@rero/rero-ils-ui
Version:
User interface for RERO integrated library system (RERO ILS).
1 lines • 82.5 kB
JavaScript
"use strict";(self.webpackChunkadmin=self.webpackChunkadmin||[]).push([[733],{9733:(Te,x,r)=>{r.r(x),r.d(x,{AcquisitionModule:()=>Ie});var C=r(177),l=r(9417),M=r(8524),g=r(3955),s=r(2203),R=r(8580),h=r(9966),V=r(3816),U=r(52),N=r(1728),z=r(7229),_=r(6864),E=r(1626),t=r(4438),T=r(2953),L=r(8264),A=r(5973),S=r(5794);let k=(()=>{class n{transform(e){return e.allocated_amount-e.distribution}static#t=this.\u0275fac=function(i){return new(i||n)};static#e=this.\u0275pipe=t.EJ8({name:"accountAvailableAmount",type:n,pure:!0})}return n})();const P=()=>[h.Hc,U.Wk,s.UH,C.oe,g.D9,s.HK,k],w=n=>[n],O=(n,o)=>({"text-danger":n,"text-muted":o}),W=(n,o)=>({"text-muted":n,"text-warning":o}),G=(n,o,e)=>({"text-success":n,"text-muted":o,"text-warning":e}),Y=n=>["/records","acq_accounts","edit",n];function J(n,o){if(1&n&&t.EFF(0),2&n){const e=t.XpG(2);t.SpI(" [",e.account.number,"] ")}}function X(n,o){if(1&n&&(t.qex(0),t.j41(1,"div",5),t.EFF(2),t.nI1(3,"currency"),t.k0s(),t.bVm()),2&n){const e=o.ngVar,i=t.XpG(2);t.R7$(),t.HbH(t.sMw(6,G,e>0,0===e,e<0)),t.R7$(),t.SpI(" ",t.i5U(3,3,e,i.organisation.default_currency)," ")}}function H(n,o){if(1&n&&(t.j41(0,"button",8),t.nrm(1,"i",10),t.k0s()),2&n){const e=t.XpG(2);t.Y8G("routerLink",t.eq3(1,Y,e.account.pid))}}function K(n,o){if(1&n){const e=t.RV6();t.j41(0,"button",11),t.bIt("click",function(){t.eBV(e);const c=t.XpG(2);return t.Njj(c.delete())}),t.nrm(1,"i",12),t.k0s()}}function $(n,o){if(1&n&&(t.nrm(0,"div",14),t.nI1(1,"nl2br")),2&n){const e=t.XpG(3);t.Y8G("innerHtml",t.bMT(1,1,e.deleteInfoMessage),t.npT)}}function q(n,o){if(1&n&&(t.j41(0,"button",13),t.nI1(1,"translate"),t.nrm(2,"i",12),t.k0s(),t.DNE(3,$,2,3,"ng-template",null,0,t.C5r)),2&n){const e=t.sdS(4);t.FS9("title",t.bMT(1,2,"Delete")),t.Y8G("popover",e)}}function tt(n,o){if(1&n&&(t.j41(0,"div",2)(1,"div")(2,"a",3),t.EFF(3),t.k0s()(),t.j41(4,"div",4),t.DNE(5,J,1,1),t.k0s(),t.j41(6,"div",5),t.EFF(7),t.nI1(8,"currency"),t.k0s(),t.DNE(9,X,4,10,"ng-container",6),t.nI1(10,"accountAvailableAmount"),t.j41(11,"div",5),t.EFF(12),t.nI1(13,"currency"),t.k0s(),t.j41(14,"div",5),t.EFF(15),t.nI1(16,"currency"),t.k0s(),t.j41(17,"div",5),t.EFF(18),t.nI1(19,"currency"),t.k0s(),t.j41(20,"div",7),t.DNE(21,H,2,3,"button",8)(22,K,2,0,"button",9)(23,q,5,4),t.k0s()()),2&n){const e=t.XpG();t.R7$(),t.ZvI("col-5 account-name depth-padding-",e.account.depth,""),t.R7$(),t.Y8G("routerLink",t.eq3(33,w,e.detailUrl)),t.R7$(),t.JRh(e.account.name),t.R7$(2),t.vxM(5,e.account.number?5:-1),t.R7$(2),t.SpI(" ",t.i5U(8,19,e.account.allocated_amount,e.organisation.default_currency)," "),t.R7$(2),t.Y8G("ngVar",t.bMT(10,22,e.account)),t.R7$(2),t.HbH(t.l_i(35,O,e.account.encumbrance_amount.self>0,e.account.encumbrance_amount.self<=0)),t.R7$(),t.SpI(" ",t.i5U(13,24,e.account.encumbrance_amount.self,e.organisation.default_currency)," "),t.R7$(2),t.HbH(t.l_i(38,O,e.account.expenditure_amount.self>0,e.account.expenditure_amount.self<=0)),t.R7$(),t.SpI(" ",t.i5U(16,27,e.account.expenditure_amount.self,e.organisation.default_currency)," "),t.R7$(2),t.HbH(t.l_i(41,W,0===e.account.remaining_balance.self,e.account.remaining_balance.self<0)),t.R7$(),t.SpI(" ",t.i5U(19,30,e.account.remaining_balance.self,e.organisation.default_currency)," "),t.R7$(3),t.vxM(21,e.permissions.update.can?21:-1),t.R7$(),t.vxM(22,e.permissions.delete.can?22:23)}}function et(n,o){1&n&&t.nrm(0,"i",15)}function nt(n,o){if(1&n){const e=t.RV6();t.j41(0,"admin-account-brief-view",16),t.bIt("deleteAccount",function(c){t.eBV(e);const a=t.XpG();return t.Njj(a.accountDeleted(c))}),t.k0s()}if(2&n){const e=o.$implicit,i=t.XpG();t.Y8G("account",e)("loadChildren",i.loadChildren)}}let it=(()=>{class n{get organisation(){return this.organisationService.organisation}get detailUrl(){return`/records/acq_accounts/detail/${this.account.pid}`}get deleteInfoMessage(){return this.recordPermissionService.generateDeleteMessage(this.permissions.delete.reasons)}constructor(e,i,c,a,u,p){this.recordPermissionService=e,this.organisationService=i,this.accountApiService=c,this.toastrService=a,this.translateService=u,this.userService=p,this.account=null,this.loadChildren=!1,this.deleteAccount=new t.bkB,this.children=[]}ngOnInit(){this.account&&(this.recordPermissionService.getPermission("acq_accounts",this.account.pid).subscribe(e=>this.permissions=e),this.loadChildren)&&this.accountApiService.getAccounts(this.userService.user.currentLibrary,this.account.pid).subscribe(i=>this.children=i)}delete(){this.accountApiService.delete(this.account.pid).subscribe(()=>{this.toastrService.success(this.translateService.instant("Account deleted")),this.deleteAccount.emit(this.account)})}accountDeleted(e){this.children=this.children.filter(i=>i.pid!==e.pid)}static#t=this.\u0275fac=function(i){return new(i||n)(t.rXU(A.O),t.rXU(L.y),t.rXU(T.i),t.rXU(S.tw),t.rXU(g.c$),t.rXU(N.DL))};static#e=this.\u0275cmp=t.VBU({type:n,selectors:[["admin-account-brief-view"]],inputs:{account:"account",loadChildren:"loadChildren"},outputs:{deleteAccount:"deleteAccount"},decls:6,vars:1,consts:[["tolTemplate",""],[3,"account","loadChildren"],[1,"row","account"],[3,"routerLink"],[1,"col-1","account-number"],[1,"col-1","amount"],[4,"ngVar"],[1,"col-1","pr-0","text-right"],["type","button",1,"btn","btn-outline-primary","btn-sm",3,"routerLink"],["type","button",1,"btn","btn-outline-danger","btn-sm","ml-1"],[1,"fa","fa-pencil"],["type","button",1,"btn","btn-outline-danger","btn-sm","ml-1",3,"click"],[1,"fa","fa-trash"],["type","button","triggers","mouseenter:mouseleave",1,"btn","btn-sm","btn-outline-danger","disabled","ml-1",3,"title","popover"],[3,"innerHtml"],[1,"fa","fa-spinner"],[3,"deleteAccount","account","loadChildren"]],template:function(i,c){1&i&&(t.DNE(0,tt,24,44)(1,et,1,0),t.nv$(2,0,P,null,1),t.Z7z(4,nt,1,2,"admin-account-brief-view",1,t.fX1)),2&i&&(t.R7$(2),t.LVR(c.account&&c.permissions),t.R7$(2),t.Dyx(c.children))},dependencies:[n],styles:['.account[_ngcontent-%COMP%]{margin-bottom:.25rem}.account[_ngcontent-%COMP%]:hover{background-color:#f8f8f8}.account[_ngcontent-%COMP%] .account-name[_ngcontent-%COMP%]{font-weight:700}.account[_ngcontent-%COMP%] .account-number[_ngcontent-%COMP%]{text-transform:uppercase;font-size:.9rem}.account[_ngcontent-%COMP%] .amount[_ngcontent-%COMP%]{text-align:right}.account[_ngcontent-%COMP%] .depth-padding-1[_ngcontent-%COMP%]{padding-left:50px}.account[_ngcontent-%COMP%] .depth-padding-2[_ngcontent-%COMP%]{padding-left:100px}.account[_ngcontent-%COMP%] .depth-padding-3[_ngcontent-%COMP%]{padding-left:150px}.account[_ngcontent-%COMP%] .depth-padding-4[_ngcontent-%COMP%]{padding-left:200px}.account[_ngcontent-%COMP%] .depth-padding-5[_ngcontent-%COMP%]{padding-left:250px}.account[_ngcontent-%COMP%] .depth-padding-6[_ngcontent-%COMP%]{padding-left:300px}.account[_ngcontent-%COMP%] .depth-padding-7[_ngcontent-%COMP%]{padding-left:350px}.account[_ngcontent-%COMP%] .depth-padding-8[_ngcontent-%COMP%]{padding-left:400px}.account[_ngcontent-%COMP%] .depth-padding-9[_ngcontent-%COMP%]{padding-left:450px}.receipt[_ngcontent-%COMP%] .account-number[_ngcontent-%COMP%]{font-size:.875em;color:#6c757d;font-weight:700}.receipt[_ngcontent-%COMP%] .account-number[_ngcontent-%COMP%]:before{content:"["}.receipt[_ngcontent-%COMP%] .account-number[_ngcontent-%COMP%]:after{content:"]"}.no-gutter[_ngcontent-%COMP%]{margin-right:-15px;margin-left:-15px}.bullet-notes[_ngcontent-%COMP%]{margin-left:.5rem}.bullet-notes[_ngcontent-%COMP%] .fa-bullet[_ngcontent-%COMP%]{font-size:.75rem;margin-left:.25rem}.bullet-notes[_ngcontent-%COMP%] .fa-bullet.bullet-primary[_ngcontent-%COMP%]{color:#007bff}.bullet-notes[_ngcontent-%COMP%] .fa-bullet.bullet-success[_ngcontent-%COMP%]{color:#28a745}.bullet-notes[_ngcontent-%COMP%] .fa-bullet.bullet-danger[_ngcontent-%COMP%]{color:#dc3545}.bullet-notes[_ngcontent-%COMP%] .fa-bullet.bullet-warning[_ngcontent-%COMP%]{color:#ffc107}.bullet-notes[_ngcontent-%COMP%] .fa-bullet.bullet-info[_ngcontent-%COMP%]{color:#17a2b8}.bullet-notes[_ngcontent-%COMP%] .fa-bullet.bullet-dark[_ngcontent-%COMP%]{color:#1b4464}.priority[_ngcontent-%COMP%]{background-repeat:no-repeat;background-position:center center;height:16px;width:16px}.priority.priority-1[_ngcontent-%COMP%]{background-image:url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjIiIGJhc2VQcm9maWxlPSJ0aW55LXBzIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNCIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE0Ij4KCTx0aXRsZT5Ob3V2ZWF1IHByb2pldDwvdGl0bGU+Cgk8ZGVmcz4KCQk8aW1hZ2UgIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNCIgaWQ9ImltZzEiIGhyZWY9ImRhdGE6aW1hZ2UvcG5nO2J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cuMTMgMTIuMTQgNi41MSAxMi4wMlE1Ljg5IDExLjkgNS4yOCAxMS42Nkw1LjI4IDEwLjE3UTUuODkgMTAuNTEgNi40MyAxMC42OVE2Ljk4IDEwLjg2IDcuNDYgMTAuODZROC4xNSAxMC44NiA4LjU1IDEwLjUyUTguOTUgMTAuMTggOC45NSA5LjYxUTguOTUgOS4wMyA4LjU1IDguN1E4LjE1IDguMzYgNy40NiA4LjM2UTcuMDUgOC4zNiA2LjU4IDguNDdRNi4xMSA4LjU4IDUuNTggOC44WiIgLz4KPC9zdmc+)}.rollovered[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]:not(.fiscal-year-closed){opacity:.5}']})}return n})();const ct=()=>["/","records","acq_accounts","new"],ot=n=>({budget:n}),at=()=>["/","acquisition","accounts","transfer"];function rt(n,o){if(1&n){const e=t.RV6();t.j41(0,"admin-account-brief-view",13),t.bIt("deleteAccount",function(c){t.eBV(e);const a=t.XpG(3);return t.Njj(a.accountDeleted(c))}),t.k0s()}2&n&&t.Y8G("account",o.$implicit)("loadChildren",!0)}function lt(n,o){if(1&n&&t.Z7z(0,rt,1,2,"admin-account-brief-view",12,t.fX1),2&n){const e=t.XpG(2);t.Dyx(e.rootAccounts)}}function st(n,o){1&n&&(t.EFF(0),t.nI1(1,"translate")),2&n&&t.SpI(" ",t.bMT(1,1,"No account available")," ")}function dt(n,o){if(1&n&&(t.j41(0,"header",0)(1,"h1",1),t.EFF(2,"Acquisition accounts"),t.k0s(),t.j41(3,"div",2)(4,"a",3),t.nrm(5,"i",4),t.EFF(6),t.nI1(7,"translate"),t.k0s(),t.nrm(8,"ng-core-export-button",5),t.j41(9,"a",6),t.nrm(10,"i",7),t.EFF(11),t.nI1(12,"translate"),t.k0s()()(),t.j41(13,"section",8)(14,"div",9),t.nrm(15,"div",10),t.j41(16,"div",11),t.EFF(17,"Amount"),t.k0s(),t.j41(18,"div",11),t.EFF(19,"Available"),t.k0s(),t.j41(20,"div",11),t.EFF(21,"Engagement"),t.k0s(),t.j41(22,"div",11),t.EFF(23,"Expenditure"),t.k0s(),t.j41(24,"div",11),t.EFF(25,"Balance"),t.k0s()(),t.DNE(26,lt,2,0)(27,st,2,3),t.k0s()),2&n){const e=t.XpG();t.R7$(4),t.Y8G("routerLink",t.lJ4(14,ct))("queryParams",t.eq3(15,ot,e.organisation.current_budget_pid))("permissions",e.permissions.ACAC_CREATE),t.R7$(2),t.SpI(" ",t.bMT(7,10,"Add")," "),t.R7$(2),t.Y8G("exportOptions",e.exportOptions)("cssClass","btn btn-sm btn-outline-primary mr-2 ml-2"),t.R7$(),t.Y8G("routerLink",t.lJ4(17,at))("permissions",e.permissions.ACAC_TRANSFER),t.R7$(2),t.SpI(" ",t.bMT(12,12,"Transfer funds")," \u2026 "),t.R7$(15),t.vxM(26,e.rootAccounts.length>0?26:27)}}let ut=(()=>{class n{get organisation(){return this.organisationService.organisation}get exportInfoMessage(){return 0===this.rootAccounts.length?this.translateService.instant("Result list is empty."):this.translateService.instant("Too many items. Should be less than {{max}}.",{max:s.nO.MAX_REST_RESULTS_SIZE})}constructor(e,i,c,a,u){this.userService=e,this.acqAccountApiService=i,this.organisationService=c,this.apiService=a,this.translateService=u,this.rootAccounts=[],this.permissions=N.Jj}ngOnInit(){this._libraryPid=this.userService.user.currentLibrary,this.acqAccountApiService.getAccounts(this._libraryPid,null).subscribe(e=>{this.rootAccounts=e,this.exportOptions=this._exportFormats()})}accountDeleted(e){this.rootAccounts=this.rootAccounts.filter(i=>i.pid!==e.pid)}_exportFormats(){return _.F.map(e=>({label:e.label,url:this.getExportFormatUrl(e),disabled:!this.canExport(e),disabled_message:this.exportInfoMessage}))}getExportFormatUrl(e){const c=["is_active:true",`library.pid:${this._libraryPid}`].join(" AND "),a=e.endpoint||this.apiService.getExportEndpointByType("acq_accounts"),u=(new E.Nl).set("q",c).set("format",e.format);return e.disableMaxRestResultsSize||u.append("size",String(s.nO.MAX_REST_RESULTS_SIZE)),`${a}?${u.toString()}`}canExport(e){const i=this.rootAccounts.length;return e.hasOwnProperty("disableMaxRestResultsSize")&&e.disableMaxRestResultsSize?i>0:i>0&&i<s.nO.MAX_REST_RESULTS_SIZE}static#t=this.\u0275fac=function(i){return new(i||n)(t.rXU(N.DL),t.rXU(T.i),t.rXU(L.y),t.rXU(s.Gf),t.rXU(g.c$))};static#e=this.\u0275cmp=t.VBU({type:n,selectors:[["admin-account-list"]],decls:1,vars:1,consts:[[1,"d-flex","align-items-baseline"],["translate",""],[1,"ml-auto"],[1,"btn","btn-sm","btn-primary",3,"routerLink","queryParams","permissions"],[1,"fa","fa-plus"],[3,"exportOptions","cssClass"],[1,"btn","btn-sm","btn-outline-primary",3,"routerLink","permissions"],[1,"fa","fa-exchange"],[1,"mt-3"],[1,"row","p-1","mb-2","bg-dark","rounded","text-light"],[1,"col-6"],["translate","",1,"col-1","text-right"],[3,"account","loadChildren"],[3,"deleteAccount","account","loadChildren"]],template:function(i,c){1&i&&t.DNE(0,dt,28,18),2&i&&t.vxM(0,c.organisation?0:-1)},dependencies:[U.Wk,g.Mm,s.gI,N.U7,it,g.D9],encapsulation:2})}return n})();var v=r(6066);const gt=n=>({"is-invalid":n}),pt=(n,o,e)=>({"text-success":n,"text-muted":o,"text-warning":e});function mt(n,o){if(1&n&&(t.j41(0,"option",21),t.EFF(1),t.nI1(2,"getRecord"),t.nI1(3,"async"),t.k0s()),2&n){const e=o.$implicit;t.Y8G("value",e),t.R7$(),t.SpI(" ",t.bMT(3,7,t.ii3(2,2,e,"budgets","field","name"))," ")}}function Nt(n,o){if(1&n){const e=t.RV6();t.j41(0,"select",20),t.bIt("change",function(c){t.eBV(e);const a=t.XpG(2);return t.Njj(a.selectBudget(c))}),t.Z7z(1,mt,4,9,"option",21,t.fX1),t.k0s()}if(2&n){const e=t.XpG(2);t.R7$(),t.Dyx(e.budgets)}}function Mt(n,o){if(1&n){const e=t.RV6();t.j41(0,"div",22)(1,"div",23)(2,"input",24),t.bIt("click",function(){const c=t.eBV(e).$implicit,a=t.XpG(3);return t.Njj(a.selectAccount("source",c))}),t.k0s()(),t.j41(3,"div")(4,"a",25),t.EFF(5),t.k0s()(),t.j41(6,"div",26),t.EFF(7),t.nI1(8,"currency"),t.k0s(),t.j41(9,"div",26),t.EFF(10),t.nI1(11,"currency"),t.k0s(),t.j41(12,"div",23)(13,"input",27),t.bIt("click",function(){const c=t.eBV(e).$implicit,a=t.XpG(3);return t.Njj(a.selectAccount("target",c))}),t.k0s()()()}if(2&n){const e=o.$implicit,i=t.XpG(3);t.R7$(2),t.FS9("value",e.pid),t.Y8G("disabled",i.form.get("target").value&&i.form.get("target").value.pid===e.pid),t.R7$(),t.ZvI("col-6 account-name depth-padding-",e.depth,""),t.R7$(),t.Y8G("routerLink",i.getDetailUrl(e)),t.R7$(),t.JRh(e.name),t.R7$(2),t.SpI(" ",t.i5U(8,13,e.allocated_amount,i.organisation.default_currency)," "),t.R7$(2),t.HbH(t.sMw(19,pt,e.remaining_balance.self>0,0===e.remaining_balance.self,e.remaining_balance.self<0)),t.R7$(),t.SpI(" ",t.i5U(11,16,e.remaining_balance.self,i.organisation.default_currency)," "),t.R7$(3),t.FS9("value",e.pid),t.Y8G("disabled",i.form.get("source").value&&i.form.get("source").value.pid===e.pid)}}function Ut(n,o){if(1&n&&t.Z7z(0,Mt,14,23,"div",22,t.fX1),2&n){const e=t.XpG(2);t.Dyx(e.accountsToDisplay)}}function Ct(n,o){1&n&&(t.EFF(0),t.nI1(1,"translate")),2&n&&t.SpI(" ",t.bMT(1,1,"No account available")," ")}function It(n,o){1&n&&(t.j41(0,"small",28),t.EFF(1," This field is required. "),t.k0s())}function Tt(n,o){if(1&n&&(t.j41(0,"small",29),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&n){const e=t.XpG(3);t.R7$(),t.Lme(" ",t.bMT(2,2,"Minimum amount is")," ",e.form.get("amount").errors.min.min,". ")}}function jt(n,o){if(1&n&&(t.j41(0,"small",29),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&n){const e=t.XpG(3);t.R7$(),t.Lme(" ",t.bMT(2,2,"Maximum amount is")," ",e.form.get("amount").errors.max.max,". ")}}function Rt(n,o){if(1&n&&(t.j41(0,"div",16),t.DNE(1,It,2,0,"small",28)(2,Tt,3,4,"small",29)(3,jt,3,4,"small",29),t.k0s()),2&n){const e=t.XpG(2);t.R7$(),t.vxM(1,e.form.get("amount").hasError("required")?1:-1),t.R7$(),t.vxM(2,e.form.get("amount").hasError("min")?2:-1),t.R7$(),t.vxM(3,e.form.get("amount").hasError("max")?3:-1)}}function Dt(n,o){if(1&n){const e=t.RV6();t.j41(0,"div",0)(1,"h1",1),t.EFF(2,"Fund transfer"),t.k0s(),t.j41(3,"form",2),t.bIt("ngSubmit",function(){t.eBV(e);const c=t.XpG();return t.Njj(c.submit())}),t.DNE(4,Nt,3,0,"select",3),t.j41(5,"div",4)(6,"div",5)(7,"div",6),t.EFF(8,"Source"),t.k0s(),t.nrm(9,"div",7),t.j41(10,"div",8),t.EFF(11,"Amount"),t.k0s(),t.j41(12,"div",8),t.EFF(13,"Available"),t.k0s(),t.j41(14,"div",6),t.EFF(15,"Target"),t.k0s()(),t.j41(16,"div",9),t.DNE(17,Ut,2,0)(18,Ct,2,3),t.k0s(),t.j41(19,"div",10)(20,"label",11),t.EFF(21,"Amount"),t.k0s(),t.j41(22,"div",12)(23,"div",13)(24,"div",14),t.EFF(25),t.k0s()(),t.nrm(26,"input",15),t.DNE(27,Rt,4,3,"div",16),t.k0s(),t.j41(28,"div",17)(29,"button",18),t.EFF(30,"Cancel"),t.k0s(),t.j41(31,"button",19),t.EFF(32,"Transfer"),t.k0s()()()()()()}if(2&n){const e=t.XpG();t.R7$(3),t.Y8G("formGroup",e.form),t.R7$(),t.vxM(4,e.budgets.length>1?4:-1),t.R7$(13),t.vxM(17,e.accountsToDisplay.length>0?17:18),t.R7$(8),t.JRh(e.currencySymbol),t.R7$(),t.HbH(t.eq3(8,gt,e.checkInput("amount"))),t.R7$(),t.vxM(27,e.checkInput("amount")?27:-1),t.R7$(4),t.Y8G("disabled",e.form.invalid)}}let bt=(()=>{class n{get organisation(){return this.organisationService.organisation}get currencySymbol(){return(0,C.Qn)(this.organisation.default_currency,"wide")}constructor(e,i,c,a,u,p,m){this.acqAccountApiService=e,this.organisationService=i,this.formBuilder=c,this.toastrService=a,this.translateService=u,this.router=p,this.userService=m,this.accountsToDisplay=[],this.budgets=[],this.accountsTree=[],this.selectedBudgetPid=void 0,this.form=this.formBuilder.group({source:[void 0,l.k0.required],target:[void 0,l.k0.required],amount:[0,l.k0.min(.01)]})}ngOnInit(){this._loadData(),this.form.controls.source.valueChanges.subscribe(e=>{const i=e.remaining_balance.self;this.form.controls.amount.setValidators([l.k0.min(.01),l.k0.max(i)])})}getDetailUrl(e){return["/","records","acq_accounts","detail",e.pid]}selectBudget(e){this.selectedBudgetPid=e.target.value,this._filterAccountToDisplay()}selectAccount(e,i){this.form.controls[e].patchValue(i)}submit(){this.acqAccountApiService.transferFunds(this.form.value.source.pid,this.form.value.target.pid,this.form.value.amount).subscribe(()=>{this.toastrService.success(this.translateService.instant("Fund transfer successful!")),this.router.navigate(["/","acquisition","accounts"])},e=>{this.toastrService.error(this.translateService.instant(e.error.message))})}checkInput(e){return void 0===this.form.get(e)||this.form.get(e).invalid&&this.form.get(e).errors&&(this.form.get(e).dirty||this.form.get(e).touched)}_loadData(){this.acqAccountApiService.getAccounts(this.userService.user.currentLibrary,void 0,{sort:"depth"}).subscribe(i=>{this.accountsTree=(0,v.p)(i),this.budgets=Array.from(new Set(this.accountsTree.map(c=>c.budget.pid))),this.selectedBudgetPid=this.budgets.find(Boolean),this._filterAccountToDisplay()})}_filterAccountToDisplay(){this.accountsToDisplay=this.accountsTree.filter(e=>e.budget.pid===this.selectedBudgetPid)}static#t=this.\u0275fac=function(i){return new(i||n)(t.rXU(T.i),t.rXU(L.y),t.rXU(l.ze),t.rXU(S.tw),t.rXU(g.c$),t.rXU(U.Ix),t.rXU(N.DL))};static#e=this.\u0275cmp=t.VBU({type:n,selectors:[["admin-account-transfer"]],decls:1,vars:1,consts:[[1,"container"],["translate",""],[3,"ngSubmit","formGroup"],[1,"form-control"],[1,"card","container","mt-3"],[1,"card-header","row","p-1","mb-2","bg-dark","text-light"],["translate","",1,"col-1","text-center"],[1,"col-6"],["translate","",1,"col-2","text-right"],[1,"card-text","mb-3"],[1,"card-footer","row","form-group","mb-0"],["for","amount",1,"col-1","col-form-label"],[1,"input-group","col-6"],[1,"input-group-prepend"],[1,"input-group-text"],["type","number","id","amount","formControlName","amount",1,"form-control"],[1,"ml-2","block","pt-2"],[1,"col","text-right"],["type","reset",1,"btn","btn-outline-danger","mr-2"],["type","submit",1,"btn","btn-primary",3,"disabled"],[1,"form-control",3,"change"],[3,"value"],[1,"row","account","my-2"],[1,"col-1","text-center"],["type","radio","name","source",3,"click","value","disabled"],[3,"routerLink"],[1,"col-2","amount"],["type","radio","name","target",3,"click","value","disabled"],["translate","",1,"text-danger"],[1,"text-danger"]],template:function(i,c){1&i&&t.DNE(0,Dt,33,10,"div",0),2&i&&t.vxM(0,c.accountsToDisplay&&c.organisation?0:-1)},dependencies:[U.Wk,l.qT,l.xH,l.y7,l.me,l.Q0,l.BC,l.cb,l.j4,l.JD,g.Mm,C.Jj,C.oe,s.yX,g.D9],styles:['.account[_ngcontent-%COMP%]{margin-bottom:.25rem}.account[_ngcontent-%COMP%]:hover{background-color:#f8f8f8}.account[_ngcontent-%COMP%] .account-name[_ngcontent-%COMP%]{font-weight:700}.account[_ngcontent-%COMP%] .account-number[_ngcontent-%COMP%]{text-transform:uppercase;font-size:.9rem}.account[_ngcontent-%COMP%] .amount[_ngcontent-%COMP%]{text-align:right}.account[_ngcontent-%COMP%] .depth-padding-1[_ngcontent-%COMP%]{padding-left:50px}.account[_ngcontent-%COMP%] .depth-padding-2[_ngcontent-%COMP%]{padding-left:100px}.account[_ngcontent-%COMP%] .depth-padding-3[_ngcontent-%COMP%]{padding-left:150px}.account[_ngcontent-%COMP%] .depth-padding-4[_ngcontent-%COMP%]{padding-left:200px}.account[_ngcontent-%COMP%] .depth-padding-5[_ngcontent-%COMP%]{padding-left:250px}.account[_ngcontent-%COMP%] .depth-padding-6[_ngcontent-%COMP%]{padding-left:300px}.account[_ngcontent-%COMP%] .depth-padding-7[_ngcontent-%COMP%]{padding-left:350px}.account[_ngcontent-%COMP%] .depth-padding-8[_ngcontent-%COMP%]{padding-left:400px}.account[_ngcontent-%COMP%] .depth-padding-9[_ngcontent-%COMP%]{padding-left:450px}.receipt[_ngcontent-%COMP%] .account-number[_ngcontent-%COMP%]{font-size:.875em;color:#6c757d;font-weight:700}.receipt[_ngcontent-%COMP%] .account-number[_ngcontent-%COMP%]:before{content:"["}.receipt[_ngcontent-%COMP%] .account-number[_ngcontent-%COMP%]:after{content:"]"}.no-gutter[_ngcontent-%COMP%]{margin-right:-15px;margin-left:-15px}.bullet-notes[_ngcontent-%COMP%]{margin-left:.5rem}.bullet-notes[_ngcontent-%COMP%] .fa-bullet[_ngcontent-%COMP%]{font-size:.75rem;margin-left:.25rem}.bullet-notes[_ngcontent-%COMP%] .fa-bullet.bullet-primary[_ngcontent-%COMP%]{color:#007bff}.bullet-notes[_ngcontent-%COMP%] .fa-bullet.bullet-success[_ngcontent-%COMP%]{color:#28a745}.bullet-notes[_ngcontent-%COMP%] .fa-bullet.bullet-danger[_ngcontent-%COMP%]{color:#dc3545}.bullet-notes[_ngcontent-%COMP%] .fa-bullet.bullet-warning[_ngcontent-%COMP%]{color:#ffc107}.bullet-notes[_ngcontent-%COMP%] .fa-bullet.bullet-info[_ngcontent-%COMP%]{color:#17a2b8}.bullet-notes[_ngcontent-%COMP%] .fa-bullet.bullet-dark[_ngcontent-%COMP%]{color:#1b4464}.priority[_ngcontent-%COMP%]{background-repeat:no-repeat;background-position:center center;height:16px;width:16px}.priority.priority-1[_ngcontent-%COMP%]{background-image:url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjIiIGJhc2VQcm9maWxlPSJ0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mlhLWxhYmVsPSI1IiAgZD0iTTUuNTggOC44TDUuNTggNC42OEwxMC4zMyA0LjY4TDEwLjMzIDYuMDZMNy4xIDYuMDZMNy4xIDcuMlE3LjMyIDcuMTQgNy41NCA3LjExUTcuNzYgNy4wNyA4IDcuMDdROS4zNSA3LjA3IDEwLjExIDcuNzVRMTAuODYgOC40MSAxMC44NiA5LjYxUTEwLjg2IDEwLjggMTAuMDQgMTEuNDdROS4yMiAxMi4xNCA3Ljc2IDEyLjE0UTcuMTMgMTIuMTQgNi41MSAxMi4wMlE1Ljg5IDExLjkgNS4yOCAxMS42Nkw1LjI4IDEwLjE3UTUuODkgMTAuNTEgNi40MyAxMC42OVE2Ljk4IDEwLjg2IDcuNDYgMTAuODZROC4xNSAxMC44NiA4LjU1IDEwLjUyUTguOTUgMTAuMTggOC45NSA5LjYxUTguOTUgOS4wMyA4LjU1IDguN1E4LjE1IDguMzYgNy40NiA4LjM2UTcuMDUgOC4zNiA2LjU4IDguNDdRNi4xMSA4LjU4IDUuNTggOC44WiIgLz4KPC9zdmc+)}.rollovered[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]:not(.fiscal-year-closed){opacity:.5}']})}return n})();var f=r(8141),Lt=r(980),D=r(96),B=r(254),d=r(6688),St=r(5558),j=r(6354),b=r(9372),y=r(4954);function yt(n,o,e){n.preventDefault(),e.map(i=>{i.fieldGroup.find(a=>"selected"===a.key).formControl.setValue("select"===o)})}let Z=(()=>{class n{constructor(e,i,c,a){this.acqOrderApiService=e,this.acqAccountApiService=i,this.apiService=c,this.orderReceipt=a}setModel(e){return this.model=e,this}getModel(){return this.model}getOrderRecord(){return this.orderRecord}getConfig(){return this.config}createForm(e){return this.config=this._getConfig(),this.acqOrderApiService.getOrder(e).pipe((0,f.M)(i=>this.orderRecord=i),(0,St.n)(i=>{const c=i.library.$ref,a=(0,s.LC)(c);return this.acqAccountApiService.getAccounts(a).subscribe(p=>{const m=this.config.filter(I=>"amountAdjustments"===I.key)[0].fieldArray.fieldGroup.filter(I=>"acqAccount"===I.key)[0].props;m.currency=i.currency,m.options=(0,v.p)(p)}),this.model.acqOrderRef=this.apiService.getRefEndpoint("acq_orders",i.pid),this.model.libraryRef=c,this.model.organisationRef=i.organisation.$ref,i.vendor.pid=(0,s.LC)(i.vendor.$ref),this.acqOrderApiService.getOrderLines(i.pid,`AND (NOT status:"${b.UZ.CANCELLED}" OR NOT status:"${b.UZ.RECEIVED}")`).pipe((0,j.T)(p=>(p.forEach(m=>{const I=m.received_quantity||0;this.model.receiveLines.push({acqOrderLineRef:this.apiService.getRefEndpoint("acq_order_lines",m.pid),selected:!1,document:m.document.pid,quantity:m.quantity-I,quantityMax:m.quantity-I,amount:m.amount,vatRate:0})}),!0)))}))}processForm(e,i){return(i=i||this.orderReceipt.processBaseRecord(e)).hasOwnProperty("amount_adjustments")?i.amount_adjustments.map(c=>c.acq_account={$ref:this.apiService.getRefEndpoint("acq_accounts",c.acq_account.pid)}):i.amount_adjustments=[],i.hasOwnProperty("notes")||(i.notes=[]),i.amount_adjustments=[...i.amount_adjustments,...this.orderReceipt.processAdjustments(e)],i.notes=[...i.notes,...e.notes||[]],e.reference&&e.reference.length>0&&(i.reference=e.reference),this.orderReceipt.cleanData(i)}_getConfig(){return[{key:"reference",type:"string",props:{label:(0,d.x)("Reference")}},{key:"receiptDate",type:"datepicker",props:{type:"date",label:(0,d.x)("Reception date"),required:!0}},{key:"exchangeRate",type:"input",defaultValue:1,hideExpression:!0},{key:"receiveLines",type:"repeat",props:{className:"pl-0 my-0 font-weight-bold",label:(0,d.x)("Order line(s)"),addButton:!1,trashButton:!1,selectUnselect:yt,minLength:0},fieldArray:{fieldGroupClassName:"row",validators:{validation:[{name:"receiveQuantityMax",options:{errorPath:"quantity"}}]},fieldGroup:[{key:"acqOrderLineRef",type:"input",hideExpression:!0},{key:"selected",type:"checkbox",className:"col-1",wrappers:["input-no-label"],props:{hideLabel:!0,headerClassName:"col-1 font-weight-bold mb-2"}},{key:"document",type:"field-document-brief-view",className:"col-5",wrappers:["input-no-label"],props:{headerClassName:"col-5 font-weight-bold mb-2",label:(0,d.x)("Document"),resource:"documents",resourceKey:"document",resourceField:"title.0._text",resourceSelect:{field:"type",value:"bf:Title"}}},{key:"quantityMax",type:"input",wrappers:["hide"]},{key:"quantity",type:"input",className:"col-2",wrappers:["input-no-label"],props:{headerClassName:"col-2 font-weight-bold mb-2",type:"number",label:(0,d.x)("Qty"),required:!0,min:1}},{key:"amount",type:"input",className:"col-2",wrappers:["input-no-label"],props:{headerClassName:"col-2 font-weight-bold mb-2",type:"number",label:(0,d.x)("Amount"),required:!0,min:0}},{key:"vatRate",type:"input",className:"col-2",wrappers:["input-no-label"],props:{headerClassName:"col-2 font-weight-bold mb-2",type:"number",label:(0,d.x)("Vat Rate"),min:0,max:100,addonRight:["%"]}}]}},{key:"amountAdjustments",type:"repeat",props:{className:"pl-0 my-0 font-weight-bold",label:(0,d.x)("Fees, discounts and other adjustments"),addButton:!0,trashButton:!0},fieldArray:{fieldGroup:[{key:"label",type:"input",props:{label:(0,d.x)("Label"),required:!0,minLength:3}},{key:"amount",type:"input",defaultValue:1,props:{label:(0,d.x)("Amount"),type:"number",description:(0,d.x)("To specify a discount, enter a negative amount"),required:!0}},{key:"acqAccount",type:"select-account",wrappers:["form-field"],props:{placeholder:(0,d.x)("Select an account"),label:(0,d.x)("Account"),required:!0,options:[]}}]}},{key:"notes",type:"repeat",props:{className:"pl-0 my-0 font-weight-bold",label:(0,d.x)("Notes"),addButton:!0,trashButton:!0},fieldArray:{fieldGroup:[{key:"type",type:"select",defaultValue:"staff_note",props:{label:(0,d.x)("Type"),options:[{label:(0,d.x)("staff_note"),value:"staff_note"}]}},{key:"content",type:"textarea",props:{label:(0,d.x)("Note"),required:!0,rows:5}}]}}]}static#t=this.\u0275fac=function(i){return new(i||n)(t.KVO(y.$),t.KVO(T.i),t.KVO(s.Gf),t.KVO(D.f))};static#e=this.\u0275prov=t.jDH({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var Ft=r(6373),xt=r(5146);const ht=n=>["/","records","acq_orders","detail",n],zt=(n,o)=>({"fa-save":n,"fa-spinner fa-pulse":o}),Ot=(n,o)=>({"btn-expanded":n,"btn-collapsed":o});function vt(n,o){if(1&n&&(t.j41(0,"div",15)(1,"div",10)(2,"h5",3),t.EFF(3,"Already in this receipt"),t.k0s()(),t.j41(4,"div",18),t.nrm(5,"admin-receipt-summary",19),t.k0s()()),2&n){const e=t.XpG(2);t.R7$(5),t.Y8G("receiptPid",e.receiptRecord.pid)("collapsable",!1)("allowActions",!1)}}function ft(n,o){if(1&n){const e=t.RV6();t.j41(0,"form",1),t.bIt("ngSubmit",function(){t.eBV(e);const c=t.XpG();return t.Njj(c.onSubmit(c.model))}),t.j41(1,"section",2)(2,"h1",3),t.EFF(3,"Receipt of an order"),t.k0s(),t.j41(4,"div",4)(5,"button",5),t.nrm(6,"i",6),t.EFF(7),t.nI1(8,"translate"),t.k0s(),t.j41(9,"button",7),t.nrm(10,"i",8),t.EFF(11),t.nI1(12,"translate"),t.k0s()()(),t.j41(13,"div",9)(14,"div",10)(15,"button",11),t.bIt("click",function(){t.eBV(e);const c=t.XpG();return t.Njj(c.knownDataCollapsed=!c.knownDataCollapsed)}),t.k0s(),t.j41(16,"h5",12),t.EFF(17,"Order overview"),t.k0s()(),t.j41(18,"div",13),t.nrm(19,"admin-order-summary",14),t.DNE(20,vt,6,3,"div",15),t.k0s()(),t.j41(21,"div",16)(22,"div",10)(23,"h5",3),t.EFF(24,"Receipt new data"),t.k0s()(),t.nrm(25,"formly-form",17),t.k0s()()}if(2&n){const e=t.XpG();t.Y8G("formGroup",e.form),t.R7$(5),t.Y8G("routerLink",t.eq3(18,ht,e.orderRecord.pid)),t.R7$(2),t.SpI(" ",t.bMT(8,14,"Cancel")," "),t.R7$(2),t.Y8G("disabled",!e.form.valid||e.orderSend),t.R7$(),t.Y8G("ngClass",t.l_i(20,zt,!e.orderSend,e.orderSend)),t.R7$(),t.SpI(" ",t.bMT(12,16,"Save")," "),t.R7$(4),t.Y8G("ngClass",t.l_i(23,Ot,!e.knownDataCollapsed,e.knownDataCollapsed)),t.BMQ("aria-expanded",!e.knownDataCollapsed),t.R7$(3),t.Y8G("hidden",e.knownDataCollapsed),t.R7$(),t.Y8G("order",e.orderRecord),t.R7$(),t.vxM(20,e.receiptRecord?20:-1),t.R7$(5),t.Y8G("form",e.form)("fields",e.fields)("model",e.model)}}let Bt=(()=>{class n{get fields(){return this.model.pid&&(this._fields.find(e=>"reference"===e.key).props.readonly=!0),this._fields}constructor(e,i,c,a,u,p,m){this.route=e,this.router=i,this.orderReceipt=c,this.acqReceiptApiService=a,this.toastrService=u,this.translateService=p,this.orderReceiptForm=m,this.orderSend=!1,this.loaded=!1,this.form=new l.J3({}),this.knownDataCollapsed=!0}ngOnInit(){this.orderPid=this.route.snapshot.paramMap.get("pid"),this._generateForm()}onSubmit(e){this.orderSend=!0;let i=this.receiptRecord?this.orderReceipt.processExistingRecord(this.receiptRecord):this.orderReceipt.processBaseRecord(e);i=this.orderReceiptForm.processForm(e,i),(this.receiptRecord?this.acqReceiptApiService.updateReceipt(i.pid,i):this.acqReceiptApiService.createReceipt(i).pipe((0,f.M)(a=>e.pid=a.pid))).pipe((0,Lt.j)(()=>this.orderSend=!1)).subscribe(a=>this.createLinesAndMessage(e,a),a=>{this.toastrService.error(a.title,this.translateService.instant("Receipt"),{disableTimeOut:!0,closeButton:!0})})}_generateForm(){this.model=this.orderReceipt.model;const e=this.route.snapshot.queryParams.receipt;e&&this.acqReceiptApiService.getReceipt(e).subscribe(i=>{this.receiptRecord=i,this.model.pid=e,this.model.reference=i.reference}),this.orderReceiptForm.setModel(this.model).createForm(this.orderPid).subscribe(i=>{this.orderRecord=this.orderReceiptForm.getOrderRecord(),this.model=this.orderReceiptForm.getModel(),this._fields=this.orderReceiptForm.getConfig(),this.loaded=i})}createLinesAndMessage(e,i){const c=this.orderReceipt.processLines(e);c.length>0?this.acqReceiptApiService.createReceiptLines(e.pid,c).subscribe(a=>{a.success?this.toastrService.success(this.translateService.instant("Receipt operations were successful"),this.translateService.instant("Receipt")):this.toastrService.error(this.translateService.instant(a.messages),this.translateService.instant("Receipt"),{disableTimeOut:!0,closeButton:!0}),this.redirectToOrder()}):(this.toastrService.success(this.translateService.instant("Receipt operations were successful"),this.translateService.instant("Receipt")),this.redirectToOrder())}redirectToOrder(){this.router.navigate(["/","records","acq_orders","detail",this.orderPid])}static#t=this.\u0275fac=function(i){return new(i||n)(t.rXU(U.nX),t.rXU(U.Ix),t.rXU(D.f),t.rXU(B.H),t.rXU(S.tw),t.rXU(g.c$),t.rXU(Z))};static#e=this.\u0275cmp=t.VBU({type:n,selectors:[["admin-order-receipt-view"]],decls:1,vars:1,consts:[[1,"container",3,"formGroup"],[1,"container",3,"ngSubmit","formGroup"],[1,"d-flex","mb-3"],["translate",""],[1,"ml-auto"],["type","reset",1,"btn","btn-outline-danger","btn-sm",3,"routerLink"],[1,"fa","fa-times"],["type","submit",1,"btn","btn-primary","btn-sm","ml-1",3,"disabled"],[1,"fa",3,"ngClass"],[1,"row","card","known-data"],[1,"card-header"],["type","button","aria-controls","collapse",1,"btn-show-more",3,"click","ngClass"],["translate","",1,"d-inline-block"],[1,"card-body","callout","callout-info","callout-bg-info","pt-0",3,"hidden"],[3,"order"],[1,"card","w-100","pt-0"],[1,"row","card","p-0","my-3"],[1,"card-body",3,"form","fields","model"],[1,"card-body","p-0"],[1,"container",3,"receiptPid","collapsable","allowActions"]],template:function(i,c){1&i&&t.DNE(0,ft,26,26,"form",0),2&i&&t.vxM(0,c.loaded?0:-1)},dependencies:[C.YU,U.Wk,M.aF,l.qT,l.cb,l.j4,g.Mm,Ft.U,xt.w,g.D9],styles:['.account[_ngcontent-%COMP%]{margin-bottom:.25rem}.account[_ngcontent-%COMP%]:hover{background-color:#f8f8f8}.account[_ngcontent-%COMP%] .account-name[_ngcontent-%COMP%]{font-weight:700}.account[_ngcontent-%COMP%] .account-number[_ngcontent-%COMP%]{text-transform:uppercase;font-size:.9rem}.account[_ngcontent-%COMP%] .amount[_ngcontent-%COMP%]{text-align:right}.account[_ngcontent-%COMP%] .depth-padding-1[_ngcontent-%COMP%]{padding-left:50px}.account[_ngcontent-%COMP%] .depth-padding-2[_ngcontent-%COMP%]{padding-left:100px}.account[_ngcontent-%COMP%] .depth-padding-3[_ngcontent-%COMP%]{padding-left:150px}.account[_ngcontent-%COMP%] .depth-padding-4[_ngcontent-%COMP%]{padding-left:200px}.account[_ngcontent-%COMP%] .depth-padding-5[_ngcontent-%COMP%]{padding-left:250px}.account[_ngcontent-%COMP%] .depth-padding-6[_ngcontent-%COMP%]{padding-left:300px}.account[_ngcontent-%COMP%] .depth-padding-7[_ngcontent-%COMP%]{padding-left:350px}.account[_ngcontent-%COMP%] .depth-padding-8[_ngcontent-%COMP%]{padding-left:400px}.account[_ngcontent-%COMP%] .depth-padding-9[_ngcontent-%COMP%]{padding-left:450px}.receipt[_ngcontent-%COMP%] .account-number[_ngcontent-%COMP%]{font-size:.875em;color:#6c757d;font-weight:700}.receipt[_ngcontent-%COMP%] .account-number[_ngcontent-%COMP%]:before{content:"["}.receipt[_ngcontent-%COMP%] .account-number[_ngcontent-%COMP%]:after{content:"]"}.no-gutter[_ngcon