|
14 | 14 |
|
15 | 15 | $email = $_SESSION['email'];
|
16 | 16 | //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 | +} |
24 | 24 |
|
25 | 25 | $result = [];
|
26 | 26 | $company_data = null;
|
|
31 | 31 | $sql = "SELECT * FROM compani WHERE comp_id = $company_id";
|
32 | 32 | $result = $conn->query($sql);
|
33 | 33 | $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 | + |
34 | 42 | ?>
|
35 | 43 |
|
36 | 44 |
|
|
261 | 269 | display: none;
|
262 | 270 | /* Hide the file input */
|
263 | 271 | }
|
| 272 | + |
| 273 | + /*Employee header*/ |
| 274 | + .headerSetting{ |
| 275 | + display: flex; |
| 276 | + gap: 250px; |
| 277 | + } |
| 278 | + |
264 | 279 | </style>
|
265 | 280 |
|
266 | 281 | <!-- Template Main CSS File -->
|
|
421 | 436 | </div>
|
422 | 437 | </div>
|
423 | 438 |
|
424 |
| - <?php if (isset($_GET['success']) && $_GET['success'] == 1): ?> |
425 |
| - <br> |
426 |
| - <?php endif; ?> |
427 |
| - |
428 | 439 | <!-- Main content container -->
|
429 | 440 | <div class="d-flex flex-wrap">
|
430 | 441 |
|
|
479 | 490 | </div>
|
480 | 491 |
|
481 | 492 | <!-- 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> |
520 | 593 | </div>
|
521 | 594 |
|
| 595 | + </div> |
| 596 | + |
522 | 597 | </div>
|
523 | 598 | <!-- End d-flex container -->
|
524 | 599 | </main><!-- End #main -->
|
|
0 commit comments