%PDF- %PDF-
Direktori : /var/www/html/sljcon/resources/views/admin/section/ |
Current File : /var/www/html/sljcon/resources/views/admin/section/form.blade.php |
@extends('layouts.app') @section('content') <div class="container"> <div class="row"> <div class="col-md-12"> <div class="pull-right"> @if($project_id != null) <a href="{{route('admin.project.section',$project_id)}}" class="btn btn-warning"> <i class="fa fa-arrow-left"></i> All section </a> @else <a href="{{route('admin.project.section',$section->project->id)}}" class="btn btn-warning"> <i class="fa fa-arrow-left"></i> All section </a> @endif </div> </div> </div> <div class="row"> <div class="col-md-12 m_top_30"> <form class="form-horizontal" method="POST" autocomplete="off" enctype="multipart/form-data" action="{{ route('admin.project.section.store', $id) }}"> {{ csrf_field() }} <div class="center m_top_30 m_bottom_30"> <h2>Add New Section</h2> </div> @if($project_id != null) <input name="project_id" type="hidden" value="{{$project_id}}"/> @else <input name="project_id" type="hidden" value="{{$section->project->id}}"/> @endif <div class="form-group{{ $errors->has('title') ? ' has-error' : '' }}"> <label for="title" class="col-md-3 control-label">Title</label> <div class="col-md-6"> <input id="title" type="text" class="form-control" name="title" value="{{ $section->title }}" required autofocus> </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="6" required >{{ $section->description }}</textarea> @if ($errors->has('description')) <span class="help-block"> <strong>{{ $errors->first('description') }}</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="{{ $section->order }}" required>--}} <select name="order" id="order" class="form-control"> <option value="1" {{$section->order == 1 ? 'selected' : ''}}>1</option> <option value="2" {{$section->order == 2 ? 'selected' : ''}}>2</option> <option value="3" {{$section->order == 3 ? 'selected' : ''}}>3</option> <option value="4" {{$section->order == 4 ? 'selected' : ''}}>3</option> </select> </div> </div> <div class="form-group{{ $errors->has('file') ? ' has-error' : '' }}"> <label for="file" class="col-md-3 control-label">Main Image</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($section->media()->count() > 0) <img class="img img-responsive full-width" id="image-preview-uploaded" src="{{env('APP_URL') . 'uploads/section/' . $section->media()->where('media_type', \App\Models\Media::MEDIA_TYPE_SECTION_IMAGE)->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>