From f250f658148dfe6c77f4e4aa8773c362b6484b3e Mon Sep 17 00:00:00 2001 From: Jonathan Chevalier Date: Wed, 12 Oct 2022 17:37:30 +0200 Subject: [PATCH] WIP MMCM --- src/stores/mmcm.js | 11 +++++++---- src/views/delivery-option-step-3.vue | 15 --------------- src/views/delivery-option-summary.vue | 6 ++++-- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/stores/mmcm.js b/src/stores/mmcm.js index 72dd67f..4720dc5 100644 --- a/src/stores/mmcm.js +++ b/src/stores/mmcm.js @@ -13,6 +13,8 @@ const afterTomorrow = days: 2 }) +const timestampConverter = (digit13) => digit13 / 1000 + export const useMMCMStore = defineStore('counter', { state: () => ({ street: '', @@ -21,15 +23,16 @@ export const useMMCMStore = defineStore('counter', { productList: [], withPrescription: null, idProduct: null, - dateDelivery: null, - dateCollect :null + dateDelivery: null, // 13 digit timestamp millisecond + 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"), - 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), + 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), + dateDeliveryTimestampInSecond: (state) => timestampConverter(state.dateDelivery) }, actions: { setStreet(street) { diff --git a/src/views/delivery-option-step-3.vue b/src/views/delivery-option-step-3.vue index a641d9c..4fb44c8 100644 --- a/src/views/delivery-option-step-3.vue +++ b/src/views/delivery-option-step-3.vue @@ -1,19 +1,4 @@