Bug 10402 [Template follow-up] Add multiple contacts for vendors
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / supplier.tt
blob420214f8feb160d719a4a140dd83e7a30c566e44
1 [% USE KohaDates %]
2 [% BLOCK edit_contact %]
3     <ol id="contact-form">
4         <input type="hidden" name="contact_id" value="[% contact.id %]" />
5         <li><label for="contact_name[% contact.id %]">Contact name: </label>
6             <input type="text" size="40" id="contact_name[% contact.id %]" name="contact_name" value="[% contact.name %]" /></li>
7         <li><label for="contact_position[% contact.id %]">Position: </label>
8             <input type="text" size="40" id="contact_position[% contact.id %]" name="contact_position" value="[% contact.position %]" /></li>
9         <li><label for="contact_phone[% contact.id %]">Phone: </label>
10                 <input type="text" size="20" id="contact_phone[% contact.id %]" name="contact_phone" value="[% contact.phone %]" /> </li>
11         <li><label for="contact_altphone[% contact.id %]">Alternative phone: </label>
12             <input type="text" size="20" id="contact_altphone[% contact.id %]" name="contact_altphone" value="[% contact.altphone %]" /></li>
13         <li><label for="contact_fax[% contact.id %]">Fax: </label>
14             <input type="text" size="20" id="contact_fax[% contact.id %]" name="contact_fax" value="[% contact.fax %]" /></li>
15         <li><label for="contact_email[% contact.id %]">Email: </label>
16             <input type="text" size="40" id="contact_email[% contact.id %]" name="contact_email" value="[% contact.email %]" /></li>
17         <li><label for="contact_notes[% contact.id %]">Notes: </label>
18             <textarea id="contact_notes[% contact.id %]" name="contact_notes" cols="40" rows="4">[% contnotes %]</textarea></li>
19         [% IF contact.id %]<li><button class="btn" class="delete-contact"><i class="icon-remove"></i> Delete contact</li>[% END %]
20     </ol>
21 [% END %]
23 [% BLOCK show_contact %]
24     <h3>[% contact.name %]</h3>
25     <p><span class="label">Position: </span>[% contact.position %]</p>
26     <p><span class="label">Phone: </span>[% contact.phone %]</p>
27     <p><span class="label">Alternative phone: </span>[% contact.altphone %]</p>
28     <p><span class="label">Fax: </span>[% contact.fax %]</p>
29     [% IF ( contact.email ) %]
30         <p><span class="label">Email: </span><a href="mailto:[% contact.email %]">[% contact.email %]</a></p>
31     [% END %]
32     [% IF ( contact.notes ) %]
33         <p><span class="label">Notes: </span>[% contact.notes %]</p>
34     [% END %]
35 [% END %]
37 [% INCLUDE 'doc-head-open.inc' %]
38 <title>Koha &rsaquo; Vendor [% bookselname %]</title>
39 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
40 [% INCLUDE 'doc-head-close.inc' %]
41 [% INCLUDE 'datatables.inc' %]
43 <script type="text/javascript">
44 //<![CDATA[
45 function confirm_deletion() {
46     if (confirm(_("Confirm deletion of this vendor ?"))) {
47         window.location="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]&op=delete";
48     }
51 function add_contact() {
52     var new_contact = $('#contact-template').clone();
53     var timestamp = new Date().getTime();
54     $(new_contact).removeAttr('id');
55     $('input, textarea', new_contact).each(function () {
56         $(this).attr('id', $(this).attr('id') + '_' + timestamp);
57     });
58     $('label', new_contact).each(function () {
59         $(this).attr('for', $(this).attr('for') + '_' + timestamp);
60     });
61     $(new_contact).insertBefore(this);
62     $('input[name="contact_name"]', new_contact).focus();
63     return false;
66 function delete_contact() {
67     $(this).parents('fieldset').delete();
68     return false;
71  $(document).ready(function() {
72     var contractst = $("#contractst").dataTable($.extend(true, {}, dataTablesDefaults, {
73         "aoColumnDefs": [
74           { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
75           { "sType": "title-string", "aTargets" : [ "title-string" ] }
76         ],
77         'sDom': 't'
78     } ) );
79     $('.delete-contact').click(delete_contact);
80     $('#add-contact').click(add_contact);
81  });
82 //]]>
83 </script>
84 </head>
85 <body id="acq_supplier" class="acq">
86 [% INCLUDE 'header.inc' %]
87 [% INCLUDE 'acquisitions-search.inc' %]
89 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; [% IF ( enter ) %][% IF ( booksellerid ) %] <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% name %]</a> &rsaquo; Update: [% name %][% ELSE %]Add vendor[% END %] [% ELSE %][% name %][% END %]</div>
91 <div id="doc3" class="yui-t2">
93 <div id="bd">
94     <div id="yui-main">
95     <div class="yui-b">
96     [% IF ( enter ) %]
97         [% IF ( booksellerid ) %]
98         <h1>Update: [% name %]</h1>
99     [% ELSE %]
100         <h1>Add vendor</h1>
101     [% END %]
102     [% END %]
103 [% UNLESS ( enter ) %][% INCLUDE 'acquisitions-toolbar.inc' %][% END %]
104 [% IF ( enter ) %]
105     <form action="updatesupplier.pl" name="updatesupplier" class="validated" method="post">
106     <div class="yui-g">
107         <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
108         <fieldset class="rows">
109             <legend>Company details</legend>
110             <ol><li><label for="company" class="required">Name:</label>
111                 <input type="text" size="40" id="company" name="company" value="[% name %]" required="required" class="required" /><span class="required">Required</span></li>
112             <li><label for="company_postal">Postal address: </label>
113                     <textarea id="company_postal" name="company_postal" cols="40" rows="3">[% postal %]</textarea></li>
114             <li><label for="physical">Physical address: </label>
115                 <textarea id="physical" name="physical" cols="40" rows="3">[% address1 %][% address2 %][% address3 %][% address4 %]</textarea></li>
116             <li><label for="company_phone">Phone: </label>
117                 <input type="text" size="20" id="company_phone" name="company_phone" value="[% phone %]" /></li>
118             <li><label for="company_fax">Fax: </label>
119                 <input type="text" size="20" id="company_fax" name="company_fax" value="[% fax %]" /></li>
120             <li><label for="website">Website: </label>
121                 <input type="text" size="40" id="website" name="website" value="[% url %]" /></li>
122             <li><label for="accountnumber">Account number: </label>
123                 <input type="text" size="40" id="accountnumber" name="accountnumber" value="[% accountnumber %]" /></li></ol>
124         </fieldset>
125         <fieldset class="rows">
126             <legend>Contacts</legend>
127             <fieldset id="contact-template" class="supplier-contact">
128                 <legend>Contact details</legend>
129                 [% INCLUDE edit_contact %]
130             </fieldset>
131             [% FOREACH contact IN contacts %]
132                 <fieldset class="supplier-contact">
133                     <legend>Contact details</legend>
134                     [% INCLUDE edit_contact %]
135                 </fieldset>
136             [% END %]
137             <button id="add-contact" class="btn"><i class="icon-plus"></i> Add another contact</button>
138         </fieldset>
139     </div>
140         <div class="yui-g">
141         <fieldset class="rows">
142             <legend>Ordering information</legend>
143             <ol class="radio"><li><label for="activestatus" class="radio">Vendor is:</label>
144                     [% IF ( active ) %]
145                         <label for="activestatus">Active</label> <input type="radio" id="activestatus" name="status" value="1" checked="checked" />
146                         <label for="inactivestatus">Inactive</label> <input type="radio" id="inactivestatus" name="status" value="0" />
147                     [% ELSE %]
148                         <label for="activestatus">Active</label> <input type="radio" id="activestatus" name="status" value="1" />
149                         <label for="inactivestatus">Inactive</label> <input type="radio" id="inactivestatus" name="status" value="0" checked="checked" />
150                     [% END %]</li>
151             </ol>
152             <ol>
153             <li><label for="list_currency">List prices are: </label>
154                     <select name="list_currency" id="list_currency">
155                     [% FOREACH loop_currenc IN loop_currency %]
156                         [% IF ( loop_currenc.listprice ) %]<option value="[% loop_currenc.currency %]" selected="selected">[% loop_currenc.currency %]</option>
157                         [% ELSE %]<option value="[% loop_currenc.currency %]">[% loop_currenc.currency %]</option>[% END %]
158                     [% END %]
159                     </select>
160             </li>
161             <li><label for="invoice_currency">Invoice prices are: </label>
162                     <select name="invoice_currency" id="invoice_currency">
163                     [% FOREACH loop_currenc IN loop_currency %]
164                         [% IF ( loop_currenc.invoiceprice ) %]<option value="[% loop_currenc.currency %]" selected="selected">[% loop_currenc.currency %]</option>
165                         [% ELSE %]<option value="[% loop_currenc.currency %]">[% loop_currenc.currency %]</option>[% END %]
166                     [% END %]
167                     </select>
168             </li>
169             </ol>
170             <ol class="radio">
171             <li><label for="gstyes" class="radio">Tax number registered:</label>
172                 [% IF ( gstreg ) %]
173                     <label for="gstyes">Yes</label> <input type="radio" name="gst" id="gstyes" value="1" checked="checked" />
174                     <label for="gstno">No</label> <input type="radio" name="gst" id="gstno" value="0" />
175                 [% ELSE %]
176                     <label for="gstyes">Yes</label> <input type="radio" name="gst" id="gstyes" value="1" />
177                     <label for="gstno">No</label> <input type="radio" name="gst" id="gstno" value="0" checked="checked" />
178                 [% END %]</li>
179             
180             <li><label for="list_gstyes" class="radio">List prices:</label>
181                 [% IF ( listincgst ) %]
182                     <label for="list_gstyes">Include tax</label> <input type="radio" id="list_gstyes" name="list_gst" value="1" checked="checked" />
183                     <label for="list_gstno">Don't include tax</label> <input type="radio" id="list_gstno" name="list_gst" value="0" />
184                 [% ELSE %]
185                     <label for="list_gstyes">Include tax</label> <input type="radio" id="list_gstyes" name="list_gst" value="1" />
186                     <label for="list_gstno">Don't include tax</label> <input type="radio" id="list_gstno" name="list_gst" value="0" checked="checked" />
187                 [% END %]</li>
188             
189             <li><label for="invoice_gstyes" class="radio">Invoice prices:</label>
190                 [% IF ( invoiceincgst ) %]
191                     <label for="invoice_gstyes">Include tax</label> <input type="radio" id="invoice_gstyes" name="invoice_gst" value="1" checked="checked" />
192                     <label for="invoice_gstno">Don't include tax</label> <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" />
193                     [% ELSE %]
194                     <label for="invoice_gstyes">Include tax</label> <input type="radio" id="invoice_gstyes" name="invoice_gst" value="1" />
195                     <label for="invoice_gstno">Don't include tax</label> <input type="radio" id="invoice_gstno" name="invoice_gst" value="0" checked="checked" />
196                 [% END %]</li>
197             </ol>
198             [% IF gst_values %]
199                 <ol>
200                   <li>
201                     <label for="gstrate">Tax rate: </label>
202                     <select name="gstrate" id="gstrate">
203                     [% FOREACH gst IN gst_values %]
204                       [% IF ( gstrate == gst.option ) %]
205                         <option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format ("%.1f") %] %</option>
206                       [% ELSE %]
207                         <option value="[% gst.option %]">[% gst.option * 100 | format ("%.1f") %] %</option>
208                       [% END %]
209                     [% END %]
210                     </select>
211                   </li>
212                 </ol>
213             [% ELSE %]
214                 <input type="hidden" name="gstrate" value="0" />
215             [% END %]
216             <ol>
217             <li><label for="discount">Discount: </label>
218                 <input type="text" size="6" id="discount" name="discount" value="[% discount | format ("%.1f") %]" />%</li>
219             <li>
220                 <label for="deliverytime">Delivery time: </label>
221                 <input type="text" size="2" id="deliverytime" name="deliverytime" value="[% deliverytime %]" /> days
222             </li>
223             <li><label for="notes">Notes: </label>
224                 <textarea cols="40" rows="4" id="notes" name="notes" >[% notes %]</textarea></li></ol>
225         </fieldset>
226         <fieldset class="action"><input type="submit" value="Save" /> [% IF ( booksellerid ) %]
227         <a class="cancel" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% ELSE %]<a class="cancel" href="/cgi-bin/koha/acqui/acqui-home.pl">
228         [% END %]Cancel</a></fieldset>
229         </div>
230     </form>
231 [% ELSE %]
232     <h1>[% name %]</h1>
233         <div class="yui-g">
234             <div id="supplier-company-details" class="yui-u first">
235                 <h2>Vendor details</h2>
236                 <p><span class="label">Company name: </span>[% name %]</p>
237                 <p><span class="label">Postal address: </span>[% postal %]</p>
238                 <p><span class="label">Physical address: </span>[% address1 %][% address2 %][% address3 %][% address4 %]</p>
239                 <p><span class="label">Phone: </span>[% phone %]</p>
240                 <p><span class="label">Fax: </span>[% fax %]</p>
241                 [% IF ( url ) %]
242                     <p><span class="label">Website: </span><a href="[% url %]" target="_blank">[% url %]</a></p>
243                 [% END %]
244                 [% IF ( accountnumber ) %]
245                     <p><span class="label">Account number: </span>[% accountnumber %]</p>
246                 [% END %]
248             <div id="supplier-ordering-information">
249             <h2>Ordering information</h2>
250                 <p><strong>Vendor is: </strong>
251                         [% IF ( active ) %]
252                             Active
253                         [% ELSE %]
254                             Inactive
255                         [% END %]</p>
256                 <p><strong>List prices are: </strong>[% listprice %]</p>
257                 <p><strong>Invoice prices are: </strong>[% invoiceprice %]</p>
258                 [% IF ( gstrate ) %]<p><strong>Tax number registered: </strong>
259                         [% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</p>
260                 <p><strong>List item price includes tax: </strong>
261                         [% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</p>
262                 <p><strong>Invoice item price includes tax: </strong>
263                         [% IF ( invoiceincgst ) %]Yes[% ELSE %]No[% END %]</p>[% END %]
264                 <p><strong>Discount: </strong>
265                     [% discount | format("%.1f") %] %</p>
266                 <p><strong>Tax rate: </strong>
267                     [% 0 + gstrate * 100 | format("%.1f") %] %</p>
268                 [% IF deliverytime.defined %]
269                     <p><strong>Delivery time: </strong>
270                         [% deliverytime %] days</p>
271                 [% END %]
272                 [% IF ( notes ) %]<p><strong>Notes: </strong>
273                     [% notes %]</p>[% END %]
274             </div>
275             </div>
277             <div class="supplier-contact-details yui-u">
278                 <h2>Contact</h2>
279                 [% FOREACH contact IN contacts %]
280                     [% INCLUDE show_contact %]
281                 [% END %]
282             </div>
284         </div>
286         [% IF ( contracts ) %]
287             <div id="supplier-contracts" class="yui-g">
288                 <h2>Contract(s)</h2>
289                 <table id="contractst">
290                   <thead>
291                     <tr>
292                         <th scope="col">Name</th>
293                         <th scope="col">Description</th>
294                         <th scope="col" class="title-string">Start date</th>
295                         <th scope="col" class="title-string">End date</th>
296                         <th scope="col">&nbsp; </th>
297                         <th scope="col">&nbsp; </th>
298                     </tr>
299                   </thead>
300                   <tbody>
301                     [% FOREACH contract IN contracts %]
302                         [% IF ( loop.even ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
303                         <td>
304                             <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;contractnumber=[% contract.contractnumber %]&amp;booksellerid=[% contract.booksellerid %]">[% contract.contractname %]</a>
305                         </td>
306                         <td>[% contract.contractdescription %]</td>
307                         <td><span title="[% contract.contractstartdate %]">[% contract.contractstartdate | $KohaDates %]</span></td>
308                         <td><span title="[% contract.contractenddate %]">[% contract.contractenddate | $KohaDates %]</span></td>
309                         <td><a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;contractnumber=[% contract.contractnumber %]&amp;booksellerid=[% contract.booksellerid %]">Edit</a></td>
310                         <td><a href="/cgi-bin/koha/admin/aqcontract.pl?op=delete_confirm&amp;contractnumber=[% contract.contractnumber %]&amp;booksellerid=[% contract.booksellerid %]">Delete</a></td>
311                         </tr>
312                     [% END %]
313                   </tbody>
314                 </table>
315             </div>
316         [% END %]
318 [% END %]
320 </div>
321 </div>
322 <div class="yui-b">
323 [% INCLUDE 'vendor-menu.inc' %]
324 </div>
325 </div>
326 [% INCLUDE 'intranet-bottom.inc' %]