Skip to content

Commit

Permalink
refactor: "improved overall commenting"
Browse files Browse the repository at this point in the history
  • Loading branch information
kamranzafar4343 committed Sep 11, 2024
1 parent 2b7a67a commit bd32e81
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 166 deletions.
24 changes: 7 additions & 17 deletions Branches.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@

$email = $_SESSION['email'];
//get user name and email from register table
$getAdminData = "SELECT * FROM register WHERE email = '$email'";
$resultData = mysqli_query($conn, $getAdminData);
if($resultData ->num_rows > 0){
$row2= $resultData->fetch_assoc();
$adminName= $row2['name'];
$adminEmail=$row2['email'];
}
$getAdminData = "SELECT * FROM register WHERE email = '$email'";
$resultData = mysqli_query($conn, $getAdminData);
if ($resultData->num_rows > 0) {
$row2 = $resultData->fetch_assoc();
$adminName = $row2['name'];
$adminEmail = $row2['email'];
}

// Get company ID from query string
$company_id = isset($_GET['id']) ? intval($_GET['id']) : 0;
Expand Down Expand Up @@ -439,16 +439,6 @@
</li>
<!-- End Profile Page Nav -->



<!-- <li class="nav-item">
<a class="nav-link collapsed" href="pages-register.php">
<i class="bi bi-card-list"></i>
<span>Register</span>
</a>
</li> -->
<!-- End Register Page Nav -->

<li class="nav-item">
<a class="nav-link collapsed" href="pages-login.php">
<i class="bi bi-box-arrow-in-right"></i>
Expand Down
5 changes: 1 addition & 4 deletions Companies.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,7 @@
echo "<td >" . "<img src='" . $row['image'] . "' alt='Profile Image' width='70' height=''>" . "</td> ";
echo "<td >" . htmlspecialchars($row["phone"]) . "</td> ";
echo "<td >" . htmlspecialchars($row["email"]) . "</td>";
// echo "<td>" . htmlspecialchars($row["password"]) . "</td>";
// echo "<td><button type='button' class='btn btn-light view-password' data-id='" . htmlspecialchars($row['comp_id']) . "'><i class='fa fa-eye'></i></button></td>";
echo "<td >" . htmlspecialchars($row["city"]) . "</td>";
// echo "<td>" . htmlspecialchars($row["state"]) . "</td>";
echo "<td >" . htmlspecialchars($row["city"]) . "</td>";
echo "<td >" . htmlspecialchars($row["country"]) . "</td>";
echo "<td>" . htmlspecialchars($row["registration"]) . "</td>";
echo "<td >" . htmlspecialchars($row["expiry"]) . "</td>";
Expand Down
18 changes: 0 additions & 18 deletions CompanyInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,19 +416,8 @@

<main id="main" class="main">
<div class="headerbox">
<!-- <div class="pagetitle">
<h1 class="mb-1 mt-4">Companies</h1>
<div>
<nav class="mt-0">
<ol class="breadcrumb mt-0">
<li class="breadcrumb-item">Company</li>
<li class="breadcrumb-item active">Details</li>
</ol>
</nav>
</div> -->
</div><!-- End Page Title -->
<div class="pagetitleinside mt-1">
<!-- <button type="button" onclick="window.location.href = 'createBranch.php';" class="btn btn-outline-primary mb-3">Add Branch</button> -->
</div>
</div>

Expand Down Expand Up @@ -485,13 +474,6 @@
<li class="list-group-item" style="text-align: right; width: 55%;"><?php echo $company_data['country']; ?></li>
</ul>

<!-- <ul class="list-group list-group-horizontal-lg">
<li class="list-group-item">Branches</li>
<li class="list-group-item">An item</li>
</ul> -->
<!-- <div class="card-footer" style="background: inherit; border-color: inherit;">
<a href="#" class="btn btn-outline-primary">Branches</a>
</div> -->
</div>
</div>
</div>
Expand Down
63 changes: 14 additions & 49 deletions box.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,6 @@
}

$result = $conn->query($sql);

// $sql2 = "Select * from compani where comp_id= $companiID_FK";
// $result2 = $conn->query($sql2);
// $comp_name = "";
// if ($result2->num_rows > 0) {
// $row2 = $result2->fetch_assoc();
// $comp_name = $row2['comp_name'];
// }

