<?php $__env->startSection('styles'); ?>
    <link rel="stylesheet" href="<?php echo e(asset('backend/vendor/select2/css/select2.min.css')); ?>">
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
    <div class="card shadow mb-4">
        <div class="card-header py-3 d-flex">
            <h6 class="m-0 font-weight-bold text-success">
                Edit shipping company (<?php echo e($shippingCompany->name); ?>)
            </h6>
            <div class="ml-auto">
                <a href="<?php echo e(route('admin.shipping_companies.index')); ?>" class="btn btn-success">
                    <span class="icon text-white-50">
                        <i class="fa fa-shipping-fast"></i>
                    </span>
                    <span class="text">Back to Shipping companies</span>
                </a>
            </div>
        </div>
        <div class="card-body">
            <form method="POST" action="<?php echo e(route('admin.shipping_companies.update', $shippingCompany)); ?>">
                <?php echo csrf_field(); ?>
                <?php echo method_field('PATCH'); ?>
                <div class="row">
                    <div class="col-6">
                        <div class="form-group">
                            <label for="name" class="text-small text-uppercase"><?php echo e(__('Name')); ?></label>
                            <input name="name" type="text" class="form-control" id="name"
                                   value="<?php echo e(old('name', $shippingCompany->name)); ?>" placeholder="Company Name">
                            <?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="text-danger"><?php echo e($message); ?></span><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                    </div>
                    <div class="col-6">
                        <div class="form-group">
                            <label for="code" class="text-small text-uppercase"><?php echo e(__('Code')); ?></label>
                            <input id="code" type="text" class="form-control" name="code"
                                   value="<?php echo e(old('code', $shippingCompany->code)); ?>" placeholder="Company code">
                            <?php $__errorArgs = ['code'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><span class="text-danger"><?php echo e($message); ?></span><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-6">
                        <?php echo BootForm::select('countries[]',__("Countries"),
                   old('countries',$shippingCompany->countries->pluck('id')) ,$countries->pluck('name',"id"),
                   ['data-plugin-multiselect',"multiple" => ""]); ?>

                    </div>
                    <div class="col-6">
                        <div class="form-group">
                            <label for="cost" class="text-small text-uppercase"><?php echo e(__('Cost')); ?></label>
                            <input id="cost" type="number" min="0.00" class="form-control" name="cost" value="<?php echo e(old('cost', $shippingCompany->cost)); ?>" >
                            <?php $__errorArgs = ['cost'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><span class="text-danger"><?php echo e($message); ?></span><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-4">
                        <div class="form-group">
                            <label for="description" class="text-small text-uppercase"><?php echo e(__('Description')); ?></label>
                            <input id="description" value="<?php echo e(old('description', $shippingCompany->description)); ?>" class="form-control" name="description">
                            <?php $__errorArgs = ['description'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><span class="text-danger"><?php echo e($message); ?></span><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                    </div>
                    <div class="col-4">
                        <div class="form-group">
                            <label for="fast">Fast</label>
                            <select name="fast" id="fast" class="form-control">
                                <option value="">---</option>
                                <option value="1" <?php echo e(old('fast', $shippingCompany->fast) == 1 ? 'selected' : null); ?>><?php echo e(__('Yes')); ?></option>
                                <option value="0" <?php echo e(old('fast', $shippingCompany->fast) == 0 ? 'selected' : null); ?>><?php echo e(__("No")); ?></option>
                            </select>
                            <?php $__errorArgs = ['fast'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><span class="text-danger"><?php echo e($message); ?></span><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                    </div>
                    <div class="col-4">
                        <div class="form-group">
                            <label for="active">Status</label>
                            <select name="active" id="active" class="form-control">
                                <option value="">---</option>
                                <option value="1" <?php echo e(old('active', $shippingCompany->active) == 1 ? 'selected' : null); ?>><?php echo e(__("Active")); ?></option>
                                <option value="0" <?php echo e(old('active', $shippingCompany->active) == 0  ? 'selected' : null); ?>><?php echo e(__("Inactive")); ?></option>
                            </select>
                            <?php $__errorArgs = ['active'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><span class="text-danger"><?php echo e($message); ?></span><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <button type="submit" class="btn btn-success">
                        <?php echo e(__('Update')); ?>

                    </button>
                </div>
            </form>
        </div>
    </div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('scripts'); ?>
    <script src="<?php echo e(asset('backend/vendor/select2/js/select2.full.min.js')); ?>"></script>
    <script>
        $(function () {
            // select2
            function matchStart(params, data) {
                // If there are no search terms, return all of the data
                if ($.trim(params.term) === '') {
                    return data;
                }

                // Skip if there is no 'children' property
                if (typeof data.children === 'undefined') {
                    return null;
                }

                // `data.children` contains the actual options that we are matching against
                var filteredChildren = [];
                $.each(data.children, function (idx, child) {
                    if (child.text.toUpperCase().indexOf(params.term.toUpperCase()) == 0) {
                        filteredChildren.push(child);
                    }
                });

                // If we matched any of the timezone group's children, then set the matched children on the group
                // and return the group object
                if (filteredChildren.length) {
                    var modifiedData = $.extend({}, data, true);
                    modifiedData.children = filteredChildren;

                    // You can return modified objects from here
                    // This includes matching the `children` how you want in nested data sets
                    return modifiedData;
                }

                // Return `null` if the term should not be displayed
                return null;
            }

            $(".select2").select2({
                tags: true,
                closeOnSelect: false,
                minimumResultsForSearch: Infinity,
                matcher: matchStart
            });
        })
    </script>
<?php $__env->stopSection(); ?>

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