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 80a88fc00c
commit a5f4eabc34
2 changed files with 8 additions and 3 deletions

View File

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

View File

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