Bug 10651 - (follow-up) add DataTables include to admin/aqbudgets.tt
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / aqcontract.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Acquisitions &rsaquo; Contracts &rsaquo;
3 [% IF ( add_form ) %]
4     [% IF ( contractnumber ) %]Modify contract '[% contractname %]'
5 [% ELSE %]New contract[% END %]
6 [% END %]
7 [% IF ( else ) %]Contracts of [% booksellername %][% END %]
8 [% IF ( add_validate ) %]Data recorded[% END %]
9 [% IF ( delete_confirm ) %]Confirm deletion of contract '[% contractnumber %]'[% END %]
10 [% IF ( delete_confirmed ) %]Contract deleted[% END %]</title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 [% INCLUDE 'calendar.inc' %]
13 <script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
14 <script type="text/javascript">
15 //<![CDATA[
16 // to check if the data are correctly entered.
17 function Check(ff) {
18     var ok=0;
19     var _alertString=_("Form not submitted because of the following problem(s)");
20     _alertString +="\n-------------------------------------------------------------------\n\n";
21     if (!(isNotNull(ff.contractname,0))){
22         ok=1;
23         _alertString += _("- Name missing") + "\n";
24     }
25     var startDate = Date_from_syspref($("#from").val());
26     var endDate   = Date_from_syspref($("#to").val());
27     if (!parseInt(startDate.getTime())) {
28         ok=1;
29         _alertString += _("- Start date missing or invalid.") + "\n";
30     }
31     if (!parseInt(endDate.getTime())) {
32         ok=1;
33         _alertString += _("- End date missing or invalid.") + "\n";
34     }
35     
36     if (startDate > endDate) {
37         ok=1;
38         _alertString += _("Wrong date! start date cannot be after end date.") + "\n";
39     }
40     if (endDate < (new Date)) {
41         ok=1;
42         _alertString += _("End date before today, Invalid end date!") + "\n";
43     }
44     if (ok) { // if there is a problem
45         alert(_alertString);
46     return false;
47 }
48 // if all is good
49     ff.submit();
50 }
51 //]]>
52 </script>
53 </head>
54 <body id="acq_aqcontract" class="acq">
55 [% INCLUDE 'header.inc' %]
56 [% INCLUDE 'contracts-admin-search.inc' %]
57
58 <div id="breadcrumbs">
59     <a href="/cgi-bin/koha/mainpage.pl">Home</a>
60     &rsaquo;
61     <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
62     &rsaquo;
63     <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername %]</a>
64     &rsaquo;
65     [% IF ( add_form ) %]
66         <a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid %]">Contracts</a>
67         &rsaquo;
68         [% IF ( contractnumber ) %]Modify contract '[% contractname %]'
69         [% ELSE %]New contract
70         [% END %]
71     [% END %]
72     [% IF ( add_validate ) %]
73         <a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid %]">Contracts</a>
74         &rsaquo; Data recorded
75     [% END %]
76     [% IF ( delete_confirm ) %]
77         <a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid %]">Contracts</a>
78         &rsaquo; Confirm deletion of contract [% contractnumber %]
79     [% END %]
80     [% IF ( delete_confirmed ) %]
81         <a href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid %]">Contracts</a> &rsaquo; Contract Deleted
82     [% END %]
83     [% IF ( else ) %]Contracts[% END %]
84 </div>
85
86 <div id="doc3" class="yui-t2">
87
88     <div id="bd">
89     <div id="yui-main">
90     <div class="yui-b">
91
92 [% INCLUDE 'acquisitions-toolbar.inc' %]
93                 [% IF ( add_form ) %]
94                     <form name="Aform" action="[% script_name %]" method="post">
95                         <input type="hidden" name="op" value="add_validate" />
96                         <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
97                         <input type="hidden" name="checked" value="0" />
98                         [% IF ( contractnumber ) %]
99                             <h1>Modify contract [% contractname %] for [% booksellername %]</h1>
100                         [% ELSE %]
101                             <h1>New contract for [% booksellername %]</h1>
102                         [% END %]
103                         <fieldset class="rows">
104                             <ol>
105                                 [% IF ( contractnumber ) %]
106                                         <li><span class="label">Contract id </span>[% contractnumber %]
107                                             <input type="hidden" name="contractnumber" value="[% contractnumber %]" />
108                                             <input type="hidden" name="is_a_modif" value="1" />
109                                         </li>
110                                 [% END %]
111                                 <li><label for="contractname" class="required">Name: *</label> &nbsp;
112                                         <input type="text" name="contractname" id="contractname" size="40" maxlength="80" value="[% contractname %]" />
113                                 </li>
114                                 <li><label for="contractdescription">Description: </label> &nbsp;
115                                         <input type="text" name="contractdescription" id="contractdescription" size="40" maxlength="80" value="[% contractdescription %]" />
116                                 </li>
117                                 <li><label for="from" class="required">Start date: *</label> &nbsp;
118                                         <input type="text" name="contractstartdate" id="from" value="[% contractstartdate %]" maxlength="10" size="10" class="datepickerfrom" />
119                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
120                                 </li>
121                                 <li><label for="to" class="required">End date: *</label> &nbsp;
122                                         <input type="text" name="contractenddate" id="to" value="[% contractenddate %]" maxlength="10"  size="10" class="datepickerto" />
123                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
124                                 </li>
125                             </ol>
126                         </fieldset>
127                         <fieldset class="action">
128                             <input type="button" value="Save" onclick="Check(this.form);" /> <a class="cancel" href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid %]&amp;contractnumber=[% contractnumber %]">Cancel</a>
129                         </fieldset>
130                     </form>
131             [% END %]
132             [% IF ( add_validate ) %]
133                 <h3>Data recorded</h3>
134                 <form action="[% script_name %]" method="post">
135                     <input type="submit" value="OK" />
136                 </form>
137             [% END %]
138             [% IF ( delete_confirm ) %]
139                 <form action="[% script_name %]" method="post">
140                     <fieldset>
141                         <legend>Confirm deletion of contract [% contractnumber %]</legend>
142                         <table>
143                             <tr><th scope="row">Contract number:</th><td>[% contractnumber %]</td></tr>
144                             <tr><th scope="row">Contract name:</th><td>[% contractname %]</td></tr>
145                             <tr><th scope="row">Contract description:</th><td>[% contractdescription %]</td></tr>
146                             <tr><th scope="row">Contract start date:</th><td>[% contractstartdate %]</td></tr>
147                             <tr><th scope="row">Contract end date:</th><td>[% contractenddate %]</td></tr>
148                             <tr><th scope="row">Vendor:</th><td>[% booksellername %]</td></tr>
149                         </table>
150                         <fieldset class="action">
151                             <input type="hidden" name="op" value="delete_confirmed" />
152                             <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
153                             <input type="hidden" name="contractnumber" value="[% contractnumber %]" />
154                             <input type="submit" value="Delete this Contract" />
155                             <a class="cancel" href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid %]&amp;contractnumber=[% contractnumber %]">Cancel</a>
156                         </fieldset>
157                     </fieldset>
158                 </form>
159             [% END %]
160             [% IF ( delete_confirmed ) %]
161                 <h3>Contract deleted</h3>
162                 <form action="[% script_name %]" method="post">
163                     <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
164                     <input type="submit" value="OK" />
165                 </form>
166             [% END %]
167             [% IF ( else ) %]
168                 <h2>Contract(s) of [% booksellername %]</h2>
169                 [% IF ( loop ) %]
170                     <table>
171                         <tr>
172                             <th scope="col">Name</th>
173                             <th scope="col">Description</th>
174                             <th scope="col">Start date</th>
175                             <th scope="col">End date</th>
176                             <th scope="col" colspan="2">&nbsp; </th>
177                         </tr>
178                     [% FOREACH loo IN loop %]
179                         [% IF ( loop.even ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
180                         <td>
181                             <a href="[% loo.script_name %]?op=add_form&amp;booksellerid=[% loo.booksellerid %]&amp;contractnumber=[% loo.contractnumber %]">[% loo.contractname %]</a>
182                         </td>
183                         <td>[% loo.contractdescription %]</td>
184                         <td>[% loo.contractstartdate %]</td>
185                         <td>[% loo.contractenddate %]</td>
186                         <td><a href="[% loo.script_name %]?op=add_form&amp;contractnumber=[% loo.contractnumber %]&amp;booksellerid=[% loo.booksellerid %]">Edit</a></td>
187                         <td><a href="[% loo.script_name %]?op=delete_confirm&amp;contractnumber=[% loo.contractnumber %]&amp;booksellerid=[% loo.booksellerid %]">Delete</a></td>
188                         </tr>
189                     [% END %]
190                 </table>
191                 [% ELSE %]
192                 <div class="dialog message">There are no contracts with this vendor. <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;booksellerid=[% booksellerid %]">Add a contract</a>.</div>
193                 [% END %]
194             [% END %]
195 </div>
196 </div>
197 <div class="yui-b">
198 [% INCLUDE 'vendor-menu.inc' %]
199 </div>
200 </div>
201 [% INCLUDE 'intranet-bottom.inc' %]