This commit is contained in:
parent
07c1181d6e
commit
041e9f5461
9 changed files with 371 additions and 249 deletions
|
|
@ -35,7 +35,9 @@ import { usePaginationStore } from "../../stores/pagination";
|
|||
import { useFiltersStore } from "../../stores/filters";
|
||||
import { useModalStore } from "../../stores/modal";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useNotificationStore } from "../../stores/notifications-primevue";
|
||||
|
||||
const notifications = useNotificationStore();
|
||||
const loadingStore = useLoadingStore();
|
||||
const paginationStore = usePaginationStore();
|
||||
const filtersStore = useFiltersStore();
|
||||
|
|
@ -128,7 +130,7 @@ const columns = [
|
|||
sortable: true,
|
||||
buttonVariant: "outlined",
|
||||
onStatusClick: (status, rowData) => handleAppointmentClick(status, rowData),
|
||||
disableCondition: (status) => status?.toLowerCase() !== "not started",
|
||||
// disableCondition: (status) => status?.toLowerCase() !== "not started",
|
||||
},
|
||||
{
|
||||
label: "Estimate Sent",
|
||||
|
|
@ -137,7 +139,7 @@ const columns = [
|
|||
sortable: true,
|
||||
buttonVariant: "outlined",
|
||||
onStatusClick: (status, rowData) => handleEstimateClick(status, rowData),
|
||||
disableCondition: (status) => status?.toLowerCase() !== "not started",
|
||||
// disableCondition: (status) => status?.toLowerCase() !== "not started",
|
||||
},
|
||||
{
|
||||
label: "Payment Received",
|
||||
|
|
@ -146,7 +148,7 @@ const columns = [
|
|||
sortable: true,
|
||||
buttonVariant: "outlined",
|
||||
onStatusClick: (status, rowData) => handlePaymentClick(status, rowData),
|
||||
disableCondition: (status) => status?.toLowerCase() !== "not started",
|
||||
// disableCondition: (status) => status?.toLowerCase() !== "not started",
|
||||
},
|
||||
{
|
||||
label: "Job Status",
|
||||
|
|
@ -155,7 +157,7 @@ const columns = [
|
|||
sortable: true,
|
||||
buttonVariant: "outlined",
|
||||
onStatusClick: (status, rowData) => handleJobClick(status, rowData),
|
||||
disableCondition: (status) => status?.toLowerCase() !== "not started",
|
||||
// disableCondition: (status) => status?.toLowerCase() !== "not started",
|
||||
},
|
||||
];
|
||||
|
||||
|
|
@ -203,36 +205,6 @@ const tableActions = [
|
|||
// variant: "filled",
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// label: "Edit",
|
||||
// action: (rowData) => {
|
||||
// console.log("Editing client:", rowData);
|
||||
// // Implementation would open edit modal
|
||||
// },
|
||||
// type: "button",
|
||||
// style: "secondary",
|
||||
// icon: "pi pi-pencil",
|
||||
// rowAction: true, // Row action - appears in each row's actions column
|
||||
// layout: {
|
||||
// priority: "primary",
|
||||
// variant: "outlined",
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// label: "Quick View",
|
||||
// action: (rowData) => {
|
||||
// console.log("Quick view for:", rowData.addressTitle);
|
||||
// // Implementation would show quick preview
|
||||
// },
|
||||
// type: "button",
|
||||
// style: "info",
|
||||
// icon: "pi pi-search",
|
||||
// rowAction: true, // Row action - appears in each row's actions column
|
||||
// layout: {
|
||||
// priority: "secondary",
|
||||
// variant: "compact",
|
||||
// },
|
||||
// },
|
||||
];
|
||||
// Handle lazy loading events from DataTable
|
||||
const handleLazyLoad = async (event) => {
|
||||
|
|
@ -306,35 +278,50 @@ const handleLazyLoad = async (event) => {
|
|||
};
|
||||
// Status button click handlers
|
||||
const handleAppointmentClick = (status, rowData) => {
|
||||
const address = encodeURIComponent(rowData.address);
|
||||
if (status?.toLowerCase() === "not started") {
|
||||
// Navigate to schedule on-site meeting
|
||||
const address = encodeURIComponent(rowData.address);
|
||||
router.push(`/schedule-onsite?new=true&address=${address}`);
|
||||
} else {
|
||||
// Navigate to view appointment details
|
||||
router.push('/schedule-onsite?address=' + address);
|
||||
}
|
||||
};
|
||||
|
||||
const handleEstimateClick = (status, rowData) => {
|
||||
const address = encodeURIComponent(rowData.address);
|
||||
if (status?.toLowerCase() === "not started") {
|
||||
// Navigate to create quotation/estimate
|
||||
const address = encodeURIComponent(rowData.address);
|
||||
router.push(`/estimate?new=true&address=${address}`);
|
||||
} else {
|
||||
// Navigate to view estimate details
|
||||
router.push('/estimate?address=' + address);
|
||||
}
|
||||
};
|
||||
|
||||
const handlePaymentClick = (status, rowData) => {
|
||||
if (status?.toLowerCase() === "not started") {
|
||||
// Navigate to payment processing
|
||||
const address = encodeURIComponent(rowData.address);
|
||||
router.push(`/payments?new=true&address=${address}`);
|
||||
}
|
||||
notifications.addWarning("Payment view/create coming soon!");
|
||||
// const address = encodeURIComponent(rowData.address);
|
||||
// if (status?.toLowerCase() === "not started") {
|
||||
// // Navigate to payment processing
|
||||
// router.push(`/payments?new=true&address=${address}`);
|
||||
// }
|
||||
// else {
|
||||
// // Navigate to view payment details
|
||||
// router.push('/payments?address=' + address);
|
||||
// }
|
||||
};
|
||||
|
||||
const handleJobClick = (status, rowData) => {
|
||||
if (status?.toLowerCase() === "not started") {
|
||||
// Navigate to job creation
|
||||
const address = encodeURIComponent(rowData.address);
|
||||
router.push(`/jobs?new=true&address=${address}`);
|
||||
}
|
||||
notifications.addWarning("Job view/create coming soon!");
|
||||
// const address = encodeURIComponent(rowData.address);
|
||||
// if (status?.toLowerCase() === "not started") {
|
||||
// // Navigate to job creation
|
||||
// router.push(`/job?new=true&address=${address}`);
|
||||
// } else {
|
||||
// // Navigate to view job details
|
||||
// router.push('/job?address=' + address);
|
||||
// }
|
||||
};
|
||||
|
||||
// Watch for filters change to update status counts
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@
|
|||
/>
|
||||
</div>
|
||||
<div v-if="estimate">
|
||||
<Button label="Send Estimate" @click="showConfirmationModal = true"/>
|
||||
<Button label="Send Estimate" @click="showConfirmationModal = true" :disabled="estimate.docstatus !== 0"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -196,7 +196,7 @@
|
|||
@click="showConfirmationModal = false"
|
||||
severity="secondary"
|
||||
/>
|
||||
<Button label="Send Estimate" @click="confirmAndSendEstimate" />
|
||||
<Button label="Send Estimate" @click="confirmAndSendEstimate" :disabled="estimate.customSent !== 0" />
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
|
|
@ -371,9 +371,13 @@ const saveDraft = async () => {
|
|||
};
|
||||
|
||||
const confirmAndSendEstimate = async () => {
|
||||
loadingStore.setLoading(true, "Sending estimate...");
|
||||
const updatedEstimate = await Api.sendEstimateEmail(estimate.value.name);
|
||||
loadingStore.setLoading(false);
|
||||
notificationStore.addSuccess("Estimate sent successfully", "success");
|
||||
showConfirmationModal.value = false;
|
||||
// TODO: Implement send estimate functionality
|
||||
notificationStore.addWarning("Send estimate functionality coming soon");
|
||||
notificationStore.addWarning("Estimate has been locked and can no longer be edited.", "warning");
|
||||
estimate.value = updatedEstimate;
|
||||
};
|
||||
|
||||
const tableActions = [
|
||||
|
|
|
|||
|
|
@ -229,7 +229,6 @@ const completedJobs = computed(
|
|||
);
|
||||
const clientSatisfaction = computed(() => 94);
|
||||
const avgResponseTime = computed(() => 2.3);
|
||||
|
||||
const navigateTo = (path) => {
|
||||
router.push(path);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue