added translator engine

improved ui/ux some pages (add btn)
WIP: website route to apply translate for vistor
pull/36/head
A1Gard 9 months ago
parent c01a88b731
commit c91c3710f9

@ -4,12 +4,22 @@ namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Requests\XlangSaveRequest; use App\Http\Requests\XlangSaveRequest;
use App\Models\Cat;
use App\Models\Product; use App\Models\Product;
use App\Models\Prop;
use App\Models\Setting;
use App\Models\Xlang; use App\Models\Xlang;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Artisan;
use Xmen\StarterKit\Models\Category;
use Xmen\StarterKit\Models\Clip;
use Xmen\StarterKit\Models\Gallery;
use Xmen\StarterKit\Models\Image;
use Xmen\StarterKit\Models\MenuItem;
use Xmen\StarterKit\Models\Post;
use Xmen\StarterKit\Models\Slider;
use function Xmen\StarterKit\Helpers\logAdmin; use function Xmen\StarterKit\Helpers\logAdmin;
use function Xmen\StarterKit\Helpers\logAdminBatch; use function Xmen\StarterKit\Helpers\logAdminBatch;
@ -17,6 +27,20 @@ const PREFIX_PATH = __DIR__ . '/../../../../';
class XlangController extends Controller class XlangController extends Controller
{ {
public $allowedModels = [
Product::class,
Cat::class,
Post::class,
Category::class,
Slider::class,
MenuItem::class,
Gallery::class,
Clip::class,
Prop::class,
Setting::class,
Image::class
];
public function createOrUpdate(Xlang $xlang, XlangSaveRequest $request) public function createOrUpdate(Xlang $xlang, XlangSaveRequest $request)
{ {
$xlang->name = $request->input('name'); $xlang->name = $request->input('name');
@ -24,8 +48,8 @@ class XlangController extends Controller
$xlang->rtl = $request->has('rtl'); $xlang->rtl = $request->has('rtl');
$xlang->is_default = $request->has('is_default'); $xlang->is_default = $request->has('is_default');
if ($xlang->is_default){ if ($xlang->is_default) {
Xlang::where('is_default','1')->update([ Xlang::where('is_default', '1')->update([
'is_default' => 0, 'is_default' => 0,
]); ]);
} }
@ -73,7 +97,7 @@ class XlangController extends Controller
public function store(XlangSaveRequest $request) public function store(XlangSaveRequest $request)
{ {
// //
if ($request->tag != 'en'){ if ($request->tag != 'en') {
define("TRANSLATE_CONFIG_PATH", PREFIX_PATH . 'config/translator.php'); define("TRANSLATE_CONFIG_PATH", PREFIX_PATH . 'config/translator.php');
define("TRANSLATE_NEW_FILE", PREFIX_PATH . 'resources/lang/' . $request->tag . '.json'); define("TRANSLATE_NEW_FILE", PREFIX_PATH . 'resources/lang/' . $request->tag . '.json');
@ -162,6 +186,7 @@ class XlangController extends Controller
define("TRANSLATE_FILE", PREFIX_PATH . 'resources/lang/' . $tag . '.json'); define("TRANSLATE_FILE", PREFIX_PATH . 'resources/lang/' . $tag . '.json');
return response()->download(TRANSLATE_FILE, $tag . '.json'); return response()->download(TRANSLATE_FILE, $tag . '.json');
} }
public function ai($tag) public function ai($tag)
{ {
@ -169,17 +194,17 @@ class XlangController extends Controller
define("TRANSLATE_FILE", PREFIX_PATH . 'resources/lang/' . $tag . '.json'); define("TRANSLATE_FILE", PREFIX_PATH . 'resources/lang/' . $tag . '.json');
$file = file_get_contents(TRANSLATE_FILE); $file = file_get_contents(TRANSLATE_FILE);
$url = 'http://5.255.98.77:3001/json?form=en&to='.$tag; $url = 'http://5.255.98.77:3001/json?form=en&to=' . $tag;
$client = new Client([ $client = new Client([
'headers' => [ 'Content-Type' => 'application/json' ] 'headers' => ['Content-Type' => 'application/json']
]); ]);
$response = $client->post($url, $response = $client->post($url,
['body' => $file] ['body' => $file]
); );
file_put_contents(TRANSLATE_FILE,$response->getBody()); file_put_contents(TRANSLATE_FILE, $response->getBody()->getContents());
return redirect()->back()->with(['message' => __("Translated by ai xstack service:").' '.$tag]); return redirect()->back()->with(['message' => __("Translated by ai xstack service:") . ' ' . $tag]);
} }
public function upload($tag, Request $request) public function upload($tag, Request $request)
@ -208,6 +233,73 @@ class XlangController extends Controller
default: default:
$msg = __('Unknown bulk action :' . $request->input('bulk')); $msg = __('Unknown bulk action :' . $request->input('bulk'));
} }
return redirect()->route('admin.customer.index')->with(['message' => $msg]); return redirect()->route('admin.lang.index')->with(['message' => $msg]);
}
public function translateModel($id, $model)
{
if (!in_array($model, $this->allowedModels)) {
return abort(404);
}
$langs = Xlang::where('is_default', 0)->get();
$cls = $model;
$model = ($model)::where('id', $id)->firstOrFail();
// return $model;
$translates = $model->translatable;
return view('admin.langs.translate', compact('model', 'translates', 'langs', 'cls'));
}
public function translateModelSave($id, $model, Request $request)
{
if (!in_array($model, $this->allowedModels)) {
return abort(404);
}
$langs = Xlang::where('is_default', 0)->get();
$model = ($model)::where('id', $id)->firstOrFail();
// $model = Product::whereId('id',$id)->first();
foreach ($request->input('data') as $lang => $items) {
foreach ($items as $k => $item) {
if ($item != null) {
$model->setTranslation($k, $lang, $item);
}
}
}
$model->save();
return redirect()->back()->with(['message' => __('Translate updated')]);
}
public function translateModelAi($id, $model, $tag, $field)
{
if (!in_array($model, $this->allowedModels)) {
return abort(404);
}
$langs = Xlang::where('is_default', 0)->get();
$model = ($model)::where('id', $id)->firstOrFail();
// $model = Product::whereId('id',$id)->first();
$url = 'http://5.255.98.77:3001/text?form=' . config('app.xlang_main') . '&to=' . $tag;
$client = new Client([
'headers' => ['Content-Type' => 'application/x-www-form-urlencoded']
]);
$response = $client->post($url,
['form_params' => ['body' => $model->$field]],
);
// file_put_contents(TRANSLATE_FILE, $response->getBody());
if ($response->getStatusCode() != 200) {
return redirect()->back()->withErrors(__("API error!"));
}
// dd($response->getBody()->getContents());
$model->setTranslation($field, $tag, $response->getBody()->getContents());
$model->save();
return redirect()->back()->with(['message' => __('Translate updated')]);
} }
} }

