Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kamranzafar4343 committed Sep 19, 2024
1 parent 330f4ed commit f73cfd2
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 49 deletions.
11 changes: 1 addition & 10 deletions box.php
Original file line number Diff line number Diff line change
Expand Up @@ -525,16 +525,7 @@
<div class="cardBranch recent-sales overflow-auto">
<div class="card-body">
<h5 class="card-title">List of Boxes</h5>
<div class="datatable-wrapper datatable-loading no-footer sortable searchable fixed-columns"><div class="datatable-top">
<div class="datatable-dropdown">
<label>
<select class="datatable-selector" name="per-page"><option value="5">5</option><option value="10" selected="">10</option><option value="15">15</option><option value="-1">All</option></select> entries per page
</label>
</div>
<div class="datatable-search">
<input class="datatable-input" placeholder="Search..." type="search" name="search" title="Search within table">
</div>
</div>

<?php
if ($result->num_rows > 0) {
echo '<table class="table datatable mt-4" style="table-layout: fixed;">
Expand Down
64 changes: 42 additions & 22 deletions createBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
$adminEmail = $row2['email'];
}

//show default receive via value
$pre_val_receive_via = isset($_POST['rec_via']) ? $_POST['rec_via'] : 'default text';


if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$company_id = mysqli_real_escape_string($conn, $_POST['company']);
$branch_id = mysqli_real_escape_string($conn, $_POST['branch']);
Expand Down Expand Up @@ -51,6 +55,7 @@
}

$conn->close();

}

?>
Expand Down Expand Up @@ -409,13 +414,13 @@
</li><!-- End Contact Page Nav -->

</ul>

</aside>


<!-- ---------------------------------------------------End Sidebar--------------------------------------------------->


<!--form--------------------------------------form--------------------------------------->
<div class="headerimg text-center">
<img src="image/create.png" alt="network-logo" width="50" height="50">
Expand All @@ -429,15 +434,24 @@
<br>
<!-- Multi Columns Form -->
<form class="row g-3 needs-validation" action="" method="POST">


<div class="col-md-6">
<label class="form-label">Barcode</label>
<input type="text" class="form-control" name="barcode" id="box_barcode" pattern="[a-zA-Z0-9]{7}"
title="Input must be exactly 7 characters long and contain letters and digits only." autofocus>
<div id="barcodeFeedback" class="invalid-feedback" >
<!-- Error message will be displayed here -->
</div>
</div>

<div class="col-md-6">
<label for="company">Select Company:</label>
<select id="company" class="form-select" name="company" required>
<option value=""> Select a Company </option>

<?php

//fetch companies
//fetch companies
$result = $conn->query("SELECT comp_id, comp_name FROM compani");
while ($row = $result->fetch_assoc()) {
echo "<option value='{$row['comp_id']}'>{$row['comp_name']}</option>";
Expand All @@ -456,34 +470,26 @@

<div class="col-md-6">
<label for="rec_date">Receive date</label>
<input type="datetime-local" class="form-control" name="rec_date" required>
<input type="datetime-local" class="form-control" name="rec_date" id="rec_date" required>
</div>
<div class="col-md-6">
<label for="sender">Sender</label>
<input type="text" class="form-control" name="sender">
<input type="text" class="form-control" name="sender" id="sender">
</div>

<div class="col-md-6">
<label for="rec_via">Receive via</label>
<input type="text" class="form-control" name="rec_via" required>
<input type="text" class="form-control" name="rec_via" id="rec_via" value="<?= htmlspecialchars($pre_val_receive_via);?>" required>
</div>

<div class="col-md-6">
<label class="form-label">Barcode</label>
<input type="text" class="form-control" name="barcode" id="box_barcode" pattern="[a-zA-Z0-9]{7}"
title="Input must be exactly 7 characters long and contain letters and digits only.">
<div id="barcodeFeedback" class="invalid-feedback">
<!-- Error message will be displayed here -->
</div>
</div>

<div class="col-md-6">
<label for="status">Status:</label>
<select id="status" class="form-select" name="status" required>
<option value="">Select Status</option>
<option value="In">In</option>
<option value="Out">Out</option>
<option value="Ready for Destroy">Ready for Destroy</option>
<option value="In" selected>In</option>
<!-- <option value="Out">Out</option>
<option value="Ready for Destroy">Ready for Destroy</option> -->
</select>
</div>

Expand Down Expand Up @@ -531,6 +537,8 @@
const companySelect = document.getElementById('company');
const branchSelect = document.getElementById('branch');
const boxSelect = document.getElementById('box');
const senderSelect = document.getElementById('sender');


// Retrieve the previously selected company from localStorage
const selectedCompany = localStorage.getItem('selectedCompany');
Expand Down Expand Up @@ -568,6 +576,18 @@
localStorage.setItem('selectedBox', this.value);
});

// Retrieve the previously selected sender from localStorage
const selectedSender = localStorage.getItem('selectedSender');
if (selectedSender) {
senderSelect.value = selectedSender;
}

// Store the selected box in localStorage on change
senderSelect.addEventListener('change', function() {
localStorage.setItem('selectedSender', this.value);
});


// Function to load branches via AJAX
function loadBranches(company_id) {
$.ajax({
Expand Down
2 changes: 1 addition & 1 deletion default value/new.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
// Simulate the previously selected value (from database or after form submission)
// Simulate the previously selected dropdown value (from database or after form submission)
$previous_value = isset($_POST['my_select']) ? $_POST['my_select'] : 'default_value';
$previous_value2 = isset($_POST['my_select2']) ? $_POST['my_select2'] : 'default_value';
?>
Expand Down
24 changes: 8 additions & 16 deletions showItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,23 +373,22 @@
}

.datatable-input {
padding: 4px 10px !important;
width: 255px !important;
height: 33px;

width: 240px;
height: 35px;
font-size: 0.8rem;
margin-left: 6px;
margin-left: 401px;
outline: none;
width: 148% !important;
max-width: 414px;
padding: 21px 23px !important;



font-size: 17px;
border: 1px solid #ccc;
border-radius: 6px;
outline: none;
transition: all 0.3s ease;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
margin-bottom: 14px;
margin-top: 8px !important;
margin-bottom: -25px;
}

/* .custom-header-col-name{
Expand Down Expand Up @@ -599,29 +598,22 @@
</tr>
</thead>
<tbody style="table-layout: fixed;">



<?php

//counter variable
$counter = 1;
while ($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<tr>";
echo "<td>" . $counter++ . "</td>";


//get specific box id
$box_id = $row['box_FK_item'];

echo "<td>" . ($row["barcode"]) . "</td>";
echo "<td>" . ($row["timestamp"]) . "</td>";

echo "<td>" . '<img class="barcode" alt="' . ($row["item_id"]) . '" src="barcode.php?text=' . urlencode($row["item_id"]) . '&codetype=code128&orientation=horizontal&size=20&print=false"/>' . "</td>";

?>

<td>
<div style="display: flex; gap: 10px;">
<a type="button" class="btn btn-success btn-info d-flex justify-content-center" style="width:25px; height: 28px;" href="itemUpdate.php?id=<?php echo $row['item_id']; ?>"><i style="width: 20px;" class="fa-solid fa-pen-to-square"></i></a>
Expand Down

0 comments on commit f73cfd2

Please sign in to comment.