@ozdao/prometheus-framework 0.2.93 → 0.2.95

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. package/dist/auth.server.js +15 -14
  2. package/dist/auth.server.mjs +15 -14
  3. package/dist/main-BJvlNekm.mjs +13631 -0
  4. package/dist/main-pGo7JpSP.js +92 -0
  5. package/dist/orders.server.js +31 -27
  6. package/dist/orders.server.mjs +31 -27
  7. package/dist/organizations.server.js +31 -10
  8. package/dist/organizations.server.mjs +31 -10
  9. package/dist/prometheus-framework/src/components/Block/Block.vue.cjs +1 -1
  10. package/dist/prometheus-framework/src/components/Block/Block.vue.js +1 -1
  11. package/dist/prometheus-framework/src/components/EditImages/EditImages.vue.js +19 -19
  12. package/dist/prometheus-framework/src/components/Popup/Popup.vue.js +12 -12
  13. package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue.cjs +1 -1
  14. package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue.js +36 -1
  15. package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue2.cjs +1 -1
  16. package/dist/prometheus-framework/src/components/Spoiler/Spoiler.vue2.js +1 -36
  17. package/dist/prometheus-framework/src/components/Upload/Upload.vue.js +21 -21
  18. package/dist/prometheus-framework/src/modules/auth/router/auth.cjs +1 -1
  19. package/dist/prometheus-framework/src/modules/auth/router/auth.js +4 -0
  20. package/dist/prometheus-framework/src/modules/backoffice/router/backoffice.cjs +1 -1
  21. package/dist/prometheus-framework/src/modules/backoffice/router/backoffice.js +8 -8
  22. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
  23. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +58 -58
  24. package/dist/prometheus-framework/src/modules/icons/navigation/IconCross.vue.cjs +1 -1
  25. package/dist/prometheus-framework/src/modules/icons/navigation/IconCross.vue.js +22 -21
  26. package/dist/prometheus-framework/src/modules/orders/components/blocks/StatusHistory.vue.cjs +2 -2
  27. package/dist/prometheus-framework/src/modules/orders/components/blocks/StatusHistory.vue.js +48 -37
  28. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +1 -1
  29. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderBackoffice.vue.js +160 -167
  30. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
  31. package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +49 -48
  32. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
  33. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.js +113 -110
  34. package/dist/prometheus-framework/src/modules/orders/components/partials/ShopCart.vue.js +14 -14
  35. package/dist/prometheus-framework/src/modules/orders/store/models/order.cjs +1 -0
  36. package/dist/prometheus-framework/src/modules/orders/store/models/order.js +28 -0
  37. package/dist/prometheus-framework/src/modules/orders/store/orders.cjs +1 -1
  38. package/dist/prometheus-framework/src/modules/orders/store/orders.js +25 -43
  39. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +1 -1
  40. package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.js +20 -20
  41. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.cjs +1 -1
  42. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.js +1 -1
  43. package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.cjs +1 -1
  44. package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.js +1 -1
  45. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
  46. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +47 -47
  47. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
  48. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +143 -131
  49. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
  50. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +1 -1
  51. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
  52. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +1 -1
  53. package/dist/prometheus-framework/src/modules/organizations/organizations.client.cjs +1 -1
  54. package/dist/prometheus-framework/src/modules/organizations/organizations.client.js +32 -34
  55. package/dist/prometheus-framework/src/modules/organizations/router/members.router.cjs +1 -1
  56. package/dist/prometheus-framework/src/modules/organizations/router/members.router.js +1 -1
  57. package/dist/prometheus-framework/src/modules/organizations/store/departments.cjs +1 -1
  58. package/dist/prometheus-framework/src/modules/organizations/store/departments.js +1 -1
  59. package/dist/prometheus-framework/src/modules/organizations/store/memberships.cjs +1 -1
  60. package/dist/prometheus-framework/src/modules/organizations/store/memberships.js +30 -32
  61. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
  62. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +155 -187
  63. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
  64. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +18 -18
  65. package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.cjs +1 -1
  66. package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.js +1 -1
  67. package/dist/prometheus-framework/src/modules/users/components/blocks/CardUser.vue.cjs +1 -1
  68. package/dist/prometheus-framework/src/modules/users/components/blocks/CardUser.vue.js +26 -22
  69. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
  70. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +66 -63
  71. package/dist/prometheus-framework.cjs.js +1 -1
  72. package/dist/prometheus-framework.es.js +1 -1
  73. package/dist/style.css +1 -1
  74. package/dist/web-B2xhKZNK.js +1 -0
  75. package/dist/web-DTzbVshr.mjs +54 -0
  76. package/package.json +1 -1
  77. package/src/components/Block/Block.vue +1 -1
  78. package/src/modules/auth/controllers/auth.controller.js +19 -16
  79. package/src/modules/auth/router/auth.js +4 -0
  80. package/src/modules/backoffice/router/backoffice.js +3 -3
  81. package/src/modules/chats/routes/chats.routes.js +1 -2
  82. package/src/modules/gallery/components/sections/BackofficeGallery.vue +2 -1
  83. package/src/modules/icons/navigation/IconCross.vue +11 -7
  84. package/src/modules/orders/components/blocks/StatusHistory.vue +8 -11
  85. package/src/modules/orders/components/pages/OrderBackoffice.vue +37 -50
  86. package/src/modules/orders/components/pages/OrderCreateBackoffice.vue +7 -3
  87. package/src/modules/orders/components/pages/Orders.vue +1 -1
  88. package/src/modules/orders/controllers/orders.controller.js +25 -25
  89. package/src/modules/orders/models/order.model.js +1 -1
  90. package/src/modules/orders/routes/orders.routes.js +6 -0
  91. package/src/modules/orders/store/models/order.js +33 -0
  92. package/src/modules/orders/store/orders.js +7 -28
  93. package/src/modules/organizations/components/blocks/CardDepartment.vue +2 -2
  94. package/src/modules/organizations/components/pages/DepartmentEdit.vue +7 -5
  95. package/src/modules/organizations/components/pages/Members.vue +50 -38
  96. package/src/modules/organizations/components/pages/Organization.vue +1 -1
  97. package/src/modules/organizations/controllers/invites.controller.js +2 -0
  98. package/src/modules/organizations/controllers/memberships.controller.js +35 -11
  99. package/src/modules/organizations/models/invite.model.js +4 -0
  100. package/src/modules/organizations/organizations.client.js +0 -2
  101. package/src/modules/organizations/router/members.router.js +1 -1
  102. package/src/modules/organizations/store/departments.js +0 -1
  103. package/src/modules/organizations/store/memberships.js +1 -8
  104. package/src/modules/products/components/pages/ProductEdit.vue +39 -33
  105. package/src/modules/products/components/sections/EditProductInfo.vue +3 -3
  106. package/src/modules/users/components/blocks/CardUser.vue +9 -5
  107. package/src/modules/users/components/pages/Profile.vue +5 -3
  108. package/src/modules/organizations/components/blocks/DepartmentMemberModify.vue +0 -126
