@ozdao/prometheus-framework 0.2.67 → 0.2.69

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. package/dist/products.server.js +1 -0
  2. package/dist/products.server.mjs +1 -0
  3. package/dist/prometheus-framework/src/components/Button/Button.vue.cjs +1 -1
  4. package/dist/prometheus-framework/src/components/Button/Button.vue.js +225 -1
  5. package/dist/prometheus-framework/src/components/Button/Button.vue2.cjs +1 -1
  6. package/dist/prometheus-framework/src/components/Button/Button.vue2.js +1 -225
  7. package/dist/prometheus-framework/src/components/Field/Field.vue.cjs +1 -1
  8. package/dist/prometheus-framework/src/components/Field/Field.vue.js +84 -1
  9. package/dist/prometheus-framework/src/components/Field/Field.vue2.cjs +1 -1
  10. package/dist/prometheus-framework/src/components/Field/Field.vue2.js +1 -84
  11. package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.cjs +1 -1
  12. package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.js +1 -1
  13. package/dist/prometheus-framework/src/components/Popup/Popup.vue.cjs +1 -1
  14. package/dist/prometheus-framework/src/components/Popup/Popup.vue.js +72 -1
  15. package/dist/prometheus-framework/src/components/Popup/Popup.vue2.cjs +1 -1
  16. package/dist/prometheus-framework/src/components/Popup/Popup.vue2.js +1 -72
  17. package/dist/prometheus-framework/src/components/Select/Select.vue.cjs +1 -1
  18. package/dist/prometheus-framework/src/components/Select/Select.vue.js +97 -1
  19. package/dist/prometheus-framework/src/components/Select/Select.vue2.cjs +1 -1
  20. package/dist/prometheus-framework/src/components/Select/Select.vue2.js +1 -97
  21. package/dist/prometheus-framework/src/components/Tab/Tab.vue.cjs +1 -1
  22. package/dist/prometheus-framework/src/components/Tab/Tab.vue.js +46 -1
  23. package/dist/prometheus-framework/src/components/Tab/Tab.vue2.cjs +1 -1
  24. package/dist/prometheus-framework/src/components/Tab/Tab.vue2.js +1 -46
  25. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.cjs +1 -1
  26. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.js +3 -3
  27. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.cjs +1 -1
  28. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.js +1 -1
  29. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.cjs +1 -1
  30. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.js +3 -3
  31. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.cjs +1 -1
  32. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.js +3 -3
  33. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.cjs +1 -1
  34. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.js +3 -3
  35. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.cjs +1 -1
  36. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.js +3 -3
  37. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.cjs +1 -1
  38. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.js +3 -3
  39. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.cjs +1 -1
  40. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.js +1 -1
  41. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.cjs +1 -1
  42. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.js +3 -3
  43. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
  44. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +4 -4
  45. package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.cjs +1 -1
  46. package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.js +1 -1
  47. package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.cjs +1 -1
  48. package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.js +1 -1
  49. package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue.cjs +5 -1
  50. package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue.js +66 -0
  51. package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue2.cjs +1 -5
  52. package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue2.js +0 -66
  53. package/dist/prometheus-framework/src/modules/constructor/components/sections/Constructor.vue.cjs +1 -1
  54. package/dist/prometheus-framework/src/modules/constructor/components/sections/Constructor.vue.js +1 -1
  55. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.cjs +1 -1
  56. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.js +1 -1
  57. package/dist/prometheus-framework/src/modules/events/components/layouts/layoutEvents.vue.cjs +1 -1
  58. package/dist/prometheus-framework/src/modules/events/components/layouts/layoutEvents.vue.js +1 -1
  59. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
  60. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +4 -4
  61. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -1
  62. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.js +3 -3
  63. package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.cjs +1 -1
  64. package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.js +3 -3
  65. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
  66. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +3 -3
  67. package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.cjs +1 -1
  68. package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.js +3 -3
  69. package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.cjs +1 -1
  70. package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.js +1 -1
  71. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
  72. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +1 -1
  73. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
  74. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +2 -2
  75. package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.cjs +1 -1
  76. package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.js +4 -4
  77. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
  78. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.js +1 -1
  79. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.cjs +1 -1
  80. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.js +2 -2
  81. package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +1 -1
  82. package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +1 -1
  83. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
  84. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +5 -5
  85. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
  86. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +2 -2
  87. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
  88. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +1 -1
  89. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
  90. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +5 -5
  91. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
  92. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
  93. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
  94. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +3 -3
  95. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
  96. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +3 -3
  97. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
  98. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +5 -5
  99. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
  100. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +2 -2
  101. package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.cjs +1 -1
  102. package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.js +1 -1
  103. package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.cjs +1 -1
  104. package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.js +1 -1
  105. package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.cjs +1 -1
  106. package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.js +1 -1
  107. package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs +1 -1
  108. package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.js +1 -1
  109. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
  110. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +3 -3
  111. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
  112. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +3 -3
  113. package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.cjs +1 -1
  114. package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.js +1 -1
  115. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
  116. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +4 -4
  117. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs +1 -1
  118. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js +1 -1
  119. package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.cjs +1 -1
  120. package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.js +1 -1
  121. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
  122. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +3 -3
  123. package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
  124. package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
  125. package/dist/prometheus-framework/src/modules/products/store/leftovers.cjs +1 -1
  126. package/dist/prometheus-framework/src/modules/products/store/leftovers.js +9 -8
  127. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
  128. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +3 -3
  129. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
  130. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +2 -2
  131. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.cjs +1 -1
  132. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.js +1 -1
  133. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +1 -1
  134. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +3 -3
  135. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.cjs +1 -1
  136. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.js +1 -1
  137. package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.cjs +1 -1
  138. package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.js +3 -3
  139. package/dist/style.css +1 -1
  140. package/package.json +1 -1
  141. package/src/components/ButtonSegmented/ButtonSegmented.vue +78 -0
  142. package/src/components/Completion/Completion.vue +76 -0
  143. package/src/components/Feed/Feed.vue +46 -18
  144. package/src/components/Tab/Tab.vue +11 -30
  145. package/src/modules/auth/components/pages/Invite.vue +1 -1
  146. package/src/modules/auth/controllers/auth.controller.js +10 -21
  147. package/src/modules/backoffice/router/backoffice.js +3 -3
  148. package/src/modules/events/components/elements/ButtonCheck.vue +15 -15
  149. package/src/modules/events/components/pages/EditEventTickets.vue +39 -13
  150. package/src/modules/events/components/pages/Event.vue +1 -2
  151. package/src/modules/events/controllers/tickets.controller.js +151 -98
  152. package/src/modules/events/controllers/utils/templateEmail.js +14 -0
  153. package/src/modules/events/controllers/utils/templateTicket.js +194 -0
  154. package/src/modules/events/router/events.js +3 -0
  155. package/src/modules/events/store/tickets.js +2 -2
  156. package/src/modules/globals/controllers/utils/queryProcessor.js +31 -6
  157. package/src/modules/globals/utils/mailing.js +19 -12
  158. package/src/modules/icons/entities/IconEvents.vue +7 -2
  159. package/src/modules/landing/components/pages/Home.vue +1 -1
  160. package/src/modules/orders/components/blocks/CardOrder.vue +1 -1
  161. package/src/modules/orders/components/blocks/CardOrderVar1.vue +97 -0
  162. package/src/modules/orders/components/pages/{FormOrder.vue → OrderCreate.vue} +20 -11
  163. package/src/modules/orders/components/pages/{EditOrder.vue → OrderCreateBackoffice.vue} +74 -17
  164. package/src/modules/orders/components/pages/Orders.vue +181 -70
  165. package/src/modules/orders/components/pages/Orders_refact.vue +2 -2
  166. package/src/modules/orders/components/sections/FormClientDetails.vue +24 -26
  167. package/src/modules/{applications → orders}/components/sections/SubscribeNewsletter.vue +1 -1
  168. package/src/modules/orders/controllers/orders.controller.js +46 -7
  169. package/src/modules/orders/models/customer.model.js +31 -0
  170. package/src/modules/orders/models/order.model.js +8 -13
  171. package/src/modules/orders/orders.client.js +67 -0
  172. package/src/modules/orders/orders.server.js +15 -0
  173. package/src/modules/orders/router/orders.router.js +1 -1
  174. package/src/modules/orders/store/orders.js +17 -2
  175. package/src/modules/products/controllers/leftovers.controller.js +1 -0
  176. package/src/modules/products/store/leftovers.js +3 -2
  177. package/src/modules/users/components/pages/Profile.vue +6 -4
  178. package/src/modules/users/components/sections/ProfileCompletion.vue +30 -15
  179. package/src/modules/users/controllers/users.controller.js +0 -2
  180. package/src/modules/users/models/user.model.js +6 -5
  181. package/src/modules/users/users.server.js +1 -0
  182. package/src/styles/base/borders.scss +5 -2
  183. package/src/styles/config.scss +3 -4
  184. package/src/modules/applications/applications.client.js +0 -1
  185. package/src/modules/orders/components/blocks/Positions.vue +0 -177
  186. package/src/modules/users/models/client.model.js +0 -60
  187. /package/src/modules/{applications → orders}/controllers/applications.controller.js +0 -0
  188. /package/src/modules/{testimonials → orders}/controllers/testimonials.controller.js +0 -0
  189. /package/src/modules/{applications → orders}/models/application.model.js +0 -0
  190. /package/src/modules/{testimonials → orders}/models/testimonial.model.js +0 -0
  191. /package/src/modules/{applications → orders}/routes/applications.routes.js +0 -0
  192. /package/src/modules/{testimonials → orders}/routes/testimonials.routes.js +0 -0
  193. /package/src/modules/{applications → orders}/store/applications.js +0 -0
  194. /package/src/modules/{testimonials → orders}/store/testimonials.js +0 -0
  195. /package/src/modules/{payments → wallet}/components/pages/Payments.vue +0 -0
  196. /package/src/modules/{payments → wallet}/controllers/payments.controller.js +0 -0
  197. /package/src/modules/{payments → wallet}/controllers/payments.tinkoff.controller.js +0 -0
  198. /package/src/modules/{payments → wallet}/models/payment.model.js +0 -0
  199. /package/src/modules/{payments → wallet}/models/payment.tinkoff.model.js +0 -0
  200. /package/src/modules/{payments → wallet}/routes/payments.routes.js +0 -0
  201. /package/src/modules/{payments → wallet}/routes/payments.tinkoff.routes.js +0 -0
  202. /package/src/modules/{payments → wallet}/store/payments.js +0 -0
