softDelete features
This commit is contained in:
@@ -158,6 +158,8 @@
|
||||
|
||||
<script>
|
||||
|
||||
const can_delete = ['admin', 'owner'].includes(user_role);
|
||||
|
||||
var status_badge = {
|
||||
'-1': '<span class="badge bg-secondary">Cancelled</span>',
|
||||
'0': '<span class="badge bg-warning text-dark">Draft</span>',
|
||||
@@ -224,6 +226,7 @@
|
||||
<a href="<?php echo $server_url?>revenue/manage_quotation.php?id=${q.id}" title="View">
|
||||
<i class="ti ti-eye fs-5"></i>
|
||||
</a>
|
||||
${can_delete ? `<a href="javascript:void(0);" class="link-danger ms-2" title="Delete" onclick="delete_quotation(${q.id})"><i class="ti ti-trash fs-5"></i></a>` : ''}
|
||||
</td>
|
||||
</tr>`;
|
||||
});
|
||||
@@ -231,6 +234,24 @@
|
||||
$('table#quotation_list tbody').html(body);
|
||||
}
|
||||
|
||||
function delete_quotation(id) {
|
||||
bootbox.confirm({
|
||||
message: 'Delete this quotation? This cannot be undone.',
|
||||
buttons: { confirm: { label: 'Delete', className: 'btn-danger' }, cancel: { label: 'Back', className: 'btn-secondary' } },
|
||||
callback: function(result) {
|
||||
if (!result) return;
|
||||
ajax_request({
|
||||
url: '<?php echo $server_url?>revenue/api/engine/delete_quotation.php',
|
||||
autoPrepare: false,
|
||||
checkRequired: 0,
|
||||
action: 'delete',
|
||||
data: { id: id },
|
||||
onSuccess: function() { retrieve_quotations(); }
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(async function() {
|
||||
await load_dept_cache();
|
||||
populate_dept_filter('filter_dept');
|
||||
|
||||
Reference in New Issue
Block a user