@ozdao/prometheus-framework 0.2.68 → 0.2.70

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. package/package.json +1 -1
  2. package/src/components/ButtonSegmented/ButtonSegmented.vue +78 -0
  3. package/src/components/Completion/Completion.vue +76 -0
  4. package/src/components/Feed/Feed.vue +46 -18
  5. package/src/components/Tab/Tab.vue +11 -30
  6. package/src/modules/auth/components/pages/Invite.vue +1 -1
  7. package/src/modules/auth/controllers/auth.controller.js +10 -21
  8. package/src/modules/backoffice/router/backoffice.js +3 -3
  9. package/src/modules/events/components/elements/ButtonCheck.vue +15 -15
  10. package/src/modules/events/components/pages/EditEventTickets.vue +39 -13
  11. package/src/modules/events/components/pages/Event.vue +1 -2
  12. package/src/modules/events/controllers/tickets.controller.js +151 -98
  13. package/src/modules/events/controllers/utils/templateEmail.js +14 -0
  14. package/src/modules/events/controllers/utils/templateTicket.js +194 -0
  15. package/src/modules/events/router/events.js +3 -0
  16. package/src/modules/events/store/tickets.js +2 -2
  17. package/src/modules/globals/controllers/utils/queryProcessor.js +31 -6
  18. package/src/modules/globals/utils/mailing.js +19 -12
  19. package/src/modules/icons/entities/IconEvents.vue +7 -2
  20. package/src/modules/landing/components/pages/Home.vue +1 -1
  21. package/src/modules/orders/components/blocks/CardOrder.vue +1 -1
  22. package/src/modules/orders/components/blocks/CardOrderVar1.vue +97 -0
  23. package/src/modules/orders/components/pages/{FormOrder.vue → OrderCreate.vue} +20 -11
  24. package/src/modules/orders/components/pages/{EditOrder.vue → OrderCreateBackoffice.vue} +74 -17
  25. package/src/modules/orders/components/pages/Orders.vue +181 -70
  26. package/src/modules/orders/components/pages/Orders_refact.vue +2 -2
  27. package/src/modules/orders/components/sections/FormClientDetails.vue +24 -26
  28. package/src/modules/{applications → orders}/components/sections/SubscribeNewsletter.vue +1 -1
  29. package/src/modules/orders/controllers/orders.controller.js +46 -7
  30. package/src/modules/orders/models/customer.model.js +31 -0
  31. package/src/modules/orders/models/order.model.js +8 -13
  32. package/src/modules/orders/orders.client.js +67 -0
  33. package/src/modules/orders/orders.server.js +15 -0
  34. package/src/modules/orders/router/orders.router.js +1 -1
  35. package/src/modules/orders/store/orders.js +17 -2
  36. package/src/modules/users/components/pages/Profile.vue +6 -4
  37. package/src/modules/users/components/sections/ProfileCompletion.vue +30 -15
  38. package/src/modules/users/controllers/users.controller.js +0 -2
  39. package/src/modules/users/models/user.model.js +6 -5
  40. package/src/modules/users/users.server.js +1 -0
  41. package/src/styles/base/borders.scss +5 -2
  42. package/src/styles/config.scss +3 -4
  43. package/src/modules/applications/applications.client.js +0 -1
  44. package/src/modules/orders/components/blocks/Positions.vue +0 -177
  45. package/src/modules/users/models/client.model.js +0 -60
  46. /package/src/modules/{applications → orders}/controllers/applications.controller.js +0 -0
  47. /package/src/modules/{testimonials → orders}/controllers/testimonials.controller.js +0 -0
  48. /package/src/modules/{applications → orders}/models/application.model.js +0 -0
  49. /package/src/modules/{testimonials → orders}/models/testimonial.model.js +0 -0
  50. /package/src/modules/{applications → orders}/routes/applications.routes.js +0 -0
  51. /package/src/modules/{testimonials → orders}/routes/testimonials.routes.js +0 -0
  52. /package/src/modules/{applications → orders}/store/applications.js +0 -0
  53. /package/src/modules/{testimonials → orders}/store/testimonials.js +0 -0
  54. /package/src/modules/{payments → wallet}/components/pages/Payments.vue +0 -0
  55. /package/src/modules/{payments → wallet}/controllers/payments.controller.js +0 -0
  56. /package/src/modules/{payments → wallet}/controllers/payments.tinkoff.controller.js +0 -0
  57. /package/src/modules/{payments → wallet}/models/payment.model.js +0 -0
  58. /package/src/modules/{payments → wallet}/models/payment.tinkoff.model.js +0 -0
  59. /package/src/modules/{payments → wallet}/routes/payments.routes.js +0 -0
  60. /package/src/modules/{payments → wallet}/routes/payments.tinkoff.routes.js +0 -0
  61. /package/src/modules/{payments → wallet}/store/payments.js +0 -0
