     <!-- Deposit Action Sheet -->
        <div class="modal fade action-sheet" id="productActionSheet" tabindex="-1" role="dialog">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title">Select Action</h5>
                    </div>
                    <div class="modal-body">
                        <div class="action-sheet-content">
                            <form>
                                <div class="form-group basic">
                                    <button type="button" class="btn btn-warning btn-block btn-lg openProductcatModal">Add Product Category</button>
                                </div>

                                 <div class="form-group basic">
                                    <button type="button" class="btn btn-primary btn-block btn-lg openProductModal">Add Product</button>
                                </div>

                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- * Deposit Action Sheet -->
        
        
        <!--Product Category Modal Basic -->
        <div class="modal fade modalbox" id="pdtcatModalBasic" tabindex="-1" role="dialog">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title">Product Category</h5>
                        <a href="javascript:;" data-dismiss="modal">Close</a>
                    </div>
                    <div class="modal-body">
          <!--  Accounts Section -->   
         <div class="section mt-1" >


            <!-- Real Content -->
            <form id="productscategForm">

                <div id="productscatRows">

                    <!-- First Row -->
                    <div class="warehouse-row row mb-2">
                        <div class="form-group basic  col-md-3">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Product Category Name</label>
                            <input type="text" name="pdt_categname[]" class="form-control" required>
                            </div>
                        </div>
                      
                        <div class="form-group basic col-md-2 d-flex align-items-center">
                            <button type="button" class="btn btn-danger btn-sm removeRow" style="display:none;">Remove</button>
                        </div>
                    </div>

                </div>

                <div class="form-group basic mt-2">
                    <div class="right" style="position: fixed; right: 20px; center: 20px; z-index: 9999;">
                    <div id="liveToastContainer"></div>
                </div>
                    <button type="button" id="pdtcataddRow" class="btn btn-success btn-sm">
                        + Add Row
                    </button>
                </div>

                <div class="mt-3">
                    <button type="submit" class="btn btn-warning btn-block">
                        Add Product Category
                    </button>
                </div>

            </form>

</div>
    <!--  * Accounts Section -->
                    </div>
                </div>
            </div>
        </div>
        <!-- * Product Category Modal Basic -->
        
         <!-- Product Modal Basic -->
        <div class="modal fade modalbox" id="pdtModalBasic" tabindex="-1" role="dialog">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title">Add Product </h5>
                        <a href="javascript:;" data-dismiss="modal">Close</a>
                    </div>
                    <div class="modal-body">
     <!--  Accounts Section -->   
         <div class="section mt-1" >


    <!-- Real Content -->
    <form id="productsForm">

                <div id="productsRows">