@@ -87,29 +87,73 @@
87
87
  </Block>
88
88
 
89
89
  <Block
90
- title="Client"
90
+ title="Customer"
91
91
  class="mn-b-semi"
92
92
  >
93
- <Field
94
- v-model:field="orders.state.current.client.name"
95
- label="Client"
96
- placeholder="Enter client name"
97
- class="bg-white pd-medium radius-small mn-b-thin"
98
- />
93
+ <div class="flex-nowrap flex">
94
+ <button class="w-100 bg-main pd-small flex-center flex uppercase t-medium">Select</button>
95
+ <button @click="openClientPopup()" class="w-100 bg-main pd-small flex-center flex uppercase t-medium">Add new</button>
96
+ </div>
97
+
98
+ </Block>
99
99
 
100
- <Field
101
- v-model:field="orders.state.current.comment"
102
- label="Comment"
103
- placeholder="Enter comment"
104
- class="bg-white pd-medium radius-small mn-b-thin"
100
+ <FormDelivery
101
+ v-if="orders.state.current.status !== true"
102
+ :order="orders.state.current"
103
+ />
104
+
105
+ <FormPayment
106
+ v-if="orders.state.current.status !== true"
107
+ :order="orders.state.current"
108
+ />
109
+
110
+ <!-- <Feed
111
+ :search="true"
112
+ :states="{
113
+ empty: {
114
+ title: 'No Products Found',
115
+ description: 'Currently, there are no such products available.'
116
+ }
117
+ }"
118
+ :store="{
119
+ read: (options) => products.actions.read(options),
120
+ state: null
121
+ }"
122
+ :options="{
123
+ organization: route.params._id
124
+ }"
125
+ v-slot="{
126
+ items
127
+ }"
128
+ class="bg-grey h-min-20r h-max-20r o-scroll"
129
+ >
130
+ <CardOrderItem
131
+ v-for="(product, index) in items" :key="product._id"
132
+ :editable="false"
133
+ :product="product"
134
+ @click="() => {
135
+ let p = { ...product };
136
+ p.quantity = 1;
137
+ globals.actions.add(orders.state.current.positions, p)
138
+ closeProductsPopup();
139
+ }"
140
+ class="bg-white pd-thin radius-medium w-100 mn-b-thin"
105
141
  />
