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

Item 355 front utiliser la couche service pour connaitre le role en boolean exploiter ce booleen pour masquer les elements relatif a l iln dans le tableau #167

10 changes: 5 additions & 5 deletions src/store/authStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ export const useAuthStore = defineStore('auth', {
token: sessionStorage.getItem('token'),
authenticated: !!sessionStorage.getItem('token'),
}),

getters: {
getUser: (state) => state.user,
isAuthenticated: (state) => state.authenticated,
getToken: (state) => state.token
getToken: (state) => state.token,
},
actions: {
login(user, token) {
Expand All @@ -27,11 +27,11 @@ export const useAuthStore = defineStore('auth', {
sessionStorage.setItem('user', JSON.stringify(this.user))
sessionStorage.setItem('token', this.token);
},
setToken(token) {
this.token = token;
},
setUser(user){
this.user = user;
},
isAdmin() {
return this.user.role === 'ADMIN';
}
},
});
2 changes: 1 addition & 1 deletion src/views/Exemplarisation/ExempSteps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@

<script setup>

import { onMounted, ref } from 'vue';
import {onMounted, ref} from 'vue'
import itemService from '@/service/ItemService';
import router from '@/router';
import SelectFile from '@/components/SelectFile.vue';
Expand Down
48 changes: 34 additions & 14 deletions src/views/Exemplarisation/ExempTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
d'exemplaires archivées
</v-chip>
<v-chip variant="text">
<v-tooltip activator="parent" location="bottom">
<v-tooltip v-if="isAdmin" activator="parent" location="bottom">
<template v-slot:activator="{ props }">
<label>
<input type="checkbox" v-model="extendedAllILN" style="margin-right: 5px"
Expand All @@ -27,7 +27,7 @@
</v-tooltip>
</v-chip>
</v-container>
<v-data-table :headers="headingsDemandes" :items="contentsDemandesFrontFiltered" :items-length="totalItemsFound"
<v-data-table :headers="filteredHeadingsDemandes" :items="contentsDemandesFrontFiltered" :items-length="totalItemsFound"
:loading="!isDataLoaded" show-expand :sort-by="sortBy"
item-key="id"
>
Expand Down Expand Up @@ -134,26 +134,32 @@ import DialogCommentaire from '@/components/Dialog/DialogCommentaire.vue';
import itemService from '@/service/ItemService';
import MenuDownloadFile from '@/components/MenuDownloadFile.vue';
import moment from 'moment';
import {useAuthStore} from '@/store/authStore'
//Emit
const emit = defineEmits(['backendError', 'backendSuccess']);

//Data
const isAdmin = useAuthStore().isAdmin();
const extendedAllILN = ref(false);

const headingsDemandes = [
{
title: '',
key: 'data-table-expand',
align: 'center'
align: 'center',
display: true,
},
{
title: 'N° de Demande',
key: 'id',
align: 'center'
align: 'center',
display: true,
},
{
title: 'Crée le',
key: 'dateCreation',
align: 'center',
display: true,
sort: (d1, d2) => {
const date1 = moment(d1, 'DD/MM/yyyy HH:mm')
.valueOf();
Expand All @@ -168,6 +174,7 @@ const headingsDemandes = [
title: 'Mise à jour',
key: 'dateModification',
align: 'center',
display: true,
sort: (d1, d2) => {
const date1 = moment(d1, 'DD/MM/yyyy HH:mm')
.valueOf();
Expand All @@ -181,47 +188,59 @@ const headingsDemandes = [
{
title: 'ILN',
key: 'iln',
align: 'center'
align: 'center',
display: isAdmin,
},
{
title: 'RCR',
key: 'rcr',
align: 'center'
align: 'center',
display: true,
},
{
title: 'Type',
key: 'typeExemp',
align: 'center'
align: 'center',
display: true,
},
{
title: 'Index',
key: 'indexRecherche',
align: 'center'
align: 'center',
display: true,
},
{
title: 'Statut',
key: 'etatDemande',
align: 'center'
align: 'center',
display: true,
},
{
title: 'Progression',
key: 'pourcentageProgressionTraitement',
value: 'pourcentageProgressionTraitement',
align: 'center'
align: 'center',
display: true,
},
{
title: 'Fichiers',
key: 'filesToDownload',
value: 'filesToDownload',
align: 'center'
align: 'center',
display: true,
},
{
title: 'Action',
key: 'archiveOrCancel',
value: 'archiveOrCancel',
align: 'center'
align: 'center',
display: true,
}
];
const filteredHeadingsDemandes = computed(() =>
headingsDemandes.filter(heading => heading.display !== false)
)

const listStatut = [
'En saisie',
'En attente',
Expand All @@ -235,14 +254,14 @@ const contentsDemandesFrontFiltered = ref([]);
const totalItemsFound = ref(0);
const suppDialog = ref(false);
const suppDemande = ref({});

const sortBy = ref([{
key: 'dateModification',
order: 'desc'
}]);

//Progress bar displayed while fetching data
const isDataLoaded = ref(false);

const isDataLoaded = ref(false);
//Search fields columns
const numDemandeSearchField = ref('');
const dateCreationSearchField = ref('');
Expand All @@ -257,6 +276,7 @@ const isDialogOpen = computed(() => {
return !!contentsDemandesFrontFiltered.value.find(item => item.expanded === true);
});
//Actives or archives demands displayed

const isActiveDemandesDisplayed = ref(false);

//Data initialisation
Expand Down
46 changes: 32 additions & 14 deletions src/views/Modification/ModifTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
d'exemplaires archivées
</v-chip>
<v-chip variant="text">
<v-tooltip activator="parent" location="bottom">
<v-tooltip v-if="isAdmin" activator="parent" location="bottom">
<template v-slot:activator="{ props }">
<label>
<input type="checkbox" v-model="extendedAllILN" style="margin-right: 5px"
Expand All @@ -27,7 +27,7 @@
</v-tooltip>
</v-chip>
</v-container>
<v-data-table :headers="headingsDemandes" :items="contentsDemandesFrontFiltered" :items-length="totalItemsFound"
<v-data-table :headers="filteredHeadingsDemandes" :items="contentsDemandesFrontFiltered" :items-length="totalItemsFound"
:loading="!isDataLoaded" show-expand :sort-by="sortBy"
item-key="id">
<template v-slot:body.prepend>
Expand Down Expand Up @@ -132,27 +132,32 @@ import DialogSuppression from '@/components/Dialog/DialogSuppression.vue';
import DialogCommentaire from '@/components/Dialog/DialogCommentaire.vue';
import MenuDownloadFile from '@/components/MenuDownloadFile.vue';
import moment from 'moment/moment';
import {useAuthStore} from "@/store/authStore";

//Emit
const emit = defineEmits(['backendError', 'backendSuccess']);

//Data
const isAdmin = useAuthStore().isAdmin();
const extendedAllILN = ref(false);
const headingsDemandes = ref([
const headingsDemandes = [
{
title: '',
key: 'data-table-expand',
align: 'center'
align: 'center',
display: true,
},
{
title: 'N° de Demande',
key: 'id',
align: 'center'
align: 'center',
display: true,
},
{
title: 'Crée le',
key: 'dateCreation',
align: 'center',
display: true,
sort: (d1, d2) => {
const date1 = moment(d1, 'DD/MM/yyyy HH:mm')
.valueOf();
Expand All @@ -167,6 +172,7 @@ const headingsDemandes = ref([
title: 'Mise à jour',
key: 'dateModification',
align: 'center',
display: true,
sort: (d1, d2) => {
const date1 = moment(d1, 'DD/MM/yyyy HH:mm')
.valueOf();
Expand All @@ -180,47 +186,59 @@ const headingsDemandes = ref([
{
title: 'ILN',
key: 'iln',
align: 'center'
align: 'center',
display: isAdmin,
},
{
title: 'RCR',
key: 'rcr',
align: 'center'
align: 'center',
display: true,
},
{
title: 'Zones et sous zones',
key: 'zone',
align: 'center'
align: 'center',
display: true,
},
{
title: 'Traitement',
key: 'traitement',
align: 'center'
align: 'center',
display: true,
},
{
title: 'Statut',
key: 'etatDemande',
align: 'center'
align: 'center',
display: true,
},
{
title: 'Progression',
key: 'pourcentageProgressionTraitement',
value: 'pourcentageProgressionTraitement',
align: 'center'
align: 'center',
display: true,
},
{
title: 'Fichiers',
key: 'filesToDownload',
value: 'filesToDownload',
align: 'center'
align: 'center',
display: true,
},
{
title: 'Action',
key: 'archiveOrCancel',
value: 'archiveOrCancel',
align: 'center'
align: 'center',
display: true,
}
]);
];
const filteredHeadingsDemandes = computed(() =>
headingsDemandes.filter(heading => heading.display !== false)
)

const listStatut = [
'En saisie',
'En attente',
Expand Down
Loading
Loading