1234567891011121314151617181920212223242526272829303132333435363738 |
- {% extends 'SharixAdmin/index.html' %}
- {% load render_table from django_tables2 %}
- {% block contenthome %}
- <h1 >{{ title }}</h1>
- <div class="container text-center mt-2">
- {% render_table table %}
- </div>
- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
- <script>
- // Запрос на изменения статуса исполнителя
- $('.status-toggle').change(function() {
- var service_id = $(this).data('service-id');
- var new_status = $(this).prop('checked') ? 'active' : 'deactivated';
- $.ajax({
- url: '{% url "service/change_status" %}',
- type: 'POST',
- data: {
- 'service_id': service_id,
- 'new_status': new_status,
- 'csrfmiddlewaretoken': '{{ csrf_token }}'
- },
- success: function(response) {
- var scrollTop = window.pageYOffset;
- location.reload();
- window.scrollTo(0, scrollTop);
- },
- error: function(xhr, status, error) {
- console.log(xhr.responseText);
- }
- });
- });
- </script>
-
-
- {% endblock contenthome %}
|