@extends('layouts.app')
@push('css')
    <style>
    .color-red{
       color:red
    }
    .font-bold{
        font-weight: bold;
    }

    </style>
@endpush
@section('content')
    @php
        $source_types = config('constant.sourceType');
        $user_type = auth()->user()->user_type;
    @endphp

    <div class="row">
        <div class="col-xs-12 col-sm-12 column col-sm-offset-0 ">
            <div class="panel panel-default panel-frm">
                <div class="row">
                    <div class="col-md-12">
                        <div class="panel-heading">
                            <h3>Account Info <small>Manage your account info</small></h3>
                            <div class="pull-right" style="margin-top: -30px;margin-right: 10px;">
                                <button class="btn btn-sm btn-info" style="background: #FF440A !important;border-color: #FF440A !important;" type="button" id="btn_show_hide_text" onclick="return show_hide_textbox(this)" data-toggle="tooltip" title="Show or Hide Name,Email,SSN,Phone">
                                    <i class="fa fa-eye" style="font-size: 14px; color: black;" id="show_hide_icon" aria-hidden="true"></i>
                                </button>
                            </div>

                        </div>
                    </div>
                </div>
                <div class="panel-body">
                    <div class="clearfix"></div>
                    <div class="row">
                        <div class="col-md-12 col-sm-12 col-xs-12">
                            <div class="x_panel">
                                <form method="post" action="{{route('manage.clients')}}" id="client_form" autocomplete="off"
                                      enctype=multipart/form-data
                                      class="input-form-section">
                                    @csrf
                                <div class="x_content">
                                    <div class="col-md-12">
                                            <div class="row">
                                                <div class="col-md-6 col-xs-12">
                                                    <div class="form-group">
                                                        <label for="firstname">First Name</label>
                                                        <input class="form-control" name="creditreport[first_name]" placeholder="First Name" type="text"
                                                               value="<?php echo auth()->user()->first_name; ?>" >
                                                    </div>
                                                </div>
                                                <div class="col-md-6 col-xs-12">
                                                    <div class="form-group">
                                                        <label for="Last Name">Last Name</label>
                                                        <input class="form-control" name="creditreport[last_name]" placeholder="Last Name" type="text"
                                                               value="<?php echo auth()->user()->last_name; ?>" >
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-6 col-xs-12">
                                                    <div class="form-group">
                                                        <label for="dob">Date of Birth</label>
                                                        <input class="form-control" name="creditreport[birth_date]" placeholder="Birth Date" type="text" maxlength="10" onkeyup="birthDateCompleted()"
                                                               value="<?php echo auth()->user()->birth_date; ?>" >
                                                    </div>
                                                </div>

                                                <div class="col-md-6 col-xs-12">
                                                    <div class="form-group">
                                                        <label for="ssn">Social Security Number</label>
                                                        <input class="form-control" name="creditreport[ssn]"
                                                               type="text" maxlength="4" placeholder="Last 4 digit of ssn"
                                                               value="<?php echo auth()->user()->ssn; ?>"
                                                               >
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-6 col-xs-12">
                                                    <div class="form-group">
                                                        <label for="Phone">Phone</label>
                                                        <input class="form-control" name="creditreport[phone]" type="text" placeholder="Phone"
                                                               value="<?php echo auth()->user()->phone; ?>" >
                                                    </div>
                                                </div>

                                                <div class="col-md-6 col-xs-12">
                                                    <div class="form-group">
                                                        <label for="Street Number">Street Number</label>
                                                        <input class="form-control" name="creditreport[street_no]" placeholder="Street No" type="text"
                                                               value="<?php echo auth()->user()->street_no; ?>" >
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-6 col-xs-12">
                                                    <div class="form-group">
                                                        <label for="Street Name">Street Name</label>
                                                        <input class="form-control" name="creditreport[street_name]" placeholder="Street Name" type="text"
                                                               value="<?php echo auth()->user()->street_name; ?>">
                                                    </div>
                                                </div>
                                                <div class="col-md-6 col-xs-12">
                                                    <div class="form-group">
                                                        <label for="City">City</label>
                                                        <input class="form-control" name="creditreport[city]" placeholder="City" type="text"
                                                               value="<?php echo auth()->user()->city; ?>" >
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-6 col-xs-12">
                                                    <div class="form-group">
                                                        <label for="State">State</label>
                                                        <input class="form-control" name="creditreport[state]" placeholder="State" type="text"
                                                               value="<?php echo auth()->user()->state; ?>" >
                                                    </div>
                                                </div>
                                                <div class="col-md-6 col-xs-12">
                                                    <div class="form-group">
                                                        <label for="dob">Zip</label>
                                                        <input class="form-control" name="creditreport[zip_code]" placeholder="Zip Code" type="text"
                                                               value="<?php echo auth()->user()->zip_code; ?>" >
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-6 col-xs-12">
                                                    <div class="form-group">
                                                        <label for="dob">Email</label>
                                                        <input class="form-control" disabled name="creditreport[email]"
                                                               type="text" placeholder="Email"
                                                               value="<?php echo auth()->user()->email; ?>" >
                                                    </div>
                                                </div>
                                                <div class="col-md-6 col-xs-12">
                                                    <div class="form-group">
                                                        <label for="dob">Password</label>
                                                        <div class="input-group" id="manage_client_show_hide_password">
                                                            <input class="form-control" name="creditreport[password]"
                                                                   type="password" placeholder="Password"
                                                                   value="{{customDecrypt(auth()->user()->password)}}">
                                                            <div class="input-group-addon">
                                                                <a href=""><i class="fa fa-eye-slash" aria-hidden="true"></i></a>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        <div class="row">
                                            <div class="col-md-6 col-xs-12">
                                                <div class="form-group">
                                                    <label for="source_type">Source Type</label>
                                                    <select name="creditreport[credit_report_company_type]"  onchange="sourceTypeOnchange('{{auth()->user()->credit_report_company_type}}')" id="company_type"  class="form-control">
                                                        @foreach($source_types as  $key=>$value)
                                                            <option value="{{$value}}" {{auth()->user()->credit_report_company_type == $value ? 'selected':''}}> {{$key}}</option>
                                                        @endforeach
                                                    </select>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="x_content" id="upload-document-panel">
                                        @include('partials.upload_document')
                                    </div>
                                    <div class="col-md-12 hidden">
                                    @if(count($question_answer) > 0 && auth()->user()->credit_report_company_type == config('constant.sourceType.SmartCredit'))
                                        @include('partials.user_identity_question_answer',['question_answers'=>$question_answer])
                                    @endif
                                    </div>
                                    @if(isClientSubscription())
                                    <div class="col-sm-12 center" style="margin-top: 10px; text-align: center; ">
                                        <input class="btn btn-success btn2" onclick="return client_form_submit(this,'{{ route('admin.ajax.get.process') }}','{{$user_type}}')" type="submit" value="Save Changes">
                                    </div>
                                    @endif
                                </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade" id="common_confirmation_modal" style="margin-top: 50px" tabindex="-1" aria-hidden="true">
        <div class="modal-dialog modal-md" id="modal-dialog-panel">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                </div>
                <div class="modal-body">
                    <h4 class="mb-2 text-center" style="color: red" id="common_message_text">

                    </h4>
                </div>
                <div class="modal-footer" style="text-align: center">
                    <button type="button" class="btn btn-secondary btn-lg" data-dismiss="modal">Close</button>
                </div>
            </div>
        </div>
    </div>

    @if (!empty($upload_medias))
        @include('partials.modal.upload_doc_modal')
    @endif
@endsection

@push('script')

    <script>

        $(document).ready(function() {

                @if(getSession('login') == 1)
                  sessionStorage.setItem('user_data_viewed','0');
                  sessionStorage.setItem('video_shown','0');
                  {{setSession('login',0)}};
                @endif

                if(sessionStorage.getItem('video_shown') === '0') {
                    @if($is_first_login)
                        modalView('FIRST_TIME_LOGIN_MODAL_VIEW','first_time_login_video_modal');
                         // showFirstTimeLoginVideoModalView();
                    @endif
                }

        });

    </script>
    <script src="{{asset('/')}}js/accountinfo/clientinfo.js?v=1.0.2"></script>
@endpush
