refactor(Holiday List): use autocomplete fieldtype
This commit is contained in:
parent
8aff5a1dab
commit
dab9688410
@ -9,10 +9,9 @@ frappe.ui.form.on("Holiday List", {
|
||||
|
||||
frm.call("get_supported_countries").then(r => {
|
||||
frm.subdivisions_by_country = r.message.subdivisions_by_country;
|
||||
const countries = r.message.countries.sort((a, b) => a.label.localeCompare(b.label));
|
||||
countries.unshift({ value: "", label: __("Select Country ...") });
|
||||
|
||||
frm.set_df_property("country", "options", countries);
|
||||
frm.fields_dict.country.set_data(
|
||||
r.message.countries.sort((a, b) => a.label.localeCompare(b.label))
|
||||
);
|
||||
|
||||
if (frm.doc.country) {
|
||||
frm.trigger("set_subdivisions");
|
||||
@ -35,11 +34,10 @@ frappe.ui.form.on("Holiday List", {
|
||||
set_subdivisions: function(frm) {
|
||||
const subdivisions = [...frm.subdivisions_by_country[frm.doc.country]];
|
||||
if (subdivisions && subdivisions.length > 0) {
|
||||
subdivisions.unshift({ value: "", label: __("Select Subdivision ...") });
|
||||
frm.set_df_property("subdivision", "options", subdivisions);
|
||||
frm.fields_dict.subdivision.set_data(subdivisions);
|
||||
frm.set_df_property("subdivision", "hidden", 0);
|
||||
} else {
|
||||
frm.set_df_property("subdivision", "options", "");
|
||||
frm.fields_dict.subdivision.set_data([]);
|
||||
frm.set_df_property("subdivision", "hidden", 1);
|
||||
}
|
||||
},
|
||||
|
@ -115,13 +115,13 @@
|
||||
},
|
||||
{
|
||||
"fieldname": "country",
|
||||
"fieldtype": "Select",
|
||||
"fieldtype": "Autocomplete",
|
||||
"label": "Country"
|
||||
},
|
||||
{
|
||||
"depends_on": "country",
|
||||
"fieldname": "subdivision",
|
||||
"fieldtype": "Select",
|
||||
"fieldtype": "Autocomplete",
|
||||
"label": "Subdivision"
|
||||
},
|
||||
{
|
||||
@ -141,7 +141,7 @@
|
||||
"icon": "fa fa-calendar",
|
||||
"idx": 1,
|
||||
"links": [],
|
||||
"modified": "2023-07-14 11:29:12.537263",
|
||||
"modified": "2023-07-14 13:28:53.156421",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Holiday List",
|
||||
|
@ -4004,8 +4004,6 @@ Search for a payment,Suche nach einer Zahlung,
|
||||
Search for anything ...,Nach etwas suchen ...,
|
||||
Search results for,Suchergebnisse für,
|
||||
Select All,Alles auswählen,
|
||||
Select Country ...,Land auswählen ...,
|
||||
Select Subdivision ...,Teilgebiet auswählen ...,
|
||||
Select Difference Account,Wählen Sie Differenzkonto,
|
||||
Select a Default Priority.,Wählen Sie eine Standardpriorität.,
|
||||
Select a company,Wählen Sie eine Firma aus,
|
||||
|
Can't render this file because it is too large.
|
Loading…
x
Reference in New Issue
Block a user