@ozdao/prometheus-framework 0.2.65 → 0.2.67

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. package/dist/community.server.js +3 -3
  2. package/dist/community.server.mjs +2 -2
  3. package/dist/events.server.js +3 -3
  4. package/dist/events.server.mjs +2 -2
  5. package/dist/main-BDrW8oeL.mjs +13755 -0
  6. package/dist/main-CNIKtifM.js +91 -0
  7. package/dist/main.css +1 -1
  8. package/dist/metadata.schema-BLGSCSmy.mjs +55 -0
  9. package/dist/metadata.schema-DWR97jhW.js +54 -0
  10. package/dist/ownership.schema-CGqscZIi.js +159 -0
  11. package/dist/ownership.schema-DtT2IgqC.mjs +160 -0
  12. package/dist/products.server.js +50 -15
  13. package/dist/products.server.mjs +50 -15
  14. package/dist/prometheus-framework/src/components/Block/Block.vue.cjs +1 -1
  15. package/dist/prometheus-framework/src/components/Block/Block.vue.js +1 -1
  16. package/dist/prometheus-framework/src/components/Button/Button.vue.cjs +1 -1
  17. package/dist/prometheus-framework/src/components/Button/Button.vue.js +1 -225
  18. package/dist/prometheus-framework/src/components/Button/Button.vue2.cjs +1 -1
  19. package/dist/prometheus-framework/src/components/Button/Button.vue2.js +225 -1
  20. package/dist/prometheus-framework/src/components/Dropdown/Dropdown.vue.cjs +1 -1
  21. package/dist/prometheus-framework/src/components/Dropdown/Dropdown.vue.js +55 -1
  22. package/dist/prometheus-framework/src/components/Dropdown/Dropdown.vue2.cjs +1 -1
  23. package/dist/prometheus-framework/src/components/Dropdown/Dropdown.vue2.js +1 -55
  24. package/dist/prometheus-framework/src/components/Feed/Feed.vue.cjs +1 -1
  25. package/dist/prometheus-framework/src/components/Feed/Feed.vue.js +40 -39
  26. package/dist/prometheus-framework/src/components/Field/Field.vue.cjs +1 -1
  27. package/dist/prometheus-framework/src/components/Field/Field.vue.js +1 -83
  28. package/dist/prometheus-framework/src/components/Field/Field.vue2.cjs +1 -1
  29. package/dist/prometheus-framework/src/components/Field/Field.vue2.js +84 -1
  30. package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.cjs +1 -1
  31. package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.js +1 -1
  32. package/dist/prometheus-framework/src/components/Popup/Popup.vue.cjs +1 -1
  33. package/dist/prometheus-framework/src/components/Popup/Popup.vue.js +1 -72
  34. package/dist/prometheus-framework/src/components/Popup/Popup.vue2.cjs +1 -1
  35. package/dist/prometheus-framework/src/components/Popup/Popup.vue2.js +72 -1
  36. package/dist/prometheus-framework/src/components/Tab/Tab.vue.cjs +1 -1
  37. package/dist/prometheus-framework/src/components/Tab/Tab.vue.js +1 -46
  38. package/dist/prometheus-framework/src/components/Tab/Tab.vue2.cjs +1 -1
  39. package/dist/prometheus-framework/src/components/Tab/Tab.vue2.js +46 -1
  40. package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue.cjs +1 -1
  41. package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue.js +1 -45
  42. package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue2.cjs +1 -1
  43. package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue2.js +45 -1
  44. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.cjs +1 -1
  45. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.js +3 -3
  46. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.cjs +1 -1
  47. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.js +1 -1
  48. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.cjs +1 -1
  49. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.js +3 -3
  50. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.cjs +1 -1
  51. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.js +3 -3
  52. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.cjs +1 -1
  53. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.js +3 -3
  54. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.cjs +1 -1
  55. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.js +3 -3
  56. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.cjs +1 -1
  57. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.js +3 -3
  58. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.cjs +1 -1
  59. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.js +2 -2
  60. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
  61. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +3 -3
  62. package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.cjs +1 -1
  63. package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.js +1 -1
  64. package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.cjs +1 -1
  65. package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.js +1 -1
  66. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.cjs +1 -1
  67. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.js +1 -1
  68. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
  69. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +3 -3
  70. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -1
  71. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.js +3 -3
  72. package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.cjs +1 -1
  73. package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.js +10 -9
  74. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
  75. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +2 -2
  76. package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.cjs +1 -1
  77. package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.js +2 -2
  78. package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.cjs +1 -1
  79. package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.js +1 -1
  80. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
  81. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +60 -46
  82. package/dist/prometheus-framework/src/modules/globals/store/globals.cjs +1 -1
  83. package/dist/prometheus-framework/src/modules/globals/store/globals.js +5 -5
  84. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
  85. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +2 -2
  86. package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.cjs +1 -1
  87. package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.js +3 -3
  88. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
  89. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.js +1 -1
  90. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.cjs +1 -1
  91. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.js +1 -1
  92. package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +1 -1
  93. package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +1 -1
  94. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
  95. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +4 -4
  96. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
  97. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +3 -3
  98. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
  99. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +1 -1
  100. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
  101. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +4 -4
  102. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
  103. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
  104. package/dist/prometheus-framework/src/modules/organizations/components/sections/DetailsTab.vue.cjs +1 -1
  105. package/dist/prometheus-framework/src/modules/organizations/components/sections/DetailsTab.vue.js +1 -1
  106. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
  107. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +3 -3
  108. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
  109. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +2 -2
  110. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
  111. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +5 -5
  112. package/dist/prometheus-framework/src/modules/products/components/blocks/CardLeftover.vue.cjs +1 -1
  113. package/dist/prometheus-framework/src/modules/products/components/blocks/CardLeftover.vue.js +86 -56
  114. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
  115. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +1 -1
  116. package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.cjs +1 -1
  117. package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.js +1 -1
  118. package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.cjs +1 -1
  119. package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.js +1 -1
  120. package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.cjs +1 -1
  121. package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.js +1 -1
  122. package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs +1 -1
  123. package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.js +1 -1
  124. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
  125. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +2 -2
  126. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
  127. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +82 -67
  128. package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.cjs +1 -1
  129. package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.js +15 -15
  130. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
  131. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +4 -4
  132. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs +1 -1
  133. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js +1 -1
  134. package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.cjs +1 -1
  135. package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.js +1 -1
  136. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
  137. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +2 -2
  138. package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
  139. package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
  140. package/dist/prometheus-framework/src/modules/products/store/leftovers.cjs +1 -1
  141. package/dist/prometheus-framework/src/modules/products/store/leftovers.js +5 -5
  142. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
  143. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +2 -2
  144. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
  145. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +3 -3
  146. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.cjs +1 -1
  147. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.js +1 -1
  148. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +1 -1
  149. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +3 -3
  150. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.cjs +1 -1
  151. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.js +1 -1
  152. package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.cjs +1 -1
  153. package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.js +25 -24
  154. package/dist/prometheus-framework.cjs.js +1 -1
  155. package/dist/prometheus-framework.es.js +1 -1
  156. package/dist/style.css +1 -1
  157. package/dist/web-6-zYDWMA.js +1 -0
  158. package/dist/web-TZtLKurO.mjs +54 -0
  159. package/package.json +1 -1
  160. package/src/components/Feed/Feed.vue +17 -18
  161. package/src/components/Field/Field.vue +1 -0
  162. package/src/components/Tooltip/Tooltip.vue +1 -1
  163. package/src/modules/globals/components/blocks/CardHeader.vue +6 -3
  164. package/src/modules/globals/controllers/utils/queryProcessor.js +2 -1
  165. package/src/modules/globals/store/globals.js +3 -4
  166. package/src/modules/products/components/blocks/CardLeftover.vue +47 -27
  167. package/src/modules/products/components/pages/EditLeftover.vue +13 -0
  168. package/src/modules/products/components/pages/Leftovers.vue +3 -3
  169. package/src/modules/products/controllers/leftovers.controller.js +55 -19
  170. package/src/modules/products/models/leftover.model.js +4 -0
  171. package/src/modules/products/routes/leftovers.routes.js +1 -1
  172. package/src/modules/products/store/leftovers.js +1 -1
  173. package/src/styles/config.scss +2 -2
