reordering code & debugging
[koha.git] / koha-tmpl / intranet-tmpl / default / en / bull / subscription-add.tmpl
1 <!-- TMPL_INCLUDE NAME="bull-top.inc" -->
2 <!--------------------------MAIN BODY OF PAGE-------------------------->
3 <div id="mainbloc">
4 <!-- TMPL_IF name="mod" -->
5         <h1 class="bull">Modify subscription</h1>
6         <form method="post" name="f" action="subscription-detail.pl">
7                 <input type="hidden" name="op" value="modsubscription">
8                 <input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR name="subscriptionid" -->">
9 <!-- TMPL_ELSE -->
10         <h1 class="bull">Add a subscription</h1>
11         <form method="post" name="f">
12 <!-- /TMPL_IF -->
13 <div id="bloc25">
14         <h2 class="bull">Subscription information</h2>
15                 <input type="hidden" name="op" value="addsubscription">
16                 <input type="hidden" name="user" value="<!-- TMPL_VAR name="user" -->">
17                 <p>Librarian</td><td> <!-- TMPL_VAR name="user" --></p>
18                 <p><label>Supplier (*):</label><input type="text" name="aqbooksellerid" value="<!-- TMPL_VAR name="aqbooksellerid"-->"><a href="#" OnClick="FindAcqui()">...</a></p>
19                 <p><label>Cost</label><input type="text" name="cost" value="<!-- TMPL_VAR name="cost" -->"></label></p>
20                 <p><label>Budget</label><input type="text" name="aqbudgetid" value="<!-- TMPL_VAR name="aqbudgetid" -->"></p>
21         <p><label>Biblio</label><input type="text" name="biblionumber" value="<!-- TMPL_VAR name="biblionumber" -->"> <a href="#" onClick="Plugin(f)">...</a></p>
22         <p><label>Notes</label><TEXTAREA NAME="notes" COLS=30 ROWS=2><!-- TMPL_VAR name="notes" --></TEXTAREA></p>
23 </div>
24 <div id="bloc25">
25         <h2 class="bull">Planning</h2>
26         <p><label class="label100">Beginnning date:</label> <input type="text" name="startdate" value="<!-- TMPL_VAR name="startdate" -->"></p>
27         <p><label class="label100">Frequency (*)</label>
28                         <select name="periodicity" size="1">
29                                 <option value="" selected>None</option>
30                                 <!-- TMPL_IF name="periodicity1" -->
31                                         <option value="1" selected>1/day</option>
32                                 <!-- TMPL_ELSE -->
33                                         <option value="1">1/day</option>
34                                 <!-- /TMPL_IF -->
35                                 <!-- TMPL_IF name="periodicity2" -->
36                                         <option value="2" selected>1 week</option>
37                                 <!-- TMPL_ELSE -->
38                                         <option value="2">1 week</option>
39                                 <!-- /TMPL_IF -->
40                                 <!-- TMPL_IF name="periodicity3" -->
41                                         <option value="3" selected>2 weeks</option>
42                                 <!-- TMPL_ELSE -->
43                                         <option value="3">2 weeks</option>
44                                 <!-- /TMPL_IF -->
45                                 <!-- TMPL_IF name="periodicity4" -->
46                                         <option value="4" selected>3 weeks</option>
47                                 <!-- TMPL_ELSE -->
48                                         <option value="4">3 weeks</option>
49                                 <!-- /TMPL_IF -->
50                                 <!-- TMPL_IF name="periodicity5" -->
51                                         <option value="5" selected>1 month</option>
52                                 <!-- TMPL_ELSE -->
53                                         <option value="5">1 month</option>
54                                 <!-- /TMPL_IF -->
55                                 <!-- TMPL_IF name="periodicity6" -->
56                                         <option value="6" selected>2 months</option>
57                                 <!-- TMPL_ELSE -->
58                                         <option value="6">2 months</option>
59                                 <!-- /TMPL_IF -->
60                                 <!-- TMPL_IF name="periodicity7" -->
61                                         <option value="7" selected>3 months</option>
62                                 <!-- TMPL_ELSE -->
63                                         <option value="7">3 months</option>
64                                 <!-- /TMPL_IF -->
65                                 <!-- TMPL_IF name="periodicity8" -->
66                                         <option value="8" selected>1 quarter</option>
67                                 <!-- TMPL_ELSE -->
68                                         <option value="8">1 quarter</option>
69                                 <!-- /TMPL_IF -->
70                                 <!-- TMPL_IF name="periodicity9" -->
71                                         <option value="9" selected>2 quarters</option>
72                                 <!-- TMPL_ELSE -->
73                                         <option value="9">2 quarters</option>
74                                 <!-- /TMPL_IF -->
75                                 <!-- TMPL_IF name="periodicity10" -->
76                                         <option value="10" selected>1 year</option>
77                                 <!-- TMPL_ELSE -->
78                                         <option value="10">1 year</option>
79                                 <!-- /TMPL_IF -->
80                                 <!-- TMPL_IF name="periodicity11" -->
81                                         <option value="11" selected>2 years</option>
82                                 <!-- TMPL_ELSE -->
83                                         <option value="11">2 years</option>
84                                 <!-- /TMPL_IF -->
85                         </select>
86         </p>
87         <p><label class="label100">Arrives on</label>
88                         <select name="dow" size="1">
89                                 <option value="">None</option>
90                                 <!-- TMPL_IF name="dow1" -->
91                                         <option value="1" selected>Monday</option>
92                                 <!-- TMPL_ELSE -->
93                                         <option value="1">Monday</option>
94                                 <!-- /TMPL_IF -->
95                                 <!-- TMPL_IF name="dow2" -->
96                                         <option value="2" selected>Tuesday</option>
97                                 <!-- TMPL_ELSE -->
98                                         <option value="2">Tuesday</option>
99                                 <!-- /TMPL_IF -->
100                                 <!-- TMPL_IF name="dow3" -->
101                                         <option value="3" selected>Wednesday</option>
102                                 <!-- TMPL_ELSE -->
103                                         <option value="3">Wednesday</option>
104                                 <!-- /TMPL_IF -->
105                                 <!-- TMPL_IF name="dow4" -->
106                                         <option value="4" selected>Thursday</option>
107                                 <!-- TMPL_ELSE -->
108                                         <option value="4">Thursday</option>
109                                 <!-- /TMPL_IF -->
110                                 <!-- TMPL_IF name="dow5" -->
111                                         <option value="5" selected>Friday</option>
112                                 <!-- TMPL_ELSE -->
113                                         <option value="5">Friday</option>
114                                 <!-- /TMPL_IF -->
115                                 <!-- TMPL_IF name="dow6" -->
116                                         <option value="6" selected>Saturday</option>
117                                 <!-- TMPL_ELSE -->
118                                         <option value="6">Saturday</option>
119                                 <!-- /TMPL_IF -->
120                                 <!-- TMPL_IF name="dow7" -->
121                                         <option value="7" selected>Sunday</option>
122                                 <!-- TMPL_ELSE -->
123                                         <option value="7">Sunday</option>
124                                 <!-- /TMPL_IF -->
125                         </select>
126 </div>
127 <div id="bloc25">
128         <h2 class="bull">Subscription length</h2>
129         <p><label class="label100">Number of num</label><input type="text" name="numberlength" value="<!-- TMPL_VAR name="numberlength" -->"></p>
130         <p><label class="label100">Number of weeks</label><input type="text" name="weeklength" value="<!-- TMPL_VAR name="weeklength" -->"></p>
131         <p><label class="label100">Number of months</label><input type="text" name="monthlength" value="<!-- TMPL_VAR name="monthlength" -->"></p>
132
133 </div>
134 <div id="bloc25">
135         <h2 class="bull">Numbering calculation</h2>
136         <p>
137                 <p>Numbering formula: <input type="text" name="numberingmethod" value="<!-- TMPL_VAR name="numberingmethod" -->"></p>
138                 <table class="small">
139                         <tr>
140                                 <th class="bull">&nbsp;</th>
141                                 <th class="bull">X</th>
142                                 <th class="bull">Y</th>
143                                 <th class="bull">Z</th>
144                         </tr>
145                         <tr>
146                                 <td class="bull">Evolution</td>
147                                 <td>
148                                         <select name="seqtype1" size="1" onChange="select(this[this.selectedIndex].value, 'X')">
149                                                 <option value="">None</option>
150                                                 <!-- TMPL_IF name="seqtype11" -->
151                                                         <option value="1" selected>Added each</option>
152                                                 <!-- TMPL_ELSE -->
153                                                         <option value="1">Added each</option>
154                                                 <!-- /TMPL_IF -->
155                                                 <!-- TMPL_IF name="seqtype12" -->
156                                                         <option value="2" selected>Reinitialize each</option>
157                                                 <!-- TMPL_ELSE -->
158                                                         <option value="2">Reinitialize each</option>
159                                                 <!-- /TMPL_IF -->
160                                                 <!-- TMPL_IF name="seqtype13" -->
161                                                         <option value="3" selected>Constant</option>
162                                                 <!-- TMPL_ELSE -->
163                                                         <option value="3">Constant</option>
164                                                 <!-- /TMPL_IF -->
165                                                 </select>
166                                 </td>
167                                 <td>
168                                         <select name="seqtype2" size="1" onChange="select(this[this.selectedIndex].value, 'Y')">
169                                                 <option value="" selected>None</option>
170                                                 <!-- TMPL_IF name="seqtype21" -->
171                                                         <option value="1" selected>Added each</option>
172                                                 <!-- TMPL_ELSE -->
173                                                         <option value="1">Added each</option>
174                                                 <!-- /TMPL_IF -->
175                                                 <!-- TMPL_IF name="seqtype22" -->
176                                                         <option value="2" selected>Reinitialize each</option>
177                                                 <!-- TMPL_ELSE -->
178                                                         <option value="2">Reinitialize each</option>
179                                                 <!-- /TMPL_IF -->
180                                                 <!-- TMPL_IF name="seqtype23" -->
181                                                         <option value="3" selected>Constant</option>
182                                                 <!-- TMPL_ELSE -->
183                                                         <option value="3">Constant</option>
184                                                 <!-- /TMPL_IF -->
185                                                 </select>
186                                 </td>
187                                 <td>
188                                         <select name="seqtype3" size="1" onChange="select(this[this.selectedIndex].value, 'Z')">
189                                                 <option value="" selected>None</option>
190                                                 <!-- TMPL_IF name="seqtype31" -->
191                                                         <option value="1" selected>Added each</option>
192                                                 <!-- TMPL_ELSE -->
193                                                         <option value="1">Added each</option>
194                                                 <!-- /TMPL_IF -->
195                                                 <!-- TMPL_IF name="seqtype32" -->
196                                                         <option value="2" selected>Reinitialize each</option>
197                                                 <!-- TMPL_ELSE -->
198                                                         <option value="2">Reinitialize each</option>
199                                                 <!-- /TMPL_IF -->
200                                                 <!-- TMPL_IF name="seqtype33" -->
201                                                         <option value="3" selected>Constant</option>
202                                                 <!-- TMPL_ELSE -->
203                                                         <option value="3">Constant</option>
204                                                 <!-- /TMPL_IF -->
205                                                 </select>
206                                 </td>
207                         </tr>
208                         <tr>
209                                 <td class="bull">Value</td>
210                                 <td><input type="text" name="seqnum1" value="<!-- TMPL_VAR name="seqnum1" -->"></td>
211                                 <td><input type="text" name="seqnum2" value="<!-- TMPL_VAR name="seqnum2" -->"></td>
212                                 <td><input type="text" name="seqnum3" value="<!-- TMPL_VAR name="seqnum3" -->"></td>
213                         </tr>
214                         <tr>
215                                 <td class="bull">Frequency</td>
216                                 <td><input type="text" name="freq1" value="<!-- TMPL_VAR name="freq1" -->"></td>
217                                 <td><input type="text" name="freq2" value="<!-- TMPL_VAR name="freq2" -->"></td>
218                                 <td><input type="text" name="freq3" value="<!-- TMPL_VAR name="freq3" -->"></td>
219                         </tr>
220                         <tr>
221                                 <td class="bull">Step</td>
222                                 <td><input type="text" name="step1" value="<!-- TMPL_VAR name="step1" -->"></td>
223                                 <td><input type="text" name="step2" value="<!-- TMPL_VAR name="step2" -->"></td>
224                                 <td><input type="text" name="step3" value="<!-- TMPL_VAR name="step3" -->"></td>
225                         </tr>
226                 </table>
227 <td>Arrival date : </td><td>    <input type="text" name="arrivalplanified" value="<!-- TMPL_VAR name="arrivalplanified" -->">
228 </div>
229 <!-- TMPL_IF name="mod" -->
230         <input type="button" value="Save subscription" onclick="Check(this.form)" accesskey="w" class="button bull">
231 <!-- TMPL_ELSE -->
232         <input type="button" value="Add subscription" onclick="Check(this.form)" accesskey="w" class="button bull">
233 <!-- /TMPL_IF -->
234 </div>
235
236 </form>
237 <!-- TMPL_INCLUDE NAME="bull-bottom.inc" -->
238
239 <script language="JavaScript" type="text/javascript">
240
241 select(<!--TMPL_VAR name="seqtype1"-->, 'X');
242 select(<!--TMPL_VAR name="seqtype2"-->, 'Y');
243 select(<!--TMPL_VAR name="seqtype3"-->, 'Z');
244
245 function Plugin(f)
246 {
247          window.open("subscription-bib-search.pl","Find a bib index",'width=500,height=400,toolbar=false,scrollbars=yes');
248 }
249
250 function FindAcqui(f)
251 {
252          window.open("acqui-search.pl","Find a supplier",'width=500,height=400,toolbar=false,scrollbars=yes');
253 }
254
255
256 function Check(f)
257 {
258   if (f.aqbooksellerid.value.length != 0 && f.dow.value.length != 0
259         && f.startdate.value.length != 0 && f.dow.value.length != 0
260         && f.periodicity.value.length != 0)
261         {
262 //              alert('subscription ok');
263                 document.f.submit();
264         }
265 else
266 {
267         alert('field marked with * are mandatory');
268 }
269         return false;
270 }
271
272 function select(reponse, type)
273 {
274  if (type == 'X')
275      {
276         if (reponse == 0)
277         {
278            document.f.step1.style.backgroundColor="#DCDCDC";    
279            document.f.step1.value = "";
280            document.f.step1.disabled = true;
281            document.f.freq1.style.backgroundColor="#DCDCDC";    
282            document.f.freq1.value = "";
283            document.f.freq1.disabled = true;
284            document.f.seqnum1.style.backgroundColor="#DCDCDC";  
285            document.f.seqnum1.value = "";
286            document.f.seqnum1.disabled = true;
287            
288         }
289         if (reponse == 1)
290         {
291            document.f.step1.style.backgroundColor="#FFFFFF";    
292            document.f.step1.disabled = false;
293            document.f.freq1.style.backgroundColor="#DCDCDC";    
294            document.f.freq1.value = "";
295            document.f.freq1.disabled = true;
296            document.f.seqnum1.style.backgroundColor="#FFFFFF";  
297            document.f.seqnum1.disabled = false;
298         }       
299         if (reponse == 2)
300         {
301            document.f.step1.style.backgroundColor="#FFFFFF";    
302            document.f.step1.disabled = false;
303            document.f.freq1.style.backgroundColor="#FFFFFF";    
304            document.f.freq1.disabled = false;
305            document.f.seqnum1.style.backgroundColor="#FFFFFF";  
306            document.f.seqnum1.disabled = false;
307         }
308         if (reponse == 3)
309         {
310            document.f.step1.style.backgroundColor="#DCDCDC";    
311            document.f.step1.value = "";
312            document.f.step1.disabled = true;
313            document.f.freq1.style.backgroundColor="#DCDCDC";    
314            document.f.freq1.value = "";
315            document.f.freq1.disabled = true;
316            document.f.seqnum1.style.backgroundColor="#FFFFFF";  
317            document.f.seqnum1.disabled = false;
318         }
319      }
320  if (type == 'Y')
321      {
322         if (reponse == 0)
323         {
324            document.f.step2.style.backgroundColor="#DCDCDC";    
325            document.f.step2.value = "";
326            document.f.step2.disabled = true;
327            document.f.freq2.style.backgroundColor="#DCDCDC";    
328            document.f.freq2.value = "";
329            document.f.freq2.disabled = true;
330            document.f.seqnum2.style.backgroundColor="#DCDCDC";  
331            document.f.seqnum2.value = "";
332            document.f.seqnum2.disabled = true;
333            
334         }
335         if (reponse == 1)
336         {
337            document.f.step2.style.backgroundColor="#FFFFFF";    
338            document.f.step2.disabled = false;
339            document.f.freq2.style.backgroundColor="#DCDCDC";    
340            document.f.freq2.value = "";
341            document.f.freq2.disabled = true;
342            document.f.seqnum2.style.backgroundColor="#FFFFFF";  
343            document.f.seqnum2.disabled = false;
344         }       
345         if (reponse == 2)
346         {
347            document.f.step2.style.backgroundColor="#FFFFFF";    
348            document.f.step2.disabled = false;
349            document.f.freq2.style.backgroundColor="#FFFFFF";    
350            document.f.freq2.disabled = false;
351            document.f.seqnum2.style.backgroundColor="#FFFFFF";  
352            document.f.seqnum2.disabled = false;
353         }
354         if (reponse == 3)
355         {
356            document.f.step2.style.backgroundColor="#DCDCDC";    
357            document.f.step2.value = "";
358            document.f.step2.disabled = true;
359            document.f.freq2.style.backgroundColor="#DCDCDC";    
360            document.f.freq2.value = "";
361            document.f.freq2.disabled = true;
362            document.f.Y.style.backgroundColor="#FFFFFF";        
363            document.f.Y.disabled = false;
364         }
365
366      }
367  if (type == 'Z')
368      {
369         if (reponse == 0)
370         {
371            document.f.step3.style.backgroundColor="#DCDCDC";    
372            document.f.step3.value = "";
373            document.f.step3.disabled = true;
374            document.f.freq3.style.backgroundColor="#DCDCDC";    
375            document.f.freq3.value = "";
376            document.f.freq3.disabled = true;
377            document.f.seqnum3.style.backgroundColor="#DCDCDC";  
378            document.f.seqnum3.value = "";
379            document.f.seqnum3.disabled = true;
380            
381         }
382         if (reponse == 1)
383         {
384            document.f.step3.style.backgroundColor="#FFFFFF";    
385            document.f.step3.disabled = false;
386            document.f.freq3.style.backgroundColor="#DCDCDC";    
387            document.f.freq3.value = "";
388            document.f.freq3.disabled = true;
389            document.f.seqnum3.style.backgroundColor="#FFFFFF";  
390            document.f.seqnum3.disabled = false;
391         }       
392         if (reponse == 2)
393         {
394            document.f.step3.style.backgroundColor="#FFFFFF";    
395            document.f.step3.disabled = false;
396            document.f.freq3.style.backgroundColor="#FFFFFF";    
397            document.f.freq3.disabled = false;
398            document.f.seqnum3.style.backgroundColor="#FFFFFF";  
399            document.f.seqnum3.disabled = false;
400         }
401         if (reponse == 3)
402         {
403            document.f.step3.style.backgroundColor="#DCDCDC";    
404            document.f.step3.value = "";
405            document.f.step3.disabled = true;
406            document.f.freq3.style.backgroundColor="#DCDCDC";    
407            document.f.freq3.value = "";
408            document.f.freq3.disabled = true;
409            document.f.seqnum3.style.backgroundColor="#FFFFFF";  
410            document.f.seqnum3.disabled = false;
411         }
412
413      }
414 }
415
416 </script>