1 line
9.9 KiB
JavaScript
1 line
9.9 KiB
JavaScript
"use strict";(self.webpackChunkroad_report=self.webpackChunkroad_report||[]).push([[773],{7773:(M,m,s)=>{s.r(m),s.d(m,{GudangModule:()=>U});var c=s(177),i=s(9417),k=s(9519),t=s(8699),d=s(6803),p=s(7110);function F(e,l){1&e&&(t.j41(0,"div",15),t.EFF(1," Harus diisi "),t.k0s())}function v(e,l){1&e&&(t.j41(0,"div",15),t.EFF(1," Awalan dan akhiran tidak boleh ada spasi "),t.k0s())}function _(e,l){1&e&&(t.j41(0,"div",15),t.EFF(1," Harus diisi "),t.k0s())}function C(e,l){1&e&&(t.j41(0,"div",15),t.EFF(1," Jumlah tidak valid "),t.k0s())}const f=function(e){return{"is-invalid":e}};let h=(()=>{class e{constructor(n,o,a){this.activeModal=n,this.formBuilder=o,this.helpers=a,this.action="create",this.data={},this.form={}}ngOnInit(){this.initForm()}initForm(){this.form=this.formBuilder.group({name:[null,[i.k0.required,k.M.noWhiteSpace]],qty:[null,[i.k0.required,i.k0.pattern(/^[0-9]+(\.[0-9]{1,2})?$/)]],unit:["Kg",[i.k0.required]]}),"update"===this.action&&this.data&&this.form.patchValue(this.data)}onSubmit(){this.form.valid&&this.activeModal.close(this.form.value)}static{this.\u0275fac=function(o){return new(o||e)(t.rXU(d.Lw),t.rXU(i.ok),t.rXU(p.V))}}static{this.\u0275cmp=t.VBU({type:e,selectors:[["app-action"]],inputs:{action:"action",data:"data"},standalone:!0,features:[t.aNF],decls:33,vars:16,consts:[[1,"modal-header"],[1,"modal-title"],["type","button","aria-label","Close",1,"btn-close",3,"click"],[1,"modal-body"],[3,"formGroup"],[1,"mb-3"],[1,"form-label"],["type","text","formControlName","name",1,"form-control",3,"ngClass"],["class","invalid-feedback",4,"ngIf"],["type","text","formControlName","qty",1,"form-control",3,"ngClass"],["formControlName","unit",1,"form-select"],[3,"value"],[1,"modal-footer"],["type","button",1,"btn","btn-outline-primary",3,"click"],["type","button",1,"btn","btn-primary",3,"disabled","click"],[1,"invalid-feedback"]],template:function(o,a){1&o&&(t.j41(0,"div",0)(1,"h4",1),t.EFF(2),t.k0s(),t.j41(3,"button",2),t.bIt("click",function(){return a.activeModal.dismiss("Cross click")}),t.k0s()(),t.j41(4,"div",3)(5,"form",4)(6,"div",5)(7,"label",6),t.EFF(8,"Nama Material"),t.k0s(),t.nrm(9,"input",7),t.DNE(10,F,2,0,"div",8),t.DNE(11,v,2,0,"div",8),t.k0s(),t.j41(12,"div",5)(13,"label",6),t.EFF(14,"Jumlah"),t.k0s(),t.nrm(15,"input",9),t.DNE(16,_,2,0,"div",8),t.DNE(17,C,2,0,"div",8),t.k0s(),t.j41(18,"div",5)(19,"label",6),t.EFF(20,"Satuan"),t.k0s(),t.j41(21,"select",10)(22,"option",11),t.EFF(23,"Sak"),t.k0s(),t.j41(24,"option",11),t.EFF(25,"Pcs"),t.k0s(),t.j41(26,"option",11),t.EFF(27,"Kg"),t.k0s()()()()(),t.j41(28,"div",12)(29,"button",13),t.bIt("click",function(){return a.activeModal.close("Cancel")}),t.EFF(30," Batal "),t.k0s(),t.j41(31,"button",14),t.bIt("click",function(){return a.onSubmit()}),t.EFF(32," Simpan "),t.k0s()()),2&o&&(t.R7$(2),t.SpI(" ","create"===a.action?"Tambah":"Edit"," Material "),t.R7$(3),t.Y8G("formGroup",a.form),t.R7$(4),t.Y8G("ngClass",t.eq3(12,f,a.helpers.isInvalid(a.form,"name"))),t.R7$(1),t.Y8G("ngIf",a.helpers.hasError(a.form,"name","required")),t.R7$(1),t.Y8G("ngIf",a.helpers.hasError(a.form,"name","noWhiteSpace")),t.R7$(4),t.Y8G("ngClass",t.eq3(14,f,a.helpers.isInvalid(a.form,"qty"))),t.R7$(1),t.Y8G("ngIf",a.helpers.hasError(a.form,"qty","required")),t.R7$(1),t.Y8G("ngIf",a.helpers.hasError(a.form,"qty","pattern")),t.R7$(5),t.Y8G("value","Sak"),t.R7$(2),t.Y8G("value","Pcs"),t.R7$(2),t.Y8G("value","Kg"),t.R7$(5),t.Y8G("disabled",a.form.invalid))},dependencies:[c.MD,c.YU,c.bT,i.X1,i.qT,i.xH,i.y7,i.me,i.wz,i.BC,i.cb,i.j4,i.JD]})}}return e})();var y=s(2665),g=s(1413),b=s(6977),G=s(2423),j=s(1991),E=s(1626);let S=(()=>{class e extends j.G{constructor(n,o){super(n,o),this.http=n,this.helpers=o,this.endpoint="inventory-list"}static{this.\u0275fac=function(o){return new(o||e)(t.KVO(E.Qq),t.KVO(p.V))}}static{this.\u0275prov=t.jDH({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})();function I(e,l){1&e&&t.nrm(0,"i",9)}function $(e,l){if(1&e&&t.nrm(0,"input",10),2&e){const n=t.XpG();t.Y8G("formControl",n.searchForm)("readonly",0===n.dataSourceLength&&n.queries.filter&&!n.queries.search)}}function T(e,l){if(1&e){const n=t.RV6();t.j41(0,"button",11),t.bIt("click",function(){t.eBV(n);const a=t.XpG();return t.Njj(a.onCreate())}),t.EFF(1," Tambah Material "),t.k0s()}}function R(e,l){1&e&&(t.j41(0,"p",12),t.nrm(1,"i",13),t.EFF(2," Belum ada data. "),t.k0s())}function x(e,l){1&e&&(t.j41(0,"p",12),t.nrm(1,"i",14),t.EFF(2," Tidak ada hasil pencarian "),t.k0s())}function Y(e,l){if(1&e){const n=t.RV6();t.j41(0,"tr")(1,"td"),t.EFF(2),t.k0s(),t.j41(3,"td"),t.EFF(4),t.k0s(),t.j41(5,"td"),t.EFF(6),t.k0s(),t.j41(7,"td")(8,"div",23)(9,"button",24),t.bIt("click",function(){const r=t.eBV(n).$implicit,u=t.XpG(2);return t.Njj(u.onUpdate(r))}),t.EFF(10," Edit "),t.k0s(),t.j41(11,"button",25),t.bIt("click",function(){const r=t.eBV(n).$implicit,u=t.XpG(2);return t.Njj(u.onDeleteData(r.id,r.name))}),t.EFF(12," Hapus "),t.k0s()()()()}if(2&e){const n=l.$implicit;t.R7$(2),t.JRh(n.name),t.R7$(2),t.JRh(n.qty),t.R7$(2),t.JRh(n.unit)}}function D(e,l){if(1&e&&(t.j41(0,"option",26),t.EFF(1),t.k0s()),2&e){const n=l.$implicit,o=t.XpG(2);t.Y8G("value",n)("selected",n===o.queryLimit),t.R7$(1),t.SpI(" ",n," ")}}function N(e,l){if(1&e){const n=t.RV6();t.qex(0),t.j41(1,"div",15)(2,"table",16)(3,"thead")(4,"tr")(5,"th"),t.EFF(6,"Material"),t.k0s(),t.j41(7,"th"),t.EFF(8,"Jumlah"),t.k0s(),t.j41(9,"th"),t.EFF(10,"Satuan"),t.k0s(),t.nrm(11,"th"),t.k0s()(),t.j41(12,"tbody"),t.DNE(13,Y,13,3,"tr",17),t.k0s()()(),t.j41(14,"div",18)(15,"div",19)(16,"span"),t.EFF(17,"Item per halalaman"),t.k0s(),t.j41(18,"select",20),t.bIt("change",function(a){t.eBV(n);const r=t.XpG();return t.Njj(r.onPageSizeChange(a))}),t.DNE(19,D,2,3,"option",21),t.k0s(),t.j41(20,"span"),t.EFF(21),t.k0s()(),t.j41(22,"ngb-pagination",22),t.bIt("pageChange",function(a){t.eBV(n);const r=t.XpG();return t.Njj(r.queryPage=a)})("pageChange",function(a){t.eBV(n);const r=t.XpG();return t.Njj(r.onPaginateChange(a))}),t.k0s()(),t.bVm()}if(2&e){const n=t.XpG();t.R7$(13),t.Y8G("ngForOf",n.dataSource),t.R7$(6),t.Y8G("ngForOf",n.pageSizeOptions),t.R7$(2),t.SpI("dari ",n.dataSourceLength,""),t.R7$(1),t.Y8G("collectionSize",n.dataSourceLength)("page",n.queryPage)("maxSize",5)("pageSize",n.queryLimit)("rotate",!0)("ellipses",!1)("boundaryLinks",!1)("directionLinks",!0)}}let V=(()=>{class e extends y.v{constructor(n,o,a,r){super(n,o,a,r),this.helpers=n,this.loading=o,this.api=a,this.modal=r,this.dataInsertSubs$=new g.B,this.dataUpdateSubs$=new g.B,this.searchFields="name"}onCreate(){const n=this.modal.open(h);n.componentInstance.action="create",n.result.then(o=>{o&&this.api.insert(o).pipe((0,b.Q)(this.dataInsertSubs$)).subscribe({next:()=>{this.helpers.toast("success","Data berhasil ditambahkan"),this.getAll()},error:()=>{this.helpers.toast("error","Data gagal ditambahkan")}})},()=>{})}onUpdate(n){const o=this.modal.open(h);o.componentInstance.action="update",o.componentInstance.data=n,o.result.then(a=>{a&&this.api.update(n.id,a).pipe((0,b.Q)(this.dataUpdateSubs$)).subscribe({next:()=>{this.helpers.toast("success","Data berhasil diubah"),this.getAll()},error:()=>{this.helpers.toast("error","Data gagal diubah")}})},()=>{})}static{this.\u0275fac=function(o){return new(o||e)(t.rXU(p.V),t.rXU(G.U),t.rXU(S),t.rXU(d.Bq))}}static{this.\u0275cmp=t.VBU({type:e,selectors:[["app-gudang"]],features:[t.Vt3],decls:11,vars:7,consts:[[1,"mb-4","fw-bold"],[1,"rounded-3","p-4","bg-white"],[1,"d-flex","align-items-center","gap-3","flex-wrap","mb-3",3,"ngClass"],[1,"form-group","d-flex","align-items-center"],["class","position-absolute bi bi-search mx-auto ms-3","style","color: black",4,"ngIf"],["style","\n background: #f2f2f2;\n width: 254px;\n height: 48px;\n padding-left: 3rem;\n ","class","form-control border-0 form-control","type","text","placeholder","Cari data...",3,"formControl","readonly",4,"ngIf"],["class","btn btn-primary","type","button",3,"click",4,"ngIf"],["class","text-body-tertiary",4,"ngIf"],[4,"ngIf"],[1,"position-absolute","bi","bi-search","mx-auto","ms-3",2,"color","black"],["type","text","placeholder","Cari data...",1,"form-control","border-0","form-control",2,"background","#f2f2f2","width","254px","height","48px","padding-left","3rem",3,"formControl","readonly"],["type","button",1,"btn","btn-primary",3,"click"],[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",3,"click"],[3,"value","selected"]],template:function(o,a){1&o&&(t.j41(0,"h4",0),t.EFF(1,"Data Gudang"),t.k0s(),t.j41(2,"div",1)(3,"div",2)(4,"div",3),t.DNE(5,I,1,0,"i",4),t.DNE(6,$,1,2,"input",5),t.k0s(),t.DNE(7,T,2,0,"button",6),t.k0s(),t.DNE(8,R,3,0,"p",7),t.DNE(9,x,3,0,"p",7),t.DNE(10,N,23,11,"ng-container",8),t.k0s()),2&o&&(t.R7$(3),t.Y8G("ngClass",a.dataSourceTotal>0?"justify-content-between":"justify-content-end"),t.R7$(2),t.Y8G("ngIf",a.dataSourceTotal>0),t.R7$(1),t.Y8G("ngIf",a.dataSourceTotal>0),t.R7$(1),t.Y8G("ngIf",a.dataSourceTotal>0),t.R7$(1),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:[c.YU,c.Sq,c.bT,i.xH,i.y7,i.me,i.BC,i.l_,d.s5],styles:[".form-control[_ngcontent-%COMP%]::placeholder{color:#bdbdbd}"]})}}return e})();var X=s(8185);const B=[{path:"",component:V}];let U=(()=>{class e{static{this.\u0275fac=function(o){return new(o||e)}}static{this.\u0275mod=t.$C({type:e})}static{this.\u0275inj=t.G2t({imports:[c.MD,X.iI.forChild(B),i.X1,d.c9]})}}return e})()}}]); |