142
+ </Feed> -->
143
+
144
+ <Popup
145
+ title="Добавить участника"
146
+ @close-popup="closeClientPopup"
147
+ :isPopupOpen="isOpenClientPopup"
148
+ class="bg-white w-min-30r w-max-30r radius-big pd-medium"
149
+ >
150
+ <h3 class="mn-b-small">Add New Client</h3>
106
151
 
107
- <!-- <FormClientDetails
152
+ <FormClientDetails
108
153
  :order="orders.state.current"
109
- class="bg-white"
110
- /> -->
111
-
112
- </Block>
154
+ class="bg-grey"
155
+ />
156
+ </Popup>
113
157
 
114
158
  <Block
115
159
  class="mn-b-semi"
@@ -140,6 +184,9 @@
140
184
  import CardPosition from '@pf/src/modules/products/components/blocks/CardPosition.vue';
141
185
 
142
186
  import FormClientDetails from '@pf/src/modules/orders/components/sections/FormClientDetails.vue'
187
+ import FormDelivery from '@pf/src/modules/orders/components/sections/FormDelivery.vue'
188
+ import FormPayment from '@pf/src/modules/orders/components/sections/FormPayment.vue'
189
+
143
190
  // Import your store
144
191
  import * as auth from '@pf/src/modules/auth/store/auth';
