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