This commit is contained in:
merdan 2022-12-15 15:11:55 +05:00
parent 999a7c8049
commit de2b1bf8ef
12 changed files with 411 additions and 25 deletions

View File

@ -20,7 +20,7 @@
"extra": {
"laravel": {
"providers": [
"TPS\\API\\Providers\\APIerviceProvider"
"TPS\\API\\Providers\\APIServiceProvider"
],
"aliases": {}
}

View File

@ -0,0 +1,153 @@
@extends('admin::layouts.content')
@section('page_title')
{{ __('admin::app.settings.sliders.add-title') }}
@stop
@section('content')
<div class="content">
<form
method="POST"
@submit.prevent="onSubmit"
enctype="multipart/form-data"
action="{{ route('admin.sliders.create') }}">
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.sliders.index') }}'"></i>
{{ __('admin::app.settings.sliders.add-title') }}
</h1>
</div>
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.sliders.save-btn-title') }}
</button>
</div>
</div>
<div class="page-content">
<div class="form-container">
@csrf()
{!! view_render_event('bagisto.admin.settings.slider.create.before') !!}
<div class="control-group multi-select" :class="[errors.has('locale[]') ? 'has-error' : '']">
<label for="locale">{{ __('admin::app.datagrid.locale') }}</label>
<select class="control" id="locale" name="locale[]" data-vv-as="&quot;{{ __('admin::app.datagrid.locale') }}&quot;" value="" v-validate="'required'" multiple>
@foreach (core()->getAllLocales() as $localeModel)
<option value="{{ $localeModel->code }}">
{{ $localeModel->name }}
</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('locale[]')">@{{ errors.first('locale[]') }}</span>
</div>
<div class="control-group" :class="[errors.has('title') ? 'has-error' : '']">
<label for="title" class="required">{{ __('admin::app.settings.sliders.name') }}</label>
<input type="text" class="control" name="title" v-validate="'required'" data-vv-as="&quot;{{ __('admin::app.settings.sliders.name') }}&quot;">
<span class="control-error" v-if="errors.has('title')">@{{ errors.first('title') }}</span>
</div>
<div class="control-group" :class="[errors.has('type') ? 'has-error' : '']">
<label for="type" class="required">{{ __('admin::app.catalog.categories.display-mode') }}</label>
<select class="control" v-validate="'required'" id="type" name="type" data-vv-as="&quot;Type&quot;">
<option value="slider">
Slider
</option>
<option value="banner">
Banner
</option>
</select>
<span class="control-error" v-if="errors.has('display_mode')">@{{ errors.first('display_mode') }}</span>
</div>
<?php $channels = core()->getAllChannels() ?>
<div class="control-group" :class="[errors.has('channel_id') ? 'has-error' : '']">
<label for="channel_id">{{ __('admin::app.settings.sliders.channels') }}</label>
<select class="control" id="channel_id" name="channel_id" v-validate="'required'" data-vv-as="&quot;{{ __('admin::app.settings.sliders.channels') }}&quot;">
@foreach ($channels as $channel)
<option value="{{ $channel->id }}" @if ($channel->id == old('channel_id')) selected @endif>
{{ __(core()->getChannelName($channel)) }}
</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('channel_id')">@{{ errors.first('channel_id') }}</span>
</div>
<div class="control-group date">
<label for="expired_at">{{ __('admin::app.settings.sliders.expired-at') }}</label>
<date>
<input type="text" name="expired_at" class="control" value="{{ old('expired_at') }}"/>
</date>
</div>
<div class="control-group">
<label for="sort_order">{{ __('admin::app.settings.sliders.sort-order') }}</label>
<input type="text" class="control" id="sort_order" name="sort_order" value="{{ old('sort_order') ?? 0 }}"/>
</div>
<div class="control-group {!! $errors->has('image.*') ? 'has-error' : '' !!}">
<label class="required">{{ __('admin::app.catalog.categories.image') }}</label>
<image-wrapper button-label="{{ __('admin::app.settings.sliders.image') }}" input-name="image" :multiple="false"></image-wrapper>
<span class="control-error" v-if="{!! $errors->has('image.*') !!}">
@foreach ($errors->get('image.*') as $key => $message)
@php echo str_replace($key, 'Image', $message[0]); @endphp
@endforeach
</span>
</div>
<div class="control-group {!! $errors->has('mobile_image.*') ? 'has-error' : '' !!}">
<label class="required">Mobile image</label>
<image-wrapper button-label="{{ __('admin::app.settings.sliders.image') }}" input-name="mobile_image" :multiple="false"></image-wrapper>
<span class="control-error" v-if="{!! $errors->has('mobile_image.*') !!}">
@foreach ($errors->get('mobile_image.*') as $key => $message)
@php echo str_replace($key, 'Image', $message[0]); @endphp
@endforeach
</span>
</div>
<div class="control-group" :class="[errors.has('content') ? 'has-error' : '']">
<label for="content">{{ __('admin::app.settings.sliders.content') }}</label>
<textarea id="tiny" class="control" id="add_content" name="content" rows="5"></textarea>
<span class="control-error" v-if="errors.has('content')">@{{ errors.first('content') }}</span>
</div>
{!! view_render_event('bagisto.admin.settings.slider.create.after') !!}
</div>
</div>
</form>
</div>
@endsection
@push('scripts')
@include('admin::layouts.tinymce')
<script>
$(document).ready(function () {
tinyMCEHelper.initTinyMCE({
selector: 'textarea#tiny',
height: 200,
width: "100%",
plugins: 'image imagetools media wordcount save fullscreen code table lists link hr',
toolbar1: 'formatselect | bold italic strikethrough forecolor backcolor link hr | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat | code | table',
image_advtab: true,
templates: [
{ title: 'Test template 1', content: 'Test 1' },
{ title: 'Test template 2', content: 'Test 2' }
],
});
});
</script>
@endpush

View File

@ -0,0 +1,157 @@
@extends('admin::layouts.content')
@section('page_title')
{{ __('admin::app.settings.sliders.edit-title') }}
@stop
@section('content')
<div class="content">
@php $locale = core()->getRequestedLocaleCode(); @endphp
<form method="POST" action="{{ route('admin.sliders.update', $slider->id) }}" @submit.prevent="onSubmit" enctype="multipart/form-data">
<div class="page-header">
<div class="page-title">
<h1>
<i class="icon angle-left-icon back-link" onclick="window.location = '{{ route('admin.sliders.index') }}'"></i>
{{ __('admin::app.settings.sliders.edit-title') }}
@if ($slider->locale)
<span class="locale">[{{ $slider->locale }}]</span>
@endif
</h1>
</div>
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.settings.sliders.save-btn-title') }}
</button>
</div>
</div>
<div class="page-content">
<div class="form-container">
@csrf()
{!! view_render_event('bagisto.admin.settings.slider.edit.before') !!}
<div class="control-group multi-select" :class="[errors.has('locale[]') ? 'has-error' : '']">
<label for="locale">{{ __('admin::app.datagrid.locale') }}</label>
<select class="control" id="locale" name="locale[]" data-vv-as="&quot;{{ __('admin::app.datagrid.locale') }}&quot;" value="" v-validate="'required'" multiple>
@foreach (core()->getAllLocales() as $localeModel)
<option value="{{ $localeModel->code }}" {{ in_array($localeModel->code, explode(',', $slider->locale)) ? 'selected' : ''}}>
{{ $localeModel->name }}
</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('locale[]')">@{{ errors.first('locale[]') }}</span>
</div>
<div class="control-group" :class="[errors.has('title') ? 'has-error' : '']">
<label for="title" class="required">{{ __('admin::app.settings.sliders.name') }}</label>
<input type="text" class="control" name="title" v-validate="'required'" data-vv-as="&quot;{{ __('admin::app.settings.sliders.name') }}&quot;" value="{{ $slider->title ?: old('title') }}">
<span class="control-error" v-if="errors.has('title')">@{{ errors.first('title') }}</span>
</div>
<div class="control-group" :class="[errors.has('type') ? 'has-error' : '']">
<label for="type" class="required">{{ __('admin::app.catalog.categories.display-mode') }}</label>
<select class="control" v-validate="'required'" id="type" name="type" data-vv-as="&quot;Type&quot;">
<option value="slider" @if ('slider' == $slider->type) selected @endif>
Slider
</option>
<option value="banner" @if ("banner" == $slider->type) selected @endif>
Banner
</option>
</select>
<span class="control-error" v-if="errors.has('display_mode')">@{{ errors.first('display_mode') }}</span>
</div>
<?php $channels = core()->getAllChannels() ?>
<div class="control-group" :class="[errors.has('channel_id') ? 'has-error' : '']">
<label for="channel_id">{{ __('admin::app.settings.sliders.channels') }}</label>
<select class="control" id="channel_id" name="channel_id" data-vv-as="&quot;{{ __('admin::app.settings.sliders.channels') }}&quot;" value="" v-validate="'required'">
@foreach ($channels as $channel)
<option value="{{ $channel->id }}" @if ($channel->id == $slider->channel_id) selected @endif>
{{ __(core()->getChannelName($channel)) }}
</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('channel_id')">@{{ errors.first('channel_id') }}</span>
</div>
<div class="control-group date">
<label for="expired_at">{{ __('admin::app.settings.sliders.expired-at') }}</label>
<date>
<input type="text" name="expired_at" class="control" value="{{ old('expired_at') ?: $slider->expired_at }}"/>
</date>
</div>
<div class="control-group">
<label for="sort_order">{{ __('admin::app.settings.sliders.sort-order') }}</label>
<input type="text" class="control" id="sort_order" name="sort_order" value="{{ $slider->sort_order ?? old('sort_order') }}"/>
</div>
<div class="control-group {!! $errors->has('image.*') ? 'has-error' : '' !!}">
<label class="required">{{ __('admin::app.catalog.categories.image') }}</label>
<image-wrapper button-label="{{ __('admin::app.settings.sliders.image') }}" input-name="image" :multiple="false" :images='"{{ Storage::url($slider->path) }}"'></image-wrapper>
<span class="control-error" v-if="{!! $errors->has('image.*') !!}">
@foreach ($errors->get('image.*') as $key => $message)
@php echo str_replace($key, 'Image', $message[0]); @endphp
@endforeach
</span>
</div>
<div class="control-group {!! $errors->has('mobile_image.*') ? 'has-error' : '' !!}">
<label class="required">Mobile image</label>
<image-wrapper button-label="{{ __('admin::app.settings.sliders.image') }}" input-name="mobile_image" :multiple="false" :images='"{{ Storage::url($slider->mobile_path) }}"'></image-wrapper>
<span class="control-error" v-if="{!! $errors->has('mobile_image.*') !!}">
@foreach ($errors->get('mobile_image.*') as $key => $message)
@php echo str_replace($key, 'Image', $message[0]); @endphp
@endforeach
</span>
</div>
<div class="control-group">
<label for="content">{{ __('admin::app.settings.sliders.content') }}</label>
<div class="panel-body">
<textarea id="tiny" class="control" id="add_content" name="content" rows="5">{{ $slider->content ? : old('content') }}</textarea>
</div>
<span class="control-error" v-if="errors.has('content')">@{{ errors.first('content') }}</span>
</div>
{!! view_render_event('bagisto.admin.settings.slider.edit.after', ['slider' => $slider]) !!}
</div>
</div>
</form>
</div>
@endsection
@push('scripts')
@include('admin::layouts.tinymce')
<script>
$(document).ready(function () {
tinyMCEHelper.initTinyMCE({
selector: 'textarea#tiny',
height: 200,
width: "100%",
plugins: 'image imagetools media wordcount save fullscreen code table lists link hr',
toolbar1: 'formatselect | bold italic strikethrough forecolor backcolor link hr | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat | code | table',
image_advtab: true,
templates: [
{ title: 'Test template 1', content: 'Test 1' },
{ title: 'Test template 2', content: 'Test 2' }
],
});
});
</script>
@endpush

View File

@ -1,16 +1,4 @@
<div class="control-group {!! $errors->has('mobile_image.*') ? 'has-error' : '' !!}">
<label class="required">Mobile image</label>
<image-wrapper button-label="{{ __('admin::app.settings.sliders.image') }}" input-name="mobile_image" :multiple="false"
@if(isset($slider) && $slider->mobile_path)
:images='"{{ Storage::url($slider->mobile_path) }}"'>
@endif
</image-wrapper>
<span class="control-error" v-if="{!! $errors->has('mobile_image.*') !!}">
@foreach ($errors->get('mobile_image.*') as $key => $message)
@php echo str_replace($key, 'Image', $message[0]); @endphp
@endforeach
</span>
</div>
<div class="control-group">
<label>Mobile Link</label>

View File

@ -0,0 +1,8 @@
<?php
namespace TPS\Balance\Contracts;
interface Balance
{
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('sliders', function (Blueprint $table) {
$table->string('mobile_link')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropColumn('mobile_link');
}
};

View File

@ -1,6 +1,6 @@
<?php
namespace TPS\Shop\Models;
namespace TPS\Balance\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

View File

@ -0,0 +1,16 @@
<?php
namespace TPS\Balance\Providers;
use Illuminate\Support\ServiceProvider;
class BalanceServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot(){
$this->app->register(ModuleServiceProvider::class);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace TPS\Balance\Providers;
use Webkul\Core\Providers\CoreModuleServiceProvider;
class ModuleServiceProvider extends CoreModuleServiceProvider
{
protected $models = [
\TPS\Balance\Models\Balance::class
];
}

View File

@ -1,8 +1,8 @@
<?php
namespace TPS\Shop\Repositories;
namespace TPS\Balance\Repositories;
use TPS\Shop\Contracts\Balance;
use TPS\Balance\Contracts\Balance;
use Webkul\Core\Eloquent\Repository;
class BalanceRepository extends Repository

View File

@ -0,0 +1,30 @@
{
"name": "tps/balance",
"description": "Balance for TPS.",
"license": "MIT",
"authors": [
{
"name": "merdan muhammedow",
"email": "merdan.m@gmail.com"
}
],
"require": {},
"autoload": {
"psr-4": {
"TPS\\Balance\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"TPS\\Balance\\Providers\\BalanceServiceProvider"
],
"aliases": {}
}
},
"minimum-stability": "dev"
}

View File

@ -1,8 +0,0 @@
<?php
namespace TPS\Shop\Contracts;
interface Balance
{
}