From 61e704e5b989cf68d9f296b04373d716484757ab Mon Sep 17 00:00:00 2001
From: Aan Choesni Herlingga <aanchoesni@unesa.ac.id>
Date: Thu, 2 Jan 2020 10:26:55 +0700
Subject: [PATCH] master layouts

---
 app/Http/Controllers/Webprofile/Backend/LayoutController.php  | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 database/migrations/2019_11_12_112102_create_design_table.php |   1 +
 resources/lang/en/feature.php                                 |  10 ++++++++++
 resources/lang/en/label.php                                   |   3 ++-
 resources/lang/id/feature.php                                 |  10 ++++++++++
 resources/lang/id/label.php                                   |   1 +
 resources/views/webprofile/backend/design/create.blade.php    |  77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 resources/views/webprofile/backend/design/edit.blade.php      |  77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 resources/views/webprofile/backend/design/index.blade.php     | 261 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 routes/webprofile/backend.php                                 |   1 +
 10 files changed, 564 insertions(+), 1 deletion(-)
 create mode 100644 app/Http/Controllers/Webprofile/Backend/LayoutController.php
 create mode 100644 resources/views/webprofile/backend/design/create.blade.php
 create mode 100644 resources/views/webprofile/backend/design/edit.blade.php
 create mode 100644 resources/views/webprofile/backend/design/index.blade.php

diff --git a/app/Http/Controllers/Webprofile/Backend/LayoutController.php b/app/Http/Controllers/Webprofile/Backend/LayoutController.php
new file mode 100644
index 0000000..ec32975
--- /dev/null
+++ b/app/Http/Controllers/Webprofile/Backend/LayoutController.php
@@ -0,0 +1,124 @@
+<?php
+
+namespace App\Http\Controllers\Webprofile\Backend;
+
+use Illuminate\Http\Request;
+use App\Http\Controllers\Controller;
+use App\Repositories\Webprofile\DesignRepository;
+use Crypt;
+
+class LayoutController extends Controller
+{
+    private $repo;
+
+    public function __construct(DesignRepository $repo)
+    {
+        $this->repo = $repo;
+    }
+
+    /**
+     * Display a listing of the resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function index()
+    {
+        $layouts = $this->repo->get();
+
+        $data = [
+            'layouts' => $layouts,
+        ];
+
+        return view('webprofile.backend.design.index', $data)->withTitle(trans('feature.layout'));
+    }
+
+    /**
+     * Show the form for creating a new resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function create()
+    {
+        return redirect()->route('layouts.index');
+    }
+
+    /**
+     * Store a newly created resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return \Illuminate\Http\Response
+     */
+    public function store(Request $request)
+    {
+        $data = $request->except('_token');
+        array_key_exists('title_show', $data) ? $data['title_show'] = 1 : $data['title_show'] = 0;
+
+        $this->repo->store($data);
+
+        return redirect()->route('layouts.index');
+    }
+
+    /**
+     * Display the specified resource.
+     *
+     * @param  int  $id
+     * @return \Illuminate\Http\Response
+     */
+    public function show($id)
+    {
+        $data = [
+            'position' => $id,
+        ];
+
+        return view('webprofile.backend.design.create', $data)->withTitle(trans('label.create') . ' ' . trans('feature.' . $id));
+    }
+
+    /**
+     * Show the form for editing the specified resource.
+     *
+     * @param  int  $id
+     * @return \Illuminate\Http\Response
+     */
+    public function edit($id)
+    {
+        $layout = $this->repo->findId(Crypt::decrypt($id));
+
+        $data = [
+            'data' => $layout,
+        ];
+
+        return view('webprofile.backend.design.edit', $data)->withTitle(trans('label.edit') . ' ' . trans('feature.' . $layout->name_design));
+    }
+
+    /**
+     * Update the specified resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  int  $id
+     * @return \Illuminate\Http\Response
+     */
+    public function update(Request $request, $id)
+    {
+        $data = $request->except(['_token', 'id']);
+        array_key_exists('title_show', $data) ? $data['title_show'] = 1 : $data['title_show'] = 0;
+
+        $layout = $this->repo->findId($id);
+        $edit = $this->repo->update($data, $layout);
+
+        return redirect()->route('layouts.index');
+    }
+
+    /**
+     * Remove the specified resource from storage.
+     *
+     * @param  int  $id
+     * @return \Illuminate\Http\Response
+     */
+    public function destroy($id)
+    {
+        $data = $this->repo->findId(Crypt::decrypt($id));
+        $this->repo->destroy($data);
+
+        return redirect()->route('layouts.index');
+    }
+}
diff --git a/database/migrations/2019_11_12_112102_create_design_table.php b/database/migrations/2019_11_12_112102_create_design_table.php
index 255aceb..0fc3b6b 100644
--- a/database/migrations/2019_11_12_112102_create_design_table.php
+++ b/database/migrations/2019_11_12_112102_create_design_table.php
@@ -19,6 +19,7 @@ class CreateDesignTable extends Migration
             $table->string('title_design')->nullable();
             $table->text('value_design')->nullable();
             $table->integer('urutan')->nullable();
