Removing jqGrid. Implementing this fucking thing myself. Ugh
This commit is contained in:
parent
f2d54e13aa
commit
6ba966a94d
|
|
@ -15,10 +15,10 @@ class JobsController extends AppController {
|
|||
);
|
||||
|
||||
function index() {
|
||||
/*$this->Job->recursive = 1;
|
||||
$this->Job->recursive = 1;
|
||||
$this->set('jobs', $this->paginate());
|
||||
$this->set('customers', $this->Job->Enquiry->Customer->find('list'));
|
||||
$this->set('currencies', $this->Job->Currency->find('list'));*/
|
||||
$this->set('currencies', $this->Job->Currency->find('list'));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -63,6 +63,7 @@ class JobsController extends AppController {
|
|||
$jobs = $this->Job->find('all', array('recursive'=>1, 'order'=>array('Job.id'=>'desc')));
|
||||
//print_r($jobs);
|
||||
$this->set('jobs', $jobs);
|
||||
$this->set('sale_category_options', $this->sale_category_options_array());
|
||||
|
||||
$customers = $this->Job->Enquiry->Customer->find('list');
|
||||
$this->set('customers', $customers);
|
||||
|
|
@ -70,6 +71,43 @@ class JobsController extends AppController {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Build the HTML select for sale_category1.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function sale_category_options() {
|
||||
$this->layout = 'none';
|
||||
$options = $this->sale_category_options_array();
|
||||
$this->set('options', $options);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function sale_category_options_array() {
|
||||
|
||||
$options['Australian Sale'] = array(
|
||||
0 => "Australian Customer & Australian Destination (GST Applies)",
|
||||
1 => "Overseas Customer & Australian Destination (GST Applies)",
|
||||
2 => "Commission from Australian Company or Supplier (GST Applies)",
|
||||
|
||||
);
|
||||
|
||||
$options['Exports'] = array(
|
||||
3 => "Overseas Customer & Overseas Destination (no GST)",
|
||||
4 => "Australian Customer & Overseas Destination (no GST)",
|
||||
5 => "Commission from Overseas Company (no GST)"
|
||||
);
|
||||
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function ajax_edit() {
|
||||
if(isset($this->params['form'])) {
|
||||
|
||||
|
|
@ -103,74 +141,7 @@ class JobsController extends AppController {
|
|||
|
||||
}
|
||||
|
||||
function index_oldgrid() {
|
||||
|
||||
$this->layout = 'grid';
|
||||
$jobs = $this->paginate();
|
||||
|
||||
$this->set('jobs', $jobs);
|
||||
|
||||
$jsonObj = array();
|
||||
|
||||
$customers = $this->Job->Enquiry->Customer->find('list');
|
||||
$this->set('customers', $customers);
|
||||
|
||||
|
||||
foreach($jobs as $job) {
|
||||
$jsonObj[] = array(
|
||||
'id' => $job['Job']['id'],
|
||||
'created' => $job['Job']['created'],
|
||||
'title' => $job['Job']['title'],
|
||||
'customer' => $customers[$job['Enquiry']['customer_id']],
|
||||
'customer_order_number' => $job['Job']['customer_order_number'],
|
||||
'supplier_reference' =>$job['Job']['supplier_reference'],
|
||||
'date_order_received' => $job['Job']['date_order_received'],
|
||||
'date_order_placed_on_principle' => $job['Job']['date_order_placed_on_principle'],
|
||||
'date_scheduled_ex_works' => $job['Job']['date_scheduled_ex_works'],
|
||||
'date_order_sent_to_customer' => $job['Job']['date_order_sent_to_customer'],
|
||||
'domestic_freight_paid_by' => $job['Job']['domestic_freight_paid_by'],
|
||||
'sale_category' => $job['Job']['sale_category'],
|
||||
'shipment_category' => $job['Job']['shipment_category'],
|
||||
'comments' => $job['Job']['comments'],
|
||||
'company_gross_sales_aud' => $job['Job']['company_gross_sales_aud'],
|
||||
'net_sales_aud' => $job['Job']['net_sales_aud'],
|
||||
'gross_profit_aud' => $job['Job']['gross_profit_aud'],
|
||||
'ato_exchange_rate' => $job['Job']['ato_exchange_rate'],
|
||||
'gst'=> $job['Job']['gst'],
|
||||
'currency_id' => $job['Job']['currency_id'],
|
||||
'gst_amount' => $job['Job']['gst_amount'],
|
||||
'gross_commisions' => $job['Job']['gross_commisions'],
|
||||
'invoiced_amount_inc_gst' => $job['Job']['invoiced_amount_inc_gst'],
|
||||
'net_export_sales_aud' =>$job['Job']['net_export_sales_aud'],
|
||||
'gross_profit_exports_aud' => $job['Job']['gross_profit_exports_aud'],
|
||||
'gp_percent' => $job['Job']['gp_percent'],
|
||||
'gross_australian_sales_foreign_currency' => $job['Job']['gross_australian_sales_foreign_currency'],
|
||||
'net_australian_sales_foreign_currency' => $job['Job']['net_australian_sales_foreign_currency'],
|
||||
'gross_profit_value_australian_sales_foreign_currency' => $job['Job']['gross_profit_value_australian_sales_foreign_currency'],
|
||||
'gross_export_sales_foreign_currency' => $job['Job']['gross_export_sales_foreign_currency'],
|
||||
'net_export_sales_foreign_currency' => $job['Job']['net_export_sales_foreign_currency'],
|
||||
'gross_profit_value_after_discount_exports_foreign_currency' => $job['Job']['gross_profit_value_after_discount_exports_foreign_currency'],
|
||||
'gross_commissions' => $job['Job']['gross_commissions'],
|
||||
'net_commissions' => $job['Job']['net_commissions']
|
||||
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
$jsonObj = json_encode($jsonObj);
|
||||
|
||||
$this->set('jsonObj', $jsonObj);
|
||||
|
||||
$this->set('jobs', $jobs);
|
||||
|
||||
$this->set('currencies', $this->Job->Currency->find('list'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
function view($id = null) {
|
||||
if (!$id) {
|
||||
|
|
|
|||
|
|
@ -31,62 +31,63 @@ foreach($jobs as $job) {
|
|||
}
|
||||
|
||||
|
||||
$cellArray = array(
|
||||
$cellArray = array(
|
||||
|
||||
$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'])),
|
||||
$poString,
|
||||
$job['Job']['job_status'],
|
||||
$job['Job']['sale_category1'],
|
||||
$job['Job']['sale_category'],
|
||||
$job['Job']['shipment_category'],
|
||||
$html->link($job['Job']['title'], array('controller'=>'jobs','action'=>'view', $job['Job']['id'])),
|
||||
$poString,
|
||||
|
||||
|
||||
$html->link($customers[$job['Enquiry']['customer_id']], array('controller'=>'customers','action'=>'view', $job['Enquiry']['customer_id'])),
|
||||
$job['Job']['comments'],
|
||||
$job['Job']['customer_order_number'],
|
||||
$job['Job']['date_order_received'],
|
||||
$html->link($customers[$job['Enquiry']['customer_id']], array('controller'=>'customers','action'=>'view', $job['Enquiry']['customer_id'])),
|
||||
$job['Job']['comments'],
|
||||
$job['Job']['customer_order_number'],
|
||||
$job['Job']['date_order_received'],
|
||||
|
||||
$job['Job']['supplier_reference'],
|
||||
$job['Job']['date_order_placed_on_principle'],
|
||||
$job['Job']['supplier_reference'],
|
||||
$job['Job']['date_order_placed_on_principle'],
|
||||
|
||||
$job['Job']['date_scheduled_ex_works'],
|
||||
$job['Job']['date_order_sent_to_customer'],
|
||||
$job['Job']['domestic_freight_paid_by'],
|
||||
$job['Job']['date_scheduled_ex_works'],
|
||||
$job['Job']['date_order_sent_to_customer'],
|
||||
$job['Job']['domestic_freight_paid_by'],
|
||||
|
||||
|
||||
$job['Job']['company_gross_sales_aud'],
|
||||
$job['Job']['net_sales_aud'],
|
||||
$job['Job']['gross_profit_aud'],
|
||||
$job['Job']['ato_exchange_rate'],
|
||||
$job['Job']['gst'],
|
||||
$job['Job']['currency_id'],
|
||||
$job['Job']['gst_amount'],
|
||||
$job['Job']['gross_commisions'],
|
||||
$job['Job']['invoiced_amount_inc_gst'],
|
||||
$job['Job']['net_export_sales_aud'],
|
||||
$job['Job']['gross_profit_exports_aud'],
|
||||
$job['Job']['gp_percent'],
|
||||
$job['Job']['gross_australian_sales_foreign_currency'],
|
||||
$job['Job']['net_australian_sales_foreign_currency'],
|
||||
$job['Job']['gross_profit_value_australian_sales_foreign_currency'],
|
||||
$job['Job']['gross_export_sales_foreign_currency'],
|
||||
$job['Job']['net_export_sales_foreign_currency'],
|
||||
$job['Job']['gross_profit_value_after_discount_exports_foreign_currency'],
|
||||
$job['Job']['gross_commissions'],
|
||||
$job['Job']['net_commissions']
|
||||
);
|
||||
$job['Job']['company_gross_sales_aud'],
|
||||
$job['Job']['net_sales_aud'],
|
||||
$job['Job']['gross_profit_aud'],
|
||||
$job['Job']['ato_exchange_rate'],
|
||||
$job['Job']['gst'],
|
||||
$job['Job']['currency_id'],
|
||||
$job['Job']['gst_amount'],
|
||||
$job['Job']['gross_commisions'],
|
||||
$job['Job']['invoiced_amount_inc_gst'],
|
||||
$job['Job']['net_export_sales_aud'],
|
||||
$job['Job']['gross_profit_exports_aud'],
|
||||
$job['Job']['gp_percent'],
|
||||
$job['Job']['gross_australian_sales_foreign_currency'],
|
||||
$job['Job']['net_australian_sales_foreign_currency'],
|
||||
$job['Job']['gross_profit_value_australian_sales_foreign_currency'],
|
||||
$job['Job']['gross_export_sales_foreign_currency'],
|
||||
$job['Job']['net_export_sales_foreign_currency'],
|
||||
$job['Job']['gross_profit_value_after_discount_exports_foreign_currency'],
|
||||
$job['Job']['gross_commissions'],
|
||||
$job['Job']['net_commissions']
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
$recordObj->rows[$i]['id'] = $job['Job']['id'];
|
||||
//$rows[$i] = $job;
|
||||
$recordObj->rows[$i]['cell'] = $cellArray;
|
||||
//$recordObj->rows[$i]['cell'] = $job['Job'];
|
||||
$i++;
|
||||
};
|
||||
$recordObj->rows[$i]['id'] = $job['Job']['id'];
|
||||
//$rows[$i] = $job;
|
||||
$recordObj->rows[$i]['cell'] = $cellArray;
|
||||
//$recordObj->rows[$i]['cell'] = $job['Job'];
|
||||
$i++;
|
||||
};
|
||||
|
||||
|
||||
|
||||
$jsonObj = json_encode($recordObj);
|
||||
echo $jsonObj;
|
||||
$jsonObj = json_encode($recordObj);
|
||||
echo $jsonObj;
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//echo $javascript->link('jquery.jeditable.mini');
|
||||
//echo $javascript->link('jobindex_editinplace');
|
||||
//echo $javascript->link('addjob');
|
||||
echo $javascript->link('job_index');
|
||||
//echo $javascript->link('job_index');
|
||||
|
||||
?>
|
||||
|
||||
|
|
@ -15,12 +15,110 @@ echo $javascript->link('job_index');
|
|||
<? //<iframe src="/jobs/index_grid" id="jobs_grid_iframe"></iframe>
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="paging">
|
||||
|
||||
<?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
|
||||
| <?php echo $paginator->numbers();?>
|
||||
<?php echo $paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled'));?>
|
||||
</div>
|
||||
|
||||
<div id="jobTable">
|
||||
<table cellpadding="0" cellspacing="0" class="jobsTable">
|
||||
<tr>
|
||||
<th><? //Select Checkbox ?></th>
|
||||
<th><?php echo $paginator->sort('Status');?></th>
|
||||
<th><?php echo $paginator->sort('Sale Category 1');?></th>
|
||||
<th><?php echo $paginator->sort('Sale Category 2');?></th>
|
||||
<th><?php echo $paginator->sort('Shipment Category');?></th>
|
||||
<th><?php echo $paginator->sort('Job Number');?></th>
|
||||
<th>CMC POs</th>
|
||||
<th><?php echo $paginator->sort('Customer');?></th>
|
||||
<th>Description</th>
|
||||
<th>Customer Order No</th>
|
||||
<th><?php echo $paginator->sort('Order Received');?></th>
|
||||
<th><?php echo $paginator->sort('Supplier Ref');?></th>
|
||||
<th><?php echo $paginator->sort('Scheduled Ex-Works');?></th>
|
||||
<th><?php echo $paginator->sort('Date Sent to Customer');?></th>
|
||||
<th><?php echo $paginator->sort('Freight Paid By CMC');?></th>
|
||||
<th><?php echo $paginator->sort('Sale Currency');?></th>
|
||||
<th><?php echo $paginator->sort('Gross Sales AUD');?></th>
|
||||
<th><?php echo $paginator->sort('Net Sales AUD');?></th>
|
||||
<th><?php echo $paginator->sort('Gross Profit AUD');?></th>
|
||||
<th><?php echo $paginator->sort('Net Export Sales Converted to Or Charged in AUD');?></th>
|
||||
<th><?php echo $paginator->sort('Gross Profit Value Export in AUD');?></th>
|
||||
<th><?php echo $paginator->sort('GP% Excl Commissions');?></th>
|
||||
<th><?php echo $paginator->sort('Company Gross Sales AUD');?></th>
|
||||
<th><?php echo $paginator->sort('ATO Exchange Rate');?></th>
|
||||
<th><?php echo $paginator->sort('Gross Australian Sales Foreign Currency');?></th>
|
||||
<th><?php echo $paginator->sort('Net Australian Sales Foreign Currency');?></th>
|
||||
<th><?php echo $paginator->sort('Gross Profit value Australian Sales Foreign Currency');?></th>
|
||||
<th><?php echo $paginator->sort('Gross Export Sales Foreign Currency');?></th>
|
||||
<th><?php echo $paginator->sort('Net Export Sales Foreign Currency');?></th>
|
||||
<th><?php echo $paginator->sort('Gross Profit Value After Discount Exports Foreign Currency');?></th>
|
||||
<th><?php echo $paginator->sort('Gross Commissions');?></th>
|
||||
<th><?php echo $paginator->sort('Net Commisions');?></th>
|
||||
<th class="actions"><?php __('Actions');?></th>
|
||||
</tr>
|
||||
<? foreach($jobs as $job):?>
|
||||
<tr>
|
||||
<td><input type="checkbox" id="<?=$job['Job']['id']?>" class="selectJob"></td>
|
||||
<td><?=$job['Job']['job_status'];?></td>
|
||||
<td>SALE CATEGORY 1 DROPDOWN</td>
|
||||
<td>Sale Cat 2 Dropdown</td>
|
||||
<td>Shipment Cat.</td>
|
||||
<td><?=$job['Job']['title'];?></td>
|
||||
<td><?
|
||||
$poString = '';
|
||||
foreach($job['PurchaseOrder'] as $po) {
|
||||
$poString .= ' '.$html->link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));
|
||||
}
|
||||
echo $poString;
|
||||
?>
|
||||
</td>
|
||||
<td><?=$job['Customer']['name'];?></td>
|
||||
<td><?=$job['Job']['comments'];?></td>
|
||||
<td><?=$job['Job']['customer_order_number'];?></td>
|
||||
<td><?=$job['Job']['date_order_received'];?></td>
|
||||
<td><?=$job['Job']['supplier_reference'];?></td>
|
||||
<td><?=$job['Job']['date_scheduled_ex_works'];?></td>
|
||||
<td><?=$job['Job']['date_order_sent_to_customer'];?></td>
|
||||
<td><?=$job['Job']['domestic_freight_paid_by'];?></td>
|
||||
<td><?=$job['Currency']['name'];?></td>
|
||||
<td><?=$job['Job']['company_gross_sales_aud'];?></td>
|
||||
<td><?=$job['Job']['net_sales_aud'];?></td>
|
||||
<td><?=$job['Job']['gross_profit_aud'];?></td>
|
||||
<td>Net Export Sales Conv to AUD?</td>
|
||||
<td><?=$job['Job']['gross_profit_exports_aud'];?></td>
|
||||
<td><?=$job['Job']['gp_percent'];?>%</td>
|
||||
<td>? Double column?</td>
|
||||
<td><?=$job['Job']['ato_exchange_rate'];?></td>
|
||||
<td><?=$job['Job']['gross_australian_sales_foreign_currency'];?></td>
|
||||
<td><?=$job['Job']['net_australian_sales_foreign_currency'];?></td>
|
||||
<td><?=$job['Job']['gross_profit_value_australian_sales_foreign_currency'];?></td>
|
||||
<td><?=$job['Job']['gross_export_sales_foreign_currency'];?></td>
|
||||
<td><?=$job['Job']['net_export_sales_foreign_currency'];?></td>
|
||||
<td><?=$job['Job']['gross_profit_value_after_discount_exports_foreign_currency'];?></td>
|
||||
<td><?=$job['Job']['gross_commissions'];?></td>
|
||||
<td><?=$job['Job']['net_commissions'];?></td>
|
||||
<td>Actions</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<? endforeach;?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="jobsIndex">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div id="editDiv">
|
||||
</div>
|
||||
|
||||
<? //debug($jobs);
|
||||
<? debug($jobs);
|
||||
?>
|
||||
|
|
@ -672,7 +672,7 @@ dt.altrow {
|
|||
}
|
||||
|
||||
#emailHeaders dt {
|
||||
|
||||
|
||||
}
|
||||
|
||||
dd {
|
||||
|
|
@ -1283,4 +1283,18 @@ span.addLineItem {
|
|||
button.actionButtons {
|
||||
margin-right: 3em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
#jobTable {
|
||||
height: 900px;
|
||||
width: 100%;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
table.jobsTable tr th {
|
||||
border: 1px solid;
|
||||
}
|
||||
|
||||
table.jobsTable tr td {
|
||||
border: 1px solid;
|
||||
}
|
||||
|
|
@ -36,7 +36,7 @@ jQuery(document).ready(function(){
|
|||
mtype: 'GET',
|
||||
colNames:[
|
||||
//'id',
|
||||
'Status', 'Sale Cat.','Shipment Cat.','Job Number','CMC POs', 'Customer','Description','Customer O/N','Order Received','Supplier Ref',
|
||||
'Status','Sale Cat. 1','Sale Cat. 2','Shipment Cat.','Job Number','CMC POs', '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',
|
||||
|
|
@ -75,6 +75,18 @@ jQuery(document).ready(function(){
|
|||
},
|
||||
|
||||
|
||||
{
|
||||
name:'sale_category1',
|
||||
index:'sale_category1',
|
||||
width:200,
|
||||
editable:true,
|
||||
edittype:"select",
|
||||
editoptions: {
|
||||
dataUrl: '/jobs/sale_category_options'
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
name:'sale_category',
|
||||
index:'sale_category',
|
||||
|
|
@ -359,8 +371,6 @@ jQuery(document).ready(function(){
|
|||
$("#editButton").click(function(){
|
||||
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');
|
||||
});
|
||||
|
|
@ -372,7 +382,6 @@ jQuery(document).ready(function(){
|
|||
$("#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);
|
||||
|
|
@ -384,14 +393,13 @@ jQuery(document).ready(function(){
|
|||
$("#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');
|
||||
jQuery("#grid").jqGrid('saveRow', value, false, '/jobs/ajax_edit');
|
||||
});
|
||||
|
||||
disableSaveEdit();
|
||||
//setJobStatus();
|
||||
setJobStatus();
|
||||
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue