2011-04-12 23:37:34 -07:00
|
|
|
$(function() {
|
|
|
|
|
|
2011-05-01 20:11:32 -07:00
|
|
|
|
|
|
|
|
|
2011-04-28 21:33:36 -07:00
|
|
|
|
2011-05-01 20:11:32 -07:00
|
|
|
$( "#add-form" ).dialog({
|
2011-04-21 00:38:01 -07:00
|
|
|
autoOpen: false,
|
2011-04-28 00:41:36 -07:00
|
|
|
height: 900,
|
|
|
|
|
width: 600,
|
2011-04-21 00:38:01 -07:00
|
|
|
modal: true,
|
|
|
|
|
buttons: {
|
|
|
|
|
"New Shipment": function() {
|
2011-04-28 20:07:30 -07:00
|
|
|
var thisShipmentInputs = $('#ShipmentAddForm').find('input,select,textarea');
|
2011-04-28 00:41:36 -07:00
|
|
|
|
2011-05-01 16:42:35 -07:00
|
|
|
$.post('/shipments/ajax_add', thisShipmentInputs, function(data) {
|
2011-05-01 20:11:32 -07:00
|
|
|
$( "#add-form" ).dialog('close');
|
2011-05-01 23:59:14 -07:00
|
|
|
window.location.reload(); //Change this to fetch a new copy of the table and update a <div>.
|
2011-04-28 00:41:36 -07:00
|
|
|
});
|
2011-04-21 00:38:01 -07:00
|
|
|
|
|
|
|
|
},
|
|
|
|
|
Cancel: function() {
|
|
|
|
|
$( this ).dialog( "close" );
|
2011-05-01 20:11:32 -07:00
|
|
|
//$("#ShipmentAddForm")[0].reset();
|
2011-04-28 00:41:36 -07:00
|
|
|
$("#principlesList").empty();
|
2011-04-21 00:38:01 -07:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
close: function() {
|
2011-04-28 00:41:36 -07:00
|
|
|
|
|
|
|
|
$("#importFields").hide();
|
|
|
|
|
$("#principle").hide();
|
|
|
|
|
|
2011-04-21 00:38:01 -07:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2011-04-28 00:41:36 -07:00
|
|
|
|
2011-05-01 20:11:32 -07:00
|
|
|
$( "#edit-form" ).dialog({
|
|
|
|
|
autoOpen: false,
|
|
|
|
|
height: 900,
|
|
|
|
|
width: 600,
|
|
|
|
|
modal: true,
|
|
|
|
|
buttons: {
|
|
|
|
|
"Save Shipment": function() {
|
|
|
|
|
var thisShipmentInputs = $('#ShipmentEditForm').find('input,select,textarea');
|
2011-04-28 00:41:36 -07:00
|
|
|
|
2011-05-01 20:11:32 -07:00
|
|
|
$.post('/shipments/ajax_edit', thisShipmentInputs, function(data) {
|
|
|
|
|
$( "#edit-form" ).dialog('close');
|
2011-05-16 23:13:52 -07:00
|
|
|
window.location.reload(); //Change this to fetch a new copy of the table and update a <div>.
|
2011-05-01 20:11:32 -07:00
|
|
|
});
|
2011-04-28 00:41:36 -07:00
|
|
|
|
2011-05-01 20:11:32 -07:00
|
|
|
},
|
|
|
|
|
Cancel: function() {
|
|
|
|
|
$( this ).dialog( "close" );
|
|
|
|
|
//$("#ShipmentEditForm")[0].reset();
|
|
|
|
|
$("#principlesList").empty();
|
2011-04-28 00:41:36 -07:00
|
|
|
}
|
2011-05-01 20:11:32 -07:00
|
|
|
},
|
|
|
|
|
close: function() {
|
2011-04-28 00:41:36 -07:00
|
|
|
|
2011-05-01 20:11:32 -07:00
|
|
|
$("#importFields").hide();
|
|
|
|
|
$("#principle").hide();
|
2011-04-28 00:41:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
2011-05-01 20:11:32 -07:00
|
|
|
$( ".newShipment" ).button().click(function() {
|
2013-04-29 06:00:24 -07:00
|
|
|
|
|
|
|
|
$.get('/shipments/add/', false, function(data) {
|
2011-04-29 00:18:44 -07:00
|
|
|
|
2011-05-01 20:11:32 -07:00
|
|
|
$("#add-form").html(data);
|
2011-05-09 21:50:42 -07:00
|
|
|
$( "#add-form" ).dialog( "open" );
|
2011-05-01 20:11:32 -07:00
|
|
|
} );
|
2011-04-28 20:07:30 -07:00
|
|
|
|
2011-05-09 21:50:42 -07:00
|
|
|
|
2011-04-28 20:07:30 -07:00
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2011-04-29 00:18:44 -07:00
|
|
|
|
2011-05-01 20:11:32 -07:00
|
|
|
$(".editButton").button().click(function() {
|
2011-04-29 00:18:44 -07:00
|
|
|
|
2013-04-29 06:00:24 -07:00
|
|
|
var id = $(this).attr('id');
|
|
|
|
|
$.get('/shipments/edit/'+id, false, function(data) {
|
2011-04-29 00:18:44 -07:00
|
|
|
|
2013-04-29 06:00:24 -07:00
|
|
|
$("#edit-form").html(data);
|
|
|
|
|
$( "#edit-form" ).dialog( "open" );
|
|
|
|
|
} );
|
2011-04-29 00:18:44 -07:00
|
|
|
});
|
|
|
|
|
|
2011-04-28 21:33:36 -07:00
|
|
|
|
2013-04-29 06:00:24 -07:00
|
|
|
$(".deleteButton").click(function() {
|
|
|
|
|
var id = $(this).prev().attr('id');
|
|
|
|
|
var confirmed = confirm("Permanently delete this shipment?");
|
|
|
|
|
|
|
|
|
|
if(confirmed) {
|
|
|
|
|
$.get('/shipments/delete/'+id, false, function() {
|
|
|
|
|
window.location.reload();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
2011-04-28 21:33:36 -07:00
|
|
|
|
2011-05-01 20:11:32 -07:00
|
|
|
|
|
|
|
|
|
2011-04-28 00:41:36 -07:00
|
|
|
|
|
|
|
|
|
2011-04-28 20:07:30 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-04-28 00:41:36 -07:00
|
|
|
|
2013-04-29 06:00:24 -07:00
|
|
|
});
|