Skip to content

Commit 4a3db2c

Browse files
feat: "added more info about box"
1 parent 66c5472 commit 4a3db2c

12 files changed

+1245
-116
lines changed

Branches.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,6 @@
460460

461461

462462
<!-- ---------------------------------------------------End Sidebar--------------------------------------------------->
463-
464463
<!--new table design-->
465464
<button id="fixedButtonBranch" type="button" onclick="window.location.href = 'createBranch.php?id=<?php echo $company_id; ?>'" class="btn btn-primary mb-3">Add Branch</button>
466465
<!--

Companies.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
$sql = "SELECT comp_id, comp_name, phone, email, password, image, city, state, country, registration, expiry FROM compani";
1414
$result = $conn->query($sql);
1515

16-
1716
$email = $_SESSION['email'];
1817
//get user name and email from register table
1918
$getAdminData = "SELECT * FROM register WHERE email = '$email'";
@@ -296,7 +295,6 @@
296295
echo "<td>" . $counter++ . "</td>";
297296
?>
298297
<td>
299-
300298
<a class="text-primary fw-bold" href="CompanyInfo.php?id=<?php echo $row['comp_id']; ?>">
301299
<?php echo $row['comp_name']; ?>
302300
</a>

CompanyInfo.php

Lines changed: 124 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414

1515
$email = $_SESSION['email'];
1616
//get user name and email from register table
17-
$getAdminData = "SELECT * FROM register WHERE email = '$email'";
18-
$resultData = mysqli_query($conn, $getAdminData);
19-
if($resultData ->num_rows > 0){
20-
$row2= $resultData->fetch_assoc();
21-
$adminName= $row2['name'];
22-
$adminEmail=$row2['email'];
23-
}
17+
$getAdminData = "SELECT * FROM register WHERE email = '$email'";
18+
$resultData = mysqli_query($conn, $getAdminData);
19+
if ($resultData->num_rows > 0) {
20+
$row2 = $resultData->fetch_assoc();
21+
$adminName = $row2['name'];
22+
$adminEmail = $row2['email'];
23+
}
2424

2525
$result = [];
2626
$company_data = null;
@@ -31,6 +31,14 @@
3131
$sql = "SELECT * FROM compani WHERE comp_id = $company_id";
3232
$result = $conn->query($sql);
3333
$company_data = $result->fetch_assoc();
34+
35+
36+
//fetch employee table
37+
$emp_sql = "Select * from employee where comp_FK_emp = $company_id";
38+
$result_emp = $conn->query($emp_sql);
39+
$emp_data = $result_emp->fetch_assoc();
40+
41+
3442
?>
3543

3644

@@ -261,6 +269,13 @@
261269
display: none;
262270
/* Hide the file input */
263271
}
272+
273+
/*Employee header*/
274+
.headerSetting{
275+
display: flex;
276+
gap: 250px;
277+
}
278+
264279
</style>
265280

266281
<!-- Template Main CSS File -->
@@ -421,10 +436,6 @@
421436
</div>
422437
</div>
423438

424-
<?php if (isset($_GET['success']) && $_GET['success'] == 1): ?>
425-
<br>
426-
<?php endif; ?>
427-
428439
<!-- Main content container -->
429440
<div class="d-flex flex-wrap">
430441

@@ -479,46 +490,110 @@
479490
</div>
480491

