<?php $__env->startSection('jsPageBottom'); ?>
<?php echo HTML::style('admin/template/plugin/bootstrap-datepicker/css/datepicker.css'); ?>

<?php echo HTML::script('admin/template/plugin/bootstrap-datepicker/js/bootstrap-datepicker.js'); ?>

<script type="text/javascript">
    var dateServer = "<?php echo date('Y/m/d'); ?>";
    $(document).ready(function () {
        $('.input-group.date').datepicker({
            autoclose: true,
            todayHighlight: true,
            orientation: "top auto",
            startDate: '0d'
        });

        $('.input-group.date input').keypress(function () {
            $('.input-group.date').datepicker('hide');
        }).blur(function () {
            if ($(this).val().length > 0) {
                var date = $(this).val().split('/');
                if (date.length == 2 || (date.length == 3 && date[2] == '')) {
                    var now = new Date();
                    var value = date.join('/') + "/" + now.getFullYear();
                    $(this).val(value.replace('//', '/'));
                }

                var regexDate = /^(0[1-9]|1[012])\/(0[1-9]|[12][0-9]|3[01])\/(19|20|30)\d\d$/;
                if (!regexDate.test($(this).val())) {
                    var now = new Date();
                    var date = $(this).val().split('/');

                    if (date[0] <= 9 && date[0].toString().charAt(0) != "0") {
                        date[0] = "0" + date[0].toString();
                    } else {
                        if (parseInt(date[0]) > 12) {
                            date[0] = "12";
                        }
                    }
                    if (date[1] <= 9 && date[1].toString().charAt(0) != "0") {
                        date[1] = "0" + date[1].toString();
                    } else {
                        if (parseInt(date[1]) > 31) {
                            date[1] = "31";
                        }
                    }
                    if (date[2].toString().length == 2) {
                        date[2] = now.getFullYear().toString().substr(0, 2) + date[2].toString();
                    }
                    $(this).val(date.join('/'));
                }
                //////////////////////////////////////////////////
                var date = dateServer.split('/');
                var today = new Date(date[0], (parseInt(date[1])-1), date[2]);

                var userDate = new Date($(this).val());
                
                if(userDate.getTime() < today.getTime()){
                    alert("Closing date invalid, Date must be after today's date");
                    $(this).val('').focus();
                }
            }
        });
    });
