%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/digiprint/resources/views/dashboard/
Upload File :
Create Path :
Current File : /var/www/html/digiprint/resources/views/dashboard/categoriesDetails.blade.php

@extends('dashboard.layouts.app')

@section('content')
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h1>
                            <span>Categories</span>
                            <span class="pull-right">
                                @if ($category && $category->id)
                                    <a class="btn btn-default"
                                       href="{{route('dashboard.categories.gallery', $category->id)}}">
                                        <span>Gallery</span>
                                    </a>
                                @endif
                                <a class="btn btn-success" href="{{route('dashboard.categories')}}">
                                    <span>Back</span>
                                </a>
                            </span>
                        </h1>
                    </div>
                </div>

                <form class="form-horizontal" method="POST" autocomplete="off" enctype="multipart/form-data"
                      action="{{ route('dashboard.categories.createOrUpdate', $id) }}">
                    {{ csrf_field() }}

                    <div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
                        <label for="name" class="col-md-3 control-label">Name</label>

                        <div class="col-md-6">
                            <input id="name" type="text" class="form-control" name="name"
                                   value="{{ $category->name }}" required autofocus>
                            @if ($errors->has('name'))
                                <span class="help-block">
                                    <strong>{{ $errors->first('name') }}</strong>
                                </span>
                            @endif
                        </div>
                    </div>

                    <div class="form-group{{ $errors->has('slug') ? ' has-error' : '' }}">
                        <label for="slug" class="col-md-3 control-label">Slug</label>

                        <div class="col-md-6">
                            <input id="slug" type="text" class="form-control" name="slug"
                                   value="{{ $category->slug }}" required>
                            @if ($errors->has('slug'))
                                <span class="help-block">
                                    <strong>{{ $errors->first('slug') }}</strong>
                                </span>
                            @endif
                        </div>
                    </div>

                    <div class="form-group{{ $errors->has('order') ? ' has-error' : '' }}">
                        <label for="order" class="col-md-3 control-label">Order</label>

                        <div class="col-md-6">
                            <input id="order" type="number" class="form-control" name="order"
                                   value="{{ $category->order }}" required>
                            @if ($errors->has('order'))
                                <span class="help-block">
                                    <strong>{{ $errors->first('order') }}</strong>
                                </span>
                            @endif
                        </div>
                    </div>

                    <div class="form-group{{ $errors->has('short_description') ? ' has-error' : '' }}">
                        <label for="short_description" class="col-md-3 control-label">Short Description</label>

                        <div class="col-md-6">
                            <textarea id="short_description" class="form-control" name="short_description" rows="6"
                                      required
                            >{{ $category->short_description }}</textarea>
                            @if ($errors->has('short_description'))
                                <span class="help-block">
                                    <strong>{{ $errors->first('short_description') }}</strong>
                                </span>
                            @endif
                        </div>
                    </div>

                    <div class="form-group{{ $errors->has('description') ? ' has-error' : '' }}">
                        <label for="description" class="col-md-3 control-label">Description</label>

                        <div class="col-md-6">
                            <textarea id="description" class="form-control" name="description" rows="11" required
                            >{{ $category->description }}</textarea>
                            @if ($errors->has('description'))
                                <span class="help-block">
                                    <strong>{{ $errors->first('description') }}</strong>
                                </span>
                            @endif
                        </div>
                    </div>

                    @if(($category->id && count($categories) > 1) || (!$category->id && count($categories) > 0))
                        <div class="form-group{{ $errors->has('parent_id') ? ' has-error' : '' }}">
                            <label for="parent_id" class="col-md-3 control-label">Category</label>

                            <div class="col-md-6">
                                <select class="form-control" id="parent_id" name="parent_id">
                                    <option value="">Parent Category</option>
                                    @foreach($categories as $cat)
                                        @if($cat->id != $category->id)
                                            <option value="{{$cat->id}}"
                                                    {{$cat->id == $category->parent_id ? 'selected' : ''}}>
                                                {{$cat->name}}
                                            </option>
                                        @endif
                                    @endforeach
                                </select>
                                @if ($errors->has('parent_id'))
                                    <span class="help-block">
                                    <strong>{{ $errors->first('parent_id') }}</strong>
                                </span>
                                @endif
                            </div>
                        </div>
                    @endif

                    <div class="form-group{{ $errors->has('file') ? ' has-error' : '' }}">
                        <label for="description" class="col-md-3 control-label">Image 400X400px </label>

                        <div class="col-md-6">
                            <input type="file" name="file" id="file" accept="image/*" onchange="fileChanged(this)">
                            @if ($errors->has('file'))
                                <span class="help-block">
                                    <strong>{{ $errors->first('file') }}</strong>
                                </span>
                            @endif
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-6 col-md-offset-3">
                            @if($category->media()->count() > 0)
                                <img class="img img-responsive full-width" id="image-preview-uploaded"
                                     src="{{env('APP_URL') . 'uploads/' . $category->media()->where('media_type', \Digiprint\Models\Media::MEDIA_TYPE_IMAGE_CATEGORY)->first()->file_name}}">
                            @endif
                            <img class="img img-responsive full-width" id="image-preview">
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-8 col-md-offset-3">
                            <button type="submit" class="btn btn-primary">
                                Save
                            </button>
                        </div>
                    </div>
                </form>

            </div>
        </div>
    </div>
@endsection

<script>
  function fileChanged(input) {
    if (input.files && input.files[0]) {
      var reader = new FileReader();

      reader.onload = function (e) {
        $('#image-preview').attr('src', e.target.result);
        $('#image-preview-uploaded').css('display', 'none');
      };

      reader.readAsDataURL(input.files[0]);
    }
  }
</script>

Zerion Mini Shell 1.0