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.

179 lines
6.0 KiB

2 years ago
  1. <template>
  2. <div
  3. class="booking-info-item xl:tw-border xl:tw-border-solid xl:tw-border-neutral-200 tw-p-[15px] tw-mb-[20px] tw-bg-white tw-rounded-xl xl:tw-p-[20px]"
  4. >
  5. <div
  6. class="tw-grid tw-grid-cols-[16%_82%] lg:tw-grid-cols-[13%_84%] tw-gap-x-2 lg:tw-gap-x-5"
  7. >
  8. <div>
  9. <nuxt-link :to="localePath('/user/booking/' + info.order_display_id)"
  10. ><img class="tw-rounded-md" :src="img"
  11. /></nuxt-link>
  12. </div>
  13. <div class="element content-text">
  14. <div class="tw-body-4 tw-py-1 tw-mb-2">
  15. <span :class="bookingColor(bookingStatusMap(info.order_status))"
  16. >{{ bookingStatusMap(info.order_status) }},&nbsp;</span
  17. >
  18. <span
  19. :class="
  20. bookingColor(
  21. paymentStatusMap(info.order_payment[0].payment_status)
  22. )
  23. "
  24. >{{ paymentStatusMap(info.order_payment[0].payment_status) }}</span
  25. >
  26. </div>
  27. <h3
  28. class="t12 tw-font-bold tw-mb-2 md:tw-text[16px] md:tw-leading-[21px]"
  29. >
  30. {{ info.service_name }}
  31. </h3>
  32. <div class="order-id tw-body-5 tw-mb-1 xl:tw-text-neutrals-800">
  33. #{{ info.order_display_id }}
  34. </div>
  35. <div class="detail tw-body-5 tw-mb-1 xl:tw-text-neutrals-800">
  36. <div v-for="(item, key) in info.order_item" :key="key">
  37. {{
  38. (item.package_name && item.package_name != ""
  39. ? item.package_name + ",&nbsp;"
  40. : "") +
  41. (item.customer_plan_name
  42. ? item.customer_plan_name + ",&nbsp;"
  43. : "") +
  44. item.specification_name +
  45. "&nbsp;x&nbsp;" +
  46. item.quantity
  47. }}
  48. </div>
  49. <div v-for="(item, key) in info.order_as" :key="key">
  50. {{ item.as_name + "&nbsp;x&nbsp;" + item.quantity }}
  51. </div>
  52. </div>
  53. <div
  54. v-if="info.service_date != null || info.service_time != null"
  55. class="service-date tw-body-5 tw-mb-1 xl:tw-text-neutrals-800"
  56. >
  57. {{ $t("Service Date:")
  58. }}{{
  59. (info.service_date != null ? info.service_date : "") +
  60. " " +
  61. (info.service_time != null ? info.service_time : "")
  62. }}
  63. </div>
  64. <div class="booking-date tw-body-5 tw-mb-2 xl:tw-text-neutrals-800">
  65. {{ $t("Booking Date:")
  66. }}{{ new Date(info.created_at).toLocaleString() }}
  67. </div>
  68. <div
  69. class="total tw-mb-[10px] md:tw-flex md:tw-justify-between md:tw-items-center"
  70. >
  71. <span class="t14 tw-font-bold tw-text-primary-1">
  72. ${{ formatTotal(info.amount) }}&nbsp;{{ info.currency }}
  73. </span>
  74. <div class="tw-mt-[10px] tw-flex">
  75. <button
  76. @click="$emit('contact-us')"
  77. class="tw-transition tw-justify-center tw-items-center tw-btn-md tw-text-primary-1 tw-border tw-border-solid tw-border-primary-1 tw-px-[30px] tw-py-[8.5px] tw-rounded-xl hover:tw-bg-primary-3 tw-hidden md:tw-flex tw-w-fit tw-h-fit tw-mr-[10px]"
  78. >
  79. {{ $t("Contact Us") }}
  80. </button>
  81. <button
  82. v-if="
  83. bookingStatusMap(info.order_status) === 'Confirmed' &&
  84. paymentStatusMap(info.order_payment[0].payment_status) ===
  85. 'Unpaid'
  86. "
  87. @click="$emit('upload-remittance-slip')"
  88. class="tw-transition tw-justify-center tw-items-center tw-btn-md tw-text-white tw-bg-primary-1 tw-px-[30px] tw-py-[8.5px] tw-rounded-xl tw-w-fit tw-h-fit"
  89. >
  90. {{ $t("Upload Remittance Slip") }}
  91. </button>
  92. <button
  93. v-if="bookingStatusMap(info.order_status) === 'Unpaid'"
  94. class="tw-transition tw-justify-center tw-items-center tw-btn-md tw-text-white tw-bg-primary-1 tw-px-[30px] tw-py-[8.5px] tw-rounded-xl tw-w-fit tw-h-fit"
  95. @click="goToPay()"
  96. >
  97. {{ $t("Go To Pay") }}
  98. </button>
  99. <button
  100. v-if="bookingStatusMap(info.order_status) === 'Completed'"
  101. class="tw-transition tw-justify-center tw-items-center tw-btn-md tw-text-white tw-bg-primary-1 tw-px-[30px] tw-py-[8.5px] tw-rounded-xl tw-w-fit tw-h-fit"
  102. >
  103. {{ $t("Write a Review") }}
  104. </button>
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </template>
  111. <script>
  112. import elementTextarea from "@/components/newComponent/form/ElementTextarea";
  113. import elementPromoCode from "@/components/newComponent/form/ElementPromoCode";
  114. import elementTimePicker from "@/components/newComponent/form/ElementTimePicker";
  115. import {
  116. bookingStatusMap,
  117. paymentStatusMap,
  118. bookingColor,
  119. } from "@/plugins/util.js";
  120. export default {
  121. components: {
  122. elementTextarea,
  123. elementPromoCode,
  124. elementTimePicker,
  125. },
  126. props: {
  127. info: {
  128. type: Object,
  129. },
  130. active: {
  131. type: Number,
  132. },
  133. },
  134. data() {
  135. return {
  136. apiUrl: process.env.SERVICE_CONSOLE,
  137. img:"",
  138. };
  139. },
  140. computed: {
  141. activeLabel() {
  142. return this.active;
  143. },
  144. formatTotal() {
  145. return function (total) {
  146. return total.toLocaleString("en-US");
  147. };
  148. },
  149. },
  150. mounted() {
  151. this.getServiceData(this.info);
  152. },
  153. methods: {
  154. onLabelClick(label) {
  155. this.$emit("changeActiveLabel", label);
  156. },
  157. bookingStatusMap,
  158. paymentStatusMap,
  159. bookingColor,
  160. goToPay() {
  161. this.$router.push(
  162. this.localePath("/service/rePay/" + this.info.order_display_id)
  163. );
  164. },
  165. async getServiceData(object) {
  166. this.$axios
  167. .get(
  168. `${this.apiUrl}/user-services/content?service_id=${object.service_id}&lang_code=${this.$i18n.localeProperties["langQuery"]}&currency=${object.currency}`
  169. )
  170. .then((res) => {
  171. this.img = res.data.preview_image;
  172. console.log(this.img);
  173. })
  174. .catch((error) => console.log(error));
  175. },
  176. },
  177. };
  178. </script>
  179. <style lang="scss" scoped></style>