<?php $__env->startSection('content'); ?>
<div class="card card-outline-info">
  <div class="card-header">
      <h4 class="m-b-0 text-white">Create Lead - New User Customer</h4>
  </div>
  <div class="card-body">
    <div class="x_content">
      <form id="demo-form2" action="<?php echo e(url('/admin/doUpdateLeadStatus/'.$customer->id)); ?>" method="post" enctype="multipart/form-data" data-parsley-validate class="form-horizontal form-label-left">
        <?php echo e(csrf_field()); ?>

            <div class="row">
                <div class="col-md-4">
                    <div class="form-group">
                      <?php echo Form::label('placement', 'Tracking No.*', ['class' => 'control-label']); ?>

                      <input type="text" class="form-control" value="<?php echo e($customer->ack_number); ?>" id="copyInput" readonly>  
                      <!-- Copy Button with Icon -->
                      <button class="btn btn-outline-secondary" type="button" id="button-copy" onclick="copyText()">
                        <i class="fa fa-clipboard"></i> <!-- Bootstrap Icon -->
                      </button>
                    </div>
                </div>
            </div>
            <?php if($customer->lead_type=='New'): ?>
            <h3 class="card-title">Personal Detail</h3>

            <div class="row">
                <div class="col-md-4">
                    <div class="form-group">
                        <?php echo Form::label('placement', 'Placement*', ['class' => 'control-label']); ?>

                        <?php echo e($customer->placement=='r' ? 'Right' : 'Left'); ?>

                    </div>
                </div>
                <div class="col-md-8">
                    <div class="form-group">
                        <?php echo Form::label('full_name', 'Full Name*', ['class' => 'control-label', 'required']); ?>

                        <?php echo e($customer->full_name); ?>

                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <?php echo Form::label('gender', 'Gender*', ['class' => 'control-label']); ?>

                        <?php echo e($customer->gender==0 ? 'Male' : 'Female'); ?>

                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <?php echo Form::label('mobileno', 'Mobile no.*', ['class' => 'control-label']); ?>

                        <?php echo e($customer->mobileno); ?>

                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                    <?php echo Form::label('email', 'Email*', ['class' => 'control-label']); ?>

                    <?php echo e($customer->email); ?>

                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <?php echo Form::label('panno', 'Pan no.*', ['class' => 'control-label']); ?>

                        <?php echo e($customer->panno); ?>

                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <?php echo Form::label('dob', 'Date of Birth*', ['class' => 'control-label']); ?>

                        <?php echo e($customer->dob); ?>

                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                    <?php echo Form::label('address', 'Address', ['class' => 'control-label']); ?>

                        <?php echo e($customer->address); ?>

                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                    <?php echo Form::label('pincode', 'Pincode', ['class' => 'control-label']); ?>

                        <?php echo e($customer->pincode); ?>

                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                    <?php echo Form::label('state', 'State*', ['class' => 'control-label']); ?>


                    <?php echo e($customer->state_name); ?>

                </div>
                <div class="col-md-4">
                    <div class="form-group">
                    <?php echo Form::label('city', 'City*', ['class' => 'control-label']); ?>

                        <?php echo e($customer->city_name); ?>

                    </div>
                </div>                
            </div>
            <?php endif; ?>
            <h3 class="card-title">Solar And Connection</h3>
            <div class="row">
                <div class="col-md-4">
                    <div class="form-group">
                        <?php echo Form::label('bank_name', 'Bank Name', ['class' => 'control-label']); ?>

                        <?php echo e($customer->bank_name); ?>

                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <?php echo Form::label('econn_no', 'Monthly Avg Electric Bill Amount*', ['class' => 'control-label']); ?>

                        <?php echo e($customer->econn_no); ?>

                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <?php echo Form::label('solar_conn_type', 'Solar Connection Type*', ['class' => 'control-label']); ?>

                        <?php echo e($customer->solar_conn_type); ?>

                    </div>
                </div>
                <div class="col-md-4">
                      <div class="form-group">
                      <label for="ev_ev_solar_model_id" class="control-label">Solar Name<span class="required">*</span></label>                  
                        <?php echo e($ev_ev_solar_model_ids->title); ?>

                    </div>
                </div>
                <div class="col-md-4">
                      <div class="form-group">
                      <label for="ev_ev_solar_model_id" class="control-label">KW<span class="required">*</span></label>                  
                        <?php echo e($ev_ev_solar_model_ids->kw); ?>

                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <?php echo Form::label('property_type', 'Property Type*', ['class' => 'control-label']); ?>

                        <?php echo e($customer->property_type); ?>

                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <?php echo Form::label('monthly_elecbill', 'Electricity Connection No.', ['class' => 'control-label']); ?>

                        <?php echo e($customer->monthly_elecbill); ?>

                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <?php echo Form::label('payment_type', 'Payment Type*', ['class' => 'control-label']); ?>

                        <?php echo e($customer->payment_type); ?>

                    </div>
                </div>
                <div class="col-md-4" id="loan_amount_con">
                    <div class="form-group">
                        <?php echo Form::label('loan_amount', 'Loan Amount', ['class' => 'control-label']); ?>

                        <?php echo e($customer->loan_amount); ?>

                    </div>
                </div>
            </div>
            <h3 class="card-title">Upload Documents</h3>
            <div class="row">
                <div class="col-md-4">
                    <div class="form-group">
                        <?php echo Form::label('aadhar_front', 'Aadhaar Front*', ['class' => 'control-label']); ?>

                        <p class="help-block"><a href="<?php echo e(url('/uploads/proofs/'.$customer->aadhar_front)); ?>" target="_blank"><img src="<?php echo e(url('/uploads/proofs/'.$customer->aadhar_front)); ?>" style="width: 200px;"></a></p>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <?php echo Form::label('aadhar_back', 'Aadhaar Back*', ['class' => 'control-label']); ?>

                        <p class="help-block"><a href="<?php echo e(url('/uploads/proofs/'.$customer->aadhar_back)); ?>" target="_blank"><img src="<?php echo e(url('/uploads/proofs/'.$customer->aadhar_back)); ?>" style="width: 200px;"></a></p>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <?php echo Form::label('pan_image', 'Pan Card*', ['class' => 'control-label']); ?>

                        <p class="help-block"><a href="<?php echo e(url('/uploads/proofs/'.$customer->pan_image)); ?>" target="_blank"><img src="<?php echo e(url('/uploads/proofs/'.$customer->pan_image)); ?>" style="width: 200px;"></a></p>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <?php echo Form::label('elect_bill_image', 'Electricity Bill*', ['class' => 'control-label']); ?>

                        <p class="help-block"><a href="<?php echo e(url('/uploads/proofs/'.$customer->elect_bill_image)); ?>" target="_blank"><img src="<?php echo e(url('/uploads/proofs/'.$customer->elect_bill_image)); ?>" style="width: 200px;"></a></p>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <?php echo Form::label('pass_cheque_book', 'Bank Passbook or Cheque*', ['class' => 'control-label']); ?>

                        <p class="help-block"><a href="<?php echo e(url('/uploads/proofs/'.$customer->pass_cheque_book)); ?>" target="_blank"><img src="<?php echo e(url('/uploads/proofs/'.$customer->pass_cheque_book)); ?>" style="width: 200px;"></a></p>
                    </div>
                </div>
            </div>
            <h3 class="card-title">Payment</h3>
            <div class="row">
                <div class="col-md-6 col-sm-12 col-xs-12">
                    <img src="<?php echo e(url('/MerchantQRCode.png')); ?>" style="width: 537px;">
                </div>
                <div class="col-md-6 col-sm-6 col-xs-12">
                    <div class="row">
                        
                        <div class="col-md-12">
                            <div class="form-group">
                                <?php echo Form::label('payment_proof', 'Screenshot of UPI payment', ['class' => 'control-label']); ?>

                                <p class="help-block"><a href="<?php echo e(url('/uploads/proofs/'.$customer->payment_proof)); ?>" target="_blank"><img src="<?php echo e(url('/uploads/proofs/'.$customer->payment_proof)); ?>" style="width: 200px;"></a></p>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="form-group">
                                <?php echo Form::label('payment_reference', 'Payment Reference/UTR No.*', ['class' => 'control-label']); ?>

                        <?php echo e($customer->payment_reference); ?>

                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="form-group">
                                <?php echo Form::label('sponsor_comment', 'Any Comment Optional', ['class' => 'control-label']); ?>

                                <?php echo e($customer->sponsor_comment); ?>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <h3 class="card-title">Payment</h3>
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <?php echo Form::label('status', 'Status*', ['class' => 'control-label']); ?>

                        <?php echo e($customer->status_name); ?>


                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <?php echo Form::label('admin_comment', 'Admin Comment*', ['class' => 'control-label']); ?>

                        <?php echo e($customer->approve_comment); ?>

                        <br/>
                        <?php echo e($customer->loan_comment); ?>

                    </div>
                </div>
            </div>
            
        </div>
        <div class="ln_solid"></div>

      </form>
    </div>
  </div>
