Commit 61e704e5 by Aan Choesni Herlingga

master layouts

parent f730c7a5
<?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');
}
}
......@@ -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();
......
......@@ -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',
];
......@@ -27,4 +27,5 @@ return [
'value' => 'Value',
'upload' => 'Upload',
'download' => 'Download',
];
'title_show' => 'Title Show',
];
\ No newline at end of file
......@@ -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',
];
......@@ -27,4 +27,5 @@ return [
'value' => 'Nilai',
'upload' => 'Unggah',
'download' => 'Unduh',
'title_show' => 'Judul ditampilkan',
];
\ No newline at end of file
@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
@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
@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
......@@ -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');
});
// });
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment