import{c as je}from"./chunk-5NB3MOJB.js";import{a as C}from"./chunk-A6DYZ2MZ.js";import{a as O}from"./chunk-QB2P2YYU.js";import{a as Le,b as Be}from"./chunk-NQ63PI4C.js";import{d as Ne}from"./chunk-Q6JJUNJG.js";import"./chunk-TFD7V66G.js";import"./chunk-HYFDCJ4V.js";import{b as ue}from"./chunk-ZURUU5AZ.js";import{a as Re,c as Ve,g as A}from"./chunk-HUIYCCBF.js";import{a as oe,b as ae}from"./chunk-ZYFBUEA5.js";import{b as H,c as ge,d as Ce,e as be,f as Me,g as we,h as xe,i as ye,j as Ee,k as Fe,l as De,m as Ie,n as ke,o as Te}from"./chunk-Q465MAI7.js";import"./chunk-I3GJPWI3.js";import{b as re,c as ne,d as F,e as D}from"./chunk-R5OOSKPE.js";import{D as L,F as pe,G as B,H as q,I as ve,M as fe,N as he,O as _e,P as Se,o as R,q as k,s as V,t as N,u as me,w as ce,x as j,y as se,z as de}from"./chunk-VF4SIIO7.js";import"./chunk-3JAJZ4ZR.js";import{aa as le}from"./chunk-SIRN2M67.js";import{k as T,m as ie,o as g}from"./chunk-ZEDFMZ3B.js";import{$a as v,$b as Z,Ab as y,Cb as J,Jb as f,Lb as K,Rb as U,Sb as W,Tb as X,Ub as I,Vb as a,Wb as w,Yb as Y,Zb as S,_a as l,_b as E,ac as ee,bc as te,ha as _,lb as u,ma as P,na as $,nb as c,oa as G,pa as Q,wb as i,xb as r,yb as d,zb as x}from"./chunk-PEWEDMBK.js";function Ke(e,t){e&1&&(i(0,"div",27),a(1," ID Service est obligatoire "),r())}function Ue(e,t){e&1&&(i(0,"div",27),a(1," Nom Service est obligatoire "),r())}function We(e,t){e&1&&(i(0,"div",27),a(1," Description est obligatoire "),r())}function Xe(e,t){e&1&&(i(0,"div",27),a(1," marchand est obligatoire "),r())}var Ye=()=>["/assistances/view-service"],ze=(()=>{let t=class t{constructor(m,o,n,s,p){this.fb=m,this.router=o,this.route=n,this.service=s,this.snackBar=p}ngOnInit(){this.editServiceForm=this.fb.group({service_id:["",k.required],nom_service:["",k.required],description:["",k.required],marchand:["",k.required]}),this.route.paramMap.subscribe(m=>{let o=m.get("service_id");console.log("id",o),o?this.service.getServiceById(Number(o)).subscribe(n=>{this.editServiceForm.patchValue({service_id:n.service_id,nom_service:n.nom_service,description:n.description,marchand:n.marchand})},n=>{console.error("Erreur lors de la r\xE9cup\xE9ration du service :",n)}):console.error("ID de service non fourni dans les param\xE8tres de la route.")})}onSubmit(){this.editServiceForm.valid?(console.log(this.editServiceForm.value),this.service.updateService(this.editServiceForm.value).subscribe(()=>{this.router.navigate(["/assistances/view-service"]),this.snackBar.open("Service mis \xE0 jour avec succ\xE8s","Fermer",{duration:3e3})},m=>{console.error("Erreur lors de la mise \xE0 jour du service :",m),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"])}};t.\u0275fac=function(o){return new(o||t)(v(pe),v(F),v(re),v(C),v(O))},t.\u0275cmp=_({type:t,selectors:[["bgui-edit-service"]],standalone:!0,features:[S],decls:40,vars:8,consts:[[1,"content","sm-gutter"],[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,"mb-3"],[3,"formGroup","ngSubmit"],["type","hidden","id","service_id","placeholder","ID","formControlName","service_id","required","",1,"form-control"],["class","text-danger",4,"ngIf"],[1,"col-md-5","mb-2"],["for","nom_service"],["type","text","id","nom_service","placeholder","Nom Service","formControlName","nom_service","required","",1,"form-control"],["for","description"],["type","text","id","description","placeholder","Description","formControlName","description","required","",1,"form-control"],["type","hidden","id","marchand","placeholder","Marchand","formControlName","marchand","readonly","","required","",1,"form-control"],[1,"col-md-12"],[1,"d-flex","justify-content-between","mt-3"],["href","#",1,"btn-round","btn","btn-secondary","btn-sm","m-1",3,"routerLink"],[1,"fa","fa-arrow-left","m-1"],["type","submit",1,"btn","btn-sm","btn-success","m-2",2,"border-radius","15px",3,"disabled","click"],[1,"fa","fa-save","m-1"],["type","button",1,"btn","btn-sm","btn-danger","m-5",2,"border-radius","15px",3,"click"],[1,"fa","fa-times","m-1"],[1,"text-danger"]],template:function(o,n){if(o&1&&(i(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"div",4)(5,"div",5)(6,"div",6)(7,"div",7)(8,"div",8)(9,"h4",9),a(10,"Modifier un service"),r(),i(11,"form",10),f("ngSubmit",function(){return n.onSubmit()}),i(12,"div",1),d(13,"input",11),u(14,Ke,2,0,"div",12),i(15,"div",13)(16,"label",14),a(17,"Nom Service"),r(),d(18,"input",15),u(19,Ue,2,0,"div",12),r(),i(20,"div",13)(21,"label",16),a(22,"Description"),r(),d(23,"input",17),u(24,We,2,0,"div",12),r(),d(25,"input",18),u(26,Xe,2,0,"div",12),i(27,"div",19)(28,"div",20)(29,"div",7)(30,"a",21),a(31," Retour "),d(32,"i",22),r()(),i(33,"div",7)(34,"button",23),f("click",function(){return n.onSubmit()}),a(35," Modifier "),d(36,"i",24),r(),i(37,"button",25),f("click",function(){return n.onCancel()}),a(38," Annuler "),d(39,"i",26),r()()()()()()()()()()()()()()()),o&2){let s,p,b,M;l(11),c("formGroup",n.editServiceForm),l(3),c("ngIf",((s=n.editServiceForm.get("service_id"))==null?null:s.invalid)&&((s=n.editServiceForm.get("service_id"))==null?null:s.touched)),l(5),c("ngIf",((p=n.editServiceForm.get("nom_service"))==null?null:p.invalid)&&((p=n.editServiceForm.get("nom_service"))==null?null:p.touched)),l(5),c("ngIf",((b=n.editServiceForm.get("description"))==null?null:b.invalid)&&((b=n.editServiceForm.get("description"))==null?null:b.touched)),l(2),c("ngIf",((M=n.editServiceForm.get("marchand"))==null?null:M.invalid)&&((M=n.editServiceForm.get("marchand"))==null?null:M.touched)),l(4),c("routerLink",E(7,Ye)),l(4),c("disabled",n.editServiceForm.invalid)}},dependencies:[g,T,D,q,j,R,V,N,L,se,de]});let e=t;return e})();var He=(()=>{let t=class t{};t.\u0275fac=function(o){return new(o||t)},t.\u0275cmp=_({type:t,selectors:[["bgui-delete-service"]],standalone:!0,features:[S],decls:2,vars:0,template:function(o,n){o&1&&(i(0,"p"),a(1,"delete-service works!"),r())}});let e=t;return e})();function Ze(e,t){e&1&&(i(0,"mat-header-cell",31),a(1,"ID"),r())}function et(e,t){if(e&1&&(i(0,"mat-cell"),a(1),r()),e&2){let h=t.$implicit;l(),w(h.service_id)}}function tt(e,t){e&1&&(i(0,"mat-header-cell",31),a(1,"Nom"),r())}function it(e,t){if(e&1&&(i(0,"mat-cell"),a(1),r()),e&2){let h=t.$implicit;l(),w(h.nom_service)}}function rt(e,t){e&1&&(i(0,"mat-header-cell",31),a(1,"Description"),r())}function nt(e,t){if(e&1&&(i(0,"mat-cell"),a(1),r()),e&2){let h=t.$implicit;l(),w(h.description)}}function ot(e,t){e&1&&(i(0,"mat-header-cell",31),a(1,"Marchand"),r())}function at(e,t){if(e&1&&(i(0,"mat-cell"),a(1),r()),e&2){let h=t.$implicit;l(),w(h.marchand)}}function lt(e,t){e&1&&(i(0,"mat-header-cell",31),a(1,"Actions"),r())}var mt=e=>["/assistances/edit-service",e],ct=()=>["/assistances/view-service"];function st(e,t){if(e&1){let h=J();i(0,"mat-cell",32)(1,"a",33)(2,"mat-icon",34),a(3,"edit"),r()(),i(4,"a",35),f("click",function(){let n=P(h).$implicit,s=K();return $(s.onDelete(n.service_id))}),i(5,"mat-icon",36),a(6,"delete_sweep"),r()()()}if(e&2){let h=t.$implicit;l(),c("routerLink",Z(2,mt,h.service_id)),l(3),c("routerLink",E(4,ct))}}function dt(e,t){e&1&&d(0,"mat-header-row")}function pt(e,t){e&1&&d(0,"mat-row")}var ut=()=>["/assistances/create-service"],vt=()=>[5,10,20],Pe=(()=>{let t=class t{onSearch(){throw new Error("Method not implemented.")}constructor(m,o,n,s){this.service=m,this.router=o,this.snackBar=n,this.dialog=s,this.services=[],this.displayedColumns=["nom_service","description","actions"],this.showForm=!1,this.hidden=!1,this.dataReadonly=!0,this.dataSource=new Te}ngOnInit(){this.service.getServices().subscribe(m=>{this.services=m.results,console.log("services=>",this.services),this.dataSource.data=this.services})}ngAfterViewInit(){this.dataSource.paginator=this.paginator,this.dataSource.paginator.pageIndex=this.paginator.pageSize}applyFilter(m){let o=m.target.value;this.dataSource.filter=o.trim().toLowerCase()}updateService(){this.showForm=!0,this.hidden=!1,this.dataReadonly=!1}viewService(){this.showForm=!0,this.hidden=!0,this.dataReadonly}onDelete(m){this.service.deleteService(m).subscribe(()=>{console.log(`Service avec l'ID ${m} supprim\xE9.`),this.ngOnInit(),this.snackBar.open("Service supprim\xE9 avec succ\xE8s","Fermer",{duration:3e3})},o=>{console.error("Erreur lors de la suppression du service :",o),this.snackBar.open("Erreur lors de la suppression du service","Fermer",{duration:3e3})})}};t.\u0275fac=function(o){return new(o||t)(v(C),v(F),v(O),v(Le))},t.\u0275cmp=_({type:t,selectors:[["bgui-view-service"]],viewQuery:function(o,n){if(o&1&&U(H,5),o&2){let s;W(s=X())&&(n.paginator=s.first)}},standalone:!0,features:[S],decls:44,vars:9,consts:[[1,"content","sm-gutter"],[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,"mb-3"],[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"],[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",3,"keyup"],["input",""],[1,"mat-elevation-z8",3,"dataSource"],["matColumnDef","service_id"],["class","text",4,"matHeaderCellDef"],[4,"matCellDef"],["matColumnDef","nom_service"],["matColumnDef","description"],["matColumnDef","marchand"],["matColumnDef","actions"],["style","text-align: right",4,"matCellDef"],[4,"matHeaderRowDef"],[4,"matRowDef","matRowDefColumns"],[3,"pageSize","pageSizeOptions","showFirstLastButtons"],["paginator",""],[1,"text"],[2,"text-align","right"],["href","#",1,"m-2",3,"routerLink"],["title","Modifier",2,"color","green"],["href","#",1,"m-2",3,"routerLink","click"],["title","Supprimer",2,"color","red"]],template:function(o,n){o&1&&(i(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"div",4)(5,"div",5)(6,"div",6)(7,"div",7)(8,"div",8)(9,"h4",9),a(10,"Liste des services"),r(),i(11,"div",10)(12,"div",11)(13,"button",12),a(14," Exporter "),d(15,"i",13),r()(),i(16,"a",14),a(17," Nouveau "),r()(),i(18,"div",15)(19,"mat-form-field")(20,"mat-label"),a(21,"Filter"),r(),i(22,"input",16,17),f("keyup",function(p){return n.applyFilter(p)}),r()(),i(24,"mat-table",18),x(25,19),u(26,Ze,2,0,"mat-header-cell",20)(27,et,2,1,"mat-cell",21),y(),x(28,22),u(29,tt,2,0,"mat-header-cell",20)(30,it,2,1,"mat-cell",21),y(),x(31,23),u(32,rt,2,0,"mat-header-cell",20)(33,nt,2,1,"mat-cell",21),y(),x(34,24),u(35,ot,2,0,"mat-header-cell",20)(36,at,2,1,"mat-cell",21),y(),x(37,25),u(38,lt,2,0,"mat-header-cell",20)(39,st,7,5,"mat-cell",26),y(),u(40,dt,1,0,"mat-header-row",27)(41,pt,1,0,"mat-row",28),r(),d(42,"mat-paginator",29,30),r()()()()()()()()()()),o&2&&(l(16),c("routerLink",E(7,ut)),l(8),c("dataSource",n.dataSource),l(16),c("matHeaderRowDef",n.displayedColumns),l(),c("matRowDefColumns",n.displayedColumns),l(),c("pageSize",5)("pageSizeOptions",E(8,vt))("showFirstLastButtons",!0))},dependencies:[D,g,H,ke,Ce,Me,Ee,we,be,Fe,xe,ye,De,Ie,he,fe,ve,Se,_e,A,q,le,ae,oe,ue,ge,B,Ne,Be],styles:[".text[_ngcontent-%COMP%]{color:#00f;font-weight:700;font-size:16px}.Ftext[_ngcontent-%COMP%]{font-size:16px}"]});let e=t;return e})();function ft(e,t){e&1&&(i(0,"div",35),G(),i(1,"svg",36),d(2,"use",37),r(),Q(),i(3,"strong"),a(4," Service cr\xE9\xE9 avec succ\xE8s."),r()())}function ht(e,t){e&1&&(i(0,"div",38),a(1," Nom Service est obligatoire "),r())}function _t(e,t){e&1&&(i(0,"div",38),a(1," Description est obligatoire "),r())}function St(e,t){e&1&&(i(0,"div",38),a(1," Marchand est obligatoire "),r())}var $e=(()=>{let t=class t{constructor(m,o){this.services=m,this.router=o,this.service={service_id:0,nom_service:"",description:"",marchand:"1"},this.showAlert=!1}onSubmit(m){this.services.createService(m).subscribe({next:o=>{console.log("Service cr\xE9\xE9 avec succ\xE8s:",o)},error:o=>{console.error("Erreur lors de la cr\xE9ation du service:",o)}}),this.service.nom_service&&this.service.description&&this.service.marchand&&(console.log(this.service),this.showAlert=!0,setTimeout(()=>{this.service={service_id:1,nom_service:"",description:"",marchand:"1"}},1e3),setTimeout(()=>this.showAlert=!1,3e3))}onCancel(){this.router.navigate(["/assistances/view-service"])}};t.\u0275fac=function(o){return new(o||t)(v(C),v(F))},t.\u0275cmp=_({type:t,selectors:[["bgui-create-service"]],standalone:!0,features:[S],decls:47,vars:8,consts:[[1,"content","sm-gutter"],[1,"page-title","mb-20"],[2,"margin-bottom","25px"],[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"],["method","post",3,"ngSubmit"],["serviceForm","ngForm"],[1,"row","justify-content-center"],[1,"col-md-6","mb-2"],["for","nom_service"],["type","text","id","nom_service","placeholder","Nom Service","name","nom_service","required","",1,"form-control",3,"ngModel","ngModelChange"],["nomService","ngModel"],["class","text-danger",4,"ngIf"],["for","description"],["type","text","id","description","placeholder","Description","name","description","required","",1,"form-control",3,"ngModel","ngModelChange"],["description","ngModel"],["hidden","true",1,"col-md-6","mb-2"],["for","marchand"],["type","text","id","marchand","placeholder","Marchand","name","marchand","required","",1,"form-control",3,"ngModel","ngModelChange"],["marchand","ngModel"],[1,"col-md-12"],[1,"d-flex","justify-content-between","mt-3"],["type","button","routerLink","/assistances/view-service",1,"btn","btn-sm","btn-secondary","m-5",2,"border-radius","15px"],[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,"click"],[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(o,n){if(o&1&&(i(0,"div",0)(1,"div",1)(2,"h4",2),a(3,"Ajouter un service"),r()(),i(4,"div",3),u(5,ft,5,0,"div",4),i(6,"div",5)(7,"div",6)(8,"div",7)(9,"div",8)(10,"div",9)(11,"div",10)(12,"div",11)(13,"form",12,13),f("ngSubmit",function(){return n.onSubmit(n.service)}),i(15,"div",14)(16,"div",15)(17,"label",16),a(18,"Nom Service"),r(),i(19,"input",17,18),f("ngModelChange",function(p){return n.service.nom_service=p}),r(),u(21,ht,2,0,"div",19),r(),i(22,"div",15)(23,"label",20),a(24,"Description"),r(),i(25,"input",21,22),f("ngModelChange",function(p){return n.service.description=p}),r(),u(27,_t,2,0,"div",19),r(),i(28,"div",23)(29,"label",24),a(30,"Marchand"),r(),i(31,"input",25,26),f("ngModelChange",function(p){return n.service.marchand=p}),r(),u(33,St,2,0,"div",19),r(),i(34,"div",27)(35,"div",28)(36,"button",29),a(37," Retour "),d(38,"i",30),r(),i(39,"div")(40,"div")(41,"button",31),a(42," Enregistrer "),d(43,"i",32),r(),i(44,"button",33),f("click",function(){return n.onCancel()}),a(45," Annuler "),d(46,"i",34),r()()()()()()()()()()()()()()()()),o&2){let s=I(14),p=I(20),b=I(26),M=I(32);l(5),c("ngIf",n.showAlert),l(14),c("ngModel",n.service.nom_service),l(2),c("ngIf",p.invalid&&p.touched),l(4),c("ngModel",n.service.description),l(2),c("ngIf",b.invalid&&b.touched),l(4),c("ngModel",n.service.marchand),l(2),c("ngIf",M.invalid&&M.touched),l(8),c("disabled",s.invalid)}},dependencies:[D,B,j,R,V,N,L,ce,me,g,T],styles:[".title[_ngcontent-%COMP%]{font-size:75px}.custom-alert[_ngcontent-%COMP%]{position:fixed;top:7%;right:5rem;width:20%;z-index:1050;display:flex;align-items:center;justify-content:center}"]});let e=t;return e})();var Ge=(()=>{let t=class t{constructor(){this.date=new Date,this.service=[],this.displayedColumns=["service_id","nom_service","description","marchand"]}};t.\u0275fac=function(o){return new(o||t)},t.\u0275cmp=_({type:t,selectors:[["bgui-assistances"]],standalone:!0,features:[Y([C]),S],decls:12,vars:4,consts:[[1,"card-body","mb-4",2,"background-color","#3f51b5","height","70px"],[1,"row"],[1,"col-md-2"],[1,"d-flex","justify-content-between","align-items-center",2,"color","white"],[1,"m-4",2,"color","white"],[2,"font-weight","bold"],[1,"w-100"]],template:function(o,n){o&1&&(i(0,"div",0)(1,"div",1),d(2,"div",2),i(3,"div",3)(4,"h5",4),a(5,"Services"),r(),i(6,"span",5),a(7),ee(8,"date"),r()()()(),i(9,"mat-card",6)(10,"mat-card-content"),d(11,"router-outlet"),r()()),o&2&&(l(7),w(te(8,1,n.date,"dd/MM/yyyy HH:mm:ss")))},dependencies:[ne,g,ie,je,A,Re,Ve]});let e=t;return e})();var Ci=[{path:"",component:Ge,children:[{path:"",redirectTo:"view-service",pathMatch:"full"},{path:"view-service",component:Pe},{path:"create-service",component:$e},{path:"edit-service/:service_id",component:ze},{path:"delete-service/:service_id",component:He}]}];export{Ci as userRoutes};