const bookingStatusMap = status => { switch (status) { case -1: return 'Cancelled' case 0: return 'Unpaid' case 1: return 'Awaiting Confirmation' case 2: return 'Confirmed' case 3: return 'Processing' case 4: return 'Completed' default: break } } const mybookingStatusMap = status => { switch (status) { case '04': return 'Cancelled' case 'Unpaid': return 'Unpaid' case '01': return 'Awaiting Confirmation' case 'Confirmed': return 'Confirmed' case '02': return 'Processing' case '03': return 'Completed' default: break } } const supplierStatusMap = status => { switch (status) { case -1: return 'Cancelled' case 0: return 'Considering' case 1: return 'Confirmed' case 2: return 'Processing' case 3: return 'Completed' default: break } } const paymentStatusMap = status => { switch (status) { case -99: return 'Refunded' case -98: return 'Refunding' case -97: return 'Hold' case -2: return 'Expired' case -1: return 'Failure' case 0: return 'Unpaid' case 1: return 'PaidConfirming' case 2: return 'Paid' default: break } } const mypaymentStatusMap = status => { switch (status) { case '05': return 'Refunded' case '04': return 'Refunding' case 'Hold': return 'Hold' case 'Expired': return 'Expired' case 'Failure': return 'Failure' case '01': return 'Unpaid' case '02': return 'PaidConfirming' case '03': return 'Paid' default: break } } const paymentMethodMap = status => { switch (status) { case '1': return '信用卡付款' case '2': return '銀行匯款' case '3': return '現場付款' default: break } } const paymentTermMap = status => { switch (status) { case '1': return '整筆付款' default: break } } const bookingColor = status => { if (/Unpaid/.test(status)) { return "tw-text-error-default"; } if (/Failure/.test(status)) { return "tw-text-error-default"; } if (/Confirming/.test(status)) { return "tw-text-secondary-default"; } if (/Expired/.test(status)) { return "tw-text-neutrals-800"; } if (/Refunded/.test(status)) { return "tw-text-success-default"; } if (/Paid/.test(status)) { return "tw-text-success-default"; } if (/Partial Payment/.test(status)) { return "tw-text-secondary-default"; } if (/Considering/.test(status)) { return "tw-text-neutrals-800"; } if (/Confirmed/.test(status)) { return "tw-text-secondary-default"; } if (/Processing/.test(status)) { return "tw-text-secondary-default"; } if (/Completed/.test(status)) { return "tw-text-success-default"; } if (/Cancelled/.test(status)) { return "tw-text-neutrals-800"; } if (/Awaiting Confirmation/.test(status)) { return "tw-text-secondary-default"; } } export { bookingStatusMap, supplierStatusMap, paymentStatusMap, bookingColor, mybookingStatusMap, mypaymentStatusMap, paymentMethodMap, paymentTermMap }