@@ -5,17 +5,27 @@ const controllerFactory = (db) => {
5
5
 
6
6
  const read = async (req, res) => {
7
7
  try {
8
+
9
+ let search = req.query.search;
10
+
11
+ let regexPattern = '';
12
+
13
+ if (search) {
14
+ // Экранируем специальные символы
15
+ search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
16
+
17
+ const parts = search.split('.');
18
+
19
+ if (parts.length === 2) {
20
+ // Создаем паттерн, который допускает замену одного символа в каждой части
21
+ regexPattern = parts.map(part => part.substr(0, part.length - 1) + '.{1}').join('\\.');
22
+ } else {
23
+ // Если нет точки, применяем аналогичный подход к всей строке
24
+ regexPattern = search.substr(0, search.length - 1) + '.{1}';
25
+ }
26
+ }
8
27
 
9
28
  const memberships = await Membership.aggregate([
10
- {
11
- $match: {
12
- ...(req.query.user && { user: new ObjectId(req.query.user) }),
13
- ...(req.query.type && { type: req.query.type }),
14
- ...(req.query.target && { target: new ObjectId(req.query.target) }),
15
- // ...(req.query.role && { role: req.query.role }),
16
- ...(req.query.role && { role: { $in: req.query.role } }),
17
- },
18
- },
19
29
  {
20
30
  $lookup: {
21
31
  from: 'users',
@@ -24,6 +34,21 @@ const controllerFactory = (db) => {
24
34
  as: 'user',
25
35
  },
26
36
  },
37
+ {
38
+ $match: {
39
+ ...(req.query.user && { user: new ObjectId(req.query.user) }),
40
+ ...(req.query.type && { type: req.query.type }),
41
+ ...(req.query.target && { target: new ObjectId(req.query.target) }),
42
+ ...(req.query.role && { role: { $in: req.query.role } }),
43
+ ...(req.query.search && {
44
+ $or: [
45
+ { "user.profile.name": { $regex: regexPattern, $options: 'i' } },
46
+ { "user.email": { $regex: regexPattern, $options: 'i' } },
47
+ { "user.phone": { $regex: regexPattern, $options: 'i' } }
48
+ ]
49
+ })
50
+ },
51
+ },
27
52
  {
28
53
  $unwind: '$user',
29
54
  },
@@ -32,7 +57,7 @@ const controllerFactory = (db) => {
32
57
  if (!memberships || memberships.length === 0) {
33
58
  return res.status(404).send({ errorCode: 'MEMBERSHIPS_NOT_FOUND' });
34
59
  }
35
-
60
+ console.log('membership is', memberships[0].user)
36
61
  res.send(memberships);
37
62
  } catch (err) {
38
63
  console.log(err);
@@ -42,7 +67,6 @@ const controllerFactory = (db) => {
42
67
 
43
68
  const create = async (req, res) => {
44
69
 
45
- console.log(req.body)
46
70
  const newMembership = new Membership({
47
71
  user: req.body.user,
48
72
  type: req.body.type,
@@ -13,6 +13,10 @@ module.exports = (db) => {
13
13
  enum: ['active', 'used', 'deactivated'],
14
14
  default: 'active'
15
15
  },
16
+ role: {
17
+ type: String,
18
+ default: 'member'
19
+ }
16
20
  }, {
17
21
  timestamps: true
18
22
  });
@@ -9,7 +9,6 @@ import CardOrganization from './components/blocks/CardOrganization.vue';
9
9
  import EditArray from './components/blocks/EditArray.vue';
10
10
  import Unit from './components/blocks/Unit.vue';
11
11
  import DepartmentSub from './components/blocks/DepartmentSub.vue';
12
- import DepartmentMemberModify from './components/blocks/DepartmentMemberModify.vue';
13
12
  import CardDepartment from './components/blocks/CardDepartment.vue';
14
13
  import Rating from './components/blocks/Rating.vue';
15
14
  import EmptyState from './components/blocks/EmptyState.vue';
@@ -45,7 +44,6 @@ CardOrganization,
45
44
  EditArray,
46
45
  Unit,
47
46
  DepartmentSub,
48
- DepartmentMemberModify,
49
47
  CardDepartment,
50
48
  Rating,
51
49
  EmptyState,
@@ -6,7 +6,7 @@ const membersRoutes = [{
6
6
  meta: {
7
7
  title: {
8
8
  en: 'Members',
9
- ru: 'Участникb'
9
+ ru: 'Участники'
10
10
  }
11
11
  },
12
12
  component: () => import('@pf/src/modules/organizations/components/pages/Members.vue')
@@ -87,7 +87,6 @@ const actions = {
87
87
  try {
88
88
  const response = await $axios.post(`/api/departments/${organizationId}/create`, department);
89
89
  state.error = null;
90
- state.department = response.data;
91
90
  return response.data; // Return the response data
92
91
  } catch (error) {
93
92
  setError(error);
@@ -23,15 +23,8 @@ const state = reactive({
23
23
  const actions = {
24
24
  async read(options = {}) {
25
25
 
26
- let params = {}
27
-
28
- if (options._id) params._id = options._id;
29
- if (options.user) params.user = options.user;
30
- if (options.target) params.target = options.target;
31
- if (options.role) params.role = options.role;
32
-
33
26
  try {
34
- const response = await $axios.get(`/api/memberships`, { params: params });
27
+ const response = await $axios.get(`/api/memberships`, { params: options });
35
28
  state.error = null;
36
29
  state.memberships = response.data;
37
30
  return Promise.resolve(response.data);
@@ -46,6 +46,39 @@
46
46
  />
47
47
  </Block>
48
48
 
49
+ <Block
50
+ title="Ingredients"
51
+ placeholder="No ingridients added yet"
52
+ :actions="[{
53
+ label: '+',
54
+ function: () => openIngredientPopup()
55
+ }]"
56
+ >
57
+ <div v-if="products.state.current.ingredients.length > 0" class="cols-1 gap-thin">
58
+ <CardPosition
59
+ v-for="(product, index) in products.state.current.ingredients"
60
+ :key="product._id"
61
+ :product="product"
62
+ :array="products.state.current.ingredients"
63
+ :products="Products"
64
+ @add="(item) => {
65
+ globals.actions.add(products.state.current.ingredients, item);
66
+ closeIngredientPopup();
67
+ }"
68
+ @update="(item) => {
69
+ globals.actions.update(products.state.current.ingredients, item, index);
70
+ closeIngredientPopup();
71
+ }"
72
+ @delete="(item) => {
73
+ globals.actions.delete(products.state.current.ingredients, item, index);
74
+ closeIngredientPopup();
75
+ }"
76
+ />
77
+ </div>
78
+ </Block>
79
+
80
+ </div>
81
+
49
82
  <Block
50
83
  title="Categories"
51
84
  :actions="[{
@@ -69,6 +102,7 @@
69
102
  />
70
103
  </Block>
71
104
 
105
+
72
106
  <Block
73
107
  title="Parameters"
74
108
  placeholder="No parameters added yet"
@@ -102,6 +136,7 @@
102
136
  </div>
103
137
  </Block>
104
138
 
139
+
105
140
  <Block
106
141
  title="Localization"
107
142
  placeholder="No localizations added yet"
@@ -134,9 +169,9 @@
134
169
  </div>
135
170
  </Block>
136
171
 
137
- </div>
172
+
138
173
 
139
- <Block
174
+ <!-- <Block
140
175
  title="Quantity Discount"
141
176
  class="mn-b-semi"
142
177
  :actions="[{
@@ -166,7 +201,7 @@
166
201
  />
167
202
  </div>
168
203
  </div>
169
- </Block>
204
+ </Block> -->
170
205
 
171
206
  <!-- <EditModifications
172
207
  :product="products.state.current"
@@ -188,36 +223,7 @@
188
223
  />
189
224
  </Popup>
190
225
 
191
- <Block
192
- title="Ingredients"
193
- placeholder="No positions added yet"
194
- :actions="[{
195
- label: '+',
196
- function: () => openIngredientPopup()
197
- }]"
198
- >
199
- <div class="cols-1 gap-thin">
200
- <CardPosition
201
- v-for="(product, index) in products.state.current.ingredients"
202
- :key="product._id"
203
- :product="product"
204
- :array="products.state.current.ingredients"
205
- :products="Products"
206
- @add="(item) => {
207
- globals.actions.add(products.state.current.ingredients, item);
208
- closeIngredientPopup();
209
- }"
210
- @update="(item) => {
211
- globals.actions.update(products.state.current.ingredients, item, index);
212
- closeIngredientPopup();
213
- }"
214
- @delete="(item) => {
215
- globals.actions.delete(products.state.current.ingredients, item, index);
216
- closeIngredientPopup();
217
- }"
218
- />
219
- </div>
220
- </Block>
226
+
221
227
 
222
228
  </div>
223
229
 
@@ -15,13 +15,13 @@
15
15
  <Field
16
16
  v-model:field="product.name"
17
17
  label="Name"
18
- placeholder="Введите название"
18
+ placeholder="Enter product name"
19
19
  class="w-100 mn-b-small bg-white radius-small pd-medium"
20
20
  />
21
21
  <Field
22
22
  v-model:field="product.price"
23
23
  label="Price"
24
- placeholder="Введите цену"
24
+ placeholder="Enter product price"
25
25
  class="w-100 mn-b-small bg-white radius-small pd-medium"
26
26
  type="number"
27
27
  >
@@ -39,7 +39,7 @@
39
39
  <Field
40
40
  v-model:field="product.description"
41
41
  label="Description"
42
- placeholder="Введите описание"
42
+ placeholder="Enter product description"
43
43
  class="w-100 bg-white radius-small pd-medium"
44
44
  type="textarea"
45
45
  />
@@ -30,7 +30,7 @@
30
30
  <span class=" mn-r-small">{{phone || email}}</span>
31
31
  </div>
32
32
 
33
- <div v-if="action || role" class="mn-l-auto flex-v-center flex">
33
+ <div v-if="action || role" class="mn-l-auto flex-stretch flex-v-center flex">
34
34
  <span
35
35
  v-if="role"
36
36
  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"
@@ -40,10 +40,14 @@
40
40
  <button
41
41
  v-if="action"
42
42
  @click.stop="action.method"
43
- class="h-100 w-2r t-white mn-l-thin capitalize t-medium radius-big bg-red"
44
- >
45
- {{action.label}}
46
- </button>
43
+ class="h-2r w-2r t-white mn-l-thin capitalize t-medium radius-big bg-red"
44
+ >
45
+ <component v-if="action.label.is" :is="action.label.is" v-bind="action.label.props"></component>
46
+
47
+ <template v-else>
48
+ {{action.label}}
49
+ </template>
50
+ </button>
47
51
  <!-- {{`Member since ${user.createdAt}. Invited by ${user.creator.target}`}} -->
48
52
  </div>
49
53
 
@@ -80,7 +80,7 @@
80
80
  />
81
81
 
82
82
  <img
83
- v-if="users.state.current.profile.photo.length > 0"
83
+ v-if="users.state.current.profile.photo && users.state.current.profile.photo.length > 0"
84
84
  :src="(FILE_SERVER_URL || '')+ users.state.current.profile.photo"
85
85
  class="radius-extra bg-white mn-b-small object-fit-cover i-extra"
86
86
  />
@@ -93,10 +93,11 @@
93
93
  <h3
94
94
  class="mn-b-thin"
95
95
  >
96
- {{users.state.current.profile.name ? users.state.current.profile.name : 'Not specified' }}
96
+ {{users.state.current.profile.name ? users.state.current.profile.name : 'Anonymous' }}
97
97
  </h3>
98
98
 
99
99
  <p
100
+ v-if="users.state.current.username"
100
101
  class="mn-b-thin t-main t-semi"
101
102
  >
102
103
  @{{ users.state.current.username ? users.state.current.username : 'Not specified' }}
@@ -105,7 +106,7 @@
105
106
  <p
106
107
  class="mn-b-small p-medium"
107
108
  >
108
- {{ users.state.current.profile.description ? users.state.current.profile.description : 'Not specified' }}
109
+ {{ users.state.current.profile.description ? users.state.current.profile.description : 'Bio not specified' }}
109
110
  </p>
110
111
 
111
112
  <div class="mn-b-medium flex-center flex-nowrap flex">
@@ -283,6 +284,7 @@ const handleMembershipUpdate = ({ membership, status, target }, statusName, stat
283
284
 
284
285
  function logout () {
285
286
  auth.actions.logout()
287
+
286
288
  router.push({name: 'Sign In'})
287
289
  }
288
290
  </script>
@@ -1,126 +0,0 @@
1
- <template>
2
- <div>
3
-
4
- <div class="br-grey radius-small mn-small">
5
-
6
- <div class="bg-grey mn-b-thin h-min-10r h-max-10r o-scroll pd-medium radius-big">
7
- <Feed
8
- :states="{
9
- empty: {
10
- title: 'No Members Found',
11
- description: 'Currently, there are no members available.'
12
- }
13
- }"
14
- :store="{
15
- read: (options) => memberships.actions.read(options),
16
- state: null
17
- }"
18
- :options="{
19
- target: $route.params._id
20
- }"
21
- v-slot="{
22
- items
23
- }"
24
- >
25
- <User
26
- v-for="(item, index) in items"
27
- :key="index"
28
- :photo="item.user.profile.photo"
29
- :name="item.user.profile.name || item.user.phone || item.user.email || item.user._id"
30
- :user="item"
31
- :position="item.position"
32
- @click="$router.push(`/app/profile/${user._id}`)"
33
- class="mn-b-thin"
34
- />
35
- </Feed>
36
- </div>
37
-
38
- <!-- <div v-else class="pd-small br-grey br-1px br-solid">
39
- {{ memberForm.user.name ? memberForm.user.name : 'Безымянный' }}, {{memberForm.user.id}}
40
- </div> -->
41
- <Field
42
- v-model:field="roleInput"
43
- label="Должность"
44
- placeholder="Название должности"
45
- class="bg-white "
46
- :validation="organizationName"
47
- />
48
- </div>
49
-
50
- <button :disabled="!userInput || !roleInput" @click="submitForm" class="w-100 button bg-blue t-white">
51
- {{ props.member !== null ? "Редактировать участника" : "Добавить участника" }}
52
- </button>
53
-
54
- <button v-if="props.member !== null" @click="removeMember" class="w-100 button bg-red t-white">
55
- Удалить участника
56
- </button>
57
- </div>
58
- </template>
59
-
60
- <script setup>
61
- import { ref, watch, computed } from "vue";
62
- // Import components
63
- import SelectMulti from '@pf/src/components/SelectMulti/SelectMulti.vue'
64
- import Field from "@pf/src/components/Field/Field.vue";
65
- import Select from "@pf/src/components/Select/Select.vue";
66
-
67
- import Feed from '@pf/src/components/Feed/Feed.vue'
68
- import User from '@pf/src/modules/users/components/blocks/CardUser.vue';
69
-
70
- import * as memberships from '@pf/src/modules/organizations/store/memberships'
71
-
72
- const props = defineProps({
73
- isPopupOpen: Boolean,
74
- member: Number,
75
- members: Array,
76
- users: Array,
77
- });
78
-
79
- const emits = defineEmits(['callback','remove'])
80
-
81
- const userInput = ref(null);
82
- const roleInput = ref(null);
83
-
84
- if (props.member !== null) {
85
- userInput.value = props.members[props.member]
86
- }
87
-
88
- import * as inputsValidation from '@pf/src/modules/middlewares/client/inputs.validation'
89
- const placeValidation = ref(null)
90
-
91
-
92
- async function submitForm() {
93
- if (props.member !== null) {
94
- props.members[props.member] = userInput
95
- props.members[props.member].role = roleInput.value
96
- emits("callback");
97
- } else {
98
- props.members.push({...userInput.value, role: roleInput.value});
99
- emits("callback");
100
- }
101
- }
102
-
103
- async function removeMember() {
104
- props.members.splice(props.member, 1);
105
- emits("callback");
106
- }
107
-
108
- </script>
109
-
110
- <style scoped>
111
- .form-group {
112
- margin-bottom: 1rem;
113
- }
114
-
115
- label {
116
- display: block;
117
- margin-bottom: 0.5rem;
118
- }
119
-
120
- input {
121
- width: 100%;
122
- padding: 0.5rem;
123
- border: 1px solid #ccc;
124
- border-radius: 5px;
125
- }
126
- </style>