UNPKG

@rero/rero-ils-ui

Version:

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

158 lines (128 loc) 18.7 kB
import{a as Me,b as Be}from"./chunk-F2COYYOM.js";import{a as X}from"./chunk-JPSHKPUE.js";import{ea as N,ka as q,m as L,n as V,na as U,oa as J,pa as Y,ta as Fe,va as Ie}from"./chunk-2UPHTDC6.js";import"./chunk-4H236NYG.js";import"./chunk-DDCLLFY5.js";import{Ab as v,Ac as x,Bb as f,Bc as S,Be as Ee,Cb as me,Cc as w,Ce as H,Eb as R,Fb as $,Fc as C,Gb as m,Hb as a,Ib as r,Jb as u,Nb as ce,Ne as Pe,Ob as de,Oc as F,Pb as A,Qb as se,Qe as Se,Ra as K,Re as ke,Sb as ue,Se as D,Ta as o,Tb as d,V as j,W as ne,Wb as ve,Y as ie,Yb as M,Zb as B,_ as g,bc as fe,da as oe,ea as ae,fc as P,gb as b,gc as c,gd as he,h as te,hb as re,hc as y,hd as Ce,ic as _,id as ye,kb as le,kd as Te,lb as pe,mb as h,qa as z,qd as Q,rc as _e,rd as be,sc as W,tc as ge,va as I,vc as k,wc as xe,xb as E,zc as s}from"./chunk-Q2WBXDIA.js";var we=` .p-timeline { display: flex; flex-grow: 1; flex-direction: column; direction: ltr; list-style: none; margin: 0; padding: 0; } .p-timeline-left .p-timeline-event-opposite { text-align: right; } .p-timeline-left .p-timeline-event-content { text-align: left; } .p-timeline-right .p-timeline-event { flex-direction: row-reverse; } .p-timeline-right .p-timeline-event-opposite { text-align: left; } .p-timeline-right .p-timeline-event-content { text-align: right; } .p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(even) { flex-direction: row-reverse; } .p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(odd) .p-timeline-event-opposite { text-align: right; } .p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(odd) .p-timeline-event-content { text-align: left; } .p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(even) .p-timeline-event-opposite { text-align: left; } .p-timeline-vertical.p-timeline-alternate .p-timeline-event:nth-child(even) .p-timeline-event-content { text-align: right; } .p-timeline-vertical .p-timeline-event-opposite, .p-timeline-vertical .p-timeline-event-content { padding: dt('timeline.vertical.event.content.padding'); } .p-timeline-vertical .p-timeline-event-connector { width: dt('timeline.event.connector.size'); } .p-timeline-event { display: flex; position: relative; min-height: dt('timeline.event.min.height'); } .p-timeline-event:last-child { min-height: 0; } .p-timeline-event-opposite { flex: 1; } .p-timeline-event-content { flex: 1; } .p-timeline-event-separator { flex: 0; display: flex; align-items: center; flex-direction: column; } .p-timeline-event-marker { display: inline-flex; align-items: center; justify-content: center; position: relative; align-self: baseline; border-width: dt('timeline.event.marker.border.width'); border-style: solid; border-color: dt('timeline.event.marker.border.color'); border-radius: dt('timeline.event.marker.border.radius'); width: dt('timeline.event.marker.size'); height: dt('timeline.event.marker.size'); background: dt('timeline.event.marker.background'); } .p-timeline-event-marker::before { content: ' '; border-radius: dt('timeline.event.marker.content.border.radius'); width: dt('timeline.event.marker.content.size'); height: dt('timeline.event.marker.content.size'); background: dt('timeline.event.marker.content.background'); } .p-timeline-event-marker::after { content: ' '; position: absolute; width: 100%; height: 100%; border-radius: dt('timeline.event.marker.border.radius'); box-shadow: dt('timeline.event.marker.content.inset.shadow'); } .p-timeline-event-connector { flex-grow: 1; background: dt('timeline.event.connector.color'); } .p-timeline-horizontal { flex-direction: row; } .p-timeline-horizontal .p-timeline-event { flex-direction: column; flex: 1; } .p-timeline-horizontal .p-timeline-event:last-child { flex: 0; } .p-timeline-horizontal .p-timeline-event-separator { flex-direction: row; } .p-timeline-horizontal .p-timeline-event-connector { width: 100%; height: dt('timeline.event.connector.size'); } .p-timeline-horizontal .p-timeline-event-opposite, .p-timeline-horizontal .p-timeline-event-content { padding: dt('timeline.horizontal.event.content.padding'); } .p-timeline-horizontal.p-timeline-alternate .p-timeline-event:nth-child(even) { flex-direction: column-reverse; } .p-timeline-bottom .p-timeline-event { flex-direction: column-reverse; } `;var $e=["content"],Ae=["opposite"],Qe=["marker"],ee=e=>({$implicit:e});function He(e,n){e&1&&A(0)}function Le(e,n){e&1&&A(0)}function Ve(e,n){if(e&1&&(ce(0),h(1,Le,1,0,"ng-container",3),de()),e&2){let t=d().$implicit,i=d();o(),m("ngTemplateOutlet",i.markerTemplate||i._markerTemplate)("ngTemplateOutletContext",k(2,ee,t))}}function qe(e,n){if(e&1&&u(0,"div",2),e&2){let t=d(2);P(t.cx("eventMarker")),m("pBind",t.ptm("eventMarker")),E("data-p",t.dataP)}}function Ue(e,n){if(e&1&&u(0,"div",2),e&2){let t=d(2);P(t.cx("eventConnector")),m("pBind",t.ptm("eventConnector")),E("data-p",t.dataP)}}function Je(e,n){e&1&&A(0)}function Xe(e,n){if(e&1&&(a(0,"div",2)(1,"div",2),h(2,He,1,0,"ng-container",3),r(),a(3,"div",2),h(4,Ve,2,4,"ng-container",4)(5,qe,1,4,"ng-template",null,0,C)(7,Ue,1,4,"div",5),r(),a(8,"div",2),h(9,Je,1,0,"ng-container",3),r()()),e&2){let t=n.$implicit,i=n.last,l=fe(6),p=d();P(p.cx("event")),m("pBind",p.ptm("event")),E("data-p",p.dataP),o(),P(p.cx("eventOpposite")),m("pBind",p.ptm("eventOpposite")),E("data-p",p.dataP),o(),m("ngTemplateOutlet",p.oppositeTemplate||p._oppositeTemplate)("ngTemplateOutletContext",k(23,ee,t)),o(),P(p.cx("eventSeparator")),m("pBind",p.ptm("eventSeparator")),E("data-p",p.dataP),o(),m("ngIf",p.markerTemplate||p._markerTemplate)("ngIfElse",l),o(3),m("ngIf",!i),o(),P(p.cx("eventContent")),m("pBind",p.ptm("eventContent")),E("data-p",p.dataP),o(),m("ngTemplateOutlet",p.contentTemplate||p._contentTemplate)("ngTemplateOutletContext",k(25,ee,t))}}var Ze={root:({instance:e})=>["p-timeline p-component","p-timeline-"+e.align,"p-timeline-"+e.layout],event:"p-timeline-event",eventOpposite:"p-timeline-event-opposite",eventSeparator:"p-timeline-event-separator",eventMarker:"p-timeline-event-marker",eventConnector:"p-timeline-event-connector",eventContent:"p-timeline-event-content"},De=(()=>{class e extends Pe{name="timeline";style=we;classes=Ze;static \u0275fac=(()=>{let t;return function(l){return(t||(t=I(e)))(l||e)}})();static \u0275prov=j({token:e,factory:e.\u0275fac})}return e})();var Ne=new ie("TIMELINE_INSTANCE"),O=(()=>{class e extends ke{componentName="Timeline";bindDirectiveInstance=g(D,{self:!0});$pcTimeline=g(Ne,{optional:!0,skipSelf:!0})??void 0;onAfterViewChecked(){this.bindDirectiveInstance.setAttrs(this.ptms(["host","root"]))}value;styleClass;align="left";layout="vertical";contentTemplate;oppositeTemplate;markerTemplate;templates;_contentTemplate;_oppositeTemplate;_markerTemplate;_componentStyle=g(De);getBlockableElement(){return this.el.nativeElement.children[0]}onAfterContentInit(){this.templates.forEach(t=>{switch(t.getType()){case"content":this._contentTemplate=t.template;break;case"opposite":this._oppositeTemplate=t.template;break;case"marker":this._markerTemplate=t.template;break}})}get dataP(){return this.cn({[this.layout]:this.layout,[this.align]:this.align})}static \u0275fac=(()=>{let t;return function(l){return(t||(t=I(e)))(l||e)}})();static \u0275cmp=b({type:e,selectors:[["p-timeline"]],contentQueries:function(i,l,p){if(i&1&&ve(p,$e,4)(p,Ae,4)(p,Qe,4)(p,Ee,4),i&2){let T;M(T=B())&&(l.contentTemplate=T.first),M(T=B())&&(l.oppositeTemplate=T.first),M(T=B())&&(l.markerTemplate=T.first),M(T=B())&&(l.templates=T)}},hostVars:3,hostBindings:function(i,l){i&2&&(E("data-p",l.dataP),P(l.cn(l.cx("root"),l.styleClass)))},inputs:{value:"value",styleClass:"styleClass",align:"align",layout:"layout"},features:[ge([De,{provide:Ne,useExisting:e},{provide:Se,useExisting:e}]),le([D]),pe],decls:1,vars:1,consts:[["marker",""],[3,"pBind","class",4,"ngFor","ngForOf"],[3,"pBind"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[4,"ngIf","ngIfElse"],[3,"pBind","class",4,"ngIf"]],template:function(i,l){i&1&&h(0,Xe,10,27,"div",1),i&2&&m("ngForOf",l.value)},dependencies:[be,Ce,ye,Te,H,D],encapsulation:2,changeDetection:0})}return e})(),G=(()=>{class e{static \u0275fac=function(i){return new(i||e)};static \u0275mod=re({type:e});static \u0275inj=ne({imports:[O,H,H]})}return e})();var je=(()=>{let n=class n extends Y{constructor(){super(...arguments),this.recordService=g(N)}getEvents(i,l="created"){return this.recordService.getRecords("patron_transaction_events",{query:`parent.pid:${i}`,page:1,itemsPerPage:N.MAX_REST_RESULTS_SIZE,headers:Y.reroJsonheaders,sort:l})}};n.\u0275fac=(()=>{let i;return function(p){return(i||(i=I(n)))(p||n)}})(),n.\u0275prov=j({token:n,factory:n.\u0275fac,providedIn:"root"});let e=n;return e})();var Ke=(e,n)=>({"event-highlight":e,"":n});function We(e,n){if(e&1&&(c(0),s(1,"translate")),e&2){let t=d().$implicit;_(" [",x(1,1,t.metadata.subtype),"] ")}}function Ye(e,n){if(e&1&&(a(0,"p-tag",6),c(1),s(2,"currency"),r()),e&2){let t=d().$implicit,i=d();m("severity",t.metadata.type==="payment"?"success":"danger"),o(),_(" ",w(2,2,t.metadata.amount,i.organisation.currency,"symbol")," ")}}function et(e,n){if(e&1&&(a(0,"dl",7)(1,"dt",8),u(2,"i",9),s(3,"translate"),a(4,"span",10),c(5,"Note"),r()(),a(6,"dd",11),c(7),r()()),e&2){let t=d().$implicit;o(2),m("title",x(3,2,"Note")),o(5),y(t.metadata.note)}}function tt(e,n){if(e&1&&(a(0,"dl",7)(1,"dt",8),u(2,"i",12),s(3,"translate"),a(4,"span",10),c(5,"Library"),r()(),a(6,"dd",11),c(7),r()()),e&2){let t=d().$implicit;o(2),m("title",x(3,2,"Library")),o(5),_(" ",t.metadata.library.name," ")}}function nt(e,n){if(e&1&&(a(0,"div",4)(1,"div",5),c(2),s(3,"translate"),v(4,We,2,3),r(),a(5,"div"),v(6,Ye,3,6,"p-tag",6),r()(),v(7,et,8,4,"dl",7),v(8,tt,8,4,"dl",7)),e&2){let t=n.$implicit;m("ngClass",xe(8,Ke,t.metadata.type==="dispute",t.metadata.type!=="dispute")),o(2),_(" ",x(3,6,t.metadata.type)," "),o(2),f(t.metadata.subtype?4:-1),o(2),f(t.metadata.amount?6:-1),o(),f(t.metadata.note?7:-1),o(),f(t.metadata.library?8:-1)}}function it(e,n){if(e&1&&(a(0,"div",13)(1,"div",14)(2,"div",15),u(3,"i",16),c(4),s(5,"dateTranslate"),r(),a(6,"div",15),u(7,"i",17),c(8),s(9,"dateTranslate"),r()()()),e&2){let t=n.$implicit;o(4),_(" ",S(5,2,t.metadata.creation_date,"shortDate")," "),o(4),_(" ",S(9,5,t.metadata.creation_date,"HH:mm")," ")}}function ot(e,n){if(e&1&&(a(0,"span",18),u(1,"i",19),r()),e&2){let t=n.$implicit;m("ngClass",t.metadata.type==="dispute"?"ui:bg-yellow-500":t.metadata.type==="payment"?"ui:bg-green-500":"ui:bg-red-500"),o(),m("ngClass",t.metadata.type==="dispute"?"fa-exclamation":"fa-check")}}var ze=(()=>{let n=class n{constructor(){this.patronTransactionEventApiService=g(je),this.store=g(X),this.event=F(),this.transactionEvents=z([])}get organisation(){return this.store.currentPatron().organisation}ngOnInit(){this.patronTransactionEventApiService.getEvents(this.event().metadata.pid).subscribe(i=>this.transactionEvents.set(i.hits.hits))}};n.\u0275fac=function(l){return new(l||n)},n.\u0275cmp=b({type:n,selectors:[["public-search-patron-profile-fee-event"]],inputs:{event:[1,"event"]},decls:7,vars:1,consts:[["content",""],["opposite",""],["marker",""],[3,"value"],[1,"ui:md:flex",3,"ngClass"],[1,"ui:flex-grow"],[1,"ui:pr-1",3,"severity"],[1,"ui:grid","ui:grid-cols-4"],[1,"ui:font-bold","ui:mr-2"],[1,"fa","fa-comment-o","ui:pr-1",3,"title"],["translate","",1,"ui:md:inline-block","ui:hidden"],[1,"ui:col-span-3"],[1,"fa","fa-map-marker","ui:pr-1",3,"title"],[1,"ui:text-muted-color","ui:text-sm","ui:justify-items-end"],[1,"ui:md:flex","ui:md:flex-row","ui:flex-col","ui:justify-items-end"],[1,"ui:flex","ui:gap-1","ui:items-center"],[1,"fa","fa-calendar-o"],[1,"fa","fa-clock-o","ui:pl-1"],[1,"ui:flex","ui:items-center","ui:justify-center","ui:text-white","ui:rounded-full","ui:z-10","ui:shadow-sm","ui:w-[1.3rem]","ui:h-[1.3rem]",3,"ngClass"],[1,"fa",3,"ngClass"]],template:function(l,p){l&1&&(a(0,"p-timeline",3),h(1,nt,9,11,"ng-template",null,0,C)(3,it,10,8,"ng-template",null,1,C)(5,ot,2,2,"ng-template",null,2,C),r()),l&2&&m("value",p.transactionEvents())},dependencies:[he,L,J,U,G,O,Q,V,q],encapsulation:2,changeDetection:0});let e=n;return e})();var at=(e,n)=>n.metadata.pid;function rt(e,n){if(e&1&&u(0,"public-search-patron-profile-fee-event",0),e&2){let t=n.$implicit;m("event",t)}}var Re=(()=>{let n=class n{constructor(){this.events=F()}};n.\u0275fac=function(l){return new(l||n)},n.\u0275cmp=b({type:n,selectors:[["public-search-patron-profile-fee-events"]],inputs:{events:[1,"events"]},decls:2,vars:0,consts:[[3,"event"]],template:function(l,p){l&1&&R(0,rt,1,1,"public-search-patron-profile-fee-event",0,at),l&2&&$(p.events())},dependencies:[ze],encapsulation:2,changeDetection:0});let e=n;return e})();var lt=e=>[e];function pt(e,n){if(e&1&&(a(0,"a",10),c(1),s(2,"mainTitle"),r()),e&2){let t=d(2);m("href",W("/",t.organisation.code,"/documents/",t.document().metadata.pid),K),o(),y(x(2,4,t.document().metadata.title))}}function mt(e,n){if(e&1&&(a(0,"li"),c(1),r()),e&2){let t=n.$implicit;o(),y(t)}}function ct(e,n){if(e&1&&(a(0,"p-panel",13),s(1,"translate"),a(2,"div",18)(3,"ul"),R(4,mt,2,1,"li",null,me),r()()()),e&2){let t=d(3),i=t.record().notes.length>1?"Notes":"Note";m("header",x(1,1,i)),o(4),$(t.record().notes)}}function dt(e,n){if(e&1&&(a(0,"dt",20),c(1,"Call number"),r(),a(2,"dd"),c(3),r()),e&2){let t=d(4);o(3),y(t.record().loan.item.call_number)}}function st(e,n){if(e&1&&(a(0,"p-panel",14),s(1,"translate"),a(2,"dl",19)(3,"dt",20),c(4,"Title"),r(),a(5,"dd")(6,"a",10),c(7),s(8,"mainTitle"),r()(),v(9,dt,4,1),a(10,"dt",20),c(11,"Loan started at"),r(),a(12,"dd"),c(13),s(14,"dateTranslate"),r()()()),e&2){let t,i=d(3);m("id",_e("fee-",i.document().metadata.pid,"-document"))("header",x(1,9,"Document")),o(6),m("href",W("/",i.organisation.code,"/documents/",i.document().metadata.pid),K),o(),y(x(8,11,i.document().metadata.title)),o(2),f((t=i.record().loan.item)!=null&&t.call_number?9:-1),o(4),y(S(14,13,i.record().loan.start_date,"short"))}}function ut(e,n){if(e&1&&(a(0,"div",21)(1,"div",22),c(2," expected fees "),r(),a(3,"div")(4,"p-tag",23),c(5),s(6,"currency"),r()()()),e&2){let t=n.$implicit,i=d(4);o(5),_(" ",w(6,1,t.overdue,i.organisation.currency,"symbol")," ")}}function vt(e,n){if(e&1&&(a(0,"div",24)(1,"div",25)(2,"div",26),u(3,"i",27),c(4),s(5,"dateTranslate"),r(),a(6,"div",26),u(7,"i",28),c(8),s(9,"dateTranslate"),r()()()),e&2){let t=n.$implicit;o(4),_(" ",S(5,2,t.createdAt,"shortDate")," "),o(4),_(" ",S(9,5,t.createdAt,"HH:mm")," ")}}function ft(e,n){e&1&&(a(0,"span",29),u(1,"i",30),r())}function _t(e,n){if(e&1&&(a(0,"p-timeline",17),h(1,ut,7,5,"ng-template",null,0,C)(3,vt,10,8,"ng-template",null,1,C)(5,ft,2,0,"ng-template",null,2,C),r()),e&2){let t=d(3);m("value",k(1,lt,t.record()))}}function gt(e,n){if(e&1&&(a(0,"div",12),v(1,ct,6,3,"p-panel",13),v(2,st,15,16,"p-panel",14),a(3,"p-panel",15),s(4,"translate"),u(5,"public-search-patron-profile-fee-events",16),v(6,_t,7,3,"p-timeline",17),r()()),e&2){let t,i=d(2);o(),f(((t=i.record().notes)==null?null:t.length)>0?1:-1),o(),f(i.document()?2:-1),o(),m("header",x(4,5,"Transactions history")),o(2),m("events",i.record().transactions),o(),f(i.record().overdue>0?6:-1)}}function xt(e,n){if(e&1){let t=se();a(0,"div",3)(1,"div",4)(2,"shared-open-close-button",5),ue("status",function(l){oe(t);let p=d();return ae(p.isCollapsed=l)}),r()(),a(3,"div",6)(4,"div",7),c(5),s(6,"dateTranslate"),r(),a(7,"div",8)(8,"div",9),v(9,pt,3,6,"a",10),a(10,"div"),c(11),s(12,"translate"),r()()(),a(13,"div",11),c(14),s(15,"currency"),r()(),v(16,gt,7,7,"div",12),r()}if(e&2){let t=d();o(5),y(S(6,5,t.record().createdAt,"short")),o(4),f(t.isCollapsed&&t.document()?9:-1),o(2),_(" ",x(12,8,t.record().type)," "),o(3),_(" ",w(15,10,t.record().totalAmount,t.organisation.currency,"symbol")," "),o(2),f(t.isCollapsed?-1:16)}}var Cn=(()=>{let n=class n{constructor(){this.store=g(X),this.recordService=g(N),this.record=F(),this.isCollapsed=!0,this.events=[],this.document=z(null),this.subscription=new te}get organisation(){return this.store.currentPatron().organisation}ngOnInit(){this.record()?.loan&&this.subscription.add(this.recordService.getRecord("documents",this.record()?.loan.document_pid).subscribe(i=>this.document.set(i)))}ngOnDestroy(){this.subscription.unsubscribe()}getPatronTransaction(i){return this.recordService.getRecord("patron_transactions",i,{resolve:1})}};n.\u0275fac=function(l){return new(l||n)},n.\u0275cmp=b({type:n,selectors:[["public-search-patron-profile-fee"]],inputs:{record:[1,"record"]},decls:1,vars:1,consts:[["content",""],["opposite",""],["marker",""],[1,"ui:grid","ui:grid-cols-12","ui:gap-4","ui:p-2","ui:pl-1"],[1,"ui:col-span-1"],[3,"status"],[1,"ui:col-span-11","ui:md:grid","ui:md:grid-cols-12","ui:flex-col","ui:ml-5","ui:md:ml-0"],[1,"ui:col-span-2"],[1,"ui:col-span-7"],[1,"ui:flex","ui:flex-col"],[3,"href"],[1,"ui:col-span-3","ui:flex","ui:justify-start","ui:md:justify-end","ui:mr-3","ui:font-bold"],[1,"ui:col-span-11","ui:col-start-2"],[1,"ui:mb-2","ui:pb-2","ui:bg-transparent",3,"header"],[1,"ui:mb-2","ui:pb-2","ui:bg-transparent",3,"header","id"],[1,"ui:bg-transparent","ui:pb-2","time-line-30",3,"header"],[3,"events"],[1,"ui:mt-2",3,"value"],[1,"ui:mx-5"],[1,"metadata","ui:mx-5"],["translate",""],[1,"ui:md:flex"],["translate","",1,"ui:flex-grow"],["severity","danger",1,"ui:pr-1"],[1,"ui:text-muted-color","ui:text-sm","ui:justify-items-end"],[1,"ui:md:flex","ui:md:flex-row","ui:flex-col","ui:justify-items-end"],[1,"ui:flex","ui:gap-1","ui:items-center"],[1,"fa","fa-calendar-o"],[1,"fa","fa-clock-o","ui:pl-1"],[1,"ui:flex","ui:items-center","ui:justify-center","ui:text-white","ui:rounded-full","ui:z-10","ui:shadow-sm","ui:bg-red-500","ui:w-[1.3rem]","ui:h-[1.3rem]"],[1,"fa","fa-check"]],template:function(l,p){l&1&&v(0,xt,17,14,"div",3),l&2&&f(p.record()?0:-1)},dependencies:[L,Ie,Be,Me,J,U,G,O,Re,Q,V,q,Fe],styles:["[_nghost-%COMP%] .p-timeline-event-opposite{max-width:250px}"],changeDetection:0});let e=n;return e})();export{Cn as PatronProfileFeeComponent};