fix run_model call so that it works with non-default options as well.
[sgn.git] / mason / barcode / index.mas
blobf2519835afcf0a7f966ca57579be0e7912532899
2 <%doc>
4 </%doc>
6 <%args>
7 @projects => ()   # [ id, name, description ]
8 @locations => ()  # [ id, description ]
9 </%args>
11 <%perl>
12 use DateTime;
13 my $dt = DateTime->from_epoch( epoch=>time );
14 my $date = join "/", ($dt->year, $dt->month, $dt->day);
15 </%perl>
17 <& /page/page_title.mas, title=>"Barcode Tools" &>
19 <&| /page/info_section.mas, title=>'Generate Barcode', collapsible=>1, collapsed=>1 &>
21 <div class="well well-sm">
22 <div class="row">
23   <div class="col-md-1 col-lg-1">
24   </div>
25   <div class="col-md-10 col-lg-10">
27 <form class="form-horizontal" role="form" action="/barcode/generate">
28   <div class="form-group form-group-sm">
29     <label class="col-sm-2 control-label">Barcode Text: </label>
30     <div class="col-sm-10">
31       <input type="text" class="form-control" name="text" />
32     </div>
33   </div>
34   <div class="form-group form-group-sm">
35     <label class="col-sm-2 control-label">Small: </label>
36     <div class="col-sm-10">
37       <input type="radio" name="size" value="small" checked="1" />
38     </div>
39   </div>
40   <div class="form-group form-group-sm">
41     <label class="col-sm-2 control-label">Large: </label>
42     <div class="col-sm-10">
43       <input type="radio" name="size" value="large" />
44     </div>
45   </div>
47   <button style="float:right" type="submit" class="btn btn-info btn-sm" type="submit" value="Generate barcode">Generate Barcode</button>
48 </form>
50 <br/>
52   </div>
53   <div class="col-md-1 col-lg-1">
54   </div>
55 </div>
56 </div>
58 </&>
60 <&| /page/info_section.mas, title=>'Download Stock Barcodes', collapsible=>1, collapsed=>0, subtitle=>'<button type="button" class="btn btn-primary" name="custom_barcode_link" id="custom_barcode_link">Design Custom Barcode</button>'&>
62 <div class="well well-sm">
63 <div class="row">
64   <div class="col-md-1 col-lg-1">
65   </div>
66   <div class="col-md-10 col-lg-10">
68 <form class="form-horizontal" role="form" enctype="multipart/form-data" method="post" action="/barcode/stock/download/pdf" >
69   <div class="form-group form-group-sm">
70     <label class="col-sm-4 control-label">Enter a List of Stock Names: </label>
71     <div class="col-sm-8">
72       <textarea class="form-control" id="stock_names" name="stock_names" ></textarea>
73     </div>
74   </div>
75   <div class="form-group form-group-sm">
76     <label class="col-sm-4 control-label">Or Paste From a List: </label>
77     <div class="col-sm-8">
78       <div id="list_menu_location_1"></div>
79 <script defer="defer">
80   jQuery(document).ready(function() {
81       pasteListMenu('stock_names', 'list_menu_location_1');
83       $(document).on('change', '#select_barcode_type', function () {
84           var barcode_type = jQuery("#select_barcode_type").val();
85           if (barcode_type == "2D") {
86               jQuery("#2D_fieldbook_option").show();
87           }
88           else if (barcode_type == "1D") {
89             jQuery("#2D_fieldbook_option").hide();
90           }
91       });
93       jQuery('#custom_barcode_link').click(function () {
94           location.href = '/tools/label_designer';
95       });
97       $(document).on('change', '#select_print_format', function () {
98           var format = jQuery("#select_print_format").val();
99           if (format == "32A4") {
100             var label_row = 10;
101             var label_cols = 4;
102             var tops_margin = 12;
103             var left_margin = 17;
104             var bottom_margin = 12;
105             var right_margin = 10;
106           }
107           if (format == "32_unique") {
108             var label_row = 10;
109             var label_cols = 4;
110             var tops_margin = 12;
111             var left_margin = 17;
112             var bottom_margin = 12;
113             var right_margin = 10;
114           }
115           else if (format == "CASS") {
116           var label_row = 10;
117           var label_cols = 2;
118           var tops_margin = 10;
119           var left_margin = 112;
120           var bottom_margin = 13;
121           var right_margin = 20;
122           }
123           else if (format == "MUSA") {
124           var label_row = 10;
125           var label_cols = 2;
126           var tops_margin = 10;
127           var left_margin = 112;
128           var bottom_margin = 13;
129           var right_margin = 20;
130           }
131           else if (format == "NCSU") {
132           var label_row = 10;
133           var label_cols = 3;
134           var tops_margin = 12;
135           var left_margin = 10;
136           var bottom_margin = 12;
137           var right_margin = 10;
138           var text = 'year,location';
139           }
140           else if (format == "20A4") {
141           var label_row = 10;
142           var label_cols = 2;
143           var tops_margin = 12;
144           var left_margin = 10;
145           var bottom_margin = 12;
146           var right_margin = 10;
147           }
148           else if (format == "IITA-3") {
149           var label_row = 20;
150           var label_cols = 3;
151           var tops_margin = 13;
152           var left_margin = 130;
153           var bottom_margin = 11;
154           var right_margin = 10;
155           }
156           else if (format == "IITA-2") {
157           var label_row = 20;
158           var label_cols = 2;
159           var tops_margin = 13;
160           var left_margin = 130;
161           var bottom_margin = 11;
162           var right_margin = 10;
163           }
164           else if (format == "crossing") {
165           var label_row = 1;
166           var label_cols = 1;
167           var tops_margin = 5;
168           var left_margin = 2;
169           var bottom_margin = 0;
170           var right_margin = 0;
171           }
172           jQuery("#text_margin").empty();
173           jQuery("#text_margin").val(text);
174           jQuery("#label_rows").empty();
175           jQuery("#label_rows").val(label_row);
176           jQuery("#label_cols").empty();
177           jQuery("#label_cols").val(label_cols);
178           jQuery("#select_barcode_type").prop('selectedIndex',1);
179           jQuery("#page_format").prop('selectedIndex',0);
180           jQuery("#tops_margin").empty();
181           jQuery("#tops_margin").val(tops_margin);
182           jQuery("#left_margin").empty();
183           jQuery("#left_margin").val(left_margin);
184           jQuery("#bottom_margin").empty();
185           jQuery("#bottom_margin").val(bottom_margin);
186           jQuery("#right_margin").empty();
187           jQuery("#right_margin").val(right_margin);
188       });
189   });
190 </script>
191     </div>
192   </div>
194   <div class="form-group form-group-sm">
195     <label class="col-sm-4 control-label">Barcode Type: </label>
196     <div class="col-sm-8">
197         <select class="form-control" id="select_barcode_type" name="select_barcode_type">
198           <option value="2D">2D Barcode</option>
199           <option value="1D">1D Barcode</option>
200         </select>
201     </div>
202   </div>
204   <div id="2D_fieldbook_option" >
205   <div class="form-group form-group-sm" >
206     <label class="col-sm-4 control-label">Enable 2D Barcode For FieldBook: </label>
207     <div class="col-sm-8">
208       <input type="checkbox" id="enable_fieldbook_2d_barcode" name="enable_fieldbook_2d_barcode" value="enable_fieldbook_2d_barcode" checked/>
209     </div>
210   </div>
211   </div>
213   <div class="form-group form-group-sm">
214     <label class="col-sm-4 control-label">Printing Format (Optional): </label>
215     <div class="col-sm-8">
216         <select class="form-control" id="select_print_format" name="select_print_format">
217           <!--<option selected disabled>select printing format</option>-->
218           <option value="">select printing format</option>
219           <option value="20A4">20 label Size Sticker Paper</option>
220           <option value="32A4">32 label Size Sticker Paper</option>
221           <option value="32_unique">32 Unique label Size Sticker Paper</option>
222           <option value="CASS">CASS printing format</option>
223           <option value="crossing">CROSS</option>
224           <option value="IITA-2">IITA-2-barcode</option>
225           <option value="IITA-3">IITA-3-barcode</option>
226           <option value="MUSA">MUSA printing format</option>
227           <option value="NCSU">NCSU printing format</option>
228         </select>
229     </div>
230   </div>
232   <div class="form-group form-group-sm">
233     <label class="col-sm-4 control-label">Or Upload <font size="3" color="#5bc0de">Tab-delimited Text File</font> With Stock Names: </label>
234     <div class="col-sm-8">
235       <input type="file" name="stock_names_file" />
236     </div>
237   </div>
238   <div class="form-group form-group-sm" style="display: none">
239     <label class="col-sm-4 control-label">Print Duplicate Labels Per Row: </label>
240     <div class="col-sm-8">
241       <input type="checkbox" name="duplicate_labels_per_row" checked="1" disabled="1" />
242     </div>
243   </div>
244     <!--<div class="form-group form-group-sm">
245     <label class="col-sm-4 control-label">Print Field Information For Plots: </label>
246     <div class="col-sm-8">
247       <input type="checkbox" name="plots" value="plots" /> &nbsp; &nbsp; &nbsp; Useful for Printing Field Information of Trials.
248     </div>
249   </div>-->
250   <!--<div class="form-group form-group-sm">
251     <label class="col-sm-4 control-label">Print Parents For Nurseries: </label>
252     <div class="col-sm-8">
253       <input type="checkbox" name="nursery" value="nursery" /> &nbsp; &nbsp; &nbsp; Useful for Printing Pedigree Information for Nurseries.
254     </div>
255   </div>-->
257   <& /barcode/printer_settings.mas &>
259   <button style="float:right" type="submit" class="btn btn-info btn-sm" type="submit" value="Download Barcodes">Download Barcodes</button>
260   <button style="float:right" class="btn btn-default btn-sm" type="reset" >Clear</button>
261 </form>
263 <br/>
265   </div>
266   <div class="col-md-1 col-lg-1">
267   </div>
268 </div>
269 </div>
271 <br/>
273 </&>
275 <!-- phenotyping barcode -->
277 <&| /page/info_section.mas, title=>'Download Plot Phenotyping Barcodes', collapsible=>1, collapsed=>0 &>
279 <div class="well well-sm">
280 <div class="row">
281   <div class="col-md-1 col-lg-1">
282   </div>
283   <div class="col-md-10 col-lg-10">
285 <form class="form-horizontal" role="form" enctype="multipart/form-data" method="post" action="/barcode/stock/download/plot_QRcode" >
286   <div class="form-group form-group-sm">
287     <label class="col-sm-4 control-label">Enter a List of Stock Names: </label>
288     <div class="col-sm-8">
289       <textarea class="form-control" id="stock_names_2" name="stock_names_2" ></textarea>
290     </div>
291   </div>
292   <div class="form-group form-group-sm">
293     <label class="col-sm-4 control-label">Or Paste From a List: </label>
294     <div class="col-sm-8">
295       <div id="list_menu_location_2"></div>
296 <script defer="defer">
297   jQuery(document).ready(function() {
298       pasteListMenu('stock_names_2', 'list_menu_location_2', 'paste', 'plots');
299   });
301 </script>
302     </div>
303   </div>
304   <div class="form-group form-group-sm">
305     <label class="col-sm-4 control-label">Or Upload <font size="3" color="#5bc0de">Tab-delimited Text File</font> With Stock Names: </label>
306     <div class="col-sm-8">
307       <input type="file" name="stock_names_file_2" />
308     </div>
309   </div>
311   <div class="form-group form-group-sm">
312     <label class="col-sm-4 control-label">Add Text to Label, e.g. location: </label>
313     <div class="col-sm-8">
314         <input class="form-control" id="select_barcode_text" name="select_barcode_text"></input>
315     </div>
316   </div>
318 <!--  <div class="form-group form-group-sm">
319     <label class="col-sm-4 control-label">Print Duplicate Labels Per Row: </label>
320     <div class="col-sm-8">
321       <input type="checkbox" name="duplicate_labels_per_row" checked="1" disabled="1" />
322     </div>
323     </div> -->
325 %#  <& /barcode/printer_settings.mas &> #%
327   <button style="float:right" type="submit" class="btn btn-info btn-sm" type="submit" value="Download Barcodes">Download Barcodes</button>
328   <button style="float:right" class="btn btn-default btn-sm" type="reset" >Clear</button>
329 </form>
331 <br/>
333   </div>
334   <div class="col-md-1 col-lg-1">
335   </div>
336 </div>
337 </div>
339 <br/>
341 </&>
343 <!-- Trial barcode -->
345 <&| /page/info_section.mas, title=>'Download Trial Barcodes', collapsible=>1, collapsed=>0 &>
347 <div class="well well-sm">
348 <div class="row">
349   <div class="col-md-1 col-lg-1">
350   </div>
351   <div class="col-md-10 col-lg-10">
353 <form class="form-horizontal" role="form" enctype="multipart/form-data" method="post" action="/barcode/trial/download/trial_QRcode" >
354   <div class="form-group form-group-sm">
355     <label class="col-sm-4 control-label">Enter a List of Trial Names: </label>
356     <div class="col-sm-8">
357       <textarea class="form-control" id="trial_names_2" name="trial_names_2" ></textarea>
358     </div>
359   </div>
360   <div class="form-group form-group-sm">
361     <label class="col-sm-4 control-label">Or Paste From a List: </label>
362     <div class="col-sm-8">
363       <div id="list_menu_location_3"></div>
364 <script defer="defer">
365   jQuery(document).ready(function() {
366       pasteListMenu('trial_names_2', 'list_menu_location_3', 'paste', 'trials');
367   });
369 </script>
370     </div>
371   </div>
372   <div class="form-group form-group-sm">
373     <label class="col-sm-4 control-label">Or Upload <font size="3" color="#5bc0de">Tab-delimited Text File</font> With Trial Names: </label>
374     <div class="col-sm-8">
375       <input type="file" name="trial_names_file_2" />
376     </div>
377   </div>
379   <button style="float:right" type="submit" class="btn btn-info btn-sm" type="submit" value="Download Barcodes">Download Barcodes</button>
380   <button style="float:right" class="btn btn-default btn-sm" type="reset" >Clear</button>
381 </form>
383 <br/>
385   </div>
386   <div class="col-md-1 col-lg-1">
387   </div>
388 </div>
389 </div>
391 <br/>
393 </&>
395 %#<&| /page/info_section.mas, title=>'Generate unique barcodes', collapsible=>1, collapsed=>0 &>
397 %#<form action="/barcode/unique" >
399 %#  Number of label pages to print <input type="text" name="label_pages" /><br /><br />
401 %#  <& /barcode/printer_settings.mas &>
402 %#    <br />
403 %#  <input type="submit" value="Generate barcodes" />
404 %#  </form>
406 %#</& >