import{r as t}from"./p-d2af20eb.js";import{a as e}from"./p-25a090c9.js";import{s as i}from"./p-d65a44ad.js";import{w as s}from"./p-1d921be2.js";import"./p-b70d1ec1.js";var n;!function(t){t.APPROVAL="approval",t.PENDING="pending",t.REJECTED="rejected",t.COMPLETED="completed"}(n||(n={}));const r=({orderNumber:t,status:e,createdAt:i,positions:s,orderTotal:r,machine:o,detailLink:l,downloadLink:a})=>{const h=(({type:t,text:e})=>`${e}`)(e);return a?`\n
\n ${t} | \n ${h} | \n ${i} | \n ${s} | \n ${r} | \n ${o} | \n \n \n \n | \n
\n `:`\n \n ${t} | \n ${h} | \n ${i} | \n ${s} | \n ${r} | \n ${o} | \n \n \n | \n
\n `};let o=class{constructor(e){t(this,e),this.url="",this.filterSelector="",this.dateFormSelector="",this.sortFormSelector="",this.tableSelector="",this.uxTabSelector="",this.filteredNumberSelector="",this.scrollSensorSelector="",this.totalNumberPrefix="",this.filter=null,this.filterForm=null,this.dateForm=null,this.sortForm=null,this.table=null,this.tableBody=null,this.filteredNumberElements=null,this.uxTabElement=null,this.nextPage="",this.scrollSensor=null}componentDidLoad(){this.setDateForm(),this.setSortForm(),this.setFilter(),this.setTable(),this.setScrollSensor(),this.setUxTabElement(),this.setFilteredNumberElements(),this.requestData(this.url)}setDateForm(){""!==this.dateFormSelector&&(this.dateForm=document.querySelector(this.dateFormSelector),null!==this.dateForm&&(this.dateForm.addEventListener("submit",(t=>{t.preventDefault(),this.requestData(this.url),this.syncSortStateToTable()})),this.dateForm.addEventListener("change",(()=>{this.requestData(this.url),this.syncSortStateToTable()}))))}setFilter(){""!==this.filterSelector&&(this.filter=document.querySelector(this.filterSelector),s(this.filter,(()=>this.setFilterForm())),this.filter.addEventListener("uxFilterChange",(()=>this.requestData(this.url))))}setSortForm(){""!==this.sortFormSelector&&(this.sortForm=document.querySelector(this.sortFormSelector),null!==this.sortForm&&this.sortForm.addEventListener("submit",l))}setUxTabElement(){""!==this.uxTabSelector&&(this.uxTabElement=document.querySelector(this.uxTabSelector))}setFilteredNumberElements(){""!==this.filteredNumberSelector&&(this.filteredNumberElements=document.querySelectorAll(this.filteredNumberSelector))}setFilterForm(){this.filterForm=this.filter.querySelector("form"),null!==this.filterForm&&this.filterForm.addEventListener("submit",l)}syncSortStateToTable(){if(null===this.table||null===this.sortForm)return;const{value:t}=this.sortForm.querySelector("input"),e=this.table.querySelector('ux-table-sort[sorted-direction="desc"], ux-table-sort[sorted-direction="asc"]');null!==e&&(e.sortedDirection="");const i=this.table.querySelector(`ux-table-sort[asc-name="${t}"]`),s=this.table.querySelector(`ux-table-sort[desc-name="${t}"]`);null!==i&&(i.sortedDirection="asc"),null!==s&&(s.sortedDirection="desc")}updateNumbers(t,e){var i,s;i=this.filteredNumberElements,s=t.toString(),null!==i&&[].forEach.call(i,(t=>t.textContent=s)),this.updateTabNumber(e)}updateTabNumber(t){if(null!=this.uxTabElement){var e="("+t.toString()+")";""!==this.totalNumberPrefix&&(e=this.totalNumberPrefix+" ("+t.toString()+")"),this.uxTabElement.name=e}}setTable(){var t;""!==this.tableSelector&&(this.table=document.querySelector(this.tableSelector),this.tableBody=null===(t=this.table)||void 0===t?void 0:t.querySelector("tbody"),null!==this.table&&null!==this.sortForm&&(this.table.addEventListener("uxTableSort",(t=>{const e=t.detail;""!==e&&(this.sortForm.querySelector("input").value=e,this.requestData(this.url))})),this.syncSortStateToTable()))}setScrollSensor(){""!==this.scrollSensorSelector&&(this.scrollSensor=document.querySelector(this.scrollSensorSelector),null!==this.scrollSensor&&this.scrollSensor.addEventListener("uxInfiniteScrollSensorScrolledIntoView",(()=>{this.requestData(this.nextPage)})))}initialRequest(){this.requestData(this.url)}getSerializedFormData(){return[i(this.dateForm),i(this.filterForm),i(this.sortForm)].filter((t=>""!==t)).join("&")}requestData(t){if(""===t)return;const i=function(t){return t.indexOf("mock-data/")>-1}(t)?{}:{method:"POST",body:this.getSerializedFormData(),headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}};e(t,i).then((e=>{this.url===t&&this.clearExistingData(),this.appendItemsToTable(e.items),this.updateNumbers(e.filteredCount,e.totalCount),this.nextPage=e.nextPage||"",""!==this.nextPage&&null!==this.scrollSensor&&(this.scrollSensor.hasFired=!1)}))}clearExistingData(){null!==this.tableBody&&(this.tableBody.textContent="")}appendItemsToTable(t){null!==this.tableBody&&this.tableBody.insertAdjacentHTML("beforeend",t.map(r).join(""))}render(){return null}static get watchers(){return{dateFormSelector:["setDateForm"],filterSelector:["setFilter"],sortFormSelector:["setSortForm"],uxTabSelector:["setUxTabElement"],filteredNumberSelector:["setFilteredNumberElements"],tableSelector:["setTable"],scrollSensorSelector:["setScrollSensor"],url:["initialRequest"]}}};function l(t){t.preventDefault()}o.style='.ux-iws-shop-item-overview__filter-container::before,.ux-iws-shop-item-overview__filter-container::after{content:" ";display:table}.ux-iws-shop-item-overview__filter-container::after{clear:both}.ux-iws-shop-item-overview__filter-container .ux-tag{background-color:#285172}.ux-iws-shop-item-overview__filter-container .datepicker-range{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-align:center;align-items:center;-ms-flex-pack:start;justify-content:flex-start}.ux-iws-shop-item-overview__filter-container .datepicker-range__divider{-ms-flex:0 0 20px;flex:0 0 20px}.ux-iws-shop-item-overview__filter-container .datepicker{-ms-flex:1 1 auto;flex:1 1 auto}.ux-iws-shop-item-overview__filter-dropdown{min-width:250px;max-width:300px;position:relative;display:inline-block;margin-right:18px;margin-bottom:20px}.ux-iws-shop-item-overview__result-set.result-set{margin-top:0;position:relative;text-align:center}.ux-iws-shop-item-overview__table-container .ux-text-status{display:-ms-flexbox;display:flex;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-align:center;align-items:center;-ms-flex-pack:start;justify-content:flex-start}.ux-iws-shop-item-overview__table-container .ux-text-status::before{content:"";display:inline-block;background-color:currentColor;width:0.8em;height:0.8em;border-radius:100%;margin-right:0.8em}.ux-iws-shop-item-overview .ux-collapsible-button__container{padding:15px;text-align:center}';export{o as ux_iws_data_controller_shop_item_quote}