Added dialog for delete

这个提交包含在:
Andreas 2023-08-03 13:24:05 +02:00
父节点 126d781baa
当前提交 bf858f31de
共有 2 个文件被更改,包括 41 次插入3 次删除

查看文件

@ -47,7 +47,7 @@
<tbody> <tbody>
<?php <?php
foreach($papertypes as $paper) { ?> foreach($papertypes as $paper) { ?>
<tr class='label_<?php echo $paper->paper_id ?>'> <tr class='paper_<?php echo $paper->paper_id ?>'>
<td><?php echo $paper->paper_name; ?></td> <td><?php echo $paper->paper_name; ?></td>
<td><?php echo $paper->metric; ?></td> <td><?php echo $paper->metric; ?></td>
<td><?php echo $paper->width; ?></td> <td><?php echo $paper->width; ?></td>
@ -55,7 +55,7 @@
<td><?php echo $paper->lbl_cnt ?? '0' ?></td> <td><?php echo $paper->lbl_cnt ?? '0' ?></td>
<td><?php echo $paper->orientation == 'P' ? 'Portrait': 'Landscape'; ?></td> <td><?php echo $paper->orientation == 'P' ? 'Portrait': 'Landscape'; ?></td>
<td><a href="<?php echo site_url('labels/editpaper/' . $paper->paper_id); ?>" class="btn btn-outline-primary btn-sm"><i class="fas fa-edit"></i></a></td> <td><a href="<?php echo site_url('labels/editpaper/' . $paper->paper_id); ?>" class="btn btn-outline-primary btn-sm"><i class="fas fa-edit"></i></a></td>
<td><a href="<?php echo site_url('labels/deletepaper/' . $paper->paper_id); ?>" class="btn btn-outline-danger btn-sm"><i class="fas fa-trash-alt"></i></a></td> <td><a href="javascript:deletepaper(<?php echo $paper->paper_id; ?>);" class="btn btn-outline-danger btn-sm"><i class="fas fa-trash-alt"></i></a></td>
</tr> </tr>
<?php } <?php }
@ -97,7 +97,7 @@
<td><input type="checkbox" <?php if ($label->useforprint == 1) {echo 'checked';}?>></td> <td><input type="checkbox" <?php if ($label->useforprint == 1) {echo 'checked';}?>></td>
<?php } ?> <?php } ?>
<td><a href="<?php echo site_url('labels/edit/' . $label->id); ?>" class="btn btn-outline-primary btn-sm"><i class="fas fa-edit"></i></a></td> <td><a href="<?php echo site_url('labels/edit/' . $label->id); ?>" class="btn btn-outline-primary btn-sm"><i class="fas fa-edit"></i></a></td>
<td><a href="<?php echo site_url('labels/delete/' . $label->id); ?>" class="btn btn-outline-danger btn-sm"><i class="fas fa-trash-alt"></i></a></td> <td><a href="javascript:deletelabel(<?php echo $label->id; ?>);" class="btn btn-outline-danger btn-sm"><i class="fas fa-trash-alt"></i></a></td>
</tr> </tr>
<?php } <?php }

查看文件

@ -39,3 +39,41 @@ function printat(stationid) {
} }
}); });
} }
function deletelabel(id) {
BootstrapDialog.confirm({
title: 'DANGER',
message: 'Warning! Are you sure you want this label?',
type: BootstrapDialog.TYPE_DANGER,
closable: true,
draggable: true,
btnOKClass: 'btn-danger',
callback: function(result) {
if (result) {
window.location.replace(base_url + 'index.php/labels/delete/'+id);
}
}
});
}
function deletepaper(id) {
var message = 'Warning! Are you sure you want delete this paper type?';
var currentRow = $(".paper_"+id).first().closest('tr');
var inuse = currentRow.find("td:eq(4)").text();
if (inuse > 0) {
message = 'Warning! This paper type is in use. Are you really sure you want delete this paper type?';
}
BootstrapDialog.confirm({
title: 'DANGER',
message: message,
type: BootstrapDialog.TYPE_DANGER,
closable: true,
draggable: true,
btnOKClass: 'btn-danger',
callback: function(result) {
if (result) {
window.location.replace(base_url + 'index.php/labels/deletePaper/'+id);
}
}
});
}