-
Notifications
You must be signed in to change notification settings - Fork 425
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #616 from nasirkhan/dev
Update Settings Module
- Loading branch information
Showing
10 changed files
with
522 additions
and
503 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 16 additions & 7 deletions
23
resources/views/backend/settings/fields/checkbox.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
@php | ||
$required = (Str::contains($field['rules'], 'required')) ? "required" : ""; | ||
$required_mark = ($required != "") ? '<span class="text-danger"> <strong>*</strong> </span>' : ''; | ||
$required = Str::contains($field['rules'], 'required') ? 'required' : ''; | ||
$required_mark = $required != '' ? '<span class="text-danger"> <strong>*</strong> </span>' : ''; | ||
@endphp | ||
|
||
<div class="form-group mt-3 {{ $errors->has($field['name']) ? ' has-error' : '' }}"> | ||
<div class="form-group {{ $errors->has($field['name']) ? ' has-error' : '' }} mt-3"> | ||
<div class="checkbox"> | ||
|
||
<label class='form-label' for="{{ $field['name'] }}"> <strong>{{ __($field['label']) }}</strong> | ||
({{ $field['name'] }})</label> {!! $required_mark !!} | ||
<br> | ||
|
||
<label> | ||
<input type='hidden' value='0' name='{{ $field['name'] }}' class='form-label'> | ||
<input name=" {{ $field['name'] }}" value="{{ \Illuminate\Support\Arr::get($field, 'value', '1') }}" type="checkbox" @if(old($field['name'], setting($field['name']))) checked="checked" @endif> | ||
<input class='form-label' name='{{ $field['name'] }}' type='hidden' value='0'> | ||
<input name=" {{ $field['name'] }}" type="checkbox" | ||
value="{{ \Illuminate\Support\Arr::get($field, 'value', '1') }}" | ||
@if (old($field['name'], setting($field['name']))) checked="checked" @endif> | ||
{{ $field['label'] }} | ||
</label> {!! $required_mark !!} | ||
|
||
@if ($errors->has($field['name'])) <small class="help-block">{{ $errors->first($field['name']) }}</small> @endif | ||
@if ($errors->has($field['name'])) | ||
<small class="help-block">{{ $errors->first($field['name']) }}</small> | ||
@endif | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,58 @@ | ||
@extends('backend.layouts.app') | ||
|
||
@section('title') {{ __($module_action) }} {{ __($module_title) }} @endsection | ||
@section('title') | ||
{{ __($module_action) }} {{ __($module_title) }} | ||
@endsection | ||
|
||
@section('breadcrumbs') | ||
<x-backend.breadcrumbs> | ||
<x-backend.breadcrumb-item type="active" icon='{{ $module_icon }}'>{{ __($module_title) }}</x-backend.breadcrumb-item> | ||
</x-backend.breadcrumbs> | ||
<x-backend.breadcrumbs> | ||
<x-backend.breadcrumb-item type="active" | ||
icon='{{ $module_icon }}'>{{ __($module_title) }}</x-backend.breadcrumb-item> | ||
</x-backend.breadcrumbs> | ||
@endsection | ||
|
||
@section('content') | ||
<div class="card"> | ||
<div class="card-body"> | ||
|
||
<x-backend.section-header> | ||
<i class="{{ $module_icon }}"></i> {{ __($module_title) }} <small class="text-muted">{{ __($module_action) }}</small> | ||
|
||
<x-slot name="toolbar"> | ||
<x-backend.buttons.return-back /> | ||
</x-slot> | ||
</x-backend.section-header> | ||
|
||
<div class="row mt-4"> | ||
<div class="col"> | ||
<form method="post" action="{{ route('backend.settings.store') }}" class="form-horizontal" role="form"> | ||
{!! csrf_field() !!} | ||
|
||
@if(count(config('setting_fields', [])) ) | ||
|
||
@foreach(config('setting_fields') as $section => $fields) | ||
<div class="card card-accent-primary mb-4"> | ||
<div class="card-header"> | ||
<i class="{{ Arr::get($fields, 'icon', 'glyphicon glyphicon-flash') }}"></i> | ||
{{ $fields['title'] }} | ||
</div> | ||
<div class="card-body"> | ||
<p class="text-muted">{{ $fields['desc'] }}</p> | ||
|
||
<div class="row mt-3"> | ||
<div class="col"> | ||
@foreach($fields['elements'] as $field) | ||
@includeIf('backend.settings.fields.' . $field['type'] ) | ||
@endforeach | ||
<div class="card"> | ||
<div class="card-body"> | ||
|
||
<x-backend.section-header :module_name="$module_name" :module_title="$module_title" :module_icon="$module_icon" :module_action="$module_action" /> | ||
|
||
<div class="row mt-4"> | ||
<div class="col"> | ||
|
||
{{ html()->form('POST', route("backend.$module_name.store"))->open() }} | ||
|
||
@if (count(config('setting_fields', []))) | ||
@foreach (config('setting_fields') as $section => $fields) | ||
<div class="card card-accent-primary mb-4"> | ||
<div class="card-header"> | ||
<i class="{{ Arr::get($fields, 'icon', 'glyphicon glyphicon-flash') }}"></i> | ||
{{ $fields['title'] }} | ||
</div> | ||
<div class="card-body"> | ||
<p class="text-muted">{{ $fields['desc'] }}</p> | ||
|
||
<div class="row mt-3"> | ||
<div class="col"> | ||
@foreach ($fields['elements'] as $field) | ||
@includeIf('backend.settings.fields.' . $field['type']) | ||
@endforeach | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
@endforeach | ||
@endforeach | ||
@endif | ||
|
||
@endif | ||
|
||
<div class="row m-b-md"> | ||
<div class="col-md-12"> | ||
<x-backend.buttons.save /> | ||
<div class="row m-b-md"> | ||
<div class="col-md-12"> | ||
<x-backend.buttons.save /> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</form> | ||
{{ html()->form()->close() }} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="card-footer"> | ||
<div class="row"> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
@endsection | ||
@endsection |
2 changes: 1 addition & 1 deletion
2
resources/views/components/backend/buttons/return-back.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
@props(["small"=>""]) | ||
@props(["small"=>"true"]) | ||
<button onclick="window.history.back();" class="btn btn-warning m-1 {{($small=='true')? 'btn-sm' : ''}}" data-toggle="tooltip" title="{{__('Return Back')}}"><i class="fas fa-reply fa-fw"></i> {!! ($slot != "") ? ' ' . $slot : '' !!}</button> |
119 changes: 66 additions & 53 deletions
119
resources/views/components/backend/section-header.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,79 @@ | ||
@props(["data"=>"", "toolbar"=>"", "title"=>"", "subtitle"=>"", "module_name"=>"", "module_title"=>"", "module_icon"=>"", "module_action"=>""]) | ||
@props([ | ||
'data' => '', | ||
'toolbar' => '', | ||
'title' => '', | ||
'subtitle' => '', | ||
'module_name' => '', | ||
'module_title' => '', | ||
'module_icon' => '', | ||
'module_action' => '', | ||
]) | ||
|
||
<div class="d-flex justify-content-between"> | ||
<div class="align-self-center"> | ||
@if($slot != "") | ||
<h4 class="card-title mb-0"> | ||
{{ $slot }} | ||
</h4> | ||
@if ($slot != '') | ||
<h4 class="card-title mb-0"> | ||
{{ $slot }} | ||
</h4> | ||
@else | ||
<h4 class="card-title mb-0"> | ||
<i class="{{ $module_icon }}"></i> {{ __($module_title) }} <small class="text-muted">{{ __($module_action) }}</small> | ||
</h4> | ||
<h4 class="card-title mb-0"> | ||
<i class="{{ $module_icon }}"></i> {{ __($module_title) }} <small | ||
class="text-muted">{{ __($module_action) }}</small> | ||
</h4> | ||
@endif | ||
|
||
@if($subtitle) | ||
<div class="small text-medium-emphasis"> | ||
{{ $subtitle }} | ||
</div> | ||
@if ($subtitle) | ||
<div class="small text-medium-emphasis"> | ||
{{ $subtitle }} | ||
</div> | ||
@endif | ||
</div> | ||
@if($toolbar) | ||
<div class="btn-toolbar d-block text-end" role="toolbar" aria-label="Toolbar with buttons"> | ||
{{ $toolbar }} | ||
</div> | ||
@if ($toolbar) | ||
<div class="btn-toolbar d-block text-end" role="toolbar" aria-label="Toolbar with buttons"> | ||
{{ $toolbar }} | ||
</div> | ||
@else | ||
<div class="btn-toolbar d-block text-end" role="toolbar" aria-label="Toolbar with buttons"> | ||
@if (Str::endsWith(Route::currentRouteName(), 'index')) | ||
@can('add_' . $module_name) | ||
<x-backend.buttons.create title="{{ __('Create') }} {{ ucwords(Str::singular($module_name)) }}" | ||
small="true" route='{{ route("backend.$module_name.create") }}' /> | ||
@endcan | ||
@can('restore_' . $module_name) | ||
<div class="btn-group"> | ||
<button class="btn btn-secondary btn-sm dropdown-toggle" data-coreui-toggle="dropdown" | ||
type="button" aria-expanded="false"> | ||
<i class="fas fa-cog"></i> | ||
</button> | ||
<ul class="dropdown-menu"> | ||
<li> | ||
<a class="dropdown-item" href='{{ route("backend.$module_name.trashed") }}'> | ||
<i class="fas fa-eye-slash"></i> @lang('View trash') | ||
</a> | ||
</li> | ||
</ul> | ||
</div> | ||
@endcan | ||
@elseif (Str::endsWith(Route::currentRouteName(), 'create')) | ||
<x-backend.buttons.return-back small="true" /> | ||
<a href='{{ route("backend.$module_name.index") }}' class="btn btn-secondary btn-sm ms-1" data-toggle="tooltip" title="{{ __($module_title) }} List"><i class="fas fa-list-ul"></i> List</a> | ||
|
||
@elseif (Str::endsWith(Route::currentRouteName(), 'edit')) | ||
<x-backend.buttons.return-back small="true" /> | ||
<x-buttons.show route='{!!route("backend.$module_name.show", $data)!!}' title="{{__('Show')}} {{ ucwords(Str::singular($module_name)) }}" class="ms-1" small="true" /> | ||
<div class="btn-toolbar d-block text-end" role="toolbar" aria-label="Toolbar with buttons"> | ||
@if (Str::endsWith(Route::currentRouteName(), 'index')) | ||
<x-backend.buttons.return-back /> | ||
|
||
@elseif (Str::endsWith(Route::currentRouteName(), 'show')) | ||
<x-backend.buttons.return-back small="true" /> | ||
@can('edit_'.$module_name) | ||
<x-buttons.edit route='{!!route("backend.$module_name.edit", $data)!!}' title="{{__('Edit')}} {{ ucwords(Str::singular($module_name)) }}" class="m-1" small="true" /> | ||
@endcan | ||
<a href="{{ route("backend.$module_name.index") }}" class="btn btn-secondary btn-sm" data-toggle="tooltip" title="{{ ucwords($module_name) }} List"><i class="fas fa-list"></i> List</a> | ||
@endif | ||
</div> | ||
@if (auth()->user()->can('add_' . $module_name) && Route::has('backend.'.$module_name.'.create')) | ||
<x-backend.buttons.create title="{{ __('Create') }} {{ ucwords(Str::singular($module_name)) }}" | ||
small="true" route='{{ route("backend.$module_name.create") }}' /> | ||
@endif | ||
@if (auth()->user()->can('restore_' . $module_name) && Route::has('backend.'.$module_name.'.create')) | ||
<div class="btn-group"> | ||
<button class="btn btn-secondary btn-sm dropdown-toggle" data-coreui-toggle="dropdown" | ||
type="button" aria-expanded="false"> | ||
<i class="fas fa-cog"></i> | ||
</button> | ||
<ul class="dropdown-menu"> | ||
<li> | ||
<a class="dropdown-item" href='{{ route("backend.$module_name.trashed") }}'> | ||
<i class="fas fa-eye-slash"></i> @lang('View trash') | ||
</a> | ||
</li> | ||
</ul> | ||
</div> | ||
@endif | ||
@elseif (Str::endsWith(Route::currentRouteName(), 'create')) | ||
<a class="btn btn-secondary btn-sm ms-1" data-toggle="tooltip" | ||
href='{{ route("backend.$module_name.index") }}' title="{{ __($module_title) }} List"><i | ||
class="fas fa-list-ul"></i> List</a> | ||
@elseif (Str::endsWith(Route::currentRouteName(), 'edit')) | ||
<x-buttons.show class="ms-1" title="{{ __('Show') }} {{ ucwords(Str::singular($module_name)) }}" | ||
route='{!! route("backend.$module_name.show", $data) !!}' small="true" /> | ||
@elseif (Str::endsWith(Route::currentRouteName(), 'show')) | ||
@if (auth()->user()->can('edit_' . $module_name) && Route::has('backend.'.$module_name.'.edit')) | ||
<x-buttons.edit class="m-1" title="{{ __('Edit') }} {{ ucwords(Str::singular($module_name)) }}" | ||
route='{!! route("backend.$module_name.edit", $data) !!}' small="true" /> | ||
@endif | ||
<a class="btn btn-secondary btn-sm" data-toggle="tooltip" | ||
href="{{ route("backend.$module_name.index") }}" title="{{ ucwords($module_name) }} List"><i | ||
class="fas fa-list"></i> {{ __('List') }}</a> | ||
@endif | ||
</div> | ||
@endif | ||
</div> | ||
|
||
<hr> | ||
<hr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.