cityssm/lottery-licence-manager

View on GitHub
public/javascripts/licence-activeSummary.min.js

Summary

Maintainability
A
0 mins
Test Coverage
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=document.querySelector("main").dataset.urlPrefix;let t="";const a=document.querySelector("#form--activeSummary"),i=document.querySelector("#container--activeSummary"),n=()=>{i.innerHTML='<p class="has-text-centered has-text-grey-lighter"><i class="fas fa-3x fa-circle-notch fa-spin" aria-hidden="true"></i><br /><em>Loading licences...</em></p>',cityssm.postJSON(e+"/licences/doGetActiveLicenceSummary",a,e=>{if(0===e.length)return void(i.innerHTML='<div class="message is-info"><p class="message-body">There are no active licences on the selected time range.</p></div>');const a=document.createElement("table");a.className="table is-striped is-hoverable is-fullwidth has-sticky-header",a.innerHTML="<thead><tr><th>"+t+"</th><th>Licence Type</th><th>Organization</th><th>Location</th><th>Issue Date</th><th>Licence Start Date</th><th>Licence End Date</th></tr></thead>";const n=document.createElement("tbody");for(const t of e){const e=document.createElement("tr");e.innerHTML='<td><a href="/licences/'+t.licenceID.toString()+'" data-tooltip="View Licence">'+cityssm.escapeHTML(t.externalLicenceNumber)+"<br /><small>Licence #"+t.licenceID.toString()+"</small></a></td><td>"+(exports.config_licenceTypes[t.licenceTypeKey]||t.licenceTypeKey)+'</td><td><a href="/organizations/'+t.organizationID.toString()+'" data-tooltip="View Organization">'+cityssm.escapeHTML(t.organizationName)+"</a></td><td>"+(t.locationID?'<a href="/locations/'+t.locationID.toString()+'" data-tooltip="View Location">'+cityssm.escapeHTML(t.locationDisplayName)+"</a>"+(t.locationDisplayName===t.locationName?"<br /><small>"+cityssm.escapeHTML(t.locationAddress1)+"</small>":""):'<span class="has-text-grey">(No Location)</span>')+'</td><td class="is-nowrap">'+t.issueDateString+'</td><td class="is-nowrap"><span class="icon"><i class="fas fa-play" aria-hidden="true"></i></span> '+t.startDateString+'</td><td class="is-nowrap"><span class="icon"><i class="fas fa-stop" aria-hidden="true"></i></span> '+t.endDateString+"</td>",n.append(e)}a.append(n),cityssm.clearElement(i),i.append(a)})};llm.initializeDateRangeSelector(document.querySelector(".is-date-range-selector[data-field-key='startEndDate']"),n),llm.getDefaultConfigProperty("externalLicenceNumber_fieldLabel",e=>{t=e,n()})})();