@ozdao/prometheus-framework 0.2.309 → 0.2.311
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/products.server.js +192 -195
- package/dist/products.server.mjs +192 -195
- package/dist/prometheus-framework/src/components/Block/Block.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Block/Block.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/components/Block/Block.vue.js +1 -1
- package/dist/prometheus-framework/src/components/Block/Block.vue.js.map +1 -1
- package/dist/prometheus-framework/src/components/Chips/Chips.vue2.cjs +2 -1
- package/dist/prometheus-framework/src/components/Chips/Chips.vue2.cjs.map +1 -1
- package/dist/prometheus-framework/src/components/Chips/Chips.vue2.js +3 -2
- package/dist/prometheus-framework/src/components/Chips/Chips.vue2.js.map +1 -1
- package/dist/prometheus-framework/src/components/EditImages/EditImages.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/EditImages/EditImages.vue2.cjs.map +1 -1
- package/dist/prometheus-framework/src/components/EditImages/EditImages.vue2.js +1 -1
- package/dist/prometheus-framework/src/components/EditImages/EditImages.vue2.js.map +1 -1
- package/dist/prometheus-framework/src/components/Field/Field.vue.cjs +13 -12
- package/dist/prometheus-framework/src/components/Field/Field.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/components/Field/Field.vue.js +13 -12
- package/dist/prometheus-framework/src/components/Field/Field.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/auth/views/middlewares/auth.validation.cjs +1 -0
- package/dist/prometheus-framework/src/modules/auth/views/middlewares/auth.validation.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/auth/views/middlewares/auth.validation.js +1 -0
- package/dist/prometheus-framework/src/modules/auth/views/middlewares/auth.validation.js.map +1 -1
- package/dist/prometheus-framework/src/modules/auth/views/store/auth.cjs +6 -2
- package/dist/prometheus-framework/src/modules/auth/views/store/auth.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/auth/views/store/auth.js +6 -2
- package/dist/prometheus-framework/src/modules/auth/views/store/auth.js.map +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs +2 -4
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js +3 -5
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/BottomNavigationBar.vue.cjs +3 -3
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/BottomNavigationBar.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/BottomNavigationBar.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/BottomNavigationBar.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/Header.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/Header.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/NavigationBar.vue.cjs +18 -15
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/NavigationBar.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/NavigationBar.vue.js +21 -18
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/NavigationBar.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/store/globals.cjs +4 -0
- package/dist/prometheus-framework/src/modules/globals/views/store/globals.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/store/globals.js +4 -0
- package/dist/prometheus-framework/src/modules/globals/views/store/globals.js.map +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormPayment.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormPayment.vue.js +1 -1
- 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 +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.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs +1 -2
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +2 -3
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/pages/pages.client.cjs +554 -554
- package/dist/prometheus-framework/src/modules/pages/pages.client.js +554 -554
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue.cjs +3 -3
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.cjs +11 -10
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.js +11 -10
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs +78 -43
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.js +83 -48
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +80 -30
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +91 -41
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js.map +1 -1
- 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 +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +119 -80
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +132 -93
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs +39 -21
- package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js +51 -33
- package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/CategoriesTree.vue.cjs +96 -0
- package/dist/prometheus-framework/src/modules/products/components/sections/CategoriesTree.vue.cjs.map +1 -0
- package/dist/prometheus-framework/src/modules/products/components/sections/CategoriesTree.vue.js +96 -0
- package/dist/prometheus-framework/src/modules/products/components/sections/CategoriesTree.vue.js.map +1 -0
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +21 -7
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +21 -7
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/Filters.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/Filters.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/products.client.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/products.client.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/router/categories.router.cjs +17 -5
- package/dist/prometheus-framework/src/modules/products/router/categories.router.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/router/categories.router.js +17 -5
- package/dist/prometheus-framework/src/modules/products/router/categories.router.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/router/products.router.cjs +1 -12
- package/dist/prometheus-framework/src/modules/products/router/products.router.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/router/products.router.js +1 -12
- package/dist/prometheus-framework/src/modules/products/router/products.router.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/store/categories.cjs +52 -71
- package/dist/prometheus-framework/src/modules/products/store/categories.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/store/categories.js +52 -71
- package/dist/prometheus-framework/src/modules/products/store/categories.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/store/products.cjs +6 -8
- package/dist/prometheus-framework/src/modules/products/store/products.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/store/products.js +6 -8
- package/dist/prometheus-framework/src/modules/products/store/products.js.map +1 -1
- package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/blocks/SpotMemberModify.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/blocks/SpotMemberModify.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.js +1 -1
- package/package.json +1 -1
- package/src/components/Block/Block.vue +1 -1
- package/src/components/EditImages/EditImages.vue +1 -1
- package/src/modules/auth/views/middlewares/auth.validation.js +1 -0
- package/src/modules/auth/views/store/auth.js +6 -2
- package/src/modules/backoffice/components/pages/Dashboard.vue +1 -3
- package/src/modules/globals/views/components/partials/BottomNavigationBar.vue +3 -3
- package/src/modules/globals/views/components/partials/NavigationBar.vue +4 -4
- package/src/modules/globals/views/store/globals.js +5 -0
- package/src/modules/organizations/components/pages/Organization.vue +1 -1
- package/src/modules/organizations/components/pages/OrganizationBackoffice.vue +1 -2
- package/src/modules/products/components/blocks/CardCategory.vue +14 -3
- package/src/modules/products/components/blocks/CardProduct.vue +12 -11
- package/src/modules/products/components/pages/Categories.vue +120 -28
- package/src/modules/products/components/pages/CategoryEdit.vue +206 -151
- package/src/modules/products/components/pages/ProductEdit.vue +107 -69
- package/src/modules/products/components/pages/Products.vue +35 -20
- package/src/modules/products/components/sections/CategoriesTree.vue +102 -0
- package/src/modules/products/components/sections/EditProductInfo.vue +53 -40
- package/src/modules/products/controllers/categories.controller.js +175 -97
- package/src/modules/products/controllers/products.controller.js +4 -2
- package/src/modules/products/models/category.model.js +15 -66
- package/src/modules/products/models/product.model.js +15 -12
- package/src/modules/products/products.client.js +0 -1
- package/src/modules/products/router/categories.router.js +17 -5
- package/src/modules/products/router/products.router.js +0 -12
- package/src/modules/products/routes/categories.routes.js +5 -34
- package/src/modules/products/store/categories.js +69 -83
- package/src/modules/products/store/products.js +6 -8
@@ -1,75 +1,24 @@
|
|
1
1
|
module.exports = (db) => {
|
2
|
-
const
|
3
|
-
name: {
|
4
|
-
type: String,
|
5
|
-
required: true,
|
6
|
-
trim: true
|
7
|
-
},
|
2
|
+
const CategorySchema = new db.mongoose.Schema({
|
3
|
+
name: { type: String, required: true, trim: true },
|
8
4
|
status: {
|
9
5
|
type: String,
|
10
|
-
enum: ['draft','internal','published','removed'],
|
6
|
+
enum: ['draft','internal','published','removed'],
|
11
7
|
default: 'draft',
|
12
8
|
required: true,
|
13
9
|
},
|
14
|
-
order: {
|
15
|
-
|
16
|
-
|
17
|
-
},
|
18
|
-
|
19
|
-
type: String,
|
20
|
-
required: true,
|
21
|
-
trim: true
|
22
|
-
},
|
23
|
-
subcategories: {
|
24
|
-
type: Array
|
25
|
-
},
|
26
|
-
localization: {
|
27
|
-
type: Array
|
28
|
-
},
|
29
|
-
filters: {
|
30
|
-
type: Array
|
31
|
-
},
|
32
|
-
// owner: {
|
33
|
-
// type: {
|
34
|
-
// type: String,
|
35
|
-
// required: true
|
36
|
-
// },
|
37
|
-
// target: {
|
38
|
-
// type: mongoose.Schema.Types.ObjectId,
|
39
|
-
// ref: function (value) {
|
40
|
-
// if (this.owner.type === 'user') return 'User';
|
41
|
-
// if (this.owner.type === 'organization') return 'Organization';
|
42
|
-
// },
|
43
|
-
// required: true,
|
44
|
-
// },
|
45
|
-
// },
|
46
|
-
// creator: {
|
47
|
-
// hidden: {
|
48
|
-
// type: Boolean,
|
49
|
-
// required: true
|
50
|
-
// },
|
51
|
-
// type: {
|
52
|
-
// type: String,
|
53
|
-
// required: true
|
54
|
-
// },
|
55
|
-
// target: {
|
56
|
-
// type: mongoose.Schema.Types.ObjectId,
|
57
|
-
// ref: function (value) {
|
58
|
-
// if (this.owner.type === 'user') return 'User';
|
59
|
-
// if (this.owner.type === 'organization') return 'Organization';
|
60
|
-
// },
|
61
|
-
// required: true,
|
62
|
-
// },
|
63
|
-
// }
|
10
|
+
order: { type: Number, required: true },
|
11
|
+
url: { type: String, required: true, trim: true },
|
12
|
+
parent: { type: db.mongoose.Schema.Types.ObjectId, ref: 'Category' },
|
13
|
+
localization: { type: Array },
|
14
|
+
filters: { type: Array }
|
64
15
|
}, {
|
65
|
-
timestamps: {
|
66
|
-
currentTime: () => Date.now()
|
67
|
-
}
|
16
|
+
timestamps: { currentTime: () => Date.now() }
|
68
17
|
});
|
69
18
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
return
|
75
|
-
}
|
19
|
+
CategorySchema.index({ parent: 1 });
|
20
|
+
CategorySchema.index({ 'owner.target': 1, 'creator.target': 1});
|
21
|
+
|
22
|
+
const Category = db.mongoose.model('Category', CategorySchema, 'categories');
|
23
|
+
return Category;
|
24
|
+
};
|
@@ -2,7 +2,13 @@ const applyOwnershipSchema = require('@pf/src/modules/globals/models/schemas/own
|
|
2
2
|
|
3
3
|
module.exports = (db) => {
|
4
4
|
const ProductSchema = new db.mongoose.Schema({
|
5
|
-
status:
|
5
|
+
status: {
|
6
|
+
type: String
|
7
|
+
},
|
8
|
+
listing: {
|
9
|
+
type: String,
|
10
|
+
enum: ['sale', 'rent']
|
11
|
+
},
|
6
12
|
name: {type: String},
|
7
13
|
category: {type: Array},
|
8
14
|
description: {type: String},
|
@@ -17,7 +23,13 @@ module.exports = (db) => {
|
|
17
23
|
value: {type: String}
|
18
24
|
}],
|
19
25
|
// ЗАДАЧА: Нужно отрефачить price, перенести его в default variant
|
20
|
-
price: {
|
26
|
+
price: {
|
27
|
+
type: Number
|
28
|
+
},
|
29
|
+
price_currency: {
|
30
|
+
type: String,
|
31
|
+
default: '$',
|
32
|
+
},
|
21
33
|
prices: { type: Array},
|
22
34
|
//
|
23
35
|
variants: [{
|
@@ -64,16 +76,7 @@ module.exports = (db) => {
|
|
64
76
|
min: [0, 'Quantity-based discount cannot be less than 0'],
|
65
77
|
max: [100, 'Quantity-based discount cannot be more than 100']
|
66
78
|
},
|
67
|
-
}]
|
68
|
-
// Refactor
|
69
|
-
owner: {
|
70
|
-
type: db.mongoose.Schema.Types.ObjectId,
|
71
|
-
ref: 'User',
|
72
|
-
},
|
73
|
-
organization: {
|
74
|
-
type: db.mongoose.Schema.Types.ObjectId,
|
75
|
-
ref: 'Organization',
|
76
|
-
},
|
79
|
+
}]
|
77
80
|
}, {
|
78
81
|
timestamps: {
|
79
82
|
currentTime: () => Date.now()
|
@@ -2,21 +2,33 @@ import * as validationAuth from '@pf/src/modules/auth/views/middlewares/auth.val
|
|
2
2
|
|
3
3
|
const categoriesRoutes = [{
|
4
4
|
path: 'categories',
|
5
|
-
name: 'Categories
|
5
|
+
name: 'Categories',
|
6
6
|
meta: {
|
7
7
|
title: {
|
8
|
-
en: '
|
9
|
-
ru: '
|
8
|
+
en: 'Categories',
|
9
|
+
ru: 'Категории'
|
10
10
|
}
|
11
11
|
},
|
12
12
|
component: () => import('@pf/src/modules/products/components/pages/Categories.vue')
|
13
13
|
}, {
|
14
14
|
path: 'categories/add',
|
15
|
-
name: '
|
15
|
+
name: 'Category Add',
|
16
|
+
meta: {
|
17
|
+
title: {
|
18
|
+
en: 'Add Category',
|
19
|
+
ru: 'Добавить Категорию'
|
20
|
+
}
|
21
|
+
},
|
16
22
|
component: () => import('@pf/src/modules/products/components/pages/CategoryEdit.vue')
|
17
23
|
},{
|
18
24
|
path: 'categories/:category/edit',
|
19
|
-
name: '
|
25
|
+
name: 'Category Edit',
|
26
|
+
meta: {
|
27
|
+
title: {
|
28
|
+
en: 'Edit Category',
|
29
|
+
ru: 'Редактировать Категорию'
|
30
|
+
}
|
31
|
+
},
|
20
32
|
beforeEnter: [validationAuth.requiresAuth],
|
21
33
|
component: () => import('@pf/src/modules/products/components/pages/CategoryEdit.vue')
|
22
34
|
}];
|
@@ -2,7 +2,6 @@ import * as validationAuth from '@pf/src/modules/auth/views/middlewares/auth.val
|
|
2
2
|
|
3
3
|
import * as auth from '@pf/src/modules/auth/views/store/auth';
|
4
4
|
|
5
|
-
import IconPlus from '@pf/src/modules/icons/navigation/IconPlus.vue'
|
6
5
|
|
7
6
|
export function createProductRoutes(prefix = '', options = {}) {
|
8
7
|
const nameWithPrefix = (name) => prefix ? `${prefix}${name}` : name;
|
@@ -18,17 +17,6 @@ export function createProductRoutes(prefix = '', options = {}) {
|
|
18
17
|
en: 'Products',
|
19
18
|
ru: 'Товары'
|
20
19
|
},
|
21
|
-
|
22
|
-
actions: [
|
23
|
-
{
|
24
|
-
component: IconPlus,
|
25
|
-
props: {
|
26
|
-
fill: "rgb(var(--main))"
|
27
|
-
},
|
28
|
-
condition: () => auth.state.user && auth.state.user._id,
|
29
|
-
action: (router) => router.push({ name: 'ProductAdd' })
|
30
|
-
}
|
31
|
-
],
|
32
20
|
authorize: options.productsAuthorize || []
|
33
21
|
},
|
34
22
|
component: () => import(/* webpackChunkName: 'Products' */ '@pf/src/modules/products/components/pages/Products.vue'),
|
@@ -7,40 +7,11 @@ module.exports = function(app, db) {
|
|
7
7
|
const controller = controllerFactory(db);
|
8
8
|
|
9
9
|
const { verifyCategory } = middlewareFactoryProducts(db);
|
10
|
-
// Get categorys
|
11
|
-
app.get(
|
12
|
-
"/categories",
|
13
|
-
controller.getCategories
|
14
|
-
);
|
15
|
-
app.post(
|
16
|
-
"/categories",
|
17
|
-
controller.updateCategories
|
18
|
-
);
|
19
|
-
// Get category
|
20
|
-
app.get(
|
21
|
-
"/categories/:url",
|
22
|
-
controller.getCategory
|
23
|
-
);
|
24
|
-
// Add category
|
25
|
-
app.post(
|
26
|
-
"/categories/add",
|
27
|
-
[
|
28
|
-
verifyCategory.checkCategoryExistOrNot,
|
29
|
-
],
|
30
|
-
controller.addCategory
|
31
|
-
);
|
32
|
-
// Update catagory
|
33
|
-
app.post(
|
34
|
-
"/categories/:url",
|
35
|
-
controller.updateCategory
|
36
|
-
);
|
37
|
-
// Delete category
|
38
|
-
app.delete(
|
39
|
-
"/categories/:url",
|
40
|
-
controller.deleteCategory
|
41
|
-
);
|
42
10
|
|
11
|
+
app.get('/api/categories', controller.read);
|
12
|
+
app.post('/api/categories/create', [verifyCategory.checkCategoryExistOrNot], controller.create);
|
13
|
+
app.post('/api/categories/update', controller.update);
|
14
|
+
app.post('/api/categories/delete', controller.delete);
|
43
15
|
};
|
44
16
|
|
45
|
-
|
46
|
-
|
17
|
+
module.exports.controllerFactory = controllerFactory;
|
@@ -1,114 +1,97 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
// Globals
|
6
|
-
import { setError } from '@pf/src/modules/globals/views/store/globals'
|
7
|
-
// Setup Axios
|
1
|
+
// Dependencies
|
2
|
+
import { reactive, watch } from "vue";
|
3
|
+
import { setError } from '@pf/src/modules/globals/views/store/globals';
|
4
|
+
|
8
5
|
import $axios from '@pf/src/modules/globals/views/utils/axios-instance.js';
|
9
6
|
|
7
|
+
// State
|
10
8
|
const state = reactive({
|
11
9
|
all: [],
|
10
|
+
filter: {
|
11
|
+
status: null,
|
12
|
+
search: null
|
13
|
+
},
|
12
14
|
current: {
|
13
15
|
order: 1,
|
14
16
|
name: "",
|
15
17
|
url: "",
|
16
18
|
status: "draft",
|
17
|
-
|
19
|
+
parent: null,
|
20
|
+
children: [],
|
18
21
|
filters: [],
|
19
22
|
localization: [],
|
20
|
-
}
|
23
|
+
}
|
21
24
|
});
|
22
25
|
|
26
|
+
// Methods
|
23
27
|
const actions = {
|
24
|
-
async
|
25
|
-
|
26
|
-
categories
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
return Promise.
|
28
|
+
async read(options = {}) {
|
29
|
+
try {
|
30
|
+
const response = await $axios.get('/api/categories', { params: options });
|
31
|
+
|
32
|
+
if (options.url) {
|
33
|
+
state.current = {...response.data[0]};
|
34
|
+
return Promise.resolve(response.data[0]);
|
35
|
+
} else {
|
36
|
+
return Promise.resolve(response.data);
|
33
37
|
}
|
34
|
-
)
|
38
|
+
} catch (error) {
|
39
|
+
setError(error);
|
40
|
+
return Promise.reject(error);
|
41
|
+
}
|
35
42
|
},
|
36
43
|
|
37
|
-
|
38
|
-
|
39
|
-
(
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
(error)
|
44
|
-
|
45
|
-
|
46
|
-
}
|
47
|
-
);
|
44
|
+
async create(category) {
|
45
|
+
try {
|
46
|
+
const response = await $axios.post('/api/categories/create', category);
|
47
|
+
state.all.push(response.data);
|
48
|
+
return Promise.resolve(response.data);
|
49
|
+
} catch (error) {
|
50
|
+
setError(error);
|
51
|
+
return Promise.reject(error);
|
52
|
+
}
|
48
53
|
},
|
49
54
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
return Promise.resolve(category.data);
|
55
|
-
},
|
56
|
-
(error) => {
|
57
|
-
setError(error);
|
58
|
-
return Promise.reject(error);
|
59
|
-
}
|
60
|
-
);
|
61
|
-
},
|
55
|
+
async update(categories) {
|
56
|
+
try {
|
57
|
+
// Handle both single category and bulk update
|
58
|
+
const isArray = Array.isArray(categories);
|
62
59
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
);
|
60
|
+
const response = await $axios.post('/api/categories/update', {
|
61
|
+
categories: isArray ? categories : [categories],
|
62
|
+
});
|
63
|
+
|
64
|
+
// state.all = response.data;
|
65
|
+
return Promise.resolve(response.data);
|
66
|
+
} catch (error) {
|
67
|
+
setError(error);
|
68
|
+
return Promise.reject(error);
|
69
|
+
}
|
74
70
|
},
|
75
71
|
|
76
|
-
|
77
|
-
|
78
|
-
(
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
(error)
|
83
|
-
|
84
|
-
|
85
|
-
}
|
86
|
-
);
|
72
|
+
async delete(url) {
|
73
|
+
try {
|
74
|
+
await $axios.post('/api/categories/delete', { url });
|
75
|
+
state.all = state.all.filter(c => c.url !== url);
|
76
|
+
return Promise.resolve();
|
77
|
+
} catch (error) {
|
78
|
+
setError(error);
|
79
|
+
return Promise.reject(error);
|
80
|
+
}
|
87
81
|
},
|
88
82
|
|
89
|
-
|
83
|
+
clean() {
|
90
84
|
state.current = {
|
91
|
-
order:
|
85
|
+
order: 1,
|
92
86
|
name: "",
|
93
87
|
url: "",
|
94
88
|
status: "draft",
|
95
|
-
|
89
|
+
parent: null,
|
90
|
+
children: [],
|
96
91
|
filters: [],
|
97
92
|
localization: [],
|
98
|
-
}
|
99
|
-
}
|
100
|
-
|
101
|
-
deleteCategory(url) {
|
102
|
-
return $axios.delete("/categories/" + url).then(
|
103
|
-
(response) => {
|
104
|
-
const index = state.all.findIndex((c) => c.url === url);
|
105
|
-
state.all.splice(index, 1);
|
106
|
-
},
|
107
|
-
(error) => {
|
108
|
-
setError(error);
|
109
|
-
}
|
110
|
-
);
|
111
|
-
},
|
93
|
+
};
|
94
|
+
}
|
112
95
|
};
|
113
96
|
|
114
97
|
const history = [];
|
@@ -116,6 +99,9 @@ history.push(state);
|
|
116
99
|
|
117
100
|
watch(state, (newState) => {
|
118
101
|
history.push(newState);
|
119
|
-
});
|
102
|
+
}, { deep: true });
|
120
103
|
|
121
|
-
export {
|
104
|
+
export {
|
105
|
+
state,
|
106
|
+
actions
|
107
|
+
};
|
@@ -15,6 +15,7 @@ const state = reactive({
|
|
15
15
|
recommendation: false,
|
16
16
|
category: [],
|
17
17
|
status: 'unpublished',
|
18
|
+
listing: 'sale',
|
18
19
|
information: [],
|
19
20
|
images: [],
|
20
21
|
files: [],
|
@@ -22,6 +23,7 @@ const state = reactive({
|
|
22
23
|
name: '',
|
23
24
|
sale: 0,
|
24
25
|
price: 0,
|
26
|
+
price_currency: '$',
|
25
27
|
localization: [],
|
26
28
|
modifications: [],
|
27
29
|
quantityDiscount: [],
|
@@ -35,12 +37,8 @@ const state = reactive({
|
|
35
37
|
/////////////////////////////
|
36
38
|
const actions = {
|
37
39
|
|
38
|
-
async create(
|
39
|
-
|
40
|
-
...product,
|
41
|
-
organization: organization
|
42
|
-
}
|
43
|
-
return await $axios.post("/api/products/create", newProduct).then(
|
40
|
+
async create(product) {
|
41
|
+
return await $axios.post("/api/products/create", product).then(
|
44
42
|
(response) => {
|
45
43
|
set(response.data, 'current')
|
46
44
|
return Promise.resolve(response.data);
|
@@ -67,8 +65,8 @@ const actions = {
|
|
67
65
|
query.category = options.category;
|
68
66
|
}
|
69
67
|
|
70
|
-
if (options.
|
71
|
-
query.
|
68
|
+
if (options.owner) {
|
69
|
+
query.owner = options.owner;
|
72
70
|
}
|
73
71
|
|
74
72
|
if (options.count) {
|