Added shipments delete
This commit is contained in:
parent
24eaa4c0cd
commit
573971310d
|
|
@ -236,15 +236,14 @@ class ShipmentsController extends AppController {
|
|||
|
||||
|
||||
|
||||
function delete($id = null) {
|
||||
if (!$id) {
|
||||
$this->Session->setFlash(__('Invalid id for Shipment', true));
|
||||
$this->redirect(array('action'=>'index'));
|
||||
}
|
||||
if ($this->Shipment->del($id)) {
|
||||
$this->Session->setFlash(__('Shipment deleted', true));
|
||||
$this->redirect(array('action'=>'index'));
|
||||
}
|
||||
function delete($id = null) {
|
||||
$this->layout = 'ajax';
|
||||
if ($this->Shipment->del($id)) {
|
||||
return "Deleted"; // This should be returning status codes
|
||||
}
|
||||
else {
|
||||
return "Fail"; //All over the app.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@
|
|||
<tr>
|
||||
<td class="actions">
|
||||
<button id="<?=$shipment['Shipment']['id']?>" class="editButton">Edit</button>
|
||||
|
||||
<button class="deleteButton">Delete</button>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
|
|
|
|||
0
app/views/shipments/delete.ctp
Normal file
0
app/views/shipments/delete.ctp
Normal file
|
|
@ -1677,3 +1677,8 @@ ul.document-buttons {
|
|||
ul.document-buttons li {
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
.deleteButton {
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,8 @@ $(function() {
|
|||
|
||||
|
||||
$( ".newShipment" ).button().click(function() {
|
||||
$.get('/shipments/add/', false, function(data) {
|
||||
|
||||
$.get('/shipments/add/', false, function(data) {
|
||||
|
||||
$("#add-form").html(data);
|
||||
$( "#add-form" ).dialog( "open" );
|
||||
|
|
@ -79,19 +80,26 @@ $(function() {
|
|||
|
||||
$(".editButton").button().click(function() {
|
||||
|
||||
var id = $(this).attr('id');
|
||||
|
||||
$.get('/shipments/edit/'+id, false, function(data) {
|
||||
|
||||
$("#edit-form").html(data);
|
||||
$( "#edit-form" ).dialog( "open" );
|
||||
} );
|
||||
|
||||
var id = $(this).attr('id');
|
||||
$.get('/shipments/edit/'+id, false, function(data) {
|
||||
|
||||
$("#edit-form").html(data);
|
||||
$( "#edit-form" ).dialog( "open" );
|
||||
} );
|
||||
});
|
||||
|
||||
|
||||
$(".deleteButton").click(function() {
|
||||
var id = $(this).prev().attr('id');
|
||||
var confirmed = confirm("Permanently delete this shipment?");
|
||||
|
||||
if(confirmed) {
|
||||
$.get('/shipments/delete/'+id, false, function() {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue