{"version":3,"sources":["webpack:///./src/components/reports-kpis/AvgTimeAttention.vue","webpack:///./src/components/reports-kpis/component/AvgTimeAttention/ModalDetailList.vue","webpack:///./src/components/common/SortIcon.vue","webpack:///src/components/common/SortIcon.vue","webpack:///./src/components/common/SortIcon.vue?ee1b","webpack:///./src/components/common/SortIcon.vue?0ed8","webpack:///./src/components/reports-kpis/utils/colorResponseTime.js","webpack:///./src/components/reports-kpis/utils/formatResponteTime.js","webpack:///src/components/reports-kpis/component/AvgTimeAttention/ModalDetailList.vue","webpack:///./src/components/reports-kpis/component/AvgTimeAttention/ModalDetailList.vue?5b8f","webpack:///./src/components/reports-kpis/component/AvgTimeAttention/ModalDetailList.vue?9d91","webpack:///src/components/reports-kpis/AvgTimeAttention.vue","webpack:///./src/components/reports-kpis/AvgTimeAttention.vue?527e","webpack:///./src/components/reports-kpis/AvgTimeAttention.vue?bd40","webpack:///./src/components/reports-kpis/component/AvgTimeAttention/CardKPI.vue?040d","webpack:///./src/components/reports-kpis/AvgTimeAttention.vue?bffa","webpack:///./src/components/reports-kpis/component/AvgTimeAttention/CardKPI.vue","webpack:///src/components/reports-kpis/component/AvgTimeAttention/CardKPI.vue","webpack:///./src/components/reports-kpis/component/AvgTimeAttention/CardKPI.vue?9e43","webpack:///./src/components/reports-kpis/component/AvgTimeAttention/CardKPI.vue?2856"],"names":["model","value","dateRange","_vm","expression","staticClass","attrs","icon","_c","color","chartData","series","searchTerm","callback","scopedSlots","fn","on","key","_ref2","item","_v","_s","formatHours","_ref3","_ref4","onDialogClose","render","dialog","sort","index","_vm$items","_id","showDetail","staticRenderFns","_self","toggleSort","name","props","type","String","required","methods","$emit","component","colorResponseTime","time","formatResponseTime","hours","roundedHours","Math","floor","minutes","round","concat","components","SortIcon","LeadDetailModal","items","Array","loading","Boolean","onClose","Function","data","computed","_objectSpread","mapState","lead","state","leads","actualItem","sortedItems","_this","a","b","response_time_hours","mapActions","fetchLead","mapMutations","setLoadingActualLead","setActualLead","leadId","_this2","_asyncToGenerator","_regeneratorRuntime","mark","_callee","wrap","_context","prev","next","JSON","parse","stringify","$store","commit","stop","INITIAL_DATA","brokers","overall_stats","total_leads","average_response_time","min_response_time","max_response_time","CardKPI","DateRangeComponent","ModalDetailList","responseData","filterLeads","sortField","sortDirection","headers","text","start","end","detailData","loadingDetail","watch","handler","_handler","newVal","fetchData","sent","_x","apply","arguments","deep","filteredAndSortedBrokers","filtered","filter","broker","broker_name","toLowerCase","includes","topBrokers","_toConsumableArray","slice","map","options","chart","xaxis","categories","split","colors","getResponseBadgeColor","_callee2","response","_context2","fetchDataAvgTimeAttention","abrupt","t0","fetchDataDetail","_callee3","_context3","fetchDataAvgTimeAttentionDetail","getDetailData","brokerId","_callee4","_context4","contactId","$attrs","title","Object","default","Number"],"mappings":"+NAA8O,W,IAA2B,OAACA,EAAK,EAAC,S,OAACC,EAAK,OAAMC,GAAU,O,YAAU,U,GAAgBC,KAAID,C,YAAc,W,CAACE,0CAAW,wBAAW,OAAI,MAAO,GAAOC,QAAY,kBAA8BC,MAAM,CAAC,MAAO,EAAC,UAAiB,SAAO,YAAEC,EAAI,UAAE,GAAsB,WAAW,gBAA2CC,GAAG,QAAU,CAACF,YAAM,e,CAAC,YAAQ,C,MAA+B,C,MAAe,iBAAoB,KAAC,CAAC,KAAO,qBAA0EE,MAAG,EAAS,aAAC,6BAAQ,YAAQ,C,MAA6B,C,MAAe,+B,KAA0B,CAAW,0BAA0E,2EAAkBF,EAAK,UAAC,C,MAAC,CAAqC,MAAO,6B,KAAQ,CAAqBG,KAAK,oBAAS,eAA0E,uEAAgCH,EAAK,UAAC,C,MAAC,CAAY,MAAK,6BAAI,MAAM,KAAC,oBAAqHD,MAAW,OAA6DC,MAAM,kEAAiC,KAAQ,OAAKI,UAAUC,C,MAAO,CAAa,KAAQ,KAAM,UAAiCN,UAAW,CAAC,uFAAO,YAAK,YAAkEA,8BAAkB,eAACC,MAAM,CAAC,QAAQ,oBAAuB,SAAY,UAAE,OAAC,WAAmC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AM,gB,CAAC,SAAQH,CAAc,OAAIA,MAAOA,EAAM,KAAKI,QAE5T0B,WAAe,EAAK,qD,KCST,G,UAAA,CACfI,MAAA,CACA4H,MAAA,CAAA3H,KAAAC,OAAAC,UAAA,GACAjC,KAAA,CACA+B,KAAA4H,OACAC,QAAA,kBAAA5J,KAAA,GAAAE,MAAA,MAEAR,MAAA,CAAAqC,KAAA,CAAAC,OAAA6H,QAAA5H,UAAA,MClB8X,I,wBCQ1XG,EAAY,eACd,EACA,EACAV,GACA,EACA,KACA,KACA,MAIa,OAAAU,E","file":"js/chunk-329ef1e4.d366ed8b.js","sourcesContent":["var render = function render(){var _vm=this,_c=_vm._self._c;return _c('v-container',[_c('div',{staticClass:\"header\"},[_c('h1',{staticClass:\"text-h4\"},[_vm._v(\"Tiempo de Respuesta de Asesores\")]),_c('DateRangeComponent',{attrs:{\"dense\":\"\",\"default\":\"Últimos 7 días\"},model:{value:(_vm.dateRange),callback:function ($$v) {_vm.dateRange=$$v},expression:\"dateRange\"}})],1),_c('div',{staticClass:\"kpi-section\"},[_c('CardKPI',{attrs:{\"title\":\"Total de Leads\",\"icon\":{ icon: 'mdi-account-group' },\"value\":_vm.responseData.overall_stats.total_leads}}),_c('CardKPI',{attrs:{\"title\":\"Tiempo Promedio de Respuesta\",\"icon\":{ icon: 'mdi-clock-outline' },\"value\":_vm.formatHours(_vm.responseData.overall_stats.average_response_time)}}),_c('CardKPI',{attrs:{\"title\":\"Tiempo Mínimo de Respuesta\",\"icon\":{ icon: 'mdi-timer-outline', color: 'green' },\"value\":_vm.formatHours(_vm.responseData.overall_stats.min_response_time)}}),_c('CardKPI',{attrs:{\"title\":\"Tiempo Máximo de Respuesta\",\"icon\":{ icon: 'mdi-timer-outline', color: 'red' },\"value\":_vm.formatHours(_vm.responseData.overall_stats.max_response_time)}})],1),_c('v-row',[_c('v-col',{attrs:{\"cols\":\"12\",\"md\":\"12\"}},[_c('v-card',[_c('v-card-title',[_vm._v(\"Top 10 Asesores con Mejor Tiempo de Respuesta \")]),_c('v-card-text',[_c('span',{staticClass:\"subtitle\"},[_vm._v(\"Promedio en Horas \")]),_c('apexchart',{attrs:{\"options\":_vm.chartData.options,\"series\":_vm.chartData.series,\"type\":\"bar\",\"height\":\"350\"}})],1)],1)],1)],1),_c('v-card',{staticClass:\"my-6\"},[_c('v-card-title',[_vm._v(\"Detalle por Asesor\")]),_c('v-text-field',{staticClass:\"mx-5\",attrs:{\"label\":\"Buscar por nombre...\",\"clearable\":\"\",\"prepend-inner-icon\":\"mdi-magnify\",\"bordered\":\"\"},model:{value:(_vm.searchTerm),callback:function ($$v) {_vm.searchTerm=$$v},expression:\"searchTerm\"}}),_c('v-data-table',{staticClass:\"elevation-1\",attrs:{\"headers\":_vm.headers,\"items\":_vm.filteredAndSortedBrokers},scopedSlots:_vm._u([{key:\"item.total_leads\",fn:function({ item }){return [_c('span',{staticClass:\"total_leads\",on:{\"click\":() => _vm.getDetailData(item.broker_id)}},[_vm._v(\" \"+_vm._s(item.total_leads)+\" \")])]}},{key:\"item.average_response_time\",fn:function({ item }){return [_c('v-chip',{attrs:{\"color\":_vm.getResponseBadgeColor(item.average_response_time)}},[_vm._v(\" \"+_vm._s(_vm.formatHours(item.average_response_time))+\" \")])]}},{key:\"item.min_response_time\",fn:function({ item }){return [_vm._v(\" \"+_vm._s(_vm.formatHours(item.min_response_time))+\" \")]}},{key:\"item.max_response_time\",fn:function({ item }){return [_vm._v(\" \"+_vm._s(_vm.formatHours(item.max_response_time))+\" \")]}}])})],1),_c('ModalDetailList',{attrs:{\"items\":_vm.detailData,\"loading\":_vm.loadingDetail,\"dialog\":_vm.dialog,\"onClose\":_vm.onDialogClose}})],1)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',[_c('v-dialog',{attrs:{\"scrollable\":\"\",\"max-width\":\"500px\",\"transition\":\"dialog-transition\"},on:{\"click:outside\":_vm.onClose,\"keydown\":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,\"esc\",27,$event.key,[\"Esc\",\"Escape\"]))return null;return _vm.onClose.apply(null, arguments)}},model:{value:(_vm.dialog),callback:function ($$v) {_vm.dialog=$$v},expression:\"dialog\"}},[_c('v-card',[_c('v-card-title',[_vm._v(\"Leads por asesor \"),_c('v-spacer'),_c('SortIcon',{attrs:{\"sort\":_vm.sort},on:{\"toggleSort\":function($event){_vm.sort = _vm.sort === 'asc' ? 'desc' : 'asc'}}})],1),(_vm.loading)?_c('div',_vm._l((5),function(item,index){return _c('v-skeleton-loader',{key:index,attrs:{\"type\":\"list-item-avatar-two-line\"}})}),1):(_vm.items?.length === 0)?_c('div',[_c('v-card-text',[_vm._v(\"No hay datos para mostrar\")])],1):_c('v-card-text',_vm._l((_vm.sortedItems),function(item,index){return _c('div',{key:item._id},[_c('v-list',{attrs:{\"subheader\":\"\"}},[_c('v-list-item',{on:{\"click\":function($event){return _vm.setActualLead(item._id)}}},[_c('v-list-item-avatar',[_c('v-icon',{attrs:{\"size\":\"40\"}},[_vm._v(\"mdi-account-circle\")])],1),_c('v-list-item-content',[_c('v-list-item-title',[_vm._v(\" \"+_vm._s(item.contact_lead_name)+\" \")])],1),_c('v-list-item-icon',{staticClass:\"mx-2\",attrs:{\"justify\":\"space-between\"}},[_c('v-chip',{attrs:{\"color\":_vm.colorResponseTime(item.response_time_hours)}},[_vm._v(\" \"+_vm._s(_vm.formatResponseTime(item.response_time_hours))+\" \")])],1)],1)],1),(index < _vm.items.length - 1)?_c('v-divider'):_vm._e()],1)}),0),_c('v-card-actions',[_c('v-spacer'),(_vm.onClose)?_c('v-btn',{attrs:{\"text\":\"\"},on:{\"click\":_vm.onClose}},[_vm._v(\" Cerrar \")]):_vm._e()],1)],1)],1),_c('lead-detail-modal',{ref:\"leadDetailModal\",attrs:{\"page\":\"table\",\"dialog\":_vm.showDetail},on:{\"setDialog\":value => {\n        _vm.showDetail = value;\n      }}})],1)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',[_c('v-icon',{on:{\"click\":_vm.toggleSort}},[_vm._v(\" \"+_vm._s(_vm.sort === \"asc\" ? \"mdi-sort-ascending\" : \"mdi-sort-descending\")+\" \")])],1)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template lang=\"\">\n  <div>\n    <v-icon @click=\"toggleSort\">\n      {{ sort === \"asc\" ? \"mdi-sort-ascending\" : \"mdi-sort-descending\" }}\n    </v-icon>\n  </div>\n</template>\n<script>\nexport default {\n  name: \"SortIcon\",\n  props: {\n    sort: {\n      type: String,\n      required: true\n    }\n  },\n  methods: {\n    toggleSort() {\n      this.$emit(\"toggleSort\");\n    }\n  }\n};\n</script>\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./SortIcon.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./SortIcon.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./SortIcon.vue?vue&type=template&id=71070da0&lang=true&\"\nimport script from \"./SortIcon.vue?vue&type=script&lang=js&\"\nexport * from \"./SortIcon.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  null,\n  null\n  \n)\n\nexport default component.exports","export default function colorResponseTime(time) {\n  if (time < 1) return \"green\";\n  if (time < 3) return \"teal\";\n  if (time < 5) return \"yellow\";\n  if (time < 10) return \"orange\";\n  return \"red\";\n}\n","export default function formatResponseTime(hours) {\n  if (hours === 0) return \"0 min\";\n  const roundedHours = Math.floor(hours);\n  const minutes = Math.round((hours - roundedHours) * 60);\n  return roundedHours === 0\n    ? `${minutes} min`\n    : `${roundedHours} h ${minutes} min`;\n}\n","<template>\n  <div>\n    <v-dialog\n      @click:outside=\"onClose\"\n      @keydown.esc=\"onClose\"\n      v-model=\"dialog\"\n      scrollable\n      max-width=\"500px\"\n      transition=\"dialog-transition\"\n    >\n      <v-card>\n        <v-card-title\n          >Leads por asesor <v-spacer></v-spacer>\n          <SortIcon\n            :sort=\"sort\"\n            @toggleSort=\"sort = sort === 'asc' ? 'desc' : 'asc'\"\n          />\n        </v-card-title>\n        <div v-if=\"loading\">\n          <v-skeleton-loader\n            v-for=\"(item, index) in 5\"\n            :key=\"index\"\n            type=\"list-item-avatar-two-line\"\n          />\n        </div>\n        <div v-else-if=\"items?.length === 0\">\n          <v-card-text>No hay datos para mostrar</v-card-text>\n        </div>\n        <v-card-text v-else>\n          <div v-for=\"(item, index) in sortedItems\" :key=\"item._id\">\n            <v-list subheader>\n              <v-list-item @click=\"setActualLead(item._id)\">\n                <v-list-item-avatar>\n                  <v-icon size=\"40\">mdi-account-circle</v-icon>\n                </v-list-item-avatar>\n                <v-list-item-content>\n                  <v-list-item-title>\n                    {{ item.contact_lead_name }}\n                  </v-list-item-title>\n                </v-list-item-content>\n                <v-list-item-icon class=\"mx-2\" justify=\"space-between\">\n                  <v-chip :color=\"colorResponseTime(item.response_time_hours)\">\n                    {{ formatResponseTime(item.response_time_hours) }}\n                  </v-chip>\n                </v-list-item-icon>\n              </v-list-item>\n            </v-list>\n            <v-divider v-if=\"index < items.length - 1\"></v-divider>\n          </div>\n        </v-card-text>\n        <v-card-actions>\n          <v-spacer></v-spacer>\n          <v-btn v-if=\"onClose\" text @click=\"onClose\">\n            Cerrar\n          </v-btn>\n        </v-card-actions>\n      </v-card>\n    </v-dialog>\n    <lead-detail-modal\n      ref=\"leadDetailModal\"\n      page=\"table\"\n      :dialog=\"showDetail\"\n      @setDialog=\"\n        value => {\n          showDetail = value;\n        }\n      \"\n    />\n  </div>\n</template>\n<script>\nimport { mapActions, mapMutations, mapState } from \"vuex\";\nimport SortIcon from \"../../../common/SortIcon.vue\";\nimport colorResponseTime from \"../../utils/colorResponseTime\";\nimport formatResponseTime from \"../../utils/formatResponteTime\";\nimport LeadDetailModal from \"../../../lead/LeadDetailModal.vue\";\n\nexport default {\n  name: \"ModalDetailList\",\n  components: {\n    SortIcon,\n    LeadDetailModal\n  },\n  props: {\n    items: {\n      type: Array,\n      required: true\n    },\n    loading: Boolean,\n    dialog: Boolean,\n    onClose: Function\n  },\n  data() {\n    return {\n      sort: \"asc\",\n      showDetail: false\n    };\n  },\n  computed: {\n    ...mapState({\n      lead: state => state.leads.actualItem\n    }),\n    sortedItems() {\n      const items = this.items;\n      return items.sort((a, b) => {\n        if (this.sort === \"asc\") {\n          return a.response_time_hours - b.response_time_hours;\n        } else {\n          return b.response_time_hours - a.response_time_hours;\n        }\n      });\n    }\n  },\n  methods: {\n    ...mapActions({\n      fetchLead: \"leads/fetchActualLead\"\n    }),\n    ...mapMutations({\n      setLoadingActualLead: \"leads/setLoading\"\n    }),\n    formatResponseTime,\n    colorResponseTime,\n    async setActualLead(leadId) {\n      this.setLoadingActualLead(true);\n      this.showDetail = true;\n\n      await this.fetchLead(leadId);\n      // Se hace este parseo para que cuando mute el lead, no cambie el secundario\n      let data = JSON.parse(JSON.stringify(this.lead));\n      this.$store.commit(\"leads/setSecondaryLead\", data);\n      this.setLoadingActualLead(false);\n    }\n  }\n};\n</script>\n","import mod from \"-!../../../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../../../node_modules/thread-loader/dist/cjs.js!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ModalDetailList.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../../../node_modules/thread-loader/dist/cjs.js!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ModalDetailList.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./ModalDetailList.vue?vue&type=template&id=3781e6b8&\"\nimport script from \"./ModalDetailList.vue?vue&type=script&lang=js&\"\nexport * from \"./ModalDetailList.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  null,\n  null\n  \n)\n\nexport default component.exports","<template>\n  <v-container>\n    <div class=\"header\">\n      <h1 class=\"text-h4\">Tiempo de Respuesta de Asesores</h1>\n      <DateRangeComponent dense v-model=\"dateRange\" default=\"Últimos 7 días\" />\n    </div>\n\n    <div class=\"kpi-section\">\n      <CardKPI\n        title=\"Total de Leads\"\n        :icon=\"{ icon: 'mdi-account-group' }\"\n        :value=\"responseData.overall_stats.total_leads\"\n      />\n      <CardKPI\n        title=\"Tiempo Promedio de Respuesta\"\n        :icon=\"{ icon: 'mdi-clock-outline' }\"\n        :value=\"formatHours(responseData.overall_stats.average_response_time)\"\n      />\n      <CardKPI\n        title=\"Tiempo Mínimo de Respuesta\"\n        :icon=\"{ icon: 'mdi-timer-outline', color: 'green' }\"\n        :value=\"formatHours(responseData.overall_stats.min_response_time)\"\n      />\n      <CardKPI\n        title=\"Tiempo Máximo de Respuesta\"\n        :icon=\"{ icon: 'mdi-timer-outline', color: 'red' }\"\n        :value=\"formatHours(responseData.overall_stats.max_response_time)\"\n      />\n    </div>\n    <v-row>\n      <v-col cols=\"12\" md=\"12\">\n        <v-card>\n          <v-card-title\n            >Top 10 Asesores con Mejor Tiempo de Respuesta\n          </v-card-title>\n          <v-card-text>\n            <span class=\"subtitle\">Promedio en Horas </span>\n            <apexchart\n              :options=\"chartData.options\"\n              :series=\"chartData.series\"\n              type=\"bar\"\n              height=\"350\"\n            ></apexchart>\n          </v-card-text>\n        </v-card>\n      </v-col>\n    </v-row>\n\n    <v-card class=\"my-6\">\n      <v-card-title>Detalle por Asesor</v-card-title>\n      <v-text-field\n        class=\"mx-5\"\n        v-model=\"searchTerm\"\n        label=\"Buscar por nombre...\"\n        clearable\n        prepend-inner-icon=\"mdi-magnify\"\n        bordered\n      />\n      <v-data-table\n        :headers=\"headers\"\n        :items=\"filteredAndSortedBrokers\"\n        class=\"elevation-1\"\n      >\n        <template #item.total_leads=\"{ item }\">\n          <span\n            class=\"total_leads\"\n            @click=\"() => getDetailData(item.broker_id)\"\n          >\n            {{ item.total_leads }}\n          </span>\n        </template>\n        <template #item.average_response_time=\"{ item }\">\n          <v-chip :color=\"getResponseBadgeColor(item.average_response_time)\">\n            {{ formatHours(item.average_response_time) }}\n          </v-chip>\n        </template>\n        <template #item.min_response_time=\"{ item }\">\n          {{ formatHours(item.min_response_time) }}\n        </template>\n        <template #item.max_response_time=\"{ item }\">\n          {{ formatHours(item.max_response_time) }}\n        </template>\n      </v-data-table>\n    </v-card>\n    <ModalDetailList\n      :items=\"detailData\"\n      :loading=\"loadingDetail\"\n      :dialog=\"dialog\"\n      :onClose=\"onDialogClose\"\n    />\n  </v-container>\n</template>\n\n<script>\nimport CardKPI from \"./component/AvgTimeAttention/CardKPI.vue\";\nimport DateRangeComponent from \"./component/dateRange.component.vue\";\nimport {\n  fetchDataAvgTimeAttention,\n  fetchDataAvgTimeAttentionDetail\n} from \"../../api/reports-api\";\nimport ModalDetailList from \"./component/AvgTimeAttention/ModalDetailList.vue\";\nimport formatResponseTime from \"./utils/formatResponteTime\";\nimport colorResponseTime from \"./utils/colorResponseTime\";\n\nconst INITIAL_DATA = {\n  brokers: [],\n  overall_stats: {\n    total_leads: 0,\n    average_response_time: 0,\n    min_response_time: 0,\n    max_response_time: 0\n  }\n};\nexport default {\n  components: {\n    CardKPI,\n    DateRangeComponent,\n    ModalDetailList\n  },\n  data() {\n    return {\n      responseData: INITIAL_DATA,\n      searchTerm: \"\",\n      filterLeads: \"all\",\n      sortField: \"average_response_time\",\n      sortDirection: \"asc\",\n      headers: [\n        { text: \"Asesor\", value: \"broker_name\" },\n        { text: \"Leads\", value: \"total_leads\" },\n        { text: \"Tiempo Promedio\", value: \"average_response_time\" },\n        { text: \"Tiempo Mínimo\", value: \"min_response_time\" },\n        { text: \"Tiempo Máximo\", value: \"max_response_time\" }\n      ],\n      dateRange: { start: null, end: null },\n      detailData: [],\n      loadingDetail: false,\n      dialog: false\n    };\n  },\n\n  watch: {\n    dateRange: {\n      handler: async function(newVal) {\n        this.responseData = await this.fetchData(\n          (newVal.start || newVal.end) && newVal\n        );\n      },\n      deep: true\n    }\n  },\n  computed: {\n    filteredAndSortedBrokers() {\n      let filtered = this.responseData.brokers;\n      if (this.searchTerm) {\n        filtered = filtered.filter(broker =>\n          broker.broker_name\n            .toLowerCase()\n            .includes(this.searchTerm.toLowerCase())\n        );\n      }\n      return filtered;\n    },\n    chartData() {\n      const topBrokers = [...this.responseData.brokers]\n        .sort((a, b) => a.average_response_time - b.average_response_time)\n        .slice(0, 10);\n      return {\n        series: [\n          { data: topBrokers.map(broker => broker.average_response_time) }\n        ],\n        options: {\n          chart: { type: \"bar\" },\n          xaxis: {\n            categories: topBrokers.map(\n              broker => broker.broker_name.split(\" \")[0]\n            )\n          },\n          colors: [\"#10b981\"]\n        }\n      };\n    }\n  },\n  methods: {\n    formatHours: formatResponseTime,\n    getResponseBadgeColor: colorResponseTime,\n    async fetchData(filter) {\n      try {\n        const response = await fetchDataAvgTimeAttention({ dateRange: filter });\n        return response.data;\n      } catch (error) {\n        return INITIAL_DATA;\n      }\n    },\n    async fetchDataDetail(filter) {\n      try {\n        const response = await fetchDataAvgTimeAttentionDetail({ ...filter });\n        return response.data;\n      } catch (error) {\n        return [];\n      }\n    },\n    async getDetailData(brokerId) {\n      const filter = {\n        dateRange: this.dateRange,\n        contactId: brokerId\n      };\n      this.detailData = [];\n      this.dialog = true;\n      this.loadingDetail = true;\n      this.detailData = await this.fetchDataDetail(filter);\n      this.loadingDetail = false;\n    },\n    onDialogClose() {\n      this.dialog = false;\n    }\n  }\n};\n</script>\n\n<style scoped>\n.kpi-section {\n  display: grid;\n  grid-template-columns: repeat(1, 1fr);\n  gap: 1rem;\n  margin: 1rem 0;\n}\n\n.header {\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n}\n/* Media queries para md y lg */\n@media (min-width: 768px) {\n  .kpi-section {\n    grid-template-columns: repeat(2, 1fr);\n  }\n}\n\n@media (min-width: 1024px) {\n  .kpi-section {\n    grid-template-columns: repeat(4, 1fr);\n  }\n}\n\n.subtitle {\n  font-size: 0.875rem;\n  color: hsl(240 3.8% 46.1%);\n}\n\n.total_leads {\n  cursor: pointer;\n}\n\n.total_leads:hover {\n  text-decoration: underline;\n}\n</style>\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AvgTimeAttention.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AvgTimeAttention.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./AvgTimeAttention.vue?vue&type=template&id=729ef118&scoped=true&\"\nimport script from \"./AvgTimeAttention.vue?vue&type=script&lang=js&\"\nexport * from \"./AvgTimeAttention.vue?vue&type=script&lang=js&\"\nimport style0 from \"./AvgTimeAttention.vue?vue&type=style&index=0&id=729ef118&prod&scoped=true&lang=css&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  \"729ef118\",\n  null\n  \n)\n\nexport default component.exports","export * from \"-!../../../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--7-oneOf-1-0!../../../../../node_modules/css-loader/dist/cjs.js??ref--7-oneOf-1-1!../../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../../node_modules/postcss-loader/src/index.js??ref--7-oneOf-1-2!../../../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./CardKPI.vue?vue&type=style&index=0&id=56d7781c&prod&lang=css&\"","export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--7-oneOf-1-0!../../../node_modules/css-loader/dist/cjs.js??ref--7-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--7-oneOf-1-2!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AvgTimeAttention.vue?vue&type=style&index=0&id=729ef118&prod&scoped=true&lang=css&\"","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',_vm._g(_vm._b({staticClass:\"card\"},'div',_vm.$attrs,false),_vm.$listeners),[_c('div',{staticClass:\"title-card\"},[_vm._v(_vm._s(_vm.title))]),_c('div',{staticClass:\"content-card\"},[_c('v-icon',{attrs:{\"color\":_vm.icon.color}},[_vm._v(_vm._s(_vm.icon.icon))]),_c('span',[_vm._v(_vm._s(_vm.value))])],1)])\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\n  <div class=\"card\" v-bind=\"$attrs\" v-on=\"$listeners\">\n    <div class=\"title-card\">{{ title }}</div>\n    <div class=\"content-card\">\n      <v-icon :color=\"icon.color\">{{ icon.icon }}</v-icon>\n      <span>{{ value }}</span>\n    </div>\n  </div>\n</template>\n\n<script>\nexport default {\n  props: {\n    title: { type: String, required: true },\n    icon: {\n      type: Object,\n      default: () => ({ icon: \"\", color: \"\" })\n    },\n    value: { type: [String, Number], required: true }\n  }\n};\n</script>\n\n<style>\n.card {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  padding: 1rem;\n  border: 1px solid #e5e7eb;\n  border-radius: 0.5rem;\n  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n}\n.title-card {\n  font-size: 0.875rem;\n  line-height: 1.25rem;\n  font-weight: 500;\n  color: #4b5563;\n}\n\n.content-card {\n  font-size: 1.5rem;\n  line-height: 2rem;\n  font-weight: 500;\n  display: flex;\n  gap: 0.25rem;\n}\n</style>\n","import mod from \"-!../../../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../../../node_modules/thread-loader/dist/cjs.js!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./CardKPI.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../../../node_modules/thread-loader/dist/cjs.js!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./CardKPI.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./CardKPI.vue?vue&type=template&id=56d7781c&\"\nimport script from \"./CardKPI.vue?vue&type=script&lang=js&\"\nexport * from \"./CardKPI.vue?vue&type=script&lang=js&\"\nimport style0 from \"./CardKPI.vue?vue&type=style&index=0&id=56d7781c&prod&lang=css&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  null,\n  null\n  \n)\n\nexport default component.exports"],"sourceRoot":""}