/home/mip/mip/app/Modules/Client/Views/principals/includes/js.blade.php
<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! JsValidator::formRequest('QxCMS\Modules\Client\Requests\Principals\PrincipalRequest', '#principal-form'); !!}
<script type="text/javascript">
$(function(){
    var body = $('body');
    var form = $('form#principal-form');
   /* 
    $('#real_password').on('keyup', function(e){
        $('#password').val($(this).val());
        e.preventDefault();
    });
    $('#real_password').attr('type', 'password');
    $('#view-password').on('click', function(e) {
        if($(this).hasClass('open')) {
            $(this).removeClass('open');
            $(this).closest('.input-group').find('input').attr('type', 'password');
            $(this).html('<i class="fa fa-eye-slash"></i>');
        } else {
            $(this).addClass('open');
            $(this).closest('.input-group').find('input').attr('type', 'text');
            $(this).html('<i class="fa fa-eye"></i>');
        }
    });*/

    $(".intlphone").intlTelInput({
          //allowExtensions:true,
        autoFormat:true,
        numberType:"MOBILE",
          //autoPlaceholder:false,
        defaultCountry: "ph",
          //autoHideDialCode: false,
         // nationalMode:true,
        utilsScript: body.data('url')+'/template/AdminLTE/plugins/intlnum/lib/libphonenumber/build/utils.js'
    });



    $('body').on('click', 'button.add-contact-btn', function(e){
        var counter = form.find('input[name^="contact"]').length + 1;

        var limit = 5;
        if (counter > limit)  {
              swal('',"You have reached the maximum limit of contact.", 'error');
              return false
        }
        var new_input = "<div class=\"form-group\">";
                new_input += "<label class=\"control-label col-md-2\"></label>";
                new_input += "<div class=\"col-md-6\">";
                    new_input += "<div class=\"input-group\">"
                        new_input += "<input type=\"text\" name=\"contact_details[new_"+counter+"]\" class=\"form-control intlphone\" style=\"width:100%\">";
                        new_input += "<div class=\"input-group-btn\">";
                            new_input += "<button class=\"btn btn-flat btn-danger remove-contact-btn\" type=\"button\"><i class=\"fa fa-times\"></i></button>";           
                        new_input += "</div>";
                    new_input += "</div>";
                new_input += "</div>";
            new_input += "</div>";

        $('.contact-holder').append(new_input);
        $(".intlphone").intlTelInput({
          //allowExtensions:true,
            autoFormat:true,
            numberType:"MOBILE",
          //autoPlaceholder:false,
            defaultCountry: "ph",
          //autoHideDialCode: false,
         // nationalMode:true,
            utilsScript: body.data('url')+'/template/AdminLTE/plugins/intlnum/lib/libphonenumber/build/utils.js'
        });
        return false;  
        
    });

      $('body').on('click', 'button.remove-contact-btn', function(e){
            $(this).closest('.form-group').remove();
        });

    $('button.save-btn').on('click', function() {
        var btn = $(this);
        btn.button('loading');
        if($('form#principal-form').valid()) return true;

        setTimeout(function(){
            btn.button('reset');
        }, 200);

       return false;
    });
});
</script>