%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/sljcon/resources/views/admin/compare/
Upload File :
Create Path :
Current File : /var/www/html/sljcon/resources/views/admin/compare/form.blade.php

@extends('layouts.app')

@section('content')
    <div class="container">
        <div class="row">
            <div class="col-md-12 m_top_30">
                <a href="{{route('admin.beforeAfter')}}" class="btn btn-success pull-right">
                    <i class="fa fa-arrow-left"></i> Back
                </a>
            </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.beforeAfter.store', $id) }}">
                    {{ csrf_field() }}
                    <div class="center m_top_30 m_bottom_30">
                        <h2>Add New Item</h2>
                    </div>
                    <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="{{ $item->name }}" required autofocus>
                        </div>
                    </div>
                    <div class="form-group{{ $errors->has('before_url') ? ' has-error' : '' }}">
                        <label for="file" class="col-md-3 control-label">Before Image</label>
                        <div class="col-md-6">
                            <input type="file" name="before_url" id="before_url" accept="image/*"
                                   onchange="beforeFileChanged(this)">
                            @if ($errors->has('before_url'))
                                <span class="help-block">
                                    <strong>{{ $errors->first('before_url') }}</strong>
                                </span>
                            @endif
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-6 col-md-offset-3">
                            @if($item->before_url)
                                <img class="img img-responsive full-width" id="image-before-preview-uploaded"
                                     src="{{env('APP_URL') . 'uploads/compare/'.$item->before_url}}">
                            @endif
                            <img class="img img-responsive full-width" id="image-before-preview">
                        </div>
                    </div>
                    <div class="form-group{{ $errors->has('after_url') ? ' has-error' : '' }}">
                        <label for="file" class="col-md-3 control-label">After Image</label>
                        <div class="col-md-6">
                            <input type="file" name="after_url" id="after_url" accept="image/*"
                                   onchange="afterFileChanged(this)">
                            @if ($errors->has('after_url'))
                                <span class="help-block">
                                    <strong>{{ $errors->first('after_url') }}</strong>
                                </span>
                            @endif
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-md-6 col-md-offset-3">
                            @if($item->after_url)
                                <img class="img img-responsive full-width" id="image-after-preview-uploaded"
                                     src="{{env('APP_URL') . 'uploads/compare/'.$item->after_url}}">
                            @endif
                            <img class="img img-responsive full-width" id="image-after-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 beforeFileChanged(input) {
        if (input.files && input.files[0]) {
            var reader = new FileReader();
            reader.onload = function (e) {
                $('#image-before-preview').attr('src', e.target.result);
                $('#image-before-preview-uploaded').css('display', 'none');
            };
            reader.readAsDataURL(input.files[0]);
        }
    }

    function afterFileChanged(input) {
        if (input.files && input.files[0]) {
            var reader = new FileReader();
            reader.onload = function (e) {
                $('#image-after-preview').attr('src', e.target.result);
                $('#image-after-preview-uploaded').css('display', 'none');
            };
            reader.readAsDataURL(input.files[0]);
        }
    }
</script>

Zerion Mini Shell 1.0