import{a as Ve}from"./chunk-ENMFTS26.js";import{a as Ie}from"./chunk-GUL5JXOP.js";import{a as z}from"./chunk-P66RO3KJ.js";import{a as G}from"./chunk-QB2P2YYU.js";import{a as ke}from"./chunk-NQ63PI4C.js";import{d as H}from"./chunk-Q6JJUNJG.js";import"./chunk-TFD7V66G.js";import"./chunk-HYFDCJ4V.js";import{b as j}from"./chunk-ZURUU5AZ.js";import{g as $}from"./chunk-HUIYCCBF.js";import{a as ae,b as V}from"./chunk-ZYFBUEA5.js";import{b as Q,c as P,d as Se,e as Me,f as be,g as Ee,h as we,i as ye,j as xe,k as Fe,l as Ue,m as Te,n as A,o as De}from"./chunk-Q465MAI7.js";import"./chunk-I3GJPWI3.js";import{b as le,d as T,e as D}from"./chunk-R5OOSKPE.js";import{A as ce,B as fe,C as _e,D as N,F as ve,G as O,H as L,I as he,M as ge,N as q,O as Ce,P as B,o as k,q as g,s as R,t as me,w as de,x as se,y as pe,z as ue}from"./chunk-VF4SIIO7.js";import{b as oe}from"./chunk-3JAJZ4ZR.js";import{aa as I}from"./chunk-SIRN2M67.js";import{j as re,k as ne,o as w}from"./chunk-ZEDFMZ3B.js";import{$a as _,$b as ie,Ab as h,Jb as C,Ra as X,Rb as Y,Sb as Z,Tb as ee,Vb as n,Wb as M,Xb as te,Zb as E,_a as l,_b as S,ha as b,lb as p,nb as m,oa as K,pa as W,r as J,wb as i,xb as t,yb as s,zb as v}from"./chunk-PEWEDMBK.js";function He(e,r){e&1&&(i(0,"div",39),K(),i(1,"svg",40),s(2,"use",41),t(),W(),i(3,"strong"),n(4," Utilisateur cr\xE9\xE9 avec succ\xE8s."),t()())}function ze(e,r){e&1&&(i(0,"div",42),n(1," Nom Service est obligatoire "),t())}function Ge(e,r){e&1&&(i(0,"div",42),n(1," Pr\xE9noms Service est obligatoire "),t())}function Qe(e,r){e&1&&(i(0,"div",42),n(1," Pr\xE9noms Service est obligatoire "),t())}function Je(e,r){e&1&&(i(0,"div",42),n(1," L'email est obligatoire "),t())}function Ke(e,r){e&1&&(i(0,"div",42),n(1," Le mot de passe est obligatoire "),t())}function We(e,r){e&1&&(i(0,"div",42),n(1," Le r\xF4le est obligatoire "),t())}var Re=()=>["/utilisateurs/view-user"],Oe=(()=>{let r=class r{constructor(d,a,o,c,f){this.fb=d,this.router=a,this.route=o,this.userService=c,this.snackBar=f}ngOnInit(){this.editUserForm=this.fb.group({first_name:["",g.required],last_name:["",g.required],email:["",[g.required,g.email]],password:["",[g.required,g.minLength(8)]],profile_photo:[""],role:["",g.required],username:["",g.required]}),this.route.paramMap.subscribe(d=>{let a=d.get("id");console.log("id",a),a?this.userService.getServiceById(Number(a)).subscribe(o=>{this.editUserForm.patchValue({first_name:o.first_name,last_name:o.last_name,email:o.email,password:o.password,profile_photo:o.profile_photo,role:o.role,username:o.username})},o=>{console.error("Erreur lors de la r\xE9cup\xE9ration du service :",o)}):console.error("ID de service non fourni dans les param\xE8tres de la route.")})}onSubmit(){this.editUserForm.valid?(console.log(this.editUserForm.value),this.userService.updateService(this.editUserForm.value).subscribe(()=>{this.router.navigate(["/assistances/view-service"]),this.snackBar.open("Service mis \xE0 jour avec succ\xE8s","Fermer",{duration:3e3})},d=>{console.error("Erreur lors de la mise \xE0 jour du service :",d),this.snackBar.open("Erreur lors de la mise \xE0 jour du service","Fermer",{duration:3e3})})):this.snackBar.open("Veuillez remplir correctement tous les champs du formulaire","Fermer",{duration:3e3})}onCancel(){this.router.navigate(["/assistances/view-service"])}};r.\u0275fac=function(a){return new(a||r)(_(ve),_(T),_(le),_(z),_(G))},r.\u0275cmp=b({type:r,selectors:[["bgui-edit-user"]],standalone:!0,features:[E],decls:63,vars:13,consts:[[1,"container","mt-5"],[1,"content","sm-gutter"],[1,"d-flex","justify-content-between","align-items-center"],[1,"mb-3"],[1,"row"],["class","alert alert-success custom-alert","role","alert",4,"ngIf"],[1,"col-md-12","col-vlg-12","m-b-10"],[1,"row-fluid"],[1,"span12"],[1,"grid","simple"],[1,"card"],[1,"card-title"],[1,"card-body","m-3"],[3,"formGroup","ngSubmit"],[1,"row","justify-content-center"],[1,"col-md-6","mb-2"],["for","first_name"],["type","text","id","first_name","placeholder","Nom","formControlName","first_name","required","",1,"form-control"],["class","text-danger",4,"ngIf"],["for","last_name"],["type","text","id","last_name","placeholder","Pr\xE9noms","formControlName","last_name","required","",1,"form-control"],["for","username"],["type","text","id","username","placeholder","Nom d'utilisateur","name","username","required","",1,"form-control"],["for","user_email"],["type","email","id","email","placeholder","Email","name","email","required","",1,"form-control"],["for","user_password"],["type","password","id","password","placeholder","Mot de passe","name","password","required","",1,"form-control"],["for","role"],["type","text","id","role","placeholder","R\xF4le","name","role","required","",1,"form-control"],["for","profile_photo",2,"margin","auto"],["type","file","id","profile_photo","placeholder","Photo de profil","name","profile_photo","accept",".jpg, .jpeg, .png",1,"form-control-file"],[1,"col-md-12"],[1,"d-flex","justify-content-between","mt-3"],["type","button",1,"btn","btn-sm","btn-secondary","m-5",2,"border-radius","15px",3,"routerLink"],[1,"fa","fa-arrow-left","m-1"],["type","submit",1,"btn","btn-sm","btn-success","m-5",2,"border-radius","15px",3,"disabled"],[1,"fa","fa-save","m-1"],["type","button",1,"btn","btn-sm","btn-danger","m-5",2,"border-radius","15px",3,"routerLink"],[1,"fa","fa-times","m-1"],["role","alert",1,"alert","alert-success","custom-alert"],["width","20","height","10","role","img","aria-label","Success:",1,"bi","flex-shrink-0","me-1"],[0,"xlink","href","#check-circle-fill"],[1,"text-danger"]],template:function(a,o){if(a&1&&(i(0,"div",0)(1,"div",1)(2,"div",2)(3,"h5",3),n(4,"Ajouter Utilisateur"),t()(),i(5,"div",4),p(6,He,5,0,"div",5),i(7,"div",6)(8,"div",7)(9,"div",8)(10,"div",9)(11,"div",10)(12,"div",11)(13,"div",12)(14,"form",13),C("ngSubmit",function(){return o.onSubmit()}),i(15,"div",14)(16,"div",15)(17,"label",16),n(18,"Nom"),t(),s(19,"input",17),p(20,ze,2,0,"div",18),t(),i(21,"div",15)(22,"label",19),n(23,"Pr\xE9noms"),t(),s(24,"input",20),p(25,Ge,2,0,"div",18),t(),i(26,"div",15)(27,"label",21),n(28,"Nom utilisateur"),t(),s(29,"input",22),p(30,Qe,2,0,"div",18),t(),i(31,"div",15)(32,"label",23),n(33,"Email"),t(),s(34,"input",24),p(35,Je,2,0,"div",18),t(),i(36,"div",15)(37,"label",25),n(38,"Mot de passe"),t(),s(39,"input",26),p(40,Ke,2,0,"div",18),t(),i(41,"div",15)(42,"label",27),n(43,"R\xF4le"),t(),s(44,"input",28),p(45,We,2,0,"div",18),t(),i(46,"div",15)(47,"div")(48,"label",29),n(49,"Photo profil"),t()(),s(50,"input",30),t()(),i(51,"div",31)(52,"div",32)(53,"button",33),n(54," Retour "),s(55,"i",34),t(),i(56,"div")(57,"button",35),n(58," Enregistrer "),s(59,"i",36),t(),i(60,"button",37),n(61," Annuler "),s(62,"i",38),t()()()()()()()()()()()()()()()),a&2){let c,f,y,x,F,U;l(6),m("ngIf",o.showAlert),l(8),m("formGroup",o.editUserForm),l(6),m("ngIf",((c=o.editUserForm.get("first_name"))==null?null:c.invalid)&&((c=o.editUserForm.get("first_name"))==null?null:c.touched)),l(5),m("ngIf",((f=o.editUserForm.get("last_name"))==null?null:f.invalid)&&((f=o.editUserForm.get("last_name"))==null?null:f.touched)),l(5),m("ngIf",((y=o.editUserForm.get("username"))==null?null:y.invalid)&&((y=o.editUserForm.get("username"))==null?null:y.touched)),l(5),m("ngIf",((x=o.editUserForm.get("email"))==null?null:x.invalid)&&((x=o.editUserForm.get("email"))==null?null:x.touched)),l(5),m("ngIf",((F=o.editUserForm.get("password"))==null?null:F.invalid)&&((F=o.editUserForm.get("password"))==null?null:F.touched)),l(5),m("ngIf",((U=o.editUserForm.get("role"))==null?null:U.invalid)&&((U=o.editUserForm.get("role"))==null?null:U.touched)),l(8),m("routerLink",S(11,Re)),l(4),m("disabled",o.editUserForm.invalid),l(3),m("routerLink",S(12,Re))}},dependencies:[w,ne,A,q,B,$,L,se,k,R,me,N,pe,ue,I,V,j,P,D,O,H]});let e=r;return e})();var Le=(()=>{let r=class r{};r.\u0275fac=function(a){return new(a||r)},r.\u0275cmp=b({type:r,selectors:[["bgui-delete-user"]],standalone:!0,features:[E],decls:0,vars:0,template:function(a,o){},dependencies:[w]});let e=r;return e})();function Xe(e,r){if(e&1&&(i(0,"option",50),n(1),t()),e&2){let u=r.$implicit;m("value",u.code),l(),te(" ",u.code," ")}}function Ye(e,r){e&1&&(i(0,"mat-header-cell",51),n(1,"ID"),t())}function Ze(e,r){if(e&1&&(i(0,"mat-cell"),n(1),t()),e&2){let u=r.$implicit;l(),M(u.id)}}function et(e,r){e&1&&(i(0,"mat-header-cell",51),n(1,"Nom"),t())}function tt(e,r){if(e&1&&(i(0,"mat-cell"),n(1),t()),e&2){let u=r.$implicit;l(),M(u.first_name)}}function it(e,r){e&1&&(i(0,"mat-header-cell",51),n(1,"Pr\xE9noms"),t())}function rt(e,r){if(e&1&&(i(0,"mat-cell"),n(1),t()),e&2){let u=r.$implicit;l(),M(u.last_name)}}function nt(e,r){e&1&&(i(0,"mat-header-cell",51),n(1,"Nom utilisateur"),t())}function ot(e,r){if(e&1&&(i(0,"mat-cell"),n(1),t()),e&2){let u=r.$implicit;l(),M(u.username)}}function lt(e,r){e&1&&(i(0,"mat-header-cell",51),n(1,"Email"),t())}function at(e,r){if(e&1&&(i(0,"mat-cell"),n(1),t()),e&2){let u=r.$implicit;l(),M(u.email)}}function mt(e,r){e&1&&(i(0,"mat-header-cell",51),n(1,"R\xF4le"),t())}function dt(e,r){if(e&1&&(i(0,"mat-cell"),n(1),t()),e&2){let u=r.$implicit;l(),M(u.role)}}function st(e,r){e&1&&(i(0,"mat-header-cell",51),n(1,"Photo profil"),t())}function pt(e,r){if(e&1&&(i(0,"mat-cell"),s(1,"img",52),t()),e&2){let u=r.$implicit;l(),m("src",u.profile_photo,X)}}function ut(e,r){e&1&&(i(0,"mat-header-cell",51),n(1,"Actions"),t())}var ct=()=>["view-user"],ft=e=>["/utilisateurs/edit-user",e],_t=()=>["delete-user/id"];function vt(e,r){if(e&1&&(i(0,"mat-cell",53)(1,"a",54)(2,"mat-icon",55),n(3,"remove_red_eye"),t()(),i(4,"a",54)(5,"mat-icon",56),n(6,"edit"),t()(),i(7,"a",54)(8,"mat-icon",57),n(9," delete_sweep "),t()()()),e&2){let u=r.$implicit;l(),m("routerLink",S(3,ct)),l(3),m("routerLink",ie(4,ft,u.id)),l(3),m("routerLink",S(6,_t))}}function ht(e,r){e&1&&s(0,"mat-header-row")}function gt(e,r){e&1&&s(0,"mat-row")}var Ct=()=>["/utilisateurs/create-users"],St=()=>[5,10,20,30,40,50,60,70,80,90,100],je=(()=>{let r=class r{constructor(d,a,o,c,f){this.http=d,this.router=a,this.snackBar=o,this.dialog=c,this.userService=f,this.user=[],this.dataTypePaiements=[],this.dataSource=new De,this.selectedOperateur="OM",this.displayedColumns=["id","username","first_name","last_name","email","role","profile_photo","actions"]}onSearch(){throw new Error("Method not implemented.")}ngOnInit(){this.userService.getAllUsers().pipe(J(d=>JSON.stringify(d))).subscribe(d=>{let a=JSON.parse(d),o=a.results;console.log("UserData==> Results:",o),this.dataSource=a.results})}editUser(){throw new Error("Method not implemented.")}deleteUser(){throw new Error("Method not implemented.")}ngAfterViewInit(){this.paginator&&(this.dataSource.paginator=this.paginator)}applyFilter(d){let a=d.target.value;this.dataSource.filter=a.trim().toLowerCase()}};r.\u0275fac=function(a){return new(a||r)(_(oe),_(T),_(G),_(ke),_(z))},r.\u0275cmp=b({type:r,selectors:[["bgui-view-user"]],viewQuery:function(a,o){if(a&1&&Y(Q,5),a&2){let c;Z(c=ee())&&(o.paginator=c.first)}},standalone:!0,features:[E],decls:82,vars:13,consts:[[1,"content","sm-gutter"],[1,"mb-4"],[1,"col-md-2"],[1,"row"],[1,"col-md-12","col-vlg-12","m-b-10"],[1,"row-fluid"],[1,"span12"],[1,"grid","simple"],[1,"card"],[1,"card-title"],[1,"card-body","m-3"],[1,"row",2,"margin","auto"],["for","operateurs"],["id","operateurs","placeholder","operateur",1,"form-control","filtre",2,"width","100%",3,"ngModel","ngModelChange"],[3,"value",4,"ngFor","ngForOf"],["for","services"],[1,"form-control","filtre",2,"width","100%"],["value",""],[1,"col-md-3"],["for","debut"],["type","date","required","","name","debut",1,"form-control","form-control-sm",3,"ngModel","ngModelChange"],["for","fin"],["type","date","required","","name","fin",1,"form-control","form-control-sm",3,"ngModel","ngModelChange"],[2,"visibility","hidden"],[1,"btn","btn-primary","btn-sm",2,"border-radius","15px",3,"click"],[1,"fa","fa-search","m-1"],[1,"page-title","d-flex","justify-content-between"],[1,"col-m-5","text-right"],[1,"btn","btn-secondary","m-5",2,"border-radius","15px"],[1,"fa","fa-download","m-1"],[1,"btn","btn-sl","btn-success","m-5",2,"border-radius","15px",3,"routerLink"],[1,"example-container","mat-elevation-z8",2,"margin-top","40px"],["matInput","","placeholder","Ex. ium",1,"textFilter",3,"keyup"],["input",""],[1,"mat-elevation-z8",3,"dataSource"],["matColumnDef","id"],["class","bold-text",4,"matHeaderCellDef"],[4,"matCellDef"],["matColumnDef","first_name"],["matColumnDef","last_name"],["matColumnDef","username"],["matColumnDef","email"],["matColumnDef","role"],["matColumnDef","profile_photo"],["matColumnDef","actions"],["style","text-align: right",4,"matCellDef"],[4,"matHeaderRowDef"],[4,"matRowDef","matRowDefColumns"],[3,"pageSize","pageSizeOptions","showFirstLastButtons"],["paginator",""],[3,"value"],[1,"bold-text"],["alt","Photo de profil","width","50","height","50",3,"src"],[2,"text-align","right"],["href","#",1,"m-2",3,"routerLink"],["title","Voir",2,"color","blue"],["title","Modifier",2,"color","green"],["title","Supprimer",2,"color","red"]],template:function(a,o){a&1&&(i(0,"div",0)(1,"div",1)(2,"h4"),n(3,"Liste des utilisateurs"),t()(),s(4,"div",2),i(5,"div",3)(6,"div",4)(7,"div",5)(8,"div",6)(9,"div",7)(10,"div",8)(11,"div",9)(12,"div",10)(13,"div",11)(14,"div",2)(15,"label",12),n(16,"Op\xE9rateurs"),t(),i(17,"select",13),C("ngModelChange",function(f){return o.selectedOperateur=f}),p(18,Xe,2,2,"option",14),t()(),i(19,"div",2)(20,"label",15),n(21,"Services"),t(),i(22,"select",16)(23,"option",17),n(24,"Tout"),t()()(),i(25,"div",18)(26,"label",19),n(27,"De"),t(),i(28,"input",20),C("ngModelChange",function(f){return o.startDate=f}),t()(),i(29,"div",18)(30,"label",21),n(31,"\xC0"),t(),i(32,"input",22),C("ngModelChange",function(f){return o.endDate=f}),t()(),i(33,"div",2)(34,"label",23),n(35,"Recherche"),t(),i(36,"div",9)(37,"button",24),C("click",function(){return o.onSearch()}),n(38," Recherche "),s(39,"i",25),t()()()()()()()()()()()()(),i(40,"div",26)(41,"div",27)(42,"button",28),n(43," Exporter "),s(44,"i",29),t()(),i(45,"a",30),n(46," Ajouter "),t()(),i(47,"div",31)(48,"mat-form-field")(49,"mat-label"),n(50,"Filter"),t(),i(51,"input",32,33),C("keyup",function(f){return o.applyFilter(f)}),t()(),i(53,"mat-table",34),v(54,35),p(55,Ye,2,0,"mat-header-cell",36)(56,Ze,2,1,"mat-cell",37),h(),v(57,38),p(58,et,2,0,"mat-header-cell",36)(59,tt,2,1,"mat-cell",37),h(),v(60,39),p(61,it,2,0,"mat-header-cell",36)(62,rt,2,1,"mat-cell",37),h(),v(63,40),p(64,nt,2,0,"mat-header-cell",36)(65,ot,2,1,"mat-cell",37),h(),v(66,41),p(67,lt,2,0,"mat-header-cell",36)(68,at,2,1,"mat-cell",37),h(),v(69,42),p(70,mt,2,0,"mat-header-cell",36)(71,dt,2,1,"mat-cell",37),h(),v(72,43),p(73,st,2,0,"mat-header-cell",36)(74,pt,2,1,"mat-cell",37),h(),v(75,44),p(76,ut,2,0,"mat-header-cell",36)(77,vt,10,7,"mat-cell",45),h(),p(78,ht,1,0,"mat-header-row",46)(79,gt,1,0,"mat-row",47),t(),s(80,"mat-paginator",48,49),t()),a&2&&(l(17),m("ngModel",o.selectedOperateur),l(),m("ngForOf",o.operateurs),l(10),m("ngModel",o.startDate),l(4),m("ngModel",o.endDate),l(13),m("routerLink",S(11,Ct)),l(8),m("dataSource",o.dataSource),l(25),m("matHeaderRowDef",o.displayedColumns),l(),m("matRowDefColumns",o.displayedColumns),l(),m("pageSize",5)("pageSizeOptions",S(12,St))("showFirstLastButtons",!0))},dependencies:[w,re,Q,A,Se,be,xe,Ee,Me,Fe,we,ye,Ue,Te,q,ge,he,B,Ce,$,L,fe,_e,k,ce,R,N,I,V,ae,j,P,D,O,de,H]});let e=r;return e})();var Mi=[{path:"",component:Ie,children:[{path:"",redirectTo:"view-user",pathMatch:"full"},{path:"view-user",component:je},{path:"create-users",component:Ve},{path:"edit-user/:id",component:Oe},{path:"delete-user/:id",component:Le}]}];export{Mi as userRoutes};