@@ -0,0 +1,54 @@
1
+ import { W as p } from "./main-BDrW8oeL.mjs";
2
+ class f extends p {
3
+ constructor() {
4
+ super(...arguments), this.group = "CapacitorStorage";
5
+ }
6
+ async configure({ group: e }) {
7
+ typeof e == "string" && (this.group = e);
8
+ }
9
+ async get(e) {
10
+ return { value: this.impl.getItem(this.applyPrefix(e.key)) };
11
+ }
12
+ async set(e) {
13
+ this.impl.setItem(this.applyPrefix(e.key), e.value);
14
+ }
15
+ async remove(e) {
16
+ this.impl.removeItem(this.applyPrefix(e.key));
17
+ }
18
+ async keys() {
19
+ return { keys: this.rawKeys().map((t) => t.substring(this.prefix.length)) };
20
+ }
21
+ async clear() {
22
+ for (const e of this.rawKeys())
23
+ this.impl.removeItem(e);
24
+ }
25
+ async migrate() {
26
+ var e;
27
+ const t = [], s = [], n = "_cap_", o = Object.keys(this.impl).filter((i) => i.indexOf(n) === 0);
28
+ for (const i of o) {
29
+ const r = i.substring(n.length), a = (e = this.impl.getItem(i)) !== null && e !== void 0 ? e : "", { value: l } = await this.get({ key: r });
30
+ typeof l == "string" ? s.push(r) : (await this.set({ key: r, value: a }), t.push(r));
31
+ }
32
+ return { migrated: t, existing: s };
33
+ }
34
+ async removeOld() {
35
+ const e = "_cap_", t = Object.keys(this.impl).filter((s) => s.indexOf(e) === 0);
36
+ for (const s of t)
37
+ this.impl.removeItem(s);
38
+ }
39
+ get impl() {
40
+ return window.localStorage;
41
+ }
42
+ get prefix() {
43
+ return this.group === "NativeStorage" ? "" : `${this.group}.`;
44
+ }
45
+ rawKeys() {
46
+ return Object.keys(this.impl).filter((e) => e.indexOf(this.prefix) === 0);
47
+ }
48
+ applyPrefix(e) {
49
+ return this.prefix + e;
50
+ }
51
+ }
52
+ export {
53
+ f as PreferencesWeb
54
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ozdao/prometheus-framework",
3
- "version": "0.2.65",
3
+ "version": "0.2.67",
4
4
  "description": "Web3 Framework focused on user experience and ease of development.",
5
5
  "author": "OZ DAO <hello@ozdao.dev>",
6
6
  "license": "GPL-3.0-or-later",
@@ -2,18 +2,20 @@
2
2
 
3
3
  <TransitionGroup tag="ul" name="scaleTransition" >
4
4
  <BlockSearch
5
- v-if="search"
6
- @search="updateSearch"
7
- placeholder="Enter product name"
8
- class="bg-white mn-b-thin"
9
- />
5
+ v-if="search"
6
+ @search="updateSearch"
7
+ placeholder="Enter product name"
8
+ class="bg-white mn-b-thin"
9
+ />
10
10
  </TransitionGroup>
11
+
11
12
  <TransitionGroup v-if="isLoading" tag="ul" name="scaleTransition" class="o-hidden bg-grey radius-big">
12
13
  <SkeletonEvent
13
14
  v-if="isLoading"
14
15
  v-for="i in currentLimit" :key="i"
15
16
  />
16
17
  </TransitionGroup>
18
+
17
19
  <transition name="scaleTransition">
18
20
  <EmptyState
19
21
  v-if="!isLoading && itemsList.length < 1"
@@ -24,8 +26,6 @@
24
26
  </transition>
25
27
 
26
28
  <TransitionGroup tag="ul" name="scaleTransition" :class="$attrs.class">
27
-
28
-
29
29
  <slot
30
30
  v-if="!isLoading && itemsList.length > 0"
31
31
  :items="itemsList"
@@ -41,7 +41,6 @@
41
41
  </button>
42
42
  </TransitionGroup>
43
43
 
44
-
45
44
  </template>
46
45
 
47
46
  <script setup>
@@ -106,6 +105,14 @@ let isLoading = ref(true);
106
105
  let currentSkip = ref(props.options.skip ? props.options.skip : 0);
107
106
  let currentLimit = ref(props.options.limit ? props.options.limit : 10);
108
107
 
108
+ let currentSearch = ref('');
109
+
110
+ function updateSearch(search) {
111
+ currentSearch.value = search
112
+
113
+ fetchItems();
114
+ }
115
+
109
116
  const loadMoreItems = async () => {
110
117
  if (hasMoreItems.value) {
111
118
  currentSkip.value += currentLimit.value;
@@ -113,6 +120,7 @@ const loadMoreItems = async () => {
113
120
  const data = await props.store.read({
114
121
  skip: currentSkip.value,
115
122
  limit: currentLimit.value,
123
+ search: currentSearch.value,
116
124
  ...props.options
117
125
  });
118
126
 
@@ -132,6 +140,7 @@ const fetchItems = async () => {
132
140
  const data = await props.store.read({
133
141
  skip: currentSkip.value,
134
142
  limit: currentLimit.value,
143
+ search: currentSearch.value,
135
144
  ...props.options
136
145
  });
137
146
 
@@ -143,8 +152,6 @@ const fetchItems = async () => {
143
152
  hasMoreItems.value = true;
144
153
  }
145
154
 
146
- console.log(data)
147
-
148
155
  itemsList.value = data;
149
156
  isLoading.value = false;
150
157
  };
@@ -164,14 +171,6 @@ watch(() => props.options, (newVal, oldVal) => {
164
171
  }
165
172
  }, { deep: true });
166
173
 
167
- function updateSearch(search) {
168
- props.options.search = search
169
-
170
- console.log(search)
171
-
172
- fetchItems();
173
- }
174
-
175
174
 
176
175
  onMounted(async () => {
177
176
  await fetchItems()
@@ -60,6 +60,7 @@
60
60
  @focus="event => emit('focus', event)"
61
61
  @blur="event => emit('blur', event)"
62
62
  class="w-100"
63
+ style="resize: vertical;"
63
64
  :value="field"
64
65
  :placeholder="placeholder"
65
66
  :tabindex="tabindex"
@@ -21,7 +21,7 @@ const visible = ref(false);
21
21
 
22
22
  const tooltipStyle = reactive({
23
23
  position: 'absolute',
24
- 'min-width': '20rem',
24
+ width: 'max-content',
25
25
  zIndex: 1000,
26
26
  background: '#333',
27
27
  color: '#fff',
@@ -35,7 +35,6 @@
35
35
  })"
36
36
  />
37
37
 
38
-
39
38
  <span
40
39
  v-if="type !== 'short'"
41
40
  class="t-semi"
@@ -62,9 +61,13 @@
62
61
  >
63
62
  · by {{creator.target?.profile?.name}}
64
63
  </span>
65
- <span v-if="date">
64
+
65
+ <span v-if="date" class="pos-relative">
66
+ <Tooltip v-if="date" :text="formatDate(date)">
66
67
  · {{getTimeElapsed(date)}}
68
+ </Tooltip>
67
69
  </span>
70
+
68
71
  <span v-if="dateFormatted">
69
72
  · {{dateFormatted}}
70
73
  </span>
@@ -182,7 +185,7 @@
182
185
 
183
186
  import PlaceholderUserpic from '@pf/src/modules/icons/placeholders/PlaceholderUserpic.vue'
184
187
  import FormReport from '@pf/src/modules/reports/components/sections/FormReport.vue'
185
-
188
+ import Tooltip from '@pf/src/components/Tooltip/Tooltip.vue'
186
189
  import Dropdown from "@pf/src/components/Dropdown/Dropdown.vue";
187
190
  import ButtonToggleMembership from '@pf/src/modules/organizations/components/elements/ButtonToggleMembership.vue'
188
191
 
@@ -2,7 +2,7 @@ const ObjectId = require('mongoose').Types.ObjectId;
2
2
 
3
3
  function getBasicOptions(query) {
4
4
  // Деструктуризация для извлечения параметров запроса
5
- const { _id, url, status, owner, creator } = query;
5
+ const { _id, url, status, type, owner, creator } = query;
6
6
 
7
7
  // Подготовка условий для каждого возможного параметра
8
8
  const conditions = [];
@@ -10,6 +10,7 @@ function getBasicOptions(query) {
10
10
  if (_id) { conditions.push({ _id: new ObjectId(_id) }); }
11
11
  if (url) { conditions.push({ url: url }); }
12
12
  if (status) { conditions.push({ status: status }); }
13
+ if (type) { conditions.push({ type: type }); }
13
14
  if (owner) { conditions.push({ "owner.target": new ObjectId(owner) }); }
14
15
  if (creator) { conditions.push({ "creator.target": new ObjectId(creator) }); }
15
16
 
@@ -66,17 +66,16 @@ const actions = {
66
66
  array[existingItemIndex] = item
67
67
  }
68
68
  },
69
-
70
69
  update(array, item) {
71
70
  const existingItemIndex = array.findIndex(i => i._id === item._id);
72
-
73
71
  if (existingItemIndex === -1) {
72
+ // If the item doesn't exist, push it to the array
74
73
  array.push(item);
75
74
  } else {
76
- array[existingItemIndex] = item;
75
+ // Update the item in the array without creating a new array
76
+ Object.assign(array[existingItemIndex], item);
77
77
  }
78
78
  },
79
-
80
79
  delete(array, item) {
81
80
  const existingItemIndex = array.findIndex(c => c._id === item._id);
82
81
 
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <div class="flex-column pos-relative flex-wrap">
3
+
3
4
  <CardHeader
4
5
  :entity="leftover"
5
6
  :entityType="'leftover'"
@@ -9,45 +10,64 @@
9
10
  :date="leftover.createdAt"
10
11
  />
11
12
 
12
- <div class="w-100 mn-b-thin flex">
13
- <p class="p-big">
14
- {{leftover.type}}
15
- </p>
13
+ <router-link
14
+ :to="{
15
+ name: 'LeftoverEdit',
16
+ params: {
17
+ _id: leftover.organization,
18
+ leftover: leftover._id
19
+ }
20
+ }"
21
+ class="
22
+ cursor-pointer
23
+ pos-absolute pos-t-regular pos-r-regular
24
+ radius-extra pd-thin bg-second
25
+ "
26
+ >
16
27
  <IconEdit
17
- @click="$router.push({
18
- name: 'LeftoverEdit',
19
- params: {
20
- _id: leftover.organization,
21
- leftover: leftover._id
22
- }
23
- })"
24
- class="pos-absolute pos-t-regular pos-r-regular i-regular t-transp"
28
+ class="i-regular"
29
+ classes="fill-white"
25
30
  />
26
- </div>
27
-
28
-
29
-
30
- <div class="w-100 bg-white radius-small pd-small spoiler">
31
- <div @click="spoiler = !spoiler" class="flex">
32
- <span>Всего товаров {{leftover.positions.length}}</span>
31
+ </router-link>
32
+
33
+ <div class="mn-t-small w-100 bg-white radius-small pd-small spoiler">
34
+ <div @click="spoiler = !spoiler" class="flex-v-center flex">
35
+ <span
36
+ 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"
37
+ :class="{
38
+ 'bg-green': leftover.type === 'stock-in',
39
+ 'bg-red': leftover.type === 'stock-out'
40
+ }"
41
+ >
42
+ {{leftover.type}}
43
+ </span>
44
+ <span class="flex-child flex-child-shrink-0">Positions {{leftover.positions.length}}</span>
45
+ <span v-if="leftover.order" class="mn-r-thin mn-l-thin t-transp">|</span>
46
+ <span class="flex-child flex-child-shrink-0" v-if="leftover.order">For order {{leftover.order}}</span>
47
+ <span v-if="leftover.comment" class="mn-r-thin mn-l-thin t-transp">|</span>
48
+ <p v-if="leftover.comment" class="t-truncate">Comment: {{leftover.comment}}</p>
33
49
  <!-- <img :class="{ 'spoiler-active': spoiler }" class="button-icon" src="@/assets/icons/arrow-down-spoiler.svg"> -->
34
50
  </div>
51
+
35
52
  <transition name="fade">
36
53
  <div v-if="spoiler">
37
54
  <div v-for="position in leftover.positions" class="mn-t-small w-100 mn-b-thin flex">
38
55
  <div class=" w-50 flex">
39
56
  <span>
40
- <!-- <span class="t-transp">Название:</span> -->
41
57
  {{position.name}}
42
58
  </span>
59
+ <span class="mn-r-thin mn-l-thin t-transp">|</span>
60
+
61
+ <span class="w-50">
62
+ {{position.price}}
63
+ <span class="t-transp">{{returnCurrency()}}</span>
64
+ </span>
65
+
43
66
  </div>
44
67
 
45
- <div class="t-right w-50 flex">
46
- <span class="w-100">
47
-
48
- {{position.quantity}}
49
- <span class="t-transp">{{declOfNum(position.quantity, ['единица', ' единицы', ' единиц'])}}</span>
50
- </span>
68
+ <div class="t-right w-50">
69
+ {{position.quantity}}
70
+ <span class="t-transp">{{position.type}}</span>
51
71
  </div>
52
72
  </div>
53
73
  </div>
@@ -76,7 +96,7 @@
76
96
  });
77
97
 
78
98
 
79
- const spoiler = ref(false)
99
+ const spoiler = ref(true)
80
100
 
81
101
  function declOfNum(number, words) {
82
102
  return words[(number % 100 > 4 && number % 100 < 20) ? 2 : [2, 0, 1, 1, 1, 2][(number % 10 < 5) ? number % 10 : 5]];
@@ -89,6 +89,19 @@
89
89
  class="mn-b-small radius-medium bg-white pd-small"
90
90
  />
91
91
  </Block>
92
+
93
+ <Block
94
+ title="Comment"
95
+ class="mn-b-semi"
96
+ >
97
+ <Field
98
+ v-model:field="leftovers.state.current.comment"
99
+ label="Comment"
100
+ type="textarea"
101
+ class="w-100 bg-white radius-small pd-medium"
102
+ />
103
+
104
+ </Block>
92
105
 
93
106
  <Block class="">
94
107
  <section class="gap-thin flex-v-center flex-nojustify flex">
@@ -12,7 +12,7 @@
12
12
  </header>
13
13
 
14
14
  <section class="mn-b-semi pd-medium bg-grey radius-big">
15
- <p class="mn-b-thin">Spended:</p>
15
+ <p class="mn-b-thin">Balance:</p>
16
16
  <h3>{{formatPrice(totalPrice)}}</h3>
17
17
  </section>
18
18
 
@@ -47,6 +47,7 @@
47
47
  />
48
48
 
49
49
  <Feed
50
+ :search="true"
50
51
  :states="{
51
52
  empty: {
52
53
  title: 'No Leftovers Found',
@@ -58,9 +59,8 @@
58
59
  }"
59
60
  :options="{
60
61
  limit: 15,
61
- organization: route.params._id,
62
+ owner: route.params._id,
62
63
  ...(tab !== 'all' && { type: tab })
63
- // user: user
64
64
  }"
65
65
  v-slot="{
66
66
  items
@@ -1,29 +1,66 @@
1
+ const queryProcessorGlobals = require('@pf/src/modules/globals/controllers/utils/queryProcessor');
2
+
1
3
  const controllerFactory = (db) => {
2
4
  const Leftover = db.leftover;
3
5
 
4
- const getAll = async (req, res) => {
6
+ const read = async (req, res) => {
5
7
  try {
6
- let query = {};
7
- let options = {};
8
8
 
9
- // Проверка наличия req.query.organization
10
- if (req.query.organization) {
11
- // Создание ObjectId из строки
12
- query.organization = new db.mongoose.Types.ObjectId(req.query.organization);
13
- }
9
+ let matchConditions = [];
10
+
11
+ const search = req.query.search;
12
+
13
+ if (search) {
14
+ const parts = search.split('.');
15
+
16
+ let regexPattern = '';
14
17
 
15
- if (req.query.type) {
16
- query.type = req.query.type;
18
+ if (parts.length === 2) {
19
+ // Создаем паттерн, который допускает замену одного символа в каждой части
20
+ regexPattern = parts.map(part => part.substr(0, part.length - 1) + '.{1}').join('\\.');
21
+ } else {
22
+ // Если нет точки, применяем аналогичный подход к всей строке
23
+ regexPattern = search.substr(0, search.length - 1) + '.{1}';
24
+ }
25
+
26
+ matchConditions.push({
27
+ $or: [
28
+ { "comment ": { $regex: regexPattern, $options: 'i' } },
29
+ { "positions.name": { $regex: regexPattern, $options: 'i' } }
30
+ ]
31
+ });
17
32
  }
18
33
 
19
- console.log(query);
34
+ const matchStage = matchConditions.length > 0 ? { $match: { $and: matchConditions } } : null;
35
+
36
+ let stages = [
37
+ ...queryProcessorGlobals.getBasicOptions(
38
+ req.query
39
+ ),
40
+ // For creator
41
+ queryProcessorGlobals.getCreatorUserLookupStage(),
42
+ queryProcessorGlobals.getCreatorOrganizationLookupStage(),
43
+ // For owner
44
+ queryProcessorGlobals.getOwnerUserLookupStage(),
45
+ queryProcessorGlobals.getOwnerOrganizationLookupStage(),
46
+ queryProcessorGlobals.getAddFieldsCreatorOwnerStage(),
20
47
 
21
- const leftoveres = await Leftover.find(query, null, options)
22
- .sort({ createdAt: "desc" })
23
- .exec();
48
+ ...(matchStage != null ? [matchStage] : []),
49
+ // Pagination
50
+ ...queryProcessorGlobals.getSortingOptions(
51
+ req.query.sortParam,
52
+ req.query.sortOrder,
53
+ ),
54
+ ...queryProcessorGlobals.getPaginationOptions(
55
+ req.query.skip,
56
+ req.query.limit
57
+ )
58
+ ];
24
59
 
25
- if (!leftoveres) {
26
- return res.status(404).send({ message: "LEFTOVERES_NOT_FOUND" });
60
+ const leftoveres = await Leftover.aggregate(stages).exec();
61
+
62
+ if (!leftoveres.length) {
63
+ return res.status(404).send({ message: "LEFTOVERES_NOT_FOUND" });
27
64
  }
28
65
 
29
66
  res.status(200).send(leftoveres);
@@ -35,8 +72,7 @@ const controllerFactory = (db) => {
35
72
 
36
73
  const create = async (req, res) => {
37
74
  try {
38
-
39
- console.log(req.body)
75
+ console.log('order is', req.body.order)
40
76
  const leftover = await Leftover.create({
41
77
  organization: req.body.organization,
42
78
  type: req.body.type,
@@ -93,7 +129,7 @@ const controllerFactory = (db) => {
93
129
  };
94
130
 
95
131
  return {
96
- getAll,
132
+ read,
97
133
  create,
98
134
  get,
99
135
  update,
@@ -15,9 +15,13 @@ module.exports = (db) => {
15
15
  order: {
16
16
  type: String
17
17
  },
18
+ comment: {
19
+ type: String
20
+ },
18
21
  store: {
19
22
  type: Object
20
23
  },
24
+
21
25
  positions: [{
22
26
  _id: {
23
27
  type: db.mongoose.Schema.Types.ObjectId,
@@ -10,7 +10,7 @@ module.exports = function(app, db) {
10
10
 
11
11
  app.get(
12
12
  "/leftovers",
13
- controller.getAll
13
+ controller.read
14
14
  );
15
15
 
16
16
 
@@ -13,7 +13,7 @@ const state = reactive({
13
13
  current: {
14
14
  organization: "",
15
15
  type: "",
16
- order: "",
16
+ order: null,
17
17
  positions: [],
18
18
  },
19
19
  });
@@ -91,8 +91,8 @@
91
91
  // Tones
92
92
  --red: 360, 70, 90;
93
93
  --red-nice: 354, 80, 100;
94
- --green: 120, 58, 70;
95
- --green-nice: 126, 70, 80;
94
+ --green: 88, 207, 57;
95
+ --green-nice: 35, 226, 0;
96
96
  --orange: 8, 72, 94;
97
97
  --orange-nice: 13, 70, 100;
98
98
  --yellow: 38, 100, 100;