<section class="screen_1">
    <form id="creditfairForm" action="javascript:" method="POST">
        <input type="hidden" name="_token" value="{{ csrf_token() }}" />
        @if(isset($callback_url) && $callback_url)
        <input type="hidden" name="c_url" value="<?php echo $callback_url ?? ''; ?>" />
        @endif
        @if(isset($merchant_id) || isset($selectedMerchantID))
            <input type="hidden" name="merchant_id" value="<?php echo $merchant_id ?? ($selectedMerchantID ?? ''); ?>" class="merchant_id">
        @endif
        @if(isset($api_init))
        <input type="hidden" name="api_init" value="web-api"/>
        @endif
        @if(isset($merchant_location_id))
            <input type="hidden" name="merchant_location_id" value="{{$merchant_location_id}}" class="merchant_location_id">
        @endif
        <div class="row">
            <div class="col-md-12 mt-3">
                @if(!isset($bill_id))
                @if(isset($selectedMerchantID) && ($selectedMerchantID > 0))
                    <h4 class="text-center mb-4"><strong>Welcome to {{$merchant_details[0]['merchant_name']}}</strong></h4>
                @if(isset($merchantLocation->name) && $merchantLocation->name)
                    <h6 class="text-center" style="padding-bottom: 9px;">(<?php echo ucfirst($merchantLocation->name); ?>)</h6>
                @endif
                    <h6 class="text-center">You can apply for Easy EMI plans in just a few minutes!</h6>
                    <h6 class="text-center">Powered by Credit Fair<sup>TM</sup></h6>
                @else
                {{-- <h4 class="text-center mb-4"><strong>Welcome to Credit Fair</strong></h4>
                <h6 class="text-center">You can apply for Easy EMI plans in just a few minutes!</h6> --}}
                <div class="text-center">
                    <span class="font-weight-bold" style="font-size: 24px">Welcome to Credit Fair</span><br />
                    <span class="mt-3" style="font-size: 19px">You can apply for Easy EMI plans in just a few minutes!</span>
                </div>
                    @endif
                @endif
            </div>
        </div>

        <div class="row">
                <div class="col-12 mt-4 mb-2">
                    <strong class="font-weight-bold" style="font-size: 19px">Personal Details</strong>
                </div>
                <div class="col-12 col-md-4 mt-4">
                    <div class="md-form mt-0 mb-0">
                        <input type="text" class="form-control" @if(isset($name) && $name) readonly disabled="disabled" value="{!! $name or '' !!}" @endif name="name">
                        <label class="font-weight-normal" for="">Name as per Pan Card <span class="required">*</span></label>
                    </div>
                </div>
                <div class="col-12 col-md-4 mt-4">
                    <div class="md-form mt-0 mb-0">
                        <input type="text" class="form-control" @if(isset($pan_card) && $pan_card) readonly disabled="disabled" value="{!! $pan_card or '' !!}" @endif name="pan_card" onkeyup="this.value = this.value.toUpperCase()">
                        <label class="font-weight-normal" for="">Pan Card ID <span class="required">*</span></label>
                    </div>
                </div>
            <div class="col-12 col-md-4 mt-4">
                <div class="md-form mt-0 mb-0">
                    <input type="text" class="form-control" @if(isset($aadhaar_card) && $aadhaar_card) readonly disabled="disabled" value="{!! $aadhaar_card or '' !!}" @endif name="aadhaar_card" min="0">
                    <label class="font-weight-normal" for="">Aadhaar Card ID</label>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-12 mt-5 mb-2">
                <strong class="font-weight-bold" style="font-size: 19px">Contact Details</strong>
            </div>
            <div class="col-12 col-md-5 mt-4">
                <div class="md-form mt-0 mb-0">
                    <input type="email" class="form-control" @if(isset($email) && $email) readonly disabled="disabled" value="{!! $email or '' !!}" @endif name="email">
                    <label class="font-weight-normal" for="">Email Address  <span class="required">*</span></label>
                </div>
            </div>
            @if(Auth::check() && trim(Auth::user()->mobile_number))
            <div class="col-12 col-md-5 mt-4">
                <div class="md-form mt-0 mb-0">
                    <input type="number" class="form-control" id="mobile_number" name="mobile_number" value="{{ Auth::user()->mobile_number }}" readonly="" min="0">
                    <label class="font-weight-normal" for="">Mobile Number <span class="required">*</span></label>
                </div>
                <a href="javascript:void(0)" disabled class="verify_number verified">Verified</a>
            </div>
            @else
            <div class="col-12 col-md-5 mt-4">
                <div class="md-form mt-0 mb-0">
                    <input type="number" class="form-control" id="mobile_number" @if(isset($phone) && $phone) readonly disabled="disabled" value="{!! $phone or '' !!}" @endif name="mobile_number" min="0">
                    <label class="font-weight-normal" for="">Mobile Number <span class="required">*</span></label>
                </div>
                <a href="javascript:void(0)" class="verify_number">Verify</a>
            </div>
            @endif
            <input type="text" class="form-control" id="request_id" name="request_id" value="" id="request_id" style="display: none">

            <div class="col-12 col-md-4 mt-4" id="otp_wrap">
                <div class="md-form mt-0 mb-0">
                    <input type="text" class="form-control" id="otp">
                    <label class="font-weight-normal" for="">Enter your OTP</label>
                </div>
                <a href="javascript:void(0)" id="verify_otp" class="submit_otp btn-sm btn btn-primary">SUBMIT</a>
            </div>
        </div>

        <div class="row">
        <div class="col-12 mt-5 mb-2">
            <strong class="font-weight-bold" style="font-size: 19px">Product Details</strong>
        </div>

        <div class="col-12 col-md-4 mt-4 ">
            <div class="md-form mt-0 mb-0">
                <select class="" name="purpose" id="purpose" @if(isset($selectedMerchantCategoryID) && $selectedMerchantCategoryID > 0) disabled @endif>
                    <option value="">CHOOSE PURPOSE <span class="required">*</span></option>
                    @foreach($merchant_category as $category)
                        <option value="{!! $category->id !!}" @if(isset($selectedMerchantCategoryID) && $selectedMerchantCategoryID > 0 && $selectedMerchantCategoryID == $category->id) selected @endif>{!! $category->name !!}</option>
                    @endforeach
                </select>
            </div>
        </div>
        <div class="col-12 col-md-4 mt-4" id="type_of_customer">
            <div class="md-form mt-0 mb-0">
                <select class="mdb-select" name="type_of_customer" id="type_of_customer">
                    <option value="">Type Of Customer <span class="required">*</span></option>
                    <option value="1">Residential</option>
                    <option value="2">Rural C&I MSME ( Attachakki, Oil Expeller etc)</option>
                    <option value="3">Urban C&I MSME (Factories, Hospitals, Hotels, Offices, etc)</option>
                    <option value="4">Housing Society</option>
                    <option value="5">Schools & Universities</option>
                </select>
            </div>
        </div>
        <div class="col-12 col-md-4 mt-4" id="inverter">
            <div class="md-form mt-0 mb-0">
                <select class="mdb-select" name="inverter" id="inverter">
                    <option value="">INVERTER TO BE INSTALLED <span class="required">*</span></option>
                    @foreach($inverter_list as $inverter)
                        <option value="{!! strtolower($inverter) !!}" >{!! $inverter !!}</option>
                    @endforeach
                </select>
            </div>
        </div>
        <div class="col-12 col-md-4 mt-4 " id="other_inverter">
            <div class="md-form mt-0 mb-0">
                <input type="text" class="form-control" name="other_inverter" id='other_inverter'>
                <label class="font-weight-normal">OTHER INVERTER NAME</label>
            </div>
        </div>

        <div class="col-12 col-md-4 mt-4" id="panel">
            <div class="md-form mt-0 mb-0">
                <select class="mdb-select" name="panel" id="panel">
                    <option value="">PANEL TO BE INSTALLED <span class="required">*</span></option>
                    @foreach($panel_list as $panel)
                        <option value="{!! strtolower($panel) !!}" >{!! $panel !!}</option>
                    @endforeach
                </select>
            </div>
        </div>
        <div class="col-12 col-md-4 mt-4 " id="other_panel">
            <div class="md-form mt-0 mb-0">
                <input type="text" class="form-control" name="other_panel" id='other_panel'>
                <label class="font-weight-normal">OTHER PANEL NAME</label>
            </div>
        </div>

        <div class="col-12 col-md-4 mt-4 " id="model_description">
            <div class="md-form mt-0 mb-0">
                <input type="text" class="form-control " name="model_description" id='model_description'>
                <label class="font-weight-normal">MODEL DESCRIPTION</label>
            </div>
        </div>
        <div class="col-12 col-md-4 mt-4 " id="monthly_power_bill">
            <div class="md-form mt-0 mb-0">
                <input type="text" class="form-control field_validation1" name="monthly_power_bill" id='monthly_power_bill' min="0" onkeyup="if (/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')">
                <label class="font-weight-normal">MONTHLY POWER BILL</label>
            </div>
        </div>
        <div class="col-12 col-md-4 mt-4 " id="KW_installation">
            <div class="md-form mt-0 mb-0">
                <input type="text" class="form-control field_validation1" name="KW_installation" id='KW_installation' min="0" onkeyup="if (/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')">
                <label class="font-weight-normal">KW INSTALLATION</label>
            </div>
        </div>
        <div class="col-12 col-md-4 mt-4 " id="gross_project_amount">
            <div class="md-form mt-0 mb-0">
                <input type="text" class="form-control field_validation1" name="gross_project_amount" id='gross_project_amount' min="0" onkeyup="if (/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')">
                <label class="font-weight-normal">GROSS PROJECT AMOUNT</label>
            </div>
        </div>
        <div class="col-12 col-md-4 mt-4 " id="subsidy_amount">
            <div class="md-form mt-0 mb-0">
                <input type="text" class="form-control field_validation1" name="subsidy_amount" id='subsidy_amount' min="0" onkeyup="if (/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')">
                <label class="font-weight-normal">SUBSIDY AMOUNT</label>
            </div>
        </div>
        <div class="col-12 col-md-4 mt-4 " id="power_savings">
            <div class="md-form mt-0 mb-0">
                <input type="text" class="form-control" name="power_savings" id='power_savings' min="0" onkeyup="if (/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')" readonly="readonly">
                <label class="font-weight-normal">POWER SAVINGS(Estimated)</label>
            </div>
        </div>

        @if(!isset($bill_id))
        <div class="col-12 col-md-4 mt-4">
            <div class="md-form mt-0 mb-0">
                <select class="" name="merchant_id" id="src_merchant_name" @if(isset($selectedMerchantID) && $selectedMerchantID > 0) disabled @endif>
                    <option value="" disabled selected>NAME OF MERCHANT <span class="required">*</span></option>
                    @if(isset($selectedMerchantID) && $selectedMerchantID > 0)
                        <option value="{!! $selectedMerchantID !!}" selected>{{$merchant_details[0]['merchant_name']}}</option>
                    @endif
                </select>
            </div>
        </div>
        @endif
        @if(isset($bill_id))
        <div id='bill_id_number_block' class="col-12 col-md-4 mt-4">
            <div class="md-form mt-0 mb-0">
                <input type="text" class="form-control" name="unique_id_number" id='unique_id_number' @if(isset($bill_id) && $bill_id) value="{{$bill_id}}" readonly="" @endif>
                <label class="font-weight-normal" for="">Bill ID</label>
            </div>
        </div>
        @endif
        @if(!isset($bill_id))
        @if(isset($merchantLocation) && $merchantLocation)
            <div class="col-12 col-md-4 mt-4">
                <div class="md-form1 mt-0 mb-0">
                    <select class="" name="center_id" id="src_merchant_center_name" required="required" disabled>
                        <option value="">Name of Center <span class="required">*</span></option>
                        <option value="{!! $merchantLocation->id !!}" selected><?php echo ucfirst($merchantLocation->name); ?></option>
                    </select>
                </div>
            </div>
        @else
            <div class="col-12 col-md-4 mt-4">
                <div class="md-form1 mt-0 mb-0">
                    <select class="" name="center_id" id="src_merchant_center_name" disabled>
                        <option value="">Name of Center</option>
                    </select>
                </div>
            </div>
        @endif
        <div class="col-12 col-md-4 mt-4 other_merchant_name">
            <div class="md-form mt-0 mb-0">
                <input type="text" class="form-control" name="src_merchant_name" @if(isset($merchant_location_name) && $merchant_location_name) value="{{$merchant_location_name}}" readonly="" @endif>
                <label class="font-weight-normal" for="">Name of Merchant</label>
            </div>
        </div>
        <div id='product_name_block' class="col-12 col-md-4 mt-4">
            <div class="md-form mt-0 mb-0">
                <input type="text" class="form-control" name="product_name" id='product_name' @if(isset($product_name) && $product_name) value="{{$product_name}}" readonly="" @endif>
                <label class="font-weight-normal">@if(isset($selectedMerchantIDCat) && $selectedMerchantIDCat === 4) Course Name @elseif($selectedMerchantIDCat === 7) Vehicle Model Name @elseif($selectedMerchantIDCat === 16 || $selectedMerchantIDCat === 19 || $selectedMerchantIDCat === 20 || $selectedMerchantIDCat === 21 || $selectedMerchantIDCat === 25) Treatment Name @else Product/Treatment/Course Name @endif</label>
            </div>
        </div>
        <div id='unique_id_number_block' class="col-12 col-md-4 mt-4">
            <div class="md-form mt-0 mb-0">
                <i class="fa fa-info-circle" title="This number can be invoice number or Bill ID or student ID or any other unique number given by the merchant" style="position: absolute;left: -17px;"></i>
                <input type="text" class="form-control" name="unique_id_number" id='unique_id_number' @if(isset($bill_id) && $bill_id) value="{{$bill_id}}" readonly="" @elseif(isset($unique_id_number) && $unique_id_number) value="{{$unique_id_number}}" readonly="" @endif>
                <label class="font-weight-normal" for="">@if(isset($bill_id)) Bill ID @else Unique ID Number @endif</label>
            </div>
        </div>
        @endif
        @if(isset($merchant_email))
            <input type="hidden" class="form-control" name="lead_src_email" value="{{$merchant_email}}" >
        @endif
        @if(isset($merchant_phone))
            <input type="hidden" class="form-control" name="lead_src_phone" value="{{$merchant_phone}}" >
        @endif
        </div>

        <div class="row">
            <div id='product_id_block' class="col-12 col-md-4 mt-4" style="display: none">
                <div class="md-form mt-0 mb-0">
                    <input type="text" class="form-control" name="product_id" id='product_id' value="">
                    <label class="font-weight-normal">Product ID</label>
                </div>
            </div>
        </div>
        @if(!isset($bill_id))
        <div class="row">
            <div class="col-12 mt-4 mb-2">
                <strong class="we_just_txt">@if(isset($selectedMerchantIDCat) && $selectedMerchantIDCat === 4) Duration of course @elseif(isset($selectedMerchantIDCat) && $selectedMerchantIDCat === 7) Warranty Period of the vehicle @elseif(isset($selectedMerchantIDCat) && ($selectedMerchantIDCat === 16 || $selectedMerchantIDCat === 19 || $selectedMerchantIDCat === 20 || $selectedMerchantIDCat === 21 || $selectedMerchantIDCat === 25)) Duration of Treatment @else Warranty Period/Duration of your Product/Treatment/Course @endif</strong>
            </div>
            <div id='duration_year_block' class="col-12 col-md-4 mt-4">
                <div class="md-form mt-0 mb-0">
                    <input type="number" class="form-control field_validation" name="duration_year" @if(isset($duration_year) && $duration_year) readonly disabled="disabled" value="{!! $duration_year or '' !!}" @else value="" @endif id='duration_year' min="0" onkeyup="if (/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')">
                    <label class="font-weight-normal">Years</label>
                </div>
            </div>
            <div id='duration_month_block' class="col-12 col-md-4 mt-4">
                <div class="md-form mt-0 mb-0">
                    <input type="number" class="form-control field_validation" name="duration_month" @if(isset($duration_month) && $duration_month) readonly disabled="disabled" value="{!! $duration_month or '' !!}" @else value="" @endif id='duration_month' min="0" onkeyup="if (/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')">
                    <label class="font-weight-normal">Months</label>
                </div>
            </div>
        </div>
            @endif
        <div class="row">
            <div class="col-12 col-md-4  mt-4 mb-2">
                <div class="md-form mt-0 mb-0 amount_wrap">
                    <div class="col-12 mt-4 mb-2">
                        {{-- <strong>How much would you like to borrow? <span class="required">*</span></strong> --}}
                    </div>
                    <div style="position: relative;">
                        <i class="fa fa-inr prefix"></i>
                        <input type="text" class="form-control" @if(isset($loan_amount) && $loan_amount > 0) readonly
                               disabled="disabled" required='required' value="{!! $loan_amount or '' !!}" @endif name="loan_amount">
                               <label  class="font-weight-normal" for="">AMOUNT NEEDED?<span class="required">*</span></label>
                    </div>
                    {{-- <div class="col-12 col-md-5 mt-4" style="margin-top: 60px !important">
                        <div class="md-form mt-0 mb-0">
                            <i class="fa fa-inr prefix"></i>
                            <input type="text" class="form-control" @if(isset($loan_amount) && $loan_amount > 0) readonly
                                   disabled="disabled" required='required' value="{!! $loan_amount or '' !!}" @endif name="loan_amount">
                                   <label for="">How much would you like to borrow? <span class="required">*</span></label>
                        </div>
                    </div> --}}
                </div>
            </div>
            <div class="col-12 col-md-4  mt-4 mb-2" @if(isset($selectedMerchantID) && $selectedMerchantID > 0) style="display: none;" @endif>
                <div class="md-form mt-0 mb-0">
                    <div class="col-12 mt-4 mb-2">
                        {{-- <strong>How long would you need to borrow for? <span class="required">*</span></strong> --}}
                    </div>
                    <select class="mdb-select" name="tenure" id="tenure_select">
                        <option value="">FOR HOW LONG(MONTHS)?</option>

                        @if(isset($selectedMerchantID) && ($selectedMerchantID > 0))
                            @foreach($selectedMerchantOffers as $offer)
                                <option value="{!! $offer->tenure !!}">{!! $offer->tenure !!} Months</option>
                            @endforeach
                        @else
                            @for($i=3;$i <= 24; $i=$i+3)
                                <option value="{{$i}}">{{$i}} Months</option>
                            @endfor
                        @endif
                    </select>
                </div>
            </div>
            @if(isset($selectedMerchantID) && ($selectedMerchantID > 0))
            <div class="col-12 col-md-4  mt-4 mb-2">
                <div class="md-form mt-0 mb-0">
                    <div class="col-12 mt-4 mb-2">
                        <strong>How long would you need to borrow for? <span class="required">*</span></strong>
                    </div>
                    <div class="view-offer-data"><span class="v-title">Select Offer</span> <span><img style="display:none;width: 16px;float: right;" src="/assets/front/img/loading.gif"/></span></div>
                </div>
            </div>
            @endif
        </div>
        <div class="col-12 mt-4">
            <strong class="font-weight-bold" style="font-size: 19px">Other Details</strong>
        </div>
        <div class="row">
            <div class="col-12 col-md-4">
                <div class="md-form mt-0 mb-0">
                     <div class="col-12 mt-3 mb-2">
                        {{-- <strong>Choose a Preferred Language <span class="required">*</span></strong> --}}
                    </div>
                    <select class="mdb-select" name="preferred_language" id="preferred_language" @if(isset($lang) && $lang) readonly disabled="disabled" @endif>
                        <option value="">YOUR PREFFERED LANGUAGE</option>
                        <option @if(isset($lang) && $lang == 'ENGLISH') selected @endif value="ENGLISH">English</option>
                        <option @if(isset($lang) && $lang == 'HINDI') selected @endif value="HINDI">हिंदी</option>
                        <option @if(isset($lang) && $lang == 'MARATHI') selected @endif value="MARATHI">मराठी</option>
                        <option @if(isset($lang) && $lang == 'GUJARATI') selected @endif value="GUJARATI">ગુજરાતી</option>
                        <option @if(isset($lang) && $lang == 'BENGALI') selected @endif value="BENGALI">বাঙালি</option>
                        <option @if(isset($lang) && $lang == 'PUNJABI') selected @endif value="PUNJABI">ਪੰਜਾਬੀ</option>
                        <option @if(isset($lang) && $lang == 'TAMIL') selected @endif value="TAMIL">தமிழ்</option>
                        <option @if(isset($lang) && $lang == 'TELUGU') selected @endif value="TELUGU">తెలుగు</option>
                        <option @if(isset($lang) && $lang == 'KANNADA') selected @endif value="KANNADA">ಕನ್ನಡ</option>
                        <option @if(isset($lang) && $lang == 'MALAYALAM') selected @endif value="MALAYALAM">മലയാളം</option>
                        <option @if(isset($lang) && $lang == 'URDU') selected @endif value="URDU">اردو</option>
                        <option @if(isset($lang) && $lang == 'ODIA') selected @endif value="ODIA">ଓଡ଼ିଆ</option>
                    </select>
                </div>
            </div>
            @if(isset($selectedMerchantID) && $selectedMerchantID !== 6543)
                @if(!isset($api_init))
            <div class="col-12 col-md-4 mt-3">
                <div class="md-form mt-0 mb-0">
            <div class="col-12 mb-2">
                {{-- <strong class="we_just_txt">How did you find out about Credit Fair?<span class="required"> *</span></strong></strong> --}}
            </div>
                    {{--<input type="text" class="form-control" name="src_representative_name" @if(isset($merchant_location_name)) value="{{$merchant_location_name}}" readonly="" @endif>--}}
                    <select class="mdb-select" name="source" id="source" required="required" onchange="textSource(this.value);">
                        <option value="">HOW DID YOU HEAR ABOUT US?</option>
                        <option value="Social Media">Social Media</option>
                        <option value="Friend/Relative">Friend/Relative</option>
                        <option value="Paytm">Paytm</option>
                        <option value="Google Search">Google Search</option>
                        <option value="Other">Other</option>
                    </select>
                </div>
            </div>
            <div class="col-12 col-md-4 sc-rc-view-l">
                <div class="md-form mb-0">
                    {{--<input type="text" class="form-control" name="src_representative_name" @if(isset($merchant_location_name)) value="{{$merchant_location_name}}" readonly="" @endif>--}}
                    <input placeholder="ENTER SOURCE" type="text" name="source" id="txtSource" style="display: none;" class="form-control"/>
                </div>
            </div>
                    @endif
            @endif

            @if(isset($merchant_email))
                <input type="hidden" class="form-control" name="lead_src_email" value="{{$merchant_email}}" >
            @endif
            @if(isset($merchant_phone))
                <input type="hidden" class="form-control" name="lead_src_phone" value="{{$merchant_phone}}" >
            @endif
        </div>
        <div class="row">
            <div class="col-md-12 text-center" style="margin-bottom: 30px;">
                <button type="submit" class="btn apply_btn mt-4 mb-5 waves-effect waves-light button-logo-shade"
                        style="margin-bottom: 0 !important;">APPLY</button>
                <!-- <a href="javascript:;" id="create_application" class="btn btn-primary apply_btn mt-4 mb-5 waves-effect waves-light" style="margin-bottom: 0 !important;">APPLY</a><br/>
                <a href="javascript:;" id="check_eligibility" class="btn btn-primary eligibility_btn mt-4 mb-5 waves-effect waves-light">Check your eligibility</a> -->
            </div>
        </div>
    </form>
</section>
