Added delete and undelete functions for enquiries.
This commit is contained in:
parent
7d95c07d84
commit
4715c39b0f
|
|
@ -56,7 +56,7 @@ if($host == 'cmc.lan' || $host == '192.168.0.7') {
|
|||
Configure::write('smtp_settings', array(
|
||||
'port' => '25',
|
||||
'timeout' => '30',
|
||||
'host' => '192.168.0.8',
|
||||
'host' => '192.168.0.14',
|
||||
'username' => 'sales',
|
||||
'password' => '2seng33+02'));
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ class CostingsController extends AppController {
|
|||
|
||||
$this->set('type', 'line_item');
|
||||
$this->set('line_item', $line_item);
|
||||
//die(print_r($line_item));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@ class EnquiriesController extends AppController {
|
|||
|
||||
'contain' => false,
|
||||
'limit' => 150,
|
||||
'order'=>array('Enquiry.id' => 'desc')
|
||||
|
||||
'order'=>array('Enquiry.id' => 'desc'),
|
||||
);
|
||||
|
||||
var $components = array('RequestHandler', 'Email');
|
||||
|
|
@ -22,7 +21,6 @@ class EnquiriesController extends AppController {
|
|||
function index() {
|
||||
$this->Enquiry->recursive = 0;
|
||||
$this->set('enquiries', $this->paginate());
|
||||
|
||||
$status_list = $this->Enquiry->Status->getJSON();
|
||||
$this->set('status_list', $status_list);
|
||||
$classNames = $this->Enquiry->Status->getClassNamesJSON();
|
||||
|
|
@ -530,5 +528,45 @@ class EnquiriesController extends AppController {
|
|||
}
|
||||
|
||||
|
||||
function delete($id = null) {
|
||||
if($id == null) {
|
||||
$this->Session->setFlash('Invalid Enquiry ID');
|
||||
$this->redirect(array('action'=>'index'));
|
||||
}
|
||||
else {
|
||||
$enquiry = $this->Enquiry->findById($id);
|
||||
|
||||
$enquiry['Enquiry']['archived'] = 1;
|
||||
|
||||
$this->Enquiry->save($enquiry);
|
||||
|
||||
$undo = '<a href="/enquiries/undelete/'.$id.'">Undo</a>';
|
||||
|
||||
$this->Session->setFlash('Enquiry '.$enquiry['Enquiry']['title'].' has been deleted. '.$undo);
|
||||
$this->redirect(array('action'=>'index'));
|
||||
}
|
||||
}
|
||||
|
||||
/** Could do it in a single method, but fuck it. */
|
||||
function undelete($id = null) {
|
||||
|
||||
if($id == null) {
|
||||
$this->Session->setFlash('Invalid Enquiry ID');
|
||||
$this->redirect(array('action'=>'index'));
|
||||
}
|
||||
else {
|
||||
$enquiry = $this->Enquiry->findById($id);
|
||||
|
||||
$enquiry['Enquiry']['archived'] = 0;
|
||||
|
||||
$this->Enquiry->save($enquiry);
|
||||
|
||||
$undo = '<a href="/enquiries/delete/'.$id.'">Undo this</a>';
|
||||
|
||||
$this->Session->setFlash('Enquiry '.$enquiry['Enquiry']['title'].' has been undeleted. '.$undo);
|
||||
$this->redirect(array('action'=>'index'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -5,16 +5,18 @@
|
|||
|
||||
<?php if(isset($product)) {
|
||||
$form->input('product_id', array('type'=>'hidden', 'value'=>$product['Product']['id']));
|
||||
$title = $product['Product']['title'];
|
||||
}
|
||||
|
||||
elseif(isset($line_item)) {
|
||||
$form->input('line_item_id', array('type'=>'hidden', 'value'=>$line_item['LineItem']['id']));
|
||||
|
||||
$title = $line_tem['LineItem']['title'];
|
||||
print_r($line_item);
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
<?php __('Add Costing to');?>
|
||||
<h2>Add Costing to: <?=$title ?></h2>
|
||||
<fieldset>
|
||||
<legend>Quantity, Unit price, Packing costs</legend>
|
||||
<?php
|
||||
|
|
|
|||
|
|
@ -4,6 +4,11 @@
|
|||
|
||||
<?php echo $paginator->options(array('url' => $this->passedArgs)); ?>
|
||||
|
||||
<h4>Deleted Enquiries</h4>
|
||||
<div>
|
||||
<button id="show">Show</button>
|
||||
<button id="hide">Hide</button>
|
||||
</div>
|
||||
<?php
|
||||
echo $paginator->counter(array(
|
||||
'format' => __('Page %page% of %pages%, showing %current% Enquiries out of %count% total, starting on record %start%, ending on %end%', true)
|
||||
|
|
@ -11,7 +16,6 @@ echo $paginator->counter(array(
|
|||
?>
|
||||
|
||||
<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')); ?>
|
||||
|
|
@ -69,7 +73,7 @@ echo $paginator->counter(array(
|
|||
$class = ' class="requestforquote"';
|
||||
}
|
||||
?>
|
||||
<tr<?php echo $class; ?> id="row<?php echo $enquiry['Enquiry']['id']; ?>">
|
||||
<tr<?php echo $class; ?> id="row<?php echo $enquiry['Enquiry']['id']; ?>" data-archived="<?php echo $enquiry['Enquiry']['archived']; ?>">
|
||||
<?php
|
||||
$nameclass = null;
|
||||
if ($enquiry['Enquiry']['posted'] == 1) {
|
||||
|
|
@ -95,25 +99,6 @@ echo $paginator->counter(array(
|
|||
</td>
|
||||
|
||||
|
||||
<?php
|
||||
/* <td class="enqdate">
|
||||
|
||||
Change the date from MySQL DATETIME to a D M Y format
|
||||
if($enquiry['Enquiry']['submitted']) {
|
||||
echo date('j M Y',$time->toUnix($enquiry['Enquiry']['submitted']));
|
||||
}
|
||||
else {
|
||||
/* Maybe should make this so only the assigned user can mark it as submitted.
|
||||
|
||||
echo $html->link('Not Submitted', array('controller'=>'enquiries', 'action'=>'mark_submitted', $enquiry['Enquiry']['id']));
|
||||
}
|
||||
|
||||
</td>
|
||||
*/
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<td class="principlename">
|
||||
<?php
|
||||
if ($enquiry['Principle']['short_name']) {
|
||||
|
|
@ -170,6 +155,8 @@ echo $paginator->counter(array(
|
|||
<?php echo $html->link(__('View', true), array('controller' => 'enquiries', 'action' => 'view', $enquiry['Enquiry']['id'])); ?>
|
||||
<?php echo $html->link(__('Edit', true), array('controller' => 'enquiries', 'action' => 'edit', $enquiry['Enquiry']['id'])); ?>
|
||||
|
||||
<?php echo $html->link(__('Delete', true), array('controller' => 'enquiries', 'action' => 'delete', $enquiry['Enquiry']['id'])); ?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?php $i++; ?>
|
||||
|
|
|
|||
|
|
@ -46,73 +46,10 @@
|
|||
</div>
|
||||
|
||||
|
||||
<?php echo $javascript->link('product-model-number-builder'); ?>
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="modelNumberFormat">
|
||||
<h3>Model Number configuration</h3>
|
||||
<ul id="sortable">
|
||||
<?php foreach($options as $opt): ?>
|
||||
<li class="ui-state-default"><?php echo $opt['ProductOptionsCategory']['name']; ?></li>
|
||||
<li class="ui-state-default">-</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<button id="DoModelConfig">Click here to configure the model number builder</button>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="related">
|
||||
<h2>Option Categories for this Product</h2>
|
||||
<?php echo $html->link(__('Add new Option Category', true), array('controller'=>'ProductOptionsCategories', 'action'=>'add', $product['Product']['id'])); ?>
|
||||
<?php foreach($options as $opt): ?>
|
||||
<h3><?php echo $opt['ProductOptionsCategory']['name']; ?></h3><?php echo $html->image('edit_add.png');?>
|
||||
<table class="productoptions">
|
||||
<th><?php __('Model Number'); ?></th>
|
||||
<th><?php __('Name'); ?></th>
|
||||
<th class="actions">Actions</th>
|
||||
<?php
|
||||
if($opt['ProductOption']):
|
||||
foreach($opt['ProductOption'] as $option): ?>
|
||||
|
||||
|
||||
<?php
|
||||
if($option['default'] == '1') {
|
||||
echo '<tr class="defaultoption">';
|
||||
}
|
||||
else {
|
||||
echo '<tr>';
|
||||
}
|
||||
?>
|
||||
<td><?php echo $option['model_number'];?></td>
|
||||
<td><?php echo $option['title'];?></td>
|
||||
<td class="actions">
|
||||
<?php echo $html->link(__('View', true), array('controller' => 'product_options', 'action' => 'view', $option['id'])); ?>
|
||||
<?php echo $html->link(__('Edit', true), array('controller' => 'product_options', 'action' => 'edit', $option['id']));
|
||||
//if($option['default'] != '1') {
|
||||
// echo $html->link(__('Set as Default', true), array('controller' => 'product_options', 'action' => 'set_default', $option['id']));
|
||||
//}
|
||||
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<? endforeach;
|
||||
endif;
|
||||
?>
|
||||
</table>
|
||||
<?php echo $html->link(__('Add new '.$opt['ProductOptionsCategory']['name'].' option', true), array('controller'=>'ProductOptions', 'action'=>'add', $opt['ProductOptionsCategory']['id'])); ?>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="costingdiv"></div>
|
||||
|
||||
|
||||
<?php debug($product); ?>
|
||||
|
||||
<?php debug($options); ?>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
$(function() {
|
||||
|
||||
console.log("WOOT");
|
||||
var statusNamesJSON = $("#statusJSONlist").html();
|
||||
console.log(statusNamesJSON);
|
||||
|
||||
var statusNames = $.parseJSON(statusNamesJSON);
|
||||
|
||||
|
|
@ -36,4 +34,16 @@ $(function() {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
//Hide archived Enquiries
|
||||
$('*[data-archived="1"]').hide();
|
||||
|
||||
$("#show").click(function() {
|
||||
$('*[data-archived="1"]').show();
|
||||
});
|
||||
|
||||
$("#hide").click(function() {
|
||||
$('*[data-archived="1"]').hide(); //No DRY anywhere!
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue