publication_list_load.blade.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. @extends('admin.sub_contents.base')
  2. @section('main')
  3. <div class="table-responsive mt-2">
  4. <table class="table table-bordered list_table" style="margin-bottom:10px;">
  5. <thead>
  6. <tr>
  7. <th style="width: 8%">Sl</th>
  8. <th style="width: 70%">Title</th>
  9. <th style="width: 12%">Status</th>
  10. <th style="width: 10%; text-align: center;">Action</th>
  11. </tr>
  12. </thead>
  13. <tbody>
  14. @if(count($publications) > 0)
  15. @foreach($publications as $key=>$row)
  16. <tr>
  17. <td style="font-size: 11px;">{{++$key}}</td>
  18. <td style="font-size: 11px;">{{$row->publication}}</td>
  19. <td style="font-size: 11px;">
  20. @if($row->status==1)
  21. <span>Published</span>
  22. @endif
  23. @if($row->status==2)
  24. <span>Under Review</span>
  25. @endif
  26. @if($row->status==3)
  27. <span>Draft stage</span>
  28. @endif
  29. </td>
  30. <div class="top_part_status" style="position: relative; width: fit-content;">
  31. <td class="text-center" style="width: 75px;">
  32. <div class="icon_bar" style="border: none;">
  33. <span class="edit_publication_info" data-id="{{$row->id}}" style="cursor: pointer;"><i class="fa fa-edit change_pass_btn" ></i></span>
  34. <span class="delete_publication_info" data-id="{{$row->id}}" style="cursor: pointer;"><i class="fa fa-trash change_pass_btn ms-1" ></i></span>
  35. </div>
  36. </td>
  37. </tr>
  38. <?php
  39. $edit_cls_name = "edit_cls_".$row->id;
  40. ?>
  41. <tr class="edit_data {{$edit_cls_name}} d-none">
  42. <td colspan="4">
  43. <div class="edit_publication_load"></div>
  44. </td>
  45. </tr>
  46. @endforeach
  47. @else
  48. <tr>
  49. <td colspan="4" class="text-center">
  50. <span class="text-danger">No publication available!</span>
  51. </td>
  52. </tr>
  53. @endif
  54. </tbody>
  55. </table>
  56. </div>
  57. @endsection
  58. <script>
  59. $(function(){
  60. $('.edit_publication_info').on('click', function(){
  61. $('.edit_publication_load').empty();
  62. var self = $(this);
  63. var id = self.attr("data-id");
  64. var edit_cls = "edit_cls_"+id;
  65. $('.edit_data').addClass('d-none');
  66. $("."+edit_cls).removeClass('d-none');
  67. var edit_publication_load = self.closest('tbody').find('.edit_publication_load');
  68. fetch_sub_content(
  69. edit_publication_load,
  70. "{!! route('sub-content', ['name'=>'edit_publication_load','action'=>'edit']) !!}&edit_id="+id
  71. );
  72. });
  73. $('.delete_publication_info').on('click', function(){
  74. var id = $(this).attr("data-id");
  75. var form_data={
  76. _token: "{{ csrf_token() }}",
  77. delete_id: id,
  78. }
  79. swal({
  80. title: "Are you sure?",
  81. text: "You will not be able to recover this data!",
  82. type: "warning",
  83. showCancelButton: true,
  84. confirmButtonClass: "btn-danger",
  85. cancelButtonClass: "btn-info",
  86. confirmButtonText: "Yes, delete!",
  87. cancelButtonText: "No, cancel!",
  88. }, function(isConfirm){
  89. if(isConfirm){
  90. $.post("{{ route('ajax-post', ['name'=>'delete_publication_info']) }}",form_data
  91. ).done(function(res){
  92. pop_up_msg(res.msg);
  93. $('#publication_load').empty();
  94. fetch_sub_content(
  95. '#publication_load',
  96. "{{ route('sub-content', ['name'=>'publication_list_load']) }}"
  97. );
  98. }).fail(function(err){
  99. pop_up_msg(err_msg(err), 'error');
  100. });
  101. }
  102. });
  103. });
  104. });
  105. </script>