Compare commits
2 commits
37a405a1f2
...
54280ac78f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54280ac78f | ||
|
|
1a7f0d872a |
2 changed files with 49 additions and 2 deletions
|
|
@ -300,6 +300,12 @@
|
||||||
@click="$emit('rowClick', slotProps)"
|
@click="$emit('rowClick', slotProps)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-if="col.type === 'link'" #body="slotProps">
|
||||||
|
<button class="datatable-link"
|
||||||
|
@click="handleLinkClick(col, slotProps.data)">
|
||||||
|
{{ slotProps.data[col.fieldName] }}
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
</Column>
|
</Column>
|
||||||
|
|
||||||
<!-- Actions Column -->
|
<!-- Actions Column -->
|
||||||
|
|
@ -1096,6 +1102,17 @@ const handleStatusButtonClick = (column, rowData) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Handle link clicks
|
||||||
|
const handleLinkClick = (column, rowData) => {
|
||||||
|
try {
|
||||||
|
if (column.onLinkClick && typeof column.onLinkClick === "function") {
|
||||||
|
column.onLinkClick(rowData[column.fieldName], rowData);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error executing link click:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const getBadgeColor = (status) => {
|
const getBadgeColor = (status) => {
|
||||||
switch (status?.toLowerCase()) {
|
switch (status?.toLowerCase()) {
|
||||||
case "paid":
|
case "paid":
|
||||||
|
|
@ -1634,4 +1651,18 @@ defineExpose({
|
||||||
transform: none;
|
transform: none;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Link Styles */
|
||||||
|
.datatable-link {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.datatable-link:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -112,10 +112,11 @@ const columns = [
|
||||||
{
|
{
|
||||||
label: "Customer Name",
|
label: "Customer Name",
|
||||||
fieldName: "customerName",
|
fieldName: "customerName",
|
||||||
type: "text",
|
type: "link",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
filterable: true,
|
filterable: true,
|
||||||
filterInputId: "customerSearchInput",
|
filterInputId: "customerSearchInput",
|
||||||
|
onLinkClick: (link, rowData) => handleCustomerClick(link, rowData),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Type",
|
label: "Type",
|
||||||
|
|
@ -126,10 +127,11 @@ const columns = [
|
||||||
{
|
{
|
||||||
label: "Property",
|
label: "Property",
|
||||||
fieldName: "address",
|
fieldName: "address",
|
||||||
type: "text",
|
type: "link",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
filterable: true,
|
filterable: true,
|
||||||
filterInputId: "propertySearchInput",
|
filterInputId: "propertySearchInput",
|
||||||
|
onLinkClick: (link, rowData) => handlePropertyClick(link, rowData),
|
||||||
},
|
},
|
||||||
//{
|
//{
|
||||||
// label: "Create Estimate",
|
// label: "Create Estimate",
|
||||||
|
|
@ -297,6 +299,20 @@ const handleAppointmentClick = (status, rowData) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleCustomerClick = (link, rowData) => {
|
||||||
|
console.log("DEBUG: Customer Link Clicked.");
|
||||||
|
const client = encodeURIComponent(rowData.customerName);
|
||||||
|
const address = encodeURIComponent(rowData.address);
|
||||||
|
router.push(`/client?client=${client}&address=${address}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePropertyClick = (link, rowData) => {
|
||||||
|
console.log("DEBUG: Property Link Clicked.");
|
||||||
|
const client = encodeURIComponent(rowData.customerName);
|
||||||
|
const address = encodeURIComponent(rowData.address);
|
||||||
|
router.push(`/client?client=${client}&address=${address}`);
|
||||||
|
}
|
||||||
|
|
||||||
const handleEstimateClick = (status, rowData) => {
|
const handleEstimateClick = (status, rowData) => {
|
||||||
const address = encodeURIComponent(rowData.address);
|
const address = encodeURIComponent(rowData.address);
|
||||||
router.push(`/estimate?new=true&address=${address}`);
|
router.push(`/estimate?new=true&address=${address}`);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue