feat: modification de la gestion des rôles + ajout rôle d'un bureau (!52)
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
| Numéro du ticket | Titre du ticket | |------------------|-----------------| | | | ## Description de la PR ## Modification du .env ## Check list - [ ] Pas de régression - [ ] TU/TI/TF rédigée - [ ] TU/TI/TF OK - [ ] CHANGELOG modifié Reviewed-on: #52 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit was merged in pull request #52.
This commit is contained in:
@@ -18,13 +18,15 @@ export interface UseBovineColumnsOptions {
|
||||
|
||||
/**
|
||||
* Définition partagée des colonnes des tableaux bovins (inventory + case).
|
||||
* Variants distincts pour chaque écran et chaque rôle (admin/user) afin de
|
||||
* pouvoir ajuster les largeurs indépendamment.
|
||||
* 4 variants : avec/sans colonnes prix × inventory/case.
|
||||
*
|
||||
* Les colonnes Prix/kg et Prix total sont visibles pour les rôles BUREAU
|
||||
* et ADMIN (BUREAU hérite ses droits price-visibility, ADMIN hérite de BUREAU).
|
||||
*/
|
||||
export const useBovineColumns = (options: UseBovineColumnsOptions = {}) => {
|
||||
const auth = useAuthStore()
|
||||
|
||||
const adminColumnsInventory: BovineColumn[] = [
|
||||
const withPricesInventory: BovineColumn[] = [
|
||||
{ key: 'nationalNumber', label: 'N° National', width: '80px' },
|
||||
{ key: 'workNumber', label: 'N° Travail', width: '60px' },
|
||||
{ key: 'sex', label: 'Sexe', width: '70px' },
|
||||
@@ -38,7 +40,7 @@ export const useBovineColumns = (options: UseBovineColumnsOptions = {}) => {
|
||||
{ key: 'finalPrice', label: 'Prix total', width: '80px' }
|
||||
]
|
||||
|
||||
const userColumnsInventory: BovineColumn[] = [
|
||||
const withoutPricesInventory: BovineColumn[] = [
|
||||
{ key: 'nationalNumber', label: 'N° National', width: '80px' },
|
||||
{ key: 'workNumber', label: 'N° Travail', width: '60px' },
|
||||
{ key: 'sex', label: 'Sexe', width: '70px' },
|
||||
@@ -50,7 +52,7 @@ export const useBovineColumns = (options: UseBovineColumnsOptions = {}) => {
|
||||
{ key: 'arrivalDate', label: 'Entrée le', width: '90px' }
|
||||
]
|
||||
|
||||
const adminColumnsCase: BovineColumn[] = [
|
||||
const withPricesCase: BovineColumn[] = [
|
||||
{ key: 'nationalNumber', label: 'N° National', width: '110px' },
|
||||
{ key: 'workNumber', label: 'N° Travail', width: '85px' },
|
||||
{ key: 'sex', label: 'Sexe', width: '90px' },
|
||||
@@ -62,7 +64,7 @@ export const useBovineColumns = (options: UseBovineColumnsOptions = {}) => {
|
||||
{ key: 'finalPrice', label: 'Prix total', width: '105px' }
|
||||
]
|
||||
|
||||
const userColumnsCase: BovineColumn[] = [
|
||||
const withoutPricesCase: BovineColumn[] = [
|
||||
{ key: 'nationalNumber', label: 'N° National', width: '130px' },
|
||||
{ key: 'workNumber', label: 'N° Travail', width: '100px' },
|
||||
{ key: 'sex', label: 'Sexe', width: '110px' },
|
||||
@@ -73,10 +75,13 @@ export const useBovineColumns = (options: UseBovineColumnsOptions = {}) => {
|
||||
]
|
||||
|
||||
const columns = computed<BovineColumn[]>(() => {
|
||||
if (options.variant === 'case') {
|
||||
return auth.isAdmin ? adminColumnsCase : userColumnsCase
|
||||
const isCase = options.variant === 'case'
|
||||
const seePrice = auth.isBureau
|
||||
|
||||
if (isCase) {
|
||||
return seePrice ? withPricesCase : withoutPricesCase
|
||||
}
|
||||
return auth.isAdmin ? adminColumnsInventory : userColumnsInventory
|
||||
return seePrice ? withPricesInventory : withoutPricesInventory
|
||||
})
|
||||
|
||||
return { columns }
|
||||
|
||||
Reference in New Issue
Block a user