Added save edit cancel buttons to jbos list

This commit is contained in:
Karl Cordes 2011-04-04 11:53:29 +10:00
parent 539569fbab
commit f2d54e13aa
3 changed files with 64 additions and 21 deletions

View file

@ -14,6 +14,9 @@ echo $paginator->counter(array(
</div>
*/ ?>
<button id="editButton" class="actionButtons">Edit Selected Jobs</button><button id="saveButton" class="actionButtons">Save Jobs</button><button id="cancelButton" class="actionButtons">Cancel Editing (changes will not be saved)</button>
<table id="grid" style="overflow: hidden;"></table>
<div id="gridpager"></div>

View file

@ -1277,4 +1277,10 @@ span.addLineItem {
#jobs_grid_iframe {
width: 100%;
height: 600px;
}
button.actionButtons {
margin-right: 3em;
margin-bottom: 1em;
}

View file

@ -12,8 +12,8 @@ jQuery(document).ready(function(){
var currenciesList = [];
disableSaveEdit();
$.ajax({
url: '/currencies/jsonlist',
async: false,
@ -66,11 +66,11 @@ jQuery(document).ready(function(){
edittype:"select",
editoptions:{
value: "ORDER RECEIVED FROM CUSTOMER:ORDER RECEIVED FROM CUSTOMER;ORDER PLACED ON PRINCIPLE - WAITING ON DELIVERY:ORDER PLACED ON PRINCIPLE - WAITING ON DELIVERY;"+
"GOODS SHIPPED TO CUSTOMER - CMC WAITING ON PAYMENT:GOODS SHIPPED TO CUSTOMER - CMC WAITING ON PAYMENT;WAITING ON PAYMENT AND ANOTHER DELIVERY:WAITING ON PAYMENT AND ANOTHER DELIVERY;"+
"GOODS DELIVERED TO CUSTOMER & PAID IN FULL:GOODS DELIVERED TO CUSTOMER & PAID IN FULL;PAID IN FULL WAITING ON DELIVERY:PAID IN FULL WAITING ON DELIVERY;JOB CANCELLED:JOB CANCELLED;"+
"JOB ON HOLD:JOB ON HOLD;CUSTOMER TO PAY 100% WITH ORDER:CUSTOMER TO PAY 100% WITH ORDER"
}
},
@ -347,21 +347,9 @@ jQuery(document).ready(function(){
height: '700px',
caption:"Jobs",
editurl:"/jobs/ajax_edit",
multiselect: true,
onSelectRow: function(rowid){
if(typeof(lastsel) != undefined) {
if(rowid && rowid!==lastsel){
$(this).jqGrid('saveRow',lastsel, false, false,false);
$(this).jqGrid('editRow', rowid, true, pickdates);
}
}
lastsel = rowid;
},
gridComplete: function() {
setJobStatus();
}
@ -369,11 +357,42 @@ jQuery(document).ready(function(){
$("#editButton").click(function(){
var gr = jQuery("#grid").jqGrid('getGridParam','selrow');
var s;
s = jQuery("#grid").jqGrid('getGridParam','selarrrow');
//alert(s);
$.each(s, function(index, value) {
jQuery("#grid").jqGrid('editRow', value, false, pickdates, false, '/jobs/ajax_edit');
});
enableSaveEdit();
});
$("#cancelButton").click(function() {
var s;
s = jQuery("#grid").jqGrid('getGridParam','selarrrow');
//alert(s);
$.each(s, function(index, value) {
jQuery("#grid").jqGrid('restoreRow', value, true, pickdates);
});
disableSaveEdit();
});
$("#saveButton").click(function() {
var s;
s = jQuery("#grid").jqGrid('getGridParam','selarrrow');
//alert(s);
$.each(s, function(index, value) {
jQuery("#grid").jqGrid('saveRow', value, setJobStatus, '/jobs/ajax_edit');
});
disableSaveEdit();
//setJobStatus();
if(gr != null) {
jQuery("#grid").jqGrid('editRow', gr, true, pickdates);
}
});
@ -390,6 +409,21 @@ jQuery(document).ready(function(){
}
function disableSaveEdit() {
$("#editButton").button('enable');
$("#saveButton").button('disable');
$("#cancelButton").button('disable');
}
function enableSaveEdit() {
$("#saveButton").button('enable');
$("#cancelButton").button('enable');
$("#editButton").button('disable');
}
function addJobStatus(id, status) {
var color; //American spelling for Var Names.