import{r as l,B as o,h as i}from"./p-03169580.js";import{m as n}from"./p-c5cf028c.js";import{s as t}from"./p-46225039.js";import{f as e}from"./p-3a8e6af1.js";import"./p-4cb16df5.js";import"./p-7cbdb4ea.js";import"./p-59c95c5f.js";import"./p-c9699503.js";const a="";let s=class{constructor(o){l(this,o);this.methodIcons={check:"create",manual:"cash",card:"card"}}onChange(l){var o;if(((o=l===null||l===void 0?void 0:l.target)===null||o===void 0?void 0:o.tagName)==="ION-SEARCHBAR"){this.paginationEl.query=l.detail.value?l.detail.value:""}}formatUSD(l){const o=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2});return o.format(l?l:0)}async openPayCalculatorModal(l,o){var i,e,a;this.payCalculatorModalEl=await n.create({component:"modal-pay-calculator",componentProps:{amount:l,disableAmount:true,disableReferral:true,jobId:o,payModelId:((a=(e=(i=t===null||t===void 0?void 0:t.profile)===null||i===void 0?void 0:i.location)===null||e===void 0?void 0:e.defaultPayModel)===null||a===void 0?void 0:a.id)||null}});return this.payCalculatorModalEl.present()}async componentDidLoad(){if(!(o===null||o===void 0?void 0:o.isBrowser))return}render(){return[i("ion-content",{class:"ion-padding"},i("floodteam-title-bar",null,i("ion-router-link",{href:"/payments"},"Payments"),i("ion-buttons",{slot:"end"},i("ion-button",{fill:"solid",color:"primary",href:"/payments/new"},"Add"))),i("fireenjin-search-bar",{ref:l=>this.filterBarEl=l,paginationEl:this.paginationEl,filters:[{name:"paymodelId",label:"Pay Model",endpoint:"listPayModels",icon:"pie-chart",resultsKey:"payModels"},{name:"locationId",label:"Location",endpoint:"listLocations",value:this.locationId,icon:"business",resultsKey:"locations"},{name:"method",label:"Payment Method",icon:"pricetags",multiple:true,options:[{label:"Check",value:"check"},{label:"Manual",value:"manual"},{label:"Card",value:"card"}]}]}),i("fireenjin-pagination",{ref:l=>this.paginationEl=l,endpoint:"listPayments",display:"list",limit:24,resultsKey:"payments",listEl:({result:l})=>{var o,n;return i("ion-item",null,(l===null||l===void 0?void 0:l.method)&&this.methodIcons[l.method]&&i("ion-icon",{slot:"start",color:"medium",name:this.methodIcons[l.method]}),i("ion-label",null,i("h2",null,(o=l.job)===null||o===void 0?void 0:o.title),i("p",null,this.formatUSD(l.amount)," paid by ",l.method),i("div",null,i("ion-button",{fill:"clear",href:`/jobs/${(n=l.job)===null||n===void 0?void 0:n.id}`,target:"_blank"},"Open Job"))),l.createdAt&&i("span",{slot:"end"},i("div",{style:{textAlign:"center"}},e(new Date(Date.parse(l.createdAt)),"MM/dd/yyyy")),i("ion-button",{style:{display:"block"},size:"small",fill:"clear",onClick:()=>{var o;return this.openPayCalculatorModal(l===null||l===void 0?void 0:l.amount,(o=l===null||l===void 0?void 0:l.job)===null||o===void 0?void 0:o.id)}},"Process",i("ion-icon",{slot:"end",name:"pie-chart"}))))}})),i("floodteam-navigation-footer",null)]}};s.style=a;export{s as app_payment_list};
//# sourceMappingURL=p-e5efaf0e.entry.js.map