[% WRAPPER "ui-header.html" stylesheet="ledgersmb.css" include_stylesheet=["system/setup.css"]; PROCESS "elements.html"; PROCESS "dynatable.html"; %]
[% IF request.pls_import; text('Duplicate User Found: Importing User'); action = 'save_user'; ELSIF user.user_id; text('Editing User'); action = 'edit_user'; ELSE; text('New User'); action = 'save_user'; END %]

[% IF user.user_id and not request.pls_import %]
[% text('Username') %] | [% user.username; INCLUDE input element_data = { name = 'username' type = 'hidden' value = user.username } %]
[% ELSE %]
[% text('Username') %] |
[% END %]
[% text('Password') %] | [% PROCESS input element_data = { type = "password" id = "password" name = "password" autocomplete = "off" } %]
[% IF (request.pls_import == 1) OR !user.username %]
[% text('Import') %] [% IF request.pls_import; importc1 = 'CHECKED'; importc0 = ''; ELSE; importc1 = ''; importc0 = 'CHECKED'; END; %] | [% INCLUDE input element_data = { label = 'Yes' value = '1' checked = importc1 name = 'pls_import' type = 'radio' } %] [% INCLUDE input element_data = { label = 'No' value = '0' checked = importc0 name = 'pls_import' type = 'radio' } %]
[% END # unless employee.entity_id %]

[% IF user.username and not request.pls_import; PROCESS button element_data = { text = text('Reset Password') #' name = '__action' type = 'submit' class = 'submit' value = 'reset_password' attributes = { autocomplete = "off" } }; ELSE; PROCESS button element_data = { text = text('Add User') #' name = '__action' type = 'submit' class = 'submit' value = 'create_user' }; END; %] [% IF user.user_id and not request.pls_import%]

[% PROCESS input element_data = { type="hidden" name="id" value=request.id }; %]

[% FOREACH role IN roles %] [% rolcheck = undef; IF user.roles.grep(role.name).size; rolcheck = "checked"; END %] [% PROCESS input element_data = { type = "checkbox" label = role.description value = 1 name = role.name id = role.name checked = rolcheck }, label_pos = 1 %] [% IF loop.even() %]
[% END %] [% END %]

[% PROCESS button element_data = { text = text('Save Groups') #' class = "submit" name = "__action" value = "save_user_roles" 'data-lsmb-doing' = text('Saving...') 'data-lsmb-done' = text('Saved') } %]

[% END %]
[% END %]