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 '04': return 'Refunded' case 'Refunding': 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 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 }