WIP MMCM
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import {defineStore} from 'pinia'
|
import {defineStore} from 'pinia'
|
||||||
import {add, format} from "date-fns";
|
import {add, format, formatDistance} from "date-fns";
|
||||||
|
import {fr} from 'date-fns/locale';
|
||||||
|
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
|
|
||||||
@@ -86,6 +87,29 @@ export const useMMCMStore = defineStore('counter', {
|
|||||||
minDateForCollect: (state) => (state.productList.filter(p => p.id === state.idProduct)[0].ref === 'MMCM_EXPRESS') ? date.collectExpress : date.collectFacteur,
|
minDateForCollect: (state) => (state.productList.filter(p => p.id === state.idProduct)[0].ref === 'MMCM_EXPRESS') ? date.collectExpress : date.collectFacteur,
|
||||||
needPrescriptionDateCollect: (state) => !!(state.productList.filter(p => p.id === state.idProduct)[0].ref === 'MMCM_FACTEUR' && state.withPrescription),
|
needPrescriptionDateCollect: (state) => !!(state.productList.filter(p => p.id === state.idProduct)[0].ref === 'MMCM_FACTEUR' && state.withPrescription),
|
||||||
dateDeliveryTimestampInSecond: (state) => timestampConverter(state.dateDelivery),
|
dateDeliveryTimestampInSecond: (state) => timestampConverter(state.dateDelivery),
|
||||||
|
msgDelivery : (state) => {
|
||||||
|
|
||||||
|
//console.log(formatDistance(date.deliveryExpress, today))
|
||||||
|
|
||||||
|
let arr = []
|
||||||
|
|
||||||
|
if(date.deliveryExpress === today){
|
||||||
|
arr.push('Dès aujourd\'hui en moins de 2h')
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
arr.push('A partir de ' + format(date.deliveryExpress, 'EEEE', {locale : fr}) +' en moins de 2h')
|
||||||
|
}
|
||||||
|
|
||||||
|
const useFacteurDate = (state.withPrescription) ? date.deliveryFacteur : date.collectFacteur;
|
||||||
|
|
||||||
|
if(useFacteurDate === tomorrow){
|
||||||
|
arr.push('A partir de demain entre 9h et 17h')
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
arr.push('A partir de ' + format(useFacteurDate, 'EEEE', {locale : fr}) + ' entre 9h et 17h')
|
||||||
|
}
|
||||||
|
return arr
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export default {
|
|||||||
name: "address-check",
|
name: "address-check",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
query: "",
|
query: "9 Impasse des Peupliers 13008 Marseill",
|
||||||
searchResults: [],
|
searchResults: [],
|
||||||
isSearching: false,
|
isSearching: false,
|
||||||
isChecking: false,
|
isChecking: false,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header fw-bold"><img :alt="product.name" :src="product.media_list[0].filename" class="me-2" height="50"/> {{ product.name }}</div>
|
<div class="card-header fw-bold"><img :alt="product.name" :src="product.media_list[0].filename" class="me-2" height="50"/> {{ product.name }}</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
<div class="fw-bold mb-2 text-primary"><i class="fa-solid fa-calendar-days"></i> {{store.msgDelivery[i]}}</div>
|
||||||
<div v-html="(store.withPrescription ? product.description1 : product.description2)"></div>
|
<div v-html="(store.withPrescription ? product.description1 : product.description2)"></div>
|
||||||
<button class="btn btn-primary" @click="goNexStep(product.id)">{{ formatPrice(store.withPrescription ? product.price : product.price2) }} TTC</button>
|
<button class="btn btn-primary" @click="goNexStep(product.id)">{{ formatPrice(store.withPrescription ? product.price : product.price2) }} TTC</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export default {
|
|||||||
title: 'Date de livraison des médicaments :',
|
title: 'Date de livraison des médicaments :',
|
||||||
vModel: dateDelivery,
|
vModel: dateDelivery,
|
||||||
error: false,
|
error: false,
|
||||||
minDate: store.minDateForDelivery,
|
minDate: (store.needPrescriptionDateCollect) ? store.minDateForDelivery : store.minDateForCollect,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user