<h5 class="mb-3">Basic Information</h5>
                    <!-- First Row -->
                    <div class="warehouse-row row mb-2">
                        <div class="form-group   col-md-4">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Product Name</label>
                            <input type="text" name="product_name[]" class="form-control" required>
                            </div>
                        </div>
                        <div class="form-group   col-md-2">
                            <div class="input-wrapper">
                            <label class="label" for="name2">sku</label>
                            <input type="text" name="sku[]" class="form-control"  required>
                            </div>
                        </div>
                        <div class="form-group   col-md-3">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Type</label>
                              <select name="product_type[]" class="form-control">
                                <option value="inventory">Inventory</option>
                                <option value="service">Service</option>
                                <option value="non_inventory">Non Inventory</option>
                            </select>
                            </div>
                        </div>
                         <div class="form-group  col-md-3">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Status</label>
                             <select name="status[]" class="form-control">
                                    <option value="active">Active</option>
                                    <option value="inactive">Inactive</option>
                                </select>
                            </div>
                        </div>
                        
            
                        
                    </div>
                    <!-- First Row -->
                    
                    <!-- Second Row -->
                    <h5 class="mb-3">Classification</h5>
                    
                    <div class="warehouse-row row mb-2">
                                   <div class="form-group   col-md-4">
                           <div class="input-wrapper">
                               <label class="label" for="name2">Category</label>
                             <select name="category_id[]" class="form-control" required>
                                <?php
                                $coid  = $_SESSION['co_id'];
                                $stmt = $pdo->prepare("
                                    SELECT id, categ_name 
                                    FROM product_category
                                    WHERE co_id = ?
                                    ORDER BY categ_name ASC
                                ");
                                $stmt->execute([$coid]);
                                $categories = $stmt->fetchAll(PDO::FETCH_ASSOC);
                        
                                foreach ($categories as $cat) {
                                    echo '<option value="'.$cat['id'].'">'
                                        .htmlspecialchars($cat['categ_name']).
                                        '</option>';
                                }
                                ?>
                            </select>
                                </div>
                        </div>
                        
                         <div class="form-group  col-md-3">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Summary Sales Report</label>
                             <select name="sales_rep[]" class="form-control">
                                    <option value="yes">Yes</option>
                                    <option value="no">No</option>
                                </select>
                            </div>
                        </div>
                        
                        <div class="form-group   col-md-3">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Report Sort Order</label>
                            <input type="text" name="rep_sort[]" class="form-control"  required>
                            </div>
                        </div>
                    
                    
                      </div>
                    <!-- Second Row -->
                    
                      <!-- Third Row -->
                    <h5 class="mb-3">Sale Pricing</h5>
                    
                    <div class="warehouse-row row mb-2">
                                   <div class="form-group   col-md-4">
                           <div class="input-wrapper">
                               <label class="label" for="name2">Selling Price</label>
                              <input type="number" step="0.01" name="selling_price[]" class="form-control">
                                </div>
                        </div>
                        
                         <div class="form-group  col-md-2">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Sale Commission</label>
                             <input type="number" step="0.01" name="sale_comm[]" class="form-control">

                            </div>
                        </div>
                        
                        <div class="form-group   col-md-3">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Tax Rate (Amount)</label>
                            <input type="number" name="sale_tax_rate[]" class="form-control"  required>
                            </div>
                        </div>
                        
                        <div class="form-group  col-md-2">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Administration Commission</label>
                             <input type="number" step="0.01" name="admin_comm[]" class="form-control">

                            </div>
                        </div>
                    
                    
                      </div>
                    <!-- Third Row -->
                    
                    <!-- Fourth Row -->
                    <h5 class="mb-3">Purchase Pricing</h5>
                    
                    <div class="warehouse-row row mb-2">
                                   <div class="form-group   col-md-4">
                           <div class="input-wrapper">
                               <label class="label" for="name2">Purchase Price</label>
                              <input type="number" step="0.01" name="prch_price[]" class="form-control">
                                </div>
                        </div>
                        
                         <div class="form-group  col-md-2">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Purchase Commission</label>
                             <input type="number" step="0.01" name="prch_comm[]" class="form-control">

                            </div>
                        </div>
                        
                        <div class="form-group   col-md-3">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Tax Rate (Amount)</label>
                            <input type="number" name="prch_tax_rate[]" class="form-control"  required>
                            </div>
                        </div>
                        
                        <div class="form-group  col-md-2">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Margin</label>
                             <input type="number" step="0.01" name="margin[]" class="form-control">

                            </div>
                        </div>
                    
                    
                      </div>
                    <!-- Fourth Row -->
                    
                    
                </div>
                <div class="mt-3">
                    <button type="submit" class="btn btn-primary btn-block">
                        Add Product
                    </button>
                </div>

                <div class="form-group basic mt-2">
                    <div class="right" style="position: fixed; right: 20px; center: 20px; z-index: 9999;">
                    <div id="liveToastContainer"></div>
                </div>
                    <button type="button" id="pdtaddRow" class="btn btn-light btn-sm">
                       
                    </button>
                </div>

                

            </form>

</div>
    <!--  * Accounts Section -->
                    </div>
                </div>
            </div>
        </div>
        <!-- * Product Modal Basic -->
        
     <!-- *EDIT  Product Modal Basic -->    
        <div class="modal fade modalbox" id="editProductModal" tabindex="-1" role="dialog">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title">Edit Product </h5>
                        <a href="javascript:;" data-dismiss="modal">Close</a>
                    </div>
                    <div class="modal-body">
     <!--  Accounts Section -->   
         <div class="section mt-1" >


    <!-- Real Content -->
    <form id="editProductForm">

               
<h5 class="mb-3">Basic Information</h5>
                    <!-- First Row -->
                    <div class="warehouse-row row mb-2">
                        <div class="form-group   col-md-4">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Product Name</label>
                            <input type="hidden" name="id" id="edit_id">
                            
                            <input type="text" name="product_name_edit" id="product_name_edit"class="form-control" required>
                            </div>
                        </div>
                        <div class="form-group   col-md-2">
                            <div class="input-wrapper">
                            <label class="label" for="name2">sku</label>
                            <input type="text" name="sku_edit" id="sku_edit" class="form-control"  required>
                            </div>
                        </div>
                        <div class="form-group   col-md-3">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Type</label>
                              <select name="product_type_edit" id="product_type_edit"class="form-control">
                                <option value="inventory">Inventory</option>
                                <option value="service">Service</option>
                                <option value="non_inventory">Non Inventory</option>
                            </select>
                            </div>
                        </div>
                         <div class="form-group  col-md-3">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Status</label>
                             <select name="status_edit" id="status_edit" class="form-control">
                                    <option value="active">Active</option>
                                    <option value="inactive">Inactive</option>
                                </select>
                            </div>
                        </div>
                        
            
                        
                    </div>
                    <!-- First Row -->
                    
                    <!-- Second Row -->
                    <h5 class="mb-3">Classification</h5>
                    
                    <div class="warehouse-row row mb-2">
                                   <div class="form-group   col-md-4">
                           <div class="input-wrapper">
                               <label class="label" for="name2">Category</label>
                             <select name="category_id_edit" id="category_id_edit" class="form-control" required>
                                <?php
                                $coid  = $_SESSION['co_id'];
                                $stmt = $pdo->prepare("
                                    SELECT id, categ_name 
                                    FROM product_category
                                    WHERE co_id = ?
                                    ORDER BY categ_name ASC
                                ");
                                $stmt->execute([$coid]);
                                $categories = $stmt->fetchAll(PDO::FETCH_ASSOC);
                        
                                foreach ($categories as $cat) {
                                    echo '<option value="'.$cat['id'].'">'
                                        .htmlspecialchars($cat['categ_name']).
                                        '</option>';
                                }
                                ?>
                            </select>
                                </div>
                        </div>
                        
                         <div class="form-group  col-md-3">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Summary Sales Report</label>
                             <select name="sales_rep_edit" id="sales_rep_edit" class="form-control">
                                    <option value="yes">Yes</option>
                                    <option value="no">No</option>
                                </select>
                            </div>
                        </div>
                        
                        <div class="form-group   col-md-3">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Report Sort Order</label>
                            <input type="text" name="rep_sort_edit" id="rep_sort_edit" class="form-control"  required>
                            </div>
                        </div>
                    
                    
                      </div>
                    <!-- Second Row -->
                    
                      <!-- Third Row -->
                    <h5 class="mb-3">Sale Pricing</h5>
                    
                    <div class="warehouse-row row mb-2">
                                   <div class="form-group   col-md-4">
                           <div class="input-wrapper">
                               <label class="label" for="name2">Selling Price</label>
                              <input type="number" step="0.01" name="selling_price_edit" id="selling_price_edit" class="form-control">
                                </div>
                        </div>
                        
                         <div class="form-group  col-md-2">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Sale Commission</label>
                             <input type="number" step="0.01" name="sale_comm_edit" id="sale_comm_edit"   class="form-control">

                            </div>
                        </div>
                        
                        <div class="form-group   col-md-3">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Tax Rate (Amount)</label>
                            <input type="number" name="sale_tax_rate_edit" id="sale_tax_rate_edit" class="form-control"  required>
                            </div>
                        </div>
                        
                        <div class="form-group  col-md-2">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Administration Commission</label>
                             <input type="number" step="0.01" name="admin_comm_edit" id="admin_comm_edit" class="form-control">

                            </div>
                        </div>
                    
                    
                      </div>
                    <!-- Third Row -->
                    
                    <!-- Fourth Row -->
                    <h5 class="mb-3">Purchase Pricing</h5>
                    
                    <div class="warehouse-row row mb-2">
                                   <div class="form-group   col-md-4">
                           <div class="input-wrapper">
                               <label class="label" for="name2">Purchase Price</label>
                              <input type="number" step="0.01" name="prch_price_edit" id="prch_price_edit" class="form-control">
                                </div>
                        </div>
                        
                         <div class="form-group  col-md-2">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Purchase Commission</label>
                             <input type="number" step="0.01" name="prch_comm_edit" id="prch_comm_edit" class="form-control">

                            </div>
                        </div>
                        
                        <div class="form-group   col-md-3">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Tax Rate (Amount)</label>
                            <input type="number" name="prch_tax_rate_edit" id="prch_tax_rate_edit" class="form-control"  required>
                            </div>
                        </div>
                        
                        <div class="form-group  col-md-2">
                            <div class="input-wrapper">
                            <label class="label" for="name2">Margin</label>
                             <input type="number" step="0.01" name="margin_edit" id="margin_edit" class="form-control">

                            </div>
                        </div>
                    
                    
                      </div>
                    <!-- Fourth Row -->
                    
                    
                </div>
                <div class="mt-3">
                    <button type="submit" class="btn btn-primary btn-block">
                        Edit Product
                    </button>
                </div>

                

                

            </form>

</div>
    <!--  * Accounts Section -->
                    </div>
                </div>
            </div>
        </div>

   <!-- *EDIT  Product Modal Basic -->   