<section class="content">
    <div class="box box-primary">
            <div class="box-body">
                <div class="row">
                        <input type="hidden" name="is_service" value="1">
                        <div class="form-group col-md-6">
                            <label><?php echo app('translator')->getFromJson('front.name'); ?></label>
                            <input value="<?php echo e($service->name); ?>" required name="name" type="text" class="form-control pull-right">
                        </div>
                        <div class="form-group col-md-6">
                            <label><?php echo app('translator')->getFromJson('front.saleprice'); ?></label>
                            <input value="<?php echo e($service->last_cost); ?>" required name="last_cost" type="text" class="form-control pull-right">
                        </div>
                        <div class="form-group col-md-6">
                            <label><?php echo app('translator')->getFromJson('front.parent'); ?></label>
                            <select required name="main_category_id" class="form-control select2" style="width: 100%;">
                                <?php $__currentLoopData = $categories->where('type',1); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option <?php echo e(($service->main_category_id==$cat->id)?'selected':''); ?> value="<?php echo e($cat->id); ?>"><?php echo e($cat->name); ?></option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                        </div>
                        <div class="form-group col-md-6">
                            <label><?php echo app('translator')->getFromJson('front.child'); ?></label>
                            <select name="product[sub_category_id]" class="form-control select2" style="width: 100%;">
                                <option value=""><?php echo app('translator')->getFromJson('front.select'); ?></option>
                                <?php $__currentLoopData = $categories->where('type',2); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option <?php echo e(($cat->id==$service->sub_category_id)?'selected':''); ?> value="<?php echo e($cat->id); ?>"><?php echo e($cat->name); ?></option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                        </div>
                        <div class="form-group col-md-6">
                            <label><?php echo app('translator')->getFromJson('front.code'); ?></label>
                            <input value="<?php echo e(($service->code)?$service->code:rand(1,9).str_random(10)); ?>" name="code" type="text" class="form-control ">
                        </div>
                        <div class="form-group col-md-6">
                            <label><?php echo app('translator')->getFromJson('front.notes'); ?></label>
                            <input value="<?php echo e($service->note); ?>" name="note" type="text" class="form-control ">
                        </div>

                        <div class="col-md-12">
                            <div class="form-group">
                                <label><?php echo app('translator')->getFromJson('front.image'); ?></label>
                                <input id="FileUploade" name="image" type="file" class="form-control ">
                                <?php if(optional($service->getFirstMedia('images'))->getUrl()): ?>
                                    <img style="width: 80px;" src="<?php echo e(optional($service->getFirstMedia('images'))->getUrl()); ?>" />
                                <?php endif; ?>
                            </div>
                        </div>
                </div>
                <!-- /.row -->
            </div>
            <!-- /.box-body -->
            <div class="box-footer">
                <button type="submit" class="btn btn-primary">حفظ</button>
            </div>
        </div>
</section>
<script>
    $(function () {
        $(".select2").select2();
        $('form').validator();
    });
</script>
