Commit 5a61789a9f8f926266c89f3b0c0f44580f359223
1 parent
3d041f3f09
Exists in
master
правки
Showing 1 changed file with 2 additions and 2 deletions Inline Diff
resources/views/admin/employer_main/index.blade.php
1 | @extends('layout.admin', ['title' => 'Админка - Работодатели на главной']) | 1 | @extends('layout.admin', ['title' => 'Админка - Работодатели на главной']) |
2 | 2 | ||
3 | @section('script') | 3 | @section('script') |
4 | <script> | 4 | <script> |
5 | $(document).ready(function() { | 5 | $(document).ready(function() { |
6 | $(document).on('change', '.check_js', function () { | 6 | $(document).on('change', '.check_js', function () { |
7 | var this_ = $(this); | 7 | var this_ = $(this); |
8 | var wrap = this_.closest('tr'); | 8 | var wrap = this_.closest('tr'); |
9 | var id = wrap.data('id'); | 9 | var id = wrap.data('id'); |
10 | var field = this_.attr('data-field'); | 10 | var field = this_.attr('data-field'); |
11 | var value = this_.val(); | 11 | var value = this_.val(); |
12 | var ajax_block = $('#ajax_block'); | 12 | var ajax_block = $('#ajax_block'); |
13 | var str ="id=" + id + "&"+ field + "=" + value; | 13 | var str ="id=" + id + "&"+ field + "=" + value; |
14 | 14 | ||
15 | $.ajax({ | 15 | $.ajax({ |
16 | type: "GET", | 16 | type: "GET", |
17 | url: "{{ url()->full()}}", | 17 | url: "{{ url()->full()}}", |
18 | data: str, | 18 | data: str, |
19 | success: function (data) { | 19 | success: function (data) { |
20 | ajax_block.html(data); | 20 | ajax_block.html(data); |
21 | }, | 21 | }, |
22 | headers: { | 22 | headers: { |
23 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 23 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
24 | }, | 24 | }, |
25 | error: function (data) { | 25 | error: function (data) { |
26 | console.log('Error: ' + data); | 26 | console.log('Error: ' + data); |
27 | } | 27 | } |
28 | }); | 28 | }); |
29 | }); | 29 | }); |
30 | 30 | ||
31 | $(document).on('click', '.employers-main-remove-button', function(){ | 31 | $(document).on('click', '.employers-main-remove-button', function(){ |
32 | spinStart($(this)); | 32 | spinStart($(this)); |
33 | var this_btn = $(this); | 33 | var this_btn = $(this); |
34 | var wrap = this_btn.closest('tr'); | 34 | var wrap = this_btn.closest('tr'); |
35 | var id = wrap.data('id'); | 35 | var id = wrap.data('id'); |
36 | 36 | ||
37 | @php | 37 | @php |
38 | $page = request()->get('page'); | 38 | $page = request()->get('page'); |
39 | @endphp | 39 | @endphp |
40 | 40 | ||
41 | $.ajax({ | 41 | $.ajax({ |
42 | type: "POST", | 42 | type: "POST", |
43 | url: "{{ route('admin.employers-main-remove')}}", | 43 | url: "{{ route('admin.employers-main-remove')}}", |
44 | data: { | 44 | data: { |
45 | id: id, | 45 | id: id, |
46 | page: {{ $page }} | 46 | page: {{ $page ?? 1 }} |
47 | }, | 47 | }, |
48 | success: function (data) { | 48 | success: function (data) { |
49 | $('#ajax_block').html(data); | 49 | $('#ajax_block').html(data); |
50 | }, | 50 | }, |
51 | headers: { | 51 | headers: { |
52 | 'X-CSRF-TOKEN': $('[name="_token"]').val() | 52 | 'X-CSRF-TOKEN': $('[name="_token"]').val() |
53 | }, | 53 | }, |
54 | error: function (data) { | 54 | error: function (data) { |
55 | console.log('Error: ' + data); | 55 | console.log('Error: ' + data); |
56 | } | 56 | } |
57 | }); | 57 | }); |
58 | }); | 58 | }); |
59 | 59 | ||
60 | $(document).on('click', '.employers-main-add-button', function(){ | 60 | $(document).on('click', '.employers-main-add-button', function(){ |
61 | spinStart($(this)); | 61 | spinStart($(this)); |
62 | var this_btn = $(this); | 62 | var this_btn = $(this); |
63 | 63 | ||
64 | @php | 64 | @php |
65 | $page = request()->get('page'); | 65 | $page = request()->get('page'); |
66 | @endphp | 66 | @endphp |
67 | 67 | ||
68 | $.ajax({ | 68 | $.ajax({ |
69 | type: "POST", | 69 | type: "POST", |
70 | url: "{{ route('admin.employers-main-add')}}", | 70 | url: "{{ route('admin.employers-main-add')}}", |
71 | data:{ | 71 | data:{ |
72 | page: {{ $page }} | 72 | page: {{ $page ?? 1 }} |
73 | }, | 73 | }, |
74 | success: function (data) { | 74 | success: function (data) { |
75 | spinStop(this_btn); | 75 | spinStop(this_btn); |
76 | $('#ajax_block').html(data); | 76 | $('#ajax_block').html(data); |
77 | }, | 77 | }, |
78 | headers: { | 78 | headers: { |
79 | 'X-CSRF-TOKEN': $('[name="_token"]').val() | 79 | 'X-CSRF-TOKEN': $('[name="_token"]').val() |
80 | }, | 80 | }, |
81 | error: function (data) { | 81 | error: function (data) { |
82 | console.log('Error: ' + data); | 82 | console.log('Error: ' + data); |
83 | } | 83 | } |
84 | }); | 84 | }); |
85 | }); | 85 | }); |
86 | 86 | ||
87 | }); | 87 | }); |
88 | </script> | 88 | </script> |
89 | @endsection | 89 | @endsection |
90 | 90 | ||
91 | @section('content') | 91 | @section('content') |
92 | <style> | 92 | <style> |
93 | .col { | 93 | .col { |
94 | width: 250px; /* Ширина блока */ | 94 | width: 250px; /* Ширина блока */ |
95 | word-wrap: break-word; /* Перенос слов */ | 95 | word-wrap: break-word; /* Перенос слов */ |
96 | word-break: break-all; | 96 | word-break: break-all; |
97 | } | 97 | } |
98 | </style> | 98 | </style> |
99 | @csrf | 99 | @csrf |
100 | <div class="mb-10"> | 100 | <div class="mb-10"> |
101 | <button class="employers-main-add-button flex px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-green-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"> | 101 | <button class="employers-main-add-button flex px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-green-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"> |
102 | Добавить работодателя на главную | 102 | Добавить работодателя на главную |
103 | </button> | 103 | </button> |
104 | </div> | 104 | </div> |
105 | <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> | 105 | <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> |
106 | @include('admin.employer_main.table') | 106 | @include('admin.employer_main.table') |
107 | </div> | 107 | </div> |
108 | <div class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800"> | 108 | <div class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800"> |
109 | <?=$employers->appends($_GET)->links('admin.pagginate'); ?> | 109 | <?=$employers->appends($_GET)->links('admin.pagginate'); ?> |
110 | </div> | 110 | </div> |
111 | 111 | ||
112 | @endsection | 112 | @endsection |
113 | 113 |