@@ -3,22 +3,29 @@ require('dotenv').config();
3
3
  const nodemailer = require('nodemailer');
4
4
  const axios = require('axios');
5
5
 
6
- async function sendEmail(to, subject, text) {
6
+ async function sendEmail(to, subject, text, files=[]) {
7
7
  const transporter = nodemailer.createTransport({
8
8
  host: process.env.SMTP_HOST,
9
9
  port: process.env.SMTP_PORT,
10
- secure: process.env.SMTP_SECURE,
10
+ secure: process.env.SMTP_SECURE === 'true', // Ensure the secure option is a boolean
11
11
  auth: {
12
12
  user: process.env.SMTP_USER,
13
13
  pass: process.env.SMTP_PASSWORD
14
14
  }
15
15
  });
16
16
 
17
+ // Prepare the attachments array from the file paths
18
+ const attachments = files.map(file => ({
19
+ filename: file.split('/').pop(), // Extract filename from path
20
+ path: file // Full path to the file
21
+ }));
22
+
17
23
  const mailOptions = {
18
24
  from: `${process.env.SMTP_NAME} <${process.env.SMTP_EMAIL}>`,
19
25
  to: to,
20
26
  subject: subject,
21
- text: text
27
+ text: text,
28
+ attachments: attachments // Add attachments to mail options
22
29
  };
23
30
 
24
31
  try {
@@ -52,15 +59,15 @@ async function sendChatMessageTelegram(chatIds, text) {
52
59
  const telegramUrl = `https://api.telegram.org/bot${telegramToken}/sendMessage`;
53
60
 
54
61
  // Создание кнопок
55
- const inlineKeyboard = JSON.stringify({
56
- inline_keyboard: [
57
- [
58
- { text: 'Confirm', callback_data: `confirm_${application._id}` },
59
- { text: 'Lost', callback_data: `lost_${application._id}` },
60
- { text: 'Delete', callback_data: `delete_${application._id}` }
61
- ]
62
- ]
63
- });
62
+ // const inlineKeyboard = JSON.stringify({
63
+ // inline_keyboard: [
64
+ // [
65
+ // { text: 'Confirm', callback_data: `confirm_${application._id}` },
66
+ // { text: 'Lost', callback_data: `lost_${application._id}` },
67
+ // { text: 'Delete', callback_data: `delete_${application._id}` }
68
+ // ]
69
+ // ]
70
+ // });
64
71
 
65
72
  try {
66
73
  // Отправка сообщения каждому чату из массива
@@ -1,9 +1,14 @@
1
1
  <template>
2
2
  <svg width="80" height="80" viewBox="0 0 80 80" fill="none" xmlns="http://www.w3.org/2000/svg">
3
- <path d="M12 66V32H68V66C68 69.25 65.25 72 62 72H18C14.75 72 12 69.25 12 66ZM52 42V46C52 47.125 52.875 48 54 48H58C59.125 48 60 47.125 60 46V42C60 40.875 59.125 40 58 40H54C52.875 40 52 40.875 52 42ZM52 58V62C52 63.125 52.875 64 54 64H58C59.125 64 60 63.125 60 62V58C60 56.875 59.125 56 58 56H54C52.875 56 52 56.875 52 58ZM36 42V46C36 47.125 36.875 48 38 48H42C43.125 48 44 47.125 44 46V42C44 40.875 43.125 40 42 40H38C36.875 40 36 40.875 36 42ZM36 58V62C36 63.125 36.875 64 38 64H42C43.125 64 44 63.125 44 62V58C44 56.875 43.125 56 42 56H38C36.875 56 36 56.875 36 58ZM20 42V46C20 47.125 20.875 48 22 48H26C27.125 48 28 47.125 28 46V42C28 40.875 27.125 40 26 40H22C20.875 40 20 40.875 20 42ZM20 58V62C20 63.125 20.875 64 22 64H26C27.125 64 28 63.125 28 62V58C28 56.875 27.125 56 26 56H22C20.875 56 20 56.875 20 58ZM62 16C65.25 16 68 18.75 68 22V28H12V22C12 18.75 14.75 16 18 16H24V10C24 8.875 24.875 8 26 8H30C31.125 8 32 8.875 32 10V16H48V10C48 8.875 48.875 8 50 8H54C55.125 8 56 8.875 56 10V16H62Z" fill="rgb(var(--white))"/>
3
+ <path :fill="fill" :class="$attrs.class" d="M12 66V32H68V66C68 69.25 65.25 72 62 72H18C14.75 72 12 69.25 12 66ZM52 42V46C52 47.125 52.875 48 54 48H58C59.125 48 60 47.125 60 46V42C60 40.875 59.125 40 58 40H54C52.875 40 52 40.875 52 42ZM52 58V62C52 63.125 52.875 64 54 64H58C59.125 64 60 63.125 60 62V58C60 56.875 59.125 56 58 56H54C52.875 56 52 56.875 52 58ZM36 42V46C36 47.125 36.875 48 38 48H42C43.125 48 44 47.125 44 46V42C44 40.875 43.125 40 42 40H38C36.875 40 36 40.875 36 42ZM36 58V62C36 63.125 36.875 64 38 64H42C43.125 64 44 63.125 44 62V58C44 56.875 43.125 56 42 56H38C36.875 56 36 56.875 36 58ZM20 42V46C20 47.125 20.875 48 22 48H26C27.125 48 28 47.125 28 46V42C28 40.875 27.125 40 26 40H22C20.875 40 20 40.875 20 42ZM20 58V62C20 63.125 20.875 64 22 64H26C27.125 64 28 63.125 28 62V58C28 56.875 27.125 56 26 56H22C20.875 56 20 56.875 20 58ZM62 16C65.25 16 68 18.75 68 22V28H12V22C12 18.75 14.75 16 18 16H24V10C24 8.875 24.875 8 26 8H30C31.125 8 32 8.875 32 10V16H48V10C48 8.875 48.875 8 50 8H54C55.125 8 56 8.875 56 10V16H62Z"/>
4
4
  </svg>
5
5
  </template>
6
6
 
7
7
  <script setup>
8
-
8
+ const props = defineProps({
9
+ fill: {
10
+ type: String,
11
+ default: 'rgb(var(--black))'
12
+ }
13
+ })
9
14
  </script>
@@ -36,7 +36,7 @@
36
36
  import HeroRecommendation from '@pf/src/modules/products/components/sections/HeroRecommendation.vue'
37
37
  // Not working
38
38
  import JoinUs from '@pf/src/modules/community/components/sections/JoinUs.vue'
39
- import SubscribeNewsletter from '@pf/src/modules/applications/components/sections/SubscribeNewsletter.vue'
39
+ import SubscribeNewsletter from '@pf/src/modules/orders/components/sections/SubscribeNewsletter.vue'
40
40
  // import HeroSection from '@pf/src/modules/landing/components/sections/HeroSection.vue'
41
41
  // import HowItWorksSection from '@pf/src/modules/landing/components/sections/HowItWorksSection.vue'
42
42
  import MapSection from '@pf/src/modules/landing/components/sections/MapSection.vue'
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="pd-big mn-regular order-client-card col">
2
+ <div class="pd-big mn-regular order-customer-card col">
3
3
  <p class="mn-regular flex-center flex-nowrap flex w-100">
4
4
  <!-- <img v-if="order.status === 'Created'" class="mn-r-small" src="@/assets/icons/status/created.svg"/>
5
5
  <img v-if="order.status === 'Confirmed'" class="mn-r-small" src="@/assets/icons/status/confirmed.svg"/>
@@ -0,0 +1,97 @@
1
+ <router-link
2
+ v-for="order in orders.state.all"
3
+ :to="{
4
+ name: 'Order Edit',
5
+ params: {
6
+ order: order._id
7
+
8
+ }
9
+ }"
10
+ class="bg-grey pd-medium radius-big"
11
+ >
12
+ <CardHeader
13
+ :entity="order"
14
+ :entityType="'order'"
15
+ :user="auth.state.user"
16
+ :owner="order.creator"
17
+ :creator="order.creator"
18
+ :date="order.createdAt"
19
+ class="mn-b-thin"
20
+ />
21
+
22
+
23
+ <div class="mn-b-thin w-100 bg-white radius-small pd-small spoiler">
24
+ <div @click="spoiler = !spoiler" class="flex-v-center flex">
25
+
26
+ Order: #{{order._id}}
27
+
28
+ <span
29
+ class="flex-child flex-child-shrink-0 capitalize w-max mn-r-thin t-medium radius-big pd-b-nano pd-t-nano pd-r-thin pd-l-thin bg-main"
30
+ >
31
+ {{order.status}}
32
+ </span>
33
+
34
+ </div>
35
+
36
+
37
+ </div>
38
+
39
+
40
+
41
+ <div class="mn-b-thin w-100 bg-white radius-small pd-small spoiler">
42
+ <div @click="spoiler = !spoiler" class="flex-v-center flex">
43
+
44
+ customer: {{order.customer.target}}
45
+
46
+ </div>
47
+
48
+
49
+ </div>
50
+
51
+ <div class="w-100 bg-white radius-small pd-small">
52
+
53
+ <span class="flex-child flex-child-shrink-0">
54
+ Positions {{order.positions.length}} <a class="t-main mn-r-auto">Check Leftover</a>
55
+ </span>
56
+ <!-- <img :class="{ 'spoiler-active': spoiler }" class="button-icon" src="@/assets/icons/arrow-down-spoiler.svg"> -->
57
+
58
+
59
+ <transition name="fade">
60
+ <div v-if="spoiler">
61
+ <div v-for="position in order.positions" class="mn-t-small w-100 mn-b-thin flex">
62
+ <div class=" w-50 flex">
63
+ <span>
64
+ {{position.name}}
65
+ </span>
66
+ <span class="mn-r-thin mn-l-thin t-transp">|</span>
67
+
68
+ <span class="w-50">
69
+ {{position.quantity}}
70
+ x
71
+ {{position.price}}
72
+ <span class="t-transp">{{returnCurrency()}}</span>
73
+ </span>
74
+
75
+ </div>
76
+
77
+ <div class="t-right w-50">
78
+
79
+ <span class="t-transp">{{position.type}}</span>
80
+ </div>
81
+ </div>
82
+ </div>
83
+ </transition>
84
+
85
+ </div>
86
+
87
+ <div class="mn-b-thin w-100 bg-white radius-small pd-small">
88
+
89
+ <span class="flex-child flex-child-shrink-0">
90
+ <span class="h4">Amount: 4 500</span>
91
+ </span>
92
+ </div>
93
+
94
+ <div v-if="order.comment" class="bg-fifth-transp-10 pd-thin">
95
+ <p class="t-truncate">Comment: {{order.comment}}</p>
96
+ </div>
97
+ </router-link>
@@ -146,7 +146,7 @@ const order = computed(() => orders.state.current)
146
146
  const user = computed(() => users.state.current)
147
147
  const cartTotalPrice = computed(() => shopcart.getters.cartTotalPrice)
148
148
  // Organization
149
- const orderOrganization = ref([])
149
+ const orderOrganization = ref({})
150
150
 
151
151
  import Radio from '@pf/src/components/Radio/Radio.vue'
152
152
 
@@ -169,13 +169,13 @@ watch(() => orders.state.current.delivery.address, async (newFilterValue, oldFil
169
169
  // Store Verification
170
170
  /////////////////////////////
171
171
  const errorName = computed(() => {
172
- if (orders.state.current.client.name?.length < 2) { return true } else { return false }
172
+ if (orders.state.current.customer.name?.length < 2) { return true } else { return false }
173
173
  });
174
174
 
175
175
  const errorPhoneOrMessenger = computed(() => {
176
- const hasMessengerType = orders.state.current.client.messenger?.type;
177
- const hasMessengerValue = orders.state.current.client.messenger?.value?.length > 2;
178
- const hasPhone = orders.state.current.client.number?.length > 0;
176
+ const hasMessengerType = orders.state.current.customer.messenger?.type;
177
+ const hasMessengerValue = orders.state.current.customer.messenger?.value?.length > 2;
178
+ const hasPhone = orders.state.current.customer.number?.length > 0;
179
179
  // Ошибка, если нет ни номера телефона, ни корректного типа и значения мессенджера
180
180
  return !hasPhone && !(hasMessengerType && hasMessengerValue);
181
181
  });
@@ -199,19 +199,28 @@ const errorPayment = computed(() => {
199
199
  async function handleCreate() {
200
200
 
201
201
  orders.state.current.status = 'created';
202
- orders.state.current.delivery.type = 'courier'
203
202
 
204
203
  orders.state.current.owner = {
205
- target: orderOrganization.value._id,
204
+ target: orderOrganization.value[0]._id,
206
205
  type: 'organization'
207
206
  }
208
207
 
209
- orders.state.current.creator = {
210
- target: auth.state.user._id,
211
- type: 'user'
208
+ if (auth.state.user._id) {
209
+ orders.state.current.creator = {
210
+ target: auth.state.user._id,
211
+ type: 'user'
212
+ }
212
213
  }
213
214
 
214
- let order = await orders.actions.create(shopcart.state.positions, shopcart.state.organization);
215
+ orders.state.current.positions = shopcart.state.positions
216
+
217
+ const referralCode = localStorage.getItem('referalCode');
218
+
219
+ if (referralCode) {
220
+ orders.state.current.referralCode = referralCode;
221
+ }
222
+
223
+ let order = await orders.actions.create(orders.state.current);
215
224
 
216
225
  if (order) {
217
226
  router.push({
@@ -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 {