UNPKG

@rero/rero-ils-ui

Version:

User interface for RERO integrated library system (RERO ILS).

2 lines (1 loc) 4.27 kB
import{a as z}from"./chunk-K7WBG4SG.js";import{a as K,b as Q}from"./chunk-FCC5WNRC.js";import{a as J}from"./chunk-BR2J44KJ.js";import{a as W}from"./chunk-CGU6MK6Q.js";import{R as q,j as D,k as $}from"./chunk-4GRLSOJZ.js";import{O as k,P as L,Wa as f,fc as X,hc as Z}from"./chunk-MTJX6JRK.js";import{a as V,b as F,c as O}from"./chunk-GQ5FIRIY.js";import{ma as j}from"./chunk-4MYHQLZQ.js";import{g as G,h as H}from"./chunk-DUSRDOA3.js";import{W as P,ua as U}from"./chunk-WKOKZ3JO.js";import{H as b,Hc as a,Ic as l,Jc as E,Vb as S,X as B,Xb as C,Xc as R,Yc as M,a as v,ac as _,bc as n,cc as c,da as x,dc as T,dd as y,ed as I,gb as o,gd as N,ia as s,sc as w,v as m,vd as d,yb as g}from"./chunk-3WD6XLXL.js";var re=(e,p)=>({"text-success":e,"text-error":p}),oe=e=>[e],ee=(()=>{class e{constructor(){this.translateService=s(V),this.record=d(),this.type=d(),this.detailUrl=d()}get title(){return this.record().metadata.is_active?this.translateService.instant("Active"):this.translateService.instant("Inactive")}static{this.\u0275fac=function(t){return new(t||e)}}static{this.\u0275cmp=g({type:e,selectors:[["admin-budgets-brief-view"]],inputs:{record:[1,"record"],type:[1,"type"],detailUrl:[1,"detailUrl"]},decls:5,vars:9,consts:[[1,"fa","fa-circle","ui:mr-2",3,"title","ngClass"],[3,"routerLink"]],template:function(t,r){t&1&&(n(0,"h5"),T(1,"i",0),a(2,"\xA0 "),n(3,"a",1),a(4),c()()),t&2&&(o(),_("title",r.title)("ngClass",M(4,re,r.record().metadata.is_active,!r.record().metadata.is_active)),o(2),_("routerLink",R(7,oe,r.detailUrl().link)),o(),l(r.record().metadata.name))},dependencies:[P,j],encapsulation:2,changeDetection:0})}}return e})();var h=class{constructor(p){this.$schema=null,this.pid=null,this.name="",this.start_date="",this.end_date="",this.is_active=!1,Object.assign(this,p)}};var te=(()=>{class e{constructor(){this.recordService=s(f),this.resourceName="budgets"}getBudgets(i){return i=i||"",this.recordService.getRecords(this.resourceName,{query:i,page:1,itemsPerPage:f.MAX_REST_RESULTS_SIZE}).pipe(m(t=>+this.recordService.totalHits(t.hits.total)==0?[]:t.hits.hits),m(t=>t.map(r=>new h(r.metadata))))}getBudgetTotalAmount(i){return this.recordService.getRecords("acq_accounts",{query:`budget.pid:${i} AND depth:0`,page:1,itemsPerPage:f.MAX_REST_RESULTS_SIZE}).pipe(m(t=>+this.recordService.totalHits(t.hits.total)==0?[]:t.hits.hits),m(t=>t.map(r=>v(v({},z),r.metadata))),m(t=>t.reduce((r,u)=>r+u.allocated_amount,0)))}static{this.\u0275fac=function(t){return new(t||e)}}static{this.\u0275prov=x({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})();function ne(e,p){e&1&&(n(0,"p-message",0),a(1),y(2,"translate"),c()),e&2&&(o(),E(" ",I(2,1,"Fiscal year closed")," "))}function ae(e,p){if(e&1&&(S(0,ne,3,3,"p-message",0),n(1,"header",1)(2,"h1"),a(3),c()(),n(4,"section")(5,"dl",2)(6,"dt",3),a(7,"Total"),c(),n(8,"dd"),a(9),y(10,"currency"),c()()()),e&2){let i=p,t=w();C(i.metadata.is_active?-1:0),o(3),l(i.metadata.name),o(6),l(N(10,3,t.totalAmount(),t.currencyCode,"symbol"))}}var ie=(()=>{class e{constructor(){this.budgetApiService=s(te),this.appStore=s(q),this.record=d(),this.type=d(""),this.totalAmount=L(k(this.record).pipe(b(i=>!!i?.metadata?.pid),B(i=>this.budgetApiService.getBudgetTotalAmount(i.metadata.pid))),{initialValue:0})}get currencyCode(){return this.appStore.organisation()?.default_currency}static{this.\u0275fac=function(t){return new(t||e)}}static{this.\u0275cmp=g({type:e,selectors:[["admin-budget-detail-view"]],inputs:{record:[1,"record"],type:[1,"type"]},decls:1,vars:1,consts:[["severity","warn","showTransitionOptions","0ms"],[1,"ui:my-3"],[1,"metadata"],["translate",""]],template:function(t,r){if(t&1&&S(0,ae,11,7),t&2){let u;C((u=r.record())?0:-1,u)}},dependencies:[F,H,G,U,O],encapsulation:2,changeDetection:0})}}return e})();var Ge=()=>new A().getTypes(),He=[{path:"",component:X,title:"Budgets",canActivate:[J],data:{permissions:[D.BUDG_ACCESS,D.BUDG_SEARCH],operator:$.AND}},{path:"detail/:pid",component:Z,title:"Budget",canActivate:[Q],data:{action:K.READ}}],A=class extends W{constructor(){super(...arguments),this.name="budgets",this.recordType="budgets"}getTypes(){return[{key:this.name,label:"Budgets",component:ee,detailComponent:ie,searchFilters:[this.expertSearchFilter()]}]}};export{Ge as a,He as b};