PATH:
home
/
lab2454c
/
netxzero.com
/
carbon-credit
/
resources
/
views
/
admin
/
contacts
@extends('admin.layout.adminMasterLayout') @section('title', 'Contact List') @section('content') <meta name="csrf-token" content="{{ csrf_token() }}"> <div class="content-wrapper"> <div class="row"> <div class="col-lg-12 grid-margin stretch-card"> <div class="card"> <div class="card-body"> <div style="text-align: end;"> <button style="margin-bottom: 10px" class="btn btn-primary delete_all" disabled=""> <i class="fa fa-trash" aria-hidden="true"></i> Delete All Selected </button> </div> <h3 class="card-title">Contact List</h3> <hr> <div class="table-responsive"> <table class="table table-striped"> <thead> <tr> <th width="50px"><input type="checkbox" id="checkedAll"></th> <th>Name</th> <th>Email</th> <th>Phone</th> <th>Message</th> <th>Action</th> </tr> </thead> <tbody> @forelse($contacts as $contact) <tr id="tr_{{$contact->id}}"> <td><input type="checkbox" class="sub_chk" data-id="{{ $contact->id }}"></td> <td> {{ $contact->fullname }} </td> <td> {{ $contact->email }} </td> <td> {{ $contact->phone }} </td> <td> {{$contact->message}} </td> <td> <div class="d-inline-block"> <form action="{{route('deleteContact', $contact)}}" method="POST" > @csrf @method('DELETE') <button type="submit" class="btn btn-primary btn-sm DeleteSingle" style="cursor: pointer;"> <i class="fa fa-trash" aria-hidden="true"></i> Delete </button> </form> </div> </td> </tr> @empty <td colspan="6">No Contacts Found</td> @endforelse </tbody> </table> <div class="mt-5"> {{ $contacts->links('pagination::bootstrap-4') }} </div> </div> </div> </div> </div> </div> </div> <script> $('.DeleteSingle').on('click', function(e){ e.preventDefault(); var single = $(this); iziToast.question({ overlay: true, toastOnce: true, id: 'question', title: 'Hey', message: 'Are you sure you want to delete?', position: 'center', buttons: [ ['<button><b>YES</b></button>', function (instance, toast) { instance.hide({ transitionOut: 'fadeOut' }, toast); single.closest("form").submit(); }, true], ['<button>NO</button>', function (instance, toast) { instance.hide({ transitionOut: 'fadeOut' }, toast); }] ] }); }); </script> <script> $(function() { $('#checkedAll').on('click', function(e) { if($(this).is(':checked',true)) { $(".sub_chk").prop('checked', true); $(".delete_all").removeAttr("disabled"); } else { $(".sub_chk").prop('checked',false); $(".delete_all").attr("disabled", true); } }); $(".sub_chk").click(function () { //console.log($(".sub_chk:checked").length); if ($(".sub_chk:checked").length > 0) { $(".delete_all").removeAttr("disabled"); } if ($(".sub_chk:checked").length == 0) { $(".delete_all").attr("disabled", true); } if ($(this).is(":checked")) { var isAllChecked = 0; $(".sub_chk").each(function() { if (!this.checked) isAllChecked = 1; }); if (isAllChecked == 0) { $("#checkedAll").prop("checked", true); } } else { $("#checkedAll").prop("checked", false); } }); $('.delete_all').on('click', function(e) { var allVals = []; $(".sub_chk:checked").each(function() { allVals.push($(this).attr('data-id')); }); if(allVals.length <=0) { //alert("Please select row."); iziToast.warning({ title: 'Wait', message: 'Please select a row first to delete!', position: 'topRight', }); } else { iziToast.question({ overlay: true, toastOnce: true, id: 'question', title: 'Hey', message: 'Are you sure you want to delete?', position: 'center', buttons: [ ['<button><b>YES</b></button>', function (instance, toast) { instance.hide({ transitionOut: 'fadeOut' }, toast); var join_selected_values = allVals.join(","); $.ajax({ url: "{{ route('deleteContacts') }}", type: 'DELETE', headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}, data: 'ids='+join_selected_values, success: function (data) { if (data['success']) { $(".sub_chk:checked").each(function() { $(this).parents("tr").remove(); }); $(".delete_all").attr("disabled", true); iziToast.success({ title: 'Done', message: data['success'], position: 'topRight', }); } else if (data['error']) { iziToast.error({ title: 'Error', message: data['error'], position: 'topRight', }); } else { iziToast.error({ title: 'Error', message: 'Whoops Something went wrong!!', position: 'topRight', }); } }, error: function (data) { iziToast.error({ title: 'Error', message: data.responseText, position: 'topRight', }); } }); }, true], ['<button>NO</button>', function (instance, toast) { instance.hide({ transitionOut: 'fadeOut' }, toast); }] ] }); } }); }); </script> @endsection
[+]
..
[-] contacts.blade.php
[edit]
[-] subscriptions.blade.php
[edit]