diff --git a/controllers/jobs_controller.php b/controllers/jobs_controller.php index 449c09dc..4f9b4b5c 100755 --- a/controllers/jobs_controller.php +++ b/controllers/jobs_controller.php @@ -34,13 +34,14 @@ class JobsController extends AppController { $this->layout = 'ajax'; $this->set('job', $this->Job->find('first', array('conditions'=>array('Job.id'=>$id)))); - + $this->set('currencies', $this->Job->Currency->find('list')); $this->set('sale_category_options', $this->sale_category_options()); $this->set('sale_category_array', $this->sale_category_array()); $this->set('job_type_options', $this->job_type_options()); $this->set('shipment_options', $this->shipment_options()); $this->set('freight_paid_by_options',$this->freight_paid_options()); $this->set('gst_options', $this->gst_options()); + $this->set('job_status_options', $this->job_status_options()); } @@ -56,11 +57,26 @@ class JobsController extends AppController { $this->set('shipment_options', $this->shipment_options()); $this->set('freight_paid_by_options',$this->freight_paid_options()); $this->set('gst_options', $this->gst_options()); + } + function job_status_options() { + $options = array('ORDER RECEIVED FROM CUSTOMER', + 'ORDER PLACED ON PRINCIPLE - WAITING ON DELIVERY', + 'GOODS SHIPPED TO CUSTOMER - CMC WAITING ON PAYMENT', + 'WAITING ON PAYMENT AND ANOTHER DELIVERY', + 'GOODS DELIVERED TO CUSTOMER - CMC PAID IN FULL', + 'PAID IN FULL WAITING ON DELIVERY', + 'JOB CANCELLED', + 'JOB ON HOLD', + 'CUSTOMER TO PAY 100% WITH ORDER'); + $options = $this->buildEnumOpts($options); + return $options; + } + /** * For the 'sale_category' column. diff --git a/views/elements/isEmptyDate.ctp b/views/elements/isEmptyDate.ctp index e00af304..f9e2c502 100755 --- a/views/elements/isEmptyDate.ctp +++ b/views/elements/isEmptyDate.ctp @@ -1,7 +1,7 @@ "> - create('Job', array('action'=>'ajax_edit', 'id'=>'form_'.$job['Job']['id'], 'class'=>'job_table_form')); ?> - input('id', array('type'=>'hidden', 'value'=>$job['Job']['id'])); ?> - - - - - input('sale_category', array('options'=>$sale_category_options, 'label'=>false, 'selected'=>$job['Job']['sale_category'], 'class'=>'sale_category'));?> - - - input('job_type', array('options'=>$job_type_options, 'label' => false, 'selected'=>$job['Job']['job_type']));?> - input('shipment_category', array('options'=>$shipment_options, 'label'=>false,'selected'=>$job['Job']['shipment_category']));?> - link($job['Job']['title'], array('controller'=>'jobs', 'action'=>'view', $job['Job']['id']));?> - link($job['Enquiry']['title'], array('controller'=>'enquiries','action'=>'view', $job['Enquiry']['id']));?> - link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id'])); - } - echo $poString; - ?> - - link($job['Customer']['name'], array('controller'=>'customers','action'=>'view', $job['Customer']['id']));?> - - input('customer_order_number', array('value'=>$job['Job']['customer_order_number'], 'label'=>false ,'div'=>false));?> - - - input('supplier_reference', array('value'=>$job['Job']['supplier_reference'], 'label'=>false ,'div'=>false));?> - + + + + + + + +input('id', array('type'=>'hidden', 'value'=>$job['Job']['id'])); ?> + +input('date_order_received_display', array('value'=>$this->element('isEmptyDate', array('date'=>$job['Job']['date_order_received'])), 'label'=>false, 'id'=>$job['Job']['id'].'_date_order_received_display'));?> + input('date_order_received', array('type'=>'hidden', 'id'=>$job['Job']['id'].'_date_order_received', 'value'=>$job['Job']['date_order_received']));?> + +input('job_status', array('type'=>'select', 'options'=>$job_status_options, 'value'=>$job['Job']['job_status'], 'label'=>false, 'div'=>false));?> + + input('sale_category', array('options'=>$sale_category_options, 'type'=>'select', 'label'=>false, 'value'=>$job['Job']['sale_category'], 'class'=>'sale_category'));?> + + + input('job_type', array('options'=>$job_type_options, 'label' => false, 'selected'=>$job['Job']['job_type']));?> +input('shipment_category', array('options'=>$shipment_options, 'label'=>false,'selected'=>$job['Job']['shipment_category']));?> +link($job['Job']['title'], array('controller'=>'jobs', 'action'=>'view', $job['Job']['id']));?> +link($job['Enquiry']['title'], array('controller'=>'enquiries','action'=>'view', $job['Enquiry']['id']));?> +link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id'])); + } + echo $poString; + ?> + +input('date_order_placed_on_principle_display', array('value'=>$this->element('isEmptyDate', array('date'=>$job['Job']['date_order_placed_on_principle'])), 'label'=>false, 'id'=>$job['Job']['id'].'_date_order_placed_on_principle_display'));?> + input('date_order_placed_on_principle', array('type'=>'hidden', 'id'=>$job['Job']['id'].'_date_order_placed_on_principle', 'value'=>$job['Job']['date_order_placed_on_principle']));?> + + +link($job['Customer']['name'], array('controller'=>'customers','action'=>'view', $job['Customer']['id']));?> + + input('customer_order_number', array('value'=>$job['Job']['customer_order_number'], 'label'=>false ,'div'=>false));?> + + + + input('supplier_reference', array('value'=>$job['Job']['supplier_reference'], 'label'=>false ,'div'=>false));?> + + + + input('date_scheduled_ex_works_display', array('value'=>$this->element('isEmptyDate', array('date'=>$job['Job']['date_scheduled_ex_works'])), 'label'=>false, 'id'=>$job['Job']['id'].'_date_scheduled_ex_works_display'));?> + input('date_scheduled_ex_works', array('type'=>'hidden', 'id'=>$job['Job']['id'].'_date_scheduled_ex_works', 'value'=>$job['Job']['date_scheduled_ex_works'])); ?> + + + input('date_order_sent_to_customer_display', array('value'=>$this->element('isEmptyDate', array('date'=>$job['Job']['date_order_sent_to_customer'])), 'label'=>false, 'id'=>$job['Job']['id'].'_date_order_sent_to_customer_display'));?> + input('date_order_sent_to_customer', array('type'=>'hidden', 'id'=>$job['Job']['id'].'_date_order_sent_to_customer', 'value'=>$job['Job']['date_order_sent_to_customer'])); ?> + + input('domestic_freight_paid_by', array('type'=>'select','options'=>$freight_paid_by_options, 'value'=>$job['Job']['domestic_freight_paid_by'], 'label'=>false ,'div'=>false));?> + + + input('currency_id', array('value'=>$job['Job']['currency_id'], 'type'=>'select', 'options'=>$currencies, 'label'=>false ,'div'=>false));?> + + + input('company_gross_sales_aud', array('value'=>$job['Job']['company_gross_sales_aud'], 'label'=>false ,'div'=>false));?> + + + + input('net_sales_aud', array('value'=>$job['Job']['net_sales_aud'], 'label'=>false ,'div'=>false));?> + + input('gross_profit_aud', array('value'=>$job['Job']['gross_profit_aud'], 'label'=>false ,'div'=>false));?> + + Net Export Sales Conv to AUD? - - - input('gross_profit_exports_aud', array('value'=>$job['Job']['gross_profit_exports_aud'], 'label'=>false ,'div'=>false));?> - - - input('gp_percent', array('value'=>$job['Job']['gp_percent'], 'label'=>false ,'div'=>false));?> - - ? Double column? - - input('ato_exchange_rate', array('value'=>$job['Job']['ato_exchange_rate'], 'label'=>false ,'div'=>false));?> - - input('gross_australian_sales_foreign_currency', array('value'=>$job['Job']['gross_australian_sales_foreign_currency'], 'label'=>false ,'div'=>false));?> - - - input('net_australian_sales_foreign_currency', array('value'=>$job['Job']['net_australian_sales_foreign_currency'], 'label'=>false ,'div'=>false));?> - - input('gross_profit_value_australian_sales_foreign_currency', array('value'=>$job['Job']['gross_profit_value_australian_sales_foreign_currency'], 'label'=>false ,'div'=>false));?> - - - input('gross_export_sales_foreign_currency', array('value'=>$job['Job']['gross_export_sales_foreign_currency'], 'label'=>false ,'div'=>false));?> - - input('net_export_sales_foreign_currency', array('value'=>$job['Job']['net_export_sales_foreign_currency'], 'label'=>false ,'div'=>false));?> - - input('gross_profit_value_after_discount_exports_foreign_currency', array('value'=>$job['Job']['gross_profit_value_after_discount_exports_foreign_currency'], 'label'=>false ,'div'=>false));?> - - - input('gross_commissions', array('value'=>$job['Job']['gross_commissions'], 'label'=>false ,'div'=>false));?> - - input('net_commissions', array('value'=>$job['Job']['net_commissions'], 'label'=>false ,'div'=>false));?> - - + + + input('gross_profit_exports_aud', array('value'=>$job['Job']['gross_profit_exports_aud'], 'label'=>false ,'div'=>false));?> + + + input('gp_percent', array('value'=>$job['Job']['gp_percent'], 'label'=>false ,'div'=>false));?> + +? Double column? + + input('ato_exchange_rate', array('value'=>$job['Job']['ato_exchange_rate'], 'label'=>false ,'div'=>false));?> + + input('gross_australian_sales_foreign_currency', array('value'=>$job['Job']['gross_australian_sales_foreign_currency'], 'label'=>false ,'div'=>false));?> + + + input('net_australian_sales_foreign_currency', array('value'=>$job['Job']['net_australian_sales_foreign_currency'], 'label'=>false ,'div'=>false));?> + + input('gross_profit_value_australian_sales_foreign_currency', array('value'=>$job['Job']['gross_profit_value_australian_sales_foreign_currency'], 'label'=>false ,'div'=>false));?> + + + input('gross_export_sales_foreign_currency', array('value'=>$job['Job']['gross_export_sales_foreign_currency'], 'label'=>false ,'div'=>false));?> + + input('net_export_sales_foreign_currency', array('value'=>$job['Job']['net_export_sales_foreign_currency'], 'label'=>false ,'div'=>false));?> + + input('gross_profit_value_after_discount_exports_foreign_currency', array('value'=>$job['Job']['gross_profit_value_after_discount_exports_foreign_currency'], 'label'=>false ,'div'=>false));?> + + + input('gross_commissions', array('value'=>$job['Job']['gross_commissions'], 'label'=>false ,'div'=>false));?> + + input('net_commissions', array('value'=>$job['Job']['net_commissions'], 'label'=>false ,'div'=>false));?> + + -end();?> - - \ No newline at end of file + \ No newline at end of file diff --git a/views/jobs/get_viewable_row.ctp b/views/jobs/get_viewable_row.ctp index 45856340..b68c14de 100644 --- a/views/jobs/get_viewable_row.ctp +++ b/views/jobs/get_viewable_row.ctp @@ -1,13 +1,13 @@ - - + + element('isEmptyDate', array('date'=>$job['Job']['date_order_received']));?> - input('sale_category', array('options'=>$sale_category_options, 'label'=>false, 'selected'=>$job['Job']['sale_category'], 'class'=>'sale_category'));?> + - input('job_type', array('options'=>$job_type_options, 'label' => false, 'selected'=>$job['Job']['job_type']));?> - input('shipment_category', array('options'=>$shipment_options, 'label'=>false,'selected'=>$job['Job']['shipment_category']));?> + + link($job['Job']['title'], array('controller'=>'jobs', 'action'=>'view', $job['Job']['id']));?> link($job['Enquiry']['title'], array('controller'=>'enquiries','action'=>'view', $job['Enquiry']['id']));?> + element('isEmptyDate', array('date'=>$job['Job']['date_order_placed_on_principle']));?> link($job['Customer']['name'], array('controller'=>'customers','action'=>'view', $job['Customer']['id']));?> - input('customer_order_number', array('value'=>$job['Job']['customer_order_number'], 'label'=>false ,'div'=>false));?> + - input('supplier_reference', array('value'=>$job['Job']['supplier_reference'], 'label'=>false ,'div'=>false));?> + - input('date_scheduled_ex_works', array('value'=>$job['Job']['date_scheduled_ex_works'], 'label'=>false ,'div'=>false));?> + element('isEmptyDate', array('date'=>$job['Job']['date_scheduled_ex_works']));?> - input('date_order_sent_to_customer', array('value'=>$job['Job']['date_order_sent_to_customer'], 'label'=>false ,'div'=>false));?> - + element('isEmptyDate', array('date'=>$job['Job']['date_order_sent_to_customer']));?> - input('domestic_freight_paid_by', array('value'=>$job['Job']['domestic_freight_paid_by'], 'label'=>false ,'div'=>false));?> + - input('currency_id', array('value'=>$job['Currency']['name'], 'label'=>false ,'div'=>false));?> + - input('company_gross_sales_aud', array('value'=>$job['Job']['company_gross_sales_aud'], 'label'=>false ,'div'=>false));?> + - input('net_sales_aud', array('value'=>$job['Job']['net_sales_aud'], 'label'=>false ,'div'=>false));?> + - input('gross_profit_aud', array('value'=>$job['Job']['gross_profit_aud'], 'label'=>false ,'div'=>false));?> + Net Export Sales Conv to AUD? - input('gross_profit_exports_aud', array('value'=>$job['Job']['gross_profit_exports_aud'], 'label'=>false ,'div'=>false));?> + - input('gp_percent', array('value'=>$job['Job']['gp_percent'], 'label'=>false ,'div'=>false));?> + ? Double column? - input('ato_exchange_rate', array('value'=>$job['Job']['ato_exchange_rate'], 'label'=>false ,'div'=>false));?> + - input('gross_australian_sales_foreign_currency', array('value'=>$job['Job']['gross_australian_sales_foreign_currency'], 'label'=>false ,'div'=>false));?> + - input('net_australian_sales_foreign_currency', array('value'=>$job['Job']['net_australian_sales_foreign_currency'], 'label'=>false ,'div'=>false));?> + - input('gross_profit_value_australian_sales_foreign_currency', array('value'=>$job['Job']['gross_profit_value_australian_sales_foreign_currency'], 'label'=>false ,'div'=>false));?> + - input('gross_export_sales_foreign_currency', array('value'=>$job['Job']['gross_export_sales_foreign_currency'], 'label'=>false ,'div'=>false));?> + - input('net_export_sales_foreign_currency', array('value'=>$job['Job']['net_export_sales_foreign_currency'], 'label'=>false ,'div'=>false));?> + - input('gross_profit_value_after_discount_exports_foreign_currency', array('value'=>$job['Job']['gross_profit_value_after_discount_exports_foreign_currency'], 'label'=>false ,'div'=>false));?> + - input('gross_commissions', array('value'=>$job['Job']['gross_commissions'], 'label'=>false ,'div'=>false));?> + - input('net_commissions', array('value'=>$job['Job']['net_commissions'], 'label'=>false ,'div'=>false));?> + - - -end();?> \ No newline at end of file + + \ No newline at end of file diff --git a/views/jobs/index.ctp b/views/jobs/index.ctp index 57191f3c..c9664846 100644 --- a/views/jobs/index.ctp +++ b/views/jobs/index.ctp @@ -27,6 +27,7 @@ echo $paginator->counter(array(
+ create('Job', array('action'=>'/jobs/ajax_edit'));?> @@ -34,12 +35,13 @@ echo $paginator->counter(array( - + + @@ -67,17 +69,19 @@ echo $paginator->counter(array( + create('Job', array('action'=>'ajax_edit', 'class'=>'job_table_form', 'default'=>false)); + ?> + - create('Job', array('action'=>'ajax_edit', 'id'=>'form_'.$job['Job']['id'], 'class'=>'job_table_form')); ?> - input('id', array('type'=>'hidden', 'value'=>$job['Job']['id'])); ?> - - - + + + @@ -92,6 +96,7 @@ echo $paginator->counter(array( echo $poString; ?> + @@ -154,14 +158,14 @@ echo $paginator->counter(array( - + - end();?> - +
Actions sort('Order Received');?> sort('Status');?>sort('Sale Category');?>sort('Sale Category');?> sort('Job Type');?> sort('Shipment Category');?> sort('Job Number');?> Enquiry Number CMC POsDate Order Placed on Principle sort('Customer');?> Customer Order No sort('Supplier Ref');?>
- + element('isEmptyDate', array('date'=>$job['Job']['date_order_received']));?> + element('isEmptyDate', array('date'=>$job['Job']['date_order_placed_on_principle']));?> link($job['Customer']['name'], array('controller'=>'customers','action'=>'view', $job['Customer']['id']));?> @@ -102,11 +107,10 @@ echo $paginator->counter(array( - + element('isEmptyDate', array('date'=>$job['Job']['date_scheduled_ex_works']));?> - - + element('isEmptyDate', array('date'=>$job['Job']['date_order_sent_to_customer']));?>
+ end(); ?>
prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?> diff --git a/webroot/css/quotenik.css b/webroot/css/quotenik.css index b1935209..44b013e8 100755 --- a/webroot/css/quotenik.css +++ b/webroot/css/quotenik.css @@ -1292,6 +1292,7 @@ table.jobsTable tr th { font-size: 70%; } + table.jobsTable tr td { border: 1px solid; font-size: 60%; @@ -1316,7 +1317,7 @@ table.jobsTable tr td form { .jobsTable [disabled] { - + color:#000; background-color:#fff @@ -1328,6 +1329,7 @@ select.sale_category { } + .outer { height: 650px; } \ No newline at end of file diff --git a/webroot/js/job_index.js b/webroot/js/job_index.js index e7af0715..79767f48 100644 --- a/webroot/js/job_index.js +++ b/webroot/js/job_index.js @@ -1,71 +1,62 @@ $(function() { - // console.profile(); - //$(":input").hide(); $(".editButton").show(); - $(".cancelButton").hide(); - $(".saveButton").hide(); - - $("input").attr("readonly","readonly"); - $("select").attr("disabled", "disabled"); - $(".editButton").click(function() { - + + $(".editButton").live('click',function() { var id = $(this).parents('tr').attr('id'); - //alert(id); - makeEditable(id); + getEditable(id); - $('.editButton').hide(); - - $("#"+id).find('.saveButton').show(); - $("#"+id).find('.cancelButton').show(); return false; }); - $(".cancelButton").click(function() { + $(".cancelButton").live('click',function() { var id = $(this).parents('tr').attr('id'); - $(this).hide(); - $("#"+id).find('.saveButton').hide(); - $("#"+id).find('.editButton').show(); - cancelEditable(id); + getViewable(id); + return false; }); - $(".saveButton").click(function() { + $(".saveButton").live('click',function() { var id = $(this).parents('tr').attr('id'); - var serializedForm = $("#"+'form_'+id).serialize(); + var thisJobInputs = $('#'+id).find('input,select'); - $.post('/jobs/ajax_edit', serializedForm, function(data) { - alert("Success! Job Edited"+data); //Need to do something here to update the Row. - window.location.reload(); + $.post('/jobs/ajax_edit', thisJobInputs, function(data) { + getViewable(id); }); - //console.log($("#"+id).find('form').serialize()); return false; }); - $('form').submit(function() { - //console.log($(this).serialize()); - return false; - }); - //console.profileEnd(); }); -function makeEditable(id) { - $("#"+id).find('input').attr("readonly",""); - $("#"+id).find('select').attr("disabled",""); +function getEditable(id) { + $.get('/jobs/getEditableRow/'+id+'/editedRowCount', false, function(data) { + $("#"+id).replaceWith(data); + $("#"+id).find("button").button(); + + } ); } +function getViewable(id) { + $.get('/jobs/getViewableRow/'+id, false, function(data) { + + $("#"+id).replaceWith(data); + $("#"+id).find("button").button(); + + } ); +} + function cancelEditable(id) { $("#"+id).find('input').attr("readonly","readonly"); $("#"+id).find('select').attr("disabled","disabled");