22div
33 q-btn( color ="positive" icon ='mdi-content-save-plus' @click ="create" v-show ="isNew" v-if ="crud.create" )
44 q-tooltip.text-body2 Créer
5+ q-btn.q-mx-xs ( @click ="sendInit" color ="primary" icon ="mdi-mail" :disabled ="props.identity.state != IdentityState.SYNCED" )
6+ q-tooltip.text-body2 ( slot ="trigger" ) Envoyer le mail d'initialisation
57 q-btn.q-mx-xs ( @click ="submit" color ="positive" icon ="mdi-check" v-show ="!isNew" v-if ="crud.update" )
68 q-tooltip.text-body2 ( slot ="trigger" ) Enregistrer les modifications
79 q-btn.q-mx-xs ( v-if ="props.identity?._id" @click ="sync" color ="orange-8" : disabled= "props.identity.state != IdentityState.TO_VALIDATE" icon ="mdi-sync" )
@@ -21,9 +23,9 @@ import { useFetch } from 'nuxt/app'
2123import { useIdentityStates } from ' ~/composables'
2224import { useErrorHandling } from ' #imports'
2325
26+
2427type IdentityResponse = operations [' IdentitiesController_search' ][' responses' ][' 200' ][' content' ][' application/json' ]
2528type Identity = components [' schemas' ][' IdentitiesDto' ]
26-
2729const props = defineProps ({
2830 identity: {
2931 type: Object as PropType <Identity >,
@@ -69,6 +71,28 @@ async function sync() {
6971 emits (' sync' )
7072}
7173
74+ async function sendInit(){
75+ // envoi le mail
76+
77+ const { data : result, pending, error, refresh } = await useHttp (` /management/passwd/init ` , {
78+ method: ' POST' ,
79+ body: { uid: props .identity .inetOrgPerson .uid },
80+ });
81+ if (error .value ) {
82+ handleError ({
83+ error: error .value ,
84+ message: ' Erreur lors de l\' envoi du mail'
85+ })
86+ } else {
87+ $q .notify ({
88+ message: ' Le mail a été envoyé' ,
89+ color: ' positive' ,
90+ position: ' top-right' ,
91+ icon: ' mdi-check-circle-outline' ,
92+ })
93+ }
94+ }
95+
7296function logs() {
7397 router .push (` /jobs?filters[:concernedTo.id]=${(props .identity as any )._id } ` )
7498}
0 commit comments