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