Admin: Anlegen, Bearbeiten und Löschen von Mandanten implementiert
[kivitendo-erp.git] / templates / webpages / admin / edit_client.html
diff --git a/templates/webpages/admin/edit_client.html b/templates/webpages/admin/edit_client.html
new file mode 100644 (file)
index 0000000..392b6c4
--- /dev/null
@@ -0,0 +1,129 @@
+[%- USE HTML %]
+[%- USE L %][%- USE LxERP -%]
+
+[%- INCLUDE 'common/flash.html' %]
+
+<h1>[% HTML.escape(title) %]</h1>
+
+<p>[% L.link(SELF.url_for(action="show"), LxERP.t8("Back")) %]</p>
+
+<form method="post" action="controller.pl" id="form">
+ [% L.hidden_tag("client.id", SELF.client.id) %]
+ [% L.hidden_tag("action", "") %]
+
+ <h2>[%- LxERP.t8("Settings") %]</h2>
+
+ <table>
+  <tr>
+   <th align="right">[% LxERP.t8('Client name') %]</th>
+   <td>[% L.input_tag("client.name", SELF.client.name) %]</td>
+  </tr>
+
+  <tr>
+   <th align="right">[% LxERP.t8('Default client') %]</th>
+   <td>[% L.checkbox_tag("client.is_default", label=LxERP.t8('This is the client to be selected by default on the login screen.'), checked=SELF.client.is_default) %]</td>
+  </tr>
+
+  <tr>
+   <th align="right">[% LxERP.t8('Database name') %]</th>
+   <td>[% L.input_tag("client.dbname", SELF.client.dbname, 'data-dbsettings'=1) %]</td>
+  </tr>
+
+  <tr>
+   <th align="right">[% LxERP.t8('Database host and port') %]</th>
+   <td>
+    [% L.input_tag("client.dbhost", SELF.client.dbhost, 'data-dbsettings'=1) %]
+    [% L.input_tag("client.dbport", SELF.client.dbport, 'data-dbsettings'=1, size=6) %]
+   </td>
+  </tr>
+
+  <tr>
+   <th align="right">[% LxERP.t8('Database user and password') %]</th>
+   <td>
+    [% L.input_tag("client.dbuser",   SELF.client.dbuser, 'data-dbsettings'=1) %]
+    [% L.input_tag("client.dbpasswd", SELF.client.dbpasswd, 'data-dbsettings'=1) %]
+   </td>
+  </tr>
+ </table>
+
+ <div>
+  [% L.button_tag("test_database_connectivity()", LxERP.t8("Test database connectivity")) %]
+ </div>
+
+ <h2>[%- LxERP.t8("Access to clients") %]</h2>
+
+[% IF SELF.all_users.size %]
+ <p>
+  [%- LxERP.t8("The following users will have access to this client") %]:
+ </p>
+
+ <div class="clearfix">
+  [% L.select_tag("client.users[]", SELF.all_users, id="client_users", title_key="login", default=SELF.client.users, default_key='id', multiple=1) %]
+  [% L.multiselect2side("client_users", labelsx => LxERP.t8("All users"), labeldx => LxERP.t8("Users that have access to this client")) %]
+ </div>
+
+[%- ELSE %]
+ <p>
+  [% LxERP.t8("No users have been created yet.") %]
+ </p>
+[%- END %]
+
+ <h2>[%- LxERP.t8("Group assignment") %]</h2>
+
+[% IF SELF.all_groups.size %]
+ <p>
+  [%- LxERP.t8("The following groups are valid for this client") %]:
+ </p>
+
+ <div class="clearfix">
+  [% L.select_tag("client.groups[]", SELF.all_groups, id="client_groups", title_key="name", default=SELF.client.groups, default_key='id', multiple=1) %]
+  [% L.multiselect2side("client_groups", labelsx => LxERP.t8("All groups"), labeldx => LxERP.t8("Groups valid for this client")) %]
+ </div>
+
+[%- ELSE %]
+ <p>
+  [% LxERP.t8("No groups have been created yet.") %]
+ </p>
+[%- END %]
+
+<hr size="3" noshade>
+
+<p>
+ [% L.link(SELF.url_for(action="show"), LxERP.t8("Back")) %]
+
+ [% L.button_tag("submit_with_action('save_client')", LxERP.t8("Save")) %]
+ [% IF SELF.client.id %]
+  [% L.button_tag("save_as_new()", LxERP.t8("Save as new")) %]
+  [% L.button_tag("submit_with_action('delete_client')", LxERP.t8("Delete"), confirm=LxERP.t8("Are you sure?")) %]
+ [%- END %]
+</p>
+
+</form>
+
+<script type="text/javascript">
+ <!--
+  function submit_with_action(action) {
+    $("#action").val("Admin/" + action);
+    $("#form").submit();
+  }
+
+  function save_as_new() {
+    var new_client_name = prompt("[% LxERP.t8("Please enter the name for the new client.") %]", "");
+    if (!new_client_name)
+      return;
+
+    $("#client_name").val(new_client_name);
+    $("#client_id").val("");
+    submit_with_action("save_client");
+  }
+
+  function test_database_connectivity() {
+    open_jqm_window({
+      url:  'controller.pl?action=Admin/test_database_connectivity',
+      data: $("INPUT[data-dbsettings=1]").serialize(),
+      type: 'POST'
+    });
+    return true;
+  }
+   -->
+</script>