build out client page, edit functionality, create functionality, data massager
This commit is contained in:
parent
f510645a31
commit
34f2c110d6
15 changed files with 1571 additions and 1681 deletions
|
|
@ -250,6 +250,10 @@ 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 getCompanyNames() {
|
||||
const companies = await this.getDocsList("Company", ["name"]);
|
||||
const companyNames = companies.map((company) => company.name);
|
||||
|
|
@ -311,6 +315,18 @@ class Api {
|
|||
}
|
||||
return places;
|
||||
}
|
||||
|
||||
static async getGeocode(address) {
|
||||
const urlSafeAddress = encodeURIComponent(address);
|
||||
const url = `https://nominatim.openstreetmap.org/search?format=jsonv2&q=${urlSafeAddress}`;
|
||||
const response = await this.request(FRAPPE_PROXY_METHOD, {
|
||||
url,
|
||||
method: "GET",
|
||||
headers: { "User-Agent": "FrappeApp/1.0 (+https://yourappdomain.com)" },
|
||||
});
|
||||
const { lat, lon } = response[0] || {};
|
||||
return { latitude: parseFloat(lat), longitude: parseFloat(lon) };
|
||||
}
|
||||
}
|
||||
|
||||
export default Api;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue