get create client working
This commit is contained in:
parent
4a3576168a
commit
cb33d0c3b3
11 changed files with 1179 additions and 336 deletions
|
|
@ -328,8 +328,12 @@ class Api {
|
|||
return await this.request(FRAPPE_GET_CLIENT_NAMES_METHOD, { type });
|
||||
}
|
||||
|
||||
static async getClientNames(type) {
|
||||
return await this.request(FRAPPE_GET_CLIENT_NAMES_METHOD, { type });
|
||||
static async getClientNames(clientName) {
|
||||
return await this.request(FRAPPE_GET_CLIENT_NAMES_METHOD, { searchTerm: clientName });
|
||||
}
|
||||
|
||||
static async searchClientNames(searchTerm) {
|
||||
return await this.request("custom_ui.api.db.clients.search_client_names", { searchTerm });
|
||||
}
|
||||
|
||||
static async getCompanyNames() {
|
||||
|
|
@ -342,8 +346,7 @@ class Api {
|
|||
// Create methods
|
||||
|
||||
static async createClient(clientData) {
|
||||
const payload = DataUtils.toSnakeCaseObject(clientData);
|
||||
const result = await this.request(FRAPPE_UPSERT_CLIENT_METHOD, { data: payload });
|
||||
const result = await this.request(FRAPPE_UPSERT_CLIENT_METHOD, { data: clientData });
|
||||
console.log("DEBUG: API - Created/Updated Client: ", result);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -391,7 +394,10 @@ class Api {
|
|||
if (!places || places.length === 0) {
|
||||
throw new Error(`No location data found for zip code ${zipcode}`);
|
||||
}
|
||||
return places;
|
||||
return places.map((place) => ({
|
||||
city: place["place name"],
|
||||
state: place["state abbreviation"],
|
||||
}));
|
||||
}
|
||||
|
||||
static async getGeocode(address) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue