project-booster-vue 10.23.4 → 10.23.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
|
|
19
19
|
<m-flex class="pb-products__body" direction="column" align-items="center" v-if="product">
|
|
20
20
|
<m-flex class="pb-products__body__item" direction="column" align-items="center" justify-content="center">
|
|
21
|
-
<div class="pb-products__body__item__thumbnail">
|
|
21
|
+
<div class="pb-products__body__item__thumbnail" v-if="product.photo">
|
|
22
22
|
<img :src="product.photo" alt="" />
|
|
23
23
|
</div>
|
|
24
|
-
<div class="pb-products__body__item__title">{{ product.designation }}</div>
|
|
24
|
+
<div class="pb-products__body__item__title" v-if="product.designation">{{ product.designation }}</div>
|
|
25
25
|
</m-flex>
|
|
26
26
|
|
|
27
27
|
<m-flex class="pb-products__container--button" direction="column" align-items="center" justify-content="center">
|
|
@@ -12,22 +12,22 @@
|
|
|
12
12
|
</m-link>
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
|
-
<div class="pb-products__body row-flex column"
|
|
15
|
+
<div class="pb-products__body row-flex column">
|
|
16
16
|
<div class="pb-products__title">
|
|
17
17
|
{{ payload.viewModel.label }}
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
|
-
<div class="pb-products__body__item" v-if="product
|
|
20
|
+
<div class="pb-products__body__item" v-if="product">
|
|
21
21
|
<div class="pb-products__body__item__thumbnail" v-if="product.photo">
|
|
22
22
|
<img :src="product.photo" alt="photo du produit" />
|
|
23
23
|
</div>
|
|
24
|
-
<div class="pb-products__body__item__title">{{
|
|
24
|
+
<div class="pb-products__body__item__title" v-if="designation">{{ designation }}</div>
|
|
25
25
|
</div>
|
|
26
26
|
<div class="pb-products__body__item" v-else>
|
|
27
|
-
<div class="pb-products__body__item__thumbnail">
|
|
27
|
+
<div class="pb-products__body__item__thumbnail" v-if="payload.viewModel.defaultProduct.photo">
|
|
28
28
|
<img :src="payload.viewModel.defaultProduct.photo" alt="photo du produit" />
|
|
29
29
|
</div>
|
|
30
|
-
<div class="pb-products__body__item__title">{{
|
|
30
|
+
<div class="pb-products__body__item__title">{{ designation }}</div>
|
|
31
31
|
</div>
|
|
32
32
|
|
|
33
33
|
<div class="pb-products__container--button">
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
import { Product } from '@/types/pb/Estimate';
|
|
54
54
|
import { ScenarioStepAnswer } from '@/types/pb/Scenario';
|
|
55
55
|
import { MButton, MLink } from '@mozaic-ds/vue-3';
|
|
56
|
-
import { PropType, defineProps, onMounted, ref } from 'vue';
|
|
56
|
+
import { PropType, defineProps, onBeforeMount, onMounted, ref, watch } from 'vue';
|
|
57
57
|
import { useStore } from 'vuex';
|
|
58
58
|
import { PayloadAction } from '../types/genericPayload';
|
|
59
59
|
|
|
@@ -61,24 +61,9 @@ const emit = defineEmits(['go-back', 'step-completed']);
|
|
|
61
61
|
|
|
62
62
|
const store = useStore();
|
|
63
63
|
const metadata = store.getters['metaData/metaData'];
|
|
64
|
-
const refProduct: string = store.getters['products/getRefProduct'];
|
|
65
|
-
const product = ref<Product>(store.getters['products/getCurrentProduct']);
|
|
66
64
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
code: 'Code du produit',
|
|
70
|
-
designation: 'Désignation du produit',
|
|
71
|
-
photo: '',
|
|
72
|
-
price: {
|
|
73
|
-
unitAmount: 0,
|
|
74
|
-
initialUnitAmount: 0,
|
|
75
|
-
unitAmountNoTax: 0,
|
|
76
|
-
initialUnitAmountNoTax: 0,
|
|
77
|
-
currency: 'EURO',
|
|
78
|
-
discount: null,
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
}
|
|
65
|
+
const product = ref<Product>();
|
|
66
|
+
const designation = ref<string>();
|
|
82
67
|
|
|
83
68
|
const props = defineProps({
|
|
84
69
|
/**
|
|
@@ -135,9 +120,9 @@ const props = defineProps({
|
|
|
135
120
|
});
|
|
136
121
|
|
|
137
122
|
/**
|
|
138
|
-
*
|
|
123
|
+
* Load product from store.
|
|
139
124
|
*/
|
|
140
|
-
|
|
125
|
+
onBeforeMount(() => {
|
|
141
126
|
if (store.hasModule('products')) {
|
|
142
127
|
store.dispatch('products/loadProduct', {
|
|
143
128
|
payload: props.payload.viewModel.defaultProduct,
|
|
@@ -146,6 +131,19 @@ onMounted(() => {
|
|
|
146
131
|
}
|
|
147
132
|
});
|
|
148
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Update product and designation when product is loaded.
|
|
136
|
+
*/
|
|
137
|
+
onMounted(() => {
|
|
138
|
+
watch(
|
|
139
|
+
() => store.getters['products/getCurrentProduct'],
|
|
140
|
+
(newProduct) => {
|
|
141
|
+
product.value = newProduct;
|
|
142
|
+
designation.value = product.value?.designation || props.payload.viewModel.defaultProduct?.designation || '';
|
|
143
|
+
},
|
|
144
|
+
);
|
|
145
|
+
});
|
|
146
|
+
|
|
149
147
|
/**
|
|
150
148
|
* Send action to completed step
|
|
151
149
|
* @param action
|
|
@@ -155,20 +153,21 @@ const callAction = (action: PayloadAction) => {
|
|
|
155
153
|
if (action.code === '__BACK__') {
|
|
156
154
|
emit('go-back');
|
|
157
155
|
} else {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
156
|
+
if (product.value) {
|
|
157
|
+
emit('step-completed', {
|
|
158
|
+
answers: [
|
|
159
|
+
{
|
|
160
|
+
product: product.value,
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
nextStep: action,
|
|
164
|
+
});
|
|
165
|
+
} else {
|
|
166
|
+
emit('step-completed', {
|
|
167
|
+
answers: [{}],
|
|
168
|
+
nextStep: action,
|
|
169
|
+
});
|
|
162
170
|
}
|
|
163
|
-
|
|
164
|
-
emit('step-completed', {
|
|
165
|
-
answers: [
|
|
166
|
-
{
|
|
167
|
-
product: productToSend,
|
|
168
|
-
},
|
|
169
|
-
],
|
|
170
|
-
nextStep: action,
|
|
171
|
-
});
|
|
172
171
|
}
|
|
173
172
|
}
|
|
174
173
|
};
|
|
@@ -32,10 +32,11 @@ export default {
|
|
|
32
32
|
updateRefProduct({ commit }: ProductContext, { ref }: { ref: string }) {
|
|
33
33
|
commit('setRefProduct', ref);
|
|
34
34
|
},
|
|
35
|
+
|
|
35
36
|
async loadProduct(
|
|
36
37
|
{ commit, state }: ProductContext,
|
|
37
38
|
{ payload, storeId }: { payload: ProductPayload; storeId: string },
|
|
38
|
-
) {
|
|
39
|
+
): Promise<void> {
|
|
39
40
|
if (state.refProduct) {
|
|
40
41
|
const product: Product | null = await getProductById(state.refProduct, storeId);
|
|
41
42
|
|