WIP MMCM
This commit is contained in:
@@ -13,6 +13,8 @@ const afterTomorrow =
|
|||||||
days: 2
|
days: 2
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const timestampConverter = (digit13) => digit13 / 1000
|
||||||
|
|
||||||
export const useMMCMStore = defineStore('counter', {
|
export const useMMCMStore = defineStore('counter', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
street: '',
|
street: '',
|
||||||
@@ -21,15 +23,16 @@ export const useMMCMStore = defineStore('counter', {
|
|||||||
productList: [],
|
productList: [],
|
||||||
withPrescription: null,
|
withPrescription: null,
|
||||||
idProduct: null,
|
idProduct: null,
|
||||||
dateDelivery: null,
|
dateDelivery: null, // 13 digit timestamp millisecond
|
||||||
dateCollect :null
|
dateCollect: null
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
fullAddress: (state) => state.street + ' ' + state.zipCode + ' ' + state.city,
|
fullAddress: (state) => state.street + ' ' + state.zipCode + ' ' + state.city,
|
||||||
deliveryMethod: (state) => state.productList.filter(p => p.id === state.idProduct)[0].name,
|
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 ,
|
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),
|
needPrescriptionDateCollect: (state) => !!(state.productList.filter(p => p.id === state.idProduct)[0].ref === 'MMCM_FACTEUR' && state.withPrescription),
|
||||||
|
dateDeliveryTimestampInSecond: (state) => timestampConverter(state.dateDelivery)
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
setStreet(street) {
|
setStreet(street) {
|
||||||
|
|||||||
@@ -1,19 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="store.needPrescriptionDateCollect">
|
|
||||||
<div class="step_title">Date de collecte de l'ordonnance :</div>
|
|
||||||
<div class="input-group has-validation">
|
|
||||||
<Datepicker v-model="dateCollect" autoApply @update:modelValue="isErrorCollect = false" model-type="timestamp"
|
|
||||||
select-text="Choisir" cancel-text="Annuler"
|
|
||||||
monthNameFormat="long" format="dd MMMM yyyy" :minDate="store.minDateForDelivery" :enableTimePicker="false"
|
|
||||||
:disabledWeekDays="[6, 0]" :format-locale="fr" locale="fr-FR"/>
|
|
||||||
<button class="btn btn-primary" @click="gotToNextStep"><i class="fa-regular fa-circle-check fa-fw"></i> Valider
|
|
||||||
</button>
|
|
||||||
<div v-if="isErrorCollect" class="invalid-feedback d-block text-start">
|
|
||||||
Merci de renseigner la date
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="step_title">Date de livraison des médicaments :</div>
|
<div class="step_title">Date de livraison des médicaments :</div>
|
||||||
<div class="input-group has-validation">
|
<div class="input-group has-validation">
|
||||||
<Datepicker v-model="dateDelivery" autoApply @update:modelValue="isErrorDelivery = false" model-type="timestamp"
|
<Datepicker v-model="dateDelivery" autoApply @update:modelValue="isErrorDelivery = false" model-type="timestamp"
|
||||||
|
|||||||
@@ -33,18 +33,20 @@ export default {
|
|||||||
},
|
},
|
||||||
name: "delivery-option-summary",
|
name: "delivery-option-summary",
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
addToCart: async function (idProduct) {
|
addToCart: async function (idProduct) {
|
||||||
|
|
||||||
this.suspens = true
|
this.suspens = true
|
||||||
let urlApi = '/php/api/v3/mmcm.php?EXEC=addToCart&ID_PRODUCT=' + this.store.idProduct
|
let urlApi = '/php/api/v3/mmcm.php?EXEC=addToCart&ID_PRODUCT=' + this.store.idProduct
|
||||||
+ '&with_prescription=' + this.store.withPrescription
|
+ '&with_prescription=' + this.store.withPrescription
|
||||||
+ '&date_delivery=' + this.store.dateDelivery
|
+ '&date_delivery=' + this.store.dateDeliveryTimestampInSecond
|
||||||
+ '&street=' + encodeURI(this.store.street)
|
+ '&street=' + encodeURI(this.store.street)
|
||||||
+ '&zip_code=' + this.store.zipCode
|
+ '&zip_code=' + this.store.zipCode
|
||||||
+ '&city=' +this.store.city
|
+ '&city=' +this.store.city
|
||||||
;
|
;
|
||||||
|
|
||||||
if(import.meta.env.DEV){
|
if(import.meta.env.DEV){
|
||||||
urlApi += '&ID_SESSION=xcn6c41b'
|
urlApi += '&ID_SESSION=uYkQcd22'
|
||||||
console.log(urlApi)
|
console.log(urlApi)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user