</div>
<!-- /page content -->
<?php $__env->stopSection(); ?>
<?php $__env->startSection('javascript'); ?>
    <!-- Date picker plugins css -->
    <link href="<?php echo e(url('assets')); ?>/plugins/bootstrap-datepicker/bootstrap-datepicker.min.css" rel="stylesheet" type="text/css" />
    <!-- Daterange picker plugins css -->
    <link href="<?php echo e(url('assets')); ?>/plugins/timepicker/bootstrap-timepicker.min.css" rel="stylesheet">
    <link href="<?php echo e(url('assets')); ?>/plugins/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">
    <!-- Date Picker Plugin JavaScript -->
    <script src="<?php echo e(url('assets')); ?>/plugins/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
    <!-- Date range Plugin JavaScript -->
    <script src="<?php echo e(url('assets')); ?>/plugins/timepicker/bootstrap-timepicker.min.js"></script>
    <script src="<?php echo e(url('assets')); ?>/plugins/bootstrap-daterangepicker/daterangepicker.js"></script>
    <script src="<?php echo e(url('assets')); ?>/js/jqBootstrapValidation.js"></script>
    <link href="<?php echo e(url('assets')); ?>/plugins/EasyAutocomplete/easy-autocomplete.min.css" rel="stylesheet">
    <script src="<?php echo e(url('assets')); ?>/plugins/EasyAutocomplete/jquery.easy-autocomplete.min.js"></script>
    <script src="<?php echo e(url('assets')); ?>/js/typeahead.bundle.js"></script>
    <!-- Parsley -->
    <script>
    $(document).ready(function() {
      jQuery('.mydatepicker, #datepicker').datepicker({format: 'dd-mm-yyyy'});
      $('#state-dropdown').on('change', function() {
            var state_id = this.value;
            $("#city-dropdown").html('');
            $.ajax({
                url:"<?php echo e(url('get-cities-by-state')); ?>",
                type: "POST",
                data: {
                state_id: state_id,
                _token: '<?php echo e(csrf_token()); ?>' 
                },
                dataType : 'json',
                success: function(result){
                $('#city-dropdown').html('<option value="">Select City</option>'); 
                $.each(result.cities,function(key,value){
                $("#city-dropdown").append('<option value="'+value.id+'">'+value.name+'</option>');
                });
                }
            });
        });
    });

    payment_type
    loan_amount

    $(document).ready(function() {
        $('#payment_type').on('change', function() {
            var selectedValue = $(this).val();
            if(selectedValue=="self"){
                $("#loan_amount_con").hide();
            }else{
                $("#loan_amount_con").show();
            }            
        });

        $('#ev_ev_solar_model_id').on('change', function() {
            var selectedValue = $(this).find(':selected').attr('amount');            
            $("input#loan_amount").val(selectedValue);
            
        });
        const form = document.getElementById('demo-form2');

        form.addEventListener('submit', function(event) {
          const amount = $('#ev_ev_solar_model_id').find(':selected').attr('amount');
          
          if ($("input#loan_amount").val() > amount && $('#payment_type').val()=='loan') {
            // Prevent the form from submitting
            event.preventDefault();
            alert('Loan Amount must be less or equal to '+amount);
          }
        });
    });
    
    function copyText() {
      var copyText = document.getElementById("copyInput");
      navigator.clipboard.writeText(copyText.value).then(() => {
        alert("Text copied: " + copyText.value);
      });
    }
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home2/justsolar/public_html/resources/views/admin/leads/view_lead.blade.php ENDPATH**/ ?>