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.call("get_supported_countries").then(r => {
|
||||||
frm.subdivisions_by_country = r.message.subdivisions_by_country;
|
frm.subdivisions_by_country = r.message.subdivisions_by_country;
|
||||||
const countries = r.message.countries.sort((a, b) => a.label.localeCompare(b.label));
|
frm.fields_dict.country.set_data(
|
||||||
countries.unshift({ value: "", label: __("Select Country ...") });
|
r.message.countries.sort((a, b) => a.label.localeCompare(b.label))
|
||||||
|
);
|
||||||
frm.set_df_property("country", "options", countries);
|
|
||||||
|
|
||||||
if (frm.doc.country) {
|
if (frm.doc.country) {
|
||||||
frm.trigger("set_subdivisions");
|
frm.trigger("set_subdivisions");
|
||||||
@ -35,11 +34,10 @@ frappe.ui.form.on("Holiday List", {
|
|||||||
set_subdivisions: function(frm) {
|
set_subdivisions: function(frm) {
|
||||||
const subdivisions = [...frm.subdivisions_by_country[frm.doc.country]];
|
const subdivisions = [...frm.subdivisions_by_country[frm.doc.country]];
|
||||||
if (subdivisions && subdivisions.length > 0) {
|
if (subdivisions && subdivisions.length > 0) {
|
||||||
subdivisions.unshift({ value: "", label: __("Select Subdivision ...") });
|
frm.fields_dict.subdivision.set_data(subdivisions);
|
||||||
frm.set_df_property("subdivision", "options", subdivisions);
|
|
||||||
frm.set_df_property("subdivision", "hidden", 0);
|
frm.set_df_property("subdivision", "hidden", 0);
|
||||||
} else {
|
} else {
|
||||||
frm.set_df_property("subdivision", "options", "");
|
frm.fields_dict.subdivision.set_data([]);
|
||||||
frm.set_df_property("subdivision", "hidden", 1);
|
frm.set_df_property("subdivision", "hidden", 1);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -115,13 +115,13 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "country",
|
"fieldname": "country",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Autocomplete",
|
||||||
"label": "Country"
|
"label": "Country"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "country",
|
"depends_on": "country",
|
||||||
"fieldname": "subdivision",
|
"fieldname": "subdivision",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Autocomplete",
|
||||||
"label": "Subdivision"
|
"label": "Subdivision"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -141,7 +141,7 @@
|
|||||||
"icon": "fa fa-calendar",
|
"icon": "fa fa-calendar",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-07-14 11:29:12.537263",
|
"modified": "2023-07-14 13:28:53.156421",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Setup",
|
"module": "Setup",
|
||||||
"name": "Holiday List",
|
"name": "Holiday List",
|
||||||
|
|||||||
@ -4004,8 +4004,6 @@ Search for a payment,Suche nach einer Zahlung,
|
|||||||
Search for anything ...,Nach etwas suchen ...,
|
Search for anything ...,Nach etwas suchen ...,
|
||||||
Search results for,Suchergebnisse für,
|
Search results for,Suchergebnisse für,
|
||||||
Select All,Alles auswählen,
|
Select All,Alles auswählen,
|
||||||
Select Country ...,Land auswählen ...,
|
|
||||||
Select Subdivision ...,Teilgebiet auswählen ...,
|
|
||||||
Select Difference Account,Wählen Sie Differenzkonto,
|
Select Difference Account,Wählen Sie Differenzkonto,
|
||||||
Select a Default Priority.,Wählen Sie eine Standardpriorität.,
|
Select a Default Priority.,Wählen Sie eine Standardpriorität.,
|
||||||
Select a company,Wählen Sie eine Firma aus,
|
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