refactor(front) : aligne l'ecran ajouter client sur la maquette (ERP-63)
- Layout maquette : en-tete avec retour, grille 3 colonnes (gap-x-[80px]), cartes ombrees pour les onglets, boutons Valider centres, libelles ajustes. - Telephones du formulaire principal en tableau (1 par defaut, + revele le 2e). - Information : Description en row-span-2 (alignement corrige via pt-1), Nombre de salaries en MalioInputText masque chiffres. - Adresse : carte ombree, suppression en absolute, sites en cases a cocher inline, pays France/Espagne, exclusivite Prospect appliquee au toggle. - Onglets : icones par onglet (TAB_ICONS) ; Statistiques / Rapports / Echanges passent en edit-only (absents a la creation, option includeEditOnlyTabs pour la modification).
This commit is contained in:
@@ -12,7 +12,7 @@ import {
|
||||
type ContactDraft,
|
||||
} from '../clientFormRules'
|
||||
|
||||
describe('buildClientFormTabKeys (gating onglet Comptabilite)', () => {
|
||||
describe('buildClientFormTabKeys (gating onglet Comptabilite + onglets edit-only)', () => {
|
||||
it('inclut l onglet accounting si l utilisateur a accounting.view', () => {
|
||||
expect(buildClientFormTabKeys(true)).toContain('accounting')
|
||||
})
|
||||
@@ -21,8 +21,16 @@ describe('buildClientFormTabKeys (gating onglet Comptabilite)', () => {
|
||||
expect(buildClientFormTabKeys(false)).not.toContain('accounting')
|
||||
})
|
||||
|
||||
it('place accounting entre transport et statistics quand present', () => {
|
||||
it('a la creation, exclut Statistiques / Rapports / Echanges', () => {
|
||||
const keys = buildClientFormTabKeys(true)
|
||||
expect(keys).toEqual(['information', 'contact', 'address', 'transport', 'accounting'])
|
||||
expect(keys).not.toContain('statistics')
|
||||
expect(keys).not.toContain('reports')
|
||||
expect(keys).not.toContain('exchanges')
|
||||
})
|
||||
|
||||
it('en modification (includeEditOnlyTabs), ajoute les onglets edit-only en fin', () => {
|
||||
const keys = buildClientFormTabKeys(true, { includeEditOnlyTabs: true })
|
||||
expect(keys).toEqual([
|
||||
'information',
|
||||
'contact',
|
||||
|
||||
@@ -24,17 +24,32 @@
|
||||
export const CLIENT_FORM_PLACEHOLDER_TABS = ['transport', 'statistics', 'reports', 'exchanges'] as const
|
||||
|
||||
/**
|
||||
* Construit l'ordre des onglets de l'ecran « Ajouter un client ». L'onglet
|
||||
* Comptabilite n'est present que si l'utilisateur a `accounting.view` — sinon il
|
||||
* est totalement absent (Bureau / Commerciale ne le voient pas). Ordre aligne
|
||||
* sur la spec M1 § Ecran « Ajouter un client ».
|
||||
* Onglets affiches uniquement en MODIFICATION (selon le role), jamais a la
|
||||
* creation : Statistiques / Rapports / Echanges. A rebrancher dans les ecrans
|
||||
* d'edition (1.11/1.12) via l'option `includeEditOnlyTabs`.
|
||||
*/
|
||||
export function buildClientFormTabKeys(canAccountingView: boolean): string[] {
|
||||
export const CLIENT_FORM_EDIT_ONLY_TABS = ['statistics', 'reports', 'exchanges'] as const
|
||||
|
||||
/**
|
||||
* Construit l'ordre des onglets du formulaire client.
|
||||
* - L'onglet Comptabilite n'est present que si l'utilisateur a `accounting.view`
|
||||
* (Bureau / Commerciale ne le voient pas).
|
||||
* - Les onglets edit-only (Statistiques / Rapports / Echanges) sont exclus par
|
||||
* defaut (creation) ; passer `includeEditOnlyTabs: true` pour les afficher en
|
||||
* modification.
|
||||
* Ordre aligne sur la spec M1 § Ecran « Ajouter un client ».
|
||||
*/
|
||||
export function buildClientFormTabKeys(
|
||||
canAccountingView: boolean,
|
||||
options: { includeEditOnlyTabs?: boolean } = {},
|
||||
): string[] {
|
||||
const keys = ['information', 'contact', 'address', 'transport']
|
||||
if (canAccountingView) {
|
||||
keys.push('accounting')
|
||||
}
|
||||
keys.push('statistics', 'reports', 'exchanges')
|
||||
if (options.includeEditOnlyTabs) {
|
||||
keys.push(...CLIENT_FORM_EDIT_ONLY_TABS)
|
||||
}
|
||||
return keys
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user