+            $table->boolean('title_show')->nullable();
             $table->string('userid_created', 36)->nullable();
             $table->string('userid_updated', 36)->nullable();
             $table->timestamps();
diff --git a/resources/lang/en/feature.php b/resources/lang/en/feature.php
index 35686b7..7b19593 100644
--- a/resources/lang/en/feature.php
+++ b/resources/lang/en/feature.php
@@ -42,4 +42,14 @@ return [
     'edit_slider' => 'Edit Slider',
     'edit_layout' => 'Edit Layout',
 
+    'widget_right' => 'Widget Right',
+    'widget_left' => 'Widget Left',
+    'body' => 'Body',
+    'quote' => 'Quote',
+    'footer' => 'Footer',
+    'footer_row_1' => 'Footer 1',
+    'footer_row_2' => 'Footer 2',
+    'footer_row_3' => 'Footer 3',
+    'footer_row_4' => 'Footer 4',
+
 ];
diff --git a/resources/lang/en/label.php b/resources/lang/en/label.php
index 3e307a7..d50adb1 100644
--- a/resources/lang/en/label.php
+++ b/resources/lang/en/label.php
@@ -27,4 +27,5 @@ return [
     'value' => 'Value',
     'upload' => 'Upload',
     'download' => 'Download',
-];
+    'title_show' => 'Title Show',
+];
\ No newline at end of file
diff --git a/resources/lang/id/feature.php b/resources/lang/id/feature.php
index 224e3f9..fdd2d2d 100644
--- a/resources/lang/id/feature.php
+++ b/resources/lang/id/feature.php
@@ -42,4 +42,14 @@ return [
     'edit_slider' => 'Ubah Slider',
     'edit_layout' => 'Ubah Tampilan',
 
+    'widget_right' => 'Widget Kanan',
+    'widget_left' => 'Widget Kiri',
+    'body' => 'Body',
+    'quote' => 'Quote',
+    'footer' => 'Footer',
+    'footer_row_1' => 'Footer 1',
+    'footer_row_2' => 'Footer 2',
+    'footer_row_3' => 'Footer 3',
+    'footer_row_4' => 'Footer 4',
+
 ];
diff --git a/resources/lang/id/label.php b/resources/lang/id/label.php
index fd7a2d2..2646b19 100644
--- a/resources/lang/id/label.php
+++ b/resources/lang/id/label.php
@@ -27,4 +27,5 @@ return [
     'value' => 'Nilai',
     'upload' => 'Unggah',
     'download' => 'Unduh',
+    'title_show' => 'Judul ditampilkan',
 ];