481492
<!-- Table container -->
482-
<div class="col-md-6 col-lg-8">
483-
<?php
484-
// if ($result->num_rows > 0) {
485-
// echo "<table class='datatable custom' style='background-color: #ffffff;'><thead><tr>";
486-
// echo "<th class='custom-header'>Company#</th>
487-
// <th class='custom-header'>Branch#</th>
488-
// <th class='custom-header'>Representative</th>
489-
// <th class='custom-header'>Resignation</th>
490-
// <th class='custom-header'>Phone</th>
491-
// <th class='custom-header'>City</th>
492-
// <th class='custom-header'>State</th>
493-
// <th class='custom-header'>Country</th>
494-
// <th class='custom-header'>Action</th>";
495-
// echo "</tr></thead><tbody>";
496-
497-
// while ($row = $result->fetch_assoc()) {
498-
// echo "<tr>";
499-
// echo "<td>" . htmlspecialchars($row["compID_FK"]) . "</td>";
500-
// echo "<td>" . htmlspecialchars($row["branch_id"]) . "</td>";
501-
// echo "<td>" . htmlspecialchars($row["ContactPersonName"]) . "</td>";
502-
// echo "<td>" . htmlspecialchars($row["ContactPersonResignation"]) . "</td>";
503-
// echo "<td>" . htmlspecialchars($row["ContactPersonPhone"]) . "</td>";
504-
// echo "<td>" . htmlspecialchars($row["City"]) . "</td>";
505-
// echo "<td>" . htmlspecialchars($row["State"]) . "</td>";
506-
// echo "<td>" . htmlspecialchars($row["Country"]) . "</td>";
507-
?>
508-
<!-- <td>
509-
<a class="btn btn-danger" href="branchDelete.php?id=<?php echo $row['compID_FK']; ?>">Delete</a>
510-
</td> -->
511-
<?php
512-
// echo "</tr>";
513-
// }
514-
515-
// echo "</tbody></table>";
516-
// } else {
517-
// echo "";
518-
// }
519-
?>
493+
494+
<div class="col-md-7 col-lg-8 mt-4">
495+
<div class="cardBranch recent-sales overflow-auto">
496+
<div class="card-body" style="font-size: 0.8rem; ">
497+
<div class="headerSetting">
498+
<h5 class="card-title">List of employees</h5>
499+
<button id="fixedButtonBranch" type="button" onclick="window.location.href = 'createEmployee.php?id=<?php echo $company_id;?>'" class="btn btn-primary mb-3">Add Employee</button>
500+
</div>
501+
<?php
502+
if ($result_emp->num_rows > 0) {
503+
?>
504+
<table class="table">
505+
<thead>
506+
<tr>
507+
<th scope="col">name</th>
508+
<th scope="col">email</th>
509+
<th scope="col">phone</th>
510+
<!-- <th scope="col" >Branch</th> -->
511+
<!-- <th scope="col" style="width: 24%;">Company Name</th> -->
512+
<th scope="col">Gender</th>
513+
<th scope="col">Address</th>
514+
<th scope="col">Authority</th>
515+
<!-- <th scope="col" >Received</th> -->
516+
<!-- <th scope="col" style="width: 30%;">Barcode</th> -->
517+
<th scope="col">Action</th>
518+
</tr>
519+
</thead>
520+
<tbody style="table-layout: fixed;">
521+
<?php
522+
523+
//counter variable
524+
$counter = 1;
525+
526+
while ($emp_data = $result_emp->fetch_assoc()) {
527+
528+
//dexlare variable for box_id
529+
530+
echo "<tr>";
531+
echo "<tr>";
532+
echo "<td>" . ($emp_data["name"]) . "</td>";
533+
534+
// //get specific company id
535+
// $comp_id = $row['companiID_FK'];
536+
537+
// //show company name of box
538+
// $sql3 = "SELECT * FROM compani WHERE comp_id= '$comp_id'";
539+
// $result3 = $conn->query($sql3);
540+
// if ($result3->num_rows > 0) {
541+
// $row3 = $result3->fetch_assoc();
542+
// $comp_name = $row3['comp_name'];
543+
// }
544+
545+
546+
// echo "<td>" . $comp_name . "</td>";
547+
548+
549+
// //get specific branch id
550+
// $branch_id = $row['branchID_FK'];
551+
552+
// //show branch name of box
553+
// $sql7 = "SELECT * FROM branch WHERE branch_id= '$branch_id'";
554+
// $result7 = $conn->query($sql7);
555+
// if ($result7->num_rows > 0) {
556+
// $row7 = $result7->fetch_assoc();
557+
// $branch_name = $row7['branch_name'];
558+
// }
559+
560+
// echo "<td>" . $branch_name . "</td>";
561+
echo "<td>" . ($emp_data["email"]) . "</td>";
562+
echo "<td>" . ($emp_data["phone"]) . "</td>";
563+
echo "<td>" . ($emp_data["gender"]) . "</td>";
564+
echo "<td>" . ($emp_data["Address"]) . "</td>";
565+
echo "<td>" . ($emp_data["Authority"]) . "</td>";
566+
// echo "<td>" . '<img class="barcode" alt="' . ($row["barcode"]) . '" src="barcode.php?text=' . urlencode($row["barcode"]) . '&codetype=code128&orientation=horizontal&size=20&print=false"/>' . "</td>";
567+
?>
568+
<td>
569+
570+
<div style="display: flex; gap: 10px;">
571+
<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>
572+
573+
<a type="button" class="btn btn-danger btn-floating d-flex justify-content-center" style="width:25px; height:28px" data-mdb-ripple-init
574+
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>
575+
</div>
576+
</td>
577+
</tr>
578+
<?php
579+
}
580+
?>
581+
</tbody>
582+
</table>
583+
<?php
584+
}
585+
else{
586+
587+
echo '<br>';
588+
echo'No Employees found for Company '. '<b>'. $company_data['comp_name'] .'<b>';
589+
}
590+
?>
591+
</div>
592+
</div>
520593
</div>
521594

595+
</div>
596+
522597
</div>
523598
<!-- End d-flex container -->
524599
</main><!-- End #main -->

box.php

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
header("Location: pages-login.php");
1010
exit();
1111
}
12+
1213
include 'db.php'; // Include the database connection
1314

1415
$email = $_SESSION['email'];
@@ -526,19 +527,19 @@
526527
<?php
527528
if ($result->num_rows > 0) {
528529
?>
529-
<table class="table table-borderless datatable mt-4" style="table-layout: fixed;">
530+
<table class="table datatable mt-4" style="table-layout: fixed;">
530531
<thead>
531-
<tr>
532+
<tr>
532533
<th scope="col" style="width: 8%;">Box ID</th>
533534
<th scope="col" style="width: 14%;">Box name</th>
534535
<th scope="col" style="width: 14%;">Company</th>
535536
<th scope="col" style="width: 14%;">Branch</th>
536537
<!-- <th scope="col" style="width: 24%;">Company Name</th> -->
537538
<th scope="col" style="width: 14%;">Created at</th>
538-
<th scope="col" style="width: 14%;">Receive Date</th>
539-
<th scope="col" style="width: 10%;">Sender</th>
540-
<th scope="col" style="width: 14%;">Received via</th>
541-
539+
<!-- <th scope="col" style="width: 14%;">Receive Date</th> -->
540+
<!-- <th scope="col" style="width: 10%;">Sender</th>
541+
<th scope="col" style="width: 14%;">Received via</th> -->
542+
542543
<!-- <th scope="col" style="width: 30%;">Barcode</th> -->
543544
<th scope="col" style="width: 10%;">Action</th>
544545
</tr>
@@ -549,7 +550,7 @@
549550
//counter variable
550551
$counter = 1;
551552

552-
553+
553554
while ($row = $result->fetch_assoc()) {
554555

555556

@@ -560,45 +561,45 @@
560561
echo "<td>" . ($row["box_id"]) . "</td>";
561562
?>
562563
<td>
563-
<?php echo $row['box_name']; ?>
564+
<a class="text-primary fw-bold" href="boxInfo.php?id=<?php echo $row['box_id']; ?>">
565+
<?php echo $row['box_name']; ?>
566+
</a>
564567
</td>
565568
<?php
566569

567-
570+
//get specific company id
571+
$comp_id = $row['companiID_FK'];
568572

569-
//get specific company id
570-
$comp_id=$row['companiID_FK'];
573+
//show company name of box
574+
$sql3 = "SELECT * FROM compani WHERE comp_id= '$comp_id'";
575+
$result3 = $conn->query($sql3);
576+
if ($result3->num_rows > 0) {
577+
$row3 = $result3->fetch_assoc();
578+
$comp_name = $row3['comp_name'];
579+
}
571580

572-
//show company name of box
573-
$sql3 = "SELECT * FROM compani WHERE comp_id= '$comp_id'";
574-
$result3 = $conn->query($sql3);
575-
if($result3->num_rows>0){
576-
$row3= $result3->fetch_assoc();
577-
$comp_name=$row3['comp_name'];
578-
}
579581

582+
echo "<td>" . $comp_name . "</td>";
580583

581-
echo "<td>" . $comp_name. "</td>";
582584

585+
//get specific branch id
586+
$branch_id = $row['branchID_FK'];
583587

584-
//get specific branch id
585-
$branch_id=$row['branchID_FK'];
588+
//show branch name of box
589+
$sql7 = "SELECT * FROM branch WHERE branch_id= '$branch_id'";
590+
$result7 = $conn->query($sql7);
591+
if ($result7->num_rows > 0) {
592+
$row7 = $result7->fetch_assoc();
593+
$branch_name = $row7['branch_name'];
594+
}
586595

587-
//show branch name of box
588-
$sql7 = "SELECT * FROM branch WHERE branch_id= '$branch_id'";
589-
$result7 = $conn->query($sql7);
590-
if($result7->num_rows>0){
591-
$row7= $result7->fetch_assoc();
592-
$branch_name=$row7['branch_name'];
593-
}
596+
echo "<td>" . $branch_name . "</td>";
594597

595-
echo "<td>" . $branch_name. "</td>";
596-
597598

598599
echo "<td>" . ($row["created_at"]) . "</td>";
599-
echo "<td>" . ($row["rec_date"]) . "</td>";
600-
echo "<td>" . ($row["sender"]) . "</td>";
601-
echo "<td>" . ($row["rec_via"]) . "</td>";
600+
// echo "<td>" . ($row["rec_date"]) . "</td>";
601+
// echo "<td>" . ($row["sender"]) . "</td>";
602+
// echo "<td>" . ($row["rec_via"]) . "</td>";
602603
// echo "<td>" . '<img class="barcode" alt="' . ($row["barcode"]) . '" src="barcode.php?text=' . urlencode($row["barcode"]) . '&codetype=code128&orientation=horizontal&size=20&print=false"/>' . "</td>";
603604
?>
604605
<td>

0 commit comments

Comments
 (0)