Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MES 20/12 #1404

Merged
merged 32 commits into from
Dec 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
174398b
COM-2552 - fix bug
manonpalin Dec 14, 2021
e2351ab
COM-2526 - fix stoppedAt generation date
manonpalin Dec 14, 2021
6047c99
COM-2574: error in console on locked steps
ulysseferreira Dec 14, 2021
ed50f0d
COM-2365 add textarea type to enlarge note area
manonpalin Oct 6, 2021
dde5351
Merge pull request #1395 from sophiemoustard/COM-2574
cmolle Dec 14, 2021
be2fd28
Merge pull request #1392 from sophiemoustard/COM-2552-fix
sophiemoustard Dec 14, 2021
b1fe8cc
Merge pull request #1299 from sophiemoustard/COM-2365
sophiemoustard Dec 15, 2021
87ad393
COM-2553 - can remove customer absence
manonpalin Dec 15, 2021
0159bec
COM-2553 - fix style
manonpalin Dec 15, 2021
a46d042
COM-2462: block multiple api calls
ulysseferreira Dec 15, 2021
9952961
COM-2553 - fix reviews
manonpalin Dec 15, 2021
2d4bdad
Merge pull request #1396 from sophiemoustard/COM-2553
KennyCallegari Dec 16, 2021
bce2c0f
COM-2576 - Fix customer absence creation on stop date
KennyCallegari Dec 16, 2021
f469f57
Merge pull request #1397 from sophiemoustard/COM-2462
cmolle Dec 16, 2021
5b1187e
COM-2576 - EUREKA
KennyCallegari Dec 16, 2021
7cdc08c
COM-2563 block address validation calls
CorentinMartinot Dec 16, 2021
1e43764
COM-2563 remove useless .sync and redundant modal title
CorentinMartinot Dec 16, 2021
861504f
COM-2563 refacto update
CorentinMartinot Dec 16, 2021
e92f9e3
COM-2563 remove useless import
CorentinMartinot Dec 16, 2021
cf49766
COM-2462: pass set in parent
ulysseferreira Dec 16, 2021
4a57175
Merge pull request #1400 from sophiemoustard/COM-2462-2
sophiemoustard Dec 17, 2021
db1e680
Merge pull request #1399 from sophiemoustard/COM-2463
sophiemoustard Dec 17, 2021
ac1c9a3
COM-2564 refacto update
CorentinMartinot Dec 17, 2021
9348506
Merge pull request #1398 from sophiemoustard/COM-2576
sophiemoustard Dec 17, 2021
282270c
COM-2564 fix update for urssafCode and workHealthService
CorentinMartinot Dec 17, 2021
6b8dbac
COM-2463-fix edition
CorentinMartinot Dec 17, 2021
ab36c7a
Merge pull request #1401 from sophiemoustard/COM-2464
cmolle Dec 17, 2021
994663c
COM-2463-fix re-order surcharge
CorentinMartinot Dec 17, 2021
fcf3cce
COM-2463-fix fix email validation
CorentinMartinot Dec 17, 2021
4b599c7
COM-2463-fix fix indent
CorentinMartinot Dec 20, 2021
0397597
COM-2463-fix destructure _id
CorentinMartinot Dec 20, 2021
9187ba3
Merge pull request #1402 from sophiemoustard/COM-2463-fix
cmolle Dec 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/core/api/CustomerAbsences.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
},
};
6 changes: 2 additions & 4 deletions src/core/components/courses/SlotContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,11 @@
</div>
</div>

<!-- Course slot creation modal -->
<slot-creation-modal v-model="creationModal" :new-course-slot.sync="newCourseSlot" :validations="$v.newCourseSlot"
<slot-creation-modal v-model="creationModal" :new-course-slot="newCourseSlot" :validations="$v.newCourseSlot"
:step-options="stepOptions" :loading="modalLoading" @hide="resetCreationModal" @submit="addCourseSlot"
:link-error-message="linkErrorMessage" @update="setCourseSlot" />

<!-- Course slot edition modal -->
<slot-edition-modal v-model="editionModal" :edited-course-slot.sync="editedCourseSlot" :step-options="stepOptions"
<slot-edition-modal v-model="editionModal" :edited-course-slot="editedCourseSlot" :step-options="stepOptions"
:validations="$v.editedCourseSlot" @hide="resetEditionModal" :loading="modalLoading" @delete="deleteCourseSlot"
@submit="updateCourseSlot" :link-error-message="linkErrorMessage" @update="setCourseSlot" />
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/core/components/form/DateRange.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/core/helpers/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
</template>