?>

<!DOCTYPE html>
Expand Down Expand Up @@ -276,7 +267,7 @@
box-shadow: 0px 0 30px rgba(1, 41, 112, 0.1);
background-color: white;
font-size: 0.8rem;

}

.company-name:active {
Expand All @@ -302,12 +293,6 @@
padding-right: 34px;
padding-left: 40px;
margin-left: 20px;

/* table-layout: fixed; */

/* overflow: hidden; */
/* text-overflow: ellipsis; */
/* white-space: nowrap; */
}

tbody,
Expand Down Expand Up @@ -365,10 +350,6 @@
.datatable-bottom {
width: 122%;
}

/* .custom-header-col-name{
margin-right: 1000px;
} */
</style>

<!-- Template Main CSS File -->
Expand Down Expand Up @@ -542,42 +523,32 @@
<div class="cardBranch recent-sales overflow-auto">
<div class="card-body">
<h5 class="card-title">List of Boxes</h5>
<!-- <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) {
?>
<table class="table table-borderless datatable mt-4" style="table-layout: fixed;">
<thead>
<tr>

<!-- <th scope="col">Comp name</th> -->
<th scope="col" style="width: 25%;">Box name</th>
<th scope="col" style="width: 30%;">Created at</th>
<th scope="col" style="width: 35%;">Barcode</th>
<th scope="col" style="width:8%;">#</th>
<th scope="col" style="width: 20%;">Box name</th>
<th scope="col" style="width: 20%;">Created at</th>
<th scope="col" style="width: 30%;">Barcode</th>
<th scope="col" style="width: 10%;">Action</th>
</tr>
</thead>
<tbody style="table-layout: fixed;">

<?php

//counter variable
$counter = 1;

while ($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<tr>";
// echo "<td>" . $comp_name . "</td>";
echo "<td>" . $counter++ . "</td>";
?>
<td>
<?php echo $row['box_name']; ?>
Expand All @@ -589,29 +560,22 @@
<td>

<div style="display: flex; gap: 10px;">

<!-- <a type="button" class="btn btn-success d-flex justify-content-center " style="width:25px; height: 28px;" href="branchUpdate.php?id=<?php echo $row['box_id']; ?>"><i style="width: 20px;" class="ri-shopping-cart-2-line"></i></a> -->
<a type="button" class="btn btn-success btn-info d-flex justify-content-center " style="width:25px; height: 28px;" href="boxUpdate.php?id=<?php echo $row['box_id']; ?>"><i style="width: 20px;" class="fa-solid fa-pen-to-square"></i></a>

<a type="button" class="btn btn-danger btn-floating d-flex justify-content-center" style="width:25px; height:28px" data-mdb-ripple-init
onclick="return confirm('Are you sure you want to delete this record?');" href="boxDelete.php?id=<?php echo $row['box_id']; ?>"> <i style="width: 20px;" class="fa-solid fa-trash"></i></a>

</div>

</td>
</tr>
<?php
}
?>

</tbody>
</table>
<?php
}
?>

</div>

</div>
</div>

Expand All @@ -635,8 +599,9 @@

<!-- Template Main JS File -->
<script src="assets/js/main.js"></script>
<script>
// Listen for the Enter key press

