Merge remote-tracking branch 'origin/new/bug_6875'
[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($("#contractstartdate").val());
26     var endDate   = Date_from_syspref($("#contractenddate").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>
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="doc" class="yui-t7">
87     <div id="bd">
88         <div id="yui-main">
89                 [% IF ( add_form ) %]
90                     <form name="Aform" action="[% script_name %]" method="post">
91                         <input type="hidden" name="op" value="add_validate" />
92                         <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
93                         <input type="hidden" name="checked" value="0" />
94                         [% IF ( contractnumber ) %]
95                             <h1>Modify contract [% contractname %] for [% booksellername %]</h1>
96                         [% ELSE %]
97                             <h1>New contract for [% booksellername %]</h1>
98                         [% END %]
99                         <fieldset class="rows">
100                             <ol>
101                                 [% IF ( contractnumber ) %]
102                                         <li><span class="label">Contract id </span>[% contractnumber %]
103                                             <input type="hidden" name="contractnumber" value="[% contractnumber %]" />
104                                             <input type="hidden" name="is_a_modif" value="1" />
105                                         </li>
106                                 [% END %]
107                                 <li><label for="contractname" class="required">Name *</label> &nbsp;
108                                         <input type="text" name="contractname" id="contractname" size="40" maxlength="80" value="[% contractname %]" />
109                                 </li>
110                                 <li><label for="contractdescription">Description</label> &nbsp;
111                                         <input type="text" name="contractdescription" id="contractdescription" size="40" maxlength="80" value="[% contractdescription %]" />
112                                 </li>
113                                 <li><label for="contractstartdate" class="required">Start date *</label> &nbsp;
114                                         <input type="text" name="contractstartdate" id="contractstartdate" value="[% contractstartdate %]" maxlength="10"  size="10"/>
115                                         <img src="[% themelang %]/lib/calendar/cal.gif" id="contractstartdate_button" alt="Show Calendar" />
116                                         <script language="JavaScript" type="text/javascript">
117                                             Calendar.setup(
118                                             {
119                                             inputField : "contractstartdate",
120                                             ifFormat : "[% DHTMLcalendar_dateformat %]",
121                                             button : "contractstartdate_button"
122                                             }
123                                             );
124                                         </script>
125                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
126                                 </li>
127                                 <li><label for="contractenddate" class="required">End date *</label> &nbsp;
128                                         <input type="text" name="contractenddate" id="contractenddate" value="[% contractenddate %]" maxlength="10"  size="10" />
129                                         <img src="[% themelang %]/lib/calendar/cal.gif" id="contractenddate_button" alt="Show Calendar" />
130                                         <script language="JavaScript" type="text/javascript">
131                                             Calendar.setup(
132                                             {
133                                             inputField : "contractenddate",
134                                             ifFormat : "[% DHTMLcalendar_dateformat %]",
135                                             button : "contractenddate_button"
136                                             }
137                                             );
138                                         </script>
139                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
140                                 </li>
141                             </ol>
142                         </fieldset>
143                         <fieldset class="action">
144                             <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>
145                         </fieldset>
146                     </form>
147             [% END %]
148             [% IF ( add_validate ) %]
149                 <h3>Data recorded</h3>
150                 <form action="[% script_name %]" method="post">
151                     <input type="submit" value="OK" />
152                 </form>
153             [% END %]
154             [% IF ( delete_confirm ) %]
155                 <form action="[% script_name %]" method="post">
156                     <fieldset>
157                         <legend>Confirm Deletion of Contract [% contractnumber %]</legend>
158                         <table>
159                             <tr><th scope="row">Contract number:</th><td>[% contractnumber %]</td></tr>
160                             <tr><th scope="row">Contract name:</th><td>[% contractname %]</td></tr>
161                             <tr><th scope="row">Contract description:</th><td>[% contractdescription %]</td></tr>
162                             <tr><th scope="row">Contract start date:</th><td>[% contractstartdate %]</td></tr>
163                             <tr><th scope="row">Contract end date:</th><td>[% contractenddate %]</td></tr>
164                             <tr><th scope="row">Vendor:</th><td>[% booksellername %]</td></tr>
165                         </table>
166                         <fieldset class="action">
167                             <input type="hidden" name="op" value="delete_confirmed" />
168                             <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
169                             <input type="hidden" name="contractnumber" value="[% contractnumber %]" />
170                             <input type="submit" value="Delete this Contract" />
171                             <a class="cancel" href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=[% booksellerid %]&amp;contractnumber=[% contractnumber %]">Cancel</a>
172                         </fieldset>
173                     </fieldset>
174                 </form>
175             [% END %]
176             [% IF ( delete_confirmed ) %]
177                 <h3>Contract Deleted</h3>
178                 <form action="[% script_name %]" method="post">
179                     <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
180                     <input type="submit" value="OK" />
181                 </form>
182             [% END %]
183             [% IF ( else ) %]
184                 <div id="toolbar">
185                     <script type="text/javascript">
186                         //<![CDATA[
187                         // prepare DOM for YUI Toolbar
188                         $(document).ready(function() {
189                         yuiToolbar();
190                         });
191                         // YUI Toolbar Functions
192                         function yuiToolbar() {
193                         new YAHOO.widget.Button("newcontract");
194                         }
195                         //]]>
196                     </script>
197                     <ul class="toolbar">
198                         <li><a id="newcontract" href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&amp;booksellerid=[% booksellerid %]">New Contract</a></li>
199                     </ul>
200                 </div>
201                 <h2>Contract(s) of [% booksellername %]</h2>
202                 [% IF ( loop ) %]
203                     <table>
204                         <tr>
205                             <th scope="col">Name</th>
206                             <th scope="col">Description</th>
207                             <th scope="col">Start date</th>
208                             <th scope="col">End date</th>
209                             <th scope="col" colspan="2">&nbsp; </th>
210                         </tr>
211                     [% FOREACH loo IN loop %]
212                         [% IF ( loop.even ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
213                         <td>
214                             <a href="[% loo.script_name %]?op=add_form&amp;booksellerid=[% loo.booksellerid %]&amp;contractnumber=[% loo.contractnumber %]">[% loo.contractname %]</a>
215                         </td>
216                         <td>[% loo.contractdescription %]</td>
217                         <td>[% loo.contractstartdate %]</td>
218                         <td>[% loo.contractenddate %]</td>
219                         <td><a href="[% loo.script_name %]?op=add_form&amp;contractnumber=[% loo.contractnumber %]&amp;booksellerid=[% loo.booksellerid %]">Edit</a></td>
220                         <td><a href="[% loo.script_name %]?op=delete_confirm&amp;contractnumber=[% loo.contractnumber %]&amp;booksellerid=[% loo.booksellerid %]">Delete</a></td>
221                         </tr>
222                     [% END %]
223                 </table>
224                 [% ELSE %]
225                 <div class="dialog message">There are no contracts with this vendor.</div>
226                 [% END %]
227             [% END %]
228         </div>
229 </div>
230 [% INCLUDE 'intranet-bottom.inc' %]