boraxpr / nuxtjs-supabase

https://nuxtjs-supabase.vercel.app
2 stars 1 forks source link

[Create] Quotation Form : Vue Setup #5

Open boraxpr opened 6 months ago

boraxpr commented 6 months ago

Supabase Data Retrieval for Quotation Form

Related tables : quotation, QuotationProduct

boraxpr commented 6 months ago

let { data: quotations, error } = await supabase .from('quotations') .select('*')

ทำ reusable function Insert, Select, Update quotation

boraxpr commented 5 months ago

Data Structure image

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(),
  },
});