@ozdao/prometheus-framework 0.2.54 → 0.2.55
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/main-B7GT1EB5.js +91 -0
- package/dist/main-N_5Jg8Gx.mjs +13693 -0
- package/dist/main.css +1 -1
- package/dist/prometheus-framework.cjs.js +1 -1
- package/dist/prometheus-framework.es.js +1 -1
- package/dist/web-ktBiiov5.js +1 -0
- package/dist/web-xvjLzsHu.mjs +55 -0
- package/package.json +1 -1
- package/src/components/Feed/Feed.vue +26 -0
- package/src/modules/backoffice/router/backoffice.js +5 -2
- package/src/modules/gallery/models/photo.model.js +5 -1
- package/src/modules/globals/components/blocks/BlockSearch.vue +4 -3
- package/src/modules/globals/store/globals.js +33 -2
- package/src/modules/orders/components/blocks/CardOrderItem.vue +24 -3
- package/src/modules/orders/components/pages/EditOrder.vue +114 -108
- package/src/modules/organizations/components/pages/Organization.vue +1 -0
- package/src/modules/organizations/router/organizations.js +1 -1
- package/src/modules/products/components/blocks/CardPosition.vue +7 -7
- package/src/modules/products/store/products.js +2 -0
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./main-
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./main-B7GT1EB5.js");require("vue");exports.Address=e.Address;exports.Breadcrumbs=e._sfc_main$9;exports.Button=e._sfc_main;exports.Checkbox=e.Checkbox;exports.Chips=e.Chips;exports.Countdown=e._sfc_main$10;exports.DatePicker=e._sfc_main$11;exports.Dropdown=e.Dropdown;exports.EmptyState=e._sfc_main$12;exports.Error=e._sfc_main$1;exports.Feed=e._sfc_main$13;exports.Field=e.Field;exports.FieldBig=e._sfc_main$14;exports.FieldPhone=e.FieldPhone;exports.FieldTags=e.FieldTags;exports.Loader=e.Loader;exports.LocationMarker=e.LocationMarker;exports.Magnifier=e.Magnifier;exports.Map=e.Map;exports.Popup=e._sfc_main$2;exports.Radio=e._sfc_main$3;exports.Select=e.Select;exports.SelectMulti=e.SelectMulti;exports.Shader=e.Shader;exports.Sidebar=e._sfc_main$15;exports.Slider=e._sfc_main$16;exports.Spoiler=e._sfc_main$4;exports.Status=e._sfc_main$17;exports.Tab=e._sfc_main$5;exports.Text=e._sfc_main$6;exports.Tooltip=e.Tooltip;exports.Upload=e.Upload;exports.UploadImage=e._sfc_main$7;exports.UploadImageMultiple=e._sfc_main$8;exports.default=e.main;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { A as o, k as d, _ as r, C as t, l as i, n as l, o as p, D as u, p as S, a as n, q as c, F as m, r as g, b as F, s as M, t as b, L as h, u as T, M as f, c as k, d as x, S as C, e as U, v as w, w as B, x as D, f as L, y as P, g as y, h as A, T as E, U as I, i as j, j as q, m as v } from "./main-
|
1
|
+
import { A as o, k as d, _ as r, C as t, l as i, n as l, o as p, D as u, p as S, a as n, q as c, F as m, r as g, b as F, s as M, t as b, L as h, u as T, M as f, c as k, d as x, S as C, e as U, v as w, w as B, x as D, f as L, y as P, g as y, h as A, T as E, U as I, i as j, j as q, m as v } from "./main-N_5Jg8Gx.mjs";
|
2
2
|
import "vue";
|
3
3
|
export {
|
4
4
|
o as Address,
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./main-B7GT1EB5.js");require("vue");class p extends c.WebPlugin{constructor(){super(...arguments),this.group="CapacitorStorage"}async configure({group:e}){typeof e=="string"&&(this.group=e)}async get(e){return{value:this.impl.getItem(this.applyPrefix(e.key))}}async set(e){this.impl.setItem(this.applyPrefix(e.key),e.value)}async remove(e){this.impl.removeItem(this.applyPrefix(e.key))}async keys(){return{keys:this.rawKeys().map(t=>t.substring(this.prefix.length))}}async clear(){for(const e of this.rawKeys())this.impl.removeItem(e)}async migrate(){var e;const t=[],s=[],n="_cap_",o=Object.keys(this.impl).filter(i=>i.indexOf(n)===0);for(const i of o){const r=i.substring(n.length),a=(e=this.impl.getItem(i))!==null&&e!==void 0?e:"",{value:l}=await this.get({key:r});typeof l=="string"?s.push(r):(await this.set({key:r,value:a}),t.push(r))}return{migrated:t,existing:s}}async removeOld(){const e="_cap_",t=Object.keys(this.impl).filter(s=>s.indexOf(e)===0);for(const s of t)this.impl.removeItem(s)}get impl(){return window.localStorage}get prefix(){return this.group==="NativeStorage"?"":`${this.group}.`}rawKeys(){return Object.keys(this.impl).filter(e=>e.indexOf(this.prefix)===0)}applyPrefix(e){return this.prefix+e}}exports.PreferencesWeb=p;
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import { W as p } from "./main-N_5Jg8Gx.mjs";
|
2
|
+
import "vue";
|
3
|
+
class m extends p {
|
4
|
+
constructor() {
|
5
|
+
super(...arguments), this.group = "CapacitorStorage";
|
6
|
+
}
|
7
|
+
async configure({ group: e }) {
|
8
|
+
typeof e == "string" && (this.group = e);
|
9
|
+
}
|
10
|
+
async get(e) {
|
11
|
+
return { value: this.impl.getItem(this.applyPrefix(e.key)) };
|
12
|
+
}
|
13
|
+
async set(e) {
|
14
|
+
this.impl.setItem(this.applyPrefix(e.key), e.value);
|
15
|
+
}
|
16
|
+
async remove(e) {
|
17
|
+
this.impl.removeItem(this.applyPrefix(e.key));
|
18
|
+
}
|
19
|
+
async keys() {
|
20
|
+
return { keys: this.rawKeys().map((t) => t.substring(this.prefix.length)) };
|
21
|
+
}
|
22
|
+
async clear() {
|
23
|
+
for (const e of this.rawKeys())
|
24
|
+
this.impl.removeItem(e);
|
25
|
+
}
|
26
|
+
async migrate() {
|
27
|
+
var e;
|
28
|
+
const t = [], s = [], n = "_cap_", o = Object.keys(this.impl).filter((i) => i.indexOf(n) === 0);
|
29
|
+
for (const i of o) {
|
30
|
+
const r = i.substring(n.length), a = (e = this.impl.getItem(i)) !== null && e !== void 0 ? e : "", { value: l } = await this.get({ key: r });
|
31
|
+
typeof l == "string" ? s.push(r) : (await this.set({ key: r, value: a }), t.push(r));
|
32
|
+
}
|
33
|
+
return { migrated: t, existing: s };
|
34
|
+
}
|
35
|
+
async removeOld() {
|
36
|
+
const e = "_cap_", t = Object.keys(this.impl).filter((s) => s.indexOf(e) === 0);
|
37
|
+
for (const s of t)
|
38
|
+
this.impl.removeItem(s);
|
39
|
+
}
|
40
|
+
get impl() {
|
41
|
+
return window.localStorage;
|
42
|
+
}
|
43
|
+
get prefix() {
|
44
|
+
return this.group === "NativeStorage" ? "" : `${this.group}.`;
|
45
|
+
}
|
46
|
+
rawKeys() {
|
47
|
+
return Object.keys(this.impl).filter((e) => e.indexOf(this.prefix) === 0);
|
48
|
+
}
|
49
|
+
applyPrefix(e) {
|
50
|
+
return this.prefix + e;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
export {
|
54
|
+
m as PreferencesWeb
|
55
|
+
};
|
package/package.json
CHANGED
@@ -1,4 +1,13 @@
|
|
1
1
|
<template>
|
2
|
+
|
3
|
+
<TransitionGroup tag="ul" name="scaleTransition" >
|
4
|
+
<BlockSearch
|
5
|
+
v-if="search"
|
6
|
+
@search="updateSearch"
|
7
|
+
placeholder="Enter product name"
|
8
|
+
class="bg-white mn-b-thin"
|
9
|
+
/>
|
10
|
+
</TransitionGroup>
|
2
11
|
<TransitionGroup v-if="isLoading" tag="ul" name="scaleTransition" class="o-hidden bg-grey radius-big">
|
3
12
|
<SkeletonEvent
|
4
13
|
v-if="isLoading"
|
@@ -15,6 +24,8 @@
|
|
15
24
|
</transition>
|
16
25
|
|
17
26
|
<TransitionGroup tag="ul" name="scaleTransition" :class="$attrs.class">
|
27
|
+
|
28
|
+
|
18
29
|
<slot
|
19
30
|
v-if="!isLoading && itemsList.length > 0"
|
20
31
|
:items="itemsList"
|
@@ -42,8 +53,15 @@ import Loader from '@pf/src/components/Loader/Loader.vue';
|
|
42
53
|
import EmptyState from '@pf/src/components/EmptyState/EmptyState.vue';
|
43
54
|
import SortProducts from '@pf/src/modules/products/components/sections/SortProducts.vue'
|
44
55
|
|
56
|
+
import BlockSearch from '@pf/src/modules/globals/components/blocks/BlockSearch.vue'
|
57
|
+
|
58
|
+
|
45
59
|
// Пропсы
|
46
60
|
const props = defineProps({
|
61
|
+
search: {
|
62
|
+
type: Boolean,
|
63
|
+
default: false
|
64
|
+
},
|
47
65
|
showLoadMore: {
|
48
66
|
type: Boolean,
|
49
67
|
default: true
|
@@ -143,6 +161,14 @@ watch(() => props.options, (newVal, oldVal) => {
|
|
143
161
|
}
|
144
162
|
}, { deep: true });
|
145
163
|
|
164
|
+
function updateSearch(search) {
|
165
|
+
props.options.search = search
|
166
|
+
|
167
|
+
console.log(search)
|
168
|
+
|
169
|
+
fetchItems();
|
170
|
+
}
|
171
|
+
|
146
172
|
|
147
173
|
onMounted(async () => {
|
148
174
|
await fetchItems()
|
@@ -1,9 +1,12 @@
|
|
1
1
|
import layoutBackoffice from '../components/layouts/Backoffice.vue'
|
2
|
+
import layoutEmpty from '@pf/src/modules/globals/components/layouts/Empty.vue';
|
3
|
+
|
4
|
+
|
2
5
|
import * as validationAuth from '@pf/src/modules/middlewares/client/auth.validation.js';
|
3
6
|
|
4
7
|
const backofficeRoutes = [{
|
5
|
-
path: '
|
6
|
-
component:
|
8
|
+
path: 'backoffice',
|
9
|
+
component: layoutEmpty,
|
7
10
|
beforeEnter: [
|
8
11
|
validationAuth.requiresAdmin,
|
9
12
|
],
|
@@ -26,17 +26,18 @@ const updateSearch = (search) => {
|
|
26
26
|
<template>
|
27
27
|
<div class="flex-v-center flex-nowrap flex pd-small bg-grey w-100 radius-big">
|
28
28
|
<IconSearch class="i-medium t-transp mn-r-thin" />
|
29
|
+
|
29
30
|
<Field
|
30
31
|
:placeholder="placeholder"
|
31
|
-
@update:field="search =>
|
32
|
+
@update:field="search => updateSearch(search)"
|
32
33
|
class="w-100"
|
33
34
|
/>
|
34
35
|
|
35
|
-
<button
|
36
|
+
<!-- <button
|
36
37
|
class="pd-r-small pd-l-small pd-t-thin pd-b-thin p-medium uppercase p-small t-medium cursor-pointer radius-extra bg-main"
|
37
38
|
@click="updateSearch(stateSearch)"
|
38
39
|
>
|
39
40
|
{{ button }}
|
40
|
-
</button>
|
41
|
+
</button> -->
|
41
42
|
</div>
|
42
43
|
</template>
|
@@ -67,7 +67,7 @@ const actions = {
|
|
67
67
|
}
|
68
68
|
},
|
69
69
|
|
70
|
-
update(array, item
|
70
|
+
update(array, item) {
|
71
71
|
const existingItemIndex = array.findIndex(i => i._id === item._id);
|
72
72
|
|
73
73
|
if (existingItemIndex === -1) {
|
@@ -77,13 +77,44 @@ const actions = {
|
|
77
77
|
}
|
78
78
|
},
|
79
79
|
|
80
|
-
delete(array, item
|
80
|
+
delete(array, item) {
|
81
81
|
const existingItemIndex = array.findIndex(c => c._id === item._id);
|
82
82
|
|
83
83
|
if (existingItemIndex !== -1) {
|
84
84
|
array.splice(existingItemIndex, 1);
|
85
85
|
}
|
86
86
|
},
|
87
|
+
|
88
|
+
|
89
|
+
increment(array, item) {
|
90
|
+
console.log(array)
|
91
|
+
console.log(item)
|
92
|
+
const arrayItem = array.find(
|
93
|
+
(i) => i._id === item._id
|
94
|
+
);
|
95
|
+
|
96
|
+
if (arrayItem) {
|
97
|
+
arrayItem.quantity++;
|
98
|
+
}
|
99
|
+
},
|
100
|
+
|
101
|
+
decrement(array, item) {
|
102
|
+
const arrayItem = array.find(
|
103
|
+
(i) => i._id === item._id
|
104
|
+
);
|
105
|
+
|
106
|
+
const arrayItemIndex = array.indexOf(arrayItem);
|
107
|
+
|
108
|
+
if (arrayItemIndex > -1) {
|
109
|
+
arrayItem.quantity--;
|
110
|
+
|
111
|
+
if (arrayItem.quantity < 1) array.splice(arrayItemIndex, 1);
|
112
|
+
}
|
113
|
+
},
|
114
|
+
|
115
|
+
reset(array) {
|
116
|
+
array = [];
|
117
|
+
},
|
87
118
|
}
|
88
119
|
|
89
120
|
const errorMessages = {
|
@@ -1,7 +1,6 @@
|
|
1
1
|
<template>
|
2
2
|
<div
|
3
3
|
class="gap-small pos-relative cols-1"
|
4
|
-
style="box-sizing: content-box;"
|
5
4
|
>
|
6
5
|
|
7
6
|
<div class="pos-relative w-100 gap-thin flex-stretch flex-nowrap flex">
|
@@ -39,7 +38,7 @@
|
|
39
38
|
<!-- Quantity -->
|
40
39
|
<div v-if="editable" class="mn-t-thin gap-thin flex-nojustify flex">
|
41
40
|
<IconAdd
|
42
|
-
@click="
|
41
|
+
@click="increase_(product)"
|
43
42
|
class="hover-scale-1 cursor-pointer bg-grey i-big pd-thin radius-small"
|
44
43
|
/>
|
45
44
|
<IconMinus
|
@@ -72,15 +71,37 @@
|
|
72
71
|
|
73
72
|
const router = useRouter()
|
74
73
|
|
74
|
+
const emits = defineEmits(['increase', 'decrease', 'remove'])
|
75
|
+
|
75
76
|
const props = defineProps({
|
76
77
|
product: Object,
|
77
78
|
editable: String,
|
78
79
|
increase: Function,
|
79
80
|
decrease: Function,
|
80
81
|
remove: Function
|
81
|
-
|
82
82
|
})
|
83
83
|
|
84
|
+
function increase_ (product) {
|
85
|
+
if (props.increase) {
|
86
|
+
props.increase(product)
|
87
|
+
}
|
88
|
+
emits('increase', product)
|
89
|
+
}
|
90
|
+
|
91
|
+
function decrease (product) {
|
92
|
+
if (props.decrease) {
|
93
|
+
props.decrease(product)
|
94
|
+
}
|
95
|
+
emits('decrease', product)
|
96
|
+
}
|
97
|
+
|
98
|
+
function remove (product) {
|
99
|
+
if (props.remove) {
|
100
|
+
props.remove(product)
|
101
|
+
}
|
102
|
+
emits('remove', product)
|
103
|
+
}
|
104
|
+
|
84
105
|
</script>
|
85
106
|
|
86
107
|
<style lang="scss">
|
@@ -1,62 +1,104 @@
|
|
1
1
|
<template>
|
2
|
-
<
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
:products="Products"
|
13
|
-
/>
|
14
|
-
</Block>
|
15
|
-
|
16
|
-
<Block
|
17
|
-
title="Invetory Sheet"
|
18
|
-
class="mn-b-semi"
|
19
|
-
>
|
20
|
-
<span
|
21
|
-
v-if="orders.state.current.positions.length === 0"
|
22
|
-
class="w-100"
|
2
|
+
<div>
|
3
|
+
<header class="mn-b-medium flex-v-center flex-nowrap flex">
|
4
|
+
<h2 class="mn-r-medium">Create Order</h2>
|
5
|
+
</header>
|
6
|
+
|
7
|
+
<Popup
|
8
|
+
title="Добавить участника"
|
9
|
+
@close-popup="closeProductsPopup"
|
10
|
+
:isPopupOpen="isOpenProductsPopup"
|
11
|
+
class="bg-white w-min-30r w-max-30r radius-big pd-medium"
|
23
12
|
>
|
24
|
-
No positions added yet
|
25
|
-
</span>
|
26
|
-
|
27
|
-
<CardPosition
|
28
|
-
v-for="(product, index) in orders.state.current.positions"
|
29
|
-
:key="product._id"
|
30
|
-
:product="product"
|
31
|
-
:products="Products"
|
32
|
-
@add="addProduct"
|
33
|
-
@delete="deleteProduct"
|
34
|
-
@update="updateProduct"
|
35
|
-
/>
|
36
|
-
</Block>
|
37
|
-
<!--
|
38
|
-
<FormOrderDetails
|
39
|
-
:order="orders.state.current"
|
40
|
-
@create="handleCreate"
|
41
|
-
class="bg-grey pd-medium radius-big mn-b-semi"
|
42
|
-
/> -->
|
43
|
-
|
44
|
-
|
45
|
-
<div class="mn-thinw-100 flex-v-center flex block">
|
46
|
-
<p class="p-big">Сумма к оплате:
|
47
|
-
<span v-if="order.info?.delivery === 'Самовывоз'" class="p-big t-semi">{{ orderTotalPrice / 100 }} ₽</span>
|
48
|
-
<span v-if="order.info?.delivery === 'Курьером'" class="p-big t-semi">{{ orderTotalPrice / 100 + 350 }} ₽</span>
|
49
|
-
<span v-if="order.info?.delivery === 'Почтой'" class="p-big t-semi">{{ orderTotalPrice / 100 + 550 }} ₽</span>
|
50
|
-
(Заказ {{orderTotalPrice / 100}} ₽ + доставка
|
51
|
-
<span v-if="order.info?.delivery === 'Самовывоз'" >0</span>
|
52
|
-
<span v-if="order.info?.delivery === 'Курьером'" >350</span>
|
53
|
-
<span v-if="order.info?.delivery === 'Почтой'">550</span>
|
54
|
-
₽)
|
55
|
-
</p>
|
56
|
-
|
57
|
-
<button class="mn-l-auto button">Запросить онлайн</button>
|
58
|
-
</div>
|
59
13
|
|
14
|
+
<h3 class="mn-b-small">Add to order</h3>
|
15
|
+
|
16
|
+
<div class="bg-grey mn-b-thin h-min-20r h-max-20r o-scroll pd-medium radius-big">
|
17
|
+
<Feed
|
18
|
+
:search="true"
|
19
|
+
:states="{
|
20
|
+
empty: {
|
21
|
+
title: 'No Products Found',
|
22
|
+
description: 'Currently, there are no such products available.'
|
23
|
+
}
|
24
|
+
}"
|
25
|
+
:store="{
|
26
|
+
read: (options) => products.actions.read(options),
|
27
|
+
state: null
|
28
|
+
}"
|
29
|
+
:options="{
|
30
|
+
organization: route.params._id
|
31
|
+
}"
|
32
|
+
v-slot="{
|
33
|
+
items
|
34
|
+
}"
|
35
|
+
class=""
|
36
|
+
>
|
37
|
+
<CardOrderItem
|
38
|
+
v-for="(product, index) in items" :key="product._id"
|
39
|
+
:editable="false"
|
40
|
+
:product="product"
|
41
|
+
@click="() => {
|
42
|
+
let p = { ...product };
|
43
|
+
p.quantity = 1;
|
44
|
+
globals.actions.add(orders.state.current.positions, p)
|
45
|
+
closeProductsPopup();
|
46
|
+
}"
|
47
|
+
class="bg-white pd-thin radius-medium w-100 mn-b-thin"
|
48
|
+
/>
|
49
|
+
</Feed>
|
50
|
+
</div>
|
51
|
+
</Popup>
|
52
|
+
|
53
|
+
<Block
|
54
|
+
title="Invetory Sheet"
|
55
|
+
:actions="[{
|
56
|
+
label: '+',
|
57
|
+
function: () => openProductsPopup()
|
58
|
+
}]"
|
59
|
+
class="mn-b-semi"
|
60
|
+
>
|
61
|
+
<span
|
62
|
+
v-if="orders.state.current.positions.length === 0"
|
63
|
+
class="w-100"
|
64
|
+
>
|
65
|
+
No positions added yet
|
66
|
+
</span>
|
67
|
+
|
68
|
+
<CardOrderItem
|
69
|
+
v-for="(product, index) in orders.state.current.positions"
|
70
|
+
:key="product._id"
|
71
|
+
:editable="true"
|
72
|
+
:product="product"
|
73
|
+
@increase="() => { globals.actions.increment(orders.state.current.positions, product) }"
|
74
|
+
@decrease="() => { globals.actions.decrement(orders.state.current.positions, product) }"
|
75
|
+
@remove="() => { globals.actions.delete(orders.state.current.positions, product) }"
|
76
|
+
class="mn-b-thin pd-thin radius-medium bg-white"
|
77
|
+
/>
|
78
|
+
</Block>
|
79
|
+
<!--
|
80
|
+
<FormOrderDetails
|
81
|
+
:order="orders.state.current"
|
82
|
+
@create="handleCreate"
|
83
|
+
class="bg-grey pd-medium radius-big mn-b-semi"
|
84
|
+
/> -->
|
85
|
+
|
86
|
+
|
87
|
+
<div class="mn-thinw-100 flex-v-center flex block">
|
88
|
+
<p class="p-big">Сумма к оплате:
|
89
|
+
<span v-if="order?.info?.delivery === 'Самовывоз'" class="p-big t-semi">{{ orderTotalPrice / 100 }} ₽</span>
|
90
|
+
<span v-if="order?.info?.delivery === 'Курьером'" class="p-big t-semi">{{ orderTotalPrice / 100 + 350 }} ₽</span>
|
91
|
+
<span v-if="order?.info?.delivery === 'Почтой'" class="p-big t-semi">{{ orderTotalPrice / 100 + 550 }} ₽</span>
|
92
|
+
(Заказ {{orderTotalPrice / 100}} ₽ + доставка
|
93
|
+
<span v-if="order?.info?.delivery === 'Самовывоз'" >0</span>
|
94
|
+
<span v-if="order?.info?.delivery === 'Курьером'" >350</span>
|
95
|
+
<span v-if="order?.info?.delivery === 'Почтой'">550</span>
|
96
|
+
₽)
|
97
|
+
</p>
|
98
|
+
|
99
|
+
<button class="mn-l-auto button">Запросить онлайн</button>
|
100
|
+
</div>
|
101
|
+
</div>
|
60
102
|
|
61
103
|
|
62
104
|
</template>
|
@@ -66,79 +108,43 @@
|
|
66
108
|
import { computed, ref, defineProps, onMounted, reactive, toRefs, watch } from 'vue'
|
67
109
|
import { useRoute } from 'vue-router'
|
68
110
|
|
111
|
+
import Feed from '@pf/src/components/Feed/Feed.vue'
|
112
|
+
import Popup from '@pf/src/components/Popup/Popup.vue';
|
69
113
|
import Block from '@pf/src/components/Block/Block.vue';
|
70
114
|
|
71
|
-
import
|
115
|
+
import CardOrderItem from '@pf/src/modules/orders/components/blocks/CardOrderItem.vue'
|
116
|
+
|
72
117
|
import CardPosition from '@pf/src/modules/products/components/blocks/CardPosition.vue';
|
73
118
|
|
74
|
-
// import FormOrderDetails from '@pf/src/modules/orders/components/sections/FormOrderDetails.vue'
|
75
119
|
|
76
120
|
// Import your store
|
121
|
+
import * as globals from '@pf/src/modules/globals/store/globals';
|
77
122
|
import * as orders from '@pf/src/modules/orders/store/orders';
|
78
123
|
import * as products from '@pf/src/modules/products/store/products';
|
79
124
|
|
80
125
|
// Accessing router
|
81
126
|
const route = useRoute()
|
82
127
|
|
83
|
-
//
|
84
|
-
const
|
85
|
-
props.showProduct = [];
|
128
|
+
// Popup
|
129
|
+
const isOpenProductsPopup = ref(false);
|
86
130
|
|
87
|
-
function
|
88
|
-
|
131
|
+
function openProductsPopup() {
|
132
|
+
isOpenProductsPopup.value = true;
|
89
133
|
}
|
90
134
|
|
91
|
-
function
|
92
|
-
|
135
|
+
function closeProductsPopup() {
|
136
|
+
isOpenProductsPopup.value = false;
|
93
137
|
}
|
94
138
|
|
95
|
-
//
|
96
|
-
let
|
97
|
-
let reactiveData = toRefs(data)
|
98
|
-
var showAddNew = ref(false)
|
99
|
-
const Products = ref([])
|
139
|
+
// Data
|
140
|
+
let order = ref(null)
|
100
141
|
|
101
|
-
// Initialize order and products
|
102
|
-
let order = ref({})
|
103
|
-
// Replace store orders.actions with your orders.actions
|
104
142
|
onMounted(async () => {
|
105
|
-
//
|
106
|
-
try {
|
107
|
-
const productsResponse = await products.actions.read({
|
108
|
-
organization: '65141c476cf9860013b49f6d'
|
109
|
-
});
|
110
|
-
console.log(productsResponse)
|
111
|
-
Products.value = productsResponse;
|
112
|
-
} catch (error) {
|
113
|
-
console.error('error');
|
114
|
-
}
|
115
|
-
|
116
|
-
await orders.actions.fetchOrder(route.params.id) // Implement this action in your store
|
117
|
-
|
118
|
-
order.value = orders.state.current
|
119
|
-
})
|
143
|
+
// await orders.actions.fetchOrder(route.params.id) // Implement this action in your store
|
120
144
|
|
145
|
+
// order.value = orders.state.current
|
146
|
+
})
|
121
147
|
|
122
|
-
function saveItemList() {
|
123
|
-
orders.actions.updateOrderpositions(route.params.id) // Replace Vuex action with your action
|
124
|
-
}
|
125
|
-
|
126
|
-
function changeEdit(index) {
|
127
|
-
data[index] = !data[index]
|
128
|
-
}
|
129
|
-
|
130
|
-
function resetOrderList() {
|
131
|
-
orders.actions.fetchOrder(route.params.id) // Replace Vuex action with your action
|
132
|
-
}
|
133
|
-
|
134
|
-
function changeAdd() {
|
135
|
-
showAddNew.value = !showAddNew.value
|
136
|
-
}
|
137
|
-
|
138
|
-
// Replace computed properties with reactive orders.state
|
139
|
-
// Update this line to match your orders.state structure
|
140
|
-
const orderTotalPrice = computed(() => 100) // Implement this getter in your orders.actions
|
141
|
-
const orderProducts = computed(() => []) // Implement this getter in your orders.actions
|
142
148
|
</script>
|
143
149
|
|
144
150
|
|
@@ -75,9 +75,9 @@
|
|
75
75
|
])
|
76
76
|
|
77
77
|
const productSelected = ref(null);
|
78
|
-
const productQuantity = ref(
|
78
|
+
const productQuantity = ref(1);
|
79
79
|
const productQuantityType = ref('pcs');
|
80
|
-
const productPrice = ref(
|
80
|
+
const productPrice = ref(0);
|
81
81
|
|
82
82
|
const isProductValid = computed(() =>
|
83
83
|
productSelected.value
|
@@ -87,14 +87,14 @@
|
|
87
87
|
|
88
88
|
watch(props.array, () => {
|
89
89
|
productSelected.value = props.product
|
90
|
-
productQuantity.value = props.product.quantity
|
90
|
+
productQuantity.value = props.product.quantity || 1
|
91
91
|
productPrice.value = props.product.price
|
92
92
|
productQuantityType.value = props.product.type
|
93
93
|
});
|
94
94
|
|
95
95
|
if (props.product) {
|
96
96
|
productSelected.value = props.product
|
97
|
-
productQuantity.value = props.product.quantity
|
97
|
+
productQuantity.value = props.product.quantity || 1
|
98
98
|
productPrice.value = props.product.price
|
99
99
|
productQuantityType.value = props.product.type
|
100
100
|
}
|
@@ -105,7 +105,7 @@
|
|
105
105
|
emits('update', {
|
106
106
|
...productSelected.value,
|
107
107
|
price: productPrice.value,
|
108
|
-
quantity: productQuantity.value,
|
108
|
+
quantity: productQuantity.value || 1,
|
109
109
|
type: productQuantityType.value
|
110
110
|
});
|
111
111
|
});
|
@@ -115,7 +115,7 @@
|
|
115
115
|
emits('add', {
|
116
116
|
...productSelected.value,
|
117
117
|
price: productPrice.value,
|
118
|
-
quantity: productQuantity.value,
|
118
|
+
quantity: productQuantity.value || 1,
|
119
119
|
type: productQuantityType.value
|
120
120
|
});
|
121
121
|
}
|
@@ -124,7 +124,7 @@
|
|
124
124
|
emits('delete', {
|
125
125
|
...productSelected.value,
|
126
126
|
price: productPrice.value,
|
127
|
-
quantity: productQuantity.value,
|
127
|
+
quantity: productQuantity.value || 1,
|
128
128
|
type: productQuantityType.value
|
129
129
|
});
|
130
130
|
}
|