diff --git a/src/core/api/CustomerAbsences.js b/src/core/api/CustomerAbsences.js index 41a6710ccf..5eeeb0743d 100644 --- a/src/core/api/CustomerAbsences.js +++ b/src/core/api/CustomerAbsences.js @@ -8,4 +8,7 @@ export default { async updateById (id, payload) { await alenviAxios.put(`${process.env.API_HOSTNAME}/customerabsences/${id}`, payload); }, + async remove (id) { + await alenviAxios.delete(`${process.env.API_HOSTNAME}/customerabsences/${id}`); + }, }; diff --git a/src/core/components/courses/SlotContainer.vue b/src/core/components/courses/SlotContainer.vue index a847cf9cf1..644ddaa533 100644 --- a/src/core/components/courses/SlotContainer.vue +++ b/src/core/components/courses/SlotContainer.vue @@ -47,13 +47,11 @@ - - - - diff --git a/src/core/components/form/DateRange.vue b/src/core/components/form/DateRange.vue index ae36f16ef9..4135c6d7d4 100644 --- a/src/core/components/form/DateRange.vue +++ b/src/core/components/form/DateRange.vue @@ -101,6 +101,8 @@ export default { & .delimiter margin: 0 color: $copper-grey-700 + /deep/ .q-field__control + border: none !important .date-item /deep/ .q-field__native diff --git a/src/core/helpers/date.js b/src/core/helpers/date.js index 1f0d18925c..9157151e56 100644 --- a/src/core/helpers/date.js +++ b/src/core/helpers/date.js @@ -31,7 +31,7 @@ export const isBetween = (date, min, max) => new Date(date) < new Date(max) && n export const getStartOfDay = date => new Date(date.getFullYear(), date.getMonth(), date.getDate()); -export const getEndOfDay = date => new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59); +export const getEndOfDay = date => new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59, 999); export const ascendingSort = (a, b) => { if (moment(a).isAfter(b)) return 1; diff --git a/src/modules/client/components/auxiliary/AuxiliaryCreationModal.vue b/src/modules/client/components/auxiliary/AuxiliaryCreationModal.vue index 8cfadea592..8653ea39d5 100644 --- a/src/modules/client/components/auxiliary/AuxiliaryCreationModal.vue +++ b/src/modules/client/components/auxiliary/AuxiliaryCreationModal.vue @@ -39,7 +39,6 @@ diff --git a/src/modules/client/pages/ni/config/CompanyConfig.vue b/src/modules/client/pages/ni/config/CompanyConfig.vue index 0e30ba7f9c..8d979df614 100644 --- a/src/modules/client/pages/ni/config/CompanyConfig.vue +++ b/src/modules/client/pages/ni/config/CompanyConfig.vue @@ -82,15 +82,15 @@ - - + :loading="loading" :work-health-services="workHealthServiceList" :urssaf-codes="urssafCodeList" + @update="setEstablishment" /> - - + :loading="loading" :work-health-services="workHealthServiceList" :urssaf-codes="urssafCodeList" + @update="setEstablishment" /> @@ -99,6 +99,7 @@ import { mapGetters } from 'vuex'; import get from 'lodash/get'; import cloneDeep from 'lodash/cloneDeep'; import pick from 'lodash/pick'; +import set from 'lodash/set'; import { required, maxLength } from 'vuelidate/lib/validators'; import Establishments from '@api/Establishments'; import TitleHeader from '@components/TitleHeader'; @@ -108,8 +109,8 @@ import ResponsiveTable from '@components/table/ResponsiveTable'; import SearchAddress from '@components/form/SearchAddress'; import { NotifyNegative, NotifyPositive, NotifyWarning } from '@components/popup/notify'; import { COMPANY } from '@data/constants'; -import { urssafCodes } from '@data/urssafCodes'; -import { workHealthServices } from '@data/workHealthServices'; +import { urssafCodes as urssafCodeList } from '@data/urssafCodes'; +import { workHealthServices as workHealthServiceList } from '@data/workHealthServices'; import { frAddress, validWorkHealthService, @@ -157,14 +158,14 @@ export default { label: 'Service de santé du travail', align: 'left', field: 'workHealthService', - format: value => (value ? get(workHealthServices.find(whs => whs.value === value), 'label', '') : ''), + format: value => (value ? get(workHealthServiceList.find(whs => whs.value === value), 'label', '') : ''), }, { name: 'urssafCode', label: 'Code URSSAF', align: 'left', field: 'urssafCode', - format: value => (value ? get(urssafCodes.find(code => code.value === value), 'label', '') : ''), + format: value => (value ? get(urssafCodeList.find(code => code.value === value), 'label', '') : ''), }, { name: 'actions', label: '', align: 'center', field: '_id' }, ], @@ -187,8 +188,8 @@ export default { urssafCode: '', }, establishmentEditionModal: false, - workHealthServices, - urssafCodes, + workHealthServiceList, + urssafCodeList, establishmentValidation: { name: { required, maxLength: maxLength(32) }, siret: { required, validSiret }, @@ -283,6 +284,11 @@ export default { }; this.$v.editedEstablishment.$reset(); }, + setEstablishment (payload) { + const { path, value } = payload; + if (this.establishmentCreationModal) set(this.newEstablishment, path, value); + else if (this.establishmentEditionModal) set(this.editedEstablishment, path, value); + }, async updateEstablishment () { try { this.$v.editedEstablishment.$touch(); @@ -290,7 +296,7 @@ export default { if (!formIsValid) return NotifyWarning('Champ(s) invalide(s)'); this.loading = true; - const fields = ['name', 'siret', 'address', 'phone', 'workHealthServices', 'urssafCodes']; + const fields = ['name', 'siret', 'address', 'phone', 'workHealthService', 'urssafCode']; if (this.editedEstablishment.phone) { this.editedEstablishment.phone = formatPhoneForPayload(this.editedEstablishment.phone); } diff --git a/src/modules/client/pages/ni/config/CustomersConfig.vue b/src/modules/client/pages/ni/config/CustomersConfig.vue index f48807b873..f1f3b5108d 100644 --- a/src/modules/client/pages/ni/config/CustomersConfig.vue +++ b/src/modules/client/pages/ni/config/CustomersConfig.vue @@ -160,24 +160,20 @@ - - - - - - - + :loading="loading" :billing-mode-options="billingModeOptions" :new-third-party-payer="newThirdPartyPayer" /> - - @@ -211,6 +204,7 @@ import capitalize from 'lodash/capitalize'; import cloneDeep from 'lodash/cloneDeep'; import pickBy from 'lodash/pickBy'; import pick from 'lodash/pick'; +import set from 'lodash/set'; import compact from 'lodash/compact'; import uniq from 'lodash/uniq'; import get from 'lodash/get'; @@ -356,8 +350,6 @@ export default { }, surchargesColumns: [ { name: 'name', label: 'Nom', align: 'left', field: 'name' }, - { name: 'saturday', label: 'Samedi', align: 'center', field: row => roundFrenchPercentage(row.saturday, 0) }, - { name: 'sunday', label: 'Dimanche', align: 'center', field: row => roundFrenchPercentage(row.sunday, 0) }, { name: 'firstOfJanuary', label: '1er janvier', @@ -382,6 +374,8 @@ export default { align: 'center', field: row => roundFrenchPercentage(row.publicHoliday, 0), }, + { name: 'saturday', label: 'Samedi', align: 'center', field: row => roundFrenchPercentage(row.saturday, 0) }, + { name: 'sunday', label: 'Dimanche', align: 'center', field: row => roundFrenchPercentage(row.sunday, 0) }, { name: 'evening', label: 'Soirée', align: 'center', field: row => roundFrenchPercentage(row.evening, 0) }, { name: 'eveningStartTime', @@ -1133,13 +1127,18 @@ export default { // Third party payers openThirdPartyPayerEditionModal (tppId) { this.thirdPartyPayerEditionModal = true; - const currentThirdPartyPayer = this.thirdPartyPayers.find(tpp => tpp._id === tppId); + const selectedTpp = this.thirdPartyPayers.find(tpp => tpp._id === tppId); + const { _id, name, address, email: tppEmail, unitTTCRate, billingMode, isApa, teletransmissionId } = selectedTpp; + this.editedThirdPartyPayer = { - address: {}, - ...pick( - currentThirdPartyPayer, - ['_id', 'name', 'address', 'email', 'unitTTCRate', 'billingMode', 'isApa', 'teletransmissionId'] - ), + _id, + name: name || '', + email: tppEmail || '', + address: address || {}, + unitTTCRate: unitTTCRate || 0, + billingMode: billingMode || '', + isApa: isApa || false, + teletransmissionId: teletransmissionId || '', }; }, resetThirdPartyPayerCreation () { @@ -1160,6 +1159,11 @@ export default { return { isApa: false, ...pickBy(payload) }; }, + setThirdPartyPayer (payload) { + const { path, value } = payload; + if (this.thirdPartyPayerCreationModal) set(this.newThirdPartyPayer, path, value); + else if (this.thirdPartyPayerEditionModal) set(this.editedThirdPartyPayer, path, value); + }, async createNewThirdPartyPayer () { try { this.$v.newThirdPartyPayer.$touch(); diff --git a/src/modules/client/pages/ni/planning/CustomerPlanning.vue b/src/modules/client/pages/ni/planning/CustomerPlanning.vue index 6f1becfcd4..15cacfcdc4 100644 --- a/src/modules/client/pages/ni/planning/CustomerPlanning.vue +++ b/src/modules/client/pages/ni/planning/CustomerPlanning.vue @@ -248,8 +248,9 @@ export default { }; this.customerAbsenceModal = true; }, - closeCustomerAbsenceModal () { + async closeCustomerAbsenceModal () { this.customerAbsenceModal = false; + await this.refresh(); }, resetCustomerAbsenceEditionForm () { this.$v.editedCustomerAbsence.$reset(); diff --git a/src/modules/vendor/components/programs/ProfileContent.vue b/src/modules/vendor/components/programs/ProfileContent.vue index 85a62d4e1c..9f9c214f47 100644 --- a/src/modules/vendor/components/programs/ProfileContent.vue +++ b/src/modules/vendor/components/programs/ProfileContent.vue @@ -589,9 +589,10 @@ export default { return step.subPrograms && step.subPrograms.length > 1; }, initAreStepsLocked () { - this.areStepsLocked = Object.assign(...this.program.subPrograms + const steps = this.program.subPrograms .map(sp => sp.steps.map(step => ({ [step._id]: this.isReused(step) }))) - .flat()); + .flat(); + this.areStepsLocked = steps.length ? Object.assign(...steps) : {}; }, async openSubProgramPublicationModal () { try {