Open boraxpr opened 6 months ago
let { data: quotations, error } = await supabase .from('quotations') .select('*')
ทำ reusable function Insert, Select, Update quotation
Data Structure
const createQuotationFormData = reactive({
// Fetch from Database
db: {
customers: ref([]),
customer: {
zipcode: ref(""),
address: ref(""),
tax_id: ref(""),
branch_code: ref(""),
branch_name: ref(""),
},
salesName: ref(),
currencies: ref([]),
projects: ref([]),
project: {
detail: ref(""),
},
},
// User Selected
userInputs: {
reference: ref(),
// DROPDOWNS
// Customer Name -> Customer Id -changes-> proc Customer Detail Fetching
customer_id: ref(),
currency: ref(),
project: ref(),
quotation: {
// DATE
date: ref(),
due_date: ref(),
},
credit_day: ref(),
//QUOTATION PRODUCTS
products: ref([]),
},
calculations: {
grand_total: ref(),
},
});
Supabase Data Retrieval for Quotation Form
Related tables : quotation, QuotationProduct