cmc-sales/webroot/js/shipment_index.js

104 lines
1.8 KiB
JavaScript
Raw Normal View History

$(function() {
$( "#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) {
$( "#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" );
//$("#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
$( "#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
$.post('/shipments/ajax_edit', thisShipmentInputs, function(data) {
$( "#edit-form" ).dialog('close');
// 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
},
Cancel: function() {
$( this ).dialog( "close" );
//$("#ShipmentEditForm")[0].reset();
$("#principlesList").empty();
2011-04-28 00:41:36 -07:00
}
},
close: function() {
2011-04-28 00:41:36 -07:00
$("#importFields").hide();
$("#principle").hide();
2011-04-28 00:41:36 -07:00
}
});
$( ".newShipment" ).button().click(function() {
$.get('/shipments/add/', false, function(data) {
$("#add-form").html(data);
$( "#add-form" ).dialog( "open" );
} );
2011-04-28 20:07:30 -07:00
2011-04-28 20:07:30 -07:00
});
$(".editButton").button().click(function() {
var id = $(this).attr('id');
$.get('/shipments/edit/'+id, false, function(data) {
$("#edit-form").html(data);
$( "#edit-form" ).dialog( "open" );
} );
});
2011-04-28 00:41:36 -07:00
2011-04-28 20:07:30 -07:00
2011-04-28 00:41:36 -07:00
2011-04-21 00:38:01 -07:00
});