<script>
import set from 'lodash/set';
import Modal from '@components/modal/Modal';
import SearchAddress from '@components/form/SearchAddress';
import Select from '@components/form/Select';
Expand Down Expand Up @@ -98,8 +97,8 @@ export default {
updateSendWelcome (event) {
this.$emit('update:send-welcome-msg', event);
},
updateUser (event, path) {
this.$emit('update:newUser', set({ ...this.newUser }, path, event));
updateUser (value, path) {
this.$emit('update-new-user', { value, path });
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ export default {
submit () {
this.$emit('submit');
},
update (event, prop) {
this.$emit('update:newEstablishment', { ...this.newEstablishment, [prop]: event });
update (value, path) {
this.$emit('update', { path, value });
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export default {
submit () {
this.$emit('submit');
},
update (event, prop) {
this.$emit('update:editedEstablishment', { ...this.editedEstablishment, [prop]: event });
update (value, path) {
this.$emit('update', { path, value });
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ni-search-address :value="newThirdPartyPayer.address" error-message="Adresse invalide" in-modal
@blur="validations.address.$touch" :error="validations.address.$error" @input="update($event, 'address')" />
<ni-input in-modal caption="Email" :value="newThirdPartyPayer.email" error-message="Email non valide"
:error="!validations.email.email" @input="update($event.trim(), 'email')" />
:error="validations.email.$error" @input="update($event.trim(), 'email')" @blur="validations.email.$touch" />
<ni-input in-modal caption="Prix unitaire TTC par défaut" suffix="€" type="number"
:value="newThirdPartyPayer.unitTTCRate" :error="validations.unitTTCRate.$error"
:error-message="nbrError('unitTTCRate', validations)" @input="update($event, 'unitTTCRate')" />
Expand Down Expand Up @@ -60,8 +60,8 @@ export default {
submit () {
this.$emit('submit');
},
update (event, prop) {
this.$emit('update:newThirdPartyPayer', { ...this.newThirdPartyPayer, [prop]: event });
update (value, path) {
this.$emit('update', { path, value });
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ni-search-address in-modal :value="editedThirdPartyPayer.address" error-message="Adresse invalide"
@blur="validations.address.$touch" :error="validations.address.$error" @input="update($event, 'address')" />
<ni-input in-modal caption="Email" :value="editedThirdPartyPayer.email" error-message="Email invalide"
:error="!validations.email.email" @input="update($event.trim(), 'email')" />
:error="validations.email.$error" @input="update($event.trim(), 'email')" @blur="validations.email.$touch" />
<ni-input in-modal caption="Prix unitaire TTC par défaut" suffix="€" type="number"
:value="editedThirdPartyPayer.unitTTCRate" :error="validations.unitTTCRate.$error"
:error-message="nbrError('unitTTCRate', validations)" @input="update($event, 'unitTTCRate')" />
Expand Down Expand Up @@ -61,8 +61,8 @@ export default {
submit () {
this.$emit('submit');
},
update (event, prop) {
this.$emit('update:editedThirdPartyPayer', { ...this.editedThirdPartyPayer, [prop]: event });
update (value, path) {
this.$emit('update', { path, value });
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<ni-planning-modal-header :selected-person="editedCustomerAbsence.customer" @close="close" />
<div class="modal-subtitle">
<q-btn rounded unelevated color="primary" label="Absence" />
<ni-button class="q-mx-sm" icon="delete" color="copper-grey-400" @click="validateCustomerAbsenceDeletion" />
</div>
<ni-select caption="Motif" :value="editedCustomerAbsence.absenceType" :options="customerAbsenceOptions"
required-field @input="update($event, 'absenceType')" />
Expand All @@ -22,6 +23,9 @@
<script>
import Select from '@components/form/Select';
import DateRange from '@components/form/DateRange';
import Button from '@components/Button';
import { NotifyPositive, NotifyNegative } from '@components/popup/notify';
import CustomerAbsences from '@api/CustomerAbsences';
import { CUSTOMER_ABSENCE_TYPES } from '@data/constants';
import PlanningModalHeader from './PlanningModalHeader';

Expand All @@ -31,6 +35,7 @@ export default {
'ni-select': Select,
'ni-planning-modal-header': PlanningModalHeader,
'ni-date-range': DateRange,
'ni-button': Button,
},
data () {
return {
Expand All @@ -56,6 +61,26 @@ export default {
submit () {
this.$emit('submit');
},
validateCustomerAbsenceDeletion () {
this.$q.dialog({
title: 'Confirmation',
message: 'Êtes-vous sûr(e) de vouloir supprimer cette absence ?',
ok: 'OK',
cancel: 'Annuler',
}).onOk(this.deleteCustomerAbsence)
.onCancel(() => NotifyPositive('Suppression annulée.'));
},
async deleteCustomerAbsence () {
try {
await CustomerAbsences.remove(this.editedCustomerAbsence._id);
this.close();

NotifyPositive('Absence supprimée.');
} catch (e) {
console.error(e);
NotifyNegative('Erreur lors de la suppression de l\'absence bénéficiaire.');
}
},
},
};

Expand Down
16 changes: 9 additions & 7 deletions src/modules/client/components/planning/DeleteEventsModal.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template>
<ni-modal :value="value" @hide="hide" @input="input"
title="Suppression d'interventions sur une période">
<ni-modal :value="value" @hide="hide" @input="input" title="Suppression d'interventions sur une période">
<ni-select in-modal caption="Bénéficiaire" v-model="deletedEvents.customer"
:options="getCustomersOptions(deletedEvents.startDate)" required-field @blur="$v.deletedEvents.customer.$touch"
:error="$v.deletedEvents.customer.$error" />
Expand All @@ -12,11 +11,8 @@
<ni-select in-modal v-if="isCustomerAbsence" v-model="deletedEvents.absenceType" caption="Motif de l'absence"
:options="customerAbsenceOptions" required-field @blur="$v.deletedEvents.absenceType.$touch"
:error="$v.deletedEvents.absenceType.$error" />
<ni-date-input caption="Date de début" v-model="deletedEvents.startDate" type="date" required-field
in-modal @blur="$v.deletedEvents.startDate.$touch" :error="$v.deletedEvents.startDate.$error" />
<ni-date-input caption="Date de fin" v-model="deletedEvents.endDate" type="date" required-field in-modal
:min="deletedEvents.startDate" @blur="$v.deletedEvents.endDate.$touch"
:error="$v.deletedEvents.endDate.$error" />
<ni-date-range caption="Dates de début et de fin" required-field v-model="deletedEvents" @blur="validateDates"
:error="$v.deletedEvents.startDate.$error || $v.deletedEvents.endDate.$error" />
</template>
<template v-else>
<ni-date-input caption="Date d'arrêt des interventions" v-model="deletedEvents.startDate" type="date"
Expand All @@ -35,6 +31,7 @@ import pick from 'lodash/pick';
import omit from 'lodash/omit';
import Events from '@api/Events';
import Modal from '@components/modal/Modal';
import DateRange from '@components/form/DateRange';
import Select from '@components/form/Select';
import OptionGroup from '@components/form/OptionGroup';
import { NotifyNegative, NotifyPositive, NotifyWarning } from '@components/popup/notify';
Expand All @@ -49,6 +46,7 @@ export default {
'ni-modal': Modal,
'ni-select': Select,
'ni-option-group': OptionGroup,
'ni-date-range': DateRange,
},
props: {
value: { type: Boolean, default: false },
Expand Down Expand Up @@ -108,6 +106,10 @@ export default {
this.isCustomerAbsence = !this.isCustomerAbsence;
if (!this.isCustomerAbsence) this.deletedEvents = { ...omit(this.deletedEvents, 'absenceType') };
},
validateDates () {
this.$v.deletedEvents.startDate.$touch();
this.$v.deletedEvents.endDate.$touch();
},
async deleteEvents () {
try {
this.loading = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<ni-search-address :value="newEvent.address" :error-message="addressError" @blur="validations.address.$touch"
:error="validations.address.$error" in-modal @input="updateEvent('address', $event)" />
</template>
<ni-input in-modal :value="newEvent.misc" caption="Notes" @blur="validations.misc.$touch"
<ni-input in-modal type="textarea" :value="newEvent.misc" caption="Notes" @blur="validations.misc.$touch"
:error="validations.misc.$error" :required-field="newEvent.type === ABSENCE && newEvent.absence === OTHER"
@input="updateEvent('misc', $event)" />
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/modules/client/components/planning/EventEditionModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
:disable="!selectedAuxiliary._id || historiesLoading" in-modal :extensions="extensions" drive-storage
@delete="deleteDocument(editedEvent.attachment.driveId)" />
</template>
<ni-input in-modal v-if="!editedEvent.shouldUpdateRepetition" :value="editedEvent.misc" caption="Notes"
:disable="!canUpdateIntervention || historiesLoading" @blur="validations.misc.$touch"
<ni-input in-modal v-if="!editedEvent.shouldUpdateRepetition" type="textarea" :value="editedEvent.misc"
caption="Notes" :disable="!canUpdateIntervention || historiesLoading" @blur="validations.misc.$touch"
:error="validations.misc.$error" :required-field="isMiscRequired" @input="updateEvent('misc', $event)" />
<div v-if="canCancel" class="row q-mb-md light-checkbox">
<q-checkbox :value="editedEvent.isCancelled" label="Annuler l'évènement" dense :disable="historiesLoading"
Expand Down
8 changes: 6 additions & 2 deletions src/modules/client/pages/ni/auxiliaries/Directory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
<q-btn class="fixed fab-custom" no-caps rounded color="primary" icon="add" label="Ajouter une personne"
@click="auxiliaryCreationModal = true" :disable="tableLoading" />

<auxiliary-creation-modal v-model="auxiliaryCreationModal" :new-user.sync="newUser"
<auxiliary-creation-modal v-model="auxiliaryCreationModal" :new-user="newUser"
:validations="$v.newUser" :company-id="company._id" :loading="loading" :email-error="emailError($v.newUser)"
:first-step="firstStep" :send-welcome-msg.sync="sendWelcomeMsg" :civility-options="civilityOptions"
@hide="resetForm" @submit="submit" @go-to-next-step="nextStep" />
@hide="resetForm" @submit="submit" @go-to-next-step="nextStep" @update-new-user="setNewUser" />
</q-page>
</template>

Expand Down Expand Up @@ -348,6 +348,10 @@ export default {
getAvatar (link) {
return link || DEFAULT_AVATAR;
},
setNewUser (payload) {
const { path, value } = payload;
set(this.newUser, path, value);
},
},
};
</script>
Expand Down
32 changes: 19 additions & 13 deletions src/modules/client/pages/ni/config/CompanyConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@
</div>
</div>

<!-- Establishment creation modal -->
<establishment-creation-modal v-model="establishmentCreationModal" :new-establishment.sync="newEstablishment"
<establishment-creation-modal v-model="establishmentCreationModal" :new-establishment="newEstablishment"
:validations="$v.newEstablishment" @hide="resetEstablishmentCreationModal" @submit="createNewEstablishment"
:loading="loading" :work-health-services="workHealthServices" :urssaf-codes="urssafCodes" />
:loading="loading" :work-health-services="workHealthServiceList" :urssaf-codes="urssafCodeList"
@update="setEstablishment" />

<!-- Establishment edition modal -->
<establishment-edition-modal v-model="establishmentEditionModal" :edited-establishment.sync="editedEstablishment"
<establishment-edition-modal v-model="establishmentEditionModal" :edited-establishment="editedEstablishment"
:validations="$v.editedEstablishment" @hide="resetEstablishmentEditionModal" @submit="updateEstablishment"
:loading="loading" :work-health-services="workHealthServices" :urssaf-codes="urssafCodes" />
:loading="loading" :work-health-services="workHealthServiceList" :urssaf-codes="urssafCodeList"
@update="setEstablishment" />
</q-page>
</template>

Expand All @@ -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';
Expand All @@ -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,
Expand Down Expand Up @@ -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' },
],
Expand All @@ -187,8 +188,8 @@ export default {
urssafCode: '',
},
establishmentEditionModal: false,
workHealthServices,
urssafCodes,
workHealthServiceList,
urssafCodeList,
establishmentValidation: {
name: { required, maxLength: maxLength(32) },
siret: { required, validSiret },
Expand Down Expand Up @@ -283,14 +284,19 @@ 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();
const formIsValid = await this.waitForFormValidation(this.$v.editedEstablishment);
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);
}
Expand Down
Loading