Jobs list row color being updated based on Job Status

This commit is contained in:
Karl Cordes 2011-03-31 16:15:52 +11:00
parent a56679ed54
commit a0efe150e5
4 changed files with 120 additions and 13 deletions

View file

@ -28,6 +28,8 @@ foreach($jobs as $job) {
$cellArray = array(
// $job['Job']['id'],
$job['Job']['job_status'],
$job['Job']['sale_category'],
$job['Job']['shipment_category'],
$html->link($job['Job']['title'], array('controller'=>'jobs','action'=>'view', $job['Job']['id'])),

View file

@ -404,7 +404,7 @@ th a:hover {
text-decoration: none;
}
table tr td {
background: #fff;
/* background: #fff; */
border-right: 1px solid #ccc;
text-align: center;
vertical-align: top;

View file

@ -139,6 +139,42 @@ tr.ui-search-toolbar select {margin: 1px 0px 0px 0px}
.ui-searchFilter .divider hr {margin: 1px; }
.ui-jqgrid tr.jqgrow td {
.ui-jqgrid tr.jqgrow td { /* Word wrapping */
white-space: normal !important;
}
}
/* Job Status Colours */
tr {
border: 1px solid #A6C9E2;
}
tr.white {
background-color: #FFFFFF;
}
tr.yellow {
background-color: #F3FF35;
}
tr.light-blue {
background-color: #5CA4FF;
;
}
tr.magenta {
background-color: #FF2AF8;
}
tr.red {
background-color: #FF303E;
}
tr.brown {
background-color: #9E3F32;
}

View file

@ -13,9 +13,6 @@ jQuery(document).ready(function(){
var currenciesList = [];
/* $.getJSON('/currencies/jsonlist', function(data) {
currencies = data;
});*/
$.ajax({
url: '/currencies/jsonlist',
@ -26,7 +23,7 @@ jQuery(document).ready(function(){
}
});
console.log(currencies);
// console.log(currencies);
$.each(currencies, function(key, obj) {
currenciesList[key] = obj.name;
@ -39,7 +36,7 @@ jQuery(document).ready(function(){
mtype: 'GET',
colNames:[
//'id',
'Sale Cat.','Shipment Cat.','Job Number','Customer','Description','Customer O/N','Order Received','Supplier Ref',
'Status', 'Sale Cat.','Shipment Cat.','Job Number','Customer','Description','Customer O/N','Order Received','Supplier Ref',
'Order Placed Principle','date_scheduled_ex_works','date_order_sent_to_customer','Freight Paid By',
'company_gross_sales_aud','net_sales_aud','gross_profit_aud','ato_exchange_rate',
'gst','Sale Currency','gst_amount','gross_commisions','invoiced_amount_inc_gst','net_export_sales_aud',
@ -61,6 +58,24 @@ jQuery(document).ready(function(){
colModel:[
{
name:'job_status',
index:'job_status',
width:130,
editable:true,
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"
}
},
{
name:'sale_category',
index:'sale_category',
@ -321,7 +336,7 @@ jQuery(document).ready(function(){
],
// viewrecords: true,
gridview: true,
rowNum: 500,
height: '700px',
caption:"Jobs",
@ -333,13 +348,16 @@ jQuery(document).ready(function(){
if(typeof(lastsel) != undefined) {
if(rowid && rowid!==lastsel){
$(this).jqGrid('saveRow',lastsel);
$(this).jqGrid('saveRow',lastsel, false, false,false, setJobStatus);
$(this).jqGrid('editRow', rowid, true, pickdates);
}
}
lastsel = rowid;
},
gridComplete: function() {
setJobStatus();
}
});
@ -353,8 +371,59 @@ jQuery(document).ready(function(){
});
function setJobStatus() {
var jobStatusList = $("#grid").jqGrid('getCol', 'job_status', true);
$.each(jobStatusList, function() {
if(this.value) { //The Job Status has been set.
addJobStatus(this.id, this.value);
console.log(this.id +":"+ this.value);
}
});
return true;
}
function addJobStatus(id, status) {
var color; //American spelling for Var Names.
switch(status) {
case "ORDER RECEIVED FROM CUSTOMER":
color = "white";
break;
case "ORDER PLACED ON PRINCIPLE - WAITING ON DELIVERY":
color = "white";
break;
case "GOODS SHIPPED TO CUSTOMER - CMC WAITING ON PAYMENT":
color = "yellow";
break;
case "WAITING ON PAYMENT AND ANOTHER DELIVERY":
color = "yellow";
break;
case "GOODS DELIVERED TO CUSTOMER & PAID IN FULL":
color = "light-blue";
break;
case "PAID IN FULL WAITING ON DELIVERY":
color = "magenta";
break;
case "JOB CANCELLED":
color = "red";
break;
case "JOB ON HOLD":
color = "red";
break;
case "CUSTOMER TO PAY 100% WITH ORDER":
color = "brown";
break;
default:
color = "white";
break;
}
$("#"+id).removeClass('ui-widget-content').addClass(color);
console.log(id+":"+color);
}
function pickdates(id){
jQuery("#"+id+"_date_order_received","#grid").datepicker({