145
192
  import * as globals from '@pf/src/modules/globals/store/globals';
@@ -167,6 +214,16 @@
167
214
  isOpenProductsPopup.value = false;
168
215
  }
169
216
 
217
+ const isOpenClientPopup = ref(false);
218
+
219
+ function openClientPopup() {
220
+ isOpenClientPopup.value = true;
221
+ }
222
+
223
+ function closeClientPopup() {
224
+ isOpenClientPopup.value = false;
225
+ }
226
+
170
227
  // Data
171
228
  let order = ref(null)
172
229
 
@@ -1,85 +1,189 @@
1
1
  <template>
2
- <header class="mn-b-medium flex-v-center flex-nowrap flex">
3
- <h2 class="mn-r-medium">Orders</h2>
4
-
5
- <button
6
- @click="$router.push({
7
- name: 'AdminOrderAdd'
8
- })"
9
- class="radius-100 i-big hover-scale-1 cursor-pointer t-white bg-second">
10
- +
11
- </button>
12
- </header>
13
-
14
- <Tab
15
- v-model:selected="tab"
16
- :tabs="[
17
- { name: 'All', value: 'all' },
18
- { name: 'New', value: 'new' },
19
- { name: 'Confirmed', value: 'confirmed' },
20
- { name: 'Finished', value: 'finished' }
21
- ]"
22
- class="mn-b-small o-hidden h5 radius-big bg-grey"
23
- />
24
-
25
- <section
26
- class="cols-3 gap-thin"
27
- >
28
-
29
- <router-link
30
- v-for="order in orders.state.all"
31
- :to="{
32
- name: 'Order Edit',
33
- params: {
34
- order: order._id
2
+ <div class="pd-thin">
3
+ <div
4
+ class="mn-b-small bg-grey bg-grey radius-big"
5
+ >
6
+ <header class="br-b br-solid br-black-transp-10 pd-medium flex-v-center flex-nowrap flex">
7
+ <h1 class="mn-r-small">Orders</h1>
8
+
9
+
10
+
11
+ <router-link
12
+ :to="{
13
+ name: 'AdminOrderAdd'
14
+ }"
15
+ class="
16
+ radius-100
17
+ i-big
18
+ hover-scale-1
19
+ transition-ease
20
+ cursor-pointer
21
+ t-white
22
+ bg-second
23
+ flex-center
24
+ flex
25
+ "
26
+ >
27
+ +
28
+ </router-link>
29
+ </header>
30
+
31
+ <!-- <VueDatePicker
32
+ range
33
+ class="mn-b-semi"
34
+ /> -->
35
+
36
+ <Tab
37
+ v-model:selected="tab"
38
+ :tabs="[
39
+ { name: 'All', value: 'all' },
40
+ { name: 'Created', value: 'stock-in' },
41
+ { name: 'Confirmed', value: 'stock-out' },
42
+ { name: 'Preparing', value: 'stock-out' },
43
+ { name: 'Prepared', value: 'stock-out' },
44
+ { name: 'In delivery', value: 'stock-out' },
45
+ { name: 'Delivered', value: 'stock-out' },
46
+ { name: 'Closed', value: 'stock-out' }
47
+ ]"
48
+ class="w-100 t-nowrap o-scroll h5"
49
+ />
50
+ </div>
35
51
 
52
+ <Feed
53
+ :search="true"
54
+ :states="{
55
+ empty: {
56
+ title: 'No Orders Found',
57
+ description: 'Currently, there are no orders.'
36
58
  }
37
- }"
38
- class="bg-grey radius-big"
59
+ }"
60
+ :store="{
61
+ read: (options) => orders.actions.read(options)
62
+ }"
63
+ :options="{
64
+ limit: 15,
65
+ owner: route.params._id,
66
+ ...(tab !== 'all' && { type: tab })
67
+ }"
68
+ v-slot="{
69
+ items
70
+ }"
71
+ class="gap-thin cols-3"
39
72
  >
40
- <CardHeader
41
- :class="{
42
- 'mn-b-small pd-medium': type !== 'short',
43
- 'flex-child-order-last flex-child mn-l-small': type === 'short',
44
- }"
45
- :entity="order"
46
- :entityType="'order'"
47
- :user="auth.state.user"
48
- :owner="order.creator"
49
- :creator="order.creator"
50
- :date="order.createdAt"
51
- />
52
- <div class="pd-small">
53
- <p
54
- class="w-100 mn-b-thin p-big"
55
- >
56
- Order No.: #{{order._id}}
57
- </p>
58
-
59
- <span class="mn-b-thin pd-r-thin pd-l-thin pd-b-nano pd-t-nano bg-second radius-extra t-white t-medium d-block w-max uppercase">
60
- {{order.status}}
61
- </span>
62
- <p
63
- class="mn-b-small t-transp w-100"
64
- >
65
- <!-- Номер клиента: +7{{order.phone}}<br> -->
66
- </p>
73
+ <router-link
74
+ v-for="order in items"
75
+ :to="{
76
+ name: 'Order Edit',
77
+ params: {
78
+ order: order._id
67
79
 
68
- <p
69
- :class="{'new':order.status === 'Создан'}"
70
- class="mn-b-small"
80
+ }
81
+ }"
82
+ class="bg-grey pos-relative pd-medium radius-big"
71
83
  >
84
+
85
+ <CardHeader
86
+ :entity="order"
87
+ :entityType="'order'"
88
+ :user="auth.state.user"
89
+ :owner="order.creator"
90
+ :creator="order.creator"
91
+ :date="order.createdAt"
92
+ class="mn-b-small"
93
+ />
94
+
95
+ <div class="mn-b-small pd-small bg-white radius-small flex-nowrap flex">
96
+ <div class="w-100">
97
+ <h3 class="mn-b-thin">{{order.customer.target.slice(0,8)}}</h3>
98
+ <p class="t-truncate">{{order.delivery.address}}</p>
99
+ </div>
100
+
101
+ <div class=" w-100 t-right">
102
+ <h3 class="mn-b-thin">{{returnCurrency()}}{{orders.getters.getTotal(order.positions)}}</h3>
103
+ <p>#{{order._id.slice(0, 4) + '...' + order._id.slice(-4)}}</p>
104
+ </div>
105
+ </div>
72
106
 
73
- </p>
74
- </div>
75
- </router-link>
76
- </section>
107
+ <div class="cols-1 mn-b-small gap-thin pd-small bg-white radius-small">
108
+ <!-- Always display the first two positions -->
109
+ <div
110
+ v-for="(position, index) in order.positions.slice(0, 2)"
111
+ :key="index"
112
+ class="w-100 flex"
113
+ >
114
+ <p class="mn-r-auto">{{ position.name }}</p>
115
+ <p class="t-right">
116
+ {{ position.quantity }} {{ position.type }}
117
+ x
118
+ {{ position.price }}
119
+ <span class="t-transp">{{ returnCurrency() }}</span>
120
+ </p>
121
+ </div>
122
+
123
+ <transition name="fade">
124
+ <!-- Display the rest of the positions if there are more than two and spoiler is true -->
125
+ <div v-if="spoiler && order.positions.length > 2">
126
+ <div
127
+ v-for="(position, index) in order.positions.slice(2)"
128
+ :key="index + 2"
129
+ class="w-100 flex"
130
+ >
131
+ <p class="mn-r-auto">{{ position.name }}</p>
132
+ <p class="t-right">
133
+ {{ position.quantity }} {{ position.type }}
134
+ x
135
+ {{ position.price }}
136
+ <span class="t-transp">{{ returnCurrency() }}</span>
137
+ </p>
138
+ </div>
139
+ </div>
140
+ </transition>
141
+
142
+ <!-- Toggle button for additional positions, visible only if there are more than two positions -->
143
+ <button
144
+ v-if="order.positions.length > 2"
145
+ @click.prevent="spoiler = !spoiler"
146
+ class="radius-big bg-grey-transp-50 pd-nano w-100 flex-center flex"
147
+ >
148
+ {{ !spoiler ? `+${order.positions.length - 2} more` : `Hide` }}
149
+ </button>
150
+ </div>
151
+
152
+
153
+ <div class="pd-small bg-white radius-small gap-micro flex-v-center flex-nowrap flex">
154
+ <IconEvents class="i-semi t-transp" fill="rgb(var(--black)" />
155
+ <p class="t-medium mn-r-auto">16:40, 21.04</p>
156
+
157
+ <span
158
+ class="flex-child flex-child-shrink-0 capitalize w-max t-medium radius-big pd-b-nano pd-t-nano pd-r-thin pd-l-thin bg-main"
159
+ >
160
+ {{order.status}}
161
+ </span>
162
+
163
+ <span
164
+ class="flex-child flex-child-shrink-0 capitalize w-max t-medium radius-big pd-b-nano pd-t-nano pd-r-thin pd-l-thin t-white bg-red"
165
+ >
166
+ Unpaid
167
+ </span>
168
+ </div>
169
+
170
+
171
+ <div v-if="order.comment" class="pos-relative radius-small bg-fifth-transp-10 mn-t-thin pd-small">
172
+ <p class="mn-b-thin t-transp uppercase p-small t-medium">Comment</p>
173
+ <p>{{order.comment}}</p>
174
+ </div>
175
+ </router-link>
176
+ </Feed>
177
+ </div>
77
178
  </template>
