2828 v-for ="col in props.cols.filter(c => c.name !== 'expand')"
2929 :key ="col.name"
3030 :props ="props"
31- ) {{ col.value }}
31+ )
32+ template( v-if ="col.name === 'identity'" )
33+ q-chip(
34+ v-if ="props.row?.refId?.inetOrgPerson?.cn"
35+ @click ="push(`/identities?read=${props.row.refId._id}&skip=0&limit=16&sort[metadata.lastUpdatedAt]=desc`)"
36+ icon ="mdi-account" clickable dense
37+ ) {{ props.row?.refId?.inetOrgPerson?.cn }}
38+ span( v-else ) Inconnu
39+ template( v-else )
40+ span {{ col.value || col.field(props.row) || "" }}
3241 q-td.text-center ( auto-width )
3342 q-btn(
3443 @click ="expandRow(props)"
@@ -71,17 +80,16 @@ export default {
7180 name: ' identity' ,
7281 align: ' center' ,
7382 label: ' Identité(e)' ,
74- field : (row ) => row ?.refId ?.inetOrgPerson ?.cn || ' <Inconnu>' ,
75- format : (cn ) => ` ${cn } ` ,
83+ field : (row ) => row ?.refId || {},
7684 sortable: true ,
7785 },
7886 {
7987 name: ' lifecycle' ,
8088 required: true ,
81- label: ' Cycle' ,
89+ label: ' Cycle déclanché ' ,
8290 align: ' left' ,
8391 field : (row ) => row .lifecycle ,
84- format : (lifecycle ) => ` ${lifecycle } ` ,
92+ format : (lifecycle ) => ` ${this . cycleToText ( lifecycle ) } ` ,
8593 sortable: true ,
8694 },
8795 {
@@ -97,6 +105,8 @@ export default {
97105 }
98106 },
99107 async setup() {
108+ const router = useRouter ()
109+
100110 const {
101111 data : rows,
102112 pending,
@@ -106,9 +116,14 @@ export default {
106116 method: ' GET' ,
107117 transform : (context : { statusCode: number ; data: any [] }) => context ?.data || [],
108118 })
119+
109120 return {
110121 rows ,
111122 pending ,
123+ error ,
124+ refresh ,
125+
126+ router ,
112127 }
113128 },
114129 computed: {
@@ -144,6 +159,26 @@ export default {
144159 this .expanded = this .expanded .includes (props .row ._id ) ? [] : [props .row ._id ]
145160 // props.expand = !props.expand
146161 },
162+ cycleToText(cycle ) {
163+ switch (cycle ) {
164+ case IdentityLifecycle .DELETED :
165+ return ' Suppression'
166+ case IdentityLifecycle .INACTIVE :
167+ return ' Inactif'
168+ case IdentityLifecycle .PROVISIONAL :
169+ return ' Provisionnel'
170+ case IdentityLifecycle .ACTIVE :
171+ return ' Actif'
172+ case IdentityLifecycle .OFFICIAL :
173+ return ' Officiel'
174+
175+ default :
176+ return ' Inconnu'
177+ }
178+ },
179+ push(path ) {
180+ window .open (path , ' _blank' )
181+ },
147182 },
148183 onMounted() {
149184 this .$nextTick (() => {
0 commit comments