@rero/rero-ils-ui
Version:
User interface for RERO integrated library system (RERO ILS).
2 lines (1 loc) • 7.91 kB
JavaScript
import{a as Se}from"./chunk-JHKYMKED.js";import{a as B,b as O}from"./chunk-FCC5WNRC.js";import{a as fe}from"./chunk-BR2J44KJ.js";import{a as ve}from"./chunk-CGU6MK6Q.js";import{R as he,Y as Ce,j as I}from"./chunk-4GRLSOJZ.js";import{Eb as F,Ma as de,Oa as ce,Ta as pe,Wa as me,gc as ue,hc as ge,mc as _e}from"./chunk-MTJX6JRK.js";import{b as ae,c as le}from"./chunk-GQ5FIRIY.js";import{la as se}from"./chunk-4MYHQLZQ.js";import{va as re}from"./chunk-WKOKZ3JO.js";import{$b as H,Ca as Q,Db as x,Fa as S,Fb as X,Hc as g,Ic as M,J as G,Kc as ie,N as W,Ob as Z,Pb as z,Q as J,Vb as d,X as q,Xb as c,Yb as P,_b as b,a as N,ac as p,b as V,bc as l,cc as s,dc as f,dd as y,ed as ne,gb as r,gd as R,h as U,hc as K,ia as u,ic as Y,jc as ee,kc as te,m as j,oa as T,pa as w,r as h,rc as E,sc as a,v as D,vd as A,yb as C,zd as oe}from"./chunk-3WD6XLXL.js";function Te(t,i){if(t&1&&(l(0,"li"),g(1),s()),t&2){let e=i.$implicit;r(),M(e.issue)}}function we(t,i){if(t&1&&(l(0,"li"),g(1),s()),t&2){let e=i.$implicit;r(),M(e.issue)}}function Pe(t,i){if(t&1&&(l(0,"ul",7),b(1,Te,2,1,"li",null,P),y(3,"slice"),s(),g(4," \u2026 "),l(5,"ul",7),b(6,we,2,1,"li",null,P),y(8,"slice"),s()),t&2){let e=a(2);r(),H(R(3,0,e.serialPreviewExamples,0,10)),r(5),H(R(8,4,e.serialPreviewExamples,97,100))}}function be(t,i){t&1&&(l(0,"span",6),g(1,"No preview available"),s())}function He(t,i){if(t&1&&d(0,Pe,9,8)(1,be,2,0,"span",6),t&2){let e=a();c(e.serialPreviewExamples&&e.serialPreviewExamples.length>0?0:1)}}function Me(t,i){if(t&1&&(l(0,"span",5),g(1),y(2,"translate"),s()),t&2){let e=a();r(),ie("",ne(2,2,"Template"),"\xA0",e.serialPreviewError.status)}}var L=(()=>{class t extends ce{constructor(){super(...arguments),this.cdr=u(oe),this.editorService=u(Se),this.canDeactivate=!1,this.model={},this.serialPreviewExamples=[],this.serialPatternsTemplate=null,this.numberOfSerialPreviewExamples=100,this.serialPreviewError=null,this.predictionModel$=new j({}),this.subscription=new U}ngOnInit(){this.subscription=this.predictionModel$.pipe(W(500),J((e,n)=>JSON.stringify(e.patterns)===JSON.stringify(n.patterns)),q(e=>this.editorService.getHoldingPatternPreview(e,this.numberOfSerialPreviewExamples).pipe(G(n=>{if(n.status===400)return this.serialPreviewError=n.error,h(null)})))).subscribe(e=>{e&&e.length>0&&(this.serialPreviewExamples=e),this.cdr.markForCheck()})}ngOnDestroy(){this.subscription.unsubscribe()}modelChanged(e){e=pe(e),e.patterns&&e.patterns.template?(this.serialPatternsTemplate=e.patterns.template,this.serialPreviewError=null,this.serialPreviewExamples=[],this.predictionModel$.next(e)):(this.serialPreviewExamples=[],this.serialPatternsTemplate=null)}canDeactivateChanged(e){this.canDeactivate=e}static{this.\u0275fac=(()=>{let e;return function(o){return(e||(e=S(t)))(o||t)}})()}static{this.\u0275cmp=C({type:t,selectors:[["admin-holding-editor"]],features:[x],decls:8,vars:2,consts:[[1,"ui:grid","ui:gap-4"],[3,"modelChange","canDeactivateChange","model"],["beforeTableOfContent","",1,"ui:w-full","ui:mb-3"],["translate","",1,"ui:font-bold","ui:mb-1"],[1,"ui:ml-2"],[1,"ui:text-red-500"],["translate",""],[1,"ui:list-none"]],template:function(n,o){n&1&&(l(0,"div",0)(1,"ng-core-editor",1),E("modelChange",function(_){return o.modelChanged(_)})("canDeactivateChange",function(_){return o.canDeactivateChanged(_)}),l(2,"div",2)(3,"div",3),g(4,"Predictions"),s(),l(5,"div",4),d(6,He,2,1)(7,Me,3,4,"span",5),s()()()()),n&2&&(r(),p("model",o.model),r(5),c(o.serialPreviewError?7:6))},dependencies:[_e,ae,re,le],encapsulation:2,changeDetection:0})}}return t})();var Re=()=>[import("./chunk-ADKTPXX3.js").then(t=>t.SerialHoldingDetailViewComponent)];function Ae(t,i){if(t&1&&f(0,"admin-serial-holding-detail-view",0),t&2){let e=a();p("holding",e.record())}}var Ee=(()=>{class t{constructor(){this.router=u(se),this.record=A(),this.type=A(""),Q(()=>{let e=this.record();e&&e.metadata.holdings_type!=="serial"&&this.router.navigate(["/errors/403"],{skipLocationChange:!0})})}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=C({type:t,selectors:[["admin-holding-detail-view"]],inputs:{record:[1,"record"],type:[1,"type"]},decls:3,vars:1,consts:[[3,"holding"]],template:function(n,o){n&1&&(X(0,Ae,1,1),Z(1,0,Re)),n&2&&(r(),z(o.record()))},encapsulation:2,changeDetection:0})}}return t})();function Fe(t,i){if(t&1&&f(0,"shared-operation-logs-dialog",5),t&2){let e,n=a(3);p("resourcePid",(e=n.record())==null?null:e.metadata.pid)}}function Ie(t,i){if(t&1&&d(0,Fe,1,1,"shared-operation-logs-dialog",5),t&2){let e,n=a(2);c(n.appStore.isLogVisible("holdings")&&((e=n.record())!=null&&e.metadata.pid)?0:-1)}}function Be(t,i){if(t&1){let e=te();l(0,"ng-core-detail-button",3),E("recordEvent",function(o){T(e);let m=a();return w(m.recordEvent(o))})("deleteMessageEvent",function(o){T(e);let m=a();return w(m.showDeleteMessage(o))}),K(1,4),d(2,Ie,1,1),Y(),s()}if(t&2){let e=a();p("record",e.record())("type",e.type())("adminMode",e.adminMode())("useStatus",e.useStatus())("updateStatus",e.updateStatus())("deleteStatus",e.deleteStatus()),r(2),c(e.record()?2:-1)}}function Oe(t,i){if(t&1&&f(0,"ng-core-error",2),t&2){let e=a();p("error",e.error())}}var ye=(()=>{class t extends ge{constructor(){super(...arguments),this.appStore=u(he)}static{this.\u0275fac=(()=>{let e;return function(o){return(e||(e=S(t)))(o||t)}})()}static{this.\u0275cmp=C({type:t,selectors:[["admin-holding-page-detail"]],features:[x],decls:4,vars:2,consts:[["dynamicHost",""],[3,"record","type","adminMode","useStatus","updateStatus","deleteStatus"],[3,"error"],[3,"recordEvent","deleteMessageEvent","record","type","adminMode","useStatus","updateStatus","deleteStatus"],["beforeButton",""],["resourceType","holdings",3,"resourcePid"]],template:function(n,o){n&1&&(d(0,Be,3,7,"ng-core-detail-button",1),d(1,Oe,1,1,"ng-core-error",2),ee(2,null,0)),n&2&&(c(o.record()?0:-1),r(),c(o.error()?1:-1))},dependencies:[ue,Ce,de],encapsulation:2,changeDetection:0})}}return t})();var _t=()=>new $().getTypes(),ht=[{path:"detail/:pid",component:ye,title:"Holdings",canActivate:[O],data:{action:B.READ}},{path:"edit/:pid",component:L,title:"Holding",canActivate:[O],canDeactivate:[F],data:{action:B.UPDATE}},{path:"new",component:L,title:"Holding",canActivate:[fe],canDeactivate:[F],data:{permissions:[I.HOLD_CREATE]}}],$=class extends ve{constructor(){super(...arguments),this.name="holdings",this.recordType="holdings"}getTypes(){return[{key:this.name,label:"Holdings",editorSettings:{longMode:!0,template:{recordType:"templates",loadFromTemplate:!0,saveAsTemplate:!0}},detailComponent:Ee,canRead:i=>this.canRead(i),canAdd:()=>h({can:this.routeToolService.appStore.canAccess(I.HOLD_CREATE)}),permissions:i=>this.routeToolService.permissions(i,this.recordType,!0),preCreateRecord:i=>(i.document={$ref:this.routeToolService.apiService.getRefEndpoint("documents",this.routeToolService.getRouteQueryParam("document"))},i),formFieldMap:(i,e)=>this.populateLocationsByCurrentUserLibrary(i,e),deleteMessage:()=>[this.routeToolService.translateService.instant("Do you really want to delete this record?"),this.routeToolService.translateService.instant("This will also delete all items and issues of the holdings.")],redirectUrl:(i,e)=>e==="delete"?h(`/records/documents/detail/${i.metadata.document.pid}`):h(`/records/holdings/detail/${i.metadata.pid}`)}]}populateLocationsByCurrentUserLibrary(i,e){return e.widget?.formlyConfig?.props?.fieldMap==="location"&&(i.type="select",i.hooks=V(N({},i.hooks),{afterContentInit:o=>{let m=this.routeToolService.apiService,_=this.routeToolService.recordService,De=`library.pid:${this.routeToolService.appStore.currentLibraryPid()}`;o.props.options=_.getRecords("locations",{query:De,page:1,itemsPerPage:me.MAX_REST_RESULTS_SIZE,sort:"name"}).pipe(D(v=>+_.totalHits(v.hits.total)==0?[]:v.hits.hits),D(v=>v.map(k=>({label:k.metadata.name,value:m.getRefEndpoint("locations",k.metadata.pid)}))))}})),i}};export{_t as a,ht as b};