<!DOCTYPE html>
<html lang="en">

<head>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="description" content="">
  <meta name="author" content="">

  <title>List of Brands</title>

  <!-- Bootstrap core CSS -->
  <link href="../vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css" />
  <link href="https://fonts.googleapis.com/css2?family=Kufam:wght@400;500;600;700;800;900&display=swap"
    rel="stylesheet">

  <!-- Custom styles for this template -->
  <link href="../public/css/main.css" rel="stylesheet">

</head>

<body>

  <div class="d-flex" id="wrapper">

    <!-- Sidebar -->
    <?php
          
          include ('../sidebar_admin.php'); 
      ?>
    <!-- /#sidebar-wrapper -->

    <!-- Page Content -->
    <div id="page-content-wrapper">

        <?php
        include ('../navbar_admin.php');
        ?>


        <div class="container">
        <div class="page_name_candidate">
          <div class="candidate_div">
            <h1>Brands List</h1>

          </div>
          <div class="select_sort_second">

            <div class="sort_btn">


              <a href="add_brands.php
              "><span class="span_btn"><svg width="12px" height="12px" viewBox="0 0 18 18" version="1.1"
                    xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">
                    <desc>Created with Lunacy</desc>
                    <path
                      d="M10 8L17 8C17.5523 8 18 8.44772 18 9C18 9.55229 17.5523 10 17 10L10 10L10 17C10 17.5523 9.55229 18 9 18C8.44772 18 8 17.5523 8 17L8 10L1 10C0.447715 10 0 9.55229 0 9C0 8.44772 0.447715 8 1 8L8 8L8 1C8 0.447715 8.44772 0 9 0C9.55229 0 10 0.447715 10 1L10 8Z"
                      id="Path" fill="#FFFFFF" stroke="none" />
                  </svg></span>Add Brands</a>

            </div>
          </div>



        </div>

        <div class="cards">
          <div class="row">
            <div class="col-xl-12 mt-3 mb-3">
              <div class="card payment_method_card candidate">
                <div class="card-body ">
                  <div class="pagination_table">
                    <div class="results">
                    </div>
                    <div class="page">
                      <div class="page_filter">

                        <div class="form-group mr-3">
                          <?php
                           $query = "SELECT * FROM Categories  ORDER BY position+0 ASC";
                           $result = queryRunner($query);
                          
                        
                          
                          ?>

                          <select class="form-control" id="category-select-id">
                            <option selected="selected" value="">All Category</option>
                            <?php while ($row = rowRetriever($result)) { ?>
                            <option value="<?php echo $row['id']; ?>"><?php echo $row['name']; ?></option>

                            <?php } ?>
                          </select>
                        </div>

                      </div>

                      <span class="page_head">Results Per Page</span>
                      <ul class="pagination pagination-sm">


                      </ul>

                    </div>
                  </div>
                  <div class="search_product">
                    <form action="#">
                      <div class="input-group ">
                        <div class="input-group-prepend">
                          <span class="input-group-text" id="basic-addon1"><i class="fas fa-search"></i></span>
                        </div>
                        <input type="text" class="form-control" id="search-Brand" placeholder="Searching for.."
                          aria-label="Username" aria-describedby="basic-addon1">
                      </div>
                    </form>

                  </div>


                  <table class="table table_centerd">
                    <thead>
                      <tr>

                        <th>Logo</th>
                        <th>Brand Name</th>
                        <th>Category Name</th>
                        <th>Followers</th>
                        <th>Total Items</th>
                        <th>Total Sale</th>
                        <th>Rating</th>
                        <th>Action</th>
                        <th>Enable</th>


                      </tr>
                    </thead>
                    <tbody id="brand-table-id">
                      <?php while ($row = rowRetriever($result)) { ?>
                      <tr id="row-name-<?php echo $row['id'];   ?>">
                        <td><img class="brand_img" src="<?php echo $brand_image_path.$row['image']; ?>" alt=""></td>
                        <td><span><?php echo $row['name']; ?></span>
                        </td>
                        <td><span><?php echo $row['category_name']; ?></span>
                        </td>
                        <td><?php echo $row['total_follwers']; ?></td>
                        <td><?php echo $row['product_count']; ?></td>
                        <td><?php echo ceil($row['sales']); ?></td>
                        <td><?php echo $row['avg_ratings']; ?></td>
                        <td>
                          <div class="">
                            <a href="<?php echo "../admin_panel/editBrand.php?id=".$row['id']; ?>"><button data-toggle="modal" 
                              data-id="<?php echo $row['id']; ?>" id="editmodal" type="button"
                              class="btn btn-outline-white2 btn-rounded btn-sm">
                              <i class="fas fa-pencil-alt fa-pencil-alt2 mt-0"></i>
                            </button></a>
                            <button type="button" class="btn btn-outline-white2 btn-rounded btn-sm"
                              onclick="deletebrand(<?php echo $row['id']; ?>)">
                              <i class="far fa-trash-alt fa-trash-alt2 mt-0"></i>
                            </button>
                          </div>
                        </td>
                        <td>
                          <label class="switch">
                            <!-- echo $row['id'], echo $row['enable']; -->
                            <input type="hidden" id="brands-stauts-<?php echo $row['id']; ?>"
                              value="<?php echo $row['enable']; ?>">
                            <input type="checkbox"
                              onchange="changeBrandsStatus(<?php echo $row['id']?>,<?php echo $row['enable']; ?> )" <?php if($row['enable'] == 0){
                            
                              echo "value='0'";
                            }else {
                              echo "value='1'  checked";
                            }
                            ?>>
                            <span class="slider round"></span>
                          </label>

                        </td>


                      </tr>
                      <?php }?>

                    </tbody>
                  </table>

                </div>
              </div>

            </div>

          </div>

        </div>
      </div>
      <!-- /#page-content-wrapper -->

    </div>
    <!-- /#wrapper -->
    <!-- modals -->
    <!-- add modal -->
    <form class="childcatagories_modal_from" id="modal-form" action="">
      <div class="modal fade" id="add_payment_modal" tabindex="-1" role="dialog"
        aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered" role="document">
          <div class="modal-content">
            <div class="modal-header mh">
              <button type="button" class="close closmodel" data-dismiss="modal" aria-label="Close"
                onclick="colsemodel()">
                <span aria-hidden="true">&times;</span>
              </button>
            </div>
            <div class="modal-body mb">
              <div>
                <div class="cat-folder-img">
                  <i class="fa fa-folder" aria-hidden="true"></i>
                </div>
              </div>
              <div class="form-group">
                <label for="cat-name-upload" class="customer-add-input-label txt-regular upload-input-label">
                  Name</label>
                <input type="text" id="addpro_cat" name="addpro_cat" placeholder="Enter Payment Name" value=""
                  class="customer-add-input  w-100" />
              </div>
              <div class="form-group">
                <label for="cat-name-upload"
                  class="customer-add-input-label txt-regular upload-input-label">Price/Distance</label>
                <input type="text" id="addpro_cat" name="pri_dis" placeholder="Enter Price and distance" value=""
                  class="customer-add-input  w-100" />
              </div>
              <div class="form-group">
                <label for="cat-name-upload" class="customer-add-input-label txt-regular upload-input-label">Waiting
                  price/Condition</label>
                <input type="text" id="addpro_cat" name="pri_con" placeholder="Enter Waiting Price and Condition"
                  value="" class="customer-add-input  w-100" />
              </div>
              <div class="form-group">
                <label for="cat-name-upload" class="customer-add-input-label txt-regular upload-input-label">Ride
                  Category</label>
                <input type="text" id="addpro_cat" name="rid_cat" placeholder="Enter Ride Category" value=""
                  class="customer-add-input  w-100" />
              </div>
              <div class="form-group">
                <label for="cat-name-upload"
                  class="customer-add-input-label txt-regular upload-input-label">Country</label>
                <input type="text" id="addpro_cat" name="rid_cat" placeholder="Enter country Name" value=""
                  class="customer-add-input  w-100" />
              </div>
              <div class="form-group">
                <label for="cat-name-upload"
                  class="customer-add-input-label txt-regular upload-input-label">City</label>
                <input type="text" id="addpro_cat" name="rid_cat" placeholder="Enter city Name" value=""
                  class="customer-add-input  w-100" />
              </div>
              <div class="form-group">
                <label for="cat-name-upload"
                  class="customer-add-input-label txt-regular upload-input-label">Tagline</label>
                <input type="text" id="addpro_cat" name="tagline" placeholder="Enter  tagline" value=""
                  class="customer-add-input  w-100" />
              </div>


              <div>
                <div>
                  <div class="upload-text-heading">
                    <h5 class="coupon-code-main-heading txt-regular">
                      Upload Picture
                    </h5>
                  </div>
                  <div>
                    <p class="upload-main-paragraph txt-label2">
                      Drag and drop your files here
                    </p>
                  </div>
                </div>
                <div class="card text-center uload-card">
                  <div class="file-upload4">
                    <div class="image-upload-wrap4">
                      <input class="file-upload-input4" type="file" onchange="readURL4(this);" accept="image/*" />
                      <div class="drag-text4">
                        <div class="card-body upload-card-body4">
                          <div class="upload-img4">
                            <img src="../public/image/upload.png" alt="" />
                          </div>
                          <div class="upload-image-format4">
                            <p>
                              .PDF .JPG .PNG .DOC
                            </p>
                          </div>
                          <div class="upload-detail4">
                            <h4>You can also upload files by</h4>
                            <div class="upload-clicking4">
                              <a href="#" class="">Clicking here</a>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="file-upload-content4">
                      <img class="file-upload-image4" src="#" alt="your image" />
                      <div class="image-title-wrap4">
                        <button type="button" onclick="removeUpload4()" class="btn remove-image4">
                          Remove
                          <span class="image-title4" style="display: none;">Uploaded
                            Image</span>
                        </button>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="modal-footer mf">
              <button type="button" onclick="addproductfield()" class="btn btn-primary">
                <img src="../public/image/tick (1).png" alt="" />
              </button>
            </div>
          </div>
        </div>
      </div>
    </form>
    <!-- edit modal -->
    <form class="childcatagories_modal_from" id="modal-form" action="">
      <div class="modal fade" id="add_payment_modal_edit" tabindex="-1" role="dialog"
        aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered" role="document">
          <div class="modal-content">
            <div class="modal-header mh">
              <button type="button" class="close closmodel" data-dismiss="modal" aria-label="Close"
                onclick="colsemodel()">
                <span aria-hidden="true">&times;</span>
              </button>
            </div>
            <div class="modal-body mb">
              <div>
                <div class="cat-folder-img">
                  <i class="fa fa-folder" aria-hidden="true"></i>
                </div>
              </div>
              <div class="form-group">
                <label for="cat-name-upload" class="customer-add-input-label txt-regular upload-input-label">
                  Name</label>
                <input type="text" id="addpro_cat" name="addpro_cat" placeholder="Enter Payment Name" value=""
                  class="customer-add-input  w-100" />
              </div>
              <div class="form-group">
                <label for="cat-name-upload"
                  class="customer-add-input-label txt-regular upload-input-label">Price/Distance</label>
                <input type="text" id="addpro_cat" name="pri_dis" placeholder="Enter Price and distance" value=""
                  class="customer-add-input  w-100" />
              </div>
              <div class="form-group">
                <label for="cat-name-upload" class="customer-add-input-label txt-regular upload-input-label">Waiting
                  price/Condition</label>
                <input type="text" id="addpro_cat" name="pri_con" placeholder="Enter Waiting Price and Condition"
                  value="" class="customer-add-input  w-100" />
              </div>
              <div class="form-group">
                <label for="cat-name-upload" class="customer-add-input-label txt-regular upload-input-label">Ride
                  Category</label>
                <input type="text" id="addpro_cat" name="rid_cat" placeholder="Enter Ride Category" value=""
                  class="customer-add-input  w-100" />
              </div>
              <div class="form-group">
                <label for="cat-name-upload"
                  class="customer-add-input-label txt-regular upload-input-label">Country</label>
                <input type="text" id="addpro_cat" name="rid_cat" placeholder="Enter country Name" value=""
                  class="customer-add-input  w-100" />
              </div>
              <div class="form-group">
                <label for="cat-name-upload"
                  class="customer-add-input-label txt-regular upload-input-label">City</label>
                <input type="text" id="addpro_cat" name="rid_cat" placeholder="Enter city Name" value=""
                  class="customer-add-input  w-100" />
              </div>
              <div class="form-group">
                <label for="cat-name-upload"
                  class="customer-add-input-label txt-regular upload-input-label">Tagline</label>
                <input type="text" id="addpro_cat" name="tagline" placeholder="Enter  tagline" value=""
                  class="customer-add-input  w-100" />
              </div>


              <div>
                <div>
                  <div class="upload-text-heading">
                    <h5 class="coupon-code-main-heading txt-regular">
                      Upload Picture
                    </h5>
                  </div>
                  <div>
                    <p class="upload-main-paragraph txt-label2">
                      Drag and drop your files here
                    </p>
                  </div>
                </div>
                <div class="card text-center uload-card">
                  <div class="file-upload4">
                    <div class="image-upload-wrap4">
                      <input class="file-upload-input4" type="file" onchange="readURL4(this);" accept="image/*" />
                      <div class="drag-text4">
                        <div class="card-body upload-card-body4">
                          <div class="upload-img4">
                            <img src="../public/image/upload.png" alt="" />
                          </div>
                          <div class="upload-image-format4">
                            <p>
                              .PDF .JPG .PNG .DOC
                            </p>
                          </div>
                          <div class="upload-detail4">
                            <h4>You can also upload files by</h4>
                            <div class="upload-clicking4">
                              <a href="#" class="">Clicking here</a>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="file-upload-content4">
                      <img class="file-upload-image4" src="#" alt="your image" />
                      <div class="image-title-wrap4">
                        <button type="button" onclick="removeUpload4()" class="btn remove-image4">
                          Remove
                          <span class="image-title4" style="display: none;">Uploaded
                            Image</span>
                        </button>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div class="modal-footer mf">
              <button type="button" onclick="addproductfield()" class="btn btn-primary">
                <img src="../public/image/tick (1).png" alt="" />
              </button>
            </div>
          </div>
        </div>
      </div>
    </form>
    <!-- subcatgory Modal start -->
    <form action="" class="subcatgory_Modal_form">
      <div class="modal fade" id="addpro_subcategories" tabindex="-1" role="dialog"
        aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered" role="document">
          <div class="modal-content">
            <div class="modal-header mh">
              <button type="button" class="close closmodel" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span>
              </button>
            </div>
            <div class="modal-body mb">
              <div>
                <div class="cat-folder-img">
                  <i class="fa fa-folder" aria-hidden="true"></i>
                </div>
              </div>
              <label for="addpro_subcatagory-add"
                class="customer-add-input-label txt-regular upload-input-label">SubCategory
                Name</label>

              <input type="text" id="addpro_subcatagory-add" name="addpro_subcatagory-add" placeholder="Woman Clothes"
                value="" class="customer-add-input w-100" />

            </div>
            <div class="modal-footer mf">
              <button type="button" onclick="addprosubcat()" class="btn btn-primary">
                <img src="../public/image/tick (1).png" alt="" />
              </button>
            </div>
          </div>
        </div>
      </div>
    </form>
    <!-- subcatgory Modal End -->

    <!-- Bootstrap core JavaScript -->
    <script src="../vendor/jquery/jquery.min.js"></script>
    <script src="../vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
    <script src="../public/js/customjs.js"></script>

    <!-- Menu Toggle Script -->
    <script>
      $(document).ready(function () {
        // $('').addclass('active');
        $("#page_0").addClass("active");
      })
      $("#menu-toggle").click(function (e) {
        e.preventDefault();
        $("#wrapper").toggleClass("toggled");
      });

      $('.list_brands_active').addClass('active');
    </script>
    <!-- DIsable and Enable Functionality -->
    <script>

        $(document).ready(function (){
            retrieveallBrands();

            function retrieveallBrands(search = null,brand_id = null) {
                sendRequest("?action_type=retrieve&request_type=brand&functionality_type=retrieve_all_brands", {
                    page: 1,
                    search:search,
                    brand_id:brand_id,

                }, "POST")
                    .then((data) => {
                        var data = JSON.parse(data);
                        if (data.code == "202") {
                            $(".pagination").html(data.pagination);
                            // $("#paginate").html(data.htmlData);
                            $("#brand-table-id").empty();
                            var list = data.listOfData;

                            for (var i = 0; i < list.length; i++) {


                                // console.log("Data  Id = " + list[i].id + " Name = " + list[i].logo + " enable = " + list[i].name);
                                var n = list[i].id;
                                var name = list[i].name;
                                var images = list[i].images;
                                var category_name = list[i].category_name;
                                var total_follwers = list[i].total_follwers;
                                var product_count = list[i].product_count;
                                var sales = list[i].sales;
                                var avg_ratings = list[i].avg_ratings;
                                // var status = list[i].status;
                                // var status_class ="";
                                // if(status == "Active"){
                                //     status_class ="span_new";
                                // }
                                // else {
                                //     status_class ="span_disable";
                                // }





                                var enable = list[i].enable;
                                var checked = "";
                                if (enable == 0) {

                                    checked = "value='0'";
                                } else {

                                    checked = "value='1'  checked";
                                }



                                var text = '<tr id="brand-row-'+n+'">'+
                                    '<td><img class="brand_img" src="'+images+'" alt="">'+
                                    '</td>'+
                                    '<td>'+name+'</td>'+
                                    '<td>'+category_name+'</td>'+
                                    '<td>'+total_follwers+'</td>'+
                                    '<td>'+product_count+'</td>'+
                                    '<td>'+sales+'</td>'+
                                    '<td>'+avg_ratings+'</td>'+
                                    '<td>'+
                                    '<div class="">'+
                                    '<a href="../admin_panel/editBrand.php?id='+n+'"><button data-toggle="modal" data-id="'+n+'"  id="editmodal"'+
                                    'type="button" class="btn btn-outline-white2 btn-rounded btn-sm">'+
                                    '<i class="fas fa-pencil-alt fa-pencil-alt2 mt-0"></i>'+
                                    '</button></a>'+
                                    '<button type="button" onclick="deleteBrands('+n+')" class="btn btn-outline-white2 btn-rounded btn-sm">'+
                                    '<i class="far fa-trash-alt fa-trash-alt2 mt-0"></i>'+
                                    '</button>'+
                                    '</div>'+
                                    '</td>'+
                                    '<td>'+
                                    '<label class="switch">'+
                                    '<input type="checkbox" data-id="'+n+'" id="enable-switch-'+n+'" class="brand_switch" '+checked+'>'+
                                    '<span class="slider round"></span>'+
                                    '</label>'+

                                    '</td>'+
                                    '</tr>';
                                $("#brand-table-id").append(text);




                            }



                        }
                        else if (data.code == "206") {
                            console.log("Failed to Delete");
                        }

                    })
                    .catch((error) => {
                        console.log(error)
                    });
            }

            $('#search-Brand').keyup(function () {
                var search = $(this).val();
                var brand_id = $('#category-select-id').val();
                retrieveallBrands(search,brand_id);
                // console.log(query)
            });
            $('#category-select-id').change(function () {
                var brand_id = $(this).val();
                var search = $('#search-Brand').val();
                retrieveallBrands(search,brand_id);
                // console.log(search)
            });

            $(document).on('change','.brand_switch',function (){

                var id=$(this).data('id');
                var enable_val;
                // var from = $(".from_input").val();
                // var to_weight = $(".to_weight_input").val();
                if ($("#enable-switch-"+id).is(':checked')) {
                    $("#enable-switch-"+id).val(1);
                    enable_val = "1";
                } else {
                    $("#enable-switch-"+id).val(0);
                    enable_val = "0";
                }


                sendRequest("?action_type=update&request_type=brand&functionality_type=update_enable_data", {
                    id: id,
                    enable_val: enable_val,
                }, "POST")
                    .then((data) => {
                        var data = JSON.parse(data);
                        if(data.code == "202"){
                            // $("#sub_packages_modal_form_id").modal('hide');
                            // retrieveAllShipping(1);
                        }


                    })
                    .catch((error) => {
                        console.log(error)
                    })

            });


        });

        function deleteBrands (id) {
            var del_id =id;

            sendRequest("?action_type=delete&request_type=brand&functionality_type=delete_brand_data", {
                id:del_id,




            }, "POST")
                .then((data) => {
                    var data = JSON.parse(data);
                    if(data.code == "202"){
                        $("#brand-row-"+del_id).remove();

                        // $("#sub_child_packages_modal_form_id").modal('hide');
                        // retrieveAllShipping(1);
                    }


                })
                .catch((error) => {
                    console.log(error)
                })
        }

        function pag(offset,id) {

            var offset =offset;
            var active= $(".pagination").find('.active');
            active.removeClass("active");
            $("#pag-"+id).addClass("active");
            var search = $("#brand-search").val();
            var category_id = $("#category-select-id").val();

            var category=""
            if(category_id = ""){
                category =""
            }else {
                category = category_id;
            }
            var searchset=""
            if(search = ""){
                searchset =""
            }else {
                searchset = search;
            }
            sendRequest("?action_type=retrieve&request_type=brand&functionality_type=pagination", {
                offset:offset,
                search:search,
                brand_id:category,

            }, "POST")
                .then((data) => {
                    var data = JSON.parse(data);
                    if (data.code == "202") {
                        // $(".pagination").html(data.pagination);
                        // $("#paginate").html(data.htmlData);
                        $("#brand-table-id").empty();
                        var list = data.listOfData;

                        for (var i = 0; i < list.length; i++) {


                            // console.log("Data  Id = " + list[i].id + " Name = " + list[i].logo + " enable = " + list[i].name);
                            var n = list[i].id;
                            var name = list[i].name;
                            var images = list[i].images;
                            var category_name = list[i].category_name;
                            var total_follwers = list[i].total_follwers;
                            var product_count = list[i].product_count;
                            var sales = list[i].sales;
                            var avg_ratings = list[i].avg_ratings;
                            // var status = list[i].status;
                            // var status_class ="";
                            // if(status == "Active"){
                            //     status_class ="span_new";
                            // }
                            // else {
                            //     status_class ="span_disable";
                            // }





                            var enable = list[i].enable;
                            var checked = "";
                            if (enable == 0) {

                                checked = "value='0'";
                            } else {

                                checked = "value='1'  checked";
                            }



                            var text = '<tr id="brand-row-'+n+'">'+
                                '<td><img class="brand_img" src="'+images+'" alt="">'+
                                '</td>'+
                                '<td>'+name+'</td>'+
                                '<td>'+category_name+'</td>'+
                                '<td>'+total_follwers+'</td>'+
                                '<td>'+product_count+'</td>'+
                                '<td>'+sales+'</td>'+
                                '<td>'+avg_ratings+'</td>'+
                                '<td>'+
                                '<div class="">'+
                                '<a href="../admin_panel/editBrand.php?id='+n+'"><button data-toggle="modal" data-id="'+n+'"  id="editmodal"'+
                                'type="button" class="btn btn-outline-white2 btn-rounded btn-sm">'+
                                '<i class="fas fa-pencil-alt fa-pencil-alt2 mt-0"></i>'+
                                '</button></a>'+
                                '<button type="button" onclick="deleteBrands('+n+')" class="btn btn-outline-white2 btn-rounded btn-sm">'+
                                '<i class="far fa-trash-alt fa-trash-alt2 mt-0"></i>'+
                                '</button>'+
                                '</div>'+
                                '</td>'+
                                '<td>'+
                                '<label class="switch">'+
                                '<input type="checkbox" data-id="'+n+'" id="enable-switch-'+n+'" class="brand_switch" '+checked+'>'+
                                '<span class="slider round"></span>'+
                                '</label>'+

                                '</td>'+
                                '</tr>';
                            $("#brand-table-id").append(text);




                        }



                    }
                    else if (data.code == "206") {
                        console.log("Failed to Delete");
                    }

                })
                .catch((error) => {
                    console.log(error)
                });
        }


    </script>

</body>

</html>