import{r as o,B as l,h as i}from"./p-03169580.js";import{m as n}from"./p-5a032a89.js";import{s as t}from"./p-e1ee6da1.js";import{f as e}from"./p-5717491f.js";import"./p-4cb16df5.js";import"./p-f44f0a67.js";import"./p-59c95c5f.js";import"./p-3775d1fc.js";import"./p-80de33dc.js";import"./p-c2fbed0d.js";import"./p-de14d315.js";const a="";let s=class{constructor(l){o(this,l);this.methodIcons={check:"create",manual:"cash",card:"card"}}onChange(o){var l;if(((l=o===null||o===void 0?void 0:o.target)===null||l===void 0?void 0:l.tagName)==="ION-SEARCHBAR"){this.paginationEl.query=o.detail.value?o.detail.value:""}}formatUSD(o){const l=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2});return l.format(o?o:0)}async openPayCalculatorModal(o,l){var i,e,a;this.payCalculatorModalEl=await n.create({component:"modal-pay-calculator",componentProps:{amount:o,disableAmount:true,disableReferral:true,jobId:l,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(!(l===null||l===void 0?void 0:l.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:o=>this.filterBarEl=o,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:o=>this.paginationEl=o,endpoint:"listPayments",display:"list",limit:20,resultsKey:"payments",listEl:({result:o})=>{var l,n;return i("ion-item",null,(o===null||o===void 0?void 0:o.method)&&this.methodIcons[o.method]&&i("ion-icon",{slot:"start",color:"medium",name:this.methodIcons[o.method]}),i("ion-label",null,i("h2",null,(l=o.job)===null||l===void 0?void 0:l.title),i("p",null,this.formatUSD(o.amount)," paid by ",o.method),i("div",null,i("ion-button",{fill:"clear",href:`/jobs/${(n=o.job)===null||n===void 0?void 0:n.id}`,target:"_blank"},"Open Job"))),o.createdAt&&i("span",{slot:"end"},i("div",{style:{textAlign:"center"}},(o===null||o===void 0?void 0:o.createdAt)&&e(o.createdAt.toDate(),"MM/dd/yyyy")),i("ion-button",{style:{display:"block"},size:"small",fill:"clear",onClick:()=>{var l;return this.openPayCalculatorModal(o===null||o===void 0?void 0:o.amount,(l=o===null||o===void 0?void 0:o.job)===null||l===void 0?void 0:l.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-69d7e2df.entry.js.map