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"> <?php
<div class="modal-dialog">
<div class="modal-content"> require_once '../../../includes/modal_header.php';
<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> $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); ?></strong></h5>
<button type="button" class="close text-white" data-dismiss="modal"> <button type="button" class="close text-white" data-dismiss="modal">
<span>&times;</span> <span>&times;</span>
</button> </button>
</div> </div>
<form action="post.php" method="post" autocomplete="off"> <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"> <div class="modal-body">
@@ -93,7 +104,7 @@
</div> </div>
</div> </div>
<?php if ($type_filter == 'product') { ?> <?php if ($type == 'product') { ?>
<div class="form-group"> <div class="form-group">
<label>Location</label> <label>Location</label>
<div class="input-group"> <div class="input-group">
@@ -127,7 +138,7 @@
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button> <button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
</div> </div>
</form> </form>
</div>
</div> <?php
</div> 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> <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="card-tools">
<div class="btn-group"> <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> <button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportProductsModal"> <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> <script src="../js/bulk_actions.js"></script>
<?php <?php
require_once "modals/product/product_add.php";
require_once "modals/product/product_export.php"; require_once "modals/product/product_export.php";
require_once "../includes/footer.php"; require_once "../includes/footer.php";