import{a as g}from"./chunk-67W3PZCG.js";import{a as A}from"./chunk-I4KBB6KC.js";import{a as re,b as ne}from"./chunk-VFUN7IXN.js";import{A as Ee,B as Fe,o as B,p as fe,q as he,r as _e,s as Se,t as ge,u as Ce,v as be,w as we,x as xe,y as ye,z as Me}from"./chunk-IBM7YVRT.js";import"./chunk-GLZZNBFH.js";import"./chunk-IIYQPZAL.js";import{a as De,c as Ie,e as ke}from"./chunk-GKVOUPXH.js";import{b as ue,c as ve}from"./chunk-SX3TFIJX.js";import{h as te,i as ie,j as T,k as F}from"./chunk-KC6GENB3.js";import{Aa as ae,Ba as j,Da as le,Ea as ce,Ia as L,Ka as me,La as q,Ma as se,Na as de,Sa as pe,qa as V,sa as I,va as R,wa as N,ya as oe}from"./chunk-BHGY27BE.js";import{k,m as ee,o as E}from"./chunk-ZEDFMZ3B.js";import{$a as f,$b as X,Ab as y,Cb as G,Jb as v,Lb as Q,Rb as J,Sb as K,Tb as U,Ub as D,Vb as a,Wb as w,Yb as W,Zb as S,_a as l,_b as M,ac as Y,bc as Z,ha as _,lb as u,ma as z,na as H,nb as m,oa as P,pa as $,wb as i,xb as r,yb as d,zb as x}from"./chunk-PEWEDMBK.js";function ze(e,t){e&1&&(i(0,"div",27),a(1," ID Service est obligatoire "),r())}function He(e,t){e&1&&(i(0,"div",27),a(1," Nom Service est obligatoire "),r())}function Pe(e,t){e&1&&(i(0,"div",27),a(1," Description est obligatoire "),r())}function $e(e,t){e&1&&(i(0,"div",27),a(1," marchand est obligatoire "),r())}var Ge=()=>["/assistances/view-service"],Re=(()=>{let t=class t{constructor(c,n,o,s,p){this.fb=c,this.router=n,this.route=o,this.service=s,this.snackBar=p}ngOnInit(){this.editServiceForm=this.fb.group({service_id:["",I.required],nom_service:["",I.required],description:["",I.required],marchand:["",I.required]}),this.route.paramMap.subscribe(c=>{let n=c.get("service_id");console.log("id",n),n?this.service.getServiceById(Number(n)).subscribe(o=>{this.editServiceForm.patchValue({service_id:o.service_id,nom_service:o.nom_service,description:o.description,marchand:o.marchand})},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.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})},c=>{console.error("Erreur lors de la mise \xE0 jour du service :",c),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(n){return new(n||t)(f(me),f(T),f(te),f(g),f(A))},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(n,o){if(n&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),v("ngSubmit",function(){return o.onSubmit()}),i(12,"div",1),d(13,"input",11),u(14,ze,2,0,"div",12),i(15,"div",13)(16,"label",14),a(17,"Nom Service"),r(),d(18,"input",15),u(19,He,2,0,"div",12),r(),i(20,"div",13)(21,"label",16),a(22,"Description"),r(),d(23,"input",17),u(24,Pe,2,0,"div",12),r(),d(25,"input",18),u(26,$e,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),v("click",function(){return o.onSubmit()}),a(35," Modifier "),d(36,"i",24),r(),i(37,"button",25),v("click",function(){return o.onCancel()}),a(38," Annuler "),d(39,"i",26),r()()()()()()()()()()()()()()()),n&2){let s,p,C,b;l(11),m("formGroup",o.editServiceForm),l(3),m("ngIf",((s=o.editServiceForm.get("service_id"))==null?null:s.invalid)&&((s=o.editServiceForm.get("service_id"))==null?null:s.touched)),l(5),m("ngIf",((p=o.editServiceForm.get("nom_service"))==null?null:p.invalid)&&((p=o.editServiceForm.get("nom_service"))==null?null:p.touched)),l(5),m("ngIf",((C=o.editServiceForm.get("description"))==null?null:C.invalid)&&((C=o.editServiceForm.get("description"))==null?null:C.touched)),l(2),m("ngIf",((b=o.editServiceForm.get("marchand"))==null?null:b.invalid)&&((b=o.editServiceForm.get("marchand"))==null?null:b.touched)),l(4),m("routerLink",M(7,Ge)),l(4),m("disabled",o.editServiceForm.invalid)}},dependencies:[E,k,F,se,j,V,R,N,L,le,ce]});let e=t;return e})();var Ne=(()=>{let t=class t{};t.\u0275fac=function(n){return new(n||t)},t.\u0275cmp=_({type:t,selectors:[["bgui-delete-service"]],standalone:!0,features:[S],decls:2,vars:0,template:function(n,o){n&1&&(i(0,"p"),a(1,"delete-service works!"),r())}});let e=t;return e})();function Qe(e,t){e&1&&(i(0,"mat-header-cell",31),a(1,"ID"),r())}function Je(e,t){if(e&1&&(i(0,"mat-cell"),a(1),r()),e&2){let h=t.$implicit;l(),w(h.service_id)}}function Ke(e,t){e&1&&(i(0,"mat-header-cell",31),a(1,"Nom"),r())}function Ue(e,t){if(e&1&&(i(0,"mat-cell"),a(1),r()),e&2){let h=t.$implicit;l(),w(h.nom_service)}}function We(e,t){e&1&&(i(0,"mat-header-cell",31),a(1,"Description"),r())}function Xe(e,t){if(e&1&&(i(0,"mat-cell"),a(1),r()),e&2){let h=t.$implicit;l(),w(h.description)}}function Ye(e,t){e&1&&(i(0,"mat-header-cell",31),a(1,"Marchand"),r())}function Ze(e,t){if(e&1&&(i(0,"mat-cell"),a(1),r()),e&2){let h=t.$implicit;l(),w(h.marchand)}}function et(e,t){e&1&&(i(0,"mat-header-cell",31),a(1,"Actions"),r())}var tt=e=>["/assistances/edit-service",e],it=()=>["/assistances/view-service"];function rt(e,t){if(e&1){let h=G();i(0,"mat-cell",32)(1,"a",33)(2,"mat-icon",34),a(3,"edit"),r()(),i(4,"a",35),v("click",function(){let o=z(h).$implicit,s=Q();return H(s.onDelete(o.service_id))}),i(5,"mat-icon",36),a(6,"delete_sweep"),r()()()}if(e&2){let h=t.$implicit;l(),m("routerLink",X(2,tt,h.service_id)),l(3),m("routerLink",M(4,it))}}function nt(e,t){e&1&&d(0,"mat-header-row")}function ot(e,t){e&1&&d(0,"mat-row")}var at=()=>["/assistances/create-service"],lt=()=>[5,10,20],je=(()=>{let t=class t{onSearch(){throw new Error("Method not implemented.")}constructor(c,n){this.service=c,this.snackBar=n,this.services=[],this.displayedColumns=["nom_service","description","actions"],this.showForm=!1,this.hidden=!1,this.dataReadonly=!0,this.dataSource=new Fe}ngOnInit(){this.service.getServices().subscribe(c=>{this.services=c.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(c){let n=c.target.value;this.dataSource.filter=n.trim().toLowerCase()}updateService(){this.showForm=!0,this.hidden=!1,this.dataReadonly=!1}viewService(){this.showForm=!0,this.hidden=!0,this.dataReadonly}onDelete(c){this.service.deleteService(c).subscribe(()=>{console.log(`Service avec l'ID ${c} supprim\xE9.`),this.ngOnInit(),this.snackBar.open("Service supprim\xE9 avec succ\xE8s","Fermer",{duration:3e3})},n=>{console.error("Erreur lors de la suppression du service :",n),this.snackBar.open("Erreur lors de la suppression du service","Fermer",{duration:3e3})})}};t.\u0275fac=function(n){return new(n||t)(f(g),f(A))},t.\u0275cmp=_({type:t,selectors:[["bgui-view-service"]],viewQuery:function(n,o){if(n&1&&J(B,5),n&2){let s;K(s=U())&&(o.paginator=s.first)}},standalone:!0,features:[S],decls:43,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-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"],["appearance","outline"],["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(n,o){n&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,"h4",8),a(9,"Liste des services"),r(),i(10,"div",9)(11,"div",10)(12,"button",11),a(13," Exporter "),d(14,"i",12),r()(),i(15,"a",13),a(16," Nouveau "),r()(),i(17,"div",14)(18,"mat-form-field",15)(19,"mat-label"),a(20,"Filter"),r(),i(21,"input",16,17),v("keyup",function(p){return o.applyFilter(p)}),r()(),i(23,"mat-table",18),x(24,19),u(25,Qe,2,0,"mat-header-cell",20)(26,Je,2,1,"mat-cell",21),y(),x(27,22),u(28,Ke,2,0,"mat-header-cell",20)(29,Ue,2,1,"mat-cell",21),y(),x(30,23),u(31,We,2,0,"mat-header-cell",20)(32,Xe,2,1,"mat-cell",21),y(),x(33,24),u(34,Ye,2,0,"mat-header-cell",20)(35,Ze,2,1,"mat-cell",21),y(),x(36,25),u(37,et,2,0,"mat-header-cell",20)(38,rt,7,5,"mat-cell",26),y(),u(39,nt,1,0,"mat-header-row",27)(40,ot,1,0,"mat-row",28),r(),d(41,"mat-paginator",29,30),r()()()()()()()()()),n&2&&(l(15),m("routerLink",M(7,at)),l(8),m("dataSource",o.dataSource),l(16),m("matHeaderRowDef",o.displayedColumns),l(),m("matRowDefColumns",o.displayedColumns),l(),m("pageSize",5)("pageSizeOptions",M(8,lt))("showFirstLastButtons",!0))},dependencies:[F,q,Ee,he,Se,we,ge,_e,xe,Ce,be,ye,Me,ve,ue,pe,de,ne,re,fe,B],styles:[".text[_ngcontent-%COMP%]{color:#00f;font-weight:700;font-size:16px}.Ftext[_ngcontent-%COMP%]{font-size:16px}.card[_ngcontent-%COMP%]{border-radius:0!important;background-color:#ffffff61}"]});let e=t;return e})();function ct(e,t){e&1&&(i(0,"div",35),P(),i(1,"svg",36),d(2,"use",37),r(),$(),i(3,"strong"),a(4," Service cr\xE9\xE9 avec succ\xE8s."),r()())}function mt(e,t){e&1&&(i(0,"div",38),a(1," Nom Service est obligatoire "),r())}function st(e,t){e&1&&(i(0,"div",38),a(1," Description est obligatoire "),r())}function dt(e,t){e&1&&(i(0,"div",38),a(1," Marchand est obligatoire "),r())}var Le=(()=>{let t=class t{constructor(c,n){this.services=c,this.router=n,this.service={service_id:0,nom_service:"",description:"",marchand:"1"},this.showAlert=!1}onSubmit(c){this.services.createService(c).subscribe({next:n=>{console.log("Service cr\xE9\xE9 avec succ\xE8s:",n)},error:n=>{console.error("Erreur lors de la cr\xE9ation du service:",n)}}),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(n){return new(n||t)(f(g),f(T))},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(n,o){if(n&1&&(i(0,"div",0)(1,"div",1)(2,"h4",2),a(3,"Ajouter un service"),r()(),i(4,"div",3),u(5,ct,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),v("ngSubmit",function(){return o.onSubmit(o.service)}),i(15,"div",14)(16,"div",15)(17,"label",16),a(18,"Nom Service"),r(),i(19,"input",17,18),v("ngModelChange",function(p){return o.service.nom_service=p}),r(),u(21,mt,2,0,"div",19),r(),i(22,"div",15)(23,"label",20),a(24,"Description"),r(),i(25,"input",21,22),v("ngModelChange",function(p){return o.service.description=p}),r(),u(27,st,2,0,"div",19),r(),i(28,"div",23)(29,"label",24),a(30,"Marchand"),r(),i(31,"input",25,26),v("ngModelChange",function(p){return o.service.marchand=p}),r(),u(33,dt,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),v("click",function(){return o.onCancel()}),a(45," Annuler "),d(46,"i",34),r()()()()()()()()()()()()()()()()),n&2){let s=D(14),p=D(20),C=D(26),b=D(32);l(5),m("ngIf",o.showAlert),l(14),m("ngModel",o.service.nom_service),l(2),m("ngIf",p.invalid&&p.touched),l(4),m("ngModel",o.service.description),l(2),m("ngIf",C.invalid&&C.touched),l(4),m("ngModel",o.service.marchand),l(2),m("ngIf",b.invalid&&b.touched),l(8),m("disabled",s.invalid)}},dependencies:[F,q,j,V,R,N,L,ae,oe,E,k],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 qe=(()=>{let t=class t{constructor(){this.date=new Date,this.service=[],this.displayedColumns=["service_id","nom_service","description","marchand"]}};t.\u0275fac=function(n){return new(n||t)},t.\u0275cmp=_({type:t,selectors:[["bgui-assistances"]],standalone:!0,features:[W([g]),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(n,o){n&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),Y(8,"date"),r()()()(),i(9,"mat-card",6)(10,"mat-card-content"),d(11,"router-outlet"),r()()),n&2&&(l(7),w(Z(8,1,o.date,"dd/MM/yyyy HH:mm:ss")))},dependencies:[ie,E,ee,ke,De,Ie]});let e=t;return e})();var Qt=[{path:"",component:qe,children:[{path:"",redirectTo:"view-service",pathMatch:"full"},{path:"view-service",component:je},{path:"create-service",component:Le},{path:"edit-service/:service_id",component:Re},{path:"delete-service/:service_id",component:Ne}]}];export{Qt as userRoutes};