You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

138 lines
3.0 KiB

2 years ago
2 years ago
2 years ago
2 years ago
  1. const bookingStatusMap = status => {
  2. switch (status) {
  3. case -1:
  4. return 'Cancelled'
  5. case 0:
  6. return 'Unpaid'
  7. case 1:
  8. return 'Awaiting Confirmation'
  9. case 2:
  10. return 'Confirmed'
  11. case 3:
  12. return 'Processing'
  13. case 4:
  14. return 'Completed'
  15. default:
  16. break
  17. }
  18. }
  19. const mybookingStatusMap = status => {
  20. switch (status) {
  21. case '04':
  22. return 'Cancelled'
  23. case 'Unpaid':
  24. return 'Unpaid'
  25. case '01':
  26. return 'Awaiting Confirmation'
  27. case 'Confirmed':
  28. return 'Confirmed'
  29. case '02':
  30. return 'Processing'
  31. case '03':
  32. return 'Completed'
  33. default:
  34. break
  35. }
  36. }
  37. const supplierStatusMap = status => {
  38. switch (status) {
  39. case -1:
  40. return 'Cancelled'
  41. case 0:
  42. return 'Considering'
  43. case 1:
  44. return 'Confirmed'
  45. case 2:
  46. return 'Processing'
  47. case 3:
  48. return 'Completed'
  49. default:
  50. break
  51. }
  52. }
  53. const paymentStatusMap = status => {
  54. switch (status) {
  55. case -99:
  56. return 'Refunded'
  57. case -98:
  58. return 'Refunding'
  59. case -97:
  60. return 'Hold'
  61. case -2:
  62. return 'Expired'
  63. case -1:
  64. return 'Failure'
  65. case 0:
  66. return 'Unpaid'
  67. case 1:
  68. return 'PaidConfirming'
  69. case 2:
  70. return 'Paid'
  71. default:
  72. break
  73. }
  74. }
  75. const mypaymentStatusMap = status => {
  76. switch (status) {
  77. case '04':
  78. return 'Refunded'
  79. case 'Refunding':
  80. return 'Refunding'
  81. case 'Hold':
  82. return 'Hold'
  83. case 'Expired':
  84. return 'Expired'
  85. case 'Failure':
  86. return 'Failure'
  87. case '01':
  88. return 'Unpaid'
  89. case '02':
  90. return 'PaidConfirming'
  91. case '03':
  92. return 'Paid'
  93. default:
  94. break
  95. }
  96. }
  97. const bookingColor = status => {
  98. if (/Unpaid/.test(status)) {
  99. return "tw-text-error-default";
  100. }
  101. if (/Failure/.test(status)) {
  102. return "tw-text-error-default";
  103. }
  104. if (/Confirming/.test(status)) {
  105. return "tw-text-secondary-default";
  106. }
  107. if (/Expired/.test(status)) {
  108. return "tw-text-neutrals-800";
  109. }
  110. if (/Refunded/.test(status)) {
  111. return "tw-text-success-default";
  112. }
  113. if (/Paid/.test(status)) {
  114. return "tw-text-success-default";
  115. }
  116. if (/Partial Payment/.test(status)) {
  117. return "tw-text-secondary-default";
  118. }
  119. if (/Considering/.test(status)) {
  120. return "tw-text-neutrals-800";
  121. }
  122. if (/Confirmed/.test(status)) {
  123. return "tw-text-secondary-default";
  124. }
  125. if (/Processing/.test(status)) {
  126. return "tw-text-secondary-default";
  127. }
  128. if (/Completed/.test(status)) {
  129. return "tw-text-success-default";
  130. }
  131. if (/Cancelled/.test(status)) {
  132. return "tw-text-neutrals-800";
  133. }
  134. if (/Awaiting Confirmation/.test(status)) {
  135. return "tw-text-secondary-default";
  136. }
  137. }
  138. export { bookingStatusMap, supplierStatusMap, paymentStatusMap, bookingColor, mybookingStatusMap, mypaymentStatusMap }