diff --git a/canapGEST/API/app/Helpers/AccessLevelHelper.php b/canapGEST/API/app/Helpers/AccessLevelHelper.php index f3cd92c1d7bbafc8da1514c430a5eda24d725c72..62545517f2f4660c6aa7bf1f9decce4526169124 100644 --- a/canapGEST/API/app/Helpers/AccessLevelHelper.php +++ b/canapGEST/API/app/Helpers/AccessLevelHelper.php @@ -55,7 +55,7 @@ class AccessLevelHelper { $default_access_groups = self::getDefaultAccessGroups(); $user_alloweds = []; - $user_role = 'responsable'; // formateur + $user_role = 'formateur'; // formateur $user_groups = explode(',', $user_groups); foreach ($default_access_groups as $group => $accesses) { diff --git a/canapGEST/API/app/Http/Controllers/MarkersController.php b/canapGEST/API/app/Http/Controllers/MarkersController.php index ee51d2f4f768ca665d6c5bdd2f4b916fd34d2abc..1a166d62d33de1dd9829e472702bd0faae0a08aa 100644 --- a/canapGEST/API/app/Http/Controllers/MarkersController.php +++ b/canapGEST/API/app/Http/Controllers/MarkersController.php @@ -41,7 +41,7 @@ class MarkersController extends Controller public function getUserMarkerOnApplicant($id) { $marker = DB::table('marker')->where('fk_applicant_id', $id)->where('marker_owner_sciper', $this->user_sciper)->first(); - return ["marker" => $marker]; + return $marker ? ["marker" => $marker] : ["marker" => ['marker_value' => null]]; } public function create() diff --git a/canapGEST/Documentation/Rapport.docx b/canapGEST/Documentation/Rapport.docx index d73494395f89c3d7d219d7c102bdf16e62860523..abaad9ddf7f75fce99fd9b727a5286d270cc8c3e 100644 Binary files a/canapGEST/Documentation/Rapport.docx and b/canapGEST/Documentation/Rapport.docx differ diff --git a/canapGEST/Documentation/journal_travail.xlsx b/canapGEST/Documentation/journal_travail.xlsx index b8c5eabbf864741570ab20e44ddf4b4559af93f9..49bde3495fecf96376788879ec72aadffca171fa 100644 Binary files a/canapGEST/Documentation/journal_travail.xlsx and b/canapGEST/Documentation/journal_travail.xlsx differ diff --git a/canapGEST/Site/src/components/application/applicationTitle.vue b/canapGEST/Site/src/components/application/applicationTitle.vue index 9ce57c3a783a43ef1406be02dc4928789ccc99be..e6f370c741ac6a3eb50c776e503e7a294bd049f5 100644 --- a/canapGEST/Site/src/components/application/applicationTitle.vue +++ b/canapGEST/Site/src/components/application/applicationTitle.vue @@ -9,8 +9,10 @@ <v-rating color="warning" background-color="warning" - :value="ratingValue" + v-model="markerValue" v-if="!$store.getters['moduleUser/userIsResponsible']" + :clearable="true" + :hover="true" ></v-rating> <v-tooltip bottom v-else> <template v-slot:activator="{ on }"> @@ -54,11 +56,17 @@ <script> export default { name: 'application-title', - computed: { - ratingValue() { - return this.$store.state.moduleApplications.currentApplication.marker ? this.$store.state.moduleApplications.currentApplication.marker.marker_value : null + data() { + return { + markerValue: null } }, + created() { + this.markerValue = this.$store.state.moduleApplications.currentApplication.marker.marker_value + }, + watch: { + markerValue() { this.rate() } + }, methods: { print() { window.print() }, contact() { window.location.href = 'mailto:' + this.$store.state.moduleApplications.currentApplication.application_data.personal_data.applicant_mail }, @@ -69,7 +77,22 @@ export default { } }, exportData() { this.$store.dispatch('moduleApplications/exportData', { id: this.$store.state.moduleApplications.currentApplication.application_data.personal_data.applicant_id, name: this.$store.state.moduleApplications.currentApplication.application_data.personal_data.applicant_name + this.$store.state.moduleApplications.currentApplication.application_data.personal_data.applicant_fsname }) }, - rate() { } + rate() { + // Already a value => update + if (this.$store.state.moduleApplications.currentApplication.marker.marker_value) { + if (this.markerValue == 0) { + // New value is 0 => delete + this.$store.dispatch('moduleApplications/deleteMarker', { id: this.$store.state.moduleApplications.currentApplication.marker.marker_id }) + } else { + // New value => update + this.$store.dispatch('moduleApplications/updateMarker', { id: this.$store.state.moduleApplications.currentApplication.marker.marker_id, applicant: this.$store.state.moduleApplications.currentApplication.application_data.personal_data.applicant_id, value: this.markerValue }) + } + } else { + // No existing value => create + this.$store.dispatch('moduleApplications/createMarker', { applicant: this.$store.state.moduleApplications.currentApplication.application_data.personal_data.applicant_id, value: this.markerValue }) + } + this.$store.dispatch('moduleApplications/getCurrentApplicationMarker', { id: this.$store.state.moduleApplications.currentApplication.application_data.personal_data.applicant_id }) + } } } </script> diff --git a/canapGEST/Site/src/components/application/sheets/filesDataSheet.vue b/canapGEST/Site/src/components/application/sheets/filesDataSheet.vue index 0e104d59ecbe223c9db24d88f6beb76f3be9490d..66c81b26df523848a7b2db88d175a563e3556cdf 100644 --- a/canapGEST/Site/src/components/application/sheets/filesDataSheet.vue +++ b/canapGEST/Site/src/components/application/sheets/filesDataSheet.vue @@ -6,7 +6,6 @@ </v-card-title> <v-divider></v-divider> <v-list-tile - avatar v-for="file in $store.state.moduleApplications.currentApplication.application_data.files" :key="file.file_id" @click="getFile(file.file_id, file.file_name)" diff --git a/canapGEST/Site/src/store/modules/applications/actions.js b/canapGEST/Site/src/store/modules/applications/actions.js index 33422620c687c1597d38d52d3639b15c3f594908..96fde716cb2740c6b2fbd0b6e9982a5d02a1dfbc 100644 --- a/canapGEST/Site/src/store/modules/applications/actions.js +++ b/canapGEST/Site/src/store/modules/applications/actions.js @@ -24,23 +24,29 @@ export function getCurrentApplicationData(context, data) { } export function getCurrentApplicationComments(context, data) { - axios({ - method: 'get', - url: '/applicant/' + data.id + '/comments' - }) - .then(response => { - context.commit('setCurrentApplicationComments', response.data) + return new Promise((resolve) => { + axios({ + method: 'get', + url: '/applicant/' + data.id + '/comments' }) + .then(response => { + context.commit('setCurrentApplicationComments', response.data) + resolve() + }) + }) } export function getCurrentApplicationMarker(context, data) { - axios({ - method: 'get', - url: '/applicant/' + data.id + '/marker' - }) - .then(response => { - context.commit('setCurrentApplicationMarker', response.data.marker) + return new Promise((resolve) => { + axios({ + method: 'get', + url: '/applicant/' + data.id + '/marker' }) + .then(response => { + context.commit('setCurrentApplicationMarker', response.data.marker) + resolve() + }) + }) } export function getAvailableStatus(context) { @@ -104,4 +110,33 @@ function generateBlob(response, filename) { link.setAttribute('download', filename) document.body.appendChild(link) link.click() +} + +export function createMarker(context, data) { + axios({ + method: 'put', + url: '/marker', + data: { + value: data.value, + applicant_id: data.applicant + } + }) +} + +export function updateMarker(context, data) { + axios({ + method: 'patch', + url: '/marker/' + data.id, + data: { + value: data.value, + applicant_id: data.applicant + } + }) +} + +export function deleteMarker(context, data) { + axios({ + method: 'delete', + url: '/marker/' + data.id + }) } \ No newline at end of file diff --git a/canapGEST/Site/src/views/ApplicationView.vue b/canapGEST/Site/src/views/ApplicationView.vue index a3da7dc521d6204b3ef6d0d89cc193f0476ff78f..b85dceb77264bd0dffb6dd3f045b5967e042cc87 100644 --- a/canapGEST/Site/src/views/ApplicationView.vue +++ b/canapGEST/Site/src/views/ApplicationView.vue @@ -1,6 +1,6 @@ <template> <div id="application-view"> - <v-container fluid grid-list-sm v-if="loaded" justify-space-around> + <v-container fluid grid-list-sm v-if="loaded === 3" justify-space-around> <v-flex justify-space-around> <ApplicationTitle></ApplicationTitle> </v-flex> @@ -55,7 +55,7 @@ export default { name: 'application-view', data() { return { - loaded: false + loaded: 0 } }, created() { this.init() }, @@ -64,9 +64,9 @@ export default { }, methods: { init() { - this.$store.dispatch('moduleApplications/getCurrentApplicationData', { id: this.$route.params.id }).then(() => this.loaded = true) - this.$store.dispatch('moduleApplications/getCurrentApplicationComments', { id: this.$route.params.id }) - this.$store.dispatch('moduleApplications/getCurrentApplicationMarker', { id: this.$route.params.id }) + this.$store.dispatch('moduleApplications/getCurrentApplicationData', { id: this.$route.params.id }).then(() => this.loaded++) + this.$store.dispatch('moduleApplications/getCurrentApplicationComments', { id: this.$route.params.id }).then(() => this.loaded++) + this.$store.dispatch('moduleApplications/getCurrentApplicationMarker', { id: this.$route.params.id }).then(() => this.loaded++) } }, components: { diff --git a/canapGEST/Site/src/views/ApplicationsView.vue b/canapGEST/Site/src/views/ApplicationsView.vue index 094f0d3a5050127065b31d3d1467b9d9e5c1713d..97be0e4f59edbb43d59f82549c4d9a083c8349db 100644 --- a/canapGEST/Site/src/views/ApplicationsView.vue +++ b/canapGEST/Site/src/views/ApplicationsView.vue @@ -128,7 +128,7 @@ export default { { text: 'Indications', value: 'indications' }, { text: 'Actions', value: 'actions', sortable: false }, ], - pagination: { 'sortBy': 'applicant_application_date', 'descending': true, 'rowsPerPage': -1 } + pagination: { sortBy: 'applicant_application_date', descending: true, rowsPerPage: 25 } } }, created() {