WIP MMCM
This commit is contained in:
@@ -1,4 +1,17 @@
|
||||
import {defineStore} from 'pinia'
|
||||
import {add} from "date-fns";
|
||||
|
||||
const today = new Date();
|
||||
|
||||
const tomorrow =
|
||||
add(new Date(), {
|
||||
days: 1
|
||||
})
|
||||
|
||||
const afterTomorrow =
|
||||
add(new Date(), {
|
||||
days: 2
|
||||
})
|
||||
|
||||
export const useMMCMStore = defineStore('counter', {
|
||||
state: () => ({
|
||||
@@ -8,12 +21,15 @@ export const useMMCMStore = defineStore('counter', {
|
||||
productList: [],
|
||||
withPrescription: null,
|
||||
idProduct: null,
|
||||
dateDelivery: null
|
||||
dateDelivery: null,
|
||||
dateCollect :null
|
||||
}),
|
||||
getters: {
|
||||
fullAddress: (state) => state.street + ' ' + state.zipCode + ' ' + state.city,
|
||||
deliveryMethod: (state) => state.productList.filter(p => p.id === state.idProduct)[0].name,
|
||||
dateDeliveryString: (state) => new Date(state.dateDelivery).toLocaleDateString("fr-FR")
|
||||
dateDeliveryString: (state) => new Date(state.dateDelivery).toLocaleDateString("fr-FR"),
|
||||
minDateForDelivery : (state) => (state.productList.filter(p => p.id === state.idProduct)[0].ref === 'MMCM_EXPRESS') ? today : tomorrow ,
|
||||
needPrescriptionDateCollect : (state) => !!(state.productList.filter(p => p.id === state.idProduct)[0].ref === 'MMCM_FACTEUR' && state.withPrescription),
|
||||
},
|
||||
actions: {
|
||||
setStreet(street) {
|
||||
|
||||
Reference in New Issue
Block a user