1import{C as s,P as n,m as o}from"./polyfazer-app-DumDTOPg.js";import{h as d}from"./polymer-utils-B8xivS0d.js";import{l as r}from"./location-devices-services-DOIHqY9r.js";import"./device-details-DwkT8GFP.js";import"./image-frame-DZbP5vtK.js";import{P as a}from"./page-toolbar-C-8EZufE.js";import"./main-BEpca-0G.js";import"./BetterHTML-BN6nzApa.js";import"./BetterTemplateHandling-CTXk4mRb.js";import"./lang-helper-behavior-D3p_DZHb.js";import"./ExtendedDate-BLMVein7.js";import"./connector-icons-CU2MvAxY.js";import"./question-tag-C9ym_uv9.js";import"./paper-shrink-menu-C7LnALvz.js";import"./diamond-icon-button-AIbsxFeD.js";import"./BetterPolymerElement-Dg3wVY7D.js";import"./tippy-tooltip-BFt4tVnx.js";class l extends s(n){static get template(){return d` 2 ${super.template} 3 <style> 4 :host { 5 display: block; 6 height: 100%; 7 width: 100%; 8 position: relative; 9 } 10 11 device-details { 12 --device-details-header: { 13 background: var(--surface-color); 14 color: var(--on-surface-color); 15 margin: 0 0 10px; 16 padding: 20px; 17 box-shadow: var(--shadow-elevation-2dp_-_box-shadow); 18 } 19 } 20 21 .photos { 22 padding: 15px; 23 flex-wrap: wrap; 24 } 25 26 .photo { 27 height: 100px; 28 width: 130px; 29 margin: 7px; 30 position: relative; 31 background: var(--surface-color); 32 border-radius: var(--block-border-radius); 33 border: 1px solid var(--primary-border-color); 34 overflow: hidden; 35 padding: 10px; 36 } 37 </style> 38 39 <page-toolbar 40 pending="[[or(loading, sending)]]" 41 error="[[error]]" 42 return-href="/locations/[[locationID]]/devices" 43 > 44 <dom-restricted restricted="${o.LOCATIONS_EDIT}"> 45 <template> 46 <paper-shrink-menu slot="action-buttons" show-labels> 47 ${a.ACTION_BUTTON.delete({action:"_deleteDevice"})} 48 ${a.ACTION_BUTTON.edit({href:"/locations/[[locationID]]/device/[[deviceID]]/edit"})} 49 </paper-shrink-menu> 50 </template>
51 </dom-restricted> 52 </page-toolbar> 53 54 <div class="content-wrap"> 55 <diamond-section-overlay loading="[[loading]]" error="[[error]]" on-retry="refresh"></diamond-section-overlay> 56 57 <device-details device="[[device]]" edit-root-url="/locations/[[locationID]]/device/[[device.id]]" can-modify="[[_canEditDevice]]"> 58 <template is="dom-if" if="[[device.template.images.length]]"> 59 <div class="photos-section" slot="header-suffix"> 60 <h2>[[_lang('photos')]]</h2> 61 62 <div class="photos flex-row vertical-center"> 63 <template is="dom-repeat" items="[[device.template.images]]" sort="sortByIdDesc"> 64 <image-frame class="photo" image="[[item]]"></image-frame> 65 </template> 66 </div> 67 </div> 68 </template> 69 </device-details> 70 </div> 71 `}static get properties(){return{loading:Boolean,error:Object,locationID:Number,deviceID:Number,device:Object,_canEditDevice:Boolean}}connectedCallback(){super.connectedCallback(),window.locationDeviceDetail=this,this.registerRestrictionReflector("_canEditDevice",o.LOCATIONS_EDIT)}onPageEnter(){this.setRoleAndPermissionData()}init(t){let{locationID:i,deviceID:e}=t.params;e=parseInt(e),this.set("locationID",parseInt(i)),e!=this.get("deviceID")&&(this.set("deviceID",e),this.refresh())}refresh(){this.clearErrorFromResponse(),this.set("loading",!0);let{locationID:t,deviceID:i}=this;r(t).getItem(i).then(e=>{this.set("device",e)},e=>{window.toaster.show(this._lang("entityLoadError")),this.setErrorFromResponse(e)}).finally(()=>{this.set("loading",!1)})}_deleteDevice(){let{locationID:t,deviceID:i,device:e}=this;window.confirmDialog({title:this._lang("deleteDevice"),message:this._lang("deleteDeviceMessage"),entity:e.name}).then(()=>{this.set("sending",!0),r(t).deleteItem(i).then(()=>{this.invalidateListingData("location-devices"),window.toaster.show(this._lang("entityDeletedSuccess")),page.redirect(`/locations/${this.get("locationID")}/devices`)},()=>{window.toaster.show(this._lang("entityDeletedError"))}).finally(()=>this.set("sending",!1))})}}window.customElements.define("location-device-detail",l); 72//# sourceMappingURL=location-device-detail-B02kdJ15.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.