Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit 4aab7d6

Browse files
committed
Error Message for no qrcodes selected.
1 parent dac89ba commit 4aab7d6

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

qrcode/bulk_action.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
$files = [];
2121
$type = filter_var($json['type'], FILTER_SANITIZE_STRING);
2222

23+
if (count($params) == 0) {
24+
echo json_encode([
25+
'data' => 'No qrcodes were selected.',
26+
'status' => 400
27+
]);
28+
exit();
29+
}
30+
2331
foreach ($params as $param) {
2432
$row = $db->where('id', $param);
2533
$row = $db->getOne("{$type}_qrcodes");

qrcode/dist/css/custom.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@
1010

1111
.bulk-action-wrapper {
1212
padding: 10px 0;
13+
}
14+
#err-msg {
15+
display: none;
16+
color: red;
1317
}

qrcode/dist/js/custom.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,9 +467,19 @@
467467
success: (res) => {
468468
if (res.status == 200) {
469469
window.location.href = res.data;
470+
$('#err-msg').css('display', 'none');
471+
}
472+
473+
if (res.status == 400) {
474+
$('#err-msg').empty();
475+
$('#err-msg').append('<i class="fas fa-exclamation-circle"></i> ' + res.data);
476+
$('#err-msg').css('display', 'block');
470477
}
471478
},
472479
error: (err) => {
480+
$('#err-msg').empty();
481+
$('#err-msg').append('<i class="fas fa-exclamation-circle"></i> ' + res.data);
482+
$('#err-msg').css('display', 'block');
473483
console.log(err);
474484
}
475485
});

qrcode/forms/dynamic_table.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<div class="row">
22
<div class="col-12">
3+
<div id="err-msg"></div>
34
<div class="bulk-action-wrapper">
45
<form id="bulk-action" action="/bulk_action.php" method="POST">
56
<button type="submit" class="btn btn-primary">Bulk Action</button>

qrcode/forms/static_table.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<div class="row">
22
<div class="col-12">
3+
<div id="err-msg"></div>
34
<div class="bulk-action-wrapper">
45
<form id="bulk-action" action="/bulk_action.php" method="POST">
56
<button type="submit" class="btn btn-primary">Bulk Action</button>

0 commit comments

Comments
 (0)