@push('script')
    <script>
        $(document).ready(function () {
            function load_job(params = []) {
                $("table.table").DataTable().destroy()
                $("table.table").DataTable({
                    "deferRender": true,
                    "responsive": true,
                    'serverSide': true,
                    'processing': true,
                    "ordering": false,
                    "ajax": {
                        "url": "{{ route('api.user.admingetmaids') }}",
                        "type": "GET",
                        "data": {
                            "sort": "ASC"
                        },
                        "headers": {
                            "Authorization" : getAuthorization()
                        },
                        "dataSrc": "data"
                    },
                    "columns": [
                        {
                            data: null,
                            render: function (data, type, row, meta) {
                                return meta.row + meta.settings._iDisplayStart + 1 + '.';
                            }
                        },
                        {
                            data: null,
                            render: res => {
                                return `<img src="${res.profile.image}" width="75px" height="75px" style="border-radius: 200px;">`;
                            }
                        },
                        {
                            data: 'name'
                        },
                        {
                            data: 'email'
                        },
                        {
                            data: 'profile.phone'
                        },
                        {
                            data: 'profile.address'
                        },
                        {
                            data: 'profile.birthdate'
                        },
                        {
                            data: 'profile.gender'
                        },
                        {
                            data: 'profile.last_education'
                        },
                        {
                            data: 'profile.additional_skills'
                        },
                        {
                            data: 'profile.desired_salary'
                        }
                    ]
                });
            }

            load_job();
        })
    </script>
@endpush
