Edit File: blocked_delegates.blade.php
@extends('layouts.delegates_dashboard_layout') @section('title') {{Session::has('lang')&&Session::get('lang')=='en'?'blocked delegates':' المندوبين المحظورين'}} @endsection @section('style') @endsection @section('content') <div class="table-cont p-2 "> <div class="row align-items-center"> <div class="dash-title col-md p-0 "> <h6 class="bold">{{trans('delegates_dashboard.block_delegates')}}</h6> <p class="mb-1">{{trans('delegates_dashboard.show_block_delegates')}}</p> </div> <div class="form-group col-md p-0 m-0 "> <div class="row align-items-center justify-content-between "> <div class="col m-2 p-0 password-cont"> <input type="text" class="form-control" id="dataTableSearchInput1" aria-describedby="emailHelp" placeholder=" {{trans('delegates_dashboard.key_words')}}"> <i class="fa fa-search color-gray" ></i> </div> <form method="post" action="{{route('delegates_dashboard.download_all_delegates')}}"> @csrf <input type="hidden" name="type" value="block"> <div class=" p-0 text-align2 "> <a ><button type="submit" class="btn btn-warning font12 color-white"> <i class="fa m-2 fa-file-excel"></i> {{trans('delegates_dashboard.excel')}} </button></a> </div> </form> </div> </div> </div> <table id="dataTable1" data-order='[[ 1, "asc" ]]' data-page-length='25' class="table text-center table-striped table-ed" style="width:100%"> <thead class="table-head"> <tr > <th class="font10">{{trans('delegates_dashboard.number')}}</th> <th class="font10">{{trans('delegates_dashboard.avatar')}}</th> <th class="font10">{{trans('delegates_dashboard.name')}}</th> <th class="font10">{{trans('delegates_dashboard.phone')}}</th> <th class="font10">{{trans('delegates_dashboard.nationality')}}</th> <th class="font10">{{trans('delegates_dashboard.city')}}</th> <th class="font10">{{trans('delegates_dashboard.status')}}</th> <th class="font10">{{trans('delegates_dashboard.recent_order')}}</th> <th class="font10">{{trans('delegates_dashboard.created_at')}}</th> <th></th> </tr> </thead> <tbody data-class-name="table-body"> @foreach($delegates as $delegate) <tr > <td>{{$delegate->id}}</td> <td> <img src="{{$delegate->delegateJoinRequests()->first()?URL::to('assets/uploads/users/'.$delegate->delegateJoinRequests()->first()->personal_image):''}}" style="max-width: 60px;" alt=""> </td> <td>{{$delegate->name}}</td> <td>0{{$delegate->phone}}</td> <td>{{$delegate->delegateJoinRequests->first()?->nationality->name}}</td> <td>{{$delegate->delegateJoinRequests->first()?->city->name}}</td> <td>{{trans('delegates_dashboard.'.$delegate->status)}}</td> <td>{{$delegate->delegateOrders()->where('status','inprogress')->count() > 0 ?trans('delegates_dashboard.yes'):trans('delegates_dashboard.no')}}</td> <td>{{Carbon\Carbon::parse($delegate->delegateJoinRequests->first()?->created_at->addHours(2))->format('d/m/Y - H:i A')}}</td> <td class="table-menu"> <i onclick="openTableMenu(this)" class=" cp p-2 fa fa-ellipsis-h"></i> <div class="menu-cont"> <ul class="white-bg round7 pt-1 pb-1 shadow1"> <li> <a href="{{route('delegates_dashboard.delegate_details',$delegate->id)}}"><i class="far fa-eye color1"></i>{{trans('delegates_dashboard.more')}}</a> </li> <li class="border-bottom"></li> <form id="activeForm"> @csrf <input type="hidden" name="status" value="active"> <input type="hidden" name="user_id" value="{{$delegate->id}}"> <li> <a type="button" id="activebtn"><i class="fa fa-user-lock color-red"></i> {{trans('delegates_dashboard.active')}}</a> </li> </form> <li class="border-bottom"></li> <input type="hidden" id="deleted_user" value="{{$delegate->id}}"> <form id="deleteform"> @csrf <input type="hidden" id="user" name="user_id" value=""> </form> <li> <a href="#" name="{{$delegate->id}}" onclick="deleteElement()"><i class="far fa-trash-alt color-red"></i> {{trans('delegates_dashboard.delete')}}</a> </li> </ul> </div> </td> </tr> @endforeach </tbody> </table> </div> @endsection @section('scripts') <script> $(document).on('click','#inactivebtn',function (e) { e.preventDefault(); //get form data var form = $('#inactiveform').get(0); var formData = new FormData(form); $.ajax({ url: "{{route('delegates_dashboard.update_delegate_status')}}", type: "POST", data: formData, dataType: "json", processData: false, contentType: false, cache: false, success: function (data) { //got a resposne? if (data.key == 'success') { Swal.fire({ icon: 'success', title: '<h5 class="bold">'+data.msg+'</h5>', showConfirmButton: false, timer: 1500 }); location.reload(); } else { swal.fire({ title: data.msg, type: 'error', timer: 3000, showCloseButton: true, showConfirmButton: false, animation: true, }).catch(swal.noop); } } }); }); </script> <script> $(document).on('click','#activebtn',function (e) { e.preventDefault(); //get form data var form = $('#activeForm').get(0); var formData = new FormData(form); $.ajax({ url: "{{route('delegates_dashboard.update_delegate_status')}}", type: "POST", data: formData, dataType: "json", processData: false, contentType: false, cache: false, success: function (data) { //got a resposne? if (data.key == 'success') { Swal.fire({ icon: 'success', title: '<h5 class="bold">'+data.msg+'</h5>', showConfirmButton: false, timer: 1500 }); location.reload(); } else { swal.fire({ title: data.msg, type: 'error', timer: 3000, showCloseButton: true, showConfirmButton: false, animation: true, }).catch(swal.noop); } } }); }); </script> <script> function deleteElement(){ Swal.fire({ var button = event.target; var user = button.name; $('#user').val(user); title: '<h5 class="bold">{{trans('delegates_dashboard.delete_it')}}</h5>', icon: 'warning', html:'<p>{{trans('delegates_dashboard.delete_desc')}}</p> ' +'<div class="row">' +' <div class="col"><button class="button1 deletebtn w-100" >{{trans('delegates_dashboard.delete')}}</button></div>' +' <div class="col"><button class="button3 w-100" onclick="Swal.clickCancel()" >{{trans('delegates_dashboard.return')}}</button></div>' +'</div>', showCancelButton: false, showConfirmButton: false, }) } </script> <script> $(function(){ $('.side-button .active').siblings('.side-dropdown').slideDown(); }); </script> <script> $(document).on('click',".deletebtn",function(e){ e.preventDefault(); var form = $('#deleteform').get(0); var formData = new FormData(form); var oldText = $(this).text(); $(this).prop('disabled', true).css({ opacity:'0.5' }).text("{{trans('delegates_dashboard.loading')}}"); $.ajax({ url:"{{route('delegates_dashboard.delete_delegate')}}", type:"POST", data: formData, dataType: "json", processData: false, contentType: false, cache: false, success:function(data){ $('#deletebtn').removeAttr("disabled").css({ opacity:'1' }).text(oldText); if(data.key =='success'){ Swal.fire({icon: 'success', title: '<h5 class="bold">'+ data.msg +'</h5>', showConfirmButton: false, timer: 1500 }); location.reload(); }else{ Swal.fire({ title: data.msg, position:'top', timer: 3000, type:'error', showCloseButton: false, showConfirmButton:false, animation: true }) } } }); }); </script> @endsection
Back to File Manager