UNPKG

@rero/rero-ils-ui

Version:

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

2 lines (1 loc) 2.01 kB
import{a as v}from"./chunk-7VMGNKDP.js";import{aa as C,h as g}from"./chunk-4GRLSOJZ.js";import{Ua as f,Wa as u}from"./chunk-MTJX6JRK.js";import{d as h,i as m}from"./chunk-4MYHQLZQ.js";import{J as p,da as l,ia as o,r as s,v as n}from"./chunk-3WD6XLXL.js";var N=(()=>{class i{constructor(){this.appConfigService=o(v),this.apiService=o(f),this.recordService=o(u),this.httpClient=o(m),this.httpClientOptions={headers:new h({"Content-Type":"application/json"})}}static{this.RESOURCE_NAME="items"}getItemsByHoldings(e,t,r=10,a=""){let c=`holding.pid:${e.metadata.pid}`,d="";switch(e.metadata.holdings_type){case"serial":c+=" AND -issue.status:(claimed OR deleted OR late)",d="-issue_sort_date";break;case"standard":d="enumeration_chronology";break}return a!==""&&(c+=` AND (enumerationAndChronology.analyzed:"${a}" OR call_numbers:(*${a}*) OR barcode:(*${a}*))`),this.recordService.getRecords(i.RESOURCE_NAME,{query:c,page:t,itemsPerPage:r,headers:g.reroJsonheaders,sort:d}).pipe(p(()=>s(C)),n(E=>E))}getItem(e,t=!1){return this.recordService.getRecord(i.RESOURCE_NAME,e,t?{resolve:1}:void 0).pipe(n(r=>r.metadata))}updateLocation(e,t){return e.location.$ref=this.apiService.getRefEndpoint("locations",t),this.recordService.update(i.RESOURCE_NAME,e.pid,e)}getStatsByItemPid(e){return this.httpClient.get(`${this.appConfigService.apiEndpointPrefix}/item/${e}/stats`)}getPreviewByItemPid(e){return this.httpClient.get(`${this.appConfigService.apiEndpointPrefix}/item/${e}/issue/claims/preview`,this.httpClientOptions).pipe(p(t=>s({error:t.error.message})))}addClaimIssue(e,t){let r=`${this.appConfigService.apiEndpointPrefix}/item/${e}/issue/claims`;return this.httpClient.post(r,{recipients:t}).pipe(n(()=>!0),p(()=>s(!1)))}getAvailability(e){let t=`${this.appConfigService.apiEndpointPrefix}/item/${e}/availability?more_info=1`;return this.httpClient.get(t)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=l({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();export{N as a};