diff --git a/canapGEST/API/app/Http/Controllers/StatusController.php b/canapGEST/API/app/Http/Controllers/StatusController.php index 14aa82c050960459d3fef4e8e19c098fa47dfd7b..81e28a2cf5cc9aac4fce7cfae58177458870b319 100644 --- a/canapGEST/API/app/Http/Controllers/StatusController.php +++ b/canapGEST/API/app/Http/Controllers/StatusController.php @@ -42,7 +42,8 @@ class StatusController extends Controller // Valide le status if (count(DB::table('status')->where('status_value', $new_status)->get())) { - return DB::table('applicant')->where('applicant_id', $id)->update(['fk_status' => $new_status]); + DB::table('applicant')->where('applicant_id', $id)->update(['fk_status' => $new_status]); + return ["message" => lang::get('http.success.updated.status'), "id" => $id]; } else { return abort(404, lang::get('http.notfound')); } diff --git a/canapGEST/API/resources/lang/fr/http.php b/canapGEST/API/resources/lang/fr/http.php index c080d8b3ae716cf537e42bdabf9e61a5c8c4da2d..7beeac9a91901bf8fef866d7b571be0730c7ad5d 100644 --- a/canapGEST/API/resources/lang/fr/http.php +++ b/canapGEST/API/resources/lang/fr/http.php @@ -16,7 +16,8 @@ return [ 'comment' => 'Commentaire modifié', 'position' => 'Offre modifiée', 'location' => 'Lieu modifié', - 'job' => 'Métier modifié' + 'job' => 'Métier modifié', + 'status' => 'Statut modifié' ], 'deleted' => [ 'marker' => 'Marqueur supprimé', diff --git a/canapGEST/Site/src/store/modules/applications/actions.js b/canapGEST/Site/src/store/modules/applications/actions.js index e586d98d23a2985283cb9a95deb0baf7d983778a..398053714175e1ae532165fe82d1120e87d29961 100644 --- a/canapGEST/Site/src/store/modules/applications/actions.js +++ b/canapGEST/Site/src/store/modules/applications/actions.js @@ -11,4 +11,31 @@ export function getApplications(context) { .catch(err => { console.log(err) }) +} + +export function getAvailableStatus(context) { + axios({ + method: 'get', + url: '/status' + }) + .then(response => { + context.commit('setAvailableStatus', response.data) + }) + .catch(err => { + console.log(err) + }) +} + +export function changeApplicationStatus(context, data) { + axios({ + method: 'patch', + url: '/status/applicant/' + data.id, + data: data + }) + .then(response => { + console.log(response.data) + }) + .catch(err => { + console.log(err) + }) } \ No newline at end of file diff --git a/canapGEST/Site/src/store/modules/applications/mutations.js b/canapGEST/Site/src/store/modules/applications/mutations.js index 3e735665235b04ace92617f5df5a486cb368dee3..3ee6e92e8c71283a6e112d1e71ae63bf27c726fb 100644 --- a/canapGEST/Site/src/store/modules/applications/mutations.js +++ b/canapGEST/Site/src/store/modules/applications/mutations.js @@ -1,3 +1,7 @@ export function setApplications (state, data) { state.applications = data +} + +export function setAvailableStatus (state, data) { + state.available_status = data } \ No newline at end of file diff --git a/canapGEST/Site/src/store/modules/applications/state.js b/canapGEST/Site/src/store/modules/applications/state.js index fb3ba694901ea590d6747c1ce113c189c504cea5..d362043026b5d9315856d0f9346d401c771df979 100644 --- a/canapGEST/Site/src/store/modules/applications/state.js +++ b/canapGEST/Site/src/store/modules/applications/state.js @@ -1,4 +1,5 @@ export default { applications: [], - currentApplication: {} + currentApplication: {}, + available_status: [] } \ No newline at end of file diff --git a/canapGEST/Site/src/views/ApplicationsView.vue b/canapGEST/Site/src/views/ApplicationsView.vue index b8d9fa78846c92b30d319c2ad501ef65ca745ef8..fa357d7140b41a2a65b269f7cfa280d6797937c4 100644 --- a/canapGEST/Site/src/views/ApplicationsView.vue +++ b/canapGEST/Site/src/views/ApplicationsView.vue @@ -28,7 +28,6 @@ :items="$store.state.moduleApplications.applications" item-key="applicant_id" :search="search" - :pagination.sync="pagination" select-all > <template v-slot:items="props"> @@ -41,7 +40,6 @@ <td>{{ props.item.job_full_value }}, {{ props.item.location_site }}</td> <td>{{ props.item.applicant_address_street }} {{ props.item.applicant_address_npa }}</td> <td>{{ props.item.applicant_mail }}</td> - <td>{{ props.item.applicant_foreign_authorization }}</td> <td>{{ props.item.applicant_birthdate }}</td> <td>{{ props.item.applicant_has_majority }}</td> <td>{{ props.item.applicant_nationality }}</td> @@ -49,9 +47,19 @@ <td>{{ props.item.applicant_speaks_french }} {{ props.item.applicant_speaks_english }} {{ props.item.applicant_speaks_german }} {{ props.item.applicant_speaks_other }}</td> <td>{{ props.item.applicant_scolarity_end }}</td> <td>{{ props.item.applicant_application_date }}</td> + <td> + <v-select + :items="$store.state.moduleApplications.available_status" + label="Statut" + item-text="status_value" + item-value="status_value" + v-model="props.item.fk_status" + @change="updateStatus(props.item.applicant_id, props.item.fk_status)" + ></v-select> + </td> <td></td> <td> - <v-tooltip bottom> + <v-tooltip bottom class="mr-2"> <template v-slot:activator="{ on }"> <v-icon @click="navigateTo(props.item.applicant_id)" v-on="on">pageview</v-icon> </template> @@ -70,17 +78,14 @@ export default { name: 'applications-view', data() { return { - loaded: false, jobFilter: null, search: '', - pagination: {}, selected: [], headers: [ { text: 'Nom, Prénom', align: 'left', value: 'applicant_fsname' }, { text: 'Formation, Lieu', value: 'applicant_formation' }, { text: 'Adresse', value: 'applicant_npa' }, { text: 'Email', value: 'applicant_mail' }, - { text: 'Cat. permis étranger', value: 'applicant_foreign_authorization' }, { text: 'Date naissance', value: 'applicant_birthdate' }, { text: 'Majeur', value: 'applicant_has_majority' }, { text: 'Nationalité', value: 'applicant_nationality' }, @@ -88,6 +93,7 @@ export default { { text: 'Langues', value: 'applicant_languages', sortable: false }, { text: 'Fin de scolarité', value: 'applicant_scolarity_end' }, { text: 'Date postulation', value: 'applicant_application_date' }, + { text: 'Statut', value: 'fk_status' }, { text: 'Indications', value: 'indications' }, { text: 'Actions', value: 'actions', sortable: false }, ] @@ -96,20 +102,17 @@ export default { created() { this.loadApplications() }, - computed: { - pages() { - if (this.pagination.rowsPerPage == null || this.pagination.totalItems == null) return 0 - return Math.ceil(this.pagination.totalItems / this.pagination.rowsPerPage) - } - }, methods: { loadApplications() { this.$store.dispatch('moduleApplications/getApplications') + this.$store.dispatch('moduleApplications/getAvailableStatus') this.$store.dispatch('moduleUser/getUserPermittedJobs') - // this.loaded = true }, navigateTo(id) { this.$router.push('/application/' + id) + }, + updateStatus (id, status) { + this.$store.dispatch('moduleApplications/changeApplicationStatus', {id: id, status: status}) } } }