<?php if (isset($component)) { $__componentOriginalc6e081c8432fe1dd6b4e43af4871c93447ee9b23 = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\MasterLayout::class, ['assets' => $assets ?? []]); ?>
<?php $component->withName('master-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
    <div>
        <?php $id = $id ?? null;?>
        <?php if(isset($id)): ?>
            <?php echo Form::model($data, ['route' => ['extracharge.update', $id], 'method' => 'patch', 'id' => 'extracharge_form']); ?>

        <?php else: ?>
            <?php echo Form::open(['route' => ['extracharge.store'], 'method' => 'post' , 'id' => 'extracharge_form']); ?>

        <?php endif; ?>
        <div class="row">
            <div class="col-lg-12">
                <div class="card">
                    <div class="card-header d-flex justify-content-between">
                        <div class="header-title">
                            <h4 class="card-title"><?php echo e($pageTitle); ?></h4>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="new-user-info">
                            <div class="row">
                                <div class="form-group col-md-4">
                                    <?php echo e(Form::label('country_id', __('message.country').' <span class="text-danger">*</span>', [ 'class' => 'form-control-label' ],false)); ?>

                                    <?php echo e(Form::select('country_id', isset($data) ? [$data->country->id =>  $data->country->name ] : [], old('country_id'), [
                                        'class' => 'select2js form-group country_id',
                                        'data-placeholder' => __('message.country'),
                                        'data-ajax--url' => route('ajax-list', [ 'type' => 'country-list' ]),
                                    ])); ?>

                                </div>

                                <div class="form-group col-md-4">
                                    <?php echo e(Form::label('city_id', __('message.city').' <span class="text-danger">*</span>', [ 'class' => 'form-control-label' ],false)); ?>

                                    <?php echo e(Form::select('city_id', isset($data) ? [$data->city->id =>  $data->city->name ] : [], old('city_id'), [
                                        'class' => 'select2js form-group city_id',
                                        'data-placeholder' => __('message.city'),
                                    ])); ?>

                                </div>

                                <div class="form-group col-md-4">
                                    <?php echo e(Form::label('title',__('message.name').' <span class="text-danger">*</span>',['class'=>'form-control-label'], false )); ?>

                                    <?php echo e(Form::text('title', old('title'),['placeholder' => __('message.name'),'class' =>'form-control'])); ?>

                                </div>

                                <div class="form-group col-md-4">
                                    <?php echo e(Form::label('charges', __('message.charges').' <span class="text-danger">*</span>',['class' => 'form-control-label'], false )); ?>

                                    <?php echo e(Form::number('charges', old('charges'),[ 'step' =>'any', 'min' =>'0', 'placeholder' => __('message.charges'), 'class' => 'form-control'])); ?>

                                </div>

                                <div class="form-group col-md-4">
                                    <?php echo e(Form::label('charges_type',__('message.charges_type').' <span class="text-danger">*</span>',['class'=>'form-control-label'],false)); ?>

                                    <?php echo e(Form::select('charges_type',[ 'fixed' => __('message.fixed'), 'percentage' => __('message.percentage') ], old('charges_type'), [ 'class' =>'form-control select2js'])); ?>

                                </div>

                                <div class="form-group col-md-4">
                                    <?php echo e(Form::label('status',__('message.status').' <span class="text-danger">*</span>',['class'=>'form-control-label'],false)); ?>

                                    <?php echo e(Form::select('status',[ '1' => __('message.enable'), '0' => __('message.disable') ], old('status'), [ 'class' =>'form-control select2js'])); ?>

                                </div>
                            </div>
                            <hr>
                            <?php echo e(Form::submit( isset($id) ? __('message.update') : __('message.save'), ['class'=>'btn btn-md btn-primary float-right'])); ?>

                        </div>
                    </div>
                </div>
            </div>
        </div>
        <?php echo Form::close(); ?>

    </div>
    <?php $__env->startSection('bottom_script'); ?>
        <script>
            (function($) {
                "use strict";
                $(document).ready(function () {

                    $(document).on('change' , '#country_id' , function (){
                        var country_id = $(this).val();
                        $('#city_id').empty();
                        cityList(country_id);
                    });
                });

                function cityList(country_id) {
                    var section_class_route = "<?php echo e(route('ajax-list', ['type' => 'extra_charge_city', 'country_id' => ''])); ?>" + country_id;
                    section_class_route = section_class_route.replace('amp;','');

                    $.ajax({
                        url: section_class_route,
                        success: function(result){
                            $('#city_id').select2({
                                width: '100%',
                                placeholder: "<?php echo e(__('message.select_name',['select' => __('message.city')])); ?>",
                                data: result.results
                            });
                            if(state != null){
                                $("#city_id").val(state).trigger('change');
                            }
                        }
                    });
                }
                formValidation("#extracharge_form", {
                    country_id: { required: true },
                    city_id: { required: true },
                    title: { required: true },
                    charges: { required: true },
                    charges_type: { required: true },
                    status: { required: true },
                }, {
                    country_id: { required: "<?php echo e(__('message.please_select_country')); ?>"},
                    city_id: { required: "<?php echo e(__('message.please_select_city')); ?>"},
                    title: { required: "<?php echo e(__('message.please_enter_name')); ?>" },
                    charges: { required: "<?php echo e(__('message.please_enter_charges')); ?>" },
                    charges_type: { required: "<?php echo e(__('message.please_enter_charges_type')); ?>" },
                    status: { required: "<?php echo e(__('message.please_select_status')); ?>" },
                });
            })(jQuery);
        </script>
    <?php $__env->stopSection(); ?>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc6e081c8432fe1dd6b4e43af4871c93447ee9b23)): ?>
<?php $component = $__componentOriginalc6e081c8432fe1dd6b4e43af4871c93447ee9b23; ?>
<?php unset($__componentOriginalc6e081c8432fe1dd6b4e43af4871c93447ee9b23); ?>
<?php endif; ?>
<?php /**PATH /home/atharvatek/mxunzo.atharvatek.com/resources/views/extracharge/form.blade.php ENDPATH**/ ?>