@extends('admin.sub_contents.base') @section('main') <div class="table-responsive mt-2"> @if(count($publications) > 0) <table class="table table-bordered list_table" style="margin-bottom:10px;"> <thead> <tr> <th style="width: 8%">Sl</th> <th style="width: 70%">Title</th> <th style="width: 12%">Status</th> <th style="width: 10%; text-align: center;">Action</th> </tr> </thead> <tbody> @foreach($publications as $key=>$row) <tr> <td style="font-size: 11px;">{{++$key}}</td> <td style="font-size: 11px;">{{$row->publication}}</td> <td style="font-size: 11px;"> @if($row->status==1) <span>Published</span> @endif @if($row->status==2) <span>Under Review</span> @endif @if($row->status==3) <span>Draft stage</span> @endif </td> <div class="top_part_status" style="position: relative; width: fit-content;"> <td class="text-center" style="width: 75px;"> <div class="icon_bar" style="border: none;"> <span class="edit_publication_info" data-id="{{$row->id}}" style="cursor: pointer; @if($is_freez_profile) pointer-events:none; @endif"><i class="fa fa-edit change_pass_btn" ></i></span> <span class="delete_publication_info" data-id="{{$row->id}}" style="cursor: pointer; @if($is_freez_profile) pointer-events:none; @endif"><i class="fa fa-trash change_pass_btn ms-1" ></i></span> </div> </td> </tr> <?php $edit_cls_name = "edit_cls_".$row->id; ?> <tr class="edit_data {{$edit_cls_name}} d-none"> <td colspan="4"> <div class="edit_publication_load"></div> </td> </tr> @endforeach </tbody> </table> @else <div class="alert mt-1 mb-3" style="border-color: #e9f0f3; font-size: 12px !important; color: #dc3545; border-radius: 30px; padding: 8px 15px;"> <span>No publication available.</span> </div> @endif </div> @endsection <script> $(function(){ $('.edit_publication_info').on('click', function(){ $('.edit_publication_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_publication_load = self.closest('tbody').find('.edit_publication_load'); fetch_sub_content( edit_publication_load, "{!! route('sub-content', ['name'=>'edit_publication_load','action'=>'edit']) !!}&edit_id="+id ); }); $('.delete_publication_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_publication_info']) }}",form_data ).done(function(res){ pop_up_msg(res.msg); $('#publication_load').empty(); fetch_sub_content( '#publication_load', "{{ route('sub-content', ['name'=>'publication_list_load']) }}" ); }).fail(function(err){ pop_up_msg(err_msg(err), 'error'); }); } }); }); }); </script>