Error Message for no qrcodes selected.
This commit is contained in:
@@ -20,6 +20,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
$files = [];
|
$files = [];
|
||||||
$type = filter_var($json['type'], FILTER_SANITIZE_STRING);
|
$type = filter_var($json['type'], FILTER_SANITIZE_STRING);
|
||||||
|
|
||||||
|
if (count($params) == 0) {
|
||||||
|
echo json_encode([
|
||||||
|
'data' => 'No qrcodes were selected.',
|
||||||
|
'status' => 400
|
||||||
|
]);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($params as $param) {
|
foreach ($params as $param) {
|
||||||
$row = $db->where('id', $param);
|
$row = $db->where('id', $param);
|
||||||
$row = $db->getOne("{$type}_qrcodes");
|
$row = $db->getOne("{$type}_qrcodes");
|
||||||
|
|||||||
Vendored
+4
@@ -10,4 +10,8 @@
|
|||||||
|
|
||||||
.bulk-action-wrapper {
|
.bulk-action-wrapper {
|
||||||
padding: 10px 0;
|
padding: 10px 0;
|
||||||
|
}
|
||||||
|
#err-msg {
|
||||||
|
display: none;
|
||||||
|
color: red;
|
||||||
}
|
}
|
||||||
Vendored
+10
@@ -467,9 +467,19 @@
|
|||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.status == 200) {
|
if (res.status == 200) {
|
||||||
window.location.href = res.data;
|
window.location.href = res.data;
|
||||||
|
$('#err-msg').css('display', 'none');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.status == 400) {
|
||||||
|
$('#err-msg').empty();
|
||||||
|
$('#err-msg').append('<i class="fas fa-exclamation-circle"></i> ' + res.data);
|
||||||
|
$('#err-msg').css('display', 'block');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: (err) => {
|
error: (err) => {
|
||||||
|
$('#err-msg').empty();
|
||||||
|
$('#err-msg').append('<i class="fas fa-exclamation-circle"></i> ' + res.data);
|
||||||
|
$('#err-msg').css('display', 'block');
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
<div id="err-msg"></div>
|
||||||
<div class="bulk-action-wrapper">
|
<div class="bulk-action-wrapper">
|
||||||
<form id="bulk-action" action="/bulk_action.php" method="POST">
|
<form id="bulk-action" action="/bulk_action.php" method="POST">
|
||||||
<button type="submit" class="btn btn-primary">Bulk Action</button>
|
<button type="submit" class="btn btn-primary">Bulk Action</button>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
<div id="err-msg"></div>
|
||||||
<div class="bulk-action-wrapper">
|
<div class="bulk-action-wrapper">
|
||||||
<form id="bulk-action" action="/bulk_action.php" method="POST">
|
<form id="bulk-action" action="/bulk_action.php" method="POST">
|
||||||
<button type="submit" class="btn btn-primary">Bulk Action</button>
|
<button type="submit" class="btn btn-primary">Bulk Action</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user