import{r as i,d as o,B as l,h as t}from"./p-03169580.js";import{s as d}from"./p-e1ee6da1.js";import{g as a}from"./p-c0e85cbf.js";import{i as n}from"./p-41a47a25.js";import{i as e}from"./p-238e00f5.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 s="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 r=class{constructor(l){i(this,l);this.fireenjinTrigger=o(this,"fireenjinTrigger",7);this.fireenjinSubmit=o(this,"fireenjinSubmit",7);this.groupBy="week";this.unreadCount=0;this.selectedStatuses=["book","evaluate","claim","mitigate","monitor","review"];this.totals={};this.showMap=false}async onTrigger(i){var o,l,t,d,a;if(((o=i===null||i===void 0?void 0:i.detail)===null||o===void 0?void 0:o.name)==="set"&&((t=(l=i===null||i===void 0?void 0:i.detail)===null||l===void 0?void 0:l.payload)===null||t===void 0?void 0:t.name)==="status"){await this.mapEl.clearMarkers();this.selectedStatuses=((a=(d=i===null||i===void 0?void 0:i.detail)===null||d===void 0?void 0:d.payload)===null||a===void 0?void 0:a.value)||[]}}async onChange(i){var o,l,t,d;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}else if(((t=i===null||i===void 0?void 0:i.target)===null||t===void 0?void 0:t.name)==="timeframe"){this.timeframe=(d=i===null||i===void 0?void 0:i.target)===null||d===void 0?void 0:d.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);this.fireenjinSubmit.emit({endpoint:"exportCsv",data:{collection:"jobs"}})}render(){var i,o;const l=this.filterJobsByStatus(Object.values((d===null||d===void 0?void 0:d.jobs)||{}).filter((i=>{var o,l,t;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,(t=d===null||d===void 0?void 0:d.session)===null||t===void 0?void 0:t.uid)})),this.selectedStatuses);return[t("ion-content",{class:"truck-background ion-padding"},n()&&e()&&t("div",{id:"performance"},t("floodteam-total-graph",{groupBy:this.groupBy,totallerId:"1mFFMb6HglD2asYliHDm"}),t("floodteam-totaller-card-list",{groupBy:this.groupBy,totallerIds:["1mFFMb6HglD2asYliHDm"]})),t("article",{id:"myjobs"},this.showMap&&t("fireenjin-map",{googleMapsKey:(o=(i=d===null||d===void 0?void 0:d.config)===null||i===void 0?void 0:i.firebase)===null||o===void 0?void 0:o.apiKey,ref:i=>this.mapEl=i,markers:l.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}}}))}),t("floodteam-title-bar",null,t("ion-router-link",{href:"/jobs"},"My Jobs"," ",t("ion-badge",{style:{borderRadius:"15px"}},t("small",null,l.length||0))),t("ion-buttons",{slot:"end"},t("ion-button",{onClick:()=>this.showMap=!this.showMap,style:{"--color":"rgba(var(--ion-text-color-rgb), 0.5)"},fill:"outline",size:"small"},"Map",t("ion-icon",{slot:"end",name:"map"})),t("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:a(),value:this.selectedStatuses}}}),fill:"outline",size:"small"},"Filter",t("ion-icon",{slot:"end",name:"funnel"})))),t("ion-card",{class:"list-card"},t("ion-list",null,l.map((i=>t("floodteam-item-job",{job:i}))))))),t("floodteam-navigation-footer",null)]}};r.style=s;export{r as app_dashboard};
//# sourceMappingURL=p-75f6637c.entry.js.map