33 div
44 q-btn( color ="positive" icon ='mdi-content-save-plus' @click ="create" v-show ="isNew" v-if ="crud.create" )
55 q-tooltip.text-body2 Créer
6+ q-toggle.q-pa-md.q-gutter-y-xl ( v-if ="props.identity?._id" @click ="activate" color ="green" left-label ='Inactif' label ="Actif" v-model ="activation" )
67 q-btn.q-mx-xs ( @click ="sendInit" color ="primary" icon ="mdi-email-arrow-right" :disabled ="props.identity.state != IdentityState.SYNCED" )
78 q-tooltip.text-body2 ( slot ="trigger" ) Envoyer le mail d'invitation
89 q-btn.q-mx-xs ( @click ="submit" color ="positive" icon ="mdi-check" v-show ="!isNew" v-if ="crud.update" )
@@ -12,8 +13,6 @@ div.flex
1213 q-tooltip.text-body2 ( slot ="trigger" v-else ) L'état de l'identité ne permet pas de la synchroniser
1314 q-btn.q-mx-xs ( v-if ="props.identity?._id" @click ="logs" color ="grey-8" icon ="mdi-file-document" : href= "'/jobs?filters[:concernedTo.id]=' + props.identity?._id" )
1415 q-tooltip.text-body2 ( slot ="trigger" ) Voir les logs de l'identité
15- q-separator.q-mx-sm ( vertical )
16- div
1716 q-btn.q-mx-xs ( v-if ="props.identity?._id" @click ="deleteIdentity" : disabled= "!props.identity.lastSync" color ="negative" icon ="mdi-delete" )
1817 q-tooltip.text-body2 ( slot ="trigger" ) Supprimer l'identité
1918</template >
@@ -31,6 +30,7 @@ import { useErrorHandling } from '#imports'
3130
3231type IdentityResponse = operations [' IdentitiesController_search' ][' responses' ][' 200' ][' content' ][' application/json' ]
3332type Identity = components [' schemas' ][' IdentitiesDto' ]
33+ const activation= ref (true )
3434const props = defineProps ({
3535 identity: {
3636 type: Object as PropType <Identity >,
@@ -61,6 +61,44 @@ async function create() {
6161 // console.log('submit from actions')
6262 emits (' create' )
6363}
64+ async function activate(){
65+ let message= " "
66+ let bouton = " "
67+ debugger
68+ if (activation .value === false ){
69+ message = " Voulez vous vraiment désactiver l'identité"
70+ bouton = " Désactiver"
71+ }else {
72+ message = " Voulez vous vraiment activer l'identité"
73+ bouton = " Activer"
74+ }
75+
76+ $q .dialog ({
77+ title: ' Confirmation' ,
78+ message: message ,
79+ persistent: true ,
80+ ok: {
81+ push: true ,
82+ color: ' positive' ,
83+ label: bouton ,
84+ },
85+ cancel: {
86+ push: true ,
87+ color: ' negative' ,
88+ label: ' Annuler' ,
89+ },
90+ }).onOk (async () => {
91+ const requestOptions= {method: ' POST' ,
92+ body:JSON .stringify ({id:props .identity ._id ,status:activation .value })}
93+ const data= await $http .post (' /management/identities/activation' , requestOptions )
94+ .catch (error => {
95+ alert (' There was an error!' );
96+ })
97+ }).onCancel (() => {
98+ activation .value = activation .value === true ? activation .value = false : activation .value = true
99+ })
100+
101+ }
64102
65103
66104async function deleteIdentity() {
@@ -70,12 +108,12 @@ async function deleteIdentity() {
70108 persistent: true ,
71109 ok: {
72110 push: true ,
73- color: ' negative ' ,
111+ color: ' positive ' ,
74112 label: ' Supprimer' ,
75113 },
76114 cancel: {
77115 push: true ,
78- color: ' info ' ,
116+ color: ' negative ' ,
79117 label: ' Annuler' ,
80118 },
81119 }).onOk (() => {
0 commit comments