epic-ts
[kivitendo-erp.git] / templates / webpages / requirement_spec / _form.html
1 [%- USE LxERP -%][%- USE L -%][%- USE HTML -%]
2 [%- DEFAULT id_prefix = 'basic_settings_form'
3             submit_as = 'post'
4 %]
5 <form method="post" action="controller.pl" id="[% id_prefix %]"[% UNLESS submit_as == 'post' %] class="edit-basic-settings-context-menu"[% END %]>
6  <h2>[% LxERP.t8("Edit general settings") %]</h2>
7
8  [% L.hidden_tag("id", SELF.requirement_spec.id, id=id_prefix _ '_id') %]
9  [% L.hidden_tag("requirement_spec.is_template", SELF.requirement_spec.is_template, id=id_prefix _ '_is_template') %]
10
11  <table class="rs_input_field">
12   <tr>
13    <td>[% LxERP.t8("Title") %]</td>
14    <td>[% L.input_tag("requirement_spec.title", SELF.requirement_spec.title, id=id_prefix _ '_title') %]</td>
15   </tr>
16
17   <tr>
18    <td>[% LxERP.t8("Requirement Spec Type") %]</td>
19    <td>[% L.select_tag("requirement_spec.type_id",  SELF.types, default=SELF.requirement_spec.type_id, title_key="description", id=id_prefix _ '_type_id') %]</td>
20   </tr>
21
22 [%- UNLESS SELF.requirement_spec.is_template %]
23
24   <tr>
25    <td>[% LxERP.t8("Requirement Spec Status") %]</td>
26    <td>[% L.select_tag("requirement_spec.status_id",  SELF.statuses, default=SELF.requirement_spec.status_id, title_key="description", id=id_prefix _ '_status_id') %]</td>
27   </tr>
28
29   <tr>
30    <td>[% LxERP.t8("Customer") %]</td>
31    <td>[% L.select_tag("requirement_spec.customer_id",  SELF.customers, default=SELF.requirement_spec.customer_id, title_key="name", id=id_prefix _ '_customer_id',
32                        onchange="kivi.requirement_spec.basic_settings_customer_changed('#" _ id_prefix _ "_customer_id', '#" _ id_prefix _ "_hourly_rate_as_number')") %]</td>
33   </tr>
34
35   <tr>
36    <td>[% LxERP.t8("Hourly Rate") %]</td>
37    <td>[% L.input_tag("requirement_spec.hourly_rate_as_number", SELF.requirement_spec.hourly_rate_as_number, id=id_prefix _ '_hourly_rate_as_number') %]</td>
38   </tr>
39
40 [%- END %]
41
42   [% cvars = SELF.requirement_spec.cvars_by_config %]
43
44   [% FOREACH var = cvars %]
45    <tr>
46     <td>[% HTML.escape(var.config.description) %]</td>
47
48     <td>
49       [% INCLUDE 'common/render_cvar_input.html'
50                  cvar_name_prefix = 'cvars.'
51       %]
52     </td>
53    </tr>
54   [% END %]
55
56  </table>
57
58 [%- IF SELF.copy_source %]
59  [%- L.hidden_tag('copy_source_id', SELF.copy_source.id) %]
60
61  <p>
62   [%- IF SELF.requirement_spec.is_template %]
63    [%- LxERP.t8("The new requirement spec template will be a copy of '#1'.", SELF.copy_source.title) %]
64   [%- ELSE %]
65    [%- LxERP.t8("The new requirement spec will be a copy of '#1' for customer '#2'.", SELF.copy_source.title, SELF.copy_source.customer.name) %]
66   [%- END %]
67  </p>
68 [%- END %]
69
70  <p>
71 [% IF submit_as == 'post' %]
72   [% L.hidden_tag("action", "RequirementSpec/dispatch", id=id_prefix _ '_action') %]
73   [% L.submit_tag("action_" _ (SELF.requirement_spec.id ? "update" : "create"), LxERP.t8('Save'), id=id_prefix _ '_action_update') %]
74   <a href="[% SELF.url_for(action="list", is_template=SELF.requirement_spec.is_template) %]">[% LxERP.t8('Abort') %]</a>
75 [% ELSE %]
76   [% L.ajax_submit_tag("controller.pl?action=RequirementSpec/update",  "#" _ id_prefix, LxERP.t8("Save"), id=id_prefix _ '_submit') %]
77   <script type="text/javascript"><!--
78   $(function() {
79     $("#[% id_prefix %] INPUT[type=text]").keydown(function(event) {
80       if(event.keyCode == 13) {
81         event.preventDefault();
82         $('#[% id_prefix %]_submit').click();
83         return false;
84       }
85     });
86   });
87 --></script>
88 [% END %]
89  </p>
90 </form>