<div class="row">
    <div class="col-12">
        <div class="card">
            <div class="card-header">
                <div>
                    <span class="card-title"><i class="ri-git-repository-line"></i> {{ __('contact_name') }}</span>
                </div>
            </div>
            <div class="card-content">
                <form id="contactForm">
                    <div class="row my-3">
                        <div class="col-12 mb-3">
                            <div class="form-group">
                                <label for="EMail">{{ __('contact_email') }}</label>
                                <div class="form-group">
                                    <input type="text" class="form-control" name="EMail" id="EMail" value="{{ $contact['EMail'] }}">
                                </div>
                            </div>
                        </div>
                        <div class="col-12 mb-3">
                            <div class="form-group">
                                <label for="FirstName">{{ __('contact_firstname') }}</label>
                                <div class="form-group">
                                    <input type="text" class="form-control" name="FirstName" id="FirstName" value="{{ $contact['FirstName'] }}">
                                </div>
                            </div>
                        </div>
                        <div class="col-12 mb-3">
                            <div class="form-group">
                                <label for="LastName">{{ __('contact_lastname') }}</label>
                                <div class="form-group">
                                    <input type="text" class="form-control" name="LastName" id="LastName" value="{{ $contact['LastName'] }}">
                                </div>
                            </div>
                        </div>
                        <div class="col-12 mb-3">
                            <div class="form-group">
                                <label for="Phone">{{ __('contact_phone') }}</label>
                                <div class="form-group">
                                    <input type="text" class="form-control" name="Phone" id="Phone" value="{{ $contact['Phone'] }}">
                                </div>
                            </div>
                        </div>
                        <div class="col-12 mb-3">
                            <div class="form-group">
                                <label for="Company">{{ __('contact_company') }}</label>
                                <div class="form-group">
                                    <input type="text" class="form-control" name="Company" id="Company" value="{{ $contact['Company'] }}">
                                </div>
                            </div>
                        </div>
                        <div class="col-12 mb-3">
                            <div class="form-group">
                                <label for="City">{{ __('contact_city') }}</label>
                                <div class="form-group">
                                    <input type="text" class="form-control" name="City" id="City" value="{{ $contact['City'] }}">
                                </div>
                            </div>
                        </div>
                        <div class="col-12 mb-3">
                            <div class="form-group">
                                <label for="State">{{ __('contact_state') }}</label>
                                <div class="form-group">
                                    <input type="text" class="form-control" name="State" id="State" value="{{ $contact['State'] }}">
                                </div>
                            </div>
                        </div>
                        <div class="col-12 mb-3">
                            <div class="form-group">
                                <label for="AddressLine1">{{ __('contact_address') }}</label>
                                <div class="form-group">
                                    <input type="text" class="form-control" name="AddressLine1" id="AddressLine1" value="{{ $contact['AddressLine1'] }}">
                                </div>
                            </div>
                        </div>
                        <div class="col-12 row-center row-flex">
                            <a href="#" class="btn btn-primary beCallRequestx" data-method="contact" data-form="contact">
                                {{ __('global_save') }}
                            </a>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script>
    var wait = false;
    $(".beCallRequestx").on("click",function(){
        if(!wait){
            wait = true;
            var item = $(this);
            var content = item.html();
            item.html('<span class="btn-spinner mx-2"></span> Lütfen Bekleyiniz!');
            var method = item.data("method");
            var form = item.data("form");
            var data = item.data("data");
            var datacontent = "";
            if(form){
                datacontent = $("#"+form+"Form").serialize()+"&action="+method+"&upid={{ $userproduct['upid'] }}";
            }
            else{
                datacontent = data+"&action="+method+"&upid={{ $userproduct['upid'] }}";
            }
            $.ajax({
                url: "{{ beGetRoute('client.userproduct.userproduct.show.post') }}",
                type: "post",
                data: datacontent,
                dataType: "json",
                crossDomain: true,
                success: function(response){
                    wait = false;
                    item.html(content);
                    if(response.status){
                        $.Toast("Başarılı",response.message,"success");
                        if(response.refresh){
                            setTimeout(function(){
                                location.reload();
                            },1000);
                        }
                    }
                    else{
                        $.Toast("Bir Sorun Oluştu",response.message,"error");
                    }
                }
            });	
            return false;
        }
        else{
            $.Toast("Bir Sorun Oluştu","İşlem devam ediyor lütfen bekleyiniz","error");
        }
    });
</script>