create estimate

This commit is contained in:
Casey 2025-11-26 16:47:53 -06:00
parent 2ea20a86e3
commit afa161a0cf
15 changed files with 1234 additions and 435 deletions

View file

@ -49,6 +49,42 @@ class Api {
}
}
static async getAddressByFullAddress(fullAddress) {
return await this.request("custom_ui.api.db.addresses.get_address_by_full_address", {
full_address: fullAddress,
});
}
static async getQuotationItems() {
return await this.request("custom_ui.api.db.estimates.get_quotation_items");
}
static async getEstimateFromAddress(fullAddress) {
return await this.request("custom_ui.api.db.estimates.get_estimate_from_address", {
full_address: fullAddress,
});
}
static async getAddress(fullAddress) {
return await this.request("custom_ui.api.db.addresses.get_address", { fullAddress });
}
static async getContactsForAddress(fullAddress) {
return await this.request("custom_ui.api.db.addresses.get_contacts_for_address", {
fullAddress,
});
}
static async getEstimate(estimateName) {
return await this.request("custom_ui.api.db.estimates.get_estimate", {
estimate_name: estimateName,
});
}
static async getEstimateItems() {
return await this.request("custom_ui.api.db.estimates.get_estimate_items");
}
static async searchAddresses(searchTerm) {
const filters = {
full_address: ["like", `%${searchTerm}%`],
@ -201,7 +237,6 @@ class Api {
const result = await this.request(FRAPPE_GET_ESTIMATES_METHOD, { options });
return result;
}
/**
@ -352,9 +387,7 @@ class Api {
}
static async createEstimate(estimateData) {
const payload = DataUtils.toSnakeCaseObject(estimateData);
const result = await this.request(FRAPPE_UPSERT_ESTIMATE_METHOD, { data: payload });
console.log("DEBUG: API - Created Estimate: ", result);
const result = await this.request(FRAPPE_UPSERT_ESTIMATE_METHOD, { data: estimateData });
return result;
}