@extends('admin.sub_contents.base') @section('main') @if(count($universities) > 0) <table class="table table-bordered list_table"> <thead> <tr> <th>Sl</th> <th>Designation</th> <th>University Name</th> <th>University website</th> <th style="text-align: center;">Action</th> </tr> </thead> <tbody style="border-style: dashed;"> @foreach($universities as $key=>$row) <tr> <td style="font-size: 11px;">{{++$key}}</td> <td style="font-size: 11px;">{{cn($row,'country.name','')}}</td> <td style="font-size: 11px;">{{$row->name}}</td> <td style="font-size: 11px;">{{$row->web_address}}</td> <td style="font-size: 11px; text-align: center;"> <span class="edit_uni_info" data-id="{{$row->id}}" style="cursor: pointer;"><i class="fa fa-edit" ></i></span> <span class="delete_uni_info" data-id="{{$row->id}}" style="cursor: pointer;"><i class="fa fa-trash ms-1" ></i></span> </td> </tr> <?php $edit_cls_name = "edit_cls_".$row->id; ?> <tr class="edit_data {{$edit_cls_name}} d-none"> <td colspan="5"> <div class="edit_university_load"></div> </td> </tr> @endforeach </tbody> </table> @endif @endsection <script> $(function(){ $('.edit_uni_info').on('click', function(){ $('.edit_university_load').empty(); var self = $(this); var id = self.attr("data-id"); var edit_cls = "edit_cls_"+id; $('.edit_data').addClass('d-none'); $("."+edit_cls).removeClass('d-none'); var edit_university_load = self.closest('tbody').find('.edit_university_load'); fetch_sub_content( edit_university_load, "{!! route('sub-content', ['name'=>'edit_university_load','action'=>'edit']) !!}&edit_id="+id ); }); $('.delete_uni_info').on('click', function(){ var id = $(this).attr("data-id"); var form_data={ _token: "{{ csrf_token() }}", delete_id: id, } swal({ title: "Are you sure?", text: "You will not be able to recover this data!", type: "warning", showCancelButton: true, confirmButtonClass: "btn-danger", cancelButtonClass: "btn-info", confirmButtonText: "Yes, delete!", cancelButtonText: "No, cancel!", }, function(isConfirm){ if(isConfirm){ $.post("{{ route('ajax-post', ['name'=>'delete_university_info']) }}",form_data ).done(function(res){ pop_up_msg(res.msg); $('#country_wise_university').empty(); fetch_sub_content( '#country_wise_university', "{{ route('sub-content', ['name'=>'country_wise_university']) }}" ); }).fail(function(err){ pop_up_msg(err_msg(err), 'error'); }); } }); }); }); </script>