{"version":3,"sources":["webpack:///./src/components/reports/AdminReportsByLeads.vue?a143","webpack:///./src/components/reports/AdminReportsByLeads.vue","webpack:///./src/components/reports/AdminReportsByLeads.vue?2961","webpack:///./src/components/reports/AdminReportsByLeads.vue?567b","webpack:///./src/components/reports/AdminReportsByEOIs.vue?4bf4","webpack:///./src/components/reports/AdminReportsByEOIs.vue?ca5c","webpack:///./src/components/reports/AdminReportsByEOIs.vue","webpack:///./src/components/reports/AdminReportsByEOIs.vue?1835","webpack:///./src/views/admin/reports/EstateGraphs.vue?420b","webpack:///./src/views/admin/reports/EstateGraphs.vue","webpack:///./src/views/admin/reports/EstateGraphs.vue?3d7f","webpack:///./src/views/admin/reports/EstateGraphs.vue?a67b"],"names":["_hoisted_1","key","class","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","render","_ctx","_cache","$props","$setup","$data","$options","loading","_openBlock","_createElementBlock","_createElementVNode","leadsByEstate","props","role","_createVNode","labels","source","setData","quantity","backgroundColor","chartBackgroundColor","title","chartType","options","optionsForHorizontalBarchart","_createCommentVNode","number","total","_defineComponent","__name","estate","type","Object","required","period","String","setup","__props","expose","__expose","store","useStore","toast","useToast","ref","leadSource","LeadSourceEnum","ENQUIRY","MANUALLY","IMPORT","WAITLIST","REA","INITIAL_HOLD","estateSelected","computed","periodSelected","watch","newPeriod","oldPeriod","getLeadsByEstate","getSourceCountsByLeads","leads","sourceByLead","sourceCounts","lead","undefined","createLeadDataForChart","sourceForData","leadData","push","filterLeadsByPeriod","startDate","Date","ReportsTimePeriod","LAST_WEEK","setDate","getDate","LAST_MONTH","setMonth","getMonth","filter","createdAt","async","value","dispatch","estateId","_id","then","res","leadsWithinPeriod","data","totalLeads","length","catch","err","error","finally","onMounted","__returned__","PropType","ChartForReports","EstateInterface","LeadInterface","ReportsByNumber","defineProperty","enumerable","__exports__","eoisByEstate","status","optionsForBarchart","statusOrder","EoiStatus","APPROVED","DECLINED","PENDING","getEOIsByEstate","getStatusCountsByEoi","eois","statusOrderByEoi","statusCounts","eoi","createEoiDataForChart","statusForData","eoiData","filterEOIsByPeriod","eoIsWithinPeriod","totalEois","EoiInterface","_hoisted_6","_hoisted_7","_$setup$estate","_toDisplayString","control","_withCtx","timePeriodSelected","dropdown","_Fragment","_renderList","optionsTimePeriod","timePeriod","onClick","$event","selectTimePeriod","_normalizeClass","_","router","useRouter","stateId","currentRoute","params","reportsTimePeriod","getEstate","AdminReportsByEOIs","AdminReportsByLeads","SiteVisitorsFromAnalytics","ConversionFromAnalytics","DropDown"],"mappings":"kgGAEA,MACMA,EAAa,CACjBC,IAAK,EACLC,MAAO,WAEHC,EAAa,CACjBF,IAAK,EACLC,MAAO,iBAEHE,EAAa,CAAEF,MAAO,0CACtBG,EAAa,CACjBJ,IAAK,EACLC,MAAO,wBAEHI,EAAa,CACjBL,IAAK,EACLC,MAAO,qBAGH,SAAUK,EAAOC,EAAUC,EAAYC,EAAYC,EAAYC,EAAWC,GAC9E,OAAQF,EAAOG,SACVC,yBAAcC,gCAAoB,MAAOhB,KACzCe,yBAAcC,gCAAoB,MAAOb,EAAY,CACpDc,gCAAoB,MAAOb,EAAY,CACpCO,EAAOO,eAAuC,cAAtBP,EAAOQ,MAAMC,MACjCL,yBAAcC,gCAAoB,MAAOX,EAAY,CACpDgB,yBAAaV,EAAO,mBAAoB,CACtCW,OAAQX,EAAOO,cAAcK,OAC7BC,QAASb,EAAOO,cAAcO,SAC9BC,gBAAiBf,EAAOgB,qBACxBC,MAAO,YACPC,UAAW,MACXC,QAASnB,EAAOoB,8BACf,KAAM,EAAG,CAAC,SAAU,UAAW,kBAAmB,eAEvDC,gCAAoB,IAAI,GAC3BrB,EAAOO,eAAuC,cAAtBP,EAAOQ,MAAMC,MACjCL,yBAAcC,gCAAoB,MAAOV,EAAY,CACpDe,yBAAaV,EAAO,mBAAoB,CACtCiB,MAAO,YACPK,OAAQtB,EAAOO,cAAcgB,OAC5B,KAAM,EAAG,CAAC,cAEfF,gCAAoB,IAAI,Q,0HCx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AAqBC,uCAA2BC,qCAAyBC,sBAAU,wBAA0B,OAAOnF,wBAAqB,sBAAwB,OAAO4B,sBAAmB,gBAAkB,OAAO6C,QAAa,eAAiB,OAAOzG,QAAY,eAAiB,OAAOE,QAAYC,aAAKqD,0BAE7c,OADAjE,OAAOwE,eAAeN,EAAc,kBAAmB,CAAEO,YAAY,EAAOtB,OAAO,IAC5Ee,K,iCChDP,MAAMQ,EAA2B,IAAgB,EAAQ,CAAC,CAAC,SAAS1G,GAAQ,CAAC,YAAY,qBAE1E,gB,kCCTf,W","file":"js/admin24.4bab3e01.js","sourcesContent":["import { openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createVNode as _createVNode, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-8f3af638\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = {\n key: 0,\n class: \"spinner\"\n}\nconst _hoisted_2 = {\n key: 1,\n class: \"reports-leads\"\n}\nconst _hoisted_3 = { class: \"reports-container-horizontal-bar-chart\" }\nconst _hoisted_4 = {\n key: 0,\n class: \"bar-chart-horizontal\"\n}\nconst _hoisted_5 = {\n key: 1,\n class: \"reports-by-number\"\n}\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n return ($setup.loading)\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_1))\n : (_openBlock(), _createElementBlock(\"div\", _hoisted_2, [\n _createElementVNode(\"div\", _hoisted_3, [\n ($setup.leadsByEstate && $setup.props.role !== 'landowner')\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_4, [\n _createVNode($setup[\"ChartForReports\"], {\n labels: $setup.leadsByEstate.source,\n setData: $setup.leadsByEstate.quantity,\n backgroundColor: $setup.chartBackgroundColor,\n title: 'New Leads',\n chartType: 'bar',\n options: $setup.optionsForHorizontalBarchart\n }, null, 8, [\"labels\", \"setData\", \"backgroundColor\", \"options\"])\n ]))\n : _createCommentVNode(\"\", true),\n ($setup.leadsByEstate && $setup.props.role === 'landowner')\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_5, [\n _createVNode($setup[\"ReportsByNumber\"], {\n title: 'New Leads',\n number: $setup.leadsByEstate.total\n }, null, 8, [\"number\"])\n ]))\n : _createCommentVNode(\"\", true)\n ])\n ]))\n}","import { defineComponent as _defineComponent } from 'vue'\nimport { ref, onMounted, computed, PropType, watch } from \"vue\";\nimport { useStore } from \"vuex\";\nimport { useToast } from \"vue-toastification\";\nimport ChartForReports from \"@/components/reports/ChartForReports.vue\";\nimport { EstateInterface } from \"@/types/EstateInterface\";\nimport { LeadInterface } from \"@/types/LeadInterface\";\nimport LeadSourceEnum from \"@/enums/LeadSourceEnum\";\nimport { ReportsTimePeriod } from \"@/enums/ReportsTimePeriod\";\nimport { optionsForHorizontalBarchart } from \"@/constants/optionsChart\";\nimport { chartBackgroundColor } from \"@/constants/optionsChart\";\nimport ReportsByNumber from \"@/components/reports/ReportsByNumber.vue\";\n\ninterface LeadsByEstate {\n title: string;\n source: string[];\n quantity: number[];\n total?: number;\n}\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'AdminReportsByLeads',\n props: {\n estate: {\n type: Object as () => EstateInterface,\n required: true,\n },\n period: {\n type: String as PropType,\n required: true,\n },\n role: {\n type: String,\n required: false,\n },\n},\n setup(__props, { expose: __expose }) {\n __expose();\n\nconst props = __props;\n\n\n\nconst store = useStore();\nconst toast = useToast();\nconst loading = ref(false);\n\nconst leadsByEstate = ref();\nconst leadSource = [\n LeadSourceEnum.ENQUIRY,\n LeadSourceEnum.MANUALLY,\n LeadSourceEnum.IMPORT,\n LeadSourceEnum.WAITLIST,\n LeadSourceEnum.REA,\n LeadSourceEnum.INITIAL_HOLD,\n];\n\nconst estateSelected = computed(() => {\n return props.estate;\n});\n\nconst periodSelected = computed(() => {\n return props.period;\n});\n\nwatch(periodSelected, (newPeriod, oldPeriod) => {\n if (newPeriod !== oldPeriod) {\n getLeadsByEstate();\n }\n});\n\nconst getSourceCountsByLeads = (\n leads: LeadInterface[],\n sourceByLead: string[]\n) => {\n const sourceCounts: { [key: string]: number } = {};\n\n for (const source of sourceByLead) {\n sourceCounts[source] = 0;\n }\n\n for (const lead of leads) {\n const { source } = lead;\n if (sourceCounts[source] !== undefined) {\n sourceCounts[source]++;\n }\n }\n return sourceCounts;\n};\n\nconst createLeadDataForChart = (\n estate: EstateInterface,\n sourceForData: string[],\n sourceCounts: { [key: string]: number }\n) => {\n const leadData: {\n title: string;\n source: string[];\n quantity: number[];\n } = {\n title: estate.title,\n source: [],\n quantity: [],\n };\n\n for (const source of sourceForData) {\n leadData.source.push(source);\n leadData.quantity.push(sourceCounts[source]);\n }\n return leadData;\n};\n\nconst filterLeadsByPeriod = (\n leads: LeadInterface[],\n period: ReportsTimePeriod\n) => {\n const startDate = new Date();\n if (period === ReportsTimePeriod.LAST_WEEK) {\n startDate.setDate(startDate.getDate() - 7);\n } else if (period === ReportsTimePeriod.LAST_MONTH) {\n startDate.setMonth(startDate.getMonth() - 1);\n startDate.setDate(1);\n }\n\n return leads.filter((lead) => {\n const createdAt = new Date(lead.createdAt);\n return createdAt >= startDate;\n });\n};\n\nconst getLeadsByEstate = async () => {\n loading.value = true;\n if (estateSelected.value) {\n store\n .dispatch(\"contact/getLeads\", {\n estateId: estateSelected.value._id,\n })\n .then((res) => {\n const leadsWithinPeriod = filterLeadsByPeriod(\n res.data,\n periodSelected.value\n );\n const sourceCounts = getSourceCountsByLeads(\n leadsWithinPeriod,\n leadSource\n );\n const totalLeads = leadsWithinPeriod.length;\n\n leadsByEstate.value = {\n ...createLeadDataForChart(props?.estate, leadSource, sourceCounts),\n total: totalLeads,\n };\n })\n .catch((err) => {\n toast.error(\"Error getting Leads by estate\");\n })\n .finally(() => {\n loading.value = false;\n });\n }\n};\n\nonMounted(() => {\n getLeadsByEstate();\n});\n\nconst __returned__ = { props, store, toast, loading, leadsByEstate, leadSource, estateSelected, periodSelected, getSourceCountsByLeads, createLeadDataForChart, filterLeadsByPeriod, getLeadsByEstate, ref, onMounted, computed, PropType, watch, get useStore() { return useStore }, get useToast() { return useToast }, ChartForReports, get EstateInterface() { return EstateInterface }, get LeadInterface() { return LeadInterface }, get LeadSourceEnum() { return LeadSourceEnum }, get ReportsTimePeriod() { return ReportsTimePeriod }, get optionsForHorizontalBarchart() { return optionsForHorizontalBarchart }, get chartBackgroundColor() { return chartBackgroundColor }, ReportsByNumber }\nObject.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true })\nreturn __returned__\n}\n\n})","import { render } from \"./AdminReportsByLeads.vue?vue&type=template&id=8f3af638&scoped=true&ts=true&lang=pug\"\nimport script from \"./AdminReportsByLeads.vue?vue&type=script&lang=ts&setup=true\"\nexport * from \"./AdminReportsByLeads.vue?vue&type=script&lang=ts&setup=true\"\n\nimport \"./AdminReportsByLeads.vue?vue&type=style&index=0&id=8f3af638&lang=scss&scoped=true\"\n\nimport exportComponent from \"/codebuild/output/src264950160/src/lottrackr-front/node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render],['__scopeId',\"data-v-8f3af638\"]])\n\nexport default __exports__","export * from \"-!../../../node_modules/@vue/cli-service/node_modules/mini-css-extract-plugin/dist/loader.js??ref--9-oneOf-1-0!../../../node_modules/@vue/cli-service/node_modules/css-loader/dist/cjs.js??ref--9-oneOf-1-1!../../../node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--9-oneOf-1-2!../../../node_modules/sass-loader/dist/cjs.js??ref--9-oneOf-1-3!../../../node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/index.js??ref--1-1!./AdminReportsByLeads.vue?vue&type=style&index=0&id=8f3af638&lang=scss&scoped=true\"","export * from \"-!../../../node_modules/@vue/cli-service/node_modules/mini-css-extract-plugin/dist/loader.js??ref--9-oneOf-1-0!../../../node_modules/@vue/cli-service/node_modules/css-loader/dist/cjs.js??ref--9-oneOf-1-1!../../../node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--9-oneOf-1-2!../../../node_modules/sass-loader/dist/cjs.js??ref--9-oneOf-1-3!../../../node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/index.js??ref--1-1!./AdminReportsByEOIs.vue?vue&type=style&index=0&id=843c4496&lang=scss&scoped=true\"","import { openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createVNode as _createVNode, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-843c4496\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = {\n key: 0,\n class: \"spinner\"\n}\nconst _hoisted_2 = {\n key: 1,\n class: \"reports-eois\"\n}\nconst _hoisted_3 = { class: \"reports-container-bar-chart\" }\nconst _hoisted_4 = {\n key: 0,\n class: \"bar-chart-vertical\"\n}\nconst _hoisted_5 = {\n key: 1,\n class: \"reports-by-number\"\n}\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n return ($setup.loading)\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_1))\n : (_openBlock(), _createElementBlock(\"div\", _hoisted_2, [\n _createElementVNode(\"div\", _hoisted_3, [\n ($setup.eoisByEstate && $setup.props.role !== 'landowner')\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_4, [\n _createVNode($setup[\"ChartForReports\"], {\n labels: $setup.eoisByEstate.status,\n setData: $setup.eoisByEstate.quantity,\n backgroundColor: $setup.chartBackgroundColor,\n title: 'EOIs submitted',\n chartType: 'bar',\n options: $setup.optionsForBarchart\n }, null, 8, [\"labels\", \"setData\", \"backgroundColor\", \"options\"])\n ]))\n : _createCommentVNode(\"\", true),\n ($setup.eoisByEstate && $setup.props.role === 'landowner')\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_5, [\n _createVNode($setup[\"ReportsByNumber\"], {\n title: 'Total EOIs',\n number: $setup.eoisByEstate.total\n }, null, 8, [\"number\"])\n ]))\n : _createCommentVNode(\"\", true)\n ])\n ]))\n}","import { defineComponent as _defineComponent } from 'vue'\nimport { ref, onMounted, computed, PropType, watch } from \"vue\";\nimport { useStore } from \"vuex\";\nimport { useToast } from \"vue-toastification\";\nimport ChartForReports from \"@/components/reports/ChartForReports.vue\";\nimport { EstateInterface } from \"@/types/EstateInterface\";\nimport { EoiStatus } from \"@/enums/EoiStatus\";\nimport { EoiInterface } from \"@/types/EoiInterface\";\nimport { ReportsTimePeriod } from \"@/enums/ReportsTimePeriod\";\nimport { optionsForBarchart } from \"@/constants/optionsChart\";\nimport { chartBackgroundColor } from \"@/constants/optionsChart\";\nimport ReportsByNumber from \"@/components/reports/ReportsByNumber.vue\";\n\ninterface EoisByEstate {\n title: string;\n status: string[];\n quantity: number[];\n total?: number;\n}\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'AdminReportsByEOIs',\n props: {\n estate: {\n type: Object as () => EstateInterface,\n required: true,\n },\n period: {\n type: String as PropType,\n required: true,\n },\n role: {\n type: String,\n required: false,\n },\n},\n setup(__props, { expose: __expose }) {\n __expose();\n\nconst props = __props;\n\n\n\nconst store = useStore();\nconst toast = useToast();\nconst loading = ref(false);\n\nconst eoisByEstate = ref();\nconst statusOrder = [EoiStatus.APPROVED, EoiStatus.DECLINED, EoiStatus.PENDING];\n\nconst estateSelected = computed(() => {\n return props.estate;\n});\n\nconst periodSelected = computed(() => {\n return props.period;\n});\n\nwatch(periodSelected, (newPeriod, oldPeriod) => {\n if (newPeriod !== oldPeriod) {\n getEOIsByEstate();\n }\n});\n\nconst getStatusCountsByEoi = (\n eois: EoiInterface[],\n statusOrderByEoi: string[]\n) => {\n const statusCounts: { [key: string]: number } = {};\n\n for (const status of statusOrderByEoi) {\n statusCounts[status] = 0;\n }\n\n for (const eoi of eois) {\n const { status } = eoi;\n if (statusCounts[status] !== undefined) {\n statusCounts[status]++;\n }\n }\n\n return statusCounts;\n};\n\nconst createEoiDataForChart = (\n estate: EstateInterface,\n statusForData: string[],\n statusCounts: { [key: string]: number }\n) => {\n const eoiData: {\n title: string;\n status: string[];\n quantity: number[];\n } = {\n title: estate.title,\n status: [],\n quantity: [],\n };\n\n for (const status of statusForData) {\n eoiData.status.push(status);\n eoiData.quantity.push(statusCounts[status]);\n }\n\n return eoiData;\n};\n\nconst filterEOIsByPeriod = (\n eois: EoiInterface[],\n period: ReportsTimePeriod\n) => {\n const startDate = new Date();\n if (period === ReportsTimePeriod.LAST_WEEK) {\n startDate.setDate(startDate.getDate() - 7);\n } else if (period === ReportsTimePeriod.LAST_MONTH) {\n startDate.setMonth(startDate.getMonth() - 1);\n startDate.setDate(1);\n }\n\n return eois.filter((eoi) => {\n const createdAt = new Date(eoi.createdAt);\n return createdAt >= startDate;\n });\n};\n\nconst getEOIsByEstate = async () => {\n loading.value = true;\n if (estateSelected.value) {\n store\n .dispatch(\"eoi/getEois\", {\n estateId: estateSelected.value._id,\n })\n .then((res) => {\n const eoIsWithinPeriod = filterEOIsByPeriod(\n res.data,\n periodSelected.value\n );\n const statusCounts = getStatusCountsByEoi(\n eoIsWithinPeriod,\n statusOrder\n );\n const totalEois = eoIsWithinPeriod.length;\n\n eoisByEstate.value = {\n ...createEoiDataForChart(props?.estate, statusOrder, statusCounts),\n total: totalEois,\n };\n })\n .catch((err) => {\n toast.error(\"Error getting EOIs by estate\");\n })\n .finally(() => {\n loading.value = false;\n });\n }\n};\n\nonMounted(() => {\n getEOIsByEstate();\n});\n\nconst __returned__ = { props, store, toast, loading, eoisByEstate, statusOrder, estateSelected, periodSelected, getStatusCountsByEoi, createEoiDataForChart, filterEOIsByPeriod, getEOIsByEstate, ref, onMounted, computed, PropType, watch, get useStore() { return useStore }, get useToast() { return useToast }, ChartForReports, get EstateInterface() { return EstateInterface }, get EoiStatus() { return EoiStatus }, get EoiInterface() { return EoiInterface }, get ReportsTimePeriod() { return ReportsTimePeriod }, get optionsForBarchart() { return optionsForBarchart }, get chartBackgroundColor() { return chartBackgroundColor }, ReportsByNumber }\nObject.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true })\nreturn __returned__\n}\n\n})","import { render } from \"./AdminReportsByEOIs.vue?vue&type=template&id=843c4496&scoped=true&ts=true&lang=pug\"\nimport script from \"./AdminReportsByEOIs.vue?vue&type=script&lang=ts&setup=true\"\nexport * from \"./AdminReportsByEOIs.vue?vue&type=script&lang=ts&setup=true\"\n\nimport \"./AdminReportsByEOIs.vue?vue&type=style&index=0&id=843c4496&lang=scss&scoped=true\"\n\nimport exportComponent from \"/codebuild/output/src264950160/src/lottrackr-front/node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render],['__scopeId',\"data-v-843c4496\"]])\n\nexport default __exports__","import { openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, renderList as _renderList, Fragment as _Fragment, normalizeClass as _normalizeClass, withCtx as _withCtx, createVNode as _createVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-76e19307\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = {\n key: 0,\n class: \"spinner\"\n}\nconst _hoisted_2 = {\n key: 1,\n class: \"reports-container-graphs\"\n}\nconst _hoisted_3 = { class: \"title-main\" }\nconst _hoisted_4 = { class: \"dropdown-container-reports\" }\nconst _hoisted_5 = {\n class: \"dropdown-button input-dropdown\",\n type: \"button\"\n}\nconst _hoisted_6 = [\"onClick\"]\nconst _hoisted_7 = { class: \"reports-wr-graphs\" }\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n return ($setup.loading)\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_1))\n : (_openBlock(), _createElementBlock(\"div\", _hoisted_2, [\n _createElementVNode(\"h2\", _hoisted_3, _toDisplayString($setup.estate?.title), 1),\n _createElementVNode(\"div\", _hoisted_4, [\n _createVNode($setup[\"DropDown\"], { class: \"dropdown-container\" }, {\n control: _withCtx(() => [\n _createElementVNode(\"label\", _hoisted_5, _toDisplayString($setup.timePeriodSelected), 1)\n ]),\n dropdown: _withCtx(() => [\n _createElementVNode(\"ul\", null, [\n (_openBlock(), _createElementBlock(_Fragment, null, _renderList($setup.optionsTimePeriod, (timePeriod) => {\n return _createElementVNode(\"li\", {\n key: timePeriod,\n onClick: ($event: any) => ($setup.selectTimePeriod(timePeriod)),\n class: _normalizeClass({ 'dropdown__item-active': timePeriod === $setup.timePeriodSelected })\n }, _toDisplayString(timePeriod), 11, _hoisted_6)\n }), 64))\n ])\n ]),\n _: 1\n })\n ]),\n _createElementVNode(\"div\", _hoisted_7, [\n _createVNode($setup[\"AdminReportsByEOIs\"], {\n estate: $setup.estate,\n period: $setup.timePeriodSelected\n }, null, 8, [\"estate\", \"period\"]),\n _createVNode($setup[\"AdminReportsByLeads\"], {\n estate: $setup.estate,\n period: $setup.timePeriodSelected\n }, null, 8, [\"estate\", \"period\"])\n ])\n ]))\n}","import { defineComponent as _defineComponent } from 'vue'\nimport AdminReportsByEOIs from \"@/components/reports/AdminReportsByEOIs.vue\";\nimport AdminReportsByLeads from \"@/components/reports/AdminReportsByLeads.vue\";\nimport SiteVisitorsFromAnalytics from \"@/components/reports/SiteVisitorsFromAnalytics.vue\";\nimport ConversionFromAnalytics from \"@/components/reports/ConversionFromAnalytics.vue\";\nimport DropDown from \"@/components/ui/dropdown/DropDown.vue\";\nimport { ReportsTimePeriod } from \"@/enums/ReportsTimePeriod\";\nimport { EstateInterface } from \"@/types/EstateInterface\";\nimport { useRouter } from \"vue-router\";\nimport { useStore } from \"vuex\";\nimport { useToast } from \"vue-toastification\";\nimport { ref, onMounted } from \"vue\";\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'EstateGraphs',\n setup(__props, { expose: __expose }) {\n __expose();\n\nconst router = useRouter();\nconst store = useStore();\nconst toast = useToast();\n\nconst stateId = router.currentRoute.value.params.stateId;\nconst estate = ref();\nconst loading = ref(false);\n\nconst timePeriodSelected = ref(ReportsTimePeriod.LAST_MONTH);\nconst optionsTimePeriod = [\n ReportsTimePeriod.LAST_MONTH,\n ReportsTimePeriod.LAST_WEEK,\n];\n\nconst selectTimePeriod = (reportsTimePeriod: ReportsTimePeriod) => {\n timePeriodSelected.value = reportsTimePeriod;\n};\nconst getEstate = async () => {\n loading.value = true;\n store\n .dispatch(\"estate/getEstate\", stateId)\n .then((res) => {\n estate.value = res.data;\n loading.value = false;\n })\n .catch((error) => {\n toast.error(\"Error getting estates\");\n });\n};\n\nonMounted(() => {\n getEstate();\n});\n\nconst __returned__ = { router, store, toast, stateId, estate, loading, timePeriodSelected, optionsTimePeriod, selectTimePeriod, getEstate, AdminReportsByEOIs, AdminReportsByLeads, SiteVisitorsFromAnalytics, ConversionFromAnalytics, DropDown, get ReportsTimePeriod() { return ReportsTimePeriod }, get EstateInterface() { return EstateInterface }, get useRouter() { return useRouter }, get useStore() { return useStore }, get useToast() { return useToast }, ref, onMounted }\nObject.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true })\nreturn __returned__\n}\n\n})","import { render } from \"./EstateGraphs.vue?vue&type=template&id=76e19307&scoped=true&ts=true&lang=pug\"\nimport script from \"./EstateGraphs.vue?vue&type=script&lang=ts&setup=true\"\nexport * from \"./EstateGraphs.vue?vue&type=script&lang=ts&setup=true\"\n\nimport \"./EstateGraphs.vue?vue&type=style&index=0&id=76e19307&lang=scss&scoped=true\"\n\nimport exportComponent from \"/codebuild/output/src264950160/src/lottrackr-front/node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render],['__scopeId',\"data-v-76e19307\"]])\n\nexport default __exports__","export * from \"-!../../../../node_modules/@vue/cli-service/node_modules/mini-css-extract-plugin/dist/loader.js??ref--9-oneOf-1-0!../../../../node_modules/@vue/cli-service/node_modules/css-loader/dist/cjs.js??ref--9-oneOf-1-1!../../../../node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/stylePostLoader.js!../../../../node_modules/postcss-loader/src/index.js??ref--9-oneOf-1-2!../../../../node_modules/sass-loader/dist/cjs.js??ref--9-oneOf-1-3!../../../../node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/index.js??ref--1-1!./EstateGraphs.vue?vue&type=style&index=0&id=76e19307&lang=scss&scoped=true\""],"sourceRoot":""}