add warranties page

This commit is contained in:
Casey Wittrock 2025-10-28 00:16:35 -05:00
parent 44d47db0ad
commit 2828c0f9c8
6 changed files with 347 additions and 66 deletions

View File

@ -39,6 +39,12 @@ class Api {
return data;
}
static async getWarrantyData() {
const data = DataUtils.dummyWarrantyData;
console.log("DEBUG: API - getWarrantyData result: ", data);
return data;
}
static async getDocsList(doctype, fields = []) {
const docs = await frappe.db.get_list(doctype, { fields });
console.log(`DEBUG: API - Fetched ${doctype} list: `, docs);

View File

@ -27,7 +27,7 @@
v-model="filterModel.value"
type="text"
@input="filterCallback()"
placeholder="Search by name"
:placeholder="`Search ${col.label}...`"
/>
</template>
<template v-if="col.type === 'status'" #body="slotProps">
@ -73,7 +73,7 @@ const props = defineProps({
},
});
const emit = defineEmits(['rowClick']);
const emit = defineEmits(["rowClick"]);
const filterRef = ref(props.filters);
const selectedRows = ref();

View File

@ -28,29 +28,35 @@ const categories = [
},
];
const items = ref([
const createButtons = ref([
{
label: "Client",
command: () => {
frappe.new_doc("Customer");
},
},
{
label: "Estimate",
command: () => {
frappe.new_doc("Estimate");
},
},
{
label: "Job",
command: () => {
frappe.new_doc("Job");
},
},
{
label: "Estimate",
command: () => {
frappe.new_doc("Estimate");
},
},
{
label: "Invoice",
command: () => {
frappe.new_doc("Sales Invoice");
alert("Create Invoice clicked");
},
},
{
label: "Warranty Claim",
command: () => {
alert("Create Warranty Claim clicked");
},
},
]);
@ -78,7 +84,7 @@ const handleCategoryClick = (category) => {
</button>
</template>
<template v-else>
<SpeedDial :model="items" direction="down" type="linear" radius="50">
<SpeedDial :model="createButtons" direction="down" type="linear" radius="50">
<template #button="{ toggleCallback }">
<button
class="sidebar-button"

View File

@ -1,9 +1,125 @@
<template lang="">
<template>
<div>
<h2>Warranties Page</h2>
<h2>Warranty Claims</h2>
<div id="filter-container" class="filter-container">
<button @click="addNewWarranty" id="add-warranty-button" class="interaction-button">
Add New Warranty Claim
</button>
</div>
<DataTable :data="tableData" :columns="columns" :filters="filters" />
</div>
</template>
<script>
export default {};
<script setup>
import { onMounted, ref } from "vue";
import DataTable from "../DataTable.vue";
import Api from "../../api";
import { FilterMatchMode } from "@primevue/core";
const tableData = ref([]);
const addNewWarranty = () => {
// TODO: Open modal or navigate to create warranty form
console.log("Add new warranty claim clicked");
// In the future, this could open a modal or navigate to a form
// For now, just log the action
};
const filters = {
customer: { value: null, matchMode: FilterMatchMode.CONTAINS },
warrantyId: { value: null, matchMode: FilterMatchMode.CONTAINS },
address: { value: null, matchMode: FilterMatchMode.CONTAINS },
assignedTechnician: { value: null, matchMode: FilterMatchMode.CONTAINS },
};
const columns = [
{
label: "Warranty ID",
fieldName: "warrantyId",
type: "text",
sortable: true,
filterable: true,
},
{
label: "Customer",
fieldName: "customer",
type: "text",
sortable: true,
filterable: true,
},
{
label: "Address",
fieldName: "address",
type: "text",
sortable: true,
filterable: true,
},
{
label: "Issue Description",
fieldName: "issueDescription",
type: "text",
sortable: true,
},
{
label: "Priority",
fieldName: "priority",
type: "status",
sortable: true,
},
{
label: "Status",
fieldName: "status",
type: "status",
sortable: true,
},
{
label: "Assigned Technician",
fieldName: "assignedTechnician",
type: "text",
sortable: true,
filterable: true,
},
{
label: "Date Reported",
fieldName: "dateReported",
type: "text",
sortable: true,
},
{
label: "Est. Completion",
fieldName: "estimatedCompletionDate",
type: "text",
sortable: true,
},
];
onMounted(async () => {
if (tableData.value.length > 0) {
return;
}
let data = await Api.getWarrantyData();
tableData.value = data;
});
</script>
<style lang=""></style>
<style scoped>
.filter-container {
display: flex;
justify-content: flex-end;
margin-bottom: 1rem;
}
.interaction-button {
background-color: #007bff;
color: white;
border: none;
padding: 0.5rem 1rem;
border-radius: 4px;
cursor: pointer;
font-size: 0.9rem;
}
.interaction-button:hover {
background-color: #0056b3;
}
</style>

View File

@ -773,7 +773,7 @@ class DataUtils {
estimatedTime: "07:30",
duration: 240,
status: "completed",
coordinates: { lat: 44.9778, lng: -93.2650 }
coordinates: { lat: 44.9778, lng: -93.265 },
},
{
stopId: 2,
@ -783,7 +783,7 @@ class DataUtils {
estimatedTime: "11:45",
duration: 180,
status: "completed",
coordinates: { lat: 44.4583, lng: -93.1614 }
coordinates: { lat: 44.4583, lng: -93.1614 },
},
{
stopId: 3,
@ -793,7 +793,7 @@ class DataUtils {
estimatedTime: "15:00",
duration: 120,
status: "in progress",
coordinates: { lat: 44.2950, lng: -93.2688 }
coordinates: { lat: 44.295, lng: -93.2688 },
},
{
stopId: 4,
@ -803,7 +803,7 @@ class DataUtils {
estimatedTime: "17:30",
duration: 90,
status: "not started",
coordinates: { lat: 44.0839, lng: -93.2261 }
coordinates: { lat: 44.0839, lng: -93.2261 },
},
{
stopId: 5,
@ -813,7 +813,7 @@ class DataUtils {
estimatedTime: "19:15",
duration: 75,
status: "not started",
coordinates: { lat: 43.6667, lng: -92.9746 }
coordinates: { lat: 43.6667, lng: -92.9746 },
},
{
stopId: 6,
@ -823,9 +823,9 @@ class DataUtils {
estimatedTime: "20:45",
duration: 150,
status: "not started",
coordinates: { lat: 43.6481, lng: -93.3687 }
}
]
coordinates: { lat: 43.6481, lng: -93.3687 },
},
],
},
{
routeId: "MAT-002",
@ -849,7 +849,7 @@ class DataUtils {
estimatedTime: "06:30",
duration: 30,
status: "completed",
coordinates: { lat: 44.7677, lng: -93.2777 }
coordinates: { lat: 44.7677, lng: -93.2777 },
},
{
stopId: 2,
@ -859,7 +859,7 @@ class DataUtils {
estimatedTime: "07:15",
duration: 25,
status: "completed",
coordinates: { lat: 44.8041, lng: -93.1668 }
coordinates: { lat: 44.8041, lng: -93.1668 },
},
{
stopId: 3,
@ -869,7 +869,7 @@ class DataUtils {
estimatedTime: "08:00",
duration: 20,
status: "completed",
coordinates: { lat: 44.7319, lng: -93.2177 }
coordinates: { lat: 44.7319, lng: -93.2177 },
},
{
stopId: 4,
@ -879,7 +879,7 @@ class DataUtils {
estimatedTime: "08:45",
duration: 25,
status: "completed",
coordinates: { lat: 44.7391, lng: -93.0658 }
coordinates: { lat: 44.7391, lng: -93.0658 },
},
{
stopId: 5,
@ -889,9 +889,9 @@ class DataUtils {
estimatedTime: "09:30",
duration: 35,
status: "completed",
coordinates: { lat: 44.6497, lng: -93.2427 }
}
]
coordinates: { lat: 44.6497, lng: -93.2427 },
},
],
},
{
routeId: "WAR-003",
@ -915,7 +915,7 @@ class DataUtils {
estimatedTime: "08:30",
duration: 60,
status: "not started",
coordinates: { lat: 44.9211, lng: -93.4687 }
coordinates: { lat: 44.9211, lng: -93.4687 },
},
{
stopId: 2,
@ -925,7 +925,7 @@ class DataUtils {
estimatedTime: "10:00",
duration: 75,
status: "not started",
coordinates: { lat: 44.9744, lng: -93.5066 }
coordinates: { lat: 44.9744, lng: -93.5066 },
},
{
stopId: 3,
@ -935,7 +935,7 @@ class DataUtils {
estimatedTime: "11:30",
duration: 45,
status: "not started",
coordinates: { lat: 45.0541, lng: -93.6091 }
coordinates: { lat: 45.0541, lng: -93.6091 },
},
{
stopId: 4,
@ -945,7 +945,7 @@ class DataUtils {
estimatedTime: "12:30",
duration: 90,
status: "not started",
coordinates: { lat: 44.9364, lng: -93.6719 }
coordinates: { lat: 44.9364, lng: -93.6719 },
},
{
stopId: 5,
@ -955,7 +955,7 @@ class DataUtils {
estimatedTime: "14:15",
duration: 60,
status: "not started",
coordinates: { lat: 44.8619, lng: -93.5272 }
coordinates: { lat: 44.8619, lng: -93.5272 },
},
{
stopId: 6,
@ -965,9 +965,9 @@ class DataUtils {
estimatedTime: "15:30",
duration: 75,
status: "not started",
coordinates: { lat: 44.7886, lng: -93.6022 }
}
]
coordinates: { lat: 44.7886, lng: -93.6022 },
},
],
},
{
routeId: "SOD-004",
@ -991,7 +991,7 @@ class DataUtils {
estimatedTime: "08:00",
duration: 120,
status: "completed",
coordinates: { lat: 44.9237, lng: -92.9594 }
coordinates: { lat: 44.9237, lng: -92.9594 },
},
{
stopId: 2,
@ -1001,7 +1001,7 @@ class DataUtils {
estimatedTime: "10:30",
duration: 90,
status: "in progress",
coordinates: { lat: 44.9633, lng: -92.9652 }
coordinates: { lat: 44.9633, lng: -92.9652 },
},
{
stopId: 3,
@ -1011,7 +1011,7 @@ class DataUtils {
estimatedTime: "12:15",
duration: 150,
status: "not started",
coordinates: { lat: 44.9530, lng: -92.9952 }
coordinates: { lat: 44.953, lng: -92.9952 },
},
{
stopId: 4,
@ -1021,9 +1021,9 @@ class DataUtils {
estimatedTime: "15:00",
duration: 75,
status: "not started",
coordinates: { lat: 45.0119, lng: -93.0074 }
}
]
coordinates: { lat: 45.0119, lng: -93.0074 },
},
],
},
{
routeId: "MACH-005",
@ -1047,7 +1047,7 @@ class DataUtils {
estimatedTime: "07:30",
duration: 90,
status: "not started",
coordinates: { lat: 45.0105, lng: -93.4555 }
coordinates: { lat: 45.0105, lng: -93.4555 },
},
{
stopId: 2,
@ -1057,7 +1057,7 @@ class DataUtils {
estimatedTime: "09:15",
duration: 75,
status: "not started",
coordinates: { lat: 45.0724, lng: -93.4557 }
coordinates: { lat: 45.0724, lng: -93.4557 },
},
{
stopId: 3,
@ -1067,9 +1067,9 @@ class DataUtils {
estimatedTime: "10:45",
duration: 60,
status: "not started",
coordinates: { lat: 45.1188, lng: -93.4025 }
}
]
coordinates: { lat: 45.1188, lng: -93.4025 },
},
],
},
{
routeId: "TRK-006",
@ -1093,7 +1093,7 @@ class DataUtils {
estimatedTime: "07:00",
duration: 30,
status: "not started",
coordinates: { lat: 45.0153, lng: -93.4233 }
coordinates: { lat: 45.0153, lng: -93.4233 },
},
{
stopId: 2,
@ -1103,7 +1103,7 @@ class DataUtils {
estimatedTime: "08:00",
duration: 45,
status: "not started",
coordinates: { lat: 45.0845, lng: -93.4321 }
coordinates: { lat: 45.0845, lng: -93.4321 },
},
{
stopId: 3,
@ -1113,7 +1113,7 @@ class DataUtils {
estimatedTime: "09:15",
duration: 60,
status: "not started",
coordinates: { lat: 45.0941, lng: -93.3563 }
coordinates: { lat: 45.0941, lng: -93.3563 },
},
{
stopId: 4,
@ -1123,10 +1123,163 @@ class DataUtils {
estimatedTime: "11:00",
duration: 45,
status: "not started",
coordinates: { lat: 45.0341, lng: -93.3678 }
}
]
}
coordinates: { lat: 45.0341, lng: -93.3678 },
},
],
},
];
static dummyWarrantyData = [
{
id: 1,
warrantyId: "W-001",
customer: "John Doe",
address: "123 Lane Dr, Cityville, MN",
originalJobId: "JOB001",
issueDescription: "Sprinkler head not rotating properly",
dateReported: "2024-10-20",
priority: "medium",
status: "open",
assignedTechnician: "Mike Johnson",
estimatedCompletionDate: "2024-10-25",
warrantyType: "Parts & Labor",
systemType: "Residential Irrigation",
},
{
id: 2,
warrantyId: "W-002",
customer: "Jane Smith",
address: "456 Oak St, Townsville, CA",
originalJobId: "JOB002",
issueDescription: "Controller not responding to schedule",
dateReported: "2024-10-18",
priority: "high",
status: "in progress",
assignedTechnician: "Sarah Johnson",
estimatedCompletionDate: "2024-10-23",
warrantyType: "Parts Only",
systemType: "Commercial Irrigation",
},
{
id: 3,
warrantyId: "W-003",
customer: "Mike Johnson",
address: "789 Pine Rd, Villagetown, TX",
originalJobId: "JOB003",
issueDescription: "Multiple zones not activating",
dateReported: "2024-10-15",
priority: "high",
status: "completed",
assignedTechnician: "David Martinez",
estimatedCompletionDate: "2024-10-20",
warrantyType: "Labor Only",
systemType: "Residential Irrigation",
},
{
id: 4,
warrantyId: "W-004",
customer: "Emily Davis",
address: "321 Maple Ave, Hamlet, FL",
originalJobId: "JOB004",
issueDescription: "Low water pressure in all zones",
dateReported: "2024-10-22",
priority: "medium",
status: "open",
assignedTechnician: null,
estimatedCompletionDate: "2024-10-28",
warrantyType: "Parts & Labor",
systemType: "Residential Irrigation",
},
{
id: 5,
warrantyId: "W-005",
customer: "David Wilson",
address: "654 Cedar Blvd, Borough, NY",
originalJobId: "JOB005",
issueDescription: "Valve stuck in open position",
dateReported: "2024-10-19",
priority: "high",
status: "in progress",
assignedTechnician: "Chris Wilson",
estimatedCompletionDate: "2024-10-24",
warrantyType: "Parts & Labor",
systemType: "Commercial Irrigation",
},
{
id: 6,
warrantyId: "W-006",
customer: "Sarah Brown",
address: "987 Birch Ln, Metropolis, IL",
originalJobId: "JOB006",
issueDescription: "Broken sprinkler head causing water waste",
dateReported: "2024-10-21",
priority: "low",
status: "open",
assignedTechnician: null,
estimatedCompletionDate: "2024-10-30",
warrantyType: "Parts Only",
systemType: "Residential Irrigation",
},
{
id: 7,
warrantyId: "W-007",
customer: "Chris Taylor",
address: "159 Spruce Ct, Capital City, WA",
originalJobId: "JOB007",
issueDescription: "Timer programming lost after power outage",
dateReported: "2024-10-17",
priority: "medium",
status: "completed",
assignedTechnician: "Mike Johnson",
estimatedCompletionDate: "2024-10-22",
warrantyType: "Labor Only",
systemType: "Commercial Irrigation",
},
{
id: 8,
warrantyId: "W-008",
customer: "Amanda Martinez",
address: "753 Willow Dr, Smalltown, OH",
originalJobId: "JOB008",
issueDescription: "Pipe leak causing flooding in lawn",
dateReported: "2024-10-16",
priority: "high",
status: "in progress",
assignedTechnician: "Sarah Johnson",
estimatedCompletionDate: "2024-10-23",
warrantyType: "Parts & Labor",
systemType: "Residential Irrigation",
},
{
id: 9,
warrantyId: "W-009",
customer: "Joshua Anderson",
address: "852 Aspen Rd, Bigcity, NJ",
originalJobId: "JOB009",
issueDescription: "Sprinkler coverage uneven after installation",
dateReported: "2024-10-14",
priority: "low",
status: "open",
assignedTechnician: "David Martinez",
estimatedCompletionDate: "2024-10-29",
warrantyType: "Labor Only",
systemType: "Residential Irrigation",
},
{
id: 10,
warrantyId: "W-010",
customer: "Olivia Thomas",
address: "147 Cypress St, Uptown, GA",
originalJobId: "JOB010",
issueDescription: "Rain sensor not functioning properly",
dateReported: "2024-10-13",
priority: "medium",
status: "completed",
assignedTechnician: "Chris Wilson",
estimatedCompletionDate: "2024-10-18",
warrantyType: "Parts Only",
systemType: "Commercial Irrigation",
},
];
}