Bug 21526: Use the 'url' filter when needed
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / aqcontract.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Acquisitions &rsaquo; Contracts &rsaquo;
7 [% IF ( add_form ) %]
8     [% IF ( contractnumber ) %]Modify contract '[% contractname | html %]'
9 [% ELSE %]New contract[% END %]
10 [% END %]
11 [% IF ( else ) %]Contracts of [% booksellername | html %][% END %]
12 [% IF ( add_validate ) %]Data recorded[% END %]
13 [% IF ( delete_confirm ) %]Confirm deletion of contract '[% contractnumber | html %]'[% END %]
14 [% IF ( delete_confirmed ) %]Contract deleted[% END %]</title>
15 [% INCLUDE 'doc-head-close.inc' %]
16 </head>
17
18 <body id="acq_aqcontract" class="acq">
19 [% INCLUDE 'header.inc' %]
20 [% INCLUDE 'contracts-admin-search.inc' %]
21
22 <div id="breadcrumbs">
23     <a href="/cgi-bin/koha/mainpage.pl">Home</a>
24     &rsaquo;
25     <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
26     &rsaquo;
27     <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a>
28     &rsaquo;
29     [% IF ( add_form ) %]
30         <a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid | uri %]">Contracts</a>
31         &rsaquo;
32         [% IF ( contractnumber ) %]Modify contract '[% contractname | html %]'
33         [% ELSE %]New contract
34         [% END %]
35     [% END %]
36     [% IF ( add_validate ) %]
37         <a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid | uri %]">Contracts</a>
38         &rsaquo; Data recorded
39     [% END %]
40     [% IF ( delete_confirm ) %]
41         <a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid | uri %]">Contracts</a>
42         &rsaquo; Confirm deletion of contract [% contractnumber | html %]
43     [% END %]
44     [% IF ( delete_confirmed ) %]
45         <a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid | uri %]">Contracts</a> &rsaquo; Contract deleted
46     [% END %]
47     [% IF ( else ) %]Contracts[% END %]
48 </div>
49
50 <div class="main container-fluid">
51     <div class="row">
52         <div class="col-sm-10 col-sm-push-2">
53             <main>
54
55 [% INCLUDE 'acquisitions-toolbar.inc' %]
56
57 [% IF error == 'not_deleted' %]
58     <div class="dialog alert">Contract has not been deleted. Maybe a basket linked to this contract exists.</div>
59 [% END %]
60
61                 [% IF ( add_form ) %]
62                     <form name="Aform" action="/cgi-bin/koha/admin/aqcontract.pl" id="add_modify_contract" method="post">
63                         <input type="hidden" name="op" value="add_validate" />
64                         <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
65                         <input type="hidden" name="checked" value="0" />
66                         [% IF ( contractnumber ) %]
67                             <h1>Modify contract [% contractname | html %] for [% booksellername | html %]</h1>
68                         [% ELSE %]
69                             <h1>New contract for [% booksellername | html %]</h1>
70                         [% END %]
71                         <fieldset class="rows">
72                             <ol>
73                                 [% IF ( contractnumber ) %]
74                                         <li><span class="label">Contract id </span>[% contractnumber | html %]
75                                             <input type="hidden" name="contractnumber" value="[% contractnumber | html %]" />
76                                             <input type="hidden" name="is_a_modif" value="1" />
77                                         </li>
78                                 [% END %]
79                                 <li><label for="contractname" class="required">Name:</label> &nbsp;
80                                         <input type="text" name="contractname" id="contractname" size="40" maxlength="80" value="[% contractname | html %]" />
81                                         <span class="required">Required</span>
82                                 </li>
83                                 <li><label for="contractdescription">Description: </label> &nbsp;
84                                         <input type="text" name="contractdescription" id="contractdescription" size="40" maxlength="80" value="[% contractdescription | html %]" />
85                                 </li>
86                                 <li><label for="from" class="required">Start date:</label> &nbsp;
87                                         <input type="text" name="contractstartdate" id="from" value="[% contractstartdate | $KohaDates %]" maxlength="10" size="10" class="datepickerfrom" />
88                                         <span class="required">Required</span>
89                                     <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
90                                 </li>
91                                 <li><label for="to" class="required">End date:</label> &nbsp;
92                                         <input type="text" name="contractenddate" id="to" value="[% contractenddate | $KohaDates %]" maxlength="10"  size="10" class="datepickerto" />
93                                         <span class="required">Required</span>
94                                     <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
95                                 </li>
96                             </ol>
97                         </fieldset>
98                         <fieldset class="action">
99                             <input type="submit" value="Save" /> <a class="cancel" href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid | html %]&amp;contractnumber=[% contractnumber | html %]">Cancel</a>
100                         </fieldset>
101                     </form>
102             [% END %]
103             [% IF ( add_validate ) %]
104                 <h3>Data recorded</h3>
105                 <form action="[% script_name | html %]" method="post">
106                     <input type="submit" value="OK" />
107                 </form>
108             [% END %]
109             [% IF ( delete_confirm ) %]
110                     <div class="dialog alert">
111                         <h3>Confirm deletion of contract <i>[% contractname | html %]</i></h3>
112                         <table>
113                             <tr><th scope="row">Contract number:</th><td>[% contractnumber | html %]</td></tr>
114                             <tr><th scope="row">Contract name:</th><td>[% contractname | html %]</td></tr>
115                             <tr><th scope="row">Contract description:</th><td>[% contractdescription | html %]</td></tr>
116                             <tr><th scope="row">Contract start date:</th><td>[% contractstartdate | $KohaDates %]</td></tr>
117                             <tr><th scope="row">Contract end date:</th><td>[% contractenddate | $KohaDates %]</td></tr>
118                             <tr><th scope="row">Vendor:</th><td>[% booksellername | html %]</td></tr>
119                         </table>
120                         <form action="[% script_name | html %]" method="post">
121                             <input type="hidden" name="op" value="delete_confirmed" />
122                             <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
123                             <input type="hidden" name="contractnumber" value="[% contractnumber | html %]" />
124                             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete contract</button>
125                         </form>
126                         <form action="/cgi-bin/koha/admin/aqcontract.pl" method="get">
127                             <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
128                             <input type="hidden" name="contractnumber" value="[% contractnumber | html %]" />
129                             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
130                         </form>
131                     </div>
132             [% END %]
133             [% IF ( delete_confirmed ) %]
134                 <h3>Contract deleted</h3>
135                 <form action="[% script_name | html %]" method="post">
136                     <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
137                     <input type="submit" value="OK" />
138                 </form>
139             [% END %]
140             [% IF ( else ) %]
141                 <h2>Contract(s) of [% booksellername | html %]</h2>
142                 [% IF ( loop ) %]
143                     <table>
144                         <tr>
145                             <th scope="col">Name</th>
146                             <th scope="col">Description</th>
147                             <th scope="col">Start date</th>
148                             <th scope="col">End date</th>
149                             <th scope="col">Actions</th>
150                         </tr>
151                     [% FOREACH loo IN loop %]
152                         <tr>
153                         <td>
154                             <a href="[% loo.script_name | url %]?op=add_form&amp;booksellerid=[% loo.booksellerid | uri %]&amp;contractnumber=[% loo.contractnumber | uri %]">[% loo.contractname | html %]</a>
155                         </td>
156                         <td>[% loo.contractdescription | html %]</td>
157                         <td>[% loo.contractstartdate | html %]</td>
158                         <td>[% loo.contractenddate | html %]</td>
159                         <td class="actions">
160                             <a href="[% loo.script_name | url %]?op=add_form&amp;contractnumber=[% loo.contractnumber | uri %]&amp;booksellerid=[% loo.booksellerid | uri %]" class="btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
161                             <a href="[% loo.script_name | url %]?op=delete_confirm&amp;contractnumber=[% loo.contractnumber | uri %]&amp;booksellerid=[% loo.booksellerid | uri %]" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</a>
162                         </td>
163                         </tr>
164                     [% END %]
165                 </table>
166                 [% ELSE %]
167                     <div class="dialog message">
168                         There are no contracts with this vendor.
169                         [% IF active %]
170                             <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;booksellerid=[% booksellerid | uri %]">Add a contract</a>.
171                         [% END %]
172                     </div>
173                 [% END %]
174             [% END %]
175
176             </main>
177         </div> <!-- /.col-sm-10.col-sm-push-2 -->
178
179         <div class="col-sm-2 col-sm-pull-10">
180             <aside>
181                 [% INCLUDE 'acquisitions-menu.inc' %]
182             </aside>
183         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
184      </div> <!-- /.row -->
185
186 [% MACRO jsinclude BLOCK %]
187     [% INCLUDE 'calendar.inc' %]
188     [% Asset.js("js/acq.js") | $raw %]
189     <script>
190         $(document).ready(function(){
191             $("#add_modify_contract").validate({
192                 rules: {
193                     contractstartdate: "required",
194                     contractname: "required",
195                     contractenddate: {
196                         required: true,
197                         date_on_or_after: "#from"
198                     }
199                 },
200                 messages: {
201                     contractenddate: {
202                         date_on_or_after: _("Contract end date must be on or after contract start date")
203                     }
204                 }
205             });
206         });
207     </script>
208 [% END %]
209 [% INCLUDE 'intranet-bottom.inc' %]