Vue.component('ADBRimoFcpMap', { data() { return { mapMarkers: [], isLoading: true, error: null, window, fetchUrl: window.TT_CONFIG.BASE_PATH + '/ADBRimoFcp/getAllFCPs', }; }, async created() { await this.fetchAndPrepareData(); }, methods: { async fetchAndPrepareData() { this.isLoading = true; this.error = null; try { const response = await axios.get(this.fetchUrl); if (response.data && response.data.success && Array.isArray(response.data.data)) { this.mapMarkers = response.data.data .filter(fcp => fcp.gps_lat != null && fcp.gps_long != null) .map(fcp => ({ lat: fcp.gps_lat, lng: fcp.gps_long, options: { asyncPopupContent: async (markerData) => { const response = await axios.get(`${this.window.TT_CONFIG.BASE_PATH}/ADBRimoFcp/getById?id=${fcp.id}`); const fullFcpData = response.data; return `
| RIMO ID: | ${fullFcpData.rimo_id} |
| RIMO Ex State: | ${fullFcpData.rimo_ex_state} |
| RIMO Op State: | ${fullFcpData.rimo_op_state} |
| Building Type: | ${fullFcpData.building_type} |
| Coordinates: |
${fullFcpData.gps_lat}, ${fullFcpData.gps_long} |