load_research_interest.blade.php 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. @extends('admin.sub_contents.base')
  2. @section('main')
  3. @foreach($resarch as $row)
  4. <div class="single_glance_row mt-4 single_edit_item">
  5. <div style="display: flex;">
  6. <div class="left" style="width: 80%;">
  7. <span class="title" style="font-size:11px;">{{$row->research}}</span>
  8. </div>
  9. <div class="right" style="width: 20%;">
  10. <span class="title" style="font-size:11px; font-weight: 600;">
  11. <button type="button" class="btn btn2 edit_research mb-1" data-id="{{$row->id}}" style="padding: 2px 5px !important; font-size: 11px;"><i class="fa fa-pencil"></i></button>
  12. </span>
  13. <span class="title" style="font-size:11px; font-weight: 600;">
  14. <button type="button" class="btn btn2 delete_research mb-1" data-id="{{$row->id}}" style="padding: 2px 5px !important; font-size: 11px;"><i class="fa fa-trash" style="margin-left:2px;"></i></button>
  15. </span>
  16. </div>
  17. </div>
  18. </div>
  19. @endforeach
  20. @endsection
  21. <script>
  22. $(function(){
  23. var form_row_added=false;
  24. $('.edit_research').on('click', function(){
  25. if(form_row_added){
  26. $('.open_research_info_div').remove();
  27. form_row_added=false;
  28. }
  29. var self=$(this);
  30. var self_tr=self.closest('.single_edit_item');
  31. var res_id=self.data('id');
  32. form_row_added=true;
  33. self_tr.after(
  34. "<div class='open_research_info_div'><div class='open_research_edit_info_div_inner'></div></div>"
  35. );
  36. fetch_sub_content(
  37. '.open_research_edit_info_div_inner',
  38. "{{ route('sub-content', ['name'=>'edit_research_form']) }}?res_id="+res_id
  39. );
  40. });
  41. $('.delete_research').on('click', function(){
  42. var id = $(this).attr("data-id");
  43. var form_data={
  44. _token: "{{ csrf_token() }}",
  45. delete_id: id,
  46. }
  47. swal({
  48. title: "Are you sure?",
  49. text: "You will not be able to recover this data!",
  50. type: "warning",
  51. showCancelButton: true,
  52. confirmButtonClass: "btn-danger",
  53. cancelButtonClass: "btn-info",
  54. confirmButtonText: "Yes, delete!",
  55. cancelButtonText: "No, cancel!",
  56. }, function(isConfirm){
  57. if(isConfirm){
  58. $.post("{{ route('ajax-post', ['name'=>'delete_research_info']) }}",form_data
  59. ).done(function(res){
  60. pop_up_msg(res.msg);
  61. $('#load_department').empty();
  62. fetch_sub_content(
  63. '#load_research_interest',
  64. "{{ route('sub-content', ['name'=>'load_research_interest']) }}"
  65. );
  66. }).fail(function(err){
  67. pop_up_msg(err_msg(err), 'error');
  68. });
  69. }
  70. });
  71. });
  72. });
  73. </script>