

<?php
  $title = "Add Category";
  $button_text = "Add Category";
  if(!empty($category)) {
    $title = "Edit Category";
    $button_text = "Update Category";
  }
?>

<?php $__env->startSection('title', $title); ?>


<?php $__env->startSection('content'); ?>
    <!-- Main content -->
    <section class="py-0">
      <div class="container-fluid">
        <div class="card card-primary">
          <div class="card-header">
            <h3 class="card-title"><?php echo e($title); ?></h3>
          </div>
          <!-- /.card-header --> 
          
          <?php if(!empty($category)): ?>
            <form method="POST" action="<?php echo e(route('admin.categories.update', $category)); ?>" enctype="multipart/form-data">
            <?php echo method_field('put'); ?>
          <?php else: ?>
              <form method="POST" action="<?php echo e(route('admin.categories.store')); ?>" enctype="multipart/form-data">
          <?php endif; ?>
          <?php echo csrf_field(); ?>

                                                        <?php if(session()->has('failure')): ?>
                                                            <div class="alert alert-danger">
                                                                <?php echo e(session()->get('failure')); ?>

                                                            </div>
                                                        <?php endif; ?>

                                                        <?php if(session()->has('success')): ?>
                                                            <div class="alert alert-success">
                                                                <?php echo e(session()->get('success')); ?>

                                                            </div>
                                                        <?php endif; ?> 
          <div class="card-body">

            <div class="form-group">
                <label class="col-form-label" for="name">Name</label>
                <input type="text" class="form-control" id="name" name="name" value="<?php echo e(!empty($category->name)? $category->name : ""); ?>" placeholder="Name" required>
                <?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="invalid-feedback"><?php echo e($message); ?></span> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
            </div>

            <div class="col-lg-9 mt-2 mb-2">
                <input type="file" name="image" id="imgInp" accept="image/*" class="file-box"/>
              </div>

            <div class="form-group py-2">
              <div class="checkbox">
                <label>
                  <input type="checkbox" id="is_active" name="is_active" value="1" <?php if(!empty($category->is_active)): ?> <?php if($category->is_active == 1): ?> checked <?php endif; ?> <?php endif; ?>>
                  Active?
                </label>
              </div>
            </div>

          </div>
          <!-- /.card-body -->
          <div class="card-footer">
            <button type="submit" class="btn btn-primary"><?php echo e($button_text); ?></button>
          </div>
          <!-- /.card-footer -->
          </form>
        </div>
      </div>
    </section>
    <!-- /.content -->
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layouts.dashboard', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\chittar\resources\views/admin/category/create.blade.php ENDPATH**/ ?>