Fixed job edit
This commit is contained in:
parent
037df7d1da
commit
43f6653b1b
|
|
@ -99,19 +99,45 @@ class JobsController extends AppController {
|
|||
$this->flash(__('Invalid Job', true), array('action'=>'index'));
|
||||
}
|
||||
if (!empty($this->data)) {
|
||||
$jobid = $this->data['Job']['id'];
|
||||
if ($this->Job->save($this->data)) {
|
||||
$this->flash(__('The Job has been saved.', true), array('action'=>'index'));
|
||||
// $this->flash(__('The Job has been saved.', true), array('action'=>'view', $jobid));
|
||||
|
||||
$this->Session->setFlash(__('The Job has been saved', true));
|
||||
|
||||
$this->redirect(array('action' =>'view/'.$jobid), null, false);
|
||||
|
||||
} else {
|
||||
}
|
||||
}
|
||||
if (empty($this->data)) {
|
||||
$this->data = $this->Job->read(null, $id);
|
||||
$job = $this->Job->read(null, $id);
|
||||
$this->data = $job;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
$enquiries = $this->Job->Enquiry->find('list');
|
||||
|
||||
$this->set(compact('enquiries'));
|
||||
|
||||
|
||||
|
||||
|
||||
$freight_paid_options = array("CMC"=>"CMC", "Customer"=>"Customer");
|
||||
$this->set('freight_paid_options', $freight_paid_options);
|
||||
|
||||
$sale_category_options = array("INDENT"=>"INDENT", "STOCK"=>"STOCK", "COMMISSION"=>"COMMISSION");
|
||||
$this->set('sale_category_options', $sale_category_options);
|
||||
|
||||
$shipment_category_options = array(
|
||||
"AUSTRALIA"=>"AUSTRALIA",
|
||||
"EXPORT"=>"EXPORT",
|
||||
"DIRECT-INTL"=>"DIRECT-INTL",
|
||||
"DIRECT-AUST"=>"DIRECT-AUST",
|
||||
"NO-SHIP"=>"NO-SHIP"
|
||||
);
|
||||
$this->set('shipment_category_options', $shipment_category_options);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function delete($id = null) {
|
||||
|
|
@ -123,5 +149,17 @@ class JobsController extends AppController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function __isNotEmptyDate($date) {
|
||||
if($date == "0000-00-00") {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,29 +1,109 @@
|
|||
<div class="jobs form">
|
||||
<?php echo $javascript->link('addjob'); ?>
|
||||
|
||||
<?php echo $form->create('Job');?>
|
||||
<fieldset>
|
||||
<legend><?php __('Edit Job');?></legend>
|
||||
<legend><?php __('Edit Job: '.$this->data['Job']['title']);?></legend>
|
||||
<?php
|
||||
echo $form->input('id');
|
||||
echo $form->input('title', array('readonly'=>'readonly'));
|
||||
//echo $form->input('title');
|
||||
echo $form->input('enquiry_id', array('type'=>'hidden'));
|
||||
echo $form->input('comments');
|
||||
echo $form->input('date_order_received');
|
||||
echo $form->input('date_order_placed_on_principle');
|
||||
echo $form->input('date_scheduled_ex_works');
|
||||
echo $form->input('date_order_sent_to_customer');
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
//format the mySQL date in the nice readable format.
|
||||
if($this->data['Job']['date_order_received'] != '0000-00-00') {
|
||||
$order_received_time = strtotime($this->data['Job']['date_order_received']);
|
||||
$order_received_readable = date('l j F Y', $order_received_time );
|
||||
|
||||
}
|
||||
else {
|
||||
$order_received_readable = "";
|
||||
}
|
||||
|
||||
if($this->data['Job']['date_order_placed_on_principle'] != '0000-00-00') {
|
||||
$order_placed_on_principle_time = strtotime($this->data['Job']['date_order_placed_on_principle']);
|
||||
$order_placed_on_principle_readable = date('l j F Y', $order_placed_on_principle_time );
|
||||
|
||||
}
|
||||
else {
|
||||
$order_placed_on_principle_readable = "";
|
||||
}
|
||||
|
||||
if($this->data['Job']['date_scheduled_ex_works'] != '0000-00-00') {
|
||||
$order_scheduled_ex_works_time = strtotime($this->data['Job']['date_scheduled_ex_works']);
|
||||
$order_scheduled_readable = date('l j F Y', $order_scheduled_ex_works_time);
|
||||
|
||||
}
|
||||
else {
|
||||
$order_scheduled_readable = "";
|
||||
}
|
||||
|
||||
if($this->data['Job']['date_order_sent_to_customer'] != '0000-00-00') {
|
||||
$order_sent_to_customer_time = strtotime($this->data['Job']['date_order_sent_to_customer']);
|
||||
$order_sent_readable = date('l j F Y', $order_sent_to_customer_time);
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
$order_sent_readable = "";
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<div class="input text">
|
||||
<label for="JobDateOrderReceivedDisplay">Date Order Received by CMC</label>
|
||||
<input id="JobDateOrderReceivedDisplay" type="text" value="<?php echo $order_received_readable;?>" class="datePicker">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="input text" id="OrderPlacedOnPrincipleDiv">
|
||||
<label for="JobDateOrderPlacedOnPrincipleDisplay">Date Order Placed on Principle</label>
|
||||
<input id="JobDateOrderPlacedOnPrincipleDisplay" type="text" value="<?php echo $order_placed_on_principle_readable;?>" class="datePicker">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="input text">
|
||||
<label for="JobDateScheduledExWorksDisplay">Date Scheduled Ex Works</label>
|
||||
<input id="JobDateScheduledExWorksDisplay" type="text" value="<?php echo $order_scheduled_readable; ?>" class="datePicker">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="input text">
|
||||
<label for="JobDateOrderSentToCustomerDisplay">Date Order Sent to Customer</label>
|
||||
<input id="JobDateOrderSentToCustomerDisplay" type="text" value="<?php echo $order_sent_readable; ?>" class="datePicker">
|
||||
</div>
|
||||
<?
|
||||
|
||||
|
||||
echo $form->input('date_order_received', array('type'=>'hidden'));
|
||||
echo $form->input('date_order_placed_on_principle', array('type'=>'hidden'));
|
||||
echo $form->input('date_scheduled_ex_works', array('type'=>'hidden'));
|
||||
echo $form->input('date_order_sent_to_customer', array('type'=>'hidden'));
|
||||
echo $form->input('customer_order_number');
|
||||
echo $form->input('domestic_freight_paid_by');
|
||||
echo $form->input('sale_category');
|
||||
echo $form->input('shipment_category');
|
||||
echo $form->input('domestic_freight_paid_by', array('type'=>'select', 'options'=>$freight_paid_options));
|
||||
echo $form->input('sale_category', array('type'=>'select', 'options'=>$sale_category_options));
|
||||
echo $form->input('shipment_category', array('type'=>'select', 'options'=>$shipment_category_options));
|
||||
echo $form->input('id');
|
||||
echo $form->input('comments');
|
||||
?>
|
||||
</fieldset>
|
||||
<?php echo $form->end('Submit');?>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<ul>
|
||||
<li><?php echo $html->link(__('Delete', true), array('action' => 'delete', $form->value('Job.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $form->value('Job.id'))); ?></li>
|
||||
<li><?php echo $html->link(__('List Jobs', true), array('action' => 'index'));?></li>
|
||||
<li><?php echo $html->link(__('List States', true), array('controller' => 'states', 'action' => 'index')); ?> </li>
|
||||
<li><?php echo $html->link(__('New State', true), array('controller' => 'states', 'action' => 'add')); ?> </li>
|
||||
<li><?php echo $html->link(__('List Customers', true), array('controller' => 'customers', 'action' => 'index')); ?> </li>
|
||||
<li><?php echo $html->link(__('New Customer', true), array('controller' => 'customers', 'action' => 'add')); ?> </li>
|
||||
<li><?php echo $html->link(__('List Enquiries', true), array('controller' => 'enquiries', 'action' => 'index')); ?> </li>
|
||||
<li><?php echo $html->link(__('New Enquiry', true), array('controller' => 'enquiries', 'action' => 'add')); ?> </li>
|
||||
<li><?php echo $html->link(__('List Contacts', true), array('controller' => 'contacts', 'action' => 'index')); ?> </li>
|
||||
<li><?php echo $html->link(__('New Contact', true), array('controller' => 'contacts', 'action' => 'add')); ?> </li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue