1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
"use strict";(self.webpackChunkroad_report=self.webpackChunkroad_report||[]).push([[323],{7323:(X,g,i)=>{i.r(g),i.d(g,{PerbaikanModule:()=>R});var m=i(177),s=i(6803),l=i(9417),b=i(2665),t=i(8699),_=i(7110),k=i(2423),y=i(6747);function D(o,c){if(1&o){const e=t.RV6();t.j41(0,"ngb-datepicker",15,16),t.bIt("dateSelect",function(a){t.eBV(e);const r=t.XpG();return t.Njj(r.onDateSelection(a))}),t.k0s()}if(2&o){const e=t.XpG(),n=t.sdS(14);t.Y8G("minDate",e.todayDate)("displayMonths",2)("dayTemplate",n)("weekdays",!1)}}function F(o,c){if(1&o){const e=t.RV6();t.j41(0,"span",17),t.bIt("mouseenter",function(){const r=t.eBV(e).$implicit,d=t.XpG();return t.Njj(d.hoveredDate=r)})("mouseleave",function(){t.eBV(e);const a=t.XpG();return t.Njj(a.hoveredDate=null)}),t.EFF(1),t.k0s()}if(2&o){const e=c.$implicit,n=c.focused,a=t.XpG();t.AVh("focused",n)("range",a.isRange(e))("faded",a.isHovered(e)||a.isInside(e)),t.R7$(1),t.SpI(" ",e.day," ")}}let C=(()=>{class o extends b.v{constructor(e,n,a,r,d,p,u){super(r,d,p,u),this.activeModal=n,this.formBuilder=a,this.helpers=r,this.loading=d,this.api=p,this.modal=u,this.form={},this.toDate=null,this.hoveredDate=null,this.showDatePicker=!1,this.id="";const f=new Date;this.todayDate={year:f.getFullYear(),month:f.getMonth()+1,day:f.getDate()},this.fromDate=e.getToday(),this.toDate=e.getNext(e.getToday())}getFormattedDateRange(){const e=new Date(this.data.date_start),n=this.data.date_end?new Date(this.data.date_end):null,a=`${e.getDate()}/${e.getMonth()+1}/${e.getFullYear()}`;return n?`${a} - ${n.getDate()}/${n.getMonth()+1}/${n.getFullYear()}`:a}toggleDatePicker(){this.showDatePicker=!this.showDatePicker}ngOnInit(){this.initForm()}initForm(){this.form=this.formBuilder.group({report_id:[this.id],date_start:[this.fromDate,l.k0.required],date_end:[this.toDate]}),this.data&&this.form.patchValue(this.data)}onDateSelection(e){this.fromDate||this.toDate?this.fromDate&&!this.toDate&&e.after(this.fromDate)?this.toDate=e:(this.toDate=null,this.fromDate=e):this.fromDate=e}isHovered(e){return this.fromDate&&!this.toDate&&this.hoveredDate&&e.after(this.fromDate)&&e.before(this.hoveredDate)}isInside(e){return this.toDate&&e.after(this.fromDate)&&e.before(this.toDate)}isRange(e){return e.equals(this.fromDate)||this.toDate&&e.equals(this.toDate)||this.isInside(e)||this.isHovered(e)}formatDate(e){return`${e.year}-${e.month<10?"0"+e.month:e.month}-${e.day<10?"0"+e.day:e.day}`}formatAndPatchValues(){const e=this.formatDate(this.fromDate),n=this.toDate?this.formatDate(this.toDate):null;this.form.patchValue({date_start:e,date_end:n})}onSubmit(){this.formatAndPatchValues(),this.form.valid&&this.api.update(this.data.id,this.form.value).subscribe({next:()=>{this.helpers.toast("success","Data berhasil ditambahkan"),setTimeout(()=>{window.location.reload()},1e3),this.activeModal.close(this.form.value)},error:()=>{this.helpers.toast("error","Data gagal ditambahkan")}})}static{this.\u0275fac=function(n){return new(n||o)(t.rXU(s.iF),t.rXU(s.Lw),t.rXU(l.ok),t.rXU(_.V),t.rXU(k.U),t.rXU(y.r),t.rXU(s.Bq))}}static{this.\u0275cmp=t.VBU({type:o,selectors:[["app-jadwal"]],standalone:!0,features:[t.Vt3,t.aNF],decls:20,vars:4,consts:[[1,"modal-header"],[1,"modal-title"],["type","button","aria-label","Close",1,"btn-close",3,"click"],[1,"modal-body"],[3,"formGroup"],["for","jadwal",1,"mb-2","fw-bold"],[1,"input-group",3,"click"],["id","jadwal","placeholder","dd/mm/yyyy","type","text",1,"form-control",3,"readonly","value"],[1,"input-group-text",2,"cursor","pointer"],[1,"bi","bi-calendar4"],["outsideDays","hidden",3,"minDate","displayMonths","dayTemplate","weekdays","dateSelect",4,"ngIf"],["t",""],[1,"modal-footer"],["type","button",1,"btn","btn-outline-primary",3,"click"],["type","button",1,"btn","btn-primary",3,"click"],["outsideDays","hidden",3,"minDate","displayMonths","dayTemplate","weekdays","dateSelect"],["dp",""],[1,"custom-day",3,"mouseenter","mouseleave"]],template:function(n,a){1&n&&(t.j41(0,"div",0)(1,"h4",1),t.EFF(2,"Ubah Jadwal Perbaikan"),t.k0s(),t.j41(3,"button",2),t.bIt("click",function(){return a.activeModal.close("Cancel")}),t.k0s()(),t.j41(4,"div",3)(5,"form",4)(6,"label",5),t.EFF(7,"Tanggal"),t.k0s(),t.j41(8,"div",6),t.bIt("click",function(){return a.toggleDatePicker()}),t.nrm(9,"input",7),t.j41(10,"span",8),t.nrm(11,"i",9),t.k0s()(),t.DNE(12,D,2,4,"ngb-datepicker",10),t.DNE(13,F,2,7,"ng-template",null,11,t.C5r),t.k0s(),t.j41(15,"div",12)(16,"button",13),t.bIt("click",function(){return a.activeModal.close("Cancel")}),t.EFF(17," Batal "),t.k0s(),t.j41(18,"button",14),t.bIt("click",function(){return a.onSubmit()}),t.EFF(19," Simpan "),t.k0s()()()),2&n&&(t.R7$(5),t.Y8G("formGroup",a.form),t.R7$(4),t.Y8G("readonly",!0)("value",a.getFormattedDateRange()),t.R7$(3),t.Y8G("ngIf",a.showDatePicker))},dependencies:[m.MD,m.bT,l.X1,l.qT,l.cb,l.j4,s.IQ,s.yB,l.YN,s.oi],styles:[".ngb-dp-header[_ngcontent-%COMP%]{display:none}.custom-day[_ngcontent-%COMP%]{text-align:center;padding:.185rem .25rem;display:inline-block;height:2rem;width:2rem}.custom-day.focused[_ngcontent-%COMP%]{background-color:#e6e6e6}.custom-day.range[_ngcontent-%COMP%], .custom-day[_ngcontent-%COMP%]:hover{background-color:#0275d8;color:#fff}.custom-day.faded[_ngcontent-%COMP%]{background-color:#d87f0280}"]})}}return o})();var h=i(8185),v=i(5471);function j(o,c){if(1&o&&t.nrm(0,"input",13),2&o){const e=t.XpG(2);t.Y8G("formControl",e.searchForm)("readonly",0===e.dataSourceLength&&e.queries.filter&&!e.queries.search)}}function T(o,c){if(1&o&&(t.j41(0,"div",10),t.nrm(1,"i",11),t.DNE(2,j,1,2,"input",12),t.k0s()),2&o){const e=t.XpG();t.R7$(2),t.Y8G("ngIf",e.dataSourceTotal>0)}}function P(o,c){1&o&&(t.j41(0,"p",14),t.nrm(1,"i",15),t.EFF(2," Belum ada data. "),t.k0s())}function $(o,c){1&o&&(t.j41(0,"p",14),t.nrm(1,"i",16),t.EFF(2," Tidak ada hasil pencarian "),t.k0s())}function I(o,c){if(1&o){const e=t.RV6();t.j41(0,"button",29),t.bIt("click",function(){t.eBV(e);const a=t.XpG().$implicit,r=t.XpG(2);return t.Njj(r.onDeleteData(a.id,a.report.user.fullname))}),t.EFF(1," Hapus "),t.k0s()}}function S(o,c){if(1&o){const e=t.RV6();t.j41(0,"tr")(1,"td"),t.EFF(2),t.nI1(3,"date"),t.nI1(4,"date"),t.k0s(),t.j41(5,"td"),t.EFF(6),t.k0s(),t.j41(7,"td"),t.EFF(8),t.k0s(),t.j41(9,"td"),t.EFF(10),t.k0s(),t.j41(11,"td")(12,"div",25)(13,"button",26),t.bIt("click",function(){const r=t.eBV(e).$implicit,d=t.XpG(2);return t.Njj(d.goToMap(r.id))}),t.EFF(14," Peta "),t.k0s(),t.j41(15,"button",27),t.bIt("click",function(){const r=t.eBV(e).$implicit,d=t.XpG(2);return t.Njj(d.onUpdateSchedule(r,r.id))}),t.EFF(16," Ubah "),t.k0s(),t.DNE(17,I,2,0,"button",28),t.k0s()()()}if(2&o){const e=c.$implicit,n=t.XpG(2);t.R7$(2),t.Lme(" ",t.i5U(3,7,e.date_start,"dd/MM/yyyy"),"",e.date_end?"-"+t.i5U(4,10,e.date_end,"dd/MM/yyyy"):""," "),t.R7$(4),t.JRh(e.report.no_ticket),t.R7$(2),t.SpI(" ",e.report.segmens.length>0?e.report.segmens[e.report.segmens.length-1].segmen.name:"-"," "),t.R7$(2),t.JRh(e.report.user.fullname),t.R7$(5),t.Y8G("disabled","DONE"===e.report.status_id||"RJT"===e.report.status_id||"FIXED"===e.report.status_id),t.R7$(2),t.Y8G("ngIf",n.isPNGL())}}function E(o,c){if(1&o&&(t.j41(0,"option",30),t.EFF(1),t.k0s()),2&o){const e=c.$implicit,n=t.XpG(2);t.Y8G("value",e)("selected",e===n.queryLimit),t.R7$(1),t.SpI(" ",e," ")}}function x(o,c){if(1&o){const e=t.RV6();t.qex(0,14),t.j41(1,"div",17)(2,"table",18)(3,"thead")(4,"tr")(5,"th"),t.EFF(6,"Tanggal Perbaikan"),t.k0s(),t.j41(7,"th"),t.EFF(8,"No Tiket"),t.k0s(),t.j41(9,"th"),t.EFF(10,"Lokasi"),t.k0s(),t.j41(11,"th"),t.EFF(12,"Nama Pelapor"),t.k0s(),t.j41(13,"th"),t.EFF(14,"Aksi"),t.k0s()()(),t.j41(15,"tbody"),t.DNE(16,S,18,13,"tr",19),t.k0s()()(),t.j41(17,"div",20)(18,"div",21)(19,"span"),t.EFF(20,"Item per halalaman"),t.k0s(),t.j41(21,"select",22),t.bIt("change",function(a){t.eBV(e);const r=t.XpG();return t.Njj(r.onPageSizeChange(a))}),t.DNE(22,E,2,3,"option",23),t.k0s(),t.j41(23,"span"),t.EFF(24),t.k0s()(),t.j41(25,"ngb-pagination",24),t.bIt("pageChange",function(a){t.eBV(e);const r=t.XpG();return t.Njj(r.queryPage=a)})("pageChange",function(a){t.eBV(e);const r=t.XpG();return t.Njj(r.onPaginateChange(a))}),t.k0s()(),t.bVm()}if(2&o){const e=t.XpG();t.R7$(16),t.Y8G("ngForOf",e.dataSource),t.R7$(6),t.Y8G("ngForOf",e.pageSizeOptions),t.R7$(2),t.SpI("dari ",e.dataSourceLength,""),t.R7$(1),t.Y8G("collectionSize",e.dataSourceLength)("page",e.queryPage)("maxSize",5)("pageSize",e.queryLimit)("rotate",!0)("ellipses",!1)("boundaryLinks",!1)("directionLinks",!0)}}const G=[{path:"",component:(()=>{class o extends b.v{constructor(e,n,a,r,d,p,u){super(d,u,p,r),this.router=e,this.auth=n,this.activatedRoute=a,this.modal=r,this.helpers=d,this.api=p,this.loading=u,this.id="",this.sortBy="",this.searchFields="report.no_ticket,report.user.fullname,report.segmens.segmen.name",this.queries={page:1,sort:"-created_at",limit:10,embed:"report.user,report.status_report,report.segmens.segmen"}}applyFilter(e){this.sortBy=e,this.queries.sort="terbaru"===e?"-created_at":"terlama"===e?"created_at":"-created_at","PNGL"==this.auth.getLoggedUser().role.code?this.api.getAll(this.queries).subscribe({next:({data:n})=>{this.loading.hide(),this.dataSource=n},error:()=>{this.loading.hide(),this.helpers.toast("error","Gagal mengambil data")}}):this.getAll()}goToMap(e){this.router.navigate(["detail",e],{relativeTo:this.activatedRoute})}onUpdateSchedule(e,n){if("RJT"==n||"DONE"==n||"FIXED"==n)return alert("Jadwal tidak bisa diubah lagi");const a=this.modal.open(C);a.componentInstance.action="update",a.componentInstance.id=n,a.componentInstance.data=e}getFormattedDateRange(){if(this.fromDate){const e=`${this.fromDate.day}/${this.fromDate.month}/${this.fromDate.year}`;return this.toDate?`${e} - ${this.toDate.day}/${this.toDate.month}/${this.toDate.year}`:e}return""}isPNGL(){const e=this.auth.getLoggedUser();return!!e&&"SADM"===e.role.code}static{this.\u0275fac=function(n){return new(n||o)(t.rXU(h.Ix),t.rXU(v.u),t.rXU(h.nX),t.rXU(s.Bq),t.rXU(_.V),t.rXU(y.r),t.rXU(k.U))}}static{this.\u0275cmp=t.VBU({type:o,selectors:[["app-perbaikan"]],features:[t.Vt3],decls:17,vars:5,consts:[[1,"mb-4","fw-bold"],[1,"rounded-3","p-4","bg-white"],[1,"d-flex","align-items-center","justify-content-between","gap-3","flex-wrap","mb-3",3,"ngClass"],["class","form-group has-search d-flex align-items-center",4,"ngIf"],["ngbDropdown",""],["id","filterDropdown","ngbDropdownToggle","",1,"btn","btn-outline-primary","no-caret"],[1,"bi","bi-funnel","me-2"],["ngbDropdownMenu","","aria-labelledby","filterDropdown"],["ngbDropdownItem","",3,"click"],["class","text-body-tertiary",4,"ngIf"],[1,"form-group","has-search","d-flex","align-items-center"],[1,"position-absolute","bi","bi-search","form-control-feedback","mx-auto","ms-3",2,"color","black"],["style","background: #f2f2f2; height: 48px; padding-left: 3rem","class","form-control border-0 form-control","type","text","placeholder","Cari data...",3,"formControl","readonly",4,"ngIf"],["type","text","placeholder","Cari data...",1,"form-control","border-0","form-control",2,"background","#f2f2f2","height","48px","padding-left","3rem",3,"formControl","readonly"],[1,"text-body-tertiary"],[1,"bi","bi-exclamation-circle"],[1,"bi","bi-search"],[1,"table-responsive"],[1,"table"],[4,"ngFor","ngForOf"],[1,"d-flex","align-items-center","justify-content-between","gap-3","flex-wrap"],[1,"w-auto","d-flex","align-items-center","gap-2"],[1,"form-select","w-auto",3,"change"],[3,"value","selected",4,"ngFor","ngForOf"],[1,"mb-n3",3,"collectionSize","page","maxSize","pageSize","rotate","ellipses","boundaryLinks","directionLinks","pageChange"],[1,"d-flex"],["type","button",1,"btn","btn-outline-primary","me-2",3,"click"],["type","button",1,"btn","btn-outline-primary","me-2",3,"disabled","click"],["class","btn btn-outline-primary","type","button",3,"click",4,"ngIf"],["type","button",1,"btn","btn-outline-primary",3,"click"],[3,"value","selected"]],template:function(n,a){1&n&&(t.j41(0,"h4",0),t.EFF(1,"Jadwal Perbaikan"),t.k0s(),t.j41(2,"div",1)(3,"div",2),t.DNE(4,T,3,1,"div",3),t.j41(5,"div",4)(6,"button",5),t.nrm(7,"i",6),t.EFF(8,"Urutkan "),t.k0s(),t.j41(9,"div",7)(10,"button",8),t.bIt("click",function(){return a.applyFilter("terbaru")}),t.EFF(11," Terbaru "),t.k0s(),t.j41(12,"button",8),t.bIt("click",function(){return a.applyFilter("terlama")}),t.EFF(13," Terlama "),t.k0s()()()(),t.DNE(14,P,3,0,"p",9),t.DNE(15,$,3,0,"p",9),t.DNE(16,x,26,11,"ng-container",9),t.k0s()),2&n&&(t.R7$(3),t.Y8G("ngClass",a.dataSourceTotal>0?"justify-content-between":"justify-content-end"),t.R7$(1),t.Y8G("ngIf",a.dataSourceTotal>0),t.R7$(10),t.Y8G("ngIf",0==a.dataSourceTotal),t.R7$(1),t.Y8G("ngIf",a.dataSourceTotal>0&&0===a.dataSourceLength&&a.queries.search),t.R7$(1),t.Y8G("ngIf",a.dataSourceTotal>0&&a.dataSourceLength>0))},dependencies:[m.YU,m.Sq,m.bT,l.xH,l.y7,l.me,l.BC,l.l_,s.s5,s.tg,s.do,s.U0,s._H,m.vh],styles:[".form-control[_ngcontent-%COMP%]::placeholder{color:#bdbdbd}"]})}}return o})()},{path:"detail/:id",loadChildren:()=>Promise.all([i.e(257),i.e(685),i.e(76),i.e(727)]).then(i.bind(i,6727)).then(o=>o.DetailModule)}];let R=(()=>{class o{static{this.\u0275fac=function(n){return new(n||o)}}static{this.\u0275mod=t.$C({type:o})}static{this.\u0275inj=t.G2t({imports:[m.MD,h.iI.forChild(G),l.X1,s.c9,s.zH]})}}return o})()}}]); |