Migrated product add to the new ajax-modal

This commit is contained in:
johnnyq
2025-11-02 23:20:42 -05:00
parent c12bfb157e
commit 31d3659098
2 changed files with 140 additions and 132 deletions

View File

@@ -1,14 +1,25 @@
<div class="modal" id="addProductModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<?php
require_once '../../../includes/modal_header.php';
$type = nullable_htmlentities($_GET['type'] ?? '');
if ($type == 'product') {
$type_icon = "fa-box-open";
} else {
$type_icon = "fa-wrench";
}
ob_start();
?>
<div class="modal-header bg-dark">
<h5 class="modal-title"><i class="fas fa-fw <?= $type_icon ?> mr-2"></i>New <strong><?= ucwords($type_filter); ?></strong></h5>
<h5 class="modal-title"><i class="fas fa-fw <?= $type_icon ?> mr-2"></i>New <strong><?= ucwords($type); ?></strong></h5>
<button type="button" class="close text-white" data-dismiss="modal">
<span>&times;</span>
</button>
</div>
<form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="type" value="<?= $type_filter ?>">
<input type="hidden" name="type" value="<?= $type ?>">
<div class="modal-body">
@@ -93,7 +104,7 @@
</div>
</div>
<?php if ($type_filter == 'product') { ?>
<?php if ($type == 'product') { ?>
<div class="form-group">
<label>Location</label>
<div class="input-group">
@@ -128,6 +139,6 @@
</div>
</form>
</div>
</div>
</div>
<?php
require_once '../../../includes/modal_footer.php';

View File

@@ -60,7 +60,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<h3 class="card-title mt-2"><i class="fas fa-fw <?= $type_icon ?> mr-2"></i><?= $type_display ?></h3>
<div class="card-tools">
<div class="btn-group">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addProductModal"><i class="fas fa-plus mr-2"></i>New <strong><?= ucwords($type_filter); ?></strong></button>
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/product/product_add.php?type=<?= $type_filter ?>"><i class="fas fa-plus mr-2"></i>New <strong><?= ucwords($type_filter); ?></strong></button>
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
<div class="dropdown-menu">
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportProductsModal">
@@ -324,8 +324,5 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<script src="../js/bulk_actions.js"></script>
<?php
require_once "modals/product/product_add.php";
require_once "modals/product/product_export.php";
require_once "../includes/footer.php";