[% 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' } %]
[% text('Account Number') %]
[% INCLUDE input element_data = { name = 'accno' id = 'accno-h' size = '20' value = form.accno type = 'text' class = 'control-code' } %]
[% text('Description') %]
[% INCLUDE input element_data = { id = 'desc-h' name = 'description' size = '40' value = form.description type = 'text' class = 'description' } %]
[% text('Heading') %]
[% 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' } %]
[% text('Account Number') %]
[% INCLUDE input element_data = { name = 'accno' size = '20' value = form.accno type = 'text' class = 'control-code' id = "accno-a" } %]
[% text('Description') %]
[% INCLUDE input element_data = { name = 'description' size = '40' value = form.description type = 'text' class = 'description' id = 'desc-a' } %]
[% text('Account Type') %]
[% 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' }; %]
[% text('Heading') %]
[% 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' }; %]
[% text('Negative balance heading') %]
[% INCLUDE select element_data = { name = 'heading_negative_balance' options = form.all_headings default_blank = 1 default_values = [form.heading_negative_balance] text_attr = 'text' value_attr = 'id' class = 'account' }; %]
Configuration
[% text('Summary account for') %]
[% 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' }; %]
[% IF gifis.size > 0 -%]
[% text('GIFI') %]
[% FOREACH g IN gifis; g.text = g.accno _ '--' _ g.description; END; INCLUDE select element_data={ name = 'gifi_accno' default_values = [form.gifi_accno] default_blank = 1 options = gifis text_attr = 'text' value_attr = 'accno' id = 'gifi-a' }; %]
[% END -%]
[% text('Options') %]
[% 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.id %]
[% INCLUDE input element_data={ name = 'obsolete' type = 'checkbox' label = text('Obsolete') checked = form.obsolete ? 'checked' : '' value = '1' } %]
[% END # IF ID %]
[% IF form.custom_link_descriptions.size %]
[% text('Custom Flags') %] [% 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 %]
[% text('Include in drop-down menus') %]
[% text('Receivables') %]
[% IF form.AR_amount; AR_amount = 'CHECKED'; END; INCLUDE input element_data={ name = 'AR_amount', type = 'checkbox', label = text('Income'), checked = AR_amount, value = 'AR_amount' } %]
[% IF form.AR_paid; AR_paid = 'CHECKED'; END; INCLUDE input element_data={ name = 'AR_paid', type = 'checkbox', label = text('Payment'), checked = AR_paid, value = 'AR_paid' } %]
[% IF form.AR_tax; AR_tax = 'CHECKED'; END; INCLUDE input element_data={ name = 'AR_tax', type = 'checkbox', label = text('Tax'), checked = AR_tax, value = 'AR_tax' } %]
[% IF form.AR_overpayment; AR_overpayment = 'CHECKED'; END; INCLUDE input element_data={ name = 'AR_overpayment', type = 'checkbox', label = text('Overpayment'), checked = AR_overpayment, value = 'AR_overpayment' } %]
[% IF form.AR_discount; AR_discount = 'CHECKED'; END; INCLUDE input element_data={ name = 'AR_discount', type = 'checkbox', label = text('Discount'), checked = AR_discount, value = 'AR_discount' } %]
[% text('Payables') %]
[% IF form.AP_amount; AP_amount= 'CHECKED'; END; INCLUDE input element_data={ name = 'AP_amount', type = 'checkbox', label = text('Expense/Asset'), checked = AP_amount, value = 'AP_amount'} %]
[% IF form.AP_paid; AP_paid= 'CHECKED'; END; INCLUDE input element_data={ name = 'AP_paid', type = 'checkbox', label = text('Payment'), checked = AP_paid, value = 'AP_paid'} %]
[% IF form.AP_tax; AP_tax = 'CHECKED'; END; INCLUDE input element_data={ name = 'AP_tax', type = 'checkbox', label = text('Tax'), checked = AP_tax, value = 'AP_tax' } %]
[% IF form.AP_overpayment; AP_overpayment= 'CHECKED'; END; INCLUDE input element_data={ name = 'AP_overpayment', type = 'checkbox', label = text('Overpayment'), checked = AP_overpayment, value = 'AP_overpayment'} %]
[% IF form.AP_discount; AP_discount= 'CHECKED'; END; INCLUDE input element_data={ name = 'AP_discount', type = 'checkbox', label = text('Discount'), checked = AP_discount, value = 'AP_discount'} %]
[% text('Tracking Items') %]
[% IF form.IC_sale; IC_sale= 'CHECKED'; END; INCLUDE input element_data={ name = 'IC_sale', type = 'checkbox', label = text('Income'), checked = IC_sale, value = 'IC_sale'} %]
[% IF form.IC_cogs; IC_cogs= 'CHECKED'; END; INCLUDE input element_data={ name = 'IC_cogs', type = 'checkbox', label = text('COGS'), checked = IC_cogs, value = 'IC_cogs'} %]
[% IF form.IC_taxpart; IC_taxpart= 'CHECKED'; END; INCLUDE input element_data={ name = 'IC_taxpart', type = 'checkbox', label = text('Tax'), checked = IC_taxpart, value = 'IC_taxpart'} %]
[% IF form.IC_returns;IC_returns= 'CHECKED'; END; INCLUDE input element_data={ name = 'IC_returns', type = 'checkbox', label = text('Returns'), checked = IC_returns, value = 'IC_returns'} %]
[% text('Non-tracking Items') %]
[% IF form.IC_income;IC_income= 'CHECKED'; END; INCLUDE input element_data={ name = 'IC_income', type = 'checkbox', label = text('Income'), checked = IC_income, value = 'IC_income'} %]
[% IF form.IC_expense;IC_expense= 'CHECKED'; END; INCLUDE input element_data={ name = 'IC_expense', type = 'checkbox', label = text('Expense'), checked = IC_expense, value = 'IC_expense'} %]
[% IF form.IC_taxservice; IC_taxservice= 'CHECKED'; END; INCLUDE input element_data={ name = 'IC_taxservice', type = 'checkbox', label = text('Tax'), checked = IC_taxservice, value = 'IC_taxservice'} %]
[% text('Fixed Assets') %]
[% IF form.Fixed_Asset;fixed_asset= 'CHECKED'; END; INCLUDE input element_data={ name = 'Fixed_Asset', type = 'checkbox', label = text('Fixed Asset'), #' checked = fixed_asset, value = 'Fixed_Asset'} %]
[% IF form.Asset_Dep;asset_dep = 'CHECKED'; END; INCLUDE input element_data={ name = 'Asset_Dep', type = 'checkbox', label = text('Depreciation'), checked = asset_dep, value = 'Asset_Dep'} %]
[% IF form.asset_expense;asset_expense = 'CHECKED'; END; INCLUDE input element_data={ name = 'asset_expense', type = 'checkbox', label = text('Expense'), checked = asset_expense, value = 'asset_expense'} %]
[% IF form.asset_gain;asset_gain = 'CHECKED'; END; INCLUDE input element_data={ name = 'asset_gain', type = 'checkbox', label = text('Gain'), checked = asset_gain, value = 'asset_gain'} %]
[% IF form.asset_loss;asset_loss = 'CHECKED'; END; INCLUDE input element_data={ name = 'asset_loss', type = 'checkbox', label = text('Loss'), checked = asset_loss, value = 'asset_loss'} %]

[% 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 %]

Translations
[% PROCESS input element_data = { type="hidden" name="languagecount" value=languages.size }; lang_index = 0; FOREACH language IN languages; lang_index = lang_index + 1; %]
[% language.description %] [% 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) } %]
[% END %]

[% 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 %]