<link rel="stylesheet" type="text/css" href="<?php echo e(url('dropzone/dist/min/dropzone.min.css')); ?>">
<style>              
.img-prew{
width: 100px;
height: 100px;
margin-top: -95px;
border-radius: 50%;
margin-left: -5px;
       }
.post-imgPrw{
height: 75px;
margin-left: 10px;
width: 100px;
margin-top: 0px;
       }   
       

.invalid-feedback {
  display:block;
}
.image img {
    width: 247px;
    height: 271px;
    object-fit: cover;
}
</style>
<?php $__env->startSection('content'); ?>
<div class="common-content">
          <div class="page-content">
                <div class="page-heading">
                    <div class="headings">
                        <h6>Add Subadmin</h6>
                    </div>
                </div>
                <form method="POST" id="add_mannufacturer" action="<?php echo e(url('admin/save_subadmin')); ?>"  enctype="multipart/form-data">
                <?php echo csrf_field(); ?>
                <div class="dashboard-cnts">
                    <div class="bid-stats bidplace">
                        <div class="row">
                            
                           <!-- <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                                <div class="form-inputs">
                                     <div class="form-group">
                                     <label>GST/VAT No</label>
                                       <input type="text" id="gst_no" class="form-control <?php $__errorArgs = ['gst_no'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" name="gst_no" value="<?php echo e(old('gst_no')); ?>"  autocomplete="gst_no" autofocus>
                                       <?php $__errorArgs = ['gst_no'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <span class="invalid-feedback" role="alert">
                                        <strong><?php echo e($message); ?></strong>
                                    </span>
                                      <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                      </div>
                                </div>
                              </div>-->
                              
                          
                            <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                                <div class="form-inputs">
                                     <div class="form-group">
                                        <label>Name</label>
                                        <input type="text" class="form-control <?php $__errorArgs = ['name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" name="name" id="name" value="<?php echo e(old('name')); ?>" required autocomplete="name" autofocus>
                                        <?php $__errorArgs = ['name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                            <span class="invalid-feedback" role="alert">
                                                <strong><?php echo e($message); ?></strong>
                                            </span>
                                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                      </div>
                                </div>
                              </div>
                              <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                                <div class="form-inputs">
                                     <div class="form-group">
                                        <label>Email</label>
                                        <input type="text" class="form-control <?php $__errorArgs = ['email'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" id="email" name="email" value="<?php echo e(old('email')); ?>" required autocomplete="email" autofocus>
                                        <?php $__errorArgs = ['email'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                            <span class="invalid-feedback" role="alert">
                                                <strong><?php echo e($message); ?></strong>
                                            </span>
                                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                      </div>
                                </div>
                              </div>
                              <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                                <div class="form-inputs">
                                     <div class="form-group">
                                        <label>Password</label>
                                        <input type="password" class="form-control <?php $__errorArgs = ['password'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" id="password" name="password" value="<?php echo e(old('password')); ?>" required autocomplete="password" autofocus>
                                        <?php $__errorArgs = ['password'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                            <span class="invalid-feedback" role="alert">
                                                <strong><?php echo e($message); ?></strong>
                                            </span>
                                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                      </div>
                                </div>
                              </div>

                 
                              
                  
                  
                            
                        </div>
                        <div class="row">
                         <div class="col-12">
                            <div class="green-button green-button2">
                                <button id="create">Submit</button>
                             </div> 
                         </div>
                      </div>
                </div>
                </form>
          </div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('scripts'); ?>
<script src="<?php echo e(url('dropzone/dist/min/dropzone.min.js')); ?>" type="text/javascript"></script>

<script>  

function readURLimage(input) {
  if (input.files && input.files[0]) {
        
    var file = input.files[0];
    var fileType = file["type"];

var validImageTypes = ["image/png", "image/jpeg", "image/png"];
if ($.inArray(fileType, validImageTypes) < 0) {
     
     var reader = new FileReader();

            reader.onload = function (e) {
                $('#blah1image')
                    .attr('src', e.target.result)
            };

            reader.readAsDataURL(input.files[0]);
}
else{

   var reader = new FileReader();

            reader.onload = function (e) {
                $('#blahimage')
                    .attr('src', e.target.result)
            };

            reader.readAsDataURL(input.files[0]);
  }
       
 }
    }

  function changePicimage(){ 
      
      document.getElementById('post_imageimage').click();
      
          $('#post_imageimage').change(function() {
             var filename = $('#post_imageimage').val();
 
        var fileExtension = ['jpeg', 'jpg', 'png', 'gif'];
        if ($.inArray(filename.split('.').pop().toLowerCase(), fileExtension) == -1) {
        
                 if(filename){
                 $('#blahimage').hide();
                 $('#blah1image').show();
                 $('#uploadimageimage').hide();
                $(".invalid-feedback").css("display", "none");

              }
              $('#post_imageimage').html(filename);
           
        }
        else{
        
           if(filename){
                $('#blah1image').hide();
                $('#blahimage').show();
                $('#uploadimageimage').hide();
                $(".invalid-feedback").css("display", "none");

              }
              $('#post_imagereport').html(filename);
        
        }  
       });
    }

$('#country').on('change', function() {
      var countryid = this.value;
      var APP_URL = <?php echo json_encode(url('/getstates1')); ?> ;
      var saveData = $.ajax({
            type: 'GET',
            url: APP_URL+'/'+countryid,
            data: { countryid: countryid, _token: '<?php echo e(csrf_token()); ?>' },
            dataType: "text",
            success: function(resultData) { 
              $("#state").html(resultData);
            }
            });
            
    });
</script>
<script>
$("#create").click(function(){
    //alert("bbbb");
	$("#add_mannufacturer").validate({
		ignore: [],
        rules: {
            "name": {
                required: true
               
            },
			"email": {
                required: true,
                email: true
               
            },
			"password": {
                required: true,
                minlength: 8
               
            },
            "address": {
                required: true
               
            },
            "state": {
                required: true
               
            },
            "city": {
                required: true
               
            },
            "zipcode": {
                required: true
               
            },
            "phone_no": {
                required: true
               
            },
             "contact_name": {
                required: true
               
            },
             "contact_phone_no": {
                required: true
               
            }, 
            
            "description": {
                required: true
               
            },
        },
        submitHandler: function(form, e) {
             $(".pageloader").show();
            $(".pageloader").delay(5000).fadeOut("slow");
		   form.submit();
        }
    });
});
$(function(){
    $('#add_mannufacturer').on('submit', function(event){
        event.preventDefault();
       
    });
});
</script>

<!--<script>
    $(document).ready(function() {
   $('#gst_no').focusout(function() {
        var gst = $('#gst_no').val();
        if($('#gst_no').val() != ""){     
                var gst = $('#gst_no').val();
                var APP_URL = <?php echo json_encode(url('/getgstdetails')); ?> ;
                var saveData = $.ajax({
                    type: 'GET',
                    url: APP_URL+'/'+gst,
                    data: { gst: gst, _token: '<?php echo e(csrf_token()); ?>' },
                    dataType: "text",
                        success: function(resultData) { 
                        var res = JSON.parse(resultData);
                        var name= res.taxpayerInfo.tradeNam;
                        var dno = res.taxpayerInfo.adadr[0].addr.bno;
                        var bnm = res.taxpayerInfo.adadr[0].addr.bnm;
                        var st = res.taxpayerInfo.adadr[0].addr.st;
                        var loc = res.taxpayerInfo.adadr[0].addr.loc;
                        var dst = res.taxpayerInfo.adadr[0].addr.dst;
                        var stcd = res.taxpayerInfo.adadr[0].addr.stcd;
                        var pncd = res.taxpayerInfo.adadr[0].addr.pncd;
                        var address =dno+','+bnm+','+st+','+loc+','+dst+','+stcd+','+pncd;
                        $('#name').val(name);
                        $('#address').val(address);
                        $('#zipcode').val(pncd);
                    }
                });
                $(".pageloader").show();
                $(".pageloader").delay(5000).fadeOut("slow");
        }
    });
});
</script>-->
<script>
    $(document).ready(function() {
   $('#gst_no').focusout(function() {
        var gst_no = $('#gst_no').val();
        if($('#gst_no').val() != ""){     
                var gst_no = $('#gst_no').val();
                var APP_URL = <?php echo json_encode(url('/getmanufacturedetails')); ?> ;
                var saveData = $.ajax({
                    type: 'GET',
                    url: APP_URL+'/'+gst_no,
                    data: { gst_no: gst_no, _token: '<?php echo e(csrf_token()); ?>' },
                    dataType: "text",
                        success: function(resultData) {
                            console.log(resultData);
                            var res = JSON.parse(resultData);
                            if(res !== null && res !== ''){
                                if(res.user_type == '1'){
                                    alert('This Gst No is already registered as a buyer.');
                                }else if(res.user_type == '2'){
                                    alert('This Gst No is already registered as a Vendor.');
                                }else if(res.user_type == '3'){
                                     alert('This Gst No is already registered as a Manufacturer.');
                                }
                                
                            }else{
                                var gst = $('#gst_no').val();
                                var APP_URL = <?php echo json_encode(url('/getgstdetails')); ?> ;
                                var saveData = $.ajax({
                                    type: 'GET',
                                    url: APP_URL+'/'+gst,
                                    data: { gst_no: gst_no, _token: '<?php echo e(csrf_token()); ?>' },
                                    dataType: "text",
                                        success: function(resultData) { 
                                        var res = JSON.parse(resultData);

                                        //var res = JSON.parse(resultData);
                                            console.log(res);
                                            var name= res.taxpayerInfo.lgnm;
                                            console.log(name);

                                        var name= res.taxpayerInfo.tradeNam;
                                        var dno = res.taxpayerInfo.pradr.addr.bno;
                                        var bnm = res.taxpayerInfo.pradr.addr.bnm;
                                        var st = res.taxpayerInfo.pradr.addr.st;
                                        var loc = res.taxpayerInfo.pradr.addr.loc;
                                        var dst = res.taxpayerInfo.pradr.addr.dst;
                                        var stcd = res.taxpayerInfo.pradr.addr.stcd;
                                        var pncd = res.taxpayerInfo.pradr.addr.pncd;
                                        var address =dno+','+bnm+','+st+','+loc+','+dst+','+stcd+','+pncd;
                                        $('#name').val(name);
                                        $('#address').val(address);
                                        $('#zipcode').val(pncd);
                                    }
                                });    
                            }
                        
                        
                    }
                });
                $(".pageloader").show();
                $(".pageloader").delay(5000).fadeOut("slow");
        }
    });
});
</script>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.main_admin', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/meddbot/public_html/resources/views/admin/addsubadmin.blade.php ENDPATH**/ ?>