@ -34,7 +34,7 @@
"psr/log": "v2.*", "psr/log": "v2.*",
"symfony/dom-crawler": "^6.2", "symfony/dom-crawler": "^6.2",
"symfony/psr-http-message-bridge": "^7.0", "symfony/psr-http-message-bridge": "^7.0",
"xmen/starter-kit": "^v3.1.0" "xmen/starter-kit": "^v3.2.5"
}, },
"require-dev": { "require-dev": {
"barryvdh/laravel-ide-helper": "^2.12", "barryvdh/laravel-ide-helper": "^2.12",

14
composer.lock generated

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "476fc03eaacbf9c04610c95da580105c", "content-hash": "38e039d93317f0accb46bc58aa69b9e1",
"packages": [ "packages": [
{ {
"name": "artesaos/seotools", "name": "artesaos/seotools",
@ -8421,16 +8421,16 @@
}, },
{ {
"name": "xmen/starter-kit", "name": "xmen/starter-kit",
"version": "v3.2.2", "version": "v3.2.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/4xmen/starterkit-for-laravel.git", "url": "https://github.com/4xmen/starterkit-for-laravel.git",
"reference": "e06fae15e94831babebb1ab3ba4c7f5c57f85a5e" "reference": "207cafd1abb67f9a0768223f32490e69d1be8a8d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/4xmen/starterkit-for-laravel/zipball/e06fae15e94831babebb1ab3ba4c7f5c57f85a5e", "url": "https://api.github.com/repos/4xmen/starterkit-for-laravel/zipball/207cafd1abb67f9a0768223f32490e69d1be8a8d",
"reference": "e06fae15e94831babebb1ab3ba4c7f5c57f85a5e", "reference": "207cafd1abb67f9a0768223f32490e69d1be8a8d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -8489,9 +8489,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/4xmen/starterkit-for-laravel/issues", "issues": "https://github.com/4xmen/starterkit-for-laravel/issues",
"source": "https://github.com/4xmen/starterkit-for-laravel/tree/v3.2.2" "source": "https://github.com/4xmen/starterkit-for-laravel/tree/v3.2.5"
}, },
"time": "2024-02-04T12:31:22+00:00" "time": "2024-02-04T23:17:48+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [

@ -4,7 +4,7 @@ use Translator\Framework\LaravelConfigLoader;
use Translator\Infra\LaravelJsonTranslationRepository; use Translator\Infra\LaravelJsonTranslationRepository;
return [ return [
'languages' => ["fa","ru","ar"], 'languages' => ["fa","ru","ar","fr"],
'directories' => [ 'directories' => [
app_path(), app_path(),
resource_path('views'), resource_path('views'),

@ -0,0 +1,52 @@
<?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('posts', function ($table) {
$table->text('title')->change();
});
Schema::table('categories', function ($table) {
$table->text('name')->change();
});
Schema::table('cats', function ($table) {
$table->text('name')->change();
});
Schema::table('products', function ($table) {
$table->text('name')->change();
});
Schema::table('props', function ($table) {
$table->text('label')->change();
});
Schema::table('galleries', function ($table) {
$table->text('title')->change();
});
Schema::table('menu_items', function ($table) {
$table->text('title')->change();
});
Schema::table('images', function ($table) {
$table->text('title')->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
};

@ -3734,6 +3734,63 @@ nav a {
color: rgba(255, 255, 255, 0.3333333333); color: rgba(255, 255, 255, 0.3333333333);
} }
.lang-support {
background: dodgerblue;
color: white;
padding: 7px;
text-align: center;
font-weight: 300;
margin-top: 1rem;
}
.btn-ai {
height: 65px;
width: 65px;
background: dodgerblue;
font-size: 25px;
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: auto;
transition: 400ms;
cursor: pointer;
box-shadow: inset 0 0 0 0 rgba(0, 0, 0, 0.1333333333);
}
.btn-ai:hover {
box-shadow: inset 0 0 0 75px rgba(0, 0, 0, 0.1333333333);
}
.btn-add {
height: 50px;
width: 50px;
background: #333;
font-size: 25px;
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
transition: 400ms;
cursor: pointer;
box-shadow: inset 0 0 0 0 rgba(255, 255, 255, 0.1333333333);
position: fixed;
left: 1rem;
bottom: 1rem;
text-decoration: none;
}
.btn-add:hover {
box-shadow: inset 0 0 0 75px rgba(0, 0, 0, 0.1333333333);
}
.img-squire {
width: 100%;
height: 175px;
-o-object-fit: cover;
object-fit: cover;
}
/*-768px width*/ /*-768px width*/
@media (max-width: 1000px) { @media (max-width: 1000px) {
.gird4 { .gird4 {
@ -3800,3 +3857,7 @@ nav a {
right: auto !important; right: auto !important;
left: 2rem !important; left: 2rem !important;
} }
.no-dec a {
text-decoration: none;
}

@ -26,7 +26,9 @@
":app Dear customer Your :product signed for you.": ":app\nکاربر گرامی محصول «:product» برای شما ثبت شد.", ":app Dear customer Your :product signed for you.": ":app\nکاربر گرامی محصول «:product» برای شما ثبت شد.",
"A fresh verification link has been sent to your email address.": "یک لینک تاییده برای شما ایمیل شد", "A fresh verification link has been sent to your email address.": "یک لینک تاییده برای شما ایمیل شد",
"ACL": "سطح دسترسی", "ACL": "سطح دسترسی",
"AI translate form original source": "",
"ANSWERED": "پاسخ‌ داده شده", "ANSWERED": "پاسخ‌ داده شده",
"API error!": "",
"Action": "عملیات", "Action": "عملیات",
"Actions": "عملیات", "Actions": "عملیات",
"Active": "فعال", "Active": "فعال",
@ -276,6 +278,7 @@
"Magazine": "مجله", "Magazine": "مجله",
"Main address": "آدرس اصلی", "Main address": "آدرس اصلی",
"Main category": "سرفصل اصلی", "Main category": "سرفصل اصلی",
"Main language content": "",
"Main product category": "دسته اصلی محصول", "Main product category": "دسته اصلی محصول",
"Manage": "مدیریت", "Manage": "مدیریت",
"Max click": "حداکثر تعداد کلیک", "Max click": "حداکثر تعداد کلیک",
@ -510,6 +513,7 @@
"Total amount": "مقدار کل", "Total amount": "مقدار کل",
"Tracking code": "کد رهگیری", "Tracking code": "کد رهگیری",
"Translate": "ترجمان", "Translate": "ترجمان",
"Translate model": "",
"Translate updated": "ترجمه به روز شد", "Translate updated": "ترجمه به روز شد",
"Translate with AI": "ترجمه با کمک هوش مصنوعی", "Translate with AI": "ترجمه با کمک هوش مصنوعی",
"Translated by ai xstack service:": "", "Translated by ai xstack service:": "",
@ -536,6 +540,7 @@
"Username": "نام کاربری", "Username": "نام کاربری",
"Users": "کاربران", "Users": "کاربران",
"Users list": "فهرست کاربران", "Users list": "فهرست کاربران",
"Value": "",
"Verify Your Email Address": "تایید رایانامه یا ایمیل خود", "Verify Your Email Address": "تایید رایانامه یا ایمیل خود",
"Video clip": "ویدئو کلیپ", "Video clip": "ویدئو کلیپ",
"Video clips": "کلیپ ها", "Video clips": "کلیپ ها",

@ -6,6 +6,8 @@
"$log->action": "$log->действие", "$log->action": "$log->действие",
":app Dear customer Your :product signed for you.": ":app Уважаемый клиент, ваш :product подписан для вас.", ":app Dear customer Your :product signed for you.": ":app Уважаемый клиент, ваш :product подписан для вас.",
"A fresh verification link has been sent to your email address.": "На ваш адрес электронной почты была отправлена новая ссылка для подтверждения.", "A fresh verification link has been sent to your email address.": "На ваш адрес электронной почты была отправлена новая ссылка для подтверждения.",
"AI translate form original source": "",
"API error!": "",
"Action": "Действие", "Action": "Действие",
"Actions": "Действия", "Actions": "Действия",
"Active": "Активный", "Active": "Активный",
@ -69,6 +71,7 @@
"City": "Город", "City": "Город",
"Click": "Нажмите", "Click": "Нажмите",
"Click here to upload or drag and drop here": "Нажмите здесь для загрузки или перетащите сюда", "Click here to upload or drag and drop here": "Нажмите здесь для загрузки или перетащите сюда",
"Clip": "",
"Clip list": "Список клипов", "Clip list": "Список клипов",
"Clips": "Клипы", "Clips": "Клипы",
"Code": "Код", "Code": "Код",
@ -211,6 +214,7 @@
"Magazine": "«Журнал»", "Magazine": "«Журнал»",
"Main address": "«Основной адрес»", "Main address": "«Основной адрес»",
"Main category": "Главная категория", "Main category": "Главная категория",
"Main language content": "",
"Main product category": "«Основная категория товаров»", "Main product category": "«Основная категория товаров»",
"Manage": "Управлять", "Manage": "Управлять",
"Max click": "«Макс клик»", "Max click": "«Макс клик»",
@ -319,6 +323,7 @@
"Properties list": "«Список свойств»", "Properties list": "«Список свойств»",
"Properties meta": "«Мета свойства»", "Properties meta": "«Мета свойства»",
"Properties sort": "«Сортировка свойств»", "Properties sort": "«Сортировка свойств»",
"Props": "",
"Publish now": "«Опубликовать сейчас»", "Publish now": "«Опубликовать сейчас»",
"Published": "Опубликовано", "Published": "Опубликовано",
"Quantity": "Количество", "Quantity": "Количество",
@ -404,6 +409,7 @@
"Total Price": "Итоговая цена", "Total Price": "Итоговая цена",
"Total amount": "Общая сумма", "Total amount": "Общая сумма",
"Tracking code": "Код отслеживания", "Tracking code": "Код отслеживания",
"Translate model": "",
"Translate updated": "", "Translate updated": "",
"Translate with AI": "", "Translate with AI": "",
"Translated by ai xstack service:": "", "Translated by ai xstack service:": "",
@ -429,6 +435,7 @@
"Username": "Имя пользователя", "Username": "Имя пользователя",
"Users": "«Пользователи»", "Users": "«Пользователи»",
"Users list": "«Список пользователей»", "Users list": "«Список пользователей»",
"Value": "",
"Verify Your Email Address": "Проверьте свой адрес электронной почты", "Verify Your Email Address": "Проверьте свой адрес электронной почты",
"Video clip": "Видеоклип", "Video clip": "Видеоклип",
"Video clips": "Видеоклипы", "Video clips": "Видеоклипы",

@ -183,6 +183,63 @@ nav {
color: #ffffff55; color: #ffffff55;
} }
.lang-support{
background: dodgerblue;
color: white;
padding: 7px;
text-align: center;
font-weight: 300;
margin-top: 1rem;
}
.btn-ai{
height: 65px;
width: 65px;
background: dodgerblue;
font-size: 25px;
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: auto;
transition: 400ms;
cursor: pointer;
box-shadow: inset 0 0 0 0 #00000022;
&:hover{
box-shadow: inset 0 0 0 75px #00000022;
}
}
.btn-add{
height: 50px;
width: 50px;
background: #333;
font-size: 25px;
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
transition: 400ms;
cursor: pointer;
box-shadow: inset 0 0 0 0 #ffffff22;
position: fixed;
left: 1rem;
bottom: 1rem;
text-decoration: none;
&:hover{
box-shadow: inset 0 0 0 75px #00000022;
}
}
.img-squire{
width: 100%;
height: 175px;
object-fit: cover;
}
/*-768px width*/ /*-768px width*/
@media ( max-width: 1000px ) { @media ( max-width: 1000px ) {
.gird4 { .gird4 {
@ -250,3 +307,9 @@ nav {
right: auto !important; right: auto !important;
left: 2rem !important; left: 2rem !important;
} }
.no-dec{
a{
text-decoration: none;
}
}

@ -26,8 +26,6 @@
</th> </th>
<th> <th>
{{__("Action")}} {{__("Action")}}
<a href="{{route('admin.cat.create')}}" class="btn btn-success float-start"><i
class="fa fa-plus"></i></a>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -49,14 +47,18 @@
</td> </td>
<td> <td>
<a href="{{route('admin.cat.edit',$cat->slug)}}" class="btn btn-primary"> <a href="{{route('admin.cat.edit',$cat->slug)}}" class="btn btn-primary">
<i class="fa fa-edit"></i> &nbsp; <i class="ri-edit-2-line"></i>
{{__("Edit")}}
</a> </a>
<a href="{{route('admin.cat.delete',$cat->slug)}}" <a href="{{route('admin.cat.delete',$cat->slug)}}"
class="btn btn-danger delete-confirm"> class="btn btn-danger delete-confirm">
<i class="fa fa-times"></i> &nbsp; <i class="ri-close-line"></i>
{{__("Delete")}}
</a> </a>
@if(config('app.xlang'))
<a href="{{route('admin.lang.model',[$cat->id,\App\Models\Cat::class])}}"
class="btn btn-outline-dark translat-btn">
<i class="ri-translate"></i>
</a>
@endif
</td> </td>
</tr> </tr>
@endforeach @endforeach
@ -67,5 +69,8 @@
<div class="text-center pt-3"> <div class="text-center pt-3">
{{$cats->links()}} {{$cats->links()}}
</div> </div>
<a class="btn-add" href="{{route('admin.cat.create')}}">
<i class="ri-add-line"></i>
</a>
</div> </div>
@endsection @endsection

@ -27,8 +27,7 @@
</th> </th>
<th> <th>
{{__("Action")}} {{__("Action")}}
<a href="{{route('admin.lang.create')}}" class="btn btn-success btn-sm float-end"><i
class="fa fa-plus"></i></a>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -56,13 +55,11 @@
</td> </td>
<td> <td>
<a href="{{route('admin.lang.edit',$n->id)}}" class="btn btn-primary btn-sm"> <a href="{{route('admin.lang.edit',$n->id)}}" class="btn btn-primary btn-sm">
<i class="fa fa-edit"></i> &nbsp; <i class="ri-edit-2-line"></i>
{{__("Edit")}}
</a> </a>
<a href="{{route('admin.lang.delete',$n->id)}}" <a href="{{route('admin.lang.delete',$n->id)}}"
class="btn btn-danger delete-confirm btn-sm"> class="btn btn-danger delete-confirm btn-sm">
<i class="fa fa-times"></i> &nbsp; <i class="ri-close-line"></i>
{{__("Delete")}}
</a> </a>
</td> </td>
</tr> </tr>
@ -74,5 +71,8 @@
<div class="text-center pt-3"> <div class="text-center pt-3">
{{$langs->links()}} {{$langs->links()}}
</div> </div>
<a class="btn-add" href="{{route('admin.lang.create')}}">
<i class="ri-add-line"></i>
</a>
</div> </div>
@endsection @endsection

@ -0,0 +1,82 @@
@extends('admin.adminlayout')
@section('page_title')
{{__("Translate model")}}: {{($model->{$translates[0]})}}
-
@endsection
@section('content')
<div class="container">
@include('starter-kit::component.err')
<h3>
{{__("Translate model")}}: {{($model->{$translates[0]})}}
</h3>
<h4 class="lang-support">
{{__("Main language content")}}:({{config('app.xlang_main')}})
</h4>
<table class="table table-bordered">
<tr>
<th>
{{__("Title")}}
</th>
<th>
{{__("Value")}}
</th>
</tr>
@foreach($translates as $tr)
<tr>
<th>
{{$tr}}
</th>
<th>
{{($model->{$tr})}}
</th>
</tr>
@endforeach
</table>
<form action="{{route( 'admin.lang.modelSave',[$model->id,$cls])}}" method="post">
@csrf
@foreach($langs as $lang)
<h4 class="lang-support">
{{__("Translate model")}}: {{$lang->name}} ({{$lang->tag}})
</h4>
@foreach($translates as $tr)
<div class="form-group mt-2">
<label for="{{$lang->tag}}{{$tr}}">
{{$tr}}:
</label>
<div class="row">
<div class="col-md-10">
@if( $tr == 'body' || $tr == 'desc' || $tr == 'description' || $tr == 'excerpt' )
<textarea
class="form-control @if($tr == 'body' || $tr == 'desc' || $tr == 'description' ) ckeditorx @endif"
rows="4" id="{{$lang->tag}}{{$tr}}"
name="data[{{$lang->tag}}][{{$tr}}]">{{gettype($model->getTranslation($tr,$lang->tag)) == 'string' ? $model->getTranslation($tr,$lang->tag):'' }}</textarea>
@else
<input type="text" id="{{$lang->tag}}{{$tr}}" name="data[{{$lang->tag}}][{{$tr}}]"
value="{{gettype($model->getTranslation($tr,$lang->tag)) == 'string' ? $model->getTranslation($tr,$lang->tag):'' }}"
placeholder="" class="form-control">
@endif
</div>
<div class="col-md-2 d-flex align-items-center">
<a href="{{route('admin.lang.aiText',[$model->id,$cls,$lang->tag,$tr])}}" class="btn-ai" title="{{__("AI translate form original source")}}">
<i class="ri-translate"></i>
</a>
</div>
</div>
</div>
@endforeach
@endforeach
<button class="btn btn-outline-dark w-100 my-3">
{{__("Save")}}
</button>
</form>
</div>
@endsection

@ -54,7 +54,7 @@
<div class="row"> <div class="row">
@foreach($langs as $lang) @foreach($langs as $lang)
<div class="col-md-4"> <div class="col-md-4 mb-4">
<div class="lang-item"> <div class="lang-item">
<h5> <h5>
{{$lang->name}} {{$lang->name}}

@ -51,8 +51,6 @@
</th> </th>
<th> <th>
{{__("Action")}} {{__("Action")}}
<a href="{{route('admin.product.create')}}" class="btn btn-success float-end"><i
class="fa fa-plus"></i></a>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -78,15 +76,19 @@
</td> </td>
<td> <td>
<a href="{{route('admin.product.edit',$n->slug)}}" class="btn btn-primary"> <a href="{{route('admin.product.edit',$n->slug)}}" class="btn btn-primary">
<i class="fa fa-edit"></i> &nbsp; <i class="ri-edit-2-line"></i>
{{__("Edit")}}
</a> </a>
@if($n->deleted_at == null) @if($n->deleted_at == null)
<a href="{{route('admin.product.delete',$n->slug)}}" <a href="{{route('admin.product.delete',$n->slug)}}"
class="btn btn-danger delete-confirm"> class="btn btn-danger delete-confirm">
<i class="fa fa-times"></i> &nbsp; <i class="ri-close-line"></i>
{{__("Delete")}}
</a> </a>
@if(config('app.xlang'))
<a href="{{route('admin.lang.model',[$n->id,\App\Models\Product::class])}}"
class="btn btn-outline-dark translat-btn">
<i class="ri-translate"></i>
</a>
@endif
@else @else
<a href="{{route('admin.product.restore',$n->slug)}}" <a href="{{route('admin.product.restore',$n->slug)}}"
class="btn btn-success"> class="btn btn-success">
@ -105,5 +107,8 @@
<div class="text-center pt-3"> <div class="text-center pt-3">
{{$products->links()}} {{$products->links()}}
</div> </div>
<a class="btn-add" href="{{route('admin.post.create')}}">
<i class="ri-add-line"></i>
</a>
</div> </div>
@endsection @endsection

@ -2,10 +2,8 @@
@section('content') @section('content')
<div class="container"> <div class="container">
<h5 class="text-center"> {{__("Properties list")}} <h5 class="text-center">
<a class="btn btn-primary float-start" href="{{route('admin.props.create')}}"> {{__("Properties list")}}
<i class="fa fa-plus"></i>
</a>
</h5> </h5>
<div class="table-responsive"> <div class="table-responsive">
@ -33,7 +31,7 @@
<td> <td>
{{$p->type}} {{$p->type}}
</td> </td>
<td> <td class="no-dec">
@if(isset($p->category)) @if(isset($p->category))
@foreach($p->category as $c) @foreach($p->category as $c)
<a href="{{route('admin.props.sort',$c->id)}}"> <a href="{{route('admin.props.sort',$c->id)}}">
@ -49,14 +47,20 @@
<a title="Edit" <a title="Edit"
class="btn btn-secondary ad-accept-btn" class="btn btn-secondary ad-accept-btn"
href="{{route('admin.props.edit',$p->id)}}"> href="{{route('admin.props.edit',$p->id)}}">
<i class="fa fa-edit"></i> <i class="ri-edit-2-line"></i>
</a> </a>
&nbsp; &nbsp;
<a title="Dlete" <a title="Dlete"
class="btn btn-danger cdelete" class="btn btn-danger cdelete"
href="{{route('admin.props.delete',$p->id)}}"> href="{{route('admin.props.delete',$p->id)}}">
<i class="fa fa-times"></i> <i class="ri-close-line"></i>
</a> </a>
@if(config('app.xlang'))
<a href="{{route('admin.lang.model',[$p->id,\App\Models\Prop::class])}}"
class="btn btn-outline-dark translat-btn mx-1">
<i class="ri-translate"></i>
</a>
@endif
</div> </div>
</td> </td>
</tr> </tr>
@ -68,4 +72,9 @@
</div> </div>
</div> </div>
</div> </div>
<a class="btn-add" href="{{route('admin.props.create')}}">
<i class="ri-add-line"></i>
</a>
@endsection @endsection

@ -23,8 +23,6 @@
</th> </th>
<th> <th>
{{__("Action")}} {{__("Action")}}
<a href="{{route('admin.category.create')}}" class="btn btn-success float-start"><i
class="fa fa-plus"></i></a>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -43,14 +41,18 @@
</td> </td>
<td> <td>
<a href="{{route('admin.category.edit',$cat->slug)}}" class="btn btn-primary"> <a href="{{route('admin.category.edit',$cat->slug)}}" class="btn btn-primary">
<i class="fa fa-edit"></i> &nbsp; <i class="ri-edit-2-line"></i>
{{__("Edit")}}
</a> </a>
<a href="{{route('admin.category.delete',$cat->slug)}}" <a href="{{route('admin.category.delete',$cat->slug)}}"
class="btn btn-danger delete-confirm"> class="btn btn-danger delete-confirm">
<i class="fa fa-times"></i> &nbsp; <i class="ri-close-line"></i>
{{__("Delete")}}
</a> </a>
@if(config('app.xlang'))
<a href="{{route('admin.lang.model',[$cat->id,\Xmen\StarterKit\Models\Category::class])}}"
class="btn btn-outline-dark translat-btn">
<i class="ri-translate"></i>
</a>
@endif
</td> </td>
</tr> </tr>
@endforeach @endforeach
@ -62,4 +64,8 @@
{{$cats->links()}} {{$cats->links()}}
</div> </div>
</div> </div>
<a class="btn-add" href="{{route('admin.category.create')}}">
<i class="ri-add-line"></i>
</a>
@endsection @endsection

@ -46,8 +46,6 @@
</th> </th>
<th> <th>
{{__("Action")}} {{__("Action")}}
<a href="{{route('admin.clip.create')}}" class="btn btn-success float-start"><i
class="fa fa-plus"></i></a>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -69,11 +67,17 @@
</td> </td>
<td> <td>
<a href="{{route('admin.clip.edit',$pl->slug)}}" class="btn btn-secondary"> <a href="{{route('admin.clip.edit',$pl->slug)}}" class="btn btn-secondary">
{{__("Edit")}} <i class="ri-edit-2-line"></i>
</a> </a>
<a href="{{route('admin.clip.delete',$pl->slug)}}" class="btn btn-danger del-conf"> <a href="{{route('admin.clip.delete',$pl->slug)}}" class="btn btn-danger del-conf">
{{__("Delete")}} <i class="ri-close-line"></i>
</a> </a>
@if(config('app.xlang'))
<a href="{{route('admin.lang.model',[$n->id,\Xmen\StarterKit\Models\Clip::class])}}"
class="btn btn-outline-dark translat-btn">
<i class="ri-translate"></i>
</a>
@endif
</td> </td>
</tr> </tr>
@endforeach @endforeach
@ -83,5 +87,9 @@
</form> </form>
<br> <br>
{{$clips->links()}} {{$clips->links()}}
<a class="btn-add" href="{{route('admin.clip.create')}}">
<i class="ri-add-line"></i>
</a>
</div> </div>
@endsection @endsection

@ -97,17 +97,30 @@
<div class="card-body"> <div class="card-body">
<form action="{{route('admin.gallery.updatetitle',$gallery->slug)}}" method="post"> <form action="{{route('admin.gallery.updatetitle',$gallery->slug)}}" method="post">
@csrf @csrf
<div class="row">
@foreach($gallery->images as $img) @foreach($gallery->images as $img)
<div class="img-preview"> <div class="col-md-3">
<a href="{{route('admin.image.delete',$img->id)}}" class="del-conf"> <a href="{{route('admin.image.delete',$img->id)}}" class="del-conf">
<i class="fa fa-times"></i> <i class="fa fa-times"></i>
</a> </a>
<img src="{{$img->imgUrl()}}" alt=""> <img src="{{$img->imgUrl()}}" class="img-squire" alt="">
<h4> <div class="row">
<div class="col-md-9">
<input type="text" class="form-control" name="titles[{{$img->id}}]" value="{{$img->title}}"/> <input type="text" class="form-control" name="titles[{{$img->id}}]" value="{{$img->title}}"/>
</h4> </div>
<div class="col-md-3">
@if(config('app.xlang'))
<a href="{{route('admin.lang.model',[$img->id,\Xmen\StarterKit\Models\Image::class])}}"
class="btn btn-outline-dark translat-btn">
<i class="ri-translate"></i>
</a>
@endif
</div>
</div>
</div> </div>
@endforeach @endforeach
</div>
<br> <br>
<input type="submit" class="btn btn-primary" value="{{__("Save")}}"/> <input type="submit" class="btn btn-primary" value="{{__("Save")}}"/>
</form> </form>

@ -40,8 +40,6 @@
</th> </th>
<th> <th>
{{__("Action")}} {{__("Action")}}
<a href="{{route('admin.gallery.create')}}" class="btn btn-success float-start"><i
class="fa fa-plus"></i></a>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -65,14 +63,18 @@
</td> </td>
<td> <td>
<a href="{{route('admin.gallery.edit',$n->slug)}}" class="btn btn-primary"> <a href="{{route('admin.gallery.edit',$n->slug)}}" class="btn btn-primary">
<i class="fa fa-edit"></i> &nbsp; <i class="ri-edit-2-line"></i>
{{__("Edit")}}
</a> </a>
<a href="{{route('admin.gallery.delete',$n->slug)}}" <a href="{{route('admin.gallery.delete',$n->slug)}}"
class="btn btn-danger delete-confirm"> class="btn btn-danger delete-confirm">
<i class="fa fa-times"></i> &nbsp; <i class="ri-close-line"></i>
{{__("Delete")}}
</a> </a>
@if(config('app.xlang'))
<a href="{{route('admin.lang.model',[$n->id,\Xmen\StarterKit\Models\Gallery::class])}}"
class="btn btn-outline-dark translat-btn">
<i class="ri-translate"></i>
</a>
@endif
</td> </td>
</tr> </tr>
@endforeach @endforeach
@ -83,5 +85,8 @@
<div class="text-center pt-3"> <div class="text-center pt-3">
{{$galleries->links()}} {{$galleries->links()}}
</div> </div>
<a class="btn-add" href="{{route('admin.gallery.create')}}">
<i class="ri-add-line"></i>
</a>
</div> </div>
@endsection @endsection

@ -40,8 +40,6 @@
</th> </th>
<th> <th>
{{__("Action")}} {{__("Action")}}
<a href="{{route('admin.post.create')}}" class="btn btn-success float-start"><i
class="fa fa-plus"></i></a>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -65,14 +63,18 @@
</td> </td>
<td> <td>
<a href="{{route('admin.post.edit',$n->slug)}}" class="btn btn-primary"> <a href="{{route('admin.post.edit',$n->slug)}}" class="btn btn-primary">
<i class="fa fa-edit"></i> &nbsp; <i class="ri-edit-2-line"></i>
{{__("Edit")}}
</a> </a>
<a href="{{route('admin.post.delete',$n->slug)}}" <a href="{{route('admin.post.delete',$n->slug)}}"
class="btn btn-danger delete-confirm"> class="btn btn-danger delete-confirm">
<i class="fa fa-times"></i> &nbsp; <i class="ri-close-line"></i>
{{__("Delete")}}
</a> </a>
@if(config('app.xlang'))
<a href="{{route('admin.lang.model',[$n->id,\Xmen\StarterKit\Models\Post::class])}}"
class="btn btn-outline-dark translat-btn">
<i class="ri-translate"></i>
</a>
@endif
</td> </td>
</tr> </tr>
@endforeach @endforeach
@ -83,5 +85,8 @@
<div class="text-center pt-3"> <div class="text-center pt-3">
{{$posts->links()}} {{$posts->links()}}
</div> </div>
<a class="btn-add" href="{{route('admin.post.create')}}">
<i class="ri-add-line"></i>
</a>
</div> </div>
@endsection @endsection

@ -8,9 +8,6 @@
<div class="container"> <div class="container">
<h1> <h1>
{{__("Slider list")}} {{__("Slider list")}}
<a href="{{route('admin.slider.create')}}" class="btn btn-success float-start">
{{__("New Slider")}}
</a>
</h1> </h1>
@include('starter-kit::component.err') @include('starter-kit::component.err')
<div class="alert alert-dark"> <div class="alert alert-dark">
@ -44,8 +41,6 @@
</th> </th>
<th> <th>
{{__("Action")}} {{__("Action")}}
<a href="{{route('admin.slider.create')}}" class="btn btn-success float-start"><i
class="fa fa-plus"></i></a>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -64,11 +59,17 @@
</td> </td>
<td> <td>
<a href="{{route('admin.slider.edit',$pl->id)}}" class="btn btn-secondary"> <a href="{{route('admin.slider.edit',$pl->id)}}" class="btn btn-secondary">
{{__("Edit")}} <i class="ri-edit-2-line"></i>
</a> </a>
<a href="{{route('admin.slider.delete',$pl->id)}}" class="btn btn-danger del-conf"> <a href="{{route('admin.slider.delete',$pl->id)}}" class="btn btn-danger del-conf">
{{__("Delete")}} <i class="ri-close-line"></i>
</a>
@if(config('app.xlang'))
<a href="{{route('admin.lang.model',[$pl->id,\Xmen\StarterKit\Models\Slider::class])}}"
class="btn btn-outline-dark translat-btn">
<i class="ri-translate"></i>
</a> </a>
@endif
</td> </td>
</tr> </tr>
@endforeach @endforeach
@ -78,5 +79,8 @@
</form> </form>
<br> <br>
{{$sliders->links()}} {{$sliders->links()}}
<a class="btn-add" href="{{route('admin.cat.create')}}">
<i class="ri-add-line"></i>
</a>
</div> </div>
@endsection @endsection

@ -43,6 +43,9 @@ Route::prefix(config('starter-kit.uri'))->name('admin.')->group(
Route::get('/download/{tag}', [\App\Http\Controllers\Admin\XlangController::class,'download'])->name('download'); Route::get('/download/{tag}', [\App\Http\Controllers\Admin\XlangController::class,'download'])->name('download');
Route::get('/ai/{tag}', [\App\Http\Controllers\Admin\XlangController::class,'ai'])->name('ai'); Route::get('/ai/{tag}', [\App\Http\Controllers\Admin\XlangController::class,'ai'])->name('ai');
Route::post('/upload/{tag}', [\App\Http\Controllers\Admin\XlangController::class,'upload'])->name('upload'); Route::post('/upload/{tag}', [\App\Http\Controllers\Admin\XlangController::class,'upload'])->name('upload');
Route::get('/model/translate/{id}/{model}', [\App\Http\Controllers\Admin\XlangController::class,'translateModel'])->name('model');
Route::post('/model/translate/save/{id}/{model}', [\App\Http\Controllers\Admin\XlangController::class,'translateModelSave'])->name('modelSave');
Route::get('/model/ai/{id}/{model}/{field}/{lang}', [\App\Http\Controllers\Admin\XlangController::class,'translateModelAi'])->name('aiText');
}); });

Loading…
Cancel
Save