@ozdao/prometheus-framework 0.2.51 → 0.2.53
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/main-0a2437f4.js +91 -0
- package/dist/main-482dc398.mjs +13626 -0
- package/dist/main-4fnApBsF.js +91 -0
- package/dist/main-b2JI9sFg.js +91 -0
- package/dist/main-c56d4c09.js +91 -0
- package/dist/main-cdd0be68.mjs +13628 -0
- package/dist/main-kjbLXQEa.mjs +13606 -0
- package/dist/main-x-9D8zvb.mjs +13604 -0
- package/dist/main.css +1 -1
- package/dist/organizations.server.js +2 -2
- package/dist/organizations.server.mjs +2 -2
- package/dist/products.server.js +81 -56
- package/dist/products.server.mjs +81 -56
- package/dist/prometheus-framework/src/components/Button/Button.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Button/Button.vue2.js +18 -20
- package/dist/prometheus-framework/src/components/Feed/Feed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Feed/Feed.vue.js +19 -19
- package/dist/prometheus-framework/src/components/Field/Field.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Field/Field.vue2.js +28 -26
- package/dist/prometheus-framework/src/components/LocationMarker/LocationMarker.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/LocationMarker/LocationMarker.vue2.js +2 -2
- package/dist/prometheus-framework/src/components/Map/Map.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Map/Map.vue.js +35 -2
- package/dist/prometheus-framework/src/components/Map/Map.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Map/Map.vue2.js +2 -35
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.js +37 -0
- package/dist/prometheus-framework/src/modules/icons/entities/IconShopcart.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/icons/entities/IconShopcart.vue.js +21 -14
- package/dist/prometheus-framework/src/modules/icons/navigation/IconSearch.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/icons/navigation/IconSearch.vue.js +24 -0
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue.js +2 -11
- package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue2.js +11 -2
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.js +49 -101
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.js +25 -25
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.js +68 -39
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/User.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/User.vue.js +38 -48
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.js +69 -62
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +131 -126
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +117 -146
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Feed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Feed.vue.js +13 -13
- package/dist/prometheus-framework/src/modules/organizations/router/products.router.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/router/products.router.js +22 -0
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue.js +45 -0
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue2.cjs +1 -0
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue2.js +4 -0
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.js +79 -0
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +193 -0
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue2.cjs +1 -0
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue2.js +4 -0
- package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +43 -43
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +65 -55
- package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js +64 -51
- package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/FilterProducts.vue.js +35 -33
- package/dist/prometheus-framework/src/modules/products/products.client.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/products.client.js +2 -2
- package/dist/prometheus-framework/src/modules/products/store/categories.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/store/categories.js +39 -27
- package/dist/prometheus-framework/src/modules/products/store/products.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/store/products.js +23 -23
- package/dist/prometheus-framework/src/modules/spots/components/blocks/CardSpot.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/blocks/CardSpot.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +1 -1
- package/dist/prometheus-framework.cjs.js +1 -1
- package/dist/prometheus-framework.es.js +1 -1
- package/dist/style.css +1 -1
- package/dist/web-0066fd51.mjs +55 -0
- package/dist/web-6b9fa713.js +1 -0
- package/dist/web-6dcbb74b.mjs +55 -0
- package/dist/web-caJAdsxy.js +1 -0
- package/dist/web-ee302c1d.js +1 -0
- package/dist/web-i08OVMw9.mjs +55 -0
- package/dist/web-ngl7bNhF.js +1 -0
- package/dist/web-t91TrxXa.mjs +55 -0
- package/package.json +1 -1
- package/src/components/Button/Button.vue +4 -6
- package/src/components/Feed/Feed.vue +2 -1
- package/src/components/Field/Field.vue +3 -1
- package/src/components/LocationMarker/LocationMarker.vue +1 -0
- package/src/modules/applications/applications.client.js +0 -1
- package/src/modules/globals/components/blocks/BlockSearch.vue +42 -0
- package/src/modules/icons/entities/IconProfile.vue +10 -1
- package/src/modules/icons/entities/IconShopcart.vue +12 -2
- package/src/modules/marketplace/components/layouts/Marketplace.vue +7 -14
- package/src/modules/marketplace/components/sections/Filters.vue +7 -1
- package/src/modules/mobile/components/NavigationBar/NavigationBar.vue +27 -7
- package/src/modules/orders/components/partials/ShopCart.vue +4 -1
- package/src/modules/organizations/components/blocks/CardDepartment.vue +34 -66
- package/src/modules/organizations/components/blocks/DepartmentMemberModify.vue +50 -13
- package/src/modules/organizations/components/blocks/User.vue +18 -9
- package/src/modules/organizations/components/pages/Department.vue +19 -3
- package/src/modules/organizations/components/pages/DepartmentEdit.vue +14 -10
- package/src/modules/organizations/components/pages/Organization.vue +38 -71
- package/src/modules/organizations/components/sections/Feed.vue +1 -1
- package/src/modules/organizations/controllers/memberships.controller.js +2 -2
- package/src/modules/organizations/controllers/organizations.controller.js +0 -1
- package/src/modules/organizations/router/products.router.js +24 -4
- package/src/modules/products/components/blocks/CardCategory.vue +53 -0
- package/src/modules/products/components/pages/Categories.vue +90 -0
- package/src/modules/products/components/pages/CategoryEdit.vue +214 -0
- package/src/modules/products/components/pages/EditLeftover.vue +6 -4
- package/src/modules/products/components/pages/ProductEdit.vue +9 -1
- package/src/modules/products/components/pages/Products.vue +58 -38
- package/src/modules/products/components/sections/FilterProducts.vue +9 -6
- package/src/modules/products/controllers/categories.controller.js +30 -13
- package/src/modules/products/controllers/leftovers.controller.js +12 -5
- package/src/modules/products/controllers/products.controller.js +18 -0
- package/src/modules/products/models/category.model.js +42 -32
- package/src/modules/products/products.client.js +4 -2
- package/src/modules/products/store/categories.js +17 -3
- package/src/modules/products/store/products.js +4 -0
- package/src/modules/backoffice/components/admin/Categories.vue +0 -53
- package/src/modules/backoffice/components/admin/CategoryEdit.vue +0 -98
- package/src/modules/products/components/blocks/CategoryCard.vue +0 -42
- package/src/modules/products/router/products.router.js +0 -48
- /package/src/modules/{products → organizations}/components/pages/OrganizationCreate.vue +0 -0
- /package/src/modules/{products → organizations}/components/pages/OrganizationDetails.vue +0 -0
- /package/src/modules/{products → organizations}/components/pages/OrganizationDocuments.vue +0 -0
- /package/src/modules/{products → organizations}/components/pages/OrganizationPeople.vue +0 -0
@@ -10,76 +10,43 @@
|
|
10
10
|
class="mn-b-semi"
|
11
11
|
/>
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
read: (options) => departments.actions.read(route.params._id),
|
51
|
-
state: null
|
52
|
-
}"
|
53
|
-
:options="{
|
54
|
-
user: auth.state.user._id,
|
55
|
-
sort: 'numberOfMemberships',
|
56
|
-
limit: 10
|
57
|
-
}"
|
58
|
-
v-slot="{
|
59
|
-
items
|
60
|
-
}"
|
61
|
-
>
|
62
|
-
<CardDepartment
|
63
|
-
v-for="(department, index) in items"
|
64
|
-
:key="index"
|
65
|
-
:department="department"
|
66
|
-
:organization="route.params._id"
|
67
|
-
class="radius-big bg-white pos-relative mn-b-thin"
|
68
|
-
/>
|
69
|
-
</Feed>
|
70
|
-
</Block>
|
71
|
-
<div>
|
72
|
-
<User
|
73
|
-
v-for="(member, index) in organization.state.current.memberships"
|
74
|
-
:key="index"
|
75
|
-
:user="member"
|
76
|
-
:position="member.position"
|
77
|
-
class="bg-grey radius-small flex-nowrap flex pd-medium"
|
78
|
-
/>
|
79
|
-
|
80
|
-
</div>
|
81
|
-
</div>
|
82
|
-
|
13
|
+
<Block
|
14
|
+
:title="`${organization.state.current.numberOfMembers} members`"
|
15
|
+
:actions="[{
|
16
|
+
label: '>',
|
17
|
+
function: () => $router.push(`/organizations/${route.params._id}/departments/create`)
|
18
|
+
}]"
|
19
|
+
class="mn-b-semi"
|
20
|
+
>
|
21
|
+
<Feed
|
22
|
+
:states="{
|
23
|
+
empty: {
|
24
|
+
title: 'No Departments Found',
|
25
|
+
description: 'Currently, there are no departments available.'
|
26
|
+
}
|
27
|
+
}"
|
28
|
+
:store="{
|
29
|
+
read: (options) => departments.actions.read(route.params._id),
|
30
|
+
state: null
|
31
|
+
}"
|
32
|
+
:options="{
|
33
|
+
user: auth.state.user._id,
|
34
|
+
sort: 'numberOfMemberships',
|
35
|
+
limit: 10
|
36
|
+
}"
|
37
|
+
v-slot="{
|
38
|
+
items
|
39
|
+
}"
|
40
|
+
>
|
41
|
+
<CardDepartment
|
42
|
+
v-for="(department, index) in items"
|
43
|
+
:key="index"
|
44
|
+
:department="department"
|
45
|
+
:organization="route.params._id"
|
46
|
+
class="radius-big bg-white pos-relative mn-b-thin"
|
47
|
+
/>
|
48
|
+
</Feed>
|
49
|
+
</Block>
|
83
50
|
|
84
51
|
<Tab
|
85
52
|
v-model:selected="tabOrganization"
|
@@ -265,7 +232,7 @@
|
|
265
232
|
route.query.tab = tabOrganization.value
|
266
233
|
|
267
234
|
watch(tabOrganization, (newValue) => {
|
268
|
-
router.replace({ query:
|
235
|
+
router.replace({ query: null});
|
269
236
|
});
|
270
237
|
</script>
|
271
238
|
|
@@ -8,9 +8,9 @@ const controllerFactory = (db) => {
|
|
8
8
|
const memberships = await Membership.aggregate([
|
9
9
|
{
|
10
10
|
$match: {
|
11
|
-
...(req.query.user && { user: req.query.user }),
|
11
|
+
...(req.query.user && { user: new ObjectId(req.query.user) }),
|
12
12
|
...(req.query.type && { type: req.query.type }),
|
13
|
-
...(req.query.target && { target: req.query.target }),
|
13
|
+
...(req.query.target && { target: new ObjectId(req.query.target) }),
|
14
14
|
...(req.query.role && { role: req.query.role }),
|
15
15
|
},
|
16
16
|
},
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import * as validationAuth from '@pf/src/modules/middlewares/client/auth.validation.js';
|
2
2
|
|
3
|
-
const productRoutes = [
|
3
|
+
const productRoutes = [
|
4
|
+
{
|
4
5
|
path: ':_id/products/:product',
|
5
6
|
name: 'Product Organization',
|
6
7
|
meta: {
|
@@ -20,6 +21,25 @@ const productRoutes = [{
|
|
20
21
|
name: 'ProductAdd',
|
21
22
|
component: () => import('@pf/src/modules/products/components/pages/ProductEdit.vue')
|
22
23
|
},{
|
24
|
+
path: ':_id/categories',
|
25
|
+
name: 'Categories Organization',
|
26
|
+
meta: {
|
27
|
+
title: {
|
28
|
+
en: 'Category',
|
29
|
+
ru: 'Категория'
|
30
|
+
}
|
31
|
+
},
|
32
|
+
component: () => import('@pf/src/modules/products/components/pages/Categories.vue')
|
33
|
+
}, {
|
34
|
+
path: ':_id/categories/add',
|
35
|
+
name: 'CategoryAdd',
|
36
|
+
component: () => import('@pf/src/modules/products/components/pages/CategoryEdit.vue')
|
37
|
+
},{
|
38
|
+
path: ':_id/categories/:category/edit',
|
39
|
+
name: 'CategoryEdit',
|
40
|
+
beforeEnter: [validationAuth.requiresAuth],
|
41
|
+
component: () => import('@pf/src/modules/products/components/pages/CategoryEdit.vue')
|
42
|
+
}, {
|
23
43
|
path: ':_id/leftovers',
|
24
44
|
name: 'Leftovers',
|
25
45
|
meta: {
|
@@ -41,8 +61,7 @@ const productRoutes = [{
|
|
41
61
|
authorize: []
|
42
62
|
},
|
43
63
|
component: () => import(/* webpackChunkName: 'LeftoverEdit' */ '@pf/src/modules/products/components/pages/EditLeftover.vue')
|
44
|
-
},
|
45
|
-
{
|
64
|
+
},{
|
46
65
|
path: ':_id/leftovers/:leftover',
|
47
66
|
name: 'LeftoverEdit',
|
48
67
|
meta: {
|
@@ -53,6 +72,7 @@ const productRoutes = [{
|
|
53
72
|
authorize: []
|
54
73
|
},
|
55
74
|
component: () => import(/* webpackChunkName: 'LeftoverEdit' */ '@pf/src/modules/products/components/pages/EditLeftover.vue')
|
56
|
-
}
|
75
|
+
}
|
76
|
+
];
|
57
77
|
|
58
78
|
export default productRoutes;
|
@@ -0,0 +1,53 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="flex-v-center flex">
|
3
|
+
<h4 class="mn-r-auto">{{category.name}}</h4>
|
4
|
+
|
5
|
+
<router-link
|
6
|
+
:to="{
|
7
|
+
name: 'CategoryEdit',
|
8
|
+
params: {
|
9
|
+
_id: route.params._id,
|
10
|
+
category: category.url
|
11
|
+
}
|
12
|
+
}"
|
13
|
+
class="mn-r-medium nav-link"
|
14
|
+
>
|
15
|
+
Edit
|
16
|
+
</router-link>
|
17
|
+
<a
|
18
|
+
class="nav-link"
|
19
|
+
@click="deleteCategory(category)"
|
20
|
+
>
|
21
|
+
Delete
|
22
|
+
</a>
|
23
|
+
</div>
|
24
|
+
</template>
|
25
|
+
|
26
|
+
|
27
|
+
<script setup>
|
28
|
+
import { toRef, onMounted, defineEmits } from 'vue';
|
29
|
+
import { useRoute, useRouter } from 'vue-router';
|
30
|
+
|
31
|
+
const props = defineProps({
|
32
|
+
category: Object,
|
33
|
+
});
|
34
|
+
|
35
|
+
const emits = defineEmits(['delete']);
|
36
|
+
|
37
|
+
const route = useRoute();
|
38
|
+
const router = useRouter();
|
39
|
+
|
40
|
+
const deleteCategory = (category) => {
|
41
|
+
emits('delete', category);
|
42
|
+
};
|
43
|
+
|
44
|
+
</script>
|
45
|
+
|
46
|
+
|
47
|
+
<style lang="scss">
|
48
|
+
.categories-card {
|
49
|
+
|
50
|
+
}
|
51
|
+
</style>
|
52
|
+
|
53
|
+
|
@@ -0,0 +1,90 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="pd-thin">
|
3
|
+
<Block class="radius-big mn-b-thin flex-nowrap flex-v-center flex">
|
4
|
+
<h1 class="mn-r-auto">
|
5
|
+
Product Categories
|
6
|
+
</h1>
|
7
|
+
|
8
|
+
<router-link
|
9
|
+
:to="{
|
10
|
+
name: 'CategoryAdd',
|
11
|
+
params: {
|
12
|
+
_id: $route.params._id
|
13
|
+
}
|
14
|
+
}"
|
15
|
+
class="mn-r-medium uppercase t-medium pd-small radius-big bg-white nav-link"
|
16
|
+
>
|
17
|
+
Add category
|
18
|
+
</router-link>
|
19
|
+
|
20
|
+
<Button
|
21
|
+
@click="updateCategoriesOrder"
|
22
|
+
class="pd-small radius-big bg-black t-white uppercase t-medium"
|
23
|
+
>
|
24
|
+
Change Order
|
25
|
+
</Button>
|
26
|
+
</Block>
|
27
|
+
|
28
|
+
<VueDraggableNext
|
29
|
+
class="dragArea list-group w-full"
|
30
|
+
:list="categories.state.all"
|
31
|
+
item-key="order"
|
32
|
+
@end="updateOrder"
|
33
|
+
>
|
34
|
+
<CardCategory
|
35
|
+
v-for="(category, index) in categories.state.all"
|
36
|
+
:key="category.id"
|
37
|
+
:category="category"
|
38
|
+
@delete="deleteCategory"
|
39
|
+
class="pd-medium bg-grey radius-medium mn-b-thin"
|
40
|
+
/>
|
41
|
+
</VueDraggableNext>
|
42
|
+
</div>
|
43
|
+
</template>
|
44
|
+
|
45
|
+
<script setup>
|
46
|
+
import { onMounted } from 'vue';
|
47
|
+
import { VueDraggableNext } from 'vue-draggable-next';
|
48
|
+
|
49
|
+
import { useRoute, useRouter } from 'vue-router';
|
50
|
+
|
51
|
+
import * as categories from '@pf/src/modules/products/store/categories';
|
52
|
+
|
53
|
+
const route = useRoute();
|
54
|
+
const router = useRouter();
|
55
|
+
|
56
|
+
import Button from "@pf/src/components/Button/Button.vue";
|
57
|
+
import Block from '@pf/src/components/Block/Block.vue';
|
58
|
+
import CardCategory from '@pf/src/modules/products/components/blocks/CardCategory.vue';
|
59
|
+
|
60
|
+
onMounted(async () => {
|
61
|
+
await categories.actions.fetchCategories();
|
62
|
+
});
|
63
|
+
|
64
|
+
function updateOrder() {
|
65
|
+
categories.state.all.forEach((category, index) => {
|
66
|
+
category.order = index;
|
67
|
+
});
|
68
|
+
updateCategoriesOrder();
|
69
|
+
}
|
70
|
+
|
71
|
+
async function updateCategoriesOrder() {
|
72
|
+
await categories.actions.updateCategories(categories.state.all);
|
73
|
+
}
|
74
|
+
|
75
|
+
async function deleteCategory(category) {
|
76
|
+
// Запрашиваем подтверждение у пользователя
|
77
|
+
const isConfirmed = confirm(`Are you sure you want to delete the category "${category.name}"?`);
|
78
|
+
|
79
|
+
// Если пользователь подтвердил удаление, продолжаем процесс
|
80
|
+
if (isConfirmed) {
|
81
|
+
await categories.actions.deleteCategory(category.url);
|
82
|
+
} else {
|
83
|
+
alert('Category deletion cancelled');
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
</script>
|
88
|
+
|
89
|
+
<style lang="scss">
|
90
|
+
</style>
|
@@ -0,0 +1,214 @@
|
|
1
|
+
<template>
|
2
|
+
<Block class="radius-big mn-b-thin flex-nowrap flex-v-center flex">
|
3
|
+
<h1 class="mn-r-auto">
|
4
|
+
{{route.params.category ? 'Edit Category' : 'Add Category'}}
|
5
|
+
</h1>
|
6
|
+
|
7
|
+
<Button
|
8
|
+
:submit="onSubmit"
|
9
|
+
:callback="redirectTo"
|
10
|
+
class="pd-small radius-big bg-main t-black uppercase t-medium"
|
11
|
+
>
|
12
|
+
Save Category
|
13
|
+
</Button>
|
14
|
+
</Block>
|
15
|
+
|
16
|
+
<Block
|
17
|
+
title="Profile"
|
18
|
+
class="mn-b-thin"
|
19
|
+
>
|
20
|
+
<div class="mn-b-medium w-100 flex-nowrap gap-thin flex">
|
21
|
+
<Field
|
22
|
+
v-model:field="categories.state.current.order"
|
23
|
+
label="Order"
|
24
|
+
:disabled="true"
|
25
|
+
class="w-25 bg-white radius-small pd-medium"
|
26
|
+
/>
|
27
|
+
<Field
|
28
|
+
v-model:field="categories.state.current.url"
|
29
|
+
label="URL"
|
30
|
+
placeholder="Enter category URL"
|
31
|
+
class="w-100 bg-white radius-small pd-medium"
|
32
|
+
/>
|
33
|
+
<Field
|
34
|
+
v-model:field="categories.state.current.name"
|
35
|
+
label="Name"
|
36
|
+
placeholder="Enter category name"
|
37
|
+
class="w-100 bg-white radius-small pd-medium"
|
38
|
+
/>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<Select
|
42
|
+
v-model:select="categories.state.current.status"
|
43
|
+
label="Status"
|
44
|
+
:options="[
|
45
|
+
'draft',
|
46
|
+
'internal',
|
47
|
+
'published',
|
48
|
+
'removed'
|
49
|
+
]"
|
50
|
+
placeholder="Display product"
|
51
|
+
class="pos-relative w-100 mn-b-small bg-white radius-small pd-medium"
|
52
|
+
/>
|
53
|
+
|
54
|
+
<div class="flex-v-center flex-nowrap flex">
|
55
|
+
<h4 class="mn-r-thin t-medium">Localization</h4>
|
56
|
+
|
57
|
+
<button
|
58
|
+
@click="() => categories.state.current.localization.push({locale: '', text: ''})"
|
59
|
+
class="i-small pd-thin button-delete button"
|
60
|
+
>
|
61
|
+
+
|
62
|
+
</button>
|
63
|
+
</div>
|
64
|
+
<div
|
65
|
+
class="gap-thin mn-b-thin flex-nowrap flex"
|
66
|
+
v-for="(item, index) in categories.state.current.localization"
|
67
|
+
:key="index"
|
68
|
+
>
|
69
|
+
<Field
|
70
|
+
v-model:field="item.locale"
|
71
|
+
placeholder="Locale"
|
72
|
+
class="w-100 bg-white radius-small pd-medium"
|
73
|
+
/>
|
74
|
+
<Field
|
75
|
+
v-model:field="item.text"
|
76
|
+
placeholder="Text"
|
77
|
+
class="w-100 bg-white radius-small pd-medium"
|
78
|
+
/>
|
79
|
+
<div
|
80
|
+
@click="() => categories.state.current.localization.splice(index, 1)"
|
81
|
+
class="radius-small pd-small flex-center flex aspect-1x1 bg-red"
|
82
|
+
>
|
83
|
+
<IconDelete
|
84
|
+
class="i-medium"
|
85
|
+
/>
|
86
|
+
</div>
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
</Block>
|
91
|
+
<!-- Subcategories -->
|
92
|
+
<Block
|
93
|
+
title="Subcategories"
|
94
|
+
placeholder="No subcategories added yet"
|
95
|
+
:actions="[{
|
96
|
+
label: '+',
|
97
|
+
function: () => categories.state.current.subcategories.push({name: '', url: ''})
|
98
|
+
}]"
|
99
|
+
class="mn-b-thin"
|
100
|
+
>
|
101
|
+
<div
|
102
|
+
class="gap-thin mn-b-thin flex-nowrap flex"
|
103
|
+
v-for="(item, index) in categories.state.current.subcategories"
|
104
|
+
:key="index"
|
105
|
+
>
|
106
|
+
<Field
|
107
|
+
v-model:field="item.name"
|
108
|
+
placeholder="Subcategory name"
|
109
|
+
class="w-100 bg-white radius-small pd-medium"
|
110
|
+
/>
|
111
|
+
<Field
|
112
|
+
v-model:field="item.url"
|
113
|
+
placeholder="Subcategory"
|
114
|
+
class="w-100 bg-white radius-small pd-medium"
|
115
|
+
/>
|
116
|
+
<div
|
117
|
+
@click="() => categories.state.current.subcategories.splice(index, 1)"
|
118
|
+
class="radius-small pd-small flex-center flex aspect-1x1 bg-red"
|
119
|
+
>
|
120
|
+
<IconDelete
|
121
|
+
class="i-medium"
|
122
|
+
/>
|
123
|
+
</div>
|
124
|
+
</div>
|
125
|
+
</Block>
|
126
|
+
<!-- Filters -->
|
127
|
+
<Block
|
128
|
+
title="Filters"
|
129
|
+
placeholder="No filters added yet"
|
130
|
+
:actions="[{
|
131
|
+
label: '+',
|
132
|
+
function: () => categories.state.current.filters.push({name: '', url: ''})
|
133
|
+
}]"
|
134
|
+
>
|
135
|
+
<div
|
136
|
+
class="gap-thin mn-b-thin flex-nowrap flex"
|
137
|
+
v-for="(item, index) in categories.state.current.filters"
|
138
|
+
:key="index"
|
139
|
+
>
|
140
|
+
<Field
|
141
|
+
v-model:field="item.name"
|
142
|
+
placeholder="Filter name"
|
143
|
+
class="w-100 bg-white radius-small pd-medium"
|
144
|
+
/>
|
145
|
+
<Field
|
146
|
+
v-model:field="item.options"
|
147
|
+
placeholder="Filter options divided by ,"
|
148
|
+
class="w-100 bg-white radius-small pd-medium"
|
149
|
+
/>
|
150
|
+
<div
|
151
|
+
@click="() => categories.state.current.filters.splice(index, 1)"
|
152
|
+
class="radius-small pd-small flex-center flex aspect-1x1 bg-red"
|
153
|
+
>
|
154
|
+
<IconDelete
|
155
|
+
class="i-medium"
|
156
|
+
/>
|
157
|
+
</div>
|
158
|
+
</div>
|
159
|
+
</Block>
|
160
|
+
|
161
|
+
</template>
|
162
|
+
|
163
|
+
<script setup>
|
164
|
+
// Import libs
|
165
|
+
import { computed } from 'vue'
|
166
|
+
import { useRoute,useRouter } from 'vue-router'
|
167
|
+
|
168
|
+
import IconDelete from '@pf/src/modules/icons/navigation/IconDelete.vue';
|
169
|
+
|
170
|
+
import Button from "@pf/src/components/Button/Button.vue";
|
171
|
+
import Select from "@pf/src/components/Select/Select.vue";
|
172
|
+
import Field from "@pf/src/components/Field/Field.vue";
|
173
|
+
|
174
|
+
import Block from '@pf/src/components/Block/Block.vue';
|
175
|
+
|
176
|
+
// Import the new store structure
|
177
|
+
import * as categories from '@pf/src/modules/products/store/categories';
|
178
|
+
|
179
|
+
const route = useRoute()
|
180
|
+
const router = useRouter()
|
181
|
+
|
182
|
+
// Data prefetching
|
183
|
+
if (route.params.category) {
|
184
|
+
categories.actions.fetchCategory(route.params.category)
|
185
|
+
} else {
|
186
|
+
categories.actions.resetCategory() // Adjusted based on the new store's method to reset the category state
|
187
|
+
}
|
188
|
+
|
189
|
+
// Accessing state
|
190
|
+
const category = computed(() => categories.state.current)
|
191
|
+
const routePath = computed(() => route.name)
|
192
|
+
|
193
|
+
// Functions
|
194
|
+
function onSubmit() {
|
195
|
+
if (route.params.category) {
|
196
|
+
categories.actions.updateCategory(route.params.category)
|
197
|
+
} else {
|
198
|
+
categories.actions.addCategory()
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
function redirectTo () {
|
203
|
+
router.push({
|
204
|
+
name: 'Categories Organization',
|
205
|
+
params: {
|
206
|
+
_id: route.params._id
|
207
|
+
}
|
208
|
+
})
|
209
|
+
}
|
210
|
+
</script>
|
211
|
+
|
212
|
+
<style lang="scss">
|
213
|
+
/* Your styles here */
|
214
|
+
</style>
|
@@ -112,7 +112,7 @@
|
|
112
112
|
|
113
113
|
const totalPrice = computed(() => {
|
114
114
|
return leftovers.state.current.positions.reduce((sum, position) => {
|
115
|
-
return sum +
|
115
|
+
return sum + position.price;
|
116
116
|
}, 0);
|
117
117
|
});
|
118
118
|
|
@@ -147,14 +147,16 @@
|
|
147
147
|
}
|
148
148
|
|
149
149
|
function onSubmit() {
|
150
|
+
leftovers.state.current.organization = route.params._id;
|
151
|
+
|
150
152
|
if (route.params.leftover) {
|
151
153
|
leftovers.actions.update(leftovers.state.current).then(
|
152
|
-
() => router.push({ name: '
|
154
|
+
() => router.push({ name: 'Leftovers', params: {_id: route.params._id} }),
|
153
155
|
(error) => console.error('error')
|
154
156
|
);
|
155
157
|
} else {
|
156
158
|
leftovers.actions.create(leftovers.state.current).then(
|
157
|
-
() => router.push({ name: '
|
159
|
+
() => router.push({ name: 'Leftovers', params: {_id: route.params._id} }),
|
158
160
|
(error) => console.error('error')
|
159
161
|
);
|
160
162
|
}
|
@@ -162,7 +164,7 @@
|
|
162
164
|
|
163
165
|
function onDelete() {
|
164
166
|
leftovers.actions.delete(route.params.leftover).then(
|
165
|
-
() => router.push({ name: '
|
167
|
+
() => router.push({ name: 'Leftovers', params: {_id: route.params._id} }),
|
166
168
|
(error) => console.error('error')
|
167
169
|
);
|
168
170
|
}
|
@@ -48,6 +48,15 @@
|
|
48
48
|
|
49
49
|
<Block
|
50
50
|
title="Categories"
|
51
|
+
:actions="[{
|
52
|
+
label: '+',
|
53
|
+
function: () => router.push({
|
54
|
+
name: 'Categories Organization',
|
55
|
+
params: {
|
56
|
+
_id: route.params._id
|
57
|
+
}
|
58
|
+
})
|
59
|
+
}]"
|
51
60
|
>
|
52
61
|
<Checkbox
|
53
62
|
v-for="(category, index) in categories.state.all"
|
@@ -224,7 +233,6 @@
|
|
224
233
|
import Block from '@pf/src/components/Block/Block.vue';
|
225
234
|
import Tab from "@pf/src/components/Tab/Tab.vue";
|
226
235
|
import Field from "@pf/src/components/Field/Field.vue";
|
227
|
-
import Select from "@pf/src/components/Select/Select.vue";
|
228
236
|
import Checkbox from "@pf/src/components/Checkbox/Checkbox.vue";
|
229
237
|
import Button from "@pf/src/components/Button/Button.vue";
|
230
238
|
import Popup from "@pf/src/components/Popup/Popup.vue";
|