import{r as i,d as o,B as l,h as d}from"./p-03169580.js";import{s as n}from"./p-e1ee6da1.js";import{g as t}from"./p-c0e85cbf.js";import"./p-59c95c5f.js";import"./p-3775d1fc.js";import"./p-80de33dc.js";import"./p-c2fbed0d.js";import"./p-5717491f.js";import"./p-de14d315.js";const a="app-dashboard floodteam-activity-feed .feed-header h3{color:#fff}app-dashboard fireenjin-map{background:var(--ion-color-light-shade);border-radius:15px;display:block;margin:20px auto 0;overflow:hidden;max-width:calc(100% - 30px)}app-dashboard h1 a{padding:0}app-dashboard ion-grid{margin-top:0;padding-top:0}app-dashboard .title-divider{display:flex;justify-content:space-between;align-items:baseline}app-dashboard .title-divider>span{display:flex;align-items:baseline;padding-inline-end:5px;margin-top:auto}app-dashboard .title-divider>span>ion-button{margin-right:5px}";let e=class{constructor(l){i(this,l);this.fireenjinTrigger=o(this,"fireenjinTrigger",7);this.unreadCount=0;this.selectedStatuses=["book","evaluate","claim","mitigate","monitor","review"];this.totals={}}async onTrigger(i){var o,l,d,n,t;if(((o=i===null||i===void 0?void 0:i.detail)===null||o===void 0?void 0:o.name)==="set"&&((d=(l=i===null||i===void 0?void 0:i.detail)===null||l===void 0?void 0:l.payload)===null||d===void 0?void 0:d.name)==="status"){await this.mapEl.clearMarkers();this.selectedStatuses=((t=(n=i===null||i===void 0?void 0:i.detail)===null||n===void 0?void 0:n.payload)===null||t===void 0?void 0:t.value)||[]}}async onChange(i){var o,l;console.log(i);if(((o=i===null||i===void 0?void 0:i.target)===null||o===void 0?void 0:o.name)==="groupBy"){this.groupBy=(l=i===null||i===void 0?void 0:i.target)===null||l===void 0?void 0:l.value}}filterJobsByStatus(i,o){return i.filter((i=>o.includes(i===null||i===void 0?void 0:i.status)))}async componentDidLoad(){if(!(l===null||l===void 0?void 0:l.isBrowser))return;this.options=await this.db.list("/totals/1mFFMb6HglD2asYliHDm/jobs",null)}render(){var i,o,l;const a=this.filterJobsByStatus(Object.values((n===null||n===void 0?void 0:n.jobs)||{}).filter((i=>{var o,l,d;return(l=(o=i===null||i===void 0?void 0:i.userIds)===null||o===void 0?void 0:o.includes)===null||l===void 0?void 0:l.call(o,(d=n===null||n===void 0?void 0:n.session)===null||d===void 0?void 0:d.uid)})),this.selectedStatuses);return[d("ion-content",{class:"truck-background ion-padding"},d("floodteam-title-bar",null,d("ion-router-link",{href:"#"},"Welcome Back"," ",((i=n===null||n===void 0?void 0:n.profile)===null||i===void 0?void 0:i.firstName)?`, ${n.profile.firstName}`:"","!")),d("article",{id:"myjobs"},d("fireenjin-map",{googleMapsKey:(l=(o=n===null||n===void 0?void 0:n.config)===null||o===void 0?void 0:o.firebase)===null||l===void 0?void 0:l.apiKey,ref:i=>this.mapEl=i,markers:a.map((i=>{var o,l;return{payload:{job:i},name:i===null||i===void 0?void 0:i.title,icon:null,position:{lat:(o=i===null||i===void 0?void 0:i.address)===null||o===void 0?void 0:o.lat,lng:(l=i===null||i===void 0?void 0:i.address)===null||l===void 0?void 0:l.lng}}}))}),d("floodteam-title-bar",null,d("ion-router-link",{href:"/jobs"},"My Jobs"," ",d("ion-badge",{style:{borderRadius:"15px"}},d("small",null,a.length||0))),d("ion-buttons",{slot:"end"},d("ion-button",{style:{"--color":"rgba(var(--ion-text-color-rgb), 0.5)"},onClick:i=>this.fireenjinTrigger.emit({event:i,name:"filter",type:"status",payload:{control:{name:"status",label:"Status",icon:"help-circle",multiple:true,options:t(),value:this.selectedStatuses}}}),fill:"outline",size:"small"},"Filter",d("ion-icon",{slot:"end",name:"funnel"})))),d("ion-card",{class:"list-card"},d("ion-list",null,a.map((i=>d("floodteam-item-job",{job:i}))))))),d("floodteam-navigation-footer",null)]}static get watchers(){return{groupBy:["onChange"]}}};e.style=a;export{e as app_dashboard};
//# sourceMappingURL=p-dfd1042f.entry.js.map