78
179
 
79
180
  <script setup>
80
181
  import { computed, onMounted, reactive, ref } from 'vue';
81
182
  import { useRoute, useRouter } from 'vue-router';
82
183
 
184
+ import VueDatePicker from '@vuepic/vue-datepicker';
185
+ import '@vuepic/vue-datepicker/dist/main.css'
186
+
83
187
  import Tab from '@pf/src/components/Tab/Tab.vue'
84
188
 
85
189
  import * as orders from '@pf/src/modules/orders/store/orders';
@@ -88,12 +192,19 @@
88
192
  import CardOrder from '@pf/src/modules/orders/components/blocks/CardOrder.vue'
89
193
  import CardHeader from '@pf/src/modules/globals/components/blocks/CardHeader.vue'
90
194
 
195
+ import Feed from '@pf/src/components/Feed/Feed.vue'
196
+
197
+ import IconEvents from '@pf/src/modules/icons/entities/IconEvents.vue'
198
+
91
199
  const route = useRoute();
92
200
  const router = useRouter();
201
+
202
+ const spoiler = ref(false)
203
+
93
204
  // Tab logic
94
205
  const tab = ref(route.query.tab ? route.query.tab : 'posts')
95
206
 
96
207
  onMounted(async () => {
97
- await orders.actions.read();
208
+
98
209
  });
99
210
  </script>
@@ -18,7 +18,7 @@
18
18
  <transition @before-enter="scrollTop" name="scale">
19
19
  <div v-if="order.state.current._id === ''" >
20
20
 
21
- <section v-for="order in user.orders" class="pd-big mn-b-regular order-client-card col">
21
+ <section v-for="order in user.orders" class="pd-big mn-b-regular order-customer-card col">
22
22
  <p class="mn-b-regular flex-center flex-nowrap flex w-100">
23
23
  <img v-if="order.status === 'Создан'" class="mn-r-small" src="@/assets/icons/status/created.svg"/>
24
24
  <img v-if="order.status === 'Подтвержден'" class="mn-r-small" src="@/assets/icons/status/confirmed.svg"/>
@@ -112,7 +112,7 @@ function orderProducts (positions) {
112
112
  </script>
113
113
 
114
114
  <style lang="scss" scoped>
115
- .order-client-card {
115
+ .order-customer-card {
116
116
  background: #FBFCFD;
117
117
  }
118
118
  .order-images-wrapper {
@@ -1,51 +1,49 @@
1
1
  <template>
2
2
  <Block title="Personal Data" class="mn-b-thin">
3
3
  <Field
4
- v-model:field="order.client.name"
4
+ v-model:field="order.customer.name"
5
5
  label="Name*"
6
6
  placeholder="Enter your name"
7
7
  class="bg-white pd-medium radius-small mn-b-thin"
8
8
  />
9
-
10
- <FieldPhone
11
- v-model="order.client.phone"
12
- @country="(country) => { order.client.number = country }"
13
- :inputOptions="{
14
- placeholder: 'Enter contact phone number',
15
- type: 'tel',
16
- }"
17
- :defaultCountry="'TH'"
18
- :validCharactersOnly="true"
19
- :dropdownOptions="{
20
- showDialCodeInSelection: true,
21
- showFlags: true,
22
- showDialCodeInList: true
23
- }"
24
- mode="national"
25
- class="bg-white pd-small radius-small mn-b-thin"
26
- />
27
-
28
- <p class="mn-b-small">
29
- Prefer to chat instead of calling? Just drop your messenger info here:
30
- </p>
31
9
 
32
10
  <div class="flex-nowrap flex">
11
+
33
12
  <Select
34
13
  :options="[
14
+ {name: 'Phone', value: 'phone'},
35
15
  {name: 'Telegram', value: 'telegram'},
36
16
  {name: 'WhatsApp', value: 'whatsapp'},
37
17
  {name: 'Line', value: 'line'},
38
18
  ]"
