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