changes
This commit is contained in:
36
fusion_claims/static/nuke_cache.html
Normal file
36
fusion_claims/static/nuke_cache.html
Normal file
@@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><title>Odoo Cache Reset</title></head>
|
||||
<body style="font-family: Arial, sans-serif; padding: 40px; text-align: center;">
|
||||
<h1>Odoo Cache Reset</h1>
|
||||
<div id="status" style="font-size: 18px; margin: 20px;">Working...</div>
|
||||
<script>
|
||||
async function nukeEverything() {
|
||||
const status = document.getElementById("status");
|
||||
let log = "";
|
||||
if ("serviceWorker" in navigator) {
|
||||
const registrations = await navigator.serviceWorker.getRegistrations();
|
||||
for (let reg of registrations) {
|
||||
await reg.unregister();
|
||||
log += "<p style=\"color:green\">Unregistered service worker: " + reg.scope + "</p>";
|
||||
}
|
||||
if (registrations.length === 0) log += "<p>No service workers found.</p>";
|
||||
}
|
||||
if ("caches" in window) {
|
||||
const names = await caches.keys();
|
||||
for (let name of names) {
|
||||
await caches.delete(name);
|
||||
log += "<p style=\"color:green\">Deleted cache: " + name + "</p>";
|
||||
}
|
||||
if (names.length === 0) log += "<p>No caches found.</p>";
|
||||
}
|
||||
try { localStorage.clear(); log += "<p style=\"color:green\">Cleared localStorage</p>"; } catch(e) {}
|
||||
try { sessionStorage.clear(); log += "<p style=\"color:green\">Cleared sessionStorage</p>"; } catch(e) {}
|
||||
log += "<h2 style=\"color:blue; margin-top:30px;\">Done! Click below to go to Odoo.</h2>";
|
||||
log += "<a href=\"/odoo\" style=\"display:inline-block;padding:15px 30px;background:#714b67;color:white;text-decoration:none;border-radius:5px;font-size:18px;margin-top:10px;\">Go to Odoo Backend</a>";
|
||||
status.innerHTML = log;
|
||||
}
|
||||
nukeEverything();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -290,9 +290,17 @@ $transition-speed: .25s;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.fc_task_travel {
|
||||
display: inline-block;
|
||||
.fc_task_bottom_row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-top: 4px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.fc_task_travel {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
font-size: 10px;
|
||||
color: $body-color;
|
||||
background: rgba($secondary, .1);
|
||||
@@ -301,6 +309,17 @@ $transition-speed: .25s;
|
||||
.fa { opacity: .5; }
|
||||
}
|
||||
|
||||
.fc_task_source {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
font-size: 10px;
|
||||
color: #fff;
|
||||
font-weight: 600;
|
||||
padding: 1px 8px;
|
||||
border-radius: 4px;
|
||||
.fa { opacity: .8; }
|
||||
}
|
||||
|
||||
// ── Map area ────────────────────────────────────────────────────────
|
||||
.fc_map_area {
|
||||
flex: 1 1 auto;
|
||||
|
||||
@@ -164,8 +164,13 @@ function classifyDate(dateStr) {
|
||||
return GROUP_LATER;
|
||||
}
|
||||
|
||||
const SOURCE_COLORS = {
|
||||
westin: "#0d6efd",
|
||||
mobility: "#198754",
|
||||
};
|
||||
|
||||
/** Group + sort tasks, returning { groupKey: { label, tasks[], count } } */
|
||||
function groupTasks(tasksData) {
|
||||
function groupTasks(tasksData, localInstanceId) {
|
||||
// Sort by date ASC, time ASC
|
||||
const sorted = [...tasksData].sort((a, b) => {
|
||||
const da = a.scheduled_date || "";
|
||||
@@ -197,12 +202,16 @@ function groupTasks(tasksData) {
|
||||
task._statusColor = STATUS_COLORS[task.status] || "#6b7280";
|
||||
task._statusLabel = STATUS_LABELS[task.status] || task.status || "";
|
||||
task._statusIcon = STATUS_ICONS[task.status] || "fa-circle";
|
||||
task._clientName = task.partner_id ? task.partner_id[1] : "N/A";
|
||||
task._clientName = task.x_fc_sync_client_name || (task.partner_id ? task.partner_id[1] : "N/A");
|
||||
task._techName = task.technician_id ? task.technician_id[1] : "Unassigned";
|
||||
task._typeLbl = task.task_type
|
||||
? task.task_type.charAt(0).toUpperCase() + task.task_type.slice(1).replace("_", " ")
|
||||
: "Task";
|
||||
task._timeRange = `${task.time_start_display || floatToTime12(task.time_start)} - ${task.time_end_display || ""}`;
|
||||
const src = task.x_fc_sync_source || localInstanceId || "";
|
||||
task._sourceLabel = src ? src.charAt(0).toUpperCase() + src.slice(1) : "";
|
||||
task._sourceColor = SOURCE_COLORS[src] || "#6c757d";
|
||||
task._hasCoords = task.address_lat && task.address_lng && task.address_lat !== 0 && task.address_lng !== 0;
|
||||
groups[g].tasks.push(task);
|
||||
groups[g].count++;
|
||||
}
|
||||
@@ -312,11 +321,12 @@ export class FusionTaskMapController extends Component {
|
||||
const domain = this._getDomain();
|
||||
const result = await this.orm.call("fusion.technician.task", "get_map_data", [domain]);
|
||||
this.apiKey = result.api_key;
|
||||
this.localInstanceId = result.local_instance_id || "";
|
||||
this.tasksData = result.tasks || [];
|
||||
this.locationsData = result.locations || [];
|
||||
this.state.taskCount = this.tasksData.length;
|
||||
this.state.techCount = this.locationsData.length;
|
||||
this.state.groups = groupTasks(this.tasksData);
|
||||
this.state.groups = groupTasks(this.tasksData, this.localInstanceId);
|
||||
|
||||
if (!this.apiKey) {
|
||||
this.state.error = _t("Google Maps API key not configured. Go to Settings > Fusion Claims.");
|
||||
@@ -338,11 +348,12 @@ export class FusionTaskMapController extends Component {
|
||||
try {
|
||||
const domain = this._getDomain();
|
||||
const result = await this.orm.call("fusion.technician.task", "get_map_data", [domain]);
|
||||
this.localInstanceId = result.local_instance_id || this.localInstanceId || "";
|
||||
this.tasksData = result.tasks || [];
|
||||
this.locationsData = result.locations || [];
|
||||
this.state.taskCount = this.tasksData.length;
|
||||
this.state.techCount = this.locationsData.length;
|
||||
this.state.groups = groupTasks(this.tasksData);
|
||||
this.state.groups = groupTasks(this.tasksData, this.localInstanceId);
|
||||
this._renderMarkers();
|
||||
} catch (e) {
|
||||
console.error("FusionTaskMap update error:", e);
|
||||
|
||||
@@ -102,10 +102,17 @@
|
||||
<t t-esc="task.address_display"/>
|
||||
</div>
|
||||
|
||||
<!-- Travel badge -->
|
||||
<div t-if="task.travel_time_minutes" class="fc_task_travel">
|
||||
<i class="fa fa-car me-1"/>
|
||||
<t t-esc="task.travel_time_minutes"/> min travel
|
||||
<!-- Travel + source -->
|
||||
<div class="fc_task_bottom_row">
|
||||
<span t-if="task.travel_time_minutes" class="fc_task_travel">
|
||||
<i class="fa fa-car me-1"/>
|
||||
<t t-esc="task.travel_time_minutes"/> min travel
|
||||
</span>
|
||||
<span t-if="task._sourceLabel" class="fc_task_source"
|
||||
t-att-style="'background:' + task._sourceColor">
|
||||
<i class="fa fa-building-o me-1"/>
|
||||
<t t-esc="task._sourceLabel"/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
Reference in New Issue
Block a user