UNPKG

@dbp-topics/greenlight

Version:

[GitHub Repository](https://github.com/digital-blueprint/greenlight-frontend) | [npmjs package](https://www.npmjs.com/package/@dbp-topics/greenlight) | [Unpkg CDN](https://unpkg.com/browse/@dbp-topics/greenlight/) | [Greenlight Bundle](https://gitlab.tugr

114 lines (110 loc) 6.89 kB
let e,t,i,s,n,r=e=>e;function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},a.apply(this,arguments)} /*! * License: LGPL-2.1-or-later * Dependencies: * * @webcomponents/scoped-custom-element-registry: 0.0.7 (BSD-3-Clause) * @dbp-toolkit/app-shell: 0.3.3 (LGPL-2.1-or-later) * @dbp-toolkit/language-select: 0.3.1 (LGPL-2.1-or-later) * @dbp-toolkit/common: 0.3.4 (LGPL-2.1-or-later) * @dbp-toolkit/auth: 0.3.1 (LGPL-2.1-or-later) * event-target-shim: 6.0.2 (MIT) * @dbp-toolkit/notification: 0.3.1 (LGPL-2.1-or-later) * @dbp-toolkit/theme-switcher: 0.0.5 (LGPL-2.1-or-later) * path-to-regexp: 6.2.0 (MIT) * universal-router: 9.1.0 (MIT) * generateUrls: 9.1.0 (MIT) * @dbp-toolkit/matomo: 0.2.6 (LGPL-2.1-or-later) * @tugraz/web-components: 0.3.6 (LGPL-2.1-or-later) * @babel/runtime: 7.20.13 (MIT) * i18next: 22.4.9 (MIT) * @lit/reactive-element: 1.6.1 (BSD-3-Clause) * lit-html: 2.6.1 (BSD-3-Clause) * lit-element: 3.2.2 (BSD-3-Clause) * @open-wc/dedupe-mixin: 1.3.1 (MIT) * @open-wc/scoped-elements: 2.1.4 (MIT) * jose: 4.11.2 (MIT) * @dbp-toolkit/file-handling: 0.3.5 (LGPL-2.1-or-later) * webdav: 4.8.0 (MIT) * tabulator-tables: 5.1.8 (MIT) * file-saver: 2.0.5 (MIT) * @dbp-toolkit/qr-code-scanner: 0.3.1 (LGPL-2.1-or-later) * async-mutex: 0.4.0 (MIT) * pdfjs-dist: 2.16.105 (Apache-2.0) * dommatrix: 1.0.3 (MIT) * web-streams-polyfill: 3.2.1 (MIT) * mockdate: 3.0.5 (MIT) * certlogic-js: 1.2.2 (Apache-2.0) * string-similarity: 4.0.4 (ISC) * @popperjs/core: 2.11.5 (MIT) * tippy.js: 6.3.7 (MIT) * @dbp-toolkit/tooltip: 0.0.3 (LGPL-2.1-or-later) * qrcode-generator: 1.4.4 (MIT) */import{S as c,i as o,g as l,e as h,N as d,f as p,j as m,t as u,n as g,y as k,o as f,m as w}from"./shared/notification.23e517da.es.js";import{D as b,g as y}from"./shared/dbp-greenlight-ticket-lit-element.6a6b9129.es.js";import{A as $,z as v,B as T}from"./shared/activity.bd47f9d0.es.js";import{T as R}from"./shared/textswitch.aac4259d.es.js";var j={element:"dbp-show-reference-ticket",module_src:"dbp-show-reference-ticket.js",routing_name:"show-reference-ticket",name:{de:"Referenzticket anzeigen",en:"Show reference ticket"},short_name:{de:"Referenzticket anzeigen",en:"Show reference ticket"},description:{de:"Hier können Überprüfende das aktuell gültige Referenzticket zum Zweck der Kontrolle einsehen.",en:"Here, verifiers can view the currently valid reference ticket for the purpose of control."},subscribe:"lang,entry-point-url,auth,html-overrides,ticket-types"};class x extends(c(b)){constructor(){super(),this.activity=new $(j),this.locationName=this._i18n.t("show-reference-ticket.place-name")}static get scopedElements(){return a({},super.scopedElements,{"dbp-textswitch":R})}static get properties(){return a({},super.properties,{locationName:{type:String,attribute:!1}})}async updateTicket(){if(!1===this.ticketOpen)return!1;let e=await this.getReferenceTicketRequest(),t="";try{t=await e.clone().json()}catch(e){return this.setTimeoutIsSet=!1,this.showReloadButton=!0,!1}return 200===e.status?(this.sendSuccessAnalyticsEvent("UpdateReferenceTicketRequest","Success",""),this.showReloadButton=!1,this.ticketImage=t["hydra:member"][0].image||"",this.setTimer(1e3*t["hydra:member"][0].imageValidFor+1e3),!0):(this.sendErrorAnalyticsEvent("UpdateReferenceTicketRequest","UnknownError","",e),console.log("Update reference ticket failed"),this.setTimeoutIsSet=!1,this.showReloadButton=!0,!1)}async getReferenceTicketRequest(){return await this.httpGetAsync(v(this.entryPointUrl,"/greenlight/reference-permits?page=1"),{method:"GET",headers:{"Content-Type":"application/ld+json"}})}async showTicket(){this.ticketLoading=!0,await this.openTicket("ShowReferenceTicket"),await this.updateTicket(),this.ticketLoading=!1}static get styles(){return o(e||(e=r` ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} .color-switch { margin-top: 0.5rem; } .ticket { column-gap: 20px; } `),l(),h(!1),d(),p(),T(),m(),u(),g(),y())}render(){const e=this._i18n,a=k(t||(t=r` <div class="information-container ${0}"> <slot name="information-container"> <h4>${0}</h4> ${0} </slot> </div> `),f({hidden:this.ticketLoading}),e.t("show-reference-ticket.information-container-headline"),e.t("show-reference-ticket.information-container-body")),c=k(i||(i=r` <div class="ticket"> <span class="header"> <h3> <slot name="place">${0}: ${0}</slot> </h3> <span class="header"> <slot name="ticket-description"> <span>${0}</span> </slot> </span> </span> <div class="btn"> <dbp-loading-button type="is-primary" @click="${0}" title="${0}"> ${0} </dbp-loading-button> <dbp-loading-button id="delete-btn" value="${0}" disabled> ${0} </dbp-loading-button> </div> </div> `),e.t("entry-ticket"),this.locationName,e.t("show-reference-ticket.description"),(()=>{this.showTicket()}),e.t("show-btn-text"),e.t("show-btn-text"),e.t("delete-btn-text"),e.t("delete-btn-text"));let o=null;if(this._hasMultipleTicketTypes()){let t=e=>{let t=e.target.name;this.forceTicketGrayscale="grayscale"===t};o=k(s||(s=r` <dbp-textswitch name="${0}" class="color-switch" name1="color" name2="grayscale" value1="${0}" value2="${0}" @change=${0}></dbp-textswitch> `),this.forceTicketGrayscale?"grayscale":"color",e.t("show-reference-ticket.switch-label-in-color"),e.t("show-reference-ticket.switch-label-in-grayscale"),(e=>t(e)))}const l=this.isLoading();return k(n||(n=r` <div class="control ${0}"> <span class="loading"> <dbp-mini-spinner text=${0}></dbp-mini-spinner> </span> </div> ${0} `),f({hidden:!this.isLoading()}),e.t("loading-message"),this.getTicketUI(l,c,a,o))}}w("dbp-show-reference-ticket",x); //# sourceMappingURL=dbp-show-reference-ticket.js.map