<!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>Disputs</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>Disputs</h1>

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

            <div class="sort_btn">
              <a href="" data-toggle="modal" data-target="#add_payment_modal"><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</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">-->
<!---->
<!--                          <select class="form-control">-->
<!--                            <option>City</option>-->
<!--                            <option>2</option>-->
<!--                            <option>3</option>-->
<!--                            <option>4</option>-->
<!--                            <option>5</option>-->
<!--                          </select>-->
<!--                        </div>-->
<!--                        <div class="form-group mr-3">-->
<!---->
<!--                          <select class="form-control">-->
<!--                            <option>Country</option>-->
<!--                            <option>2</option>-->
<!--                            <option>3</option>-->
<!--                            <option>4</option>-->
<!--                            <option>5</option>-->
<!--                          </select>-->
<!--                        </div>-->
<!--                        <div class="form-group mr-3">-->
<!--                          <label for="exampleFormControlSelect1">Show:</label>-->
<!--                          <select class="form-control" id="exampleFormControlSelect1">-->
<!--                            <option>20</option>-->
<!--                            <option>2</option>-->
<!--                            <option>3</option>-->
<!--                            <option>4</option>-->
<!--                            <option>5</option>-->
<!--                          </select>-->
<!--                        </div>-->
                      </div>

                      <span class="page_head">Results Per Page</span>
                      <ul class="pagination pagination-sm">