<script>
// event listener for search bar
document.getElementById("searchInput").addEventListener("keypress", function(event) {
if (event.key === "Enter") {
event.preventDefault(); // Prevent default form submission
Expand Down
25 changes: 7 additions & 18 deletions boxUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@

$email = $_SESSION['email'];
//get user name and email from register table
$getAdminData = "SELECT * FROM register WHERE email = '$email'";
$resultData = mysqli_query($conn, $getAdminData);
if($resultData ->num_rows > 0){
$row2= $resultData->fetch_assoc();
$adminName= $row2['name'];
$adminEmail=$row2['email'];
}
$getAdminData = "SELECT * FROM register WHERE email = '$email'";
$resultData = mysqli_query($conn, $getAdminData);
if ($resultData->num_rows > 0) {
$row2 = $resultData->fetch_assoc();
$adminName = $row2['name'];
$adminEmail = $row2['email'];
}

// show box previous data
if (isset($_GET['id'])) {
Expand Down Expand Up @@ -603,17 +603,6 @@
<span>Profile</span>
</a>
</li>
<!-- End Profile Page Nav -->



<!-- <li class="nav-item">
<a class="nav-link collapsed" href="pages-register.php">
<i class="bi bi-card-list"></i>
<span>Register</span>
</a>
</li> -->
<!-- End Register Page Nav -->

<li class="nav-item">
<a class="nav-link collapsed" href="pages-login.php">
Expand Down
16 changes: 8 additions & 8 deletions branchUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@

$email = $_SESSION['email'];
//get user name and email from register table
$getAdminData = "SELECT * FROM register WHERE email = '$email'";
$resultData = mysqli_query($conn, $getAdminData);
if($resultData ->num_rows > 0){
$row2= $resultData->fetch_assoc();
$adminName= $row2['name'];
$adminEmail=$row2['email'];
}
$getAdminData = "SELECT * FROM register WHERE email = '$email'";
$resultData = mysqli_query($conn, $getAdminData);
if ($resultData->num_rows > 0) {
$row2 = $resultData->fetch_assoc();
$adminName = $row2['name'];
$adminEmail = $row2['email'];
}

// show branch previous data
if (isset($_GET['id'])) {
Expand Down Expand Up @@ -544,7 +544,7 @@

<li class="nav-item profileimage dropdown pe-3 mr-4">

<a class="nav-link nav-profile d-flex align-items-center pe-0" href="#" data-bs-toggle="dropdown">
<a class="nav-link nav-profile d-flex align-items-center pe-0" href="#" data-bs-toggle="dropdown">
<img src="image/admin-png.png" alt="Profile" class="rounded-circle">
<span class="d-none d-md-block dropdown-toggle ps-2"><?php echo $adminName ?></span>
</a><!-- End Profile Image Icon -->
Expand Down
2 changes: 1 addition & 1 deletion db.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
// //error reporting
//error reporting
error_reporting(E_ALL);
ini_set('display_errors', 1);

Expand Down
16 changes: 0 additions & 16 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@
<!-- Template Main CSS File -->
<link href="assets/css/style.css" rel="stylesheet">

<!-- =======================================================
* Template Name: NiceAdmin
* Template URL: https://bootstrapmade.com/nice-admin-bootstrap-admin-html-template/
* Updated: Apr 20 2024 with Bootstrap v5.3.3
* Author: BootstrapMade.com
* License: https://bootstrapmade.com/license/
======================================================== -->
<style>
.profileimage {
margin-right: 24px;
Expand Down Expand Up @@ -104,15 +97,6 @@
<i class="bi bi-list toggle-sidebar-btn"></i>
</div><!-- End Logo -->

<!--
<div class="search-bar">
<form class="search-form d-flex align-items-center" method="POST" action="#">
<input type="text" name="query" placeholder="Search" title="Enter search keyword">
<button type="submit" title="Search"><i class="bi bi-search"></i></button>
</form>
</div>
End Search Bar -->

<nav class="header-nav ms-auto">
<ul class="d-flex align-items-center">

Expand Down
10 changes: 0 additions & 10 deletions itemUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -610,16 +610,6 @@
</li>
<!-- End Profile Page Nav -->



<!-- <li class="nav-item">
<a class="nav-link collapsed" href="pages-register.php">
<i class="bi bi-card-list"></i>
<span>Register</span>
</a>
</li> -->
<!-- End Register Page Nav -->

<li class="nav-item">
<a class="nav-link collapsed" href="pages-login.php">
<i class="bi bi-box-arrow-in-right"></i>
Expand Down
7 changes: 0 additions & 7 deletions logout.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@
}
</style>

<!-- =======================================================
* Template Name: NiceAdmin
* Template URL: https://bootstrapmade.com/nice-admin-bootstrap-admin-html-template/
* Updated: Apr 20 2024 with Bootstrap v5.3.3
* Author: BootstrapMade.com
* License: https://bootstrapmade.com/license/
======================================================== -->
</head>

<body>
Expand Down
Loading

0 comments on commit bd32e81

Please sign in to comment.