<style>

#cke_notifications_area_editor1,#cke_notifications_area_editor2,#cke_notifications_area_editor3,#cke_notifications_area_editor4,#cke_notifications_area_editor5,#cke_notifications_area_editor6,#cke_notifications_area_editor7,#cke_notifications_area_editor8,#cke_notifications_area_editor9,#cke_notifications_area_editor10,#cke_notifications_area_editor11,#cke_notifications_area_editor12,#cke_notifications_area_editor13,#cke_notifications_area_editor14{
    display: none !important;

}



</style>
 <?php $__env->startSection('content'); ?>
    <div class="common-content">
        <div class="page-content">
            <div class="page-heading">
                <div class="headings">
                    <h6>Create Purchase Order</h6>
                </div>
            </div>


            <?php if($profile=='incomplete'): ?>
                <?php if(Auth::user()->user_type==1): ?>
                    <div style="background-color:red;text-align:center;margin:auto;font-size: 14px;     padding: 8px;color: #fff;    font-weight: 200;    border-radius: 5px 5px 5px 5px; "><b>Your Profile is incomplete, Please <a href="<?php echo e(url('userprofile')); ?>">click here</a> to complete your profile before creating a purchase order </b></div>
                <?php endif; ?>
                <?php if(Auth::user()->user_type==4): ?>
                    <div style="background-color:red;text-align:center;margin:auto;font-size: 14px;     padding: 8px;color: #fff;    font-weight: 200;    border-radius: 5px 5px 5px 5px; "><b>Your Main Buyer Profile is incomplete, Please  contact  Main Buyer before creating a purchase order </b></div>
                <?php endif; ?>
            <?php else: ?>


            <div class="boxings">
                <form id="save_purchaseorder" method="POST" action="<?php echo e(url('buyers/save_purchaseorder')); ?>"
                    enctype="multipart/form-data"> <?php echo csrf_field(); ?>
                    <h6>Create Purchase Order</h6>

                   

                    <div class="row c-po">
                        <?php if($buyer_type == 'proc'): ?>
                            <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                                <div class="form-inputs app-vend f-adj">
                                    <div class="form-group">
                                        <label class="label">Consignee<sup>*</sup></label>
                                        <select id="buyer" class="form-control  invoiceselect" name="buyer">
                                            <option value="">Select</option>
                                            <?php if(!empty($individual_buyers)): ?>
                                                <?php $__currentLoopData = $individual_buyers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $buyers): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <option value="<?php echo e($buyers->id); ?>"><?php echo e($buyers->name); ?></option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            <?php endif; ?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                                <div class="form-inputs app-vend f-adj">
                                    <div class="form-group">
                                        <label class="label">Ship To<sup>*</sup></label>
                                        <select id="ship" class="form-control  invoiceselect" name="ship">
                                            <option value="">Select</option>
                                           
                                                    <option value="1">Consignee</option>
                                                    <option value="2">Procurement</option>
                                              
                                          
                                        </select>
                                    </div>
                                </div>
                            </div>
                        <?php endif; ?>
                        <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                            <div class="form-inputs app-vend f-adj">
                                <div class="form-group">
                                    <label class="label">Vendor/Manufacturer<sup>*</sup></label>
                                    <select id="vendor" class="form-control  invoiceselect" name="vendor">
                                        <option value="">Select</option>
                                        <?php $__currentLoopData = $vendorlist; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $vendor): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <option value="<?php echo e($vendor->id); ?>"><?php echo e($vendor->name); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                             <div class="form-inputs app-vend f-adj">
                                <div class="form-group">
                                    <label class="label">Pre Dispatch Inspection Required</label>
                                   <div class="inspCheck">
                                        <div class="form-check form-check-inline">
                                      <input class="form-check-input" type="radio" name="predispatch" id="inlineRadio1" value="1">
                                      <label class="form-check-label" for="inlineRadio1">Yes</label>
                                    </div>
                                    <div class="form-check form-check-inline">
                                      <input class="form-check-input" type="radio" name="predispatch" id="inlineRadio2" value="0" checked>
                                      <label class="form-check-label" for="inlineRadio2">No</label>
                                    </div>
                                    </div>
                                    

                                </div>
                            </div>
                        </div>
                   
                       
                        <input name="_token" type="hidden" id="token_po" value="<?php echo e(csrf_token()); ?>">
                    </div>
                    <div id="products">


                        
                    </div>
                    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 p-0" id="addnewproducts" style="display:none;">
                        <div class="form-inputs app-vend f-adj">
                            <div class="form-group">
                                <div class="green-button green-button2 d-flex justify-content-start">
                                    <button id="create"  class="addproducts"><i class="fa fa-plus" aria-hidden="true"></i>Add New Products</button>
                                </div>
                                
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-4 col-md-12 col-sm-12 col-xs-12">
                            <div class="form-inputs app-vend">
                                <div class="form-group">
                                    <label>Name & Address of the Purchaser <sup>*</sup></label>

                                    <input type="text"  class="form-control" name="name_purchaser" readonly value="<?php echo e($mainbuyer); ?>">

                                </div>
                            </div>
                            <div class="form-inputs app-vend f-adj">
                                <div class="form-group">
                                    <label>Tender Number<sup>*</sup></label>
                                    <input id="tender_number" name="tender_number" value="" type="text"
                                        class="form-control">
                                </div>
                            </div>
                        </div>
                        <?php if($main_buyer_id == 6): ?>
                            <div class="col-lg-4 col-md-12 col-sm-12 col-xs-12">
                                <div class="form-inputs app-vend">
                                    <div class="form-group">
                                        <label>Name & Address of the Consignee(s)<sup>*</sup></label>
                                        <textarea class="form-control" rows="4" id="name_consigee" name="name_consigee"></textarea>
                                    </div>
                                </div>
                            </div>
                        <?php endif; ?>
                        <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                          
                            <div class="form-inputs app-vend f-adj">
                                <div class="form-group">
                                    <label>Country of Origin<sup>*</sup></label>
                                    <select class="form-control js-example-disabled-results invoiceselect" id="country"
                                        name="country" required>
                                        <option value="">Select</option>
                                        <?php $__currentLoopData = $countrylist; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $country): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <option value="<?php echo e($country->id); ?>"
                                                <?php if($country->id == '101') {?>selected<?php  }?>><?php echo e($country->name); ?>

                                            </option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                            <div class="form-inputs app-vend f-adj">
                                <div class="form-group">
                                    <label>Terms of Delivery<sup>*</sup></label>
                                    <textarea class="form-control" rows="4" id="terms_delivery" name="terms_delivery"><?php echo e($ordercontents->terms_service); ?></textarea>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="row mt-3">
                        <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                            <div class="form-inputs app-vend f-adj">
                                <div class="form-group">
                                    <label>Delivery Period<sup>*</sup></label>
                                    <textarea name="editor1" id="editor1" rows="10" cols="80"><?php echo $ordercontents->delivery_period; ?></textarea>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                            <div class="form-inputs app-vend f-adj">
                                <div class="form-group">
                                    <label>Dispatch Instructions <sup>*</sup></label>
                                    <textarea name="editor2" id="editor2" rows="10" cols="80"><?php echo $ordercontents->dispatch_instruction; ?></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                            <div class="form-inputs app-vend f-adj">
                                <div class="form-group">
                                    <label>Packing & Marking <sup>*</sup></label>
                                    <textarea name="editor3" id="editor3" rows="10" cols="80"><?php echo $ordercontents->packing_making; ?></textarea>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                            <div class="form-inputs app-vend f-adj">
                                <div class="form-group">
                                    <label>Inspection Authority<sup>*</sup></label>
                                    <textarea name="editor4" id="editor4" rows="10" cols="80"><?php echo $ordercontents->inspection_authority; ?></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                            <div class="form-inputs app-vend f-adj">
                                <div class="form-group">
                                    <label>Inspecting Officer<sup>*</sup></label>
                                    <textarea name="editor5" id="editor5" rows="10" cols="80"><?php echo $ordercontents->inspecting_officer; ?></textarea>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                            <div class="form-inputs app-vend f-adj">
                                <div class="form-group">
                                    <label>Pre dispatch Inspection of goods Located in India <sup>*</sup></label>
                                    <textarea name="editor6" id="editor6" rows="10" cols="80"><?php echo $ordercontents->predespatch_goods; ?></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                            <div class="form-inputs app-vend f-adj">
                                <div class="form-group">
                                    <label>Performance Security<sup>*</sup></label>
                                    <textarea name="editor7" id="editor7" rows="10" cols="80"><?php echo $ordercontents->performance_security; ?></textarea>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                            <div class="form-inputs app-vend f-adj">
                                <div class="form-group">
                                    <label>Warranty Terms <sup>*</sup></label>
                                    <textarea name="editor8" id="editor8" rows="10" cols="80"><?php echo $ordercontents->warranty_terms; ?></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                            <div class="form-inputs app-vend f-adj">
                                <div class="form-group">
                                    <label> Comprehensive Annual Maintenance Contract<sup>*</sup></label>
                                    <textarea name="editor9" id="editor9" rows="10" cols="80"><?php echo $ordercontents->annual_maintanace; ?></textarea>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                            <div class="form-inputs app-vend f-adj">
                                <div class="form-group">
                                    <label> Liquidated damages <sup>*</sup></label>
                                    <textarea name="editor10" id="editor10" rows="10" cols="80"><?php echo $ordercontents->liquidated_damage; ?></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                            <div class="form-inputs app-vend f-adj">
                                <div class="form-group">
                                    <label> Paying Authority<sup>*</sup></label>
                                    <textarea name="editor11" id="editor11" rows="10" cols="80"><?php echo $ordercontents->paying_authority; ?></textarea>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                            <div class="form-inputs app-vend f-adj">
                                <div class="form-group">
                                    <label>Payment Terms <sup>*</sup></label>
                                    <textarea name="editor12" id="editor12" rows="10" cols="80"><?php echo $ordercontents->payment_terms; ?></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                            <div class="form-inputs app-vend f-adj">
                                <div class="form-group">
                                    <label>Resolution of disputes <sup>*</sup></label>
                                    <textarea name="editor13" id="editor13" rows="10" cols="80"><?php echo $ordercontents->resolution_disputes; ?></textarea>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                            <div class="form-inputs app-vend f-adj">
                                <div class="form-group">
                                    <label>Other Instructions <sup>*</sup></label>
                                    <textarea name="editor14" id="editor14" rows="10" cols="80"><?php echo $ordercontents->other_instruction; ?></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row" style="padding-top: 20px;">
                        <div class="col-12">
                            <div class="green-button green-button2 d-flex justify-content-center">
                                <button id="create">Submit</button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <?php endif; ?>
        </div>
        <?php $__env->stopSection(); ?> <?php $__env->startSection('scripts'); ?>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
       <!--<script src="https://cdn.ckeditor.com/4.5.1/standard/ckeditor.js"></script>-->
        

        <script src="<?php echo e(URL::to('assets/js/buyernew.js')); ?>"></script>
        <script src="https://cdn.ckeditor.com/4.22.1/standard/ckeditor.js"></script>
        <script type="text/javascript">

            $(document).ready(function() {
                $(window).keydown(function(event){
                    if(event.keyCode == 13) {
                    event.preventDefault();
                    return false;
                    }
                });

                $("#vendor").on('change', function () {
                        if($(this).val()!=''){
                            $('label[for=vendor]').hide();
                        }
                        else{
                        $('label[for=vendor]').show();
                        }
	            });



            });


                



            <?php if(Session::has('message')): ?>
                swal({
                    title: "",
                    text: "<?php echo e(Session::get('message')); ?>",
                    type: "success",
                    showCancelButton: false,
                    dangerMode: false,
                    confirmButtonText: 'OK',
                });
            <?php endif; ?>

            <?php if(Session::has('errormessage')): ?>
                swal({
                    title: "",
                    text: "<?php echo e(Session::get('errormessage')); ?>",
                    type: "error",
                    showCancelButton: false,
                    dangerMode: false,
                    confirmButtonText: 'OK',
                });
            <?php endif; ?>
            // Replace the <textarea id="editor1"> with a CKEditor
            // instance, using default configuration.
            CKEDITOR.editorConfig = function(config) {
                config.language = 'es';
                config.uiColor = '#F7B42C';
                config.height = 300;
                config.removePlugins = 'about';
               // config.toolbarCanCollapse = true;
            };

            CKEDITOR.on('instanceReady', function(ev) {
                ev.editor.on('change', function() {
                    if (CKEDITOR.plugins.get('updatemsg')) {
                        CKEDITOR.plugins.updatemsg.hide();
                    }
                });
            });
            
            CKEDITOR.replace('editor1');
            CKEDITOR.replace('editor2');
            CKEDITOR.replace('editor3');
            CKEDITOR.replace('editor4');
            CKEDITOR.replace('editor5');
            CKEDITOR.replace('editor6');
            CKEDITOR.replace('editor7');
            CKEDITOR.replace('editor8');
            CKEDITOR.replace('editor9');
            CKEDITOR.replace('editor10');
            CKEDITOR.replace('editor11');
            CKEDITOR.replace('editor12');
            CKEDITOR.replace('editor13');
            CKEDITOR.replace('editor14');
        </script>
    <?php $__env->stopSection(); ?>

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