39
- @update:select="(option) => order.client.messenger.type = option.value"
19
+ @update:select="(option) => order.customer.messenger.type = option.value"
40
20
  placeholder="Messenger"
41
21
  size="small"
42
22
  class="bg-white pd-medium radius-small mn-r-small"
43
23
  />
44
24
 
45
- <Field
46
- v-model:field="order.client.messenger.value"
25
+ <!-- <Field
26
+ v-model:field="order.customer.messenger.value"
47
27
  placeholder="Enter your contact here"
48
28
  class="bg-white pd-medium radius-small w-100"
29
+ /> -->
30
+
31
+ <FieldPhone
32
+ v-model="order.customer.phone"
33
+ @country="(country) => { order.customer.number = country }"
34
+ :inputOptions="{
35
+ placeholder: 'Enter contact phone number',
36
+ type: 'tel',
37
+ }"
38
+ :defaultCountry="'TH'"
39
+ :validCharactersOnly="true"
40
+ :dropdownOptions="{
41
+ showDialCodeInSelection: true,
42
+ showFlags: true,
43
+ showDialCodeInList: true
44
+ }"
45
+ mode="national"
46
+ class="bg-white pd-small radius-small mn-b-thin"
49
47
  />
50
48
  </div>
51
49
  </Block>
@@ -38,7 +38,7 @@ import { ref } from 'vue'
38
38
  import FieldBig from "@pf/src/components/FieldBig/FieldBig.vue";
39
39
 
40
40
  import * as globals from '@pf/src/modules/globals/store/globals.js';
41
- import * as applications from '@pf/src/modules/applications/store/applications.js';
41
+ import * as applications from '@pf/src/modules/orders/store/applications.js';
42
42
 
43
43
  import * as inputsValidation from '@pf/src/modules/middlewares/client/inputs.validation'
44
44
 
