<?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 $__env->stopSection(); ?>
<?php $__env->startSection('pageContent'); ?>
<div id="center-body">
    <div id="title-background">
        <div id="title-body-orders"> &nbsp;
            <p> UPDATE LIEN ORDERS INFORMATION
        </div>
    </div>
    <div id="content" class="content_lien_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="title-section">
                Basic Information
                <div id="footer_line"></div>
            </div> -->
            <div id="basic-information">
                <?php echo Form::open(['route'=>['order.lien.update', $order->OrderID], 'files' => true]); ?>

                <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-lien', 'class'=>"form-control", 'maxlength'=>"50"]); ?>

                            <?php echo Form::hidden('ClientID', Auth::user()->lien_client_id); ?>

                            <?php echo Form::hidden('FileNo', $order->FileNo); ?>

                            <?php echo Form::hidden('ResponseTypeID', $order->ResponseTypeID); ?>

                        </div>
                        <div class="col-md-3">
                            <p>Closing Date:</p>
                            <?php /* Form::input('date', 'ClosingDate',  Input::old('FileNo'), ['id'=>'closing-date-lien', 'class'=>"form-control", 'placeholder'=>"MM/DD/YYYY"]) */ ?>
                            <div class="input-group date">
                                <?php echo Form::text('ClosingDate',  Input::old('ClosingDate'), ['id'=>'closing-date-lien', '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>
                                <p>&nbsp;</p>
                                <?php echo Form::label('is_rush', 'RUSH ORDER', ['id'=>'Light_OnOff']); ?>

                                <?php echo Form::checkbox('IsRUSHOrder', 1,false, ['id'=>'is_rush']); ?>

                            </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_lien" style="height: auto;">
                    <!-- INICIO segundo campo de inputs -->
                    <!--                    <div id="column" class="row">
                                            <div class="col-md-1">
                                                <p>Number:</p>
                                                <?php echo Form::text('StreetNo', Input::old('StreetNo', $order->Property->StreetNo), ['id'=>'number-street-lien', 'class'=>"form-control-especial center"]); ?>

                                            </div>
                                            <div class="col-sm-2">
                                                <p>&nbsp;</p>
                                                <?php echo Form::select('StreetDirectionID', [''=>'Select'] + $streetDirections, Input::old('StreetDirectionID',$order->Property->StreetDirectionID), ['id'=>'', 'class'=>"form-control center"]); ?>

                                            </div>
                                            <div class="col-md-3">
                                                <p>Street Name:</p>
                                                <?php echo Form::text('StreetName', Input::old('StreetName', $order->Property->StreetName), ['id'=>'street-name-lien', 'class'=>"form-control center"]); ?>

                                            </div>
                                            <div class="col-md-3">
                                                <p> Type: </p>
                                                <?php echo Form::select('StreetTypeID', [''=>'Select'] + $streetTypes, Input::old('StreetTypeID', $order->Property->StreetTypeID), ['id'=>'type-lien', 'class'=>"form-control center"]); ?>

                                            </div>
                                            <div class="col-md-2">
                                                <p>Unit Number:</p>
                                                <?php echo Form::text('StreetUnitNo', Input::old('StreetUnitNo', $order->Property->StreetUnitNo), ['id'=>'unit-number-lien', 'class'=>"form-control center"]); ?>

                                            </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>
                                                <input name="city" id="city-lien" type="text" class="form-control center" placeholder="City">
                                                <?php echo Form::select('CityID', [''=>'Select'] + $cities, Input::old('CityID', $order->Property->CityID), ['id'=>'city-lien', 'class'=>"form-control center"]); ?>

                                            </div>
                                            <div class="col-md-3">
                                                <p> Zip: </p>
                                                <input name="ZipCode" id="zip-lien" class="form-control center" placeholder="">
                                                <?php echo Form::text('ZipCode', Input::old('ZipCode', $order->Property->ZipCode), ['id'=>'zip-lien', 'class'=>"form-control center"]); ?>

                                            </div>
                                            <div class="col-md-3">
                                                <p> County: </p>
                                                <?php echo Form::select('CountyID', [''=>'Select'] + $counties, Input::old('CountyID', $order->Property->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::old('FolioNo', $order->Property->FolioNo), ['id'=>'folio-number-lien', 'class'=>"form-control center"]); ?>

                                            </div>
                                            <div class="col-md-6">
                                                <p> Legal Description: </p>
                                                <?php echo Form::textarea('LegalDescription', Input::old('LegalDescription', $order->Property->LegalDescription), ['id'=>'legal-description-lien', 'class'=>"form-control", 'size'=>'20x3']); ?>

                                            </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::old('BuyerName'), ['id'=>'buyer-lien', 'class'=>"form-control center", 'maxlength'=>"100"]); ?>

                        </div>
                        <div class="col-md-3">
                            <p> Seller: </p>
                            <?php echo Form::text('SellerName', Input::old('SellerName'), ['id'=>'seller-lien', '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-3">
                            <?php if($order->ResponseTypeID==1): ?>
                            <p> Email: </p>
                            <?php echo Form::text('Email', Input::old('Email', $order->Email), ['id'=>'input-email', 'class'=>"form-control center", 'maxlength'=>"50"]); ?>

                            <?php elseif($order->ResponseTypeID==2): ?>
                            <p> Fax: </p>
                            <?php echo Form::text('FaxNo', Input::old('FaxNo', $order->FaxNo), ['id'=>'input-fax', 'class'=>"form-control center", 'maxlength'=>"15"]); ?>

                            <?php endif; ?>
                        </div>
                        <div class="col-md-6">
                            <p>Specific Instructions:</p>
                            <?php echo Form::textarea('SpecialInstruction', Input::old('SpecialInstruction'), ['id'=>'specific-instructions-lien', 'class'=>"form-control center", 'size'=>'20x3', 'maxlength'=>"2000"]); ?>

                        </div>
                        <div class="col-md-3"> &nbsp; </div>
                    </div>
                    <!-- FIN 6to campo de inputs -->
                    <div id="column-checkbox-top" class="row">
                        <div class="col-md-12">
                            <p> Upload Document: </p>
                            <input type="file" name="document" class="form-class" id="upload-document" accept='.pdf, .txt, .xls, .doc, .xlsx, .docx'>
                        </div>
                    </div>
                </div>
                <?php echo $__env->make('helpers.lienSelections', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                <!--                <div id="title-section">
                                    <p> Upload Document </p>
                                    <div id="footer_line"></div>
                                </div>
                                <div id="form-upload-document">
                                     Upload document
                                    <div id="column-checkbox-top" class="row">
                                        <div class="col-md-3">
                                            <p> Upload Document: </p>
                                            <input type="file" name="document" class="form-class" id="upload-document">
                                        </div>
                                    </div>
                                </div>-->
                <div id="form-submit">
                    <div class="row">
                        <div class="col-md-4"> &nbsp; </div>
                        <div class="col-md-2">
                            <div class="btn-group">
                                <button id="button-submit-form" name="button-submit-form" type="submit" class="btn btn-default">
                                    Submit
                                </button>
                            </div>
                        </div>
                        <div class="col-md-2">
                            <button id="button-submit-form" name="button-cancel-form" type="reset" class="btn btn-default"> Cancel
                            </button>
                        </div>
                        <div class="col-md-4"> &nbsp; </div>
                    </div>
                </div>
                <?php echo Form::close(); ?>

                <?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(); ?>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('helpers.base', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>