FEATURE [store][component] final adjustments to methods to post time spent

This commit is contained in:
Julie Lenaerts 2023-02-15 11:50:05 +01:00
parent e528e4f57a
commit 9ff116797a
2 changed files with 8 additions and 3 deletions

View File

@ -55,7 +55,8 @@
</label>
<div class="col-8 col-sm-4 col-md-8 col-lg-4">
<select class="form-control form-control-sm" type="time" v-model="timeSpent">
<option v-for="time in timeSpent" :value="new Date(time.value)">
<option disabled value="">{{ $t('select_time_spent') }}</option>
<option v-for="time in timeSpentChoices" :value="time.value">
{{ time.text }}
</option>
</select>
@ -204,6 +205,7 @@ const i18n = {
evaluation_add_a_document: "Ajouter un document",
evaluation_add: "Ajouter une évaluation",
evaluation_time_spent: "Temps de rédaction",
select_time_spent: "Indiquez le temps de rédaction",
Documents: "Documents",
document_add: "Générer ou téléverser un document",
document_upload: "Téléverser un document",
@ -295,7 +297,7 @@ export default {
set(v) { this.$store.commit('setEvaluationWarningInterval', { key: this.evaluation.key, days: v }); }
},
timeSpent: {
get() { return this.timeSpentChoices },
get() { return this.evaluation.timeSpent },
set(v) { this.$store.commit('setEvaluationTimeSpent', { key: this.evaluation.key, time: v}) }
},
comment: {

View File

@ -116,6 +116,7 @@ const store = createStore({
endDate: e.endDate === null || e.endDate === '' ? null : { datetime: datetimeToISO(ISOToDate(e.endDate)) },
maxDate: e.maxDate === null || e.maxDate === '' ? null : { datetime: datetimeToISO(ISOToDate(e.maxDate)) },
warningInterval: intervalDaysToISO(e.warningInterval),
timeSpent: e.timeSpent,
comment: e.comment,
documents: e.documents
};
@ -138,6 +139,7 @@ const store = createStore({
endDate: e.endDate !== null ? dateToISO(new Date(e.endDate.datetime)) : null,
maxDate: e.maxDate !== null ? dateToISO(new Date(e.maxDate.datetime)) : null,
warningInterval: e.warningInterval !== null ? intervalISOToDays(e.warningInterval) : null,
timeSpent: e.timeSpent !== null ? e.timeSpent : null,
documents: e.documents.map((d, docIndex) => {
return Object.assign(d, {
key: docIndex
@ -258,6 +260,7 @@ const store = createStore({
endDate: null,
maxDate: null,
warningInterval: null,
timeSpent: null,
comment: "",
editEvaluation: true,
workflows_availables: state.work.workflows_availables_evaluation,
@ -471,7 +474,7 @@ const store = createStore({
;
commit('setIsPosting', true);
console.log('payload', payload);
console.log('the social action', payload);
return makeFetch('PUT', url, payload)
.then(data => {