<!--                        <li class="page-item"><a class="page-link page_pre" href="#"><span><i-->
<!--                                class="fas fa-angle-left"></i></span></a></li>-->
<!--                        <li class="page-item"><a class="page-link" href="#">1</a></li>-->
<!--                        <li class="page-item"><a class="page-link" href="#">2</a></li>-->
<!--                        <li class="page-item"><a class="page-link" href="#">...</a></li>-->
<!--                        <li class="page-item"><a class="page-link" href="#">19</a></li>-->
<!--                        <li class="page-item"><a class="page-link page_next" href="#"><span><i-->
<!--                                class="fas fa-angle-right"></i></span></a></li>-->
                      </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="dispute-search" placeholder="Searching for.." aria-label="Username"
                          aria-describedby="basic-addon1">
                      </div>
                    </form>

                  </div>

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

                        <th>Product Picture</th>
                        <th>User Name</th>
                        <th>Product Name</th>
                        <th>Brand Name</th>
                          <th>Price</th>
                          <th>Action</th>
                      </tr>
                    </thead>
                    <tbody id="dispute-table-body">
                      <tr>
                          <td><img src="../public/image/person.jpg" alt=""></td>
                        <td><span>Alex</span>
                        </td>
                        <td>pepsi</td>
                          <td>pepsi</td>
                          <td>Pic</td>
                        <td>
                          <div class="reject_accept_div">
                            <span class="reject"><i class="fas fa-times"></i></span>
                            <span class="accept"><i class="fas fa-check"></i></span>
                          </div>
                        </td>


                      </tr>

                      <tr>

                        <td><span>1232</span>
                        </td>
                        <td>pepsi</td>
                        <td><img src="../public/image/person.jpg" alt=""></td>
                        <td>Pic</td>
                        <td>
                          <div class="reject_accept_div">
                            <span class="reject"><i class="fas fa-times"></i></span>
                            <span class="accept"><i class="fas fa-check"></i></span>
                          </div>
                        </td>

                      </tr>

                      <tr>

                        <td><span>1232</span>
                        </td>
                        <td>pepsi</td>
                        <td><img src="../public/image/person.jpg" alt=""></td>
                        <td>Pic</td>
                        <td>
                          <div class="reject_accept_div">
                            <span class="reject"><i class="fas fa-times"></i></span>
                            <span class="accept"><i class="fas fa-check"></i></span>
                          </div>
                        </td>
                      </tr>
                      <tr>
                        <td><span>1232</span>
                        </td>
                        <td>pepsi</td>
                        <td><img src="../public/image/person.jpg" alt=""></td>
                        <td>Pic</td>
                        <td>
                          <div class="reject_accept_div">
                            <span class="reject"><i class="fas fa-times"></i></span>
                            <span class="accept"><i class="fas fa-check"></i></span>
                          </div>
                        </td>
                      </tr>
                    </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">S.No</label>
                <input type="text" id="addpro_cat" name="driver_name" placeholder="Enter Serial No" 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"> Date &
                  Time</label>
                <input type="datetime-local" id="addpro_cat" name="driver_no" placeholder="Enter Phone No" 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"> Rider
                  Name</label>
                <input type="text" id="addpro_cat" name="driver_Email" placeholder="Enter Rider 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"> Driver
                  Name</label>
                <input type="text" id="addpro_cat" name="total_trips" placeholder="Enter driver 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">
                  Fare</label>
                <input type="text" id="addpro_cat" name="total_revenue" placeholder="Enter Fare" value=""
                  class="customer-add-input  w-100" />
              </div>
              <div class="form-group form_select">
                <label for="select_author">Vechile Category</label>
                <select class="form-control selectpicker" id="select_payment">
                  <option>Luxury</option>
                  <option>Bill Gordon</option>
                  <option>Elizabeth Warren</option>
                  <option>Mario Flores</option>
                  <option>Don Young</option>
                  <option disabled="disabled">Marvin
                    Martinez</option>
                </select>
              </div>
              <div class="form-group">
                <label for="cat-name-upload" class="customer-add-input-label txt-regular upload-input-label">
                  Status</label>
                <input type="text" id="addpro_cat" name="status" placeholder="Enter Status" 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
                  Now</label>
                <input type="text" id="addpro_cat" name="ratings" placeholder="Enter Ridings" 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">
                  Pre-bookings</label>
                <input type="text" id="addpro_cat" name="ratings" placeholder="Enter bookings" 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">S.No</label>
                <input type="text" id="addpro_cat" name="driver_name" placeholder="Enter Serial No" 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"> Date &
                  Time</label>
                <input type="datetime-local" id="addpro_cat" name="driver_no" placeholder="Enter Phone No" 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"> Rider
                  Name</label>
                <input type="text" id="addpro_cat" name="driver_Email" placeholder="Enter Rider 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"> Driver
                  Name</label>
                <input type="text" id="addpro_cat" name="total_trips" placeholder="Enter driver 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">
                  Fare</label>
                <input type="text" id="addpro_cat" name="total_revenue" placeholder="Enter Fare" value=""
                  class="customer-add-input  w-100" />
              </div>
              <div class="form-group form_select">
                <label for="select_author">Vechile Category</label>
                <select class="form-control selectpicker" id="select_payment">
                  <option>Luxury</option>
                  <option>Bill Gordon</option>
                  <option>Elizabeth Warren</option>
                  <option>Mario Flores</option>
                  <option>Don Young</option>
                  <option disabled="disabled">Marvin
                    Martinez</option>
                </select>
              </div>
              <div class="form-group">
                <label for="cat-name-upload" class="customer-add-input-label txt-regular upload-input-label">
                  Status</label>
                <input type="text" id="addpro_cat" name="status" placeholder="Enter Status" 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
                  Now</label>
                <input type="text" id="addpro_cat" name="ratings" placeholder="Enter Ridings" 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">
                  Pre-bookings</label>
                <input type="text" id="addpro_cat" name="ratings" placeholder="Enter bookings" value=""
                  class="customer-add-input  w-100" />
              </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>

    <!-- 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>
      $("#menu-toggle").click(function (e) {
        e.preventDefault();
        $("#wrapper").toggleClass("toggled");
      });
    

      $('.disput_active').addClass('active');
    </script>
      <script>

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

              function retrieveallDispute(search = '') {
                  sendRequest("?action_type=retrieve&request_type=dispute&functionality_type=retrieve_all_diepute", {
                      search:search,

                  }, "POST")
                      .then((data) => {
                          var data = JSON.parse(data);
                          if (data.code == "202") {

                              $(".pagination").html(data.pagination);
                              $("#dispute-table-body").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 user_name = list[i].user_name;
                                  var product_name = list[i].product_name;
                                  var pro_image = list[i].pro_image;
                                  var brand_name = list[i].brand_name;
                                  var discounted_amount = list[i].discounted_amount;
                                  var order_price = list[i].order_price;
                                  var coupons_id = list[i].coupons_id;

                                  var dipute_status = list[i].dipute_status;


                                  // var usage_count = list[i].usage_count;
                                  // var duration_limit = list[i].duration_limit;
                                  // var user_limit = list[i].user_limit;
                                  // var status = list[i].status;
                                  var status_class ="";
                                  var status_name ="";
                                  if(dipute_status == "0"){
                                      status_class ="refund_pending";
                                      status_name ="Pending";
                                  }
                                  else if (dipute_status == "1") {
                                      status_class ="span_completed";
                                      status_name ="Completed";
                                  }







                                  var enable = list[i].enable;
                                  var refund_price = "";
                                  if (coupons_id !== "") {

                                      refund_price = discounted_amount;
                                  } else {

                                      refund_price = order_price;
                                  }



                                  var text = "<tr>\n" +
                                      "                          <td><img src=\""+pro_image+"\" alt=\"\"></td>\n" +
                                      "                        <td><span>"+user_name+"</span>\n" +
                                      "                        </td>\n" +
                                      "                        <td>"+product_name+"</td>\n" +
                                      "                          <td>"+brand_name+"</td>\n" +
                                      "                          <td>"+refund_price+"</td>\n" +

                                      "                        <td>\n" +
                                      "                          <div class=\"reject_accept_div\">\n" +
                                      "                            <span class=\"reject\" onclick=\"addrejectid("+n+")\"><i class=\"fas fa-times\"></i></span>\n" +
                                      "                            <span class=\"accept\" onclick=\"addacceptid("+n+")\"><i class=\"fas fa-check\"></i></span>\n" +
                                      "                          </div>\n" +
                                      "                        </td>\n" +
                                      "\n" +
                                      "\n" +
                                      "                      </tr>";
                                  $("#dispute-table-body").append(text);




                              }



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

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

              $('#dispute-search').keyup(function () {
                  var search = $(this).val();
                  retrieveallDispute(search);
                  // console.log(query)
              });

              // $(document).on('click','.addrefundstatus',function (){
              //
              //     var id=$("#refund-id").val();
              //     var val=$(".responce_val").val();
              //     sendRequest("?action_type=update&request_type=refund&functionality_type=update_accept_data", {
              //         id: id,
              //         status: val,
              //     }, "POST")
              //         .then((data) => {
              //             var data = JSON.parse(data);
              //             if(data.code == "202"){
              //                 retrieveallRefund();
              //                 $("#accepted_refund").modal("hide");
              //             }
              //
              //
              //         })
              //         .catch((error) => {
              //             console.log(error)
              //         })
              //
              // });
              //
              // $(document).on('click','.addrejectstatus',function (){
              //
              //     var id=$("#refund-id").val();
              //     var val=$(".responce_val_reject").val();
              //     sendRequest("?action_type=update&request_type=refund&functionality_type=update_reject_data", {
              //         id: id,
              //         status: val,
              //     }, "POST")
              //         .then((data) => {
              //             var data = JSON.parse(data);
              //             if(data.code == "202"){
              //                 retrieveallRefund();
              //                 $("#reject_refund").modal("hide");
              //             }
              //
              //
              //         })
              //         .catch((error) => {
              //             console.log(error)
              //         })
              //
              // });



          });

          function addrejectid(id){
              var reject_id= id;
              sendRequest("?action_type=update&request_type=dispute&functionality_type=update_reject_data", {
                  id: reject_id,
                  status:"reject"

              }, "POST")
                  .then((data) => {
                      var data = JSON.parse(data);
                      if(data.code == "202"){
                          // retrieveallRefund();
                          // $("#reject_refund").modal("hide");
                      }


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

          function addacceptid(id){
              var reject_id= id;
              sendRequest("?action_type=update&request_type=dispute&functionality_type=update_accept_data", {
                  id: reject_id,
                  status:"ok"

              }, "POST")
                  .then((data) => {
                      var data = JSON.parse(data);
                      if(data.code == "202"){
                          // retrieveallRefund();
                          // $("#reject_refund").modal("hide");
                      }


                  })
                  .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 = $("#dispute-search").val();
              var searchset="";
              if(search = ""){
                  searchset ="";
              }else {
                  searchset = search;
              }
              sendRequest("?action_type=retrieve&request_type=dispute&functionality_type=pagination", {
                  offset:offset,
                  search:searchset,
              }, "POST")
                  .then((data) => {
                      var data = JSON.parse(data);
                      if (data.code == "202") {

                          // $(".pagination").html(data.pagination);
                          $("#dispute-table-body").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 user_name = list[i].user_name;
                              var product_name = list[i].product_name;
                              var pro_image = list[i].pro_image;
                              var brand_name = list[i].brand_name;
                              var discounted_amount = list[i].discounted_amount;
                              var order_price = list[i].order_price;
                              var coupons_id = list[i].coupons_id;

                              var dipute_status = list[i].dipute_status;


                              // var usage_count = list[i].usage_count;
                              // var duration_limit = list[i].duration_limit;
                              // var user_limit = list[i].user_limit;
                              // var status = list[i].status;
                              var status_class ="";
                              var status_name ="";
                              if(dipute_status == "0"){
                                  status_class ="refund_pending";
                                  status_name ="Pending";
                              }
                              else if (dipute_status == "1") {
                                  status_class ="span_completed";
                                  status_name ="Completed";
                              }







                              var enable = list[i].enable;
                              var refund_price = "";
                              if (coupons_id !== "") {

                                  refund_price = discounted_amount;
                              } else {

                                  refund_price = order_price;
                              }



                              var text = "<tr>\n" +
                                  "                          <td><img src=\""+pro_image+"\" alt=\"\"></td>\n" +
                                  "                        <td><span>"+user_name+"</span>\n" +
                                  "                        </td>\n" +
                                  "                        <td>"+product_name+"</td>\n" +
                                  "                          <td>"+brand_name+"</td>\n" +
                                  "                          <td>"+refund_price+"</td>\n" +

                                  "                        <td>\n" +
                                  "                          <div class=\"reject_accept_div\">\n" +
                                  "                            <span class=\"reject\" onclick=\"addrejectid("+n+")\"><i class=\"fas fa-times\"></i></span>\n" +
                                  "                            <span class=\"accept\" onclick=\"addacceptid("+n+")\"><i class=\"fas fa-check\"></i></span>\n" +
                                  "                          </div>\n" +
                                  "                        </td>\n" +
                                  "\n" +
                                  "\n" +
                                  "                      </tr>";
                              $("#dispute-table-body").append(text);




                          }



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

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

      </script>

</body>

</html>