8 $content_accession_name
14 $owners_string => undef
17 <& /util/import_javascript.mas, classes => [ 'bootstrap_min.js', 'jquery.iframe-post-form','CXGN.List','CXGN.BreedersToolbox.Accessions', 'CXGN.BreedersToolbox.UploadPedigrees', 'jquery', 'jquery.dataTables' ] &>
27 <& /page/page_title.mas, title => 'Seedlot '.$uniquename &>
29 <&| /page/info_section.mas, title=>"Details", collapsible => 1, collapsed=>0, subtitle=>"[<a id='edit_seedlot_details_link' >Edit Seedlot Details</a>]" &>
31 <table class="table table-bordered table-hover">
32 <tr><td><b>Breeding Program</b></td><td><div id="seedlot_breeding_program_div">[LOADING...]</div></td></tr>
33 <tr><td><b>Seedlot Name</b></td><td><a href="/stock/<% $seedlot_id %>/view"><% $uniquename %></a></td></tr>
34 <tr><td><b>Organization</b></td><td><% $organization_name %></td></tr>
35 <tr><td><b>Location Code</b><td><div id="seedlot_location_code_div">[LOADING...]</div></td></tr>
36 <tr><td><b>Box Name</b></td><td><% $box_name %></td></tr>
37 <tr><td><b>Contents</b></td><td><% $content_html %></td></tr>
38 <!--<tr><td><b>Population</b></td><td><% $population_name %></td></tr>-->
39 <tr><td><b>Current count</b></td><td><% $current_count %></td></tr>
40 <tr><td><b>Current weight (g)</b></td><td><% $current_weight %></td></tr>
41 <tr><td><b>Submitters</b></td><td><% $owners_string %></td></tr>
50 <&| /page/info_section.mas, title=>"Transactions Table", collapsible => 1, collapsed=>0, subtitle=>"[<a id='add_seedlot_transaction_button' >Add New Transaction</a>]" &>
52 <div style="overflow:scroll">
53 <table id="available_seedlot_transactions_table" class="table table-hover table-bordered">
59 <div class="modal fade" id="add_seedlot_transaction_dialog" name="add_seedlot_transaction_dialog" tabindex="-1" role="dialog" aria-labelledby="seedlot_transaction_dialog">
60 <div class="modal-dialog modal-xl" role="document">
61 <div class="modal-content">
62 <div class="modal-header">
63 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
64 <h4 class="modal-title" id="seedlot_transaction_dialog">Add New Seedlot Transaction</h4>
66 <div class="modal-body">
67 <div class="container-fluid">
68 <form class="form-horizontal" role="form" method="post" id="create_new_seedlot_transaction_form" name="create_new_seedlot_transaction_form">
70 <div class="form-group">
71 <label class="col-sm-3 control-label">Transaction Type: </label>
72 <div class="col-sm-9" >
73 <select class="form-control" id="seedlot_transaction_factor">
74 <option value="1">Added to this Seedlot (<% $uniquename %>)</option>
75 <option value="-1">Taken from this Seedlot (<% $uniquename %>)</option>
80 <div id="seedlot_transaction_from_seedlot">
81 <div class="form-group">
82 <label class="col-sm-3 control-label">Taken From Existing Seedlot:<br/><small>Only showing seedlots with matching content</small></label>
83 <div class="col-sm-9" >
84 <div id="seedlot_transaction_seedlot_div"></div>
89 <div id="seedlot_transaction_to_seedlot" style="display: none">
90 <div class="form-group">
91 <label class="col-sm-3 control-label">Transferring to a new seed lot?: </label>
92 <div class="col-sm-9" >
93 <select class="form-control" id="seedlot_transaction_to_seedlot_new">
94 <option value="no">No</option>
95 <option value="yes">Yes</option>
99 <div id="seedlot_transaction_to_seedlot_new_no">
100 <div class="form-group">
101 <label class="col-sm-3 control-label">To Existing Seedlot:<br/><small>Only showing seedlots with matching content</small> </label>
102 <div class="col-sm-9" >
103 <div id="seedlot_transaction_to_seedlot_existing"></div>
107 <div id="seedlot_transaction_to_seedlot_new_yes" style="display: none">
108 <div class="well well-sm">
109 <div class="panel panel-default">
110 <div class="panel-body">
111 <div class="form-group">
112 <label class="col-sm-3 control-label">To New Seedlot: </label>
113 <div class="col-sm-9" >
115 <div class="form-group">
116 <label class="col-sm-3 control-label">Name: </label>
117 <div class="col-sm-9" >
118 <input class="form-control" id="transaction_new_seedlot_name" placeholder="Required">
121 <div class="form-group">
122 <label class="col-sm-3 control-label">Breeding Program: </label>
123 <div class="col-sm-9" >
124 <div id="transaction_new_seedlot_breeding_program_div"></div>
127 <div class="form-group">
128 <label class="col-sm-3 control-label">Location: </label>
129 <div class="col-sm-9" >
130 <input class="form-control" id="transaction_new_seedlot_location" placeholder="Required">
133 <div class="form-group">
134 <label class="col-sm-3 control-label">Box Name: </label>
135 <div class="col-sm-9" >
136 <input class="form-control" id="transaction_new_seedlot_box_name" placeholder="Required">
140 <div class="well well-sm">
142 <div class="col-sm-3">
143 <div class="form-group">
144 <label class="col-sm-12 control-label">Contents:<br/><small>Contents must match between seedlots</small> </label>
147 <div class="col-sm-9">
148 <div class="panel panel-default">
149 <div class="panel-body">
150 <div class="form-group">
151 % if ($content_accession_name){
152 <label class="col-sm-3 control-label">Accession name: </label>
153 <div class="col-sm-9" >
154 <input class="form-control" id="transaction_new_seedlot_accession_uniquename" disabled value="<% $content_accession_name %>">
157 % if ($content_cross_name){
158 <label class="col-sm-3 control-label">Cross Unique ID: </label>
159 <div class="col-sm-9" >
160 <input class="form-control" id="transaction_new_seedlot_cross_uniquename" disabled value="<% $content_cross_name %>">
170 <div class="form-group">
171 <label class="col-sm-3 control-label">Starting Amount (number of seeds): </label>
172 <div class="col-sm-9" >
173 <input class="form-control" id="transaction_new_seedlot_amount" placeholder="Amount OR Weight Required" disabled value="0">
176 <div class="form-group">
177 <label class="col-sm-3 control-label">Starting Weight (g): </label>
178 <div class="col-sm-9" >
179 <input class="form-control" id="transaction_new_seedlot_weight" placeholder="Amount OR Weight Required" disabled value="0">
183 <div class="form-group">
184 <label class="col-sm-3 control-label">Population: </label>
185 <div class="col-sm-9" >
186 <input class="form-control" id="transaction_new_seedlot_population_name" placeholder="Optional">
190 <div class="form-group">
191 <label class="col-sm-3 control-label">Organization: </label>
192 <div class="col-sm-9" >
193 <input class="form-control" id="transaction_new_seedlot_organization" placeholder="Optional">
196 <div class="form-group">
197 <label class="col-sm-3 control-label">Timestamp: </label>
198 <div class="col-sm-9" >
199 <input class="form-control" id="transaction_new_seedlot_timestamp" value="<% $timestamp %>" placeholder="<% $timestamp %>">
202 <div class="form-group">
203 <label class="col-sm-3 control-label">Description: </label>
204 <div class="col-sm-9" >
205 <input class="form-control" id="transaction_new_seedlot_description" placeholder="Optional">
217 <div class="form-group">
218 <label class="col-sm-3 control-label">Transaction Amount (number seeds): </label>
219 <div class="col-sm-9" >
220 <input class="form-control" id="seedlot_transaction_amount" placeholder="Amount OR Weight Required">
223 <div class="form-group">
224 <label class="col-sm-3 control-label">Transaction Weight (g): </label>
225 <div class="col-sm-9" >
226 <input class="form-control" id="seedlot_transaction_weight" placeholder="Amount OR Weight Required">
229 <div class="form-group">
230 <label class="col-sm-3 control-label">Timestamp: </label>
231 <div class="col-sm-9" >
232 <input class="form-control" id="seedlot_transaction_timestamp" value="<% $timestamp %>" placeholder="<% $timestamp %>">
235 <div class="form-group">
236 <label class="col-sm-3 control-label">Description: </label>
237 <div class="col-sm-9" >
238 <input class="form-control" id="seedlot_transaction_description" placeholder="Required">
244 <div class="modal-footer">
245 <button id="create_new_seedlot_transaction_button" type="button" class="btn btn-primary" >OK</button>
251 <div class="modal fade" id="edit_seedlot_transaction_dialog" name="edit_seedlot_transaction_dialog" tabindex="-1" role="dialog" aria-labelledby="seedlot_edit_transaction_dialog">
252 <div class="modal-dialog modal-lg" role="document">
253 <div class="modal-content">
254 <div class="modal-header">
255 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
256 <h4 class="modal-title" id="seedlot_edit_transaction_dialog">Edit Seedlot Transaction</h4>
258 <div class="modal-body">
259 <div class="container-fluid">
260 <div id="edit_seedlot_transaction_div">
264 <div class="modal-footer">
265 <button id="edit_seedlot_transaction_button" type="button" class="btn btn-primary" >Save</button>
271 <div class="modal fade" id="edit_seedlot_details_dialog" name="edit_seedlot_details_dialog" tabindex="-1" role="dialog" aria-labelledby="seedlot_edit_details_dialog">
272 <div class="modal-dialog modal-lg" role="document">
273 <div class="modal-content">
274 <div class="modal-header">
275 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
276 <h4 class="modal-title" id="seedlot_edit_details_dialog">Edit Seedlot Details</h4>
278 <div class="modal-body">
279 <div class="container-fluid">
280 <form class="form-horizontal">
281 <div class="form-group">
282 <label class="col-sm-3 control-label">Seedlot Name: </label>
283 <div class="col-sm-9" >
284 <input class="form-control" type="text" id="edit_seedlot_details_uniquename" value="LOADING..."/>
287 <div class="form-group">
288 <label class="col-sm-3 control-label">Breeding Program: </label>
289 <div class="col-sm-9" >
290 <input class="form-control" type="text" id="edit_seedlot_details_breeding_program" value="LOADING..."/>
293 <div class="form-group">
294 <label class="col-sm-3 control-label">Organization: </label>
295 <div class="col-sm-9" >
296 <input class="form-control" type="text" id="edit_seedlot_details_organization" value="LOADING..."/>
299 <div class="form-group">
300 <label class="col-sm-3 control-label">Location Code: </label>
301 <div class="col-sm-9" >
302 <input class="form-control" type="text" id="edit_seedlot_details_location" value="LOADING..."/>
305 <div class="form-group">
306 <label class="col-sm-3 control-label">Box Name: </label>
307 <div class="col-sm-9" >
308 <input class="form-control" type="text" id="edit_seedlot_details_box_name" value="LOADING..."/>
312 <div class="well well-sm">
314 <div class="col-sm-3">
315 <div class="form-group">
316 <label class="col-sm-12 control-label">Contents: </label>
319 <div class="col-sm-9">
320 <div class="panel panel-default">
321 <div class="panel-body">
322 <div class="form-group">
323 <label class="col-sm-3 control-label">Accession name: </label>
324 <div class="col-sm-9" >
325 <input class="form-control" id="edit_seedlot_details_accession" placeholder="One Content Required">
330 <center><h4>OR</h4></center>
331 <div class="panel panel-default">
332 <div class="panel-body">
333 <div class="form-group">
334 <label class="col-sm-3 control-label">Cross Unique ID: </label>
335 <div class="col-sm-9" >
336 <input class="form-control" id="edit_seedlot_details_cross" placeholder="One Content Required">
346 <div class="form-group">
347 <label class="col-sm-3 control-label">Population: </label>
348 <div class="col-sm-9" >
349 <input class="form-control" type="text" id="edit_seedlot_details_population" value="LOADING..."/>
356 <div class="modal-footer">
357 <button id="edit_seedlot_details_button" type="button" class="btn btn-primary" >Save</button>
365 jQuery(document).ready(function () {
367 jQuery('#add_seedlot_transaction_button').click( function() {
368 get_select_box('seedlots', 'seedlot_transaction_seedlot_div', { 'name' : 'seedlot_transaction_seedlot_id', 'id' : 'seedlot_transaction_seedlot_id', 'multiple':'0', 'seedlot_content_accession_name':'<% $content_accession_name %>', 'seedlot_content_cross_name':'<% $content_cross_name %>' });
369 get_select_box('seedlots', 'seedlot_transaction_to_seedlot_existing', { 'name' : 'seedlot_transaction_to_seedlot_existing_id', 'id' : 'seedlot_transaction_to_seedlot_existing_id', 'multiple':'0', 'seedlot_content_accession_name':'<% $content_accession_name %>', 'seedlot_content_cross_name':'<% $content_cross_name %>' });
370 get_select_box('breeding_programs', 'transaction_new_seedlot_breeding_program_div', { 'name' : 'transaction_new_seedlot_breeding_program_id', 'id' : 'transaction_new_seedlot_breeding_program_id' });
371 jQuery('#add_seedlot_transaction_dialog').modal('show')
374 jQuery("#transaction_new_seedlot_location").autocomplete({
375 source: '/ajax/stock/geolocation_autocomplete',
377 jQuery("#edit_seedlot_details_accession").autocomplete({
378 source: '/ajax/stock/accession_autocomplete',
380 jQuery("#edit_seedlot_details_cross").autocomplete({
381 source: '/ajax/stock/cross_autocomplete',
384 var seedlot_transactions_table = jQuery('#available_seedlot_transactions_table').DataTable( {
385 'ajax': '/ajax/breeders/seedlot/<% $seedlot_id %>/transactions',
387 { title: "Transaction Id", "data": "transaction_id" },
388 { title: "Transaction Date", "data": "timestamp" },
389 { title: "From", "data": "from" },
390 { title: "To", "data": "to" },
391 { title: "Transaction Num Seeds", "data": "value" },
392 { title: "Transaction Weight (g)", "data": "weight" },
393 { title: "Operator", "data": "operator" },
394 { title: "Description", "data": "description" },
395 { title: "Options", "data": "null", "render" : function ( data, type, row ) { return "<a onclick='editSeedlotTransaction("+row.transaction_id+")' >[Edit]</a>"; } },
400 url: '/ajax/breeders/seedlot/<% $seedlot_id %>',
401 success: function(response) {
402 //console.log(response);
403 if (response.success == 1) {
404 jQuery('#seedlot_location_code_div').html(response.location_code);
405 jQuery('#seedlot_breeding_program_div').html(response.breeding_program);
406 jQuery('#edit_seedlot_details_uniquename').val(response.uniquename);
407 jQuery('#edit_seedlot_details_breeding_program').val(response.breeding_program);
408 jQuery('#edit_seedlot_details_organization').val(response.organization_name);
409 jQuery('#edit_seedlot_details_population').val(response.population_name);
410 jQuery('#edit_seedlot_details_location').val(response.location_code);
411 jQuery('#edit_seedlot_details_box_name').val(response.box_name);
412 var accession_name = '';
413 if (response.accession){
414 accession_name = response.accession[1];
418 cross_name = response.cross[1];
420 jQuery('#edit_seedlot_details_accession').val(accession_name);
421 jQuery('#edit_seedlot_details_cross').val(cross_name);
423 if (response.error) {
424 alert(response.error);
427 error: function(response) {
428 alert('An error occurred retrieving seedlot details');
432 jQuery('#create_new_seedlot_transaction_button').click( function() {
433 var factor = jQuery('#seedlot_transaction_factor').val();
434 var to_new = jQuery('#seedlot_transaction_to_seedlot_new').val();
435 var from_existing_seedlot_id_array;
436 var from_existing_seedlot_id;
437 var to_existing_seedlot_id_array;
438 var to_existing_seedlot_id;
439 var to_new_seedlot_name;
440 var to_new_seedlot_breeding_program_id;
441 var to_new_seedlot_location_name;
442 var to_new_seedlot_box_name;
443 var to_new_seedlot_accession_name;
444 var to_new_seedlot_cross_name;
445 var to_new_seedlot_amount;
446 var to_new_seedlot_weight;
447 var to_new_seedlot_population_name;
448 var to_new_seedlot_organization;
449 var to_new_seedlot_timestamp;
450 var to_new_seedlot_description;
453 from_existing_seedlot_id_array = jQuery('#seedlot_transaction_seedlot_id').val();
454 if (from_existing_seedlot_id_array.length > 1) {
455 alert("Please select only one seedlot.");
458 from_existing_seedlot_id = from_existing_seedlot_id_array[0];
463 to_existing_seedlot_id_array = jQuery('#seedlot_transaction_to_seedlot_existing_id').val();
464 if (to_existing_seedlot_id_array.length > 1) {
465 alert("Please select only one seedlot.");
468 to_existing_seedlot_id = to_existing_seedlot_id_array[0];
471 if (to_new == 'yes'){
472 to_new_seedlot_name = jQuery('#transaction_new_seedlot_name').val();
473 to_new_seedlot_breeding_program_id = jQuery('#transaction_new_seedlot_breeding_program_id').val();
474 to_new_seedlot_location_name = jQuery('#transaction_new_seedlot_location').val();
475 to_new_seedlot_box_name = jQuery('#transaction_new_seedlot_box_name').val();
476 to_new_seedlot_accession_name = "<% $content_accession_name %>";
477 to_new_seedlot_cross_name = "<% $content_cross_name %>";
478 to_new_seedlot_amount = jQuery('#transaction_new_seedlot_amount').val();
479 to_new_seedlot_weight = jQuery('#transaction_new_seedlot_weight').val();
480 to_new_seedlot_population_name = jQuery('#transaction_new_seedlot_population_name').val();
481 to_new_seedlot_organization = jQuery('#transaction_new_seedlot_organization').val();
482 to_new_seedlot_timestamp = jQuery('#transaction_new_seedlot_timestamp').val();
483 to_new_seedlot_description = jQuery('#transaction_new_seedlot_description').val();
485 if (to_new_seedlot_accession_name == '' && to_new_seedlot_cross_name == '') {
486 alert("Please provide an accession name or a cross unique id as the content of the seedlot."); return;
488 if (to_new_seedlot_accession_name != '' && to_new_seedlot_cross_name != '') {
489 alert("Please provide an accession name OR a cross unique id as the content of the seedlot. Not both."); return;
491 if (to_new_seedlot_location_name == ''){
492 alert("Please provide a location for new seedlot."); return;
494 if (to_new_seedlot_box_name == ''){
495 alert("Please provide a box name for new seedlot."); return;
497 if (to_new_seedlot_amount == '' && to_new_seedlot_weight == ''){
498 alert("Please provide a starting amount OR weight in grams for new seedlot."); return;
500 if (to_new_seedlot_timestamp == ''){
501 alert("Please provide a timestamp for new seedlot created."); return;
505 var amount = jQuery('#seedlot_transaction_amount').val();
506 var weight = jQuery('#seedlot_transaction_weight').val();
507 var timestamp = jQuery('#seedlot_transaction_timestamp').val();
508 var description = jQuery('#seedlot_transaction_description').val();
510 if (factor == '') { alert("Please provide a factor"); }
511 else if (amount == '' && weight == '') { alert("Please provide an amount OR a weight in grams"); }
512 else if (timestamp == '') { alert("Please provide a timestamp"); }
513 else if (description == '') { alert("Please provide a description"); }
514 else if (from_existing_seedlot_id == '' && to_existing_seedlot_id == '' && to_new_seedlot_name == '') { alert("Please provide seed lot"); }
518 url: '/ajax/breeders/seedlot/<% $seedlot_id %>/transaction/add',
521 'seedlot_id': <% $seedlot_id %>,
524 'timestamp': timestamp,
525 'description': description,
526 'from_existing_seedlot_id': from_existing_seedlot_id,
527 'to_existing_seedlot_id': to_existing_seedlot_id,
528 'to_new_seedlot_name' : to_new_seedlot_name,
529 'to_new_seedlot_breeding_program_id': to_new_seedlot_breeding_program_id,
530 'to_new_seedlot_location_name': to_new_seedlot_location_name,
531 'to_new_seedlot_box_name': to_new_seedlot_box_name,
532 'to_new_seedlot_accession_name': to_new_seedlot_accession_name,
533 'to_new_seedlot_cross_name': to_new_seedlot_cross_name,
534 'to_new_seedlot_amount': to_new_seedlot_amount,
535 'to_new_seedlot_weight': to_new_seedlot_weight,
536 'to_new_seedlot_population_name': to_new_seedlot_population_name,
537 'to_new_seedlot_organization': to_new_seedlot_organization,
538 'to_new_seedlot_timestamp': to_new_seedlot_timestamp,
539 'to_new_seedlot_description': to_new_seedlot_description
541 beforeSend: function(){
542 jQuery('#working_modal').modal('show');
544 success: function(response) {
545 jQuery('#working_modal').modal('hide');
546 if (response.success == 1) {
547 alert("The seedlot transaction has been created.");
548 jQuery('#add_seedlot_transaction_dialog').modal('hide');
549 seedlot_transactions_table.ajax.reload();
551 if (response.error) {
552 alert(response.error);
555 error: function(response) {
556 jQuery('#working_modal').modal('hide');
557 alert('An error occurred creating seedlot transaction');
563 jQuery('#seedlot_transaction_factor').change(function(){
564 var transaction_factor = jQuery('#seedlot_transaction_factor').val();
565 if (transaction_factor == 1){
566 jQuery('#seedlot_transaction_to_seedlot').hide();
567 jQuery('#seedlot_transaction_from_seedlot').show();
569 if (transaction_factor == -1){
570 jQuery('#seedlot_transaction_from_seedlot').hide();
571 jQuery('#seedlot_transaction_to_seedlot').show();
575 jQuery('#seedlot_transaction_to_seedlot_new').change(function(){
576 var option = jQuery('#seedlot_transaction_to_seedlot_new').val();
577 if (option == 'yes'){
578 jQuery('#seedlot_transaction_to_seedlot_new_no').hide();
579 jQuery('#seedlot_transaction_to_seedlot_new_yes').show();
582 jQuery('#seedlot_transaction_to_seedlot_new_no').show();
583 jQuery('#seedlot_transaction_to_seedlot_new_yes').hide();
587 jQuery('#edit_seedlot_transaction_button').click(function(){
588 var transaction_id = jQuery('#edit_seedlot_transaction_id').val();
589 var operator = jQuery('#edit_seedlot_transaction_operator').val();
590 var amount = jQuery('#edit_seedlot_transaction_amount').val();
591 var weight = jQuery('#edit_seedlot_transaction_weight').val();
592 var description = jQuery('#edit_seedlot_transaction_description').val();
593 var timestamp = jQuery('#edit_seedlot_transaction_timestamp').val();
594 if (transaction_id == ''){
595 alert('Transaction ID must not be blank');
596 } else if (operator == ''){
597 alert('Operator must not be blank');
598 } else if (amount == '' && weight == ''){
599 alert('Amount OR weight must not be blank');
600 } else if (description == ''){
601 alert('Description must not be blank');
602 } else if (timestamp == ''){
603 alert('Timestamp must not be blank');
606 url: '/ajax/breeders/seedlot/<% $seedlot_id %>/transaction/'+transaction_id+'/edit',
610 'weight_gram':weight,
611 'description':description,
612 'timestamp':timestamp
614 beforeSend: function(){
615 jQuery('#working_modal').modal('show');
617 success: function(response) {
618 jQuery('#working_modal').modal('hide');
619 if (response.success == 1) {
620 alert('Transaction updated!');
621 seedlot_transactions_table.ajax.reload();
623 if (response.error) {
624 alert(response.error);
627 error: function(response) {
628 jQuery('#working_modal').modal('hide');
629 alert('An error occurred editing seedlot transaction details');
635 jQuery('#edit_seedlot_details_link').click(function(){
636 jQuery('#edit_seedlot_details_dialog').modal('show');
639 jQuery('#edit_seedlot_details_button').click(function(){
640 var uniquename = jQuery('#edit_seedlot_details_uniquename').val();
641 var breeding_program = jQuery('#edit_seedlot_details_breeding_program').val();
642 var organization = jQuery('#edit_seedlot_details_organization').val();
643 var population = jQuery('#edit_seedlot_details_population').val();
644 var location = jQuery('#edit_seedlot_details_location').val();
645 var box_name = jQuery('#edit_seedlot_details_box_name').val();
646 var accession = jQuery('#edit_seedlot_details_accession').val();
647 var cross = jQuery('#edit_seedlot_details_cross').val();
648 if (uniquename == ''){
649 alert('Seedlot name must not be blank');
650 } else if (breeding_program == ''){
651 alert('Breeding program must not be blank');
652 } else if (location == ''){
653 alert('Location must not be blank');
654 } else if (accession == '' && cross == '') {
655 alert("Please provide an accession name or a cross unique id as the content of the seedlot."); return;
657 else if (accession != '' && cross != '') {
658 alert("Please provide an accession name OR a cross unique id as the content of the seedlot. Not both."); return;
662 url: '/ajax/breeders/seedlot/<% $seedlot_id %>/edit',
664 'uniquename':uniquename,
665 'breeding_program':breeding_program,
666 'organization':organization,
667 'population':population,
670 'accession':accession,
673 beforeSend: function(){
674 jQuery('#working_modal').modal('show');
676 success: function(response) {
677 jQuery('#working_modal').modal('hide');
678 if (response.success == 1) {
679 alert('Seedlot updated!');
680 document.location.reload();
682 if (response.error) {
683 alert(response.error);
686 error: function(response) {
687 jQuery('#working_modal').modal('hide');
688 alert('An error occurred editing seedlot details');
696 function editSeedlotTransaction(transaction_id){
698 url: '/ajax/breeders/seedlot/<% $seedlot_id %>/transaction/'+transaction_id,
699 beforeSend: function(){
700 jQuery('#working_modal').modal('show');
702 success: function(response) {
703 jQuery('#working_modal').modal('hide');
704 if (response.success == 1) {
705 html = '<form class="form-horizontal"><div class="form-group"><label class="col-sm-3 control-label">Transaction ID: </label><div class="col-sm-9" ><input type="text" class="form-control" id="edit_seedlot_transaction_id" value="'+response.transaction_id+'" disabled /></div></div><div class="form-group"><label class="col-sm-3 control-label">Operator: </label><div class="col-sm-9" ><input type="text" id="edit_seedlot_transaction_operator" class="form-control" value="'+response.operator+'" /></div></div><div class="form-group"><label class="col-sm-3 control-label">Amount (Number seeds): </label><div class="col-sm-9" ><input type="number" class="form-control" id="edit_seedlot_transaction_amount" value="'+response.amount+'" /></div></div><div class="form-group"><label class="col-sm-3 control-label">Weight (g): </label><div class="col-sm-9" ><input type="text" class="form-control" id="edit_seedlot_transaction_weight" value="'+response.weight_gram+'" /></div></div><div class="form-group"><label class="col-sm-3 control-label">Timestamp: </label><div class="col-sm-9" ><input type="text" class="form-control" id="edit_seedlot_transaction_timestamp" value="'+response.timestamp+'" disabled /></div></div><div class="form-group"><label class="col-sm-3 control-label">Description: </label><div class="col-sm-9" ><input type="text" class="form-control" id="edit_seedlot_transaction_description" value="'+response.description+'" /></div></div></form>';
706 jQuery('#edit_seedlot_transaction_div').html(html);
707 jQuery('#edit_seedlot_transaction_dialog').modal('show');
709 if (response.error) {
710 alert(response.error);
713 error: function(response){
714 jQuery('#working_modal').modal('hide');
715 alert('An error occurred getting seedlot transaction');