</script>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('cssPage'); ?>
<?php echo HTML::style('admin/template/css/order-forms-both-lien-hoa.css');; ?>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('pageContent'); ?>
<div id="center-body-both">
    <div id="title-background">
        <div id="title-body-orders"> &nbsp;
            <p>ORDER FORMS / BOTH LIEN AND HOA</p>
        </div>
    </div>
    <div id="content" class="content_both_order">
        <div id="form-container">
            <?php if($errors->count()>0): ?>
            <div class="alert alert-danger" id="alert">
                <ul>
                    <?php foreach($errors->all() as $error): ?>
                    <li>
                        <?php echo $error; ?>

                    </li>
                    <?php endforeach; ?>
                </ul>
            </div>
            <?php endif; ?>
            <?php if(Session::has('failed')): ?>
            <div class="alert alert-danger align-right" id="alert">
                <p><?php echo Session::get('failed'); ?></p>
            </div>
            <?php endif; ?>
            <div id="basic-information">
                <?php echo Form::open(['route'=>['order.lienhoaboth.store'], 'files'=>true, 'class'=>'form-horizontal row-border']); ?>

                <div id="title-section">
                    Basic Information
                    <div id="footer_line"></div>
                </div>
                <div id="form-basic-information">
                    <!-- INICIO primer campo de inputs -->
                    <div id="column" class="row">
                        <div class="col-md-3">
                            <p>Requested By:</p>
                            <?php echo Form::text('RequestedBy', Input::old('RequestedBy', Auth::user()->fullname), ['id'=>'requested-by-both', 'class'=>"form-control", 'maxlength'=>"50"]); ?>

                            <?php echo Form::hidden('ClientID', Auth::user()->lien_client_id); ?>

                        </div>
                        <div class="col-md-3">
                            <p>File Number:</p>
                            <?php echo Form::text('FileNo', Input::old('FileNo'), ['id'=>'file-number-both', 'class'=>"form-control center", 'maxlength'=>"50"]); ?>

                        </div>
                        <div class="col-md-3">
                            <p> Closing Date: </p>
                            <?php /* Form::input('date', 'ClosingDate',  Input::old('ClosingDate'), ['id'=>'closing-date-both', 'class'=>"form-control center", 'placeholder'=>"MM/DD/YYYY"]) */ ?>
                            <div class="input-group date">
                                <?php echo Form::text('ClosingDate',  Input::old('ClosingDate'), ['id'=>'closing-date-both', 'class'=>"form-control center", 'placeholder'=>"MM/DD/YYYY"]); ?>

                                <span class="input-group-addon">
                                    <img src="http://onesteplien.com/admin/template/images/ico_calender.png"/>
                                </span>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <label class="checkbox">
                                <p>&nbsp;</p>
                                <p style="color:#C00;">
                                    <?php echo Form::checkbox('IsRUSHOrder', 1,false, ['id'=>'is_rush']); ?>

                                    <?php echo Form::label('is_rush', 'RUSH ORDER', ['id'=>'Light_OnOff']); ?>

                                </p>
                            </label>
                        </div>
                    </div>
                    <!-- FIN primer campo de inputs -->
                </div>
                <div id="title-section">
                    Property Information
                    <div id="footer_line"></div>
                </div>
                <div id="form-property-information" class="fpi_both">
                    <!-- INICIO segundo campo de inputs -->
                    <div id="column" class="row">
                        <div class="col-md-1">
                            <p>Number:</p>
                            <?php echo Form::text('StreetNo',false, ['class'=>'form-control-especial center', 'maxlength'=>"50"]  ); ?>

                        </div>
                        <div class="col-sm-2">
                            <p>&nbsp;</p>
                            <?php echo Form::select('StreetDirectionID',($select + $streetDirection), Input::old('StreetDirectionID'), ['class'=>'form-control center-especial StreetDirectionID']); ?>

                        </div>
                        <div class="col-md-3">
                            <p>Street Name:</p>
                            <?php echo Form::text('StreetName',false, ['class'=>'form-control center', 'maxlength'=>"100"] ); ?>

                        </div>
                        <div class="col-md-3">
                            <p>Type:</p>
                            <?php echo Form::select('StreetTypeID',(['-1'=>'Select'] + $streetType), Input::old('StreetTypeID'), ['class'=>'form-control center StreetTypeID']); ?>

                        </div>
                        <div class="col-md-2">
                            <p>Unit Number:</p>
                            <?php echo Form::text('StreetUnitNo',false, ['class'=>'form-control center', 'maxlength'=>"50"] ); ?>

                        </div>
                    </div>
                    <!-- FIN segundo campo de inputs -->
                    <!-- INICIO tercer campo de inputs -->
                    <div id="column" class="row">
                        <div class="col-md-3">
                            <p style="text-align:left; font-weight:bold">City:</p>
                            <?php echo Form::select('CityID',($select + $cities), Input::old('CityID'), ['id'=>'city-lien', 'class'=>'form-control center']); ?>

                        </div>
                        <div class="col-md-3">
                            <p>Zip:</p>
                            <?php echo Form::text('ZipCode',Input::get('ZipCode'), ['class'=>'form-control center', 'maxlength'=>"10"] ); ?>

                        </div>
                        <div class="col-md-3">
                            <p>County:</p>
                            <?php echo Form::select('CountyID',($select + $counties), Input::old('CountyID'), ['id'=>'county-lien', 'class'=>'form-control center']); ?>

                        </div>
                    </div>
                    <!-- FIN tercer campo de inputs -->
                    <!-- INICIO cuarto campo de inputs -->
                    <div id="column" class="row">
                        <div class="col-md-3">
                            <p>Folio Number:</p>
                            <?php echo Form::text('FolioNo',Input::get('FolioNo'), ['class'=>'form-control center', 'maxlength'=>"100"] ); ?>

                        </div>
                        <div class="col-md-6">
                            <p>Legal Description:</p>
                            <?php echo Form::textarea('LegalDescription',Input::get('LegalDescription'), ['class'=>'form-control', 'size'=>'3x5', 'maxlength'=>"1000"] ); ?>

                        </div>
                    </div>
                    <!-- FIN cuarto campo de inputs -->
                    <!-- INICIO 5to campo de inputs -->
                    <div id="column" class="row">
                        <div class="col-md-3">
                            <p>Buyer:</p>
                            <?php echo Form::text('BuyerName',Input::get('BuyerName'), ['class'=>'form-control center', 'maxlength'=>"100"] ); ?>

                        </div>
                        <div class="col-md-3">
                            <p>Seller:</p>
                            <?php echo Form::text('SellerName',Input::get('SellerName'), ['class'=>'form-control center', 'maxlength'=>"100"] ); ?>

                        </div>
                    </div>
                    <!-- FIN 5to campo de inputs -->
                    <!-- Inicio 6to campo de inputs -->
                    <div id="column" class="row">
                        <div class="col-md-9">
                            <p> Specific Instructions: </p>
                            <?php echo Form::textarea('SpecialInstruction',Input::get('SpecialInstruction'), ['class'=>'form-control','size'=>'3x5', 'maxlength'=>"2000"] ); ?>

                        </div>
                    </div>
                    <!-- FIN 6to campo de inputs -->
                </div>
                <?php echo $__env->make('helpers.lienSelections', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                <div id="title-section">
                    HOA Information
                    <div id="footer_line"></div>
                </div>
                <div id="form-order-hoa">
                    <!-- HOA INFORMATION 1-->
                    <div id="column" class="row">
                        <div class="col-md-6">
                            <p> HOA Name: </p>
                            <?php echo Form::text('HOAName',Input::old('HOAName'), ['class'=>'form-control center', 'maxlength'=>"255"] ); ?>

                        </div>
                        <div class="col-md-6">
                            <div class="col-md-2">
                                <p> Phone: </p>
                                <?php echo Form::text('hoa_tel[0]',Input::get('hoa_tel.0'), ['class'=>'form-control-especial', 'id'=>'tel1', 'size'=>'3', 'maxlength'=>'3']); ?>

                            </div>
                            <div class="col-md-2">
                                <p>&nbsp;</p>
                                <?php echo Form::text('hoa_tel[1]',Input::get('hoa_tel.1'), ['class'=>'form-control-especial', 'id'=>'tel2', 'size'=>'3', 'maxlength'=>'3']); ?>

                            </div>
                            <div class="col-md-2">
                                <p>&nbsp;</p>
                                <?php echo Form::text('hoa_tel[2]',Input::get('hoa_tel.2'), ['class'=>'form-control-especial', 'id'=>'tel3', 'size'=>'4', 'maxlength'=>'4']); ?>

                            </div>
                        </div>
                    </div>
                    <!-- FIN  -->
                    <!-- HOA INFORMATION 2 -->
                    <div id="column" class="row">
                        <div class="col-md-6">
                            <p> Listing Agent/ Realtor: </p>
                            <?php echo Form::text('ListingAgentName',Input::get('ListingAgentName'), ['class'=>'form-control center', 'maxlength'=>"255"] ); ?>

                        </div>
                        <div class="col-md-6">
                            <div class="col-md-2">
                                <p> Phone: </p>
                                <?php echo Form::text('agent_tel[0]',Input::get('agent_tel.0'), ['class'=>'form-control-especial', 'id'=>'tel1', 'size'=>'3', 'maxlength'=>'3'] ); ?>

                            </div>
                            <div class="col-md-2">
                                <p>&nbsp;</p>
                                <?php echo Form::text('agent_tel[1]',Input::get('agent_tel.0'), ['class'=>'form-control-especial', 'id'=>'tel2', 'size'=>'3', 'maxlength'=>'3'] ); ?>

                            </div>
                            <div class="col-md-2">
                                <p>&nbsp;</p>
                                <?php echo Form::text('agent_tel[2]',Input::get('agent_tel.0'), ['class'=>'form-control-especial', 'id'=>'tel2', 'size'=>'4', 'maxlength'=>'4'] ); ?>

                            </div>
                        </div>
                    </div>
                    <!-- FIN -->
                </div>
            </div>
            <?php echo $__env->make('helpers.uploadDoc', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
            <div id="title-section">
                Search Response Delivery
                <div id="footer_line"></div>
            </div>
            <?php echo $__env->make('site.EmailFax', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
            <?php echo $__env->make('site.buttonsSubmit', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
            </form>
            <?php if(Session::has('message')): ?>
            <div class="alert alert-<?php echo Session::get('class'); ?>"><?php echo Session::get('message'); ?></div>
            <?php endif; ?>
        </div>
    </div>
</div>
<?php echo $__env->make('helpers.footer', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('helpers.base', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>