<?php echo $__env->make('dashboard.include.header', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

  
  <div class="content-wrapper" style="">
    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1 class="m-0">City Update</h1>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="/home">Home</a></li>
              <li class="breadcrumb-item active">City Update</li>
            </ol>
          </div>
        </div>
      </div>
    </div>
   
    <section class="content">
      <div class="container-fluid">

      <div class="card">
        <div class="card-body">
        <form method="post" action="/cityupfilter">
          <?php echo e(csrf_field()); ?>

          <div class="row">
            <div class="col-md-4">
              <div class="form-group">
                <label>Filter Orders by Delivery Service</label>
                <select class="form-control" name="resellerid" id="resellerid" style="width: 100%;" required>
                    <option value="" selected="selected" disabled>Select</option>
                    <?php $__currentLoopData = $delivery; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $userdata): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($userdata->id); ?>" <?php if($userdata->id == $del): ?> selected <?php endif; ?>><?php echo e($userdata->deliveryname); ?></option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
            </div>
            </div>
            <div class="col-md-1" style="padding-top:30px;"><button type="submit" class="btn btn-block btn-primary">Filter</button> </div>
          </div>
          </form>
        </div>
      </div>
      <form method="post" id="formFilter" class="formFilter">
          <?php echo e(csrf_field()); ?>

          <input type="hidden" value="<?php echo e($del); ?>" name="resellerid">
        </form>


      <div class="card">
        <div class="card-body">
          <div class="row">
            <div class="col-md-12">
                <table data-page-length='500' id="example12" class="table table-striped table-hover" style="width:100%; font-size:12px;">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>Name</th>
                            <th>Address</th>
                            <th>City</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                </table>
            </div>
          </div><br><br>
        <form method="post" action="/sendoutprint">
        <?php echo e(csrf_field()); ?>

        <div class="row">
            <input type="hidden" name="delservice" id="delservice" value="<?php echo e($del); ?>">
            <div class="col-md-2"><button type="submit" name="adddelivery" value="adddelivery" class="btn btn-primary btn-block">Send to Out Print</button></div>
        </div>
        </form>

          </div>
        </div>

      </div>
    </section>
  </div>
 

<div class="modal fade" id="editordermodelphone" role="dialog">
        <div class="modal-dialog">
        
          <!-- Modal content-->
          <div class="modal-content">
            <div class="modal-header">
                    <h4 class="modal-title">City Update</h4>
              <button type="button" class="close" data-dismiss="modal">&times;</button>
              
            </div>
            
            <form method="post" class="deliveryupform">
            <?php echo e(csrf_field()); ?>

                <div class="modal-body">
                <input type="hidden" id="id" name="id">

               <div class="form-group">
                        <label>City :</label>
                    <select class="form-control select2" name="cituselect" id="cituselect">
                        <?php $__currentLoopData = $city; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cityd): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($cityd->id); ?>"><?php echo e($cityd->city_name); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div> 
                    
                </div>
                  
            <div class="modal-footer">
            <input type="submit" class="btn btn-primary right" value="Submit"/>
              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
            </form>
          </div>
          
        </div>

</div>

  <?php echo $__env->make('dashboard.include.footer', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>



<script>
$(function () {
    $('.select2').select2()
})


$('#resellerid').change(function() {
    var min = $(this).val();
    $('#example12').DataTable().ajax.reload();
});

$(document).ready(function() {
  var table = $('#example12').DataTable({
        "ajax": {   "url": '/cityupdatedatatable',
                    "type": 'POST',
                    "data": function ( d ) {
                    return $('.formFilter').serialize();
                    }
        },
        columns: [
            { data: 'id', name: 'id' },
            { data: 'name', name: 'name' },
            { data: 'address', name: 'address'},
            { data: 'citydata', name: 'citydata'},
            { data: 'action', name: 'action', orderable: false, searchable: false}
        ],
    });
} );

$('#editordermodelphone').on('show.bs.modal', function (event) {

var button = $(event.relatedTarget) // Button that triggered the modal

var id = button.data('id') 
var city = button.data('city') 
var modal = $(this)
//   modal.find('.modal-title').text('New message to ' + recipient)
modal.find('.modal-body #id').val(id)
$("#cituselect").val(city).change();

});

$('.deliveryupform').on('submit', function(event){
    let ele = this;
        event.preventDefault();
        var form_data = $(this).serialize();
        $.ajax({
            url:"/trancecityupdate",
            method:"POST",
            data:form_data,
            dataType:"json",      
            success: function (result, code, ex) {
                // swal("Done!", "It was successfully!", "success");
                toastr.success('City Update successfully!')
                $("#editordermodelphone").modal('hide');  
                $('#example12').DataTable().ajax.reload();
            },
            error: function (jqXHR, textStatus, errorThrown) {
                swal("Warning", "Unable to Process your request", "error");
            },
            
        })
    });




<?php if(session('success')): ?>
        //swal("Success!","<?php echo e(session('success')); ?>","success");

Swal.fire({
  
  type: 'success',
  title: 'Your work has been saved',
  text: "<?php echo e(session('success')); ?>",
  showConfirmButton: false,
  timer: 1500
});


<?php endif; ?>
<?php if(session('error')): ?>
    swal({
            title: "Error!",
            text: "<?php echo e(session('error')); ?>",
            icon: "error",
            button: "OK",
        });
<?php endif; ?>
</script>