@@ -9,19 +9,21 @@ function formatPositions(positions) {
9
9
  function formatOrderMessage(order) {
10
10
  return `
11
11
  🆕 New Order Received!
12
- 👤 Client: ${order.user.name} (${order.user.phone.number ? order.user.phone.number : 'No phone'})
13
- 💬 Messenger: ${order.user.messenger ? order.user.messenger.type + ' ' + order.user.messenger.value : 'None'}
12
+ 👤 Customer: ${order.customer?.name} (${order.customer?.phone?.number ? order.customer?.phone?.number : 'No phone'})
13
+ 💬 Messenger: ${order.customer?.messenger ? order.customer?.messenger?.type + ' ' + order.customer?.messenger?.value : 'None'}
14
14
  🏢 Organization: ${order.organization}
15
15
  📦 Positions:\n${formatPositions(order.positions)}
16
16
  📝 Comment: ${order.comment ? order.comment : 'No comment'}
17
- 💳 Payment: ${order.payment.type}
18
- 🚚 Delivery: ${order.delivery.type} to ${order.delivery.address}
17
+ 💳 Payment: ${order.payment?.type}
18
+ 🚚 Delivery: ${order.delivery?.type} to ${order.delivery?.address}
19
19
  📌 Status: ${order.status}
20
+ 🧑 Agent: ${order.referralCode}
20
21
  `;
21
22
  }
22
23
 
23
24
  const controllerFactory = (db) => {
24
25
  const Order = db.order;
26
+ const Customer = db.customer;
25
27
 
26
28
  // Создание заказа
27
29
  const create = async (req, res) => {
@@ -38,8 +40,46 @@ const controllerFactory = (db) => {
38
40
  comment: ''
39
41
  });
40
42
 
43
+ console.log(req.body)
44
+
41
45
  try {
42
- // const formattedMessage = formatOrderMessage(req.body);
46
+ // Поиск или создание клиента
47
+ let searchCriteria = {};
48
+
49
+ if (req.body.customer.phone) {
50
+ searchCriteria.phone = req.body.customer.phone;
51
+ }
52
+
53
+ if (req.body.customer.email) {
54
+ searchCriteria.email = req.body.customer.email;
55
+ }
56
+
57
+ let customer = await Customer.findOne({ $or: [searchCriteria] });
58
+
59
+ if (!customer) {
60
+ customer = await Customer.create(req.body.customer);
61
+ }
62
+
63
+ // Присвоение идентификатора клиента заказу
64
+ req.body.customer = {
65
+ type: 'Customer',
66
+ target: customer._id
67
+ }
68
+
69
+ if (!req.body.creator?.target) {
70
+ req.body.creator = {
71
+ type: 'Customer',
72
+ target: customer._id
73
+ }
74
+ }
75
+
76
+ } catch (err) {
77
+ console.log(err);
78
+ return res.status(500).send({ errorCode: "CLIENT_PROCESSING_FAILED", message: "Error occurred while processing the customer.", error: err });
79
+ }
80
+
81
+ try {
82
+ const formattedMessage = formatOrderMessage(req.body);
43
83
  console.log(formattedMessage)
44
84
  const messageSent = await sendChatMessageTelegram(process.env.TELEGRAM_BOT_USERS.split(","),formattedMessage)
45
85
  } catch (err) {
@@ -56,8 +96,6 @@ const controllerFactory = (db) => {
56
96
  };
57
97
 
58
98
  const read = async (req, res) => {
59
-
60
- let stages = [];
61
99
 
62
100
  stages = [
63
101
  ...queryProcessorGlobals.getBasicOptions(
@@ -66,6 +104,7 @@ const controllerFactory = (db) => {
66
104
  // For creator
67
105
  queryProcessorGlobals.getCreatorUserLookupStage(),
68
106
  queryProcessorGlobals.getCreatorOrganizationLookupStage(),
107
+ queryProcessorGlobals.getCreatorCustomerLookupStage(),
69
108
  // For owner
70
109
  queryProcessorGlobals.getOwnerUserLookupStage(),
71
110
  queryProcessorGlobals.getOwnerOrganizationLookupStage(),
@@ -0,0 +1,31 @@
1
+ const applyOwnershipSchema = require('@pf/src/modules/globals/models/ownership.schema.js');
2
+
3
+ module.exports = (db) => {
4
+
5
+ const CustomerSchema = new db.mongoose.Schema({
6
+ // target: {
7
+ // type: {
8
+ // type: String,
9
+ // required: true
10
+ // },
11
+ // target: {
12
+ // type: db.mongoose.Schema.Types.ObjectId,
13
+ // refPath: 'target.type',
14
+ // required: true,
15
+ // },
16
+ // },
17
+ referralCode: {
18
+ type: String
19
+ }
20
+ },{
21
+ timestamps: { currentTime: () => Date.now()
22
+ }
23
+
24
+ });
25
+
26
+ // applyOwnershipSchema(CustomerSchema,db);
27
+
28
+ const Customer = db.mongoose.model("Customer", CustomerSchema);
29
+
30
+ return Customer;
31
+ }
@@ -3,31 +3,26 @@ const applyOwnershipSchema = require('@pf/src/modules/globals/models/ownership.s
3
3
  module.exports = (db) => {
4
4
 
5
5
  const OrderSchema = new db.mongoose.Schema({
6
- client: {
7
- type: {
6
+ customer: {
7
+ type: {
8
8
  type: String,
9
- trim: true
9
+ required: true
10
10
  },
11
11
  target: {
12
12
  type: db.mongoose.Schema.Types.ObjectId,
13
- refPath: 'client.type',
13
+ refPath: 'customer.type',
14
+ required: true,
14
15
  },
15
- table: { type: String, trim: true },
16
- name: { type: String, trim: true },
17
- phone: { type: Object, trim: true },
18
- email: { type: String, trim: true },
19
- messenger: {
20
- type: { type: String, trim: true },
21
- value: { type: String, trim: true }
22
- }
23
16
  },
24
17
  positions: {
25
18
  type: Array
26
19
  },
20
+ referralCode: {
21
+ type: String
22
+ },
27
23
  status: {
28
24
  type: String
29
25
  },
30
-
31
26
  status_history: [{
32
27
  status: {
33
28
  type: String,