11-21-2024-header-myshipment.php

This header panel delivers the top navigation and user menu for all My Shipments-related pages. It handles logo display, contact info, responsive navigation, and session-driven menu items such as My Account, Quote & Ship, Shipments, Settings, and Logout.


🔗 Dependencies

  • Bootstrap 5 classes (e.g. navbar, container-fluid, row, col-*)
  • Google Font “Rubik”
  • PHP session variables ($_SESSION) to drive conditional rendering
  • Utility functions for dropdown generation and access checks:
    • getCompaniesTreeCombo()
    • GenerateCustomersTreeDDL()
    • checkCustomerUserAccess()

🏗️ Layout Structure

  1. Top Strip
    • Currently commented out; reserved for subsidiary info, toll-free phone, or debug session data
  2. Font Loading
    • <link href="https://fonts.googleapis.com/css2?family=Rubik…">
  3. Main Header (<header class="main-header">)
    • Logo on the left
    • Contact Items on the right, with icons and phone numbers
  4. Navbar (<nav class="navbar-expand-lg">)
    • Desktop Nav: Horizontal links
    • Mobile Toggle: Checkbox hack + Bootstrap collapse
  5. User Panel (#nav-user)
    • My Account button showing the customer’s email
    • Expandable menu with links based on session flags

⚙️ Session-Driven Conditional Rendering

The following session variables control which menu items appear:

Variable Description Menu Item
$_SESSION['Customer_ID'] User is logged in Show entire user panel
$_SESSION['my_shipments_check']=='Y' My Shipments feature enabled My Shipments link 📦
$_SESSION['banyan_enabled']=='Y' Use v2 shipments view Link to my_shipments_v2.php
$_SESSION['small_package']=='Y' Small Parcel feature enabled Small Parcel submenu
$_SESSION['enable_claims']=='Y' Claim system enabled Claims link
$_SESSION['create_shipment_check']=='Y' New shipment creation allowed Create Shipment link
$_SESSION['create_bol']=='Y' Bill-of-Lading creation allowed Create BOL link
$_SESSION['shipment_coupon']=='Y' Vendor coupon codes available Vendor Codes link
$_SESSION['tech_logistics_access']=='Y' Special settings access Settings submenu
$_SESSION['carrier_perform']=='Y' Carrier performance reports enabled Carrier Performance link

Many of these checks utilize checkCustomerUserAccess() to validate per-user permissions .


🧩 Key Functions

// Builds a <select> of all approved companies/locations
function getCompaniesTreeCombo($name, $selected = '', $att = '') { … }  

// Builds a dynamic <select> based on a custom WHERE clause
function GenerateCustomersTreeDDL($name, $where, $selected='', $css_class='', $att='', $depth=1) { … } 

// Checks if a user has a specific access right (Y/N) in customers_users_locations_access
function checkCustomerUserAccess($accessField, $masterCustomerId, $customerId, $userId) { … } 

These utilities live in functions_v2.inc.php or similar core include files, and power the company/location dropdowns and per-user menu toggles.


📐 Example Snippets

Main Logo & Contact

<div class="col-lg-6 … company-logo">
  <a href="index.php" class="ltl-logo">
    <img src="images/Tech-Logistic-logo.webp"
         alt="Tech Logistics"
         class="img-fluid"
         width="323">
  </a>
</div>

<div class="col-lg-6 … d-flex justify-content-end align-items-center">
  <div class="contact-item me-3">
    <img src="images/phone_in_talk.svg" alt="Call Us Toll-Free">
    <div class="phone-number">
      <a href="tel:800-641-5300" class="contact-info">800-641-5300</a><br>
      <small class="text-muted">Call Us Toll-Free</small>
    </div>
  </div>
  <!-- Secondary contact… -->
</div>

User Menu Toggle

<?php if(!empty($_SESSION['Customer_ID'])){ ?>
  <button class="btn btn-primary" data-bs-toggle="collapse" data-bs-target="#loginBox">
    <img src="images/manage_accounts.svg" alt="Manage Account" class="me-2">
    <span class="customer-email">
      <?= strtolower($_SESSION['Customer_email']) ?>
    </span>
    <!-- Chevron icon -->
  </button>
  <div class="collapse myaccount-box" id="loginBox">
    <ul class="myaccount">
      <li>
        <a href="my_account.php">My Profile</a>
      </li>
      <li>
        <a href="start_quote.php">Quote & Ship</a>
      </li>
      <!-- …other items based on session flags… -->
    </ul>
  </div>
<?php } ?>

📄 Integration & Usage

  • Inclusion: This panel is pulled into pages via the site template:
    include_once("inc/panels/11-21-2024-header-myshipment.php");
    
  • Context: It replaces or augments the standard header on My Shipments views (e.g. my_shipments.php, my_shipments_v2.php).
  • Customization: Adjust session flags or add new menu items by replicating existing conditional blocks.

✨ This file centralizes all header and navigation logic for the My Shipments section, ensuring consistent branding, responsive layout, and dynamic menu controls across the application.