[% PROCESS elements.html; # Build text for dropdown options FOREACH h IN form.all_headings; h.text = h.accno _ '--' _ h.description; END; null_heading = [{ id = -1, text = '-- ' _ text('NONE') _ ' --' }]; %]
[% IF form.charttype == 'H'; %]
[% # if we put the FORM tag as the toplevel tab element, # we get trouble: content gets cut off; wrap in a div # although maybe the point is not to have the toplevel # be a *widget*...? %]
[% PROCESS input element_data = { value = 'H' name = 'charttype' type = 'hidden' } %] [% PROCESS input element_data = { value = form.id name = 'id' type = 'hidden' } %]
[% INCLUDE input element_data = { name = 'accno' id = 'accno-h' size = '20' value = form.accno type = 'text' class = 'control-code' } %]
[% INCLUDE input element_data = { id = 'desc-h' name = 'description' size = '40' value = form.description type = 'text' class = 'description' } %]
[% INCLUDE select element_data = { name = 'parent' options = null_heading.merge(form.all_headings) default_values = [form.parent_id] text_attr = 'text' value_attr = 'id' class = 'account' id = 'parent' }; %]

[% INCLUDE button element_data={ name = 'action', value = 'save' text = text('Save') 'data-lsmb-doing' = text('Saving...') 'data-lsmb-done' = text('Saved') }; IF form.id; INCLUDE button element_data={ name = 'action', value = 'save_as_new' text = text('Save as new') }; END; IF form.orphaned; INCLUDE button element_data={ name = 'action', value = 'delete' text = text('Delete') 'data-lsmb-doing' = text('Deleting...') 'data-lsmb-done' = text('Deleted') }; END; %]
[% END %] [% IF form.charttype == 'A' %]
[% PROCESS input element_data = { value = 'A' name = 'charttype' type = 'hidden' } %]
[% INCLUDE input element_data = { name = 'accno' size = '20' value = form.accno type = 'text' class = 'control-code' id = "accno-a" } %]
[% IF form.id %]
[% IF form.obsolete; obsolete = 'CHECKED'; END; INCLUDE input element_data={ name = 'obsolete' type = 'checkbox', checked = obsolete value = '1' } %]
[% END # IF ID %]
[% INCLUDE input element_data = { name = 'description' size = '40' value = form.description type = 'text' class = 'description' id = 'desc-a' } %]
[% INCLUDE select element_data = { name = 'heading' options = form.all_headings default_values = [form.heading] text_attr = 'text' value_attr = 'id' class = 'account' id = 'heading-a' }; %]
[% IF form.gifi_list.size > 0 -%]
[% FOREACH g IN form.gifi_list; g.text = g.accno _ '--' _ g.description; END; INCLUDE select element_data={ name = 'gifi_accno' default_values = [form.gifi_accno] default_blank = 1 options = form.gifi_list text_attr = 'text' value_attr = 'accno' id = 'gifi-a' }; %]
[% END -%]
[% a_types = [ { value = 'A', text = text('Asset') } { value = 'L', text = text('Liability') } { value = 'Q', text = text('Equity') } { value = 'Qt', text = text('Equity (Temporary)') } #' { value = 'I', text = text('Income') } { value = 'E', text = text('Expense') } ]; INCLUDE select element_data = { name = 'category' options = a_types default_values = [form.category] id = 'category-a' }; %]
[% IF form.contra; contra = 'CHECKED'; END; INCLUDE input element_data = { type = 'checkbox' name = 'contra' label = text('Contra') value = '1' checked = contra } %]
[% INCLUDE input element_data={ name = 'recon' type = 'checkbox', label = text('Recon') checked = form.account__is_recon ? 'checked' : '' value = '1' } %]
[% IF form.tax; tax = 'CHECKED'; END; INCLUDE input element_data={ name = 'tax', type = 'checkbox', label = text('Tax'), checked = tax, value = '1'} %]
[% IF form.custom_link_descriptions.size %]
[% FOREACH link IN form.custom_link_descriptions %]
[% INCLUDE input element_data={ name = link.description, type = 'checkbox', label = link.description, checked = form.${link.description} ? 'CHECKED' : '', value = link.description } %]
[% END %]
[% END %]
[% summary = []; # Localize summary account_link descriptions FOREACH account_link IN form.summary_link_descriptions; IF account_link.description == 'IC'; # Retain historic override for Inventory account_link.text = text('Inventory'); ELSE; account_link.text = maketext(account_link.description); END; IF form.${account_link.description}; summary = account_link.description; END; END; INCLUDE select element_data = { name = "summary" options = form.summary_link_descriptions default_values = summary default_blank = 'true' text_attr = 'text', value_attr = 'description' id = 'summary-a' }; %]

[% PROCESS input element_data = { value = form.id name = 'id' type = 'hidden' }; INCLUDE button element_data={ name = 'action', value = 'save' text = text('Save') 'data-lsmb-doing' = text('Saving...') 'data-lsmb-done' = text('Saved') }; IF form.id; INCLUDE button element_data={ name = 'action', value = 'save_as_new' text = text('Save as new') }; END; IF form.orphaned; INCLUDE button element_data={ name = 'action', value = 'delete' text = text('Delete') 'data-lsmb-doing' = text('Deleting...') 'data-lsmb-done' = text('Deleted') }; END; %]
[% END %] [% IF form.id %]
[% PROCESS input element_data = { type="hidden" name="languagecount" value=languages.size }; lang_index = 0; FOREACH language IN languages; lang_index = lang_index + 1; %] [% END %]
Translations
[% PROCESS input element_data = { type="hidden" name = 'languagecode_' _ lang_index value = language.code } %] [% PROCESS input element_data = { name = 'languagetranslation_' _ lang_index id = 'heading-languagetranslation-' _ lang_index class = 'translation' value = form.translations.${language.code}.description title = maketext(language.description) } %]
[% PROCESS input element_data = { name = 'charttype' type = 'hidden' value = form.charttype }; %] [% PROCESS input element_data = { name = 'id' type = 'hidden' value = form.id }; %] [% PROCESS button element_data = { name = 'action', value = 'update_translations', type = 'submit', class = 'submit', text = text('Save Translations'), 'data-lsmb-doing' = text('Saving Translations...') 'data-lsmb-done' = text('Saved Translations') } %]
[% END %]