publication_list_load.blade.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. @extends('admin.sub_contents.base')
  2. @section('main')
  3. <div class="table-responsive mt-2">
  4. @if(count($publications) > 0)
  5. <table class="table table-bordered list_table" style="margin-bottom:10px;">
  6. <thead>
  7. <tr>
  8. <th style="width: 8%">Sl</th>
  9. <th style="width: 70%">Title</th>
  10. <th style="width: 12%">Status</th>
  11. <th style="width: 10%; text-align: center;">Action</th>
  12. </tr>
  13. </thead>
  14. <tbody>
  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; @if($is_freez_profile) pointer-events:none; @endif"><i class="fa fa-edit change_pass_btn" ></i></span>
  34. <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>
  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. </tbody>
  48. </table>
  49. @else
  50. <div class="alert mt-1 mb-3" style="border-color: #e9f0f3; font-size: 12px !important; color: #dc3545; border-radius: 30px; padding: 8px 15px;">
  51. <span>No publication available.</span>
  52. </div>
  53. @endif
  54. </div>
  55. @endsection
  56. <script>
  57. $(function(){
  58. $('.edit_publication_info').on('click', function(){
  59. $('.edit_publication_load').empty();
  60. var self = $(this);
  61. var id = self.attr("data-id");
  62. var edit_cls = "edit_cls_"+id;
  63. $('.edit_data').addClass('d-none');
  64. $("."+edit_cls).removeClass('d-none');
  65. var edit_publication_load = self.closest('tbody').find('.edit_publication_load');
  66. fetch_sub_content(
  67. edit_publication_load,
  68. "{!! route('sub-content', ['name'=>'edit_publication_load','action'=>'edit']) !!}&edit_id="+id
  69. );
  70. });
  71. $('.delete_publication_info').on('click', function(){
  72. var id = $(this).attr("data-id");
  73. var form_data={
  74. _token: "{{ csrf_token() }}",
  75. delete_id: id,
  76. }
  77. swal({
  78. title: "Are you sure?",
  79. text: "You will not be able to recover this data!",
  80. type: "warning",
  81. showCancelButton: true,
  82. confirmButtonClass: "btn-danger",
  83. cancelButtonClass: "btn-info",
  84. confirmButtonText: "Yes, delete!",
  85. cancelButtonText: "No, cancel!",
  86. }, function(isConfirm){
  87. if(isConfirm){
  88. $.post("{{ route('ajax-post', ['name'=>'delete_publication_info']) }}",form_data
  89. ).done(function(res){
  90. pop_up_msg(res.msg);
  91. $('#publication_load').empty();
  92. fetch_sub_content(
  93. '#publication_load',
  94. "{{ route('sub-content', ['name'=>'publication_list_load']) }}"
  95. );
  96. }).fail(function(err){
  97. pop_up_msg(err_msg(err), 'error');
  98. });
  99. }
  100. });
  101. });
  102. });
  103. </script>