\ No newline at end of file
diff --git a/resources/views/webprofile/backend/design/create.blade.php b/resources/views/webprofile/backend/design/create.blade.php
new file mode 100644
index 0000000..d635730
--- /dev/null
+++ b/resources/views/webprofile/backend/design/create.blade.php
@@ -0,0 +1,77 @@
+@extends('webprofile.backend.layouts.master')
+
+@section('title')
+{{ $title }}
+@stop
+
+@section('assets')
+<link rel="stylesheet" href="{!! asset('backend/assets/select2/select2.min.css') !!}">
+<style media="screen">
+  .tkh{
+    color: black;
+  }
+</style>
+@stop
+
+@section('breadcrumbs')
+<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
+<li class="active">@lang('label.create') @lang('feature.' . $position)</li>
+@stop
+
+@section('content')
+<!-- page start-->
+<div class="row">
+  {!! Form::open(array('url' => route('layouts.store'), 'method' => 'POST')) !!}
+  {!! csrf_field() !!}
+  <div class="col-md-12">
+	    <div class="panel panel-default">
+	        <div class="panel-heading">
+	            <h3 class="panel-title"><strong>@lang('label.create')</strong> @lang('feature.' . $position)</h3>
+	        </div>
+	        <div class="panel-body">
+	            <div class="row">
+                    {{ Form::text('name_design', $position, ['style'=>'display:none;']) }}
+	                <div class="col-md-12">
+	                    <div class="form-group @if ($errors->has('title_design')) has-error @endif">
+	                        <div class="col-md-11">
+	                          {{ Form::text('title_design', old('title_design'), array('class' => 'form-control', 'placeholder'=>trans('label.title'), 'style'=>'font-size: 14pt;')) }}
+	                          @if ($errors->has('title_design'))
+	                          <label id="login-error" class="error" for="login">{{$errors->first('title_design')}}</label>
+	                          @endif
+							</div>
+							<div class="col-md-1">
+								<label class="switch">
+									{{ Form::checkbox('title_show', 1, true, ['data-toggle'=>'tooltip', 'data-original-title'=>trans('label.title_show')]) }}
+									<span></span>
+								</label>
+							</div>
+	                    </div>
+                  </div>
+                  <div class="col-md-12">
+	                    <div class="block">
+	                      {{ Form::textarea('value_design', null, array('class'=>'summernote')) }}
+	                    </div>
+	                </div>
+	            </div>
+	        </div>
+	    </div>
+	</div>
+	<div class="col-md-12">
+	    <div class="panel panel-default">
+	        <div class="panel-footer">
+				<button class="btn btn-info pull-right">@lang('label.save')</button>
+	        </div>
+	    </div>
+	</div>
+  {!! Form::close() !!}
+</div>
+<!-- page end-->
+@stop
+
+@section('script')
+{!! Html::script('backend/assets/select2/select2.full.min.js') !!}
+{!! Html::script('backend/js/plugins/bootstrap/bootstrap-datepicker.js') !!}
+{!! Html::script('backend/js/plugins/bootstrap/bootstrap-timepicker.min.js') !!}
+{!! Html::script('backend/js/plugins/bootstrap/bootstrap-file-input.js') !!}
+{!! Html::script('backend/js/plugins/summernote/summernote.js') !!}
+@stop
\ No newline at end of file
diff --git a/resources/views/webprofile/backend/design/edit.blade.php b/resources/views/webprofile/backend/design/edit.blade.php
new file mode 100644
index 0000000..8e154bd
--- /dev/null
+++ b/resources/views/webprofile/backend/design/edit.blade.php
@@ -0,0 +1,77 @@
+@extends('webprofile.backend.layouts.master')
+
+@section('title')
+{{ $title }}
+@stop
+
+@section('assets')
+<link rel="stylesheet" href="{!! asset('backend/assets/select2/select2.min.css') !!}">
+<style media="screen">
+  .tkh{
+    color: black;
+  }
+</style>
+@stop
+
+@section('breadcrumbs')
+<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
+<li class="active">@lang('label.edit') @lang('feature.' . $data->name_design)</li>
+@stop
+
+@section('content')
+<!-- page start-->
+<div class="row">
+  {!! Form::model($data, ['route' => ['layouts.update', $data->id], 'method'=>'patch']) !!}
+  {!! csrf_field() !!}
+  <div class="col-md-12">
+	    <div class="panel panel-default">
+	        <div class="panel-heading">
+	            <h3 class="panel-title"><strong>@lang('label.create')</strong> @lang('feature.' . $data->name_design)</h3>
+	        </div>
+	        <div class="panel-body">
+	            <div class="row">
+                    {{ Form::text('name_design', $data->name_design, ['style'=>'display:none;']) }}
+	                <div class="col-md-12">
+	                    <div class="form-group @if ($errors->has('title_design')) has-error @endif">
+	                        <div class="col-md-11">
+	                          {{ Form::text('title_design', old('title_design'), array('class' => 'form-control', 'placeholder'=>trans('label.title'), 'style'=>'font-size: 14pt;')) }}
+	                          @if ($errors->has('title_design'))
+	                          <label id="login-error" class="error" for="login">{{$errors->first('title_design')}}</label>
+	                          @endif
+							</div>
+							<div class="col-md-1">
+								<label class="switch">
+									{{ Form::checkbox('title_show', $data->title_show, $data->title_show, ['data-toggle'=>'tooltip', 'data-original-title'=>trans('label.title_show')]) }}
+									<span></span>
+								</label>
+							</div>
+	                    </div>
+                  </div>
+                  <div class="col-md-12">
+	                    <div class="block">
+	                      {{ Form::textarea('value_design', null, array('class'=>'summernote')) }}
+	                    </div>
+	                </div>
+	            </div>
+	        </div>
+	    </div>
+	</div>
+	<div class="col-md-12">
+	    <div class="panel panel-default">
+	        <div class="panel-footer">
+				<button class="btn btn-info pull-right">@lang('label.save')</button>
+	        </div>
+	    </div>
+	</div>
+  {!! Form::close() !!}
+</div>
+<!-- page end-->
+@stop
+
+@section('script')
+{!! Html::script('backend/assets/select2/select2.full.min.js') !!}
+{!! Html::script('backend/js/plugins/bootstrap/bootstrap-datepicker.js') !!}
+{!! Html::script('backend/js/plugins/bootstrap/bootstrap-timepicker.min.js') !!}
+{!! Html::script('backend/js/plugins/bootstrap/bootstrap-file-input.js') !!}
+{!! Html::script('backend/js/plugins/summernote/summernote.js') !!}
+@stop
\ No newline at end of file
diff --git a/resources/views/webprofile/backend/design/index.blade.php b/resources/views/webprofile/backend/design/index.blade.php
new file mode 100644
index 0000000..b264fab
--- /dev/null
+++ b/resources/views/webprofile/backend/design/index.blade.php
@@ -0,0 +1,261 @@
+@extends('webprofile.backend.layouts.master')
+
+@section('title')
+  {{ $title }}
+@stop
+
+@section('breadcrumbs')
+<li><a href="{{ url('dashboard') }}">@lang('label.dashboard')</a></li>
+<li class="active">@lang('feature.layout')</li>
+@stop
+
+@section('content')
+<div class="col-md-12">        
+    <div class="panel panel-default">
+        <div class="panel-body">
+            <h3>Header</h3>
+        </div>
+    </div>
+</div>
+<div class="col-md-12">
+    <div class="col-md-3">        
+        <div class="panel panel-default">
+            <div class="panel-body">
+                <h3>Widget Left</h3>
+                <div class="panel-body">
+                    <a href="{!! url('webprofile/layouts/widget_left') !!}" class="btn btn-block btn-success"><i class="fa fa-edit"></i> @lang('label.create')</a>
+                    @foreach ($layouts->where('name_design', 'widget_left')->sortBy('urutan') as $value)
+                    <div class="panel panel-default">
+                        <div class="panel-body">
+                            {!! $value->title_design !!}    
+                            <div class="pull-right">
+                                <a href="{{ route('layouts.edit', ['data'=>Crypt::encrypt($value->id)]) }}" class="btn btn-warning btn-xs"><i class="fa fa-pencil"></i></a>
+
+                                <button class="btn btn-danger btn-xs" id="btn_delete" data-file="{{$value->id}}"><i class="fa fa-trash-o"></i></button>
+                                {{ Form::open(['url'=>route('layouts.destroy', ['data'=>Crypt::encrypt($value->id)]), 'method'=>'delete', 'id' => $value->id, 'style' => 'display: none;']) }}
+                                {{ csrf_field() }}
+                                {{ Form::close() }}
+                            </div>
+                        </div>
+                    </div>
+                    @endforeach
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="col-md-6">        
+        <div class="panel panel-default">
+            <div class="panel-body">
+                <h3>Content</h3>
+            </div>
+        </div>
+    </div>
+    <div class="col-md-3">        
+        <div class="panel panel-default">
+            <div class="panel-body">
+                <h3>Widget Right</h3>
+                <div class="panel-body">
+                    <a href="{!! url('webprofile/layouts/widget_right') !!}" class="btn btn-block btn-success"><i class="fa fa-edit"></i> @lang('label.create')</a>
+                    @foreach ($layouts->where('name_design', 'widget_right')->sortBy('urutan') as $value)
+                    <div class="panel panel-default">
+                        <div class="panel-body">
+                            {!! $value->title_design !!}
+                            <div class="pull-right">
+                                <a href="{{ route('layouts.edit', ['data'=>Crypt::encrypt($value->id)]) }}" class="btn btn-warning btn-xs"><i class="fa fa-pencil"></i></a>
+
+                                <button class="btn btn-danger btn-xs" id="btn_delete" data-file="{{$value->id}}"><i class="fa fa-trash-o"></i></button>
+                                {{ Form::open(['url'=>route('layouts.destroy', ['data'=>Crypt::encrypt($value->id)]), 'method'=>'delete', 'id' => $value->id, 'style' => 'display: none;']) }}
+                                {{ csrf_field() }}
+                                {{ Form::close() }}
+                            </div>
+                        </div>
+                    </div>
+                    @endforeach
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<div class="col-md-12">
+    <div class="panel panel-default">
+        <div class="panel-body">
+            <h3>Body <a href="{!! url('webprofile/layouts/body') !!}" class="btn btn-success"><i class="fa fa-edit"></i> @lang('label.create')</a></h3>
+            <div class="col-md-12">
+                @foreach ($layouts->where('name_design', 'body')->sortBy('urutan') as $value)
+                <div class="panel panel-default">
+                    <div class="panel-body">
+                        <div style="text-align: center;">{!! $value->title_design !!}</div>
+                        <div style="text-align: center;">
+                            <a href="{{ route('layouts.edit', ['data'=>Crypt::encrypt($value->id)]) }}" class="btn btn-warning btn-xs"><i class="fa fa-pencil"></i></a>
+
+                            <button class="btn btn-danger btn-xs" id="btn_delete" data-file="{{$value->id}}"><i class="fa fa-trash-o"></i></button>
+                            {{ Form::open(['url'=>route('layouts.destroy', ['data'=>Crypt::encrypt($value->id)]), 'method'=>'delete', 'id' => $value->id, 'style' => 'display: none;']) }}
+                            {{ csrf_field() }}
+                            {{ Form::close() }}
+                        </div>
+                        <hr>
+                    </div>
+                </div>
+                @endforeach
+            </div>
+        </div>
+    </div>
+</div>
+<div class="col-md-12">
+    <div class="panel panel-default">
+        <div class="panel-body">
+            <h3>Quote <a href="{!! url('webprofile/layouts/quote') !!}" class="btn btn-success"><i class="fa fa-edit"></i> @lang('label.create')</a></h3>
+            <div class="col-md-12">
+                @foreach ($layouts->where('name_design', 'quote')->sortBy('urutan') as $value)
+                <div class="panel panel-default">
+                    <div class="panel-body">
+                        <div style="text-align: center;">{!! $value->value_design !!}</div>
+                        <div style="text-align: center;">{!! $value->title_design !!}</div>
+                        <div style="text-align: center;">
+                            <a href="{{ route('layouts.edit', ['data'=>Crypt::encrypt($value->id)]) }}" class="btn btn-warning btn-xs"><i class="fa fa-pencil"></i></a>
+
+                            <button class="btn btn-danger btn-xs" id="btn_delete" data-file="{{$value->id}}"><i class="fa fa-trash-o"></i></button>
+                            {{ Form::open(['url'=>route('layouts.destroy', ['data'=>Crypt::encrypt($value->id)]), 'method'=>'delete', 'id' => $value->id, 'style' => 'display: none;']) }}
+                            {{ csrf_field() }}
+                            {{ Form::close() }}
+                        </div>
+                    </div>
+                </div>
+                @endforeach
+            </div>
+        </div>
+    </div>
+</div>
+<div class="col-md-12">
+    <div class="panel panel-default">
+        <div class="panel-body">
+            <h3>Footer</h3>
+            <div class="col-md-3">
+                <div class="panel panel-default">
+                    <div class="panel-body">
+                    <a href="{{ url('webprofile/layouts/footer_row_1') }}" class="btn btn-block btn-success"><i class="fa fa-edit"></i> Footer 1</a>
+                    </div>
+
+                    @foreach ($layouts->where('name_design', 'footer_row_1')->sortBy('urutan') as $value)
+                    <div class="panel panel-default">
+                        <div class="panel-body">
+                            <div style="text-align: center;">{!! $value->title_design !!}</div>
+                            <div style="text-align: center;">
+                                <a href="{{ route('layouts.edit', ['data'=>Crypt::encrypt($value->id)]) }}" class="btn btn-warning btn-xs"><i class="fa fa-pencil"></i></a>
+
+                                <button class="btn btn-danger btn-xs" id="btn_delete" data-file="{{$value->id}}"><i class="fa fa-trash-o"></i></button>
+                                {{ Form::open(['url'=>route('layouts.destroy', ['data'=>Crypt::encrypt($value->id)]), 'method'=>'delete', 'id' => $value->id, 'style' => 'display: none;']) }}
+                                {{ csrf_field() }}
+                                {{ Form::close() }}
+                            </div>
+                        </div>
+                    </div>
+                    @endforeach
+                </div>
+            </div>
+            <div class="col-md-3">
+                <div class="panel panel-default">
+                    <div class="panel-body">
+                        <a href="{{ url('webprofile/layouts/footer_row_2') }}" class="btn btn-block btn-success"><i class="fa fa-edit"></i> Footer 2</a>
+                    </div>
+
+                    @foreach ($layouts->where('name_design', 'footer_row_2')->sortBy('urutan') as $value)
+                    <div class="panel panel-default">
+                        <div class="panel-body">
+                            <div style="text-align: center;">{!! $value->title_design !!}</div>
+                            <div style="text-align: center;">
+                                <a href="{{ route('layouts.edit', ['data'=>Crypt::encrypt($value->id)]) }}" class="btn btn-warning btn-xs"><i class="fa fa-pencil"></i></a>
+
+                                <button class="btn btn-danger btn-xs" id="btn_delete" data-file="{{$value->id}}"><i class="fa fa-trash-o"></i></button>
+                                {{ Form::open(['url'=>route('layouts.destroy', ['data'=>Crypt::encrypt($value->id)]), 'method'=>'delete', 'id' => $value->id, 'style' => 'display: none;']) }}
+                                {{ csrf_field() }}
+                                {{ Form::close() }}
+                            </div>
+                        </div>
+                    </div>
+                    @endforeach
+                </div>
+            </div>
+            <div class="col-md-3">
+                <div class="panel panel-default">
+                    <div class="panel-body">
+                        <a href="{{ url('webprofile/layouts/footer_row_3') }}" class="btn btn-block btn-success"><i class="fa fa-edit"></i> Footer 3</a>
+                    </div>
+
+                    @foreach ($layouts->where('name_design', 'footer_row_3')->sortBy('urutan') as $value)
+                    <div class="panel panel-default">
+                        <div class="panel-body">
+                            <div style="text-align: center;">{!! $value->title_design !!}</div>
+                            <div style="text-align: center;">
+                                <a href="{{ route('layouts.edit', ['data'=>Crypt::encrypt($value->id)]) }}" class="btn btn-warning btn-xs"><i class="fa fa-pencil"></i></a>
+
+                                <button class="btn btn-danger btn-xs" id="btn_delete" data-file="{{$value->id}}"><i class="fa fa-trash-o"></i></button>
+                                {{ Form::open(['url'=>route('layouts.destroy', ['data'=>Crypt::encrypt($value->id)]), 'method'=>'delete', 'id' => $value->id, 'style' => 'display: none;']) }}
+                                {{ csrf_field() }}
+                                {{ Form::close() }}
+                            </div>
+                        </div>
+                    </div>
+                    @endforeach
+                </div>
+            </div>
+            <div class="col-md-3">
+                <div class="panel panel-default">
+                    <div class="panel-body">
+                        <a href="{{ url('webprofile/layouts/footer_row_4') }}" class="btn btn-block btn-success"><i class="fa fa-edit"></i> Footer 4</a>
+                    </div>
+
+                    @foreach ($layouts->where('name_design', 'footer_row_4')->sortBy('urutan') as $value)
+                    <div class="panel panel-default">
+                        <div class="panel-body">
+                            <div style="text-align: center;">{!! $value->title_design !!}</div>
+                            <div style="text-align: center;">
+                                <a href="{{ route('layouts.edit', ['data'=>Crypt::encrypt($value->id)]) }}" class="btn btn-warning btn-xs"><i class="fa fa-pencil"></i></a>
+
+                                <button class="btn btn-danger btn-xs" id="btn_delete" data-file="{{$value->id}}"><i class="fa fa-trash-o"></i></button>
+                                {{ Form::open(['url'=>route('layouts.destroy', ['data'=>Crypt::encrypt($value->id)]), 'method'=>'delete', 'id' => $value->id, 'style' => 'display: none;']) }}
+                                {{ csrf_field() }}
+                                {{ Form::close() }}
+                            </div>
+                        </div>
+                    </div>
+                    @endforeach
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+@endsection
+
+@section('script')
+<script src="{!!asset('backend/js/datatables.net/js/jquery.dataTables.min.js') !!}"></script>
+<script>
+  $('button#btn_delete').on('click', function(e){
+    e.preventDefault();
+    var data = $(this).attr('data-file');
+
+    swal({
+      title             : "Apakah Anda Yakin?",
+      text              : "Anda akan menghapus widget ini!",
+      type              : "warning",
+      showCancelButton  : true,
+      confirmButtonColor: "#DD6B55",
+      confirmButtonText : "Yes",
+      cancelButtonText  : "No",
+      closeOnConfirm    : false,
+      closeOnCancel     : false
+    },
+    function(isConfirm){
+      if(isConfirm){
+        swal("Terhapus","Widget berhasil dihapus", "success");
+        setTimeout(function() {
+          $("#"+data).submit();
+        }, 1000); // 1 second delay
+      }
+      else{
+        swal("Dibatalkan","Widget batal dihapus", "error");
+      }
+    }
+  );});
+</script>
+@stop
diff --git a/routes/webprofile/backend.php b/routes/webprofile/backend.php
index 440f6c5..8a83c4b 100644
--- a/routes/webprofile/backend.php
+++ b/routes/webprofile/backend.php
@@ -11,6 +11,7 @@ Route::group(['middleware' => 'auth'], function () {
             Route::resource('gallery', 'GalleryController');
             Route::resource('categoriesfile', 'CategoriesFileController');
             Route::resource('file', 'FileController');
+            Route::resource('layouts', 'LayoutController');
         });
     // });
 });
--
libgit2 0.26.0