added admin role to button export
This commit is contained in:
parent
3da8ff81c9
commit
5d6302fa9c
@ -559,7 +559,11 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
<?php foreach ($importedData as $index => $row): ?>
|
||||
<div class="grid-row" data-id="<?= $row['iddatadb'] ?>">
|
||||
<div class="grid-cell button-cell" style="flex: 0 0 210px; position: relative;">
|
||||
<button type="button" class="export-lims-btn action-btn" data-row="<?= $index ?>" data-iddatadb="<?= $row['iddatadb'] ?>" title="Export to LIMS" style="background: #eb0b0bff; color: white; border: none; border-radius: 5px; cursor: pointer;"><i class="fas fa-upload"></i></button>
|
||||
<!-- commented only for admin roles -->
|
||||
<?php if ((Auth::user()->hasRole('Admin'))) : ?>
|
||||
<button type="button" class="export-lims-btn action-btn" data-row="<?= $index ?>" data-iddatadb="<?= $row['iddatadb'] ?>" title="Export to LIMS" style="background: #eb0b0bff; color: white; border: none; border-radius: 5px; cursor: pointer;"><i class="fas fa-upload"></i></button>
|
||||
<?php endif; ?>
|
||||
|
||||
<button type="button" class="save-btn action-btn" data-row="<?= $index ?>" title="Save" style="background: #28a745; color: white; border: none; border-radius: 5px; cursor: pointer;"><i class="fas fa-save"></i></button>
|
||||
<button type="button" class="photos-btn action-btn" data-row="<?= $index ?>" data-iddatadb="<?= $row['iddatadb'] ?>" title="Photos" style="background: #007bff; color: white; border: none; border-radius: 5px; cursor: pointer;"><i class="fas fa-camera"></i></button>
|
||||
<button type="button" class="parts-btn action-btn" data-row="<?= $index ?>" data-iddatadb="<?= $row['iddatadb'] ?>" title="Parts" style="background: #ffc107; color: white; border: none; border-radius: 5px; cursor: pointer;"><i class="fas fa-puzzle-piece"></i></button>
|
||||
@ -709,27 +713,28 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
<script src="parts.js"></script>
|
||||
<script src="tracking.js"></script>
|
||||
<script>
|
||||
|
||||
$(document).on("click", ".export-lims-btn", function () {
|
||||
$(document).on("click", ".export-lims-btn", function() {
|
||||
let rowId = $(this).data("row");
|
||||
let idDataDb = $(this).data("iddatadb");
|
||||
|
||||
$.ajax({
|
||||
url: "export_to_lims.php",
|
||||
method: "POST",
|
||||
data: { iddatadb: idDataDb },
|
||||
data: {
|
||||
iddatadb: idDataDb
|
||||
},
|
||||
dataType: "json",
|
||||
beforeSend: function () {
|
||||
beforeSend: function() {
|
||||
alert("Export started in background for row " + rowId);
|
||||
},
|
||||
success: function (response) {
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
alert(response.message);
|
||||
} else {
|
||||
alert("❌ Error: " + response.message);
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
error: function(xhr, status, error) {
|
||||
alert("❌ AJAX error: " + error);
|
||||
}
|
||||
});
|
||||
@ -1094,4 +1099,4 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user