404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@18.116.80.68: ~ $
@extends('admin.layout.app')
@section('title', 'All Schedules')
@push('custom_css')
    <link rel="stylesheet" href="{{ asset('assets/js/loader/waitMe.css') }}">
@endpush
@section('content')
    <div class="row">
        <div class="col-12">
            <div class="page-title-box d-sm-flex align-items-center justify-content-between">
                <h4 class="mb-sm-0">App Messages</h4>
                <div class="page-title-right">
                    <ol class="breadcrumb m-0">
                        <li class="breadcrumb-item"><a href="{{route('admin.dashboard')}}">Dashboard</a></li>
                        <li class="breadcrumb-item active">Messages</li>
                    </ol>
                </div>
            </div>
        </div>
    </div>
    <div class="card">
        <div class="card-header align-items-center d-flex">
            <h4 class="card-title mb-0 flex-grow-1">Messages</h4>
        </div><!-- end card header -->
        <div class="card-body">
            <div class="live-preview">
                <div class="table-responsive">
                    <table class="table align-middle mb-0 messages_data_table"
                           data-remove-uri="">
                        <thead>
                        <tr>
                            <th scope="col">#</th>
{{--                            <th scope="col">Sender's Name</th>--}}
                            <th scope="col">Message</th>
                            <th scope="col">Time</th>
                        </tr>
                        </thead>
                        <tbody></tbody>
                    </table>
                </div>
            </div>
        </div><!-- end card-body -->
    </div>
@endsection
@push('custom_scripts')
    <script src="{{ asset('assets/js/loader/waitMe.js') }}"></script>

    <script type="module">
        import {initializeApp} from 'https://www.gstatic.com/firebasejs/9.15.0/firebase-app.js'
        import {getDatabase, ref, onValue, orderByChild, query} from 'https://www.gstatic.com/firebasejs/9.15.0/firebase-database.js'

        const firebaseConfig = {
            apiKey: "AIzaSyDNz-G6-Ay3bgofJiIWkUWk8J0QB1n1Cm4",
            authDomain: "tuliza-fm.firebaseapp.com",
            databaseURL: "https://tuliza-fm-default-rtdb.firebaseio.com",
            projectId: "tuliza-fm",
            storageBucket: "tuliza-fm.appspot.com",
            messagingSenderId: "541055685892",
            appId: "1:541055685892:web:bf897d8d2e7cafbcf2ac51",
            measurementId: "G-561Q5DB8XW"
        };

        showLoader()

        const app = initializeApp(firebaseConfig);
        const db = getDatabase();
        const reference = ref(db, 'messages')
        const starCountRef = query(reference, orderByChild('time'))
        var messages = []

        var datatable = $('.messages_data_table').DataTable({
            processing: true,
            data: messages,
            columns: [
                {data: 'id'},
                {data: 'message'},
                {data: 'time'},
            ],
            columnDefs: [
                {
                    targets: 0,
                    orderable: false,
                    render: function (data, type, row, meta) {
                        return meta.row + meta.settings._iDisplayStart + 1;
                    }
                },
                {
                    targets: 1,
                    render: function (data, type, row) {
                        return row.message
                    }
                },
                {
                    targets: -1,
                    orderable: false,
                    render: function (data, type, row) {

                        return row.time

                    }
                },
            ],
        })

        onValue(starCountRef, (snapshot) => {
            showLoader()
            messages = []
            snapshot.forEach(child => {
                messages.push(child.val())
            })
            datatable.clear().rows.add(messages.reverse()).draw();
            stopLoader()
        });

        function showLoader() {
            $('.card').waitMe({
                effect: 'bounce',
                text: 'Getting Messages. Please wait...',
                color: "#fff",
                bg: 'rgba(0,0,0,0.5)'
            });
        }

        function stopLoader() {
            $('.card').waitMe("hide");
        }

        datatable.on('draw', function () {
            $('.delete_btn').on('click', function (e) {
                e.preventDefault()
                let key = $(this).parents().eq(2).find('.item_key').val()
                let delete_uri = $('table').attr('data-remove-uri')
                delete_uri = delete_uri.replace(':id', key)

                Swal.fire({
                    title: 'Are you sure?',
                    text: "You won't be able to revert this!",
                    icon: 'warning',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    confirmButtonText: 'Yes, delete it!'
                }).then((result) => {
                    if (result.isConfirmed) {
                        $('body').waitMe({
                            effect: 'bounce',
                            text: 'Deleting. Please wait...',
                            color: "#fff",
                            bg: 'rgba(0,0,0,0.5)'
                        })

                        $.ajax({
                            url: delete_uri,
                            dataType: 'json',
                            type: 'GET',
                            success: function (json) {
                                $('body').waitMe("hide");
                                if (json.status) {
                                    toastr.success('Message Deleted Successfully');
                                } else {
                                    toastr.error('Something went wrong. Please try again later!');

                                    Snackbar.show({
                                        text: json.message,
                                        pos: 'bottom-center',
                                        backgroundColor: '#a3220f',
                                        timeout: 3000
                                    });

                                }
                            },
                            error: function (json) {
                                Snackbar.show({
                                    text: 'Something went wrong. Please try again later!',
                                    pos: 'bottom-center',
                                    backgroundColor: '#a3220f'
                                });
                                $('body').waitMe("hide");
                            }
                        })
                    } else {
                        Swal.fire({
                            title: "Message not deleted!",
                            icon: "info",
                            confirmButtonClass: "btn btn-primary w-xs mt-2",
                            buttonsStyling: !1
                        })
                    }
                })
            })
        })
    </script>
@endpush

Filemanager

Name Type Size Permission Actions
all_messages.blade.php File 7.15 KB 0644