@@ -18,35 +18,47 @@ export enum IdentityLifecycle {
1818
1919
2020export const IdentityLifecycleList = [
21- { value : IdentityLifecycle . IMPORTED , text : 'Imported ' , color : '#F0E68C' , icon : 'mdi-circle' } , // Khaki
22- { value : IdentityLifecycle . OFFICIAL , text : 'Official ' , color : '#228B22' , icon : 'mdi-circle' } , // Forest Green
23- { value : IdentityLifecycle . ACTIVE , text : 'Active ' , color : '#00FF00' , icon : 'mdi-circle' } , // Lime
24- { value : IdentityLifecycle . PROVISIONAL , text : 'Provisional ' , color : '#FFD700' , icon : 'mdi-circle' } , // Gold
25- { value : IdentityLifecycle . INACTIVE , text : 'Inactive ' , color : '#808080' , icon : 'mdi-circle' } , // Gray
26- { value : IdentityLifecycle . DELETED , text : 'Deleted ' , color : '#FF0000' , icon : 'mdi-circle' } , // Red
21+ { value : IdentityLifecycle . IMPORTED , text : 'Importé ' , color : '#F0E68C' , icon : 'mdi-circle' , display : true } , // Khaki
22+ { value : IdentityLifecycle . OFFICIAL , text : 'Officiel ' , color : '#228B22' , icon : 'mdi-circle' , display : true } , // Forest Green
23+ { value : IdentityLifecycle . ACTIVE , text : 'Actif ' , color : '#00FF00' , icon : 'mdi-circle' , display : true } , // Lime
24+ { value : IdentityLifecycle . PROVISIONAL , text : 'Provisoir ' , color : '#FFD700' , icon : 'mdi-circle' , display : true } , // Gold
25+ { value : IdentityLifecycle . INACTIVE , text : 'Inactif ' , color : '#808080' , icon : 'mdi-circle' , display : true } , // Gray
26+ { value : IdentityLifecycle . DELETED , text : 'Supprimé ' , color : '#FF0000' , icon : 'mdi-circle' , display : true } , // Red
2727] ;
2828
2929export function useIdentityLifecycles ( ) : useIdentityLifecycleReturnType {
3030 function getLifecycleName ( state : number ) : string {
31- return IdentityLifecycleList . find ( item => item . value === state ) ?. text || 'Unknown' ;
31+ const found = IdentityLifecycleList . find ( item => item . value === state ) ;
32+ if ( found && found ?. display ) return found . text ;
33+ return 'Inconnu' ;
3234 }
3335
3436 function getLifecycleColor ( state : number ) : string {
35- return IdentityLifecycleList . find ( item => item . value === state ) ?. color || 'grey' ;
37+ const found = IdentityLifecycleList . find ( item => item . value === state ) ;
38+ if ( found && found ?. display ) return found . color ;
39+ return 'grey' ;
3640 }
3741
3842 function getLifecycleIcon ( state : number ) : string {
39- return IdentityLifecycleList . find ( item => item . value === state ) ?. icon || 'mdi-circle' ;
43+ const found = IdentityLifecycleList . find ( item => item . value === state ) ;
44+ if ( found && found ?. display ) return found . icon ;
45+ return 'mdi-circle' ;
4046 }
4147
4248 function getLifecycleInfos ( state : number ) : { color : string , name : string , icon : string , value : number } {
43- const found = IdentityLifecycleList . find ( item => item . value === state ) ;
44- return {
45- color : found ? found . color : 'grey' ,
46- name : found ? found . text : 'Unknown' ,
47- icon : found ? found . icon : 'mdi-circle' ,
48- value : state
49- } ;
49+ const found = IdentityLifecycleList . find ( item => item . value === state ) ;
50+ if ( found && found ?. display ) return {
51+ color : found . color ,
52+ name : found . text ,
53+ icon : found . icon ,
54+ value : state
55+ } ;
56+ return {
57+ color : 'grey' ,
58+ name : 'Inconnu' ,
59+ icon : 'mdi-circle' ,
60+ value : state
61+ } ;
5062 }
5163
5264
0 commit comments