job creation working
This commit is contained in:
parent
bd9e00c6f1
commit
d3818d1985
22 changed files with 591 additions and 179 deletions
|
|
@ -37,6 +37,7 @@
|
|||
<DataTable
|
||||
:data="tableData"
|
||||
:columns="columns"
|
||||
:tableActions="tableActions"
|
||||
tableName="jobtasks"
|
||||
:lazy="true"
|
||||
:totalRecords="totalRecords"
|
||||
|
|
@ -80,9 +81,49 @@ const columns = [
|
|||
{ label: "ID", fieldName: "id", type: "text", sortable: true, filterable: true },
|
||||
{ label: "Address", fieldname: "address", type: "text" },
|
||||
{ label: "Category", fieldName: "", type: "text", sortable: true, filterable: true },
|
||||
{ label: "Status", fieldName: "status", type: "text", sortable: true, filterable: true },
|
||||
{ label: "Status", fieldName: "status", type: "status", sortable: true, filterable: true },
|
||||
];
|
||||
|
||||
const statusOptions = ref([
|
||||
"Open",
|
||||
"Working",
|
||||
"Pending Review",
|
||||
"Overdue",
|
||||
"Completed",
|
||||
"Cancelled",
|
||||
]);
|
||||
|
||||
const tableActions = computed(() => [
|
||||
{
|
||||
label: "Set Status",
|
||||
rowAction: true,
|
||||
type: "menu",
|
||||
menuItems: statusOptions.value.map((option) => ({
|
||||
label: option,
|
||||
command: async (rowData) => {
|
||||
console.log("Setting status for row:", rowData, "to:", option);
|
||||
try {
|
||||
await Api.setTaskStatus(rowData.id, option);
|
||||
|
||||
// Find and update the row in the table data
|
||||
const rowIndex = tableData.value.findIndex((row) => row.id === rowData.id);
|
||||
if (rowIndex >= 0) {
|
||||
// Update reactively
|
||||
tableData.value[rowIndex].status = option;
|
||||
notifications.addSuccess(`Status updated to ${option}`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error updating status:", error);
|
||||
notifications.addError("Failed to update status");
|
||||
}
|
||||
},
|
||||
})),
|
||||
layout: {
|
||||
priority: "menu",
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
const handleLazyLoad = async (event) => {
|
||||
console.log("Task list on Job Page - handling lazy load:", event);
|
||||
try {
|
||||
|
|
@ -191,6 +232,16 @@ const handleLazyLoad = async (event) => {
|
|||
|
||||
onMounted(async () => {
|
||||
console.log("DEBUG: Query params:", route.query);
|
||||
|
||||
try {
|
||||
const optionsResult = await Api.getTaskStatusOptions();
|
||||
if (optionsResult && optionsResult.length > 0) {
|
||||
statusOptions.value = optionsResult;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error loading task status options:", error);
|
||||
}
|
||||
|
||||
if (jobIdQuery.value) {
|
||||
// Viewing existing Job
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue