<?php

use App\Models\homeModel;

$HomeModel = new homeModel();
$WebsitesDomain = $HomeModel->GetAllWebsitesDomain();
?>


<div class="modal fade update_user_modal_lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
     aria-hidden="true" data-keyboard="false" data-backdrop="static">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">Update User</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <div id="update_user_data">
                        <!--echo from user controller-->
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary" type="submit" onclick="SaveUpdateUserData()">Update</button>
            </div>
        </div>
    </div>
</div>

<script>
    function SaveUpdateUserData() {

        // var validate = $("form#UpdateUserForm").validationEngine('validate');
        // if (validate == false) {
        //     return false;
        // }

        var phpdata = $("form#UpdateUserForm").serialize();
        var response = AjaxResponse("user/save_update_user_form", phpdata);
        if (response.status == 'success') {
            setTimeout(function () {
                $("#Status").html('<div class="text-center alert alert-success mb-4" role="alert">  <strong>' + response.message + '</strong> </div>');
                location.reload();
            }, 1000);
        }

    }


</script>
