Jobs deleting implented
This commit is contained in:
parent
7a9e1ef5d6
commit
20020655c0
|
|
@ -615,6 +615,44 @@ class JobsController extends AppController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function markDeleted($id) {
|
||||||
|
$this->layout = 'ajax';
|
||||||
|
|
||||||
|
if(!$id) {
|
||||||
|
echo "FAILURE";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->Job->read(null, $id);
|
||||||
|
$this->Job->set('deleted', true);
|
||||||
|
if($this->Job->save()) {
|
||||||
|
echo "SUCCESS";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "FAILURE";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function markUndeleted($id) {
|
||||||
|
$this->layout = 'ajax';
|
||||||
|
|
||||||
|
if(!$id) {
|
||||||
|
echo "FAILURE";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->Job->read(null, $id);
|
||||||
|
$this->Job->set('deleted', false);
|
||||||
|
if($this->Job->save()) {
|
||||||
|
echo "SUCCESS";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "FAILURE";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Need to fix the customer_id which hasn't been set for these 500odd records.
|
* Need to fix the customer_id which hasn't been set for these 500odd records.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,22 @@
|
||||||
<tr id="<?=$job['Job']['id']?>">
|
|
||||||
<td><button class="editButton">Edit</button></td>
|
<?
|
||||||
|
|
||||||
|
if($job['Job']['deleted'] == 1) {
|
||||||
|
$rowClass = 'deleted';
|
||||||
|
$button = '<button class="undeleteButton">Undelete</button>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$rowClass = '';
|
||||||
|
$button = '<button class="deleteButton">X</button>';
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr id="<?=$job['Job']['id']?>" class="<?=$rowClass?>">
|
||||||
|
<td>
|
||||||
|
<button class="editButton">Edit</button>
|
||||||
|
<?=$button?>
|
||||||
|
</td>
|
||||||
<td><?=$this->element('isEmptyDate', array('date'=>$job['Job']['date_order_received']));?></td>
|
<td><?=$this->element('isEmptyDate', array('date'=>$job['Job']['date_order_received']));?></td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
|
|
@ -23,15 +40,15 @@
|
||||||
<td><?
|
<td><?
|
||||||
$poString = '';
|
$poString = '';
|
||||||
foreach($job['PurchaseOrder'] as $po) {
|
foreach($job['PurchaseOrder'] as $po) {
|
||||||
$poString .= ' '.$html->link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));
|
$poString .= ' '.$html->link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));
|
||||||
}
|
}
|
||||||
echo $poString;
|
echo $poString;
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
<td class="nowrap"><?
|
<td class="nowrap"><?
|
||||||
foreach($job['PurchaseOrder'] as $po) {
|
foreach($job['PurchaseOrder'] as $po) {
|
||||||
echo $this->element('isEmptyDate', array('date'=>$po['issue_date']));
|
echo $this->element('isEmptyDate', array('date'=>$po['issue_date']));
|
||||||
echo "<br>";
|
echo "<br>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -42,8 +59,8 @@
|
||||||
|
|
||||||
<td> <?
|
<td> <?
|
||||||
foreach($job['PurchaseOrder'] as $po) {
|
foreach($job['PurchaseOrder'] as $po) {
|
||||||
echo $po['principle_reference'];
|
echo $po['principle_reference'];
|
||||||
echo "<br>";
|
echo "<br>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -100,5 +117,8 @@
|
||||||
</td>
|
</td>
|
||||||
<td> <?=$job['Job']['net_commissions'];?>
|
<td> <?=$job['Job']['net_commissions'];?>
|
||||||
</td>
|
</td>
|
||||||
<td><button class="editButton">Edit</button></td>
|
<td>
|
||||||
|
<button class="editButton">Edit</button>
|
||||||
|
<?=$button?>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
@ -12,6 +12,8 @@ echo $javascript->link('job_index');
|
||||||
<li><?=$html->link('Show only Unpaid', array('action'=>'index/1'));?></li>
|
<li><?=$html->link('Show only Unpaid', array('action'=>'index/1'));?></li>
|
||||||
<li><?=$html->link('Show only Unsent', array('action'=>'index/0/1'));?></li>
|
<li><?=$html->link('Show only Unsent', array('action'=>'index/0/1'));?></li>
|
||||||
<li><?=$html->link('Show only Unpaid & Unsent', array('action'=>'index/1/1'));?></li>
|
<li><?=$html->link('Show only Unpaid & Unsent', array('action'=>'index/1/1'));?></li>
|
||||||
|
<li><button id="showDeleted">Show Deleted Jobs</button>
|
||||||
|
<button id="hideDeleted">Hide Deleted Jobs</button></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -75,13 +77,26 @@ echo $paginator->counter(array(
|
||||||
<? //echo $form->create('Job', array('action'=>'ajax_edit', 'class'=>'job_table_form', 'default'=>false));
|
<? //echo $form->create('Job', array('action'=>'ajax_edit', 'class'=>'job_table_form', 'default'=>false));
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<? foreach($jobs as $job):?>
|
<? foreach($jobs as $job):
|
||||||
|
if($job['Job']['deleted'] == 1) {
|
||||||
|
$rowClass = 'deleted';
|
||||||
|
$button = '<button class="undeleteButton">Undelete</button>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$rowClass = '';
|
||||||
|
$button = '<button class="deleteButton">X</button>';
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<tr id="<?=$job['Job']['id']?>">
|
<tr id="<?=$job['Job']['id']?>" class="<?=$rowClass?>">
|
||||||
<td><button class="editButton">Edit</button></td>
|
|
||||||
<td>
|
<td>
|
||||||
<?=$this->element('isEmptyDate', array('date'=>$job['Job']['date_order_received']));?></td>
|
<button class="editButton">Edit</button>
|
||||||
|
<?=$button?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?=$this->element('isEmptyDate', array('date'=>$job['Job']['date_order_received']));?>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?=$this->element('booleanTick', array('bool'=>$job['Job']['all_paid'])); ?>
|
<?=$this->element('booleanTick', array('bool'=>$job['Job']['all_paid'])); ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -176,7 +191,10 @@ echo $paginator->counter(array(
|
||||||
</td>
|
</td>
|
||||||
<td> <?=$job['Job']['net_commissions'];?>
|
<td> <?=$job['Job']['net_commissions'];?>
|
||||||
</td>
|
</td>
|
||||||
<td><button class="editButton">Edit</button></td>
|
<td>
|
||||||
|
<button class="editButton">Edit</button>
|
||||||
|
<?=$button?>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<? endforeach;?>
|
<? endforeach;?>
|
||||||
|
|
|
||||||
0
views/jobs/mark_deleted.ctp
Normal file
0
views/jobs/mark_deleted.ctp
Normal file
0
views/jobs/mark_undeleted.ctp
Normal file
0
views/jobs/mark_undeleted.ctp
Normal file
|
|
@ -1420,6 +1420,10 @@ tr.cancelled td {
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tr.deleted td {
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
|
||||||
#reports h3 {
|
#reports h3 {
|
||||||
padding-top:0.5em;
|
padding-top:0.5em;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ $(function() {
|
||||||
// $(".editButton").show();
|
// $(".editButton").show();
|
||||||
|
|
||||||
|
|
||||||
|
$(".deleted").hide();
|
||||||
|
$("#hideDeleted").hide();
|
||||||
|
|
||||||
|
|
||||||
$(".editButton").live('click',function() {
|
$(".editButton").live('click',function() {
|
||||||
|
|
@ -24,6 +26,19 @@ $(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$("#showDeleted").click(function() {
|
||||||
|
$(".deleted").show();
|
||||||
|
$(this).hide();
|
||||||
|
$("#hideDeleted").show();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$("#hideDeleted").click(function() {
|
||||||
|
$(".deleted").hide();
|
||||||
|
$(this).hide();
|
||||||
|
$("#showDeleted").show();
|
||||||
|
});
|
||||||
|
|
||||||
$(".saveButton").live('click',function() {
|
$(".saveButton").live('click',function() {
|
||||||
var id = $(this).parents('tr').attr('id');
|
var id = $(this).parents('tr').attr('id');
|
||||||
var thisJobInputs = $('#'+id).find('input,select');
|
var thisJobInputs = $('#'+id).find('input,select');
|
||||||
|
|
@ -57,6 +72,18 @@ $(function() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$(".deleteButton").live('click', function() {
|
||||||
|
var id = $(this).parents('tr').attr('id');
|
||||||
|
markDeleted(id);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".undeleteButton").live('click', function() {
|
||||||
|
var id = $(this).parents('tr').attr('id');
|
||||||
|
markUndeleted(id);
|
||||||
|
})
|
||||||
|
|
||||||
//console.profileEnd();
|
//console.profileEnd();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -91,6 +118,19 @@ function cancelEditable(id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function markDeleted(id) {
|
||||||
|
$.get('/jobs/markDeleted/'+id,false, function(data) {
|
||||||
|
getViewable(id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function markUndeleted(id) {
|
||||||
|
$.get('/jobs/markUndeleted/'+id,false, function(data) {
|
||||||
|
getViewable(id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function getParent() {
|
function getParent() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue