<?php
   include 'inc/header.php';
   include "inc/sidebar.php";
   ?>
<!-- Main Content -->
<div class="main-content">
<section class="section">
   <div class="section-header">
      <div class="row">
         <div class="col-xl-6 col-lg-6 col-md-6 col-sm-12">
            <div class="section-header-breadcrumb-content">
               <h1>User Role</h1>
               <div class="section-header-breadcrumb">
                  <div class="breadcrumb-item active"><a href="#"><i class="fas fa-home"></i></a></div>
                  <div class="breadcrumb-item"><a href="#">User Role</a></div>
               </div>
            </div>
         </div>
         <div class="col-xl-6 col-lg-6 col-md-6 col-sm-12">
            <div class="section-header-breadcrumb-chart float-right">
               <div class="breadcrumb-chart m-l-50">
                  <div class="float-right">
                     <div class="icon m-b-10">
                        <div class="chart header-bar">
                           <canvas width="49" height="40" ></canvas>
                        </div>
                     </div>
                  </div>
                  <div class="float-right m-r-5 m-l-10 m-t-1">
                     <div class="chart-info">
                        <span>$10,415</span>
                        <p>Last Week</p>
                     </div>
                  </div>
               </div>
               <div class="breadcrumb-chart m-l-50">
                  <div class="float-right">
                     <div class="icon m-b-10">
                        <div class="chart header-bar2">
                           <canvas width="49" height="40" ></canvas>
                        </div>
                     </div>
                  </div>
                  <div class="float-right m-r-5 m-l-10 m-t-1">
                     <div class="chart-info">
                        <span>$22,128</span>
                        <p>Last Month</p>
                     </div>
                  </div>
               </div>
            </div>
         </div>
      </div>
   </div>
   <div class="section-body">
      <div class="row">
         <div class="col-12">
            <div class="card">
               <div class="card-header">
                  <h4>User Role <a href="javascript:void(0)" class="btn btn-outline-primary" data-toggle="modal" data-target="#centerModal"> Add Role</a></h4>
               </div>
               <div class="card-body">
                  <div class="col-md-12">
                     <div class="col-md-12" style="margin:0 auto">
                        <?php if (isset($_SESSION['msg_scs'])): ?>
                        <p class="alert alert-success"><?php echo $_SESSION['msg_scs']; ?></p>
                        <?php endif ?>
                        <?php unset($_SESSION['msg_scs']) ?>
                        <?php if (isset($_SESSION['scs_err'])): ?>
                        <p class="alert alert-danger"><?php echo $_SESSION['scs_err']; ?></p>
                        <?php endif ?>
                        <?php unset($_SESSION['scs_err']) ?>
                        <div class="row">
                           <div class="col-md-12">
                              <table class="table table-bordered">
                                 <thead>
                                    <tr>
                                       <th>#</th>
                                     
                                       <th>Name</th>
                                       <th>User</th>
                                       <th>Type</th>
                                       <th>Role Level</th>
                                     
                                       <th>Action</th>
                                    </tr>
                                 </thead>
                                 <tbody>
                                    <?php
                                       // $sql = "SELECT * FROM `shipping_carrires` ORDER BY id ASC";
                                       // $run1 = $db->select($sql);
                                       // $sn = '1';
                                       //  if ($run1->num_rows > 0) {
                                       //      while($row = $run1->fetch_array()){
                                       ?>  
                                    <tr>
                                       <td><?= $sn;?></td>
                                       <td><img src="<?= $row['brand_logo'];?>" alt="logo" style="height: 40px; width: 40px;" class="img-responsive"></td>
                                       <td><?= $row['carrier_name'];?></td>
                                       <td><?= $row['tracking_url'];?></td>
                                       <td><?= $row['email'];?></td>
                                       <td><?= $row['phone'];?></td>
                                       <td class="text-primary"><?= $row['status'];?></td>
                                       <td>
                                          <a href="javascript:void(0);" data-id="<?= $row1['id'];?>" class="btn btn-icon btn-sm btn-success btn-edit-row"><i class="fas fa-pencil-ruler"></i></a> &nbsp;
                                          <a href="javascript:void(0);" data-id1="<?= $row1['id'];?>" class="btn btn-icon btn-sm btn-primary delete_data"><i class="fas fa-trash"></i></a>
                                       </td>
                                    </tr>
                                    <?php
                                       // $sn++;
                                       //     }
                                       // } 
                                       // else {
                                       ?> 
                                    <tr>
                                       <td class="text-danger" colspan="8">No Carriers Found</td>
                                    </tr>
                                    <?php
                                       }
                                        
                                       ?>
                                 </tbody>
                              </table>
                           </div>
                        </div>
                     </div>
                  </div>
               </div>
            </div>
         </div>
      </div>
</section>
<!-- Center -->
<div class="modal fade" id="centerModal" tabindex="-1" role="dialog"
   aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
<div class="modal-content">
<div class="modal-header" style="border-bottom: 1px solid #ccc;">
<h5 class="modal-title" id="exampleModalCenterTitle">Add Role</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form method="post" action="query.php" enctype="multipart/form-data">
<div class="modal-body">
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label> Name <sup class="text-danger">*</sup></label>
<input type="text" name="name" id="carrier_name" class="form-control" required placeholder="Carrier Name">
</div>
</div>
<div class="col-md-4">
<label>Role type <sup class="text-danger">*</sup></label>
<select name="role_type" id="status" class="form-control" required>
<option value="">Select</option>
<option value="Active">Platform </option>
<option value="Inactive">Merchant</option>
</select>   
</div>

<div class="col-md-4">
<div class="form-group">
<label>Role Level <sup class="text-danger">*</sup></label>
<input type="text" name="role_level" id="email" class="form-control" placeholder="Role level" required>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label>Description <sup class="text-danger">*</sup></label>
<textarea type="text" name="description" id="phone" class="form-control" placeholder="description" required></textarea>
</div>
</div>

</div>
</div>
<div class="modal-footer bg-whitesmoke br">
<input type="hidden" name="action" id="action" value="add_carrier">
<button type="submit" name="add_carrier" id="add_carrier" class="btn btn-primary">Save</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</form>
</div>
</div>
</div>
</div>
<?php include 'inc/footer.php'; ?>