uomlibraryapps-card-scanner-hybrid-local
Version:
Library Node.js app for UoM card scanning (hybrid-local)
1 lines • 12.3 kB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{pkyO:function(e,t,n){"use strict";n.r(t);var i=n("8Y7J");class l{}var o=n("pMnS"),s=n("A9Ix"),a=n("8Nsy"),d=n("RD68"),r=n("PE8+"),c=n("hIhI"),u=n("aoTd"),h=n("frcY"),b=n("8Ouj"),v=n("cUpR"),S=n("lcbv"),m=n("KoWe"),p=n("mrSG"),g=n("GJ2u"),f=n("YGig");class y extends g.a{constructor(e,t,n,l){super(),this.delayedService=e,this.snackService=t,this.restMediaService=n,this.restHybridLocalService=l,this.onImported=new i.m(!0),this.busy=!1,this.files=[]}doMediaChanged(e){return p.a(this,void 0,void 0,(function*(){this.media=e,this.files=[],this.file=void 0,this.files=this.media?(yield this.restMediaService.listFiles(this.media,"json")).map(e=>({filename:e})):[]}))}doImport(){return p.a(this,void 0,void 0,(function*(){if(this.media&&!(void 0===this.file||this.file>=this.files.length)){this.delayedService.delayed("import"),this.busy=!0;try{yield this.restHybridLocalService.importEventSession(this.media,this.files[this.file].filename),this.delayedService.done("import"),this.snackService.success("Imported event successfully"),this.onImported.emit()}catch(e){this.delayedService.fail("import"),this.snackService.error(e instanceof f.a?"That event session already exists":"Unable to import from file")}finally{this.busy=!1}}}))}}var w=n("eBf0"),k=n("+o9E"),z=i.ob({encapsulation:0,styles:[[".buttons[_ngcontent-%COMP%]{margin-top:20px}"]],data:{}});function E(e){return i.Lb(0,[(e()(),i.qb(0,0,null,null,9,"pi-kiosk-media-drawer",[],null,[[null,"onMediaChanged"],[null,"onBusy"]],(function(e,t,n){var i=!0,l=e.component;return"onMediaChanged"===t&&(i=!1!==l.doMediaChanged(n)&&i),"onBusy"===t&&(i=!1!==(l.busy=n)&&i),i}),c.d,c.b)),i.pb(1,4440064,null,0,u.e,[r.q,r.k,u.b],{name:[0,"name"],title:[1,"title"]},{onMediaChanged:"onMediaChanged",onBusy:"onBusy"}),(e()(),i.qb(2,0,null,0,3,"table",[["commons-table",""]],[[2,"theme-light",null],[2,"theme-dark",null]],[[null,"selectedChange"]],(function(e,t,n){var i=!0;return"selectedChange"===t&&(i=!1!==(e.component.file=n)&&i),i}),h.b,h.a)),i.pb(3,4964352,null,0,b.b,[v.b,S.i],{header:[0,"header"],data:[1,"data"],rowSelectable:[2,"rowSelectable"],selected:[3,"selected"],maxHeight:[4,"maxHeight"]},{selectedChange:"selectedChange"}),i.Eb(4,{name:0,caption:1,width:2}),i.Cb(5,1),(e()(),i.qb(6,0,null,0,3,"section",[["class","buttons"]],null,null,null,null,null)),(e()(),i.qb(7,0,null,null,2,"button",[["class","filled"],["commons-button",""]],[[8,"disabled",0],[2,"theme-light",null],[2,"theme-dark",null]],[[null,"click"]],(function(e,t,n){var i=!0;return"click"===t&&(i=!1!==e.component.doImport()&&i),i}),m.d,m.a)),i.pb(8,4440064,null,0,S.b,[S.i],null,null),(e()(),i.Jb(-1,0,["Import"]))],(function(e,t){var n=t.component;e(t,1,0,"import","Import from USB pen drive");var i=e(t,5,0,e(t,4,0,"filename","Available files","100%"));e(t,3,0,i,n.files,!n.busy,n.file,4),e(t,8,0)}),(function(e,t){var n=t.component;e(t,2,0,i.Bb(t,3).isThemeLight,i.Bb(t,3).isThemeDark),e(t,7,0,n.busy||void 0===n.media||void 0===n.file,i.Bb(t,8).isThemeLight,i.Bb(t,8).isThemeDark)}))}var A=n("tgeb"),C=n("Bkf3"),x=n("IJyt"),B=n("WB8P");class q extends g.a{constructor(e,t,n,i){super(),this.delayedService=e,this.snackService=t,this.drawerService=n,this.restHybridLocalService=i,this.busy=!1}ngOnInit(){this.subscribe(this.drawerService.showObservable(),e=>p.a(this,void 0,void 0,(function*(){"export"===e&&(this.filename=`${B.CommonsDate.dateTodmYHi(new Date).replace(/[\/:]/g,"-").replace(" ","_")}.csv`)})))}doMediaChanged(e){return p.a(this,void 0,void 0,(function*(){this.media=e}))}doExport(){return p.a(this,void 0,void 0,(function*(){if(this.media&&this.filename&&this.eventSession){this.delayedService.delayed("export"),this.busy=!0;try{yield this.restHybridLocalService.exportEventSession(this.media,this.eventSession,this.filename),this.delayedService.done("export"),this.snackService.success("Exported event successfully")}catch(e){this.delayedService.fail("export"),this.snackService.error("Unable to export to file")}finally{this.busy=!1}}}))}}var I=i.ob({encapsulation:0,styles:[[""]],data:{}});function M(e){return i.Lb(0,[(e()(),i.qb(0,0,null,null,7,"pi-kiosk-media-drawer",[],null,[[null,"onMediaChanged"],[null,"onBusy"]],(function(e,t,n){var i=!0,l=e.component;return"onMediaChanged"===t&&(i=!1!==l.doMediaChanged(n)&&i),"onBusy"===t&&(i=!1!==(l.busy=n)&&i),i}),c.d,c.b)),i.pb(1,4440064,null,0,u.e,[r.q,r.k,u.b],{name:[0,"name"],title:[1,"title"]},{onMediaChanged:"onMediaChanged",onBusy:"onBusy"}),(e()(),i.qb(2,0,null,0,1,"commons-textbox",[],[[2,"theme-light",null],[2,"theme-dark",null],[2,"forefront",null]],null,null,A.f,A.c)),i.pb(3,4440064,null,0,C.e,[S.i,x.r],{placeholder:[0,"placeholder"],editable:[1,"editable"],clearable:[2,"clearable"],value:[3,"value"]},null),(e()(),i.qb(4,0,null,0,3,"section",[["class","buttons"]],null,null,null,null,null)),(e()(),i.qb(5,0,null,null,2,"button",[["class","filled"],["commons-button",""]],[[8,"disabled",0],[2,"theme-light",null],[2,"theme-dark",null]],[[null,"click"]],(function(e,t,n){var i=!0;return"click"===t&&(i=!1!==e.component.doExport()&&i),i}),m.d,m.a)),i.pb(6,4440064,null,0,S.b,[S.i],null,null),(e()(),i.Jb(-1,0,["Export"]))],(function(e,t){var n=t.component;e(t,1,0,"export","Export to USB pen drive"),e(t,3,0,"File name",!1,!1,n.filename),e(t,6,0)}),(function(e,t){var n=t.component;e(t,2,0,i.Bb(t,3).isThemeLight,i.Bb(t,3).isThemeDark,i.Bb(t,3).forefront),e(t,5,0,n.busy||void 0===n.media||void 0===n.filename,i.Bb(t,6).isThemeLight,i.Bb(t,6).isThemeDark)}))}class H extends g.a{constructor(e,t,n,i,l,o,s,a,d,r){super(),this.router=e,this.activatedRoute=t,this.delayedService=n,this.dialogService=i,this.drawerService=l,this.snackService=o,this.restEventsService=s,this.restHybridService=a,this.allowScanningService=d,this.eventTitleService=r,this.eventSessionHybrids=[],this.allowAdditional=!1,this.allowSignout=!1,this.allowSignoutEnabled=!1}ngOnInit(){this.subscribe(this.activatedRoute.data,e=>{this.eventSessionHybrids=e.eventSessionHybrids,this.activeEventSession=e.activeEventSession,this.allowAdditional=e.allowAdditional,this.allowSignout=e.allowSignout,this.allowSignoutEnabled=e.allowSignoutEnabled})}doRefresh(){this.router.navigate(["/events"])}doSelect(e){this.activeEventSession=e}getActions(){return[{action:"import",icon:"import",iconSet:S.j.MDI,main:!1},{action:"export",icon:"export",iconSet:S.j.MDI,disabled:!this.eventSessionHybrids||0===this.eventSessionHybrids.length||void 0===this.activeEventSession,main:!1},{action:"delete",icon:"delete",disabled:!this.eventSessionHybrids||0===this.eventSessionHybrids.length||void 0===this.activeEventSession,main:!1},{action:"select",icon:"check",main:!0,disabled:!this.eventSessionHybrids||0===this.eventSessionHybrids.length||void 0===this.activeEventSession}]}doActionButton(e){return p.a(this,void 0,void 0,(function*(){switch(e){case"import":this.drawerService.show("import");break;case"export":this.drawerService.show("export");break;case"select":if(!this.activeEventSession)return;yield this.restEventsService.setActiveEventSession(this.activeEventSession),this.allowScanningService.allowScanning(!0),this.eventTitleService.eventTitle(this.activeEventSession.title),this.router.navigate(["/scan"],{relativeTo:this.activatedRoute});break;case"delete":if(!this.activeEventSession)return;this.doDelete()}}))}doAllowAdditional(){return p.a(this,void 0,void 0,(function*(){console.log("Setting allow additional to",this.allowAdditional),yield this.restEventsService.setAllowAdditional(this.allowAdditional)}))}doAllowSignout(){return p.a(this,void 0,void 0,(function*(){yield this.restEventsService.setAllowSignout(this.allowSignout)}))}doDelete(){this.dialogService.confirm("Delete event","Delete event and its detections from this scanner?",()=>p.a(this,void 0,void 0,(function*(){if(this.activeEventSession){console.log("deleting"),this.delayedService.delayed("delete");try{yield this.restHybridService.deleteEventSession(this.activeEventSession),this.delayedService.done("delete"),this.snackService.success("Deleted event successfully"),this.doRefresh()}catch(e){this.delayedService.fail("delete"),this.snackService.error("Unable to delete event and session")}}})),()=>{})}}var T=n("iInd"),D=n("pGnk"),L=i.ob({encapsulation:0,styles:[["@charset 'utf8';commons-wait-rotate[_ngcontent-%COMP%]{position:fixed;top:130px;right:290px;width:220px;height:220px}"]],data:{}});function R(e){return i.Lb(0,[(e()(),i.qb(0,0,null,null,1,"events-options",[],null,[[null,"allowAdditionalChange"],[null,"allowSignoutChange"]],(function(e,t,n){var i=!0,l=e.component;return"allowAdditionalChange"===t&&(i=!1!==(l.allowAdditional=n)&&i),"allowAdditionalChange"===t&&(i=!1!==l.doAllowAdditional()&&i),"allowSignoutChange"===t&&(i=!1!==(l.allowSignout=n)&&i),"allowSignoutChange"===t&&(i=!1!==l.doAllowSignout()&&i),i}),s.e,s.b)),i.pb(1,4440064,null,0,a.k,[],{allowSignoutEnabled:[0,"allowSignoutEnabled"],allowAdditional:[1,"allowAdditional"],allowSignout:[2,"allowSignout"]},{allowAdditionalChange:"allowAdditionalChange",allowSignoutChange:"allowSignoutChange"}),(e()(),i.qb(2,0,null,null,1,"events-event-table",[],null,[[null,"selectedChange"]],(function(e,t,n){var i=!0,l=e.component;return"selectedChange"===t&&(i=!1!==(l.activeEventSession=n)&&i),"selectedChange"===t&&(i=!1!==l.doSelect(n)&&i),i}),s.d,s.a)),i.pb(3,4964352,null,0,a.h,[],{eventSessions:[0,"eventSessions"],hasDetections:[1,"hasDetections"],selected:[2,"selected"]},{selectedChange:"selectedChange"}),(e()(),i.qb(4,0,null,null,1,"commons-bottom-action-buttons",[],null,[[null,"onAction"]],(function(e,t,n){var i=!0;return"onAction"===t&&(i=!1!==e.component.doActionButton(n)&&i),i}),d.o,d.a)),i.pb(5,4440064,null,0,r.c,[],{actions:[0,"actions"]},{onAction:"onAction"}),(e()(),i.qb(6,0,null,null,1,"app-import",[],null,[[null,"onImported"]],(function(e,t,n){var i=!0;return"onImported"===t&&(i=!1!==e.component.doRefresh()&&i),i}),E,z)),i.pb(7,4440064,null,0,y,[w.b,r.q,u.b,k.a],null,{onImported:"onImported"}),(e()(),i.qb(8,0,null,null,1,"app-export",[],null,null,null,M,I)),i.pb(9,4440064,null,0,q,[w.b,r.q,r.k,k.a],{eventSession:[0,"eventSession"]},null)],(function(e,t){var n=t.component;e(t,1,0,n.allowSignoutEnabled,n.allowAdditional,n.allowSignout),e(t,3,0,n.eventSessionHybrids,!0,n.activeEventSession),e(t,5,0,n.getActions()),e(t,7,0),e(t,9,0,n.activeEventSession)}),null)}function j(e){return i.Lb(0,[(e()(),i.qb(0,0,null,null,1,"ng-component",[],null,null,null,R,L)),i.pb(1,4440064,null,0,H,[T.o,T.a,w.b,x.g,r.k,r.q,a.l,D.d,a.d,a.i],null,null)],(function(e,t){e(t,1,0)}),null)}var O=i.mb("ng-component",H,j,{},{},[]),J=n("SVse"),U=n("IheW"),F=n("s7LF"),G=n("lawv"),W=n("nInh"),K=n("+Bp1"),N=n("o0aZ"),P=n("6Thp"),X=n("dkw+"),Y=n("UMOW"),_=n("GWMK"),V=n("p6ht"),Z=n("SxSA");class ${}n.d(t,"EventsModuleNgFactory",(function(){return Q}));var Q=i.nb(l,[],(function(e){return i.yb([i.zb(512,i.j,i.X,[[8,[o.a,O]],[3,i.j],i.v]),i.zb(4608,J.l,J.k,[i.s,[2,J.v]]),i.zb(4608,U.j,U.p,[J.c,i.z,U.n]),i.zb(4608,U.q,U.q,[U.j,U.o]),i.zb(5120,U.a,(function(e){return[e]}),[U.q]),i.zb(4608,U.m,U.m,[]),i.zb(6144,U.k,null,[U.m]),i.zb(4608,U.i,U.i,[U.k]),i.zb(6144,U.b,null,[U.i]),i.zb(4608,U.g,U.l,[U.b,i.p]),i.zb(4608,U.c,U.c,[U.g]),i.zb(4608,F.i,F.i,[]),i.zb(1073742336,J.b,J.b,[]),i.zb(1073742336,g.d,g.d,[]),i.zb(1073742336,U.e,U.e,[]),i.zb(1073742336,U.d,U.d,[]),i.zb(1073742336,w.e,w.e,[]),i.zb(1073742336,G.b,G.b,[]),i.zb(1073742336,W.g,W.g,[]),i.zb(1073742336,S.k,S.k,[]),i.zb(1073742336,F.h,F.h,[]),i.zb(1073742336,F.c,F.c,[]),i.zb(1073742336,K.b,K.b,[]),i.zb(1073742336,x.A,x.A,[]),i.zb(1073742336,r.E,r.E,[]),i.zb(1073742336,C.f,C.f,[]),i.zb(1073742336,b.c,b.c,[]),i.zb(1073742336,N.h,N.h,[]),i.zb(1073742336,P.l,P.l,[]),i.zb(1073742336,u.a,u.a,[]),i.zb(1073742336,X.e,X.e,[]),i.zb(1073742336,Y.a,Y.a,[]),i.zb(1073742336,f.d,f.d,[]),i.zb(1073742336,_.b,_.b,[]),i.zb(1073742336,V.a,V.a,[]),i.zb(1073742336,Z.h,Z.h,[]),i.zb(1073742336,a.j,a.j,[]),i.zb(1073742336,T.s,T.s,[[2,T.x],[2,T.o]]),i.zb(1073742336,$,$,[]),i.zb(1073742336,l,l,[]),i.zb(256,U.n,"XSRF-TOKEN",[]),i.zb(256,U.o,"X-XSRF-TOKEN",[]),i.zb(1024,T.m,(function(){return[[{path:"",component:H,runGuardsAndResolvers:"always",resolve:{eventSessionHybrids:D.b,activeEventSession:a.b,allowAdditional:a.c,allowSignout:a.f,allowSignoutEnabled:a.e}}]]}),[])])}))}}]);