build datatable

This commit is contained in:
Casey Wittrock 2025-10-23 17:08:17 -05:00
parent 6b0a3d9fa9
commit 73a3b67e0f
5 changed files with 141 additions and 65 deletions

View file

@ -9,7 +9,7 @@
Add
</button>
</div>
<DataTable v-if="tableData.length > 0" :data="tableData" :columns="columns" />
<DataTable :data="tableData" :columns="columns" />
</div>
</template>
<script setup>
@ -23,20 +23,25 @@ const onClick = () => {
frappe.new_doc("Customer");
};
const searchFields = { fields: ["full_name", "address", "email_id", "phone"] };
const columns = [
{ label: "Name", fieldName: "full_name" },
{ label: "Location", fieldName: "address" },
{ label: "Type", fieldName: "contact_type" },
{ label: "Contact", fieldName: "full_name" },
{ label: "Email", fieldName: "email_id" },
{ label: "Phone", fieldName: "phone" },
{ label: "Name", fieldName: "fullName", type: "text" },
{ label: "Appt. Scheduled", fieldName: "appointmentScheduled", type: "status" },
{ label: "Estimate Sent", fieldName: "estimateSent", type: "status" },
{ label: "Payment Received", fieldName: "paymentReceived", type: "status" },
{ label: "Job Status", fieldName: "jobStatus", type: "status" },
];
onMounted(async () => {
if (tableData.value.length > 0) {
return;
}
let data = await Api.getClientDetails();
console.log(data);
console.log(tableData.value);
// data = data.map((item) => [
// item.customer["customer_name"] || "",
// item.address["appointment_scheduled"] || "",
// item.address["estimate_sent"] || "",
// item.address["payment_received"] || "",
// item.address["job_status"] || "",
// ]);
tableData.value = data;
});
</script>