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.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -100,5 +117,8 @@
|
|||
</td>
|
||||
<td> <?=$job['Job']['net_commissions'];?>
|
||||
</td>
|
||||
<td><button class="editButton">Edit</button></td>
|
||||
<td>
|
||||
<button class="editButton">Edit</button>
|
||||
<?=$button?>
|
||||
</td>
|
||||
</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 Unsent', array('action'=>'index/0/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>
|
||||
</div>
|
||||
|
||||
|
|
@ -75,13 +77,26 @@ echo $paginator->counter(array(
|
|||
<? //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']?>">
|
||||
<td><button class="editButton">Edit</button></td>
|
||||
<tr id="<?=$job['Job']['id']?>" class="<?=$rowClass?>">
|
||||
<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>
|
||||
<?=$this->element('booleanTick', array('bool'=>$job['Job']['all_paid'])); ?>
|
||||
</td>
|
||||
|
|
@ -176,7 +191,10 @@ echo $paginator->counter(array(
|
|||
</td>
|
||||
<td> <?=$job['Job']['net_commissions'];?>
|
||||
</td>
|
||||
<td><button class="editButton">Edit</button></td>
|
||||
<td>
|
||||
<button class="editButton">Edit</button>
|
||||
<?=$button?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<? 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;
|
||||
}
|
||||
|
||||
tr.deleted td {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
#reports h3 {
|
||||
padding-top:0.5em;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ $(function() {
|
|||
// $(".editButton").show();
|
||||
|
||||
|
||||
$(".deleted").hide();
|
||||
$("#hideDeleted").hide();
|
||||
|
||||
|
||||
$(".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() {
|
||||
var id = $(this).parents('tr').attr('id');
|
||||
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();
|
||||
|
||||
});
|
||||
|
|
@ -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() {
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue