change icons, css, add routing to merchandise, add mail templater, fixes

This commit is contained in:
Ludovic CANDELLIER
2023-02-12 23:34:48 +01:00
parent 8313e25f2e
commit f2f4788ce1
71 changed files with 1486 additions and 154 deletions

View File

@@ -283,7 +283,7 @@ module.exports = function(grunt) {
expand: true,
cwd: 'build/img',
src: ['**'],
dest: 'public/assets/img/'
dest: 'public/img/'
},
{
expand: true,

View File

@@ -0,0 +1,53 @@
<?php
namespace App\Datatables\Admin\Core\Mail;
use App\Datatables\ParentDataTable as DataTable;
use App\Models\Core\Mail\MailLog;
use App\Repositories\Core\Mail\MailParser;
use Yajra\DataTables\Html\Column;
class MailLogsDataTable extends DataTable
{
public $model_name = 'mail_logs';
public $sortedColumn = 0;
public $sortedOrder = 'desc';
public $stateSave = true;
public function query(MailLog $model)
{
return $this->buildQuery($model);
}
public function modifier($datatables)
{
$datatables
->editColumn('sent_to', function (MailLog $log) {
return MailParser::getToEmail($log->event);
})
->editColumn('subject', function (MailLog $log) {
return MailParser::getSubject($log->event);
})
->rawColumns(['action']);
return parent::modifier($datatables);
}
public function getHtmlButtons()
{
return self::getButtonShow();
}
protected function getColumns()
{
return [
Column::make('created_at')->title(__('sent')),
Column::make('sent_to')->title(__('user')),
Column::make('subject')->title(__('subject')),
$this->makeColumnButtons()->width('60'),
];
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace App\Datatables\Admin\Core\Mail;
use App\Datatables\ParentDataTable as DataTable;
use App\Models\Core\Mail\MailTemplate;
use App\Repositories\Core\Auth\Users;
use Yajra\DataTables\Html\Column;
class MailTemplatesDataTable extends DataTable
{
public $model_name = 'mail_templates';
public $sortedColumn = 0;
public $sortedOrder = 'desc';
public $stateSave = true;
public function query(MailTemplate $model)
{
return $this->buildQuery($model);
}
public function getHtmlButtons()
{
$buttons = '';
if (Users::hasPermission('mail_templates_view')) {
$buttons .= self::getButtonShow();
}
if (Users::hasPermission('mail_templates_update')) {
$buttons .= self::getButtonEdit();
}
if (Users::hasPermission('mail_templates_delete')) {
$buttons .= self::getButtonDel();
}
return $buttons;
}
protected function getColumns()
{
return [
Column::make('subject')->title(__('Core.subject')),
Column::make('mailable')->title(__('Mailable')),
$this->makeColumnButtons()->width('60'),
];
}
}

View File

@@ -5,6 +5,7 @@ namespace App\Datatables\Shop;
use Yajra\DataTables\Html\Column;
use App\Datatables\ParentDataTable as DataTable;
use App\Models\Shop\ArticleNature;
use App\Repositories\Shop\ArticleNatures;
class ArticleNaturesDataTable extends DataTable
{
@@ -16,11 +17,22 @@ class ArticleNaturesDataTable extends DataTable
return $this->buildQuery($model);
}
public function modifier($datatables)
{
$datatables
->editColumn('product_type', function (ArticleNature $nature) {
return ArticleNatures::getProductTypeName($nature->product_type);
})
->rawColumns(['action']);
return parent::modifier($datatables);
}
protected function getColumns()
{
return [
Column::make('product_type')->title('Famille de produit')->width(140),
Column::make('name')->title('Nom'),
Column::make('articles_count')->title('#Art')->addClass('text-right')->searchable(false)->width(60),
Column::make('articles_count')->title('Nb Art.')->addClass('text-right')->searchable(false)->width(60),
$this->makeColumnButtons(),
];
}

View File

@@ -36,9 +36,9 @@ class InvoicesDataTable extends DataTable
protected function getColumns()
{
return [
Column::make('status'),
Column::make('created_at')->title('Date'),
Column::make('ref')->title('Ref')->width(80),
Column::make('status')->width(60),
Column::make('created_at')->title('Date')->width(100),
Column::make('customer.last_name')->title('Client')->default(''),
Column::make('total')->addClass('text-right'),
$this->makeColumnButtons(),

View File

@@ -44,6 +44,7 @@ class OrdersDataTable extends DataTable
protected function getColumns()
{
return [
Column::make('ref')->title('Ref'),
Column::make('status')->title('Statut'),
Column::make('created_at')->title('Date'),
Column::make('customer.last_name')->title('Client'),

View File

@@ -0,0 +1,9 @@
<?php
namespace App\Http\Controllers\Admin\Core\Mail;
use App\Http\Controllers\Controller as ParentController;
class Controller extends ParentController
{
}

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Http\Controllers\Admin\Core\Mail;
use App\Datatables\Admin\Core\Mail\MailLogsDataTable;
use App\Repositories\Core\Mail\MailLogs;
class MailLogController extends Controller
{
public function __construct()
{
// $this->middleware('ability:admin');
}
public function index(MailLogsDataTable $dataTable)
{
return $dataTable->render('admin.Core.Mail.MailLog.index', $data ?? []);
}
public function show($id)
{
$data['message'] = MailLogs::getParsed($id);
return view('admin.Core.Mail.MailLog.modal', $data);
}
}

View File

@@ -0,0 +1,70 @@
<?php
namespace App\Http\Controllers\Admin\Core\Mail;
use App\Datatables\Admin\Core\Mail\MailTemplatesDataTable;
use App\Repositories\Core\Mail\MailTemplates;
use Illuminate\Http\Request;
class MailTemplateController extends Controller
{
public function __construct()
{
// $this->middleware('ability:admin');
}
public function index(MailTemplatesDataTable $dataTable)
{
return $dataTable->render('Admin.Core.Mail.MailTemplate.index', $data ?? []);
}
public function modalCreate()
{
$data = MailTemplates::init();
return view('Admin.Core.Mail.MailTemplate.modal', $data ?? []);
}
public function modalEdit($id = false)
{
$data = MailTemplates::init();
$data['mail_template'] = MailTemplates::edit($id);
return view('Admin.Core.Mail.MailTemplate.modal', $data);
}
public function storeAjax(Request $request)
{
$data = $request->all();
unset($data['proengsoft_jsvalidation']);
$ret = MailTemplates::store($data);
return response()->json(['error' => 0]);
}
public function destroy(Request $request, $id = false)
{
$id = $id ?? $request->input('id');
MailTemplates::destroy($id);
return response()->json(['error' => 0]);
}
public function getVarsByMailable($mailable)
{
$data['vars'] = MailTemplates::getVarsByMailable($mailable);
return view('Admin.Core.Mail.MailTemplate.partials.vars', $data);
}
public function preview($template_id, $user_id)
{
return MailTemplates::preview($template_id, $user_id);
}
public function modalPreview($template_id)
{
$data = MailTemplates::getDataFormodalPreview($template_id);
return view('Admin.Core.Mail.MailTemplate.partials.modalPreview', $data);
}
}

View File

@@ -34,6 +34,9 @@ class ArticleNatureController extends Controller
public function edit($id)
{
$data['article_nature'] = ArticleNatures::get($id);
$data['product_types'] = ArticleNatures::getProductTypes();
// dump($data);
// exit;
return view('Admin.Shop.ArticleNatures.edit', $data);
}
@@ -42,8 +45,9 @@ class ArticleNatureController extends Controller
return ArticleNatures::destroy($id);
}
public static function getOptions($product_type)
public static function getOptions(Request $request)
{
return response()->json(['0' => ''] + ArticleNatures::getOptionsByProductType($product_type));
$data = ArticleNatures::getOptionsByProductTypeModel($request->input('product_type'));
return response()->json(['0' => ''] + $data);
}
}

View File

@@ -14,6 +14,7 @@ class ArticleController extends Controller
{
$data['article'] = Articles::getArticleToSell($id);
// $data['breadcrumb'] = Categories::getAncestorsByCategory($category_id);
$data['offers2'] = Articles::getSiblings($id)->toArray();
// dump($data);
// exit;
return view('Shop.Articles.show', $data);

View File

@@ -10,6 +10,7 @@ use App\Repositories\Shop\Categories;
use App\Repositories\Shop\TagGroups;
use App\Datatables\Shop\CategoriesDataTable;
use App\Repositories\Shop\ArticleNatures;
class CategoryController extends Controller
{
@@ -18,43 +19,52 @@ class CategoryController extends Controller
return $dataTable->render('Shop.Categories.list');
}
public function show(Request $request, $category_id)
public function show(Request $request, $category_id, $article_nature_id = false)
{
switch ($request->input('article_nature')) {
case 'semences':
$product_type = 'botanic';
$article_nature_id = 1;
break;
case 'plants':
$product_type = 'botanic';
$article_nature_id = 2;
break;
case 'legumes':
$product_type = 'botanic';
$article_nature_id = 3;
break;
default:
$product_type = 'botanic';
$article_nature_id = 1;
break;
if ($article_nature_id) {
$product_type = ArticleNatures::getProductType($article_nature_id);
dump($product_type);
exit;
} else {
// $product_type = Articles::getProductTypeByCategory($category_id);
// dump($product_type);
switch ($request->input('article_nature')) {
case 'semences':
$product_type = 'botanic';
$article_nature_id = 1;
break;
case 'plants':
$product_type = 'botanic';
$article_nature_id = 2;
break;
case 'legumes':
$product_type = 'botanic';
$article_nature_id = 3;
break;
default:
$product_type = 'botanic';
$article_nature_id = 1;
break;
}
// $product_type = ArticleNatures::getProductType($article_nature_id);
// dump($product_type);
}
$data = [
'category' => Categories::getFull($category_id),
'breadcrumb' => Categories::getAncestorsByCategory($category_id),
'display_by_rows' => $request->input('display_by_rows') ?? false,
'product_type' => $product_type,
'article_nature' => $request->input('article_nature'),
'article_nature' => $article_nature_id,
'tags_selected' => $request->input('tags') ?? [],
'articles' => Articles::getArticlesToSell([
'category_id' => $category_id,
'tags' => $request->input('tags') ?? [],
'product_type' => $product_type,
'product_type' => $product_type ?? false,
'article_nature_id' => $article_nature_id ?? false,
]),
'tags' => TagGroups::getWithTagsAndCountOffers($category_id),
];
// dump($data);
// exit;
return view('Shop.Shelves.shelve', $data);
}

23
app/Menu/Contents.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
namespace App\Menu;
use Sebastienheyd\Boilerplate\Menu\Builder;
class Contents
{
public function make(Builder $menu)
{
$menu->add('Contenus', ['icon' => 'newspaper' ])
->id('contents')
->order(6);
$menu->addTo('contents', 'Contenus', [
'route' => 'Admin.Shop.Homepages.index',
])->activeIfRoute(['Admin.Shop.Homepages.*'])->order(1);
$menu->addTo('contents', 'Template de Mails', [
'route' => 'Admin.Core.Mail.MailTemplate.index',
])->activeIfRoute(['Admin.Core.Mail.MailTemplate.*'])->order(2);
}
}

View File

@@ -55,10 +55,6 @@ class Shop
$menu->addTo('shop', 'Unités', [
'route' => 'Admin.Shop.Unities.index',
])->activeIfRoute(['Admin.Shop.Unities.*'])->order(14);
$menu->addTo('shop', 'Contenus', [
'route' => 'Admin.Shop.Homepages.index',
])->activeIfRoute(['Admin.Shop.Homepages.*'])->order(15);
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models\Core\Mail;
use App\Repositories\Core\DateTime;
use Illuminate\Database\Eloquent\Model;
class MailLog extends Model
{
protected $guarded = ['id'];
public function scopeByDestination($query, $email)
{
return $query->where('sent_to', $email);
}
public function getCreatedAtAttribute($value)
{
return DateTime::DateTimeToLocale($value);
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models\Core\Mail;
use App\Traits\HasTranslations;
use Spatie\MailTemplates\Models\MailTemplate as parentMailTemplate;
use Venturecraft\Revisionable\RevisionableTrait;
use Wildside\Userstamps\Userstamps;
class MailTemplate extends parentMailTemplate
{
use HasTranslations, RevisionableTrait, Userstamps;
protected $connection = 'central';
public $translatable = ['subject', 'html_template', 'text_template'];
protected $revisionCreationsEnabled = false;
protected $keepRevisionOf = ['subject', 'html_template', 'text_template'];
}

View File

@@ -141,12 +141,12 @@ class Article extends Model implements HasMedia
public function scopeByProduct($query, $model)
{
return $query->where($this->table . '.product_type', $model);
return $model ? $query->where($this->table . '.product_type', $model) : $query;
}
public function scopeByProductId($query, $model_id)
public function scopeByProductId($query, $product_id)
{
return $query->where($this->table . '.product_id', $model_id);
return $product_id ? $query->where($this->table . '.product_id', $product_id) : $query;
}
public function scopeByTag($query, $tag_id)

View File

@@ -25,14 +25,14 @@ class ArticleNature extends Model
return $query->where($this->table . '.id', $id);
}
public function scopeByBotanic($query);
public function scopeByBotanic($query)
{
return $query->where($this->table . '.product_type', 1);
return $query->ByProductType(1);
}
public function scopeByMerchandise($query);
public function scopeByMerchandise($query)
{
return $query->where($this->table . '.product_type', 2);
return $query->ByProductType(2);
}
public function scopeByProductType($query, $type)

View File

@@ -0,0 +1,45 @@
<?php
namespace App\Repositories\Core\Export;
class HelperExcel
{
public static function getHeaderStyle($color = 'ffffff', $bgcolor = '00a3cb')
{
return [
'fill' => self::setFill($bgcolor),
'borders' => self::setBorders($bgcolor),
'font' => self::setFont($color, 14, true),
];
}
public static function setFill($color)
{
return [
'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
'startColor' => [
'rgb' => $color,
],
];
}
public static function setBorders($color)
{
return [
'outline' => [
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK,
'color' => ['argb' => $color],
],
];
}
public static function setFont($color, $size = 12, $bold = false, $font = 'Calibri')
{
return [
'name' => $font,
'size' => $size,
'bold' => $bold,
'color' => ['argb' => $color],
];
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Repositories\Core\Mail;
use App\Models\Core\Mail\MailLog;
use App\Traits\Model\Basic;
class MailLogs
{
use Basic;
public static function getSubject($id)
{
return MailParser::getSubject(self::get($id)->event);
}
public static function getParsed($id)
{
return MailParser::getParsed(self::get($id)->event);
}
public static function getModel()
{
return MailLog::query();
}
}

View File

@@ -0,0 +1,89 @@
<?php
namespace App\Repositories\Core\Mail;
use ZBateson\MailMimeParser\Header\HeaderConsts;
use ZBateson\MailMimeParser\MailMimeParser;
class MailParser
{
public static function getParsed($mail)
{
$model = self::getModel($mail);
return [
'from' => self::getFromByModel($model),
'subject' => self::getSubjectByModel($model),
'content' => self::getHtmlByModel($model),
'to_name' => self::getToNameByModel($model),
'to_email' => self::getToEmailByModel($model),
];
}
public static function getSubject($mail)
{
return self::getSubjectByModel(self::getModel($mail));
}
public static function getText($mail)
{
return self::getTextByModel(self::getModel($mail));
}
public static function getHtml($mail)
{
return self::getHtmlByModel(self::getModel($mail));
}
public static function getFrom($mail)
{
return self::getFromByModel(self::getModel($mail));
}
public static function getToName($mail)
{
return self::getToNameByModel(self::getModel($mail));
}
public static function getToEmail($mail)
{
return self::getToEmailByModel(self::getModel($mail));
}
public static function getSubjectByModel($model)
{
return $model->getHeaderValue(HeaderConsts::SUBJECT);
}
public static function getTextByModel($model)
{
return $model->getTextContent();
}
public static function getFromByModel($model)
{
return $model->getHeader(HeaderConsts::FROM)->getPersonName();
}
public static function getToNameByModel($model)
{
return $model->getHeader(HeaderConsts::TO)->getAddresses()[0]->getName();
}
public static function getToEmailByModel($model)
{
return $model->getHeader(HeaderConsts::TO)->getAddresses()[0]->getEmail();
}
public static function getHtmlByModel($model)
{
return $model->getHtmlContent();
}
public static function getModel($mail)
{
$mailParser = new MailMimeParser();
return $mailParser->parse($mail, false);
}
}

View File

@@ -0,0 +1,64 @@
<?php
namespace App\Repositories\Core\Mail;
use App\Models\Core\Mail\MailTemplate;
use App\Traits\Model\Basic;
use Mustache_Engine;
class MailTemplates
{
use Basic;
public static function init()
{
return [
'mailables' => Mailables::getList(),
];
}
public static function edit($id)
{
$data = self::get($id)->toArray();
$mailable = $data['mailable'];
$data['vars'] = $mailable::getVariables();
return $data;
}
public static function getVarsByMailable($mailable)
{
return $mailable::getVariables();
}
public static function getDataFormodalPreview($id)
{
$template = self::get($id);
$mailable = $template->mailable;
return [
'id' => $id,
'users' => $mailable::getUsers(),
];
}
public static function preview($id, $user_id)
{
$template = self::get($id);
$mailable = $template->mailable;
$data = $mailable::getDataByUser($user_id);
$html_template = $template->toArray()['html_template_translations'][$data['lang']] ?? false;
if ($html_template) {
$m = new Mustache_Engine();
return $m->render($html_template, $data);
} else {
return false;
}
}
public static function getModel()
{
return MailTemplate::query();
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Repositories\Core\Mail;
class Mailables
{
public static function getList()
{
$data = [];
$files = glob(app_path('Mail').'/*.php');
foreach ($files as $file) {
$class = basename($file, '.php');
$data['App\Mail\\'.$class] = $class;
}
return $data;
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Repositories\Core\Mail;
class Mailer
{
public static function getTemplates()
{
return MailTemplates::getOptions();
}
public static function getTemplate($template_id)
{
$templates = self::getTemplates();
return $templates[$template_id];
}
}

View File

@@ -3,6 +3,10 @@
namespace App\Repositories\Shop;
use App\Models\Shop\ArticleNature;
use App\Models\Shop\Article;
use App\Models\Botanic\Specie;
use App\Models\Botanic\Variety;
use App\Models\Shop\Merchandise;
class ArticleNatures
{
@@ -11,9 +15,36 @@ class ArticleNatures
return ArticleNature::get()->pluck('name', 'id')->toArray();
}
public static function getOptionsByMerchandise()
public static function getProductType($id)
{
return self::getOptionsByProductType(2);
$type = self::get($id)->product_type ?? false;
return $type ? self::getProductTypes()[$type] : false;
}
public static function getProductTypeName($type)
{
return self::getProductTypes()[$type] ?? false;
}
public static function getProductTypeByModel($model)
{
switch ($model) {
case Specie::class:
$type = 1;
break;
case Variety::class:
$type = 1;
break;
case Merchandise::class:
$type = 2;
break;
}
return $type ?? false;
}
public static function getProductTypes()
{
return ['', 'botanic', 'merchandise'];
}
public static function getOptionsByBotanic()
@@ -21,9 +52,30 @@ class ArticleNatures
return self::getOptionsByProductType(1);
}
public static function getOptionsByMerchandise()
{
return self::getOptionsByProductType(2);
}
public static function getOptionsByProductTypeModel($model)
{
$type = self::getProductTypeByModel($model);
return self::getOptionsByProductType($type);
}
public static function getOptionsByProductType($type)
{
return ArticleNature::byProductType($type)->get()->pluck('name', 'id')->toArray();
return self::getByProductType($type)->pluck('name', 'id')->toArray();
}
public static function getByProductType($type)
{
return ArticleNature::byProductType($type)->get();
}
public static function getByCategory($category_id)
{
return Article::byCategory($category_id)->select('article_nature_id')->distinct()->get();
}
public static function getAll()

View File

@@ -10,6 +10,7 @@ use App\Repositories\Core\Comments;
use App\Repositories\Botanic\Species;
use App\Repositories\Botanic\Varieties;
use App\Models\Shop\Article;
use App\Models\Shop\Merchandise;
use App\Traits\Repository\Imageable;
@@ -106,7 +107,7 @@ class Articles
$data['description'] = self::getFullDescriptionByArticle($article);
$images = self::getFullImagesByArticle($article);
$data['image'] = self::getPreviewSrc($images[0] ?? false);
$data['images'] = $images;
$data['images'] = count($images) ? $images : false;
$data['image_big'] = self::getImageSrc($images[0] ?? false);
$data['inherited'] = self::getInherited($id);
$data['categories'] = self::getCategoriesNameByArticle($article);
@@ -376,6 +377,22 @@ class Articles
return $article->categories->pluck('id')->toArray();
}
public static function getProductTypeByCategory($category_id)
{
$models = self::getProductTypesModelsByCategory($category_id);
return (($models[0] ?? false) == Merchandise::class) ? 'merchandise' : 'botanic';
}
public static function getProductTypesModelsByCategory($category_id)
{
return Article::byCategory($category_id)->select('product_type')->distinct()->get();
}
public static function countProductTypesByCategory($category_id)
{
return Article::byCategory($category_id)->select('product_type')->distinct()->count();
}
public static function getCategoriesNameByArticle($article)
{
return $article->categories->pluck('name', 'id')->toArray();

View File

@@ -4,6 +4,7 @@ namespace App\Repositories\Shop;
use Carbon\Carbon;
use App\Models\Shop\Order;
use Illuminate\Support\Str;
class Orders
{
@@ -70,6 +71,8 @@ class Orders
public static function create($data)
{
OrderStats::increase();
$data['uuid'] = Str::uuid()->toString();
$data['ref'] = self::getNewRef();
return Order::create($data);
}
@@ -111,4 +114,12 @@ class Orders
{
return ['', 'CARTE BANCAIRE', 'CHEQUE', 'VIREMENT BANCAIRE'];
}
public static function getNewRef()
{
$ref = date('ym') . '00000';
$last_ref = Order::orderBy('ref', 'desc')->where('ref', '>', $ref)->first();
return $last_ref ? $last_ref->ref + 1 : $ref + 1;
}
}

127
app/Traits/Model/Basic.php Normal file
View File

@@ -0,0 +1,127 @@
<?php
namespace App\Traits\Model;
use Illuminate\Database\Eloquent\Model;
trait Basic
{
public static function toggle($id, $field = 'active')
{
return self::update([$field => ! self::getField($id, $field)], $id);
}
public static function getIDs()
{
return self::getAll()->pluck('id');
}
public static function getOptions($field = 'name')
{
$data = self::getModel()->pluck($field, 'id')->toArray();
asort($data, SORT_NATURAL | SORT_FLAG_CASE);
return $data;
}
public static function getName($id)
{
return self::getField($id, 'name');
}
public static function getByUUID($uuid)
{
return self::getByField('uuid', $uuid)->first();
}
public static function getFields($field)
{
return self::getAll()->pluck($field);
}
public static function getByField($field, $value)
{
return self::getModel()->where($field, $value);
}
public static function getField($id, $field)
{
$model = self::get($id);
return $model ? $model->$field : false;
}
public static function edit($id)
{
return self::get($id)->toArray();
}
public static function store($data)
{
return ($data['id'] ?? false) ? self::update($data) : self::create($data);
}
public static function create($data)
{
return self::getModel()->create($data);
}
public static function update($data, $id = false)
{
$id = $id ? $id : $data['id'];
$model = self::get($id);
$model->update($data);
return $model;
}
public static function destroy($id)
{
$model = self::get($id);
return $model ? $model->delete() : false;
}
public static function count()
{
return self::getModel()->count();
}
public static function firstOrCreate($search, $data)
{
return self::getModel()::firstOrCreate($search, $data);
}
public static function get($id, $relations = false, $relations_count = false)
{
return self::getModelRelations($relations, $relations_count)->find($id);
}
public static function getAll($relations = false, $relations_count = false)
{
return self::getModelRelations($relations, $relations_count)->get();
}
public static function getModelRelations($relations = false, $relations_count = false)
{
$model = $relations ? self::getModelWithRelations($relations) : false;
$model = $relations_count ? self::getModelWithCountRelations($relations_count, $model) : $model;
return $model ? $model : self::getModel();
}
public static function getModelWithRelations($relations = false, $model = false)
{
return is_object($model) ? $model->with($relations) : self::getModel()->with($relations);
}
public static function getModelWithCountRelations($relations = false, $model = false)
{
return is_object($model) ? $model->withCount($relations) : self::getModel()->withCount($relations);
}
public static function getModel(): Model
{
return new Model();
}
}

View File

@@ -35,7 +35,7 @@ trait Imageable
public static function getPreviewSrc($image, $with_undefined = true)
{
return $image ? Medias::getPreviewSrc($image) : ($with_undefined ? '/img/visuel-non-disponible.jpg' : '');
return $image ? Medias::getPreviewSrc($image) : ($with_undefined ? self::getUnknown() : '');
}
public static function getNormal($image, $with_undefined = true)
@@ -46,7 +46,7 @@ trait Imageable
public static function getNormalSrc($image, $with_undefined = true)
{
return $image ? Medias::getNormalSrc($image) : ($with_undefined ? '/img/visuel-non-disponible.jpg' : '');
return $image ? Medias::getNormalSrc($image) : ($with_undefined ? self::getUnknown() : '');
}
public static function getImage($image, $with_undefined = true)
@@ -57,7 +57,12 @@ trait Imageable
public static function getImageSrc($image, $with_undefined = true)
{
return $image ? Medias::getImageSrc($image) : ($with_undefined ? '/img/visuel-non-disponible.jpg' : '');
return $image ? Medias::getImageSrc($image) : ($with_undefined ? self::getUnknown() : '');
}
public static function getUnknown()
{
return '/img/visuel-non-disponible.jpg';
}
public static function deleteImage($id, $index)

View File

@@ -87,10 +87,6 @@ label {
background-color: #335012;
}
a.nav-link {
color: #FFF;
}
.bg-green-ultra-dark {
background: linear-gradient(to left top, #102723, #112723, #122724, #122724, #132724);
color: #a5b94f;
@@ -213,8 +209,18 @@ div.megamenu ul.megamenu li.megamenu.level1
cursor: pointer;
}
.dropdown.megamenu a:hover, .dropdown.megamenu a:active, .dropdown.megamenu div.w-100:hover {
background-color: #F2B90F;
#navbarContent > ul > li:hover
{
border-bottom: 4px solid #FFF!important;
}
.dropdown-menu a > div.w-100:hover
{
background-color: #F2B90F;
}
a.nav-link {
color: #FFF;
}
.slick-prev:before, .slick-next:before {

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="853.27057"
height="677.52399"
viewBox="0 0 853.27057 677.52399"
version="1.1"
id="svg2574"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs2578" />
<path
style="fill:#334f11;stroke:none"
d="m 82.007161,331.12709 c -9.8669,20.765 -34.4635,37.4 -34.946,62 -0.2537,12.938 6.5152,25.226 16.946,32.56 4.7935,3.37 16.8458,5.269 17.8519,11.459 1.8008,11.081 0.1481,23.749 0.1481,34.981 0,62.366 -14.0804,141.27 43.999999,183.255 41.754,30.182 99.419,20.745 148,20.745 h 327 c 50.606,0 104.959,7.315 143.996,-32.001 28.527,-28.731 31.004,-63.9 31.004,-101.999 0,-40.148 -3.469,-82.023 0.059,-121.996 0.649,-7.358 11.175,-10.837 15.756,-16.008 7.418,-8.372 9.453,-18.155 9.17,-28.996 -0.506,-19.392 -20.355,-27.341 -24.985,-44 15.625,0 34.951,3.045 50,-1.44 22.507,-6.708 33.446,-33.494 23.676,-54.56 -10.17,-21.928 -30.928,-22 -51.676,-22 h -57 c -8.469,0 -26.045,3.311 -32.83,-2.318 -17.647,-14.639 -31.582,-38.033 -46.251,-55.682 -34.255,-41.214 -68.051,-82.808 -102.333,-123.999998 -11.596,-13.9345 -23.206,-27.8883 -34.586,-42 -7.527,-9.3329 -15.228,-19.8099998 -27,-23.8989298 -33.123,-11.50537 -65.705,26.1725298 -47.525,56.8989298 13.416,22.674 34.415,42.643998 51.101,62.999998 35.039,42.747 70.593,85.083 105.424,128 h -371 c 10.958,-19.236 25.96,-36.998 38.86,-55 23.363,-32.605 46.569,-65.333 69.849,-98 9.805,-13.758898 21.117,-27.269698 29.415,-41.999998 16.568,-29.4106 -10.468,-62.2636698 -42.124,-57.69982976 -15.321,2.20879996 -23.393,14.03052976 -31.709,25.69982976 -9.035,12.6776 -18.083,25.3459 -27.151,38 -29.569,41.265998 -58.968,82.656998 -88.431,123.999998 -14.295,20.059 -27.347,43.932 -44.224,61.852 -6.27,6.658 -24.916,3.148 -33.485,3.148 H 54.007161 c -21.2403,0 -43.6043,1.12 -51.8989199,25 -1.78902002,5.15 -2.21726602,10.588 -2.08642002,16 1.06872002,44.204 51.76713992,37 81.98533992,37 m 166.999999,0.419 c 20.908,-5.173 47.194,-0.205 54.226,22.581 5.792,18.766 1.774,43.474 1.774,63 v 129 c 0,25.916 2.838,59.325 -30,66.331 -22.736,4.851 -44.895,-9.051 -48.561,-32.331 -3.066,-19.47 -0.439,-41.287 -0.439,-61 v -120 c 0,-21.222 -5.281,-60.584 23,-67.581 m 151,0 c 20.908,-5.173 47.194,-0.205 54.226,22.581 5.792,18.766 1.774,43.474 1.774,63 v 129 c 0,25.916 2.838,59.325 -30,66.331 -22.736,4.851 -44.895,-9.051 -48.561,-32.331 -3.066,-19.47 -0.439,-41.287 -0.439,-61 v -120 c 0,-21.222 -5.281,-60.584 23,-67.581 m 164,0 c 20.908,-5.173 47.194,-0.205 54.226,22.581 5.792,18.766 1.774,43.474 1.774,63 v 129 c 0,25.916 2.838,59.325 -30,66.331 -22.736,4.851 -44.895,-9.051 -48.561,-32.331 -3.066,-19.47 -0.439,-41.287 -0.439,-61 v -120 c 0,-21.222 -5.281,-60.584 23,-67.581 z"
id="path2580" />
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="4122.2734"
height="4124.1968"
viewBox="0 0 4122.2734 4124.1968"
version="1.1"
id="svg2503"
sodipodi:docname="catalogue.svg"
inkscape:export-filename="../../../../../../../../../Desktop/catalogue.svg"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
inkscape:version="1.2.2 (b0a8486, 2022-12-01)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs2507" />
<sodipodi:namedview
id="namedview2505"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="false"
inkscape:zoom="0.053285166"
inkscape:cx="-1895.4619"
inkscape:cy="2242.6504"
inkscape:window-width="1920"
inkscape:window-height="999"
inkscape:window-x="0"
inkscape:window-y="25"
inkscape:window-maximized="0"
inkscape:current-layer="svg2503" />
<path
style="fill:#334f11;stroke:none"
d="m 2024.6945,1.5119512 c -19.25,2.52734 -39.59,0.76513 -59,1.61523 -40.36,1.76709 -80.77,5.10547 -121,9.1293498 -116.94,11.6958 -232.81,34.7854 -346,66.2554 C 983.43949,221.77063 536.33549,575.04563 270.54449,1038.0876 c -334.887803,583.42 -360.570603,1315.5 -67.592,1921 69.575,143.79 155.867,280.41 257.166,404 134.464,164.05 292.777,308.58 470.576,424.66 198.93001,129.87 419.76001,225.63 651.00001,280.46 243.58,57.74 498,71.21 746,38.6 247.47,-32.54 489.34,-109.23 709,-228.03 182.38,-98.64 351.13,-224.2 495.99,-372.69 383.94,-393.58 602.48,-935.52 589,-1486 -5.44,-221.89 -45.14,-442.53 -119.68,-652 -217.77,-611.93397 -728.97,-1094.29897 -1350.31,-1280.719969 -142.65,-42.7988 -290.5,-70.1877 -439,-80.3693598 -37.7,-2.58496 -75.24,-3.29736 -113,-4.95019 -24.28,-1.06298997 -50.8,-3.7124 -75,-0.53613 m 2,228.8606788 c 23.67,-2.793 49.29,-0.362 73,0.676 30.4,1.33 60.64,1.87 91,3.95 132.13,9.054 263.99,32.262 391,70.369 172.32,51.702 335.34,127.704 486,226.064 335.52,219.042 593.39,552.52597 724.66,930.65597 62.57,180.26 95.67,370.61 100.33,561 8.26,337.8 -80.89,676.7 -252,968 -284.12,483.68 -799.26,830.77 -1359.99,890.83 -360.71,38.65 -728.57,-18.64 -1053,-186.09 -273.38601,-141.1 -507.39301,-347.44 -681.97401,-600.74 -324.102,-470.23 -411.713,-1101.9 -215.079,-1640 77.511,-212.11 187.45,-408.75 334.325,-580.99997 250.36,-293.612 593.03801,-505.055 968.72801,-594.116 90.64,-21.488 182.4,-34.895 275,-43.714 39.1,-3.724 79.11,-1.295 118,-5.885 m -686,603.139 c -19.33,2.54 -39.52,1.332 -59,2.665 -35.36,2.421 -70.78,5.813 -106,10.196 -121.58,15.128 -241.10801,43.363 -358.00001,79.69 -33.243,10.331 -66.221,21.627 -99,33.333 -36.196,12.926 -69.738,25.627 -94.551,56.69197 -35.738,44.74 -30.449,99.33 -30.449,153 v 288 1178 321 c 0,54.23 -3.554,110.54 42,149.57 66.873,57.3 149.834,18.35 224,-0.2 160.51001,-40.13 324.86001,-66.1 490.00001,-73.33 150.18,-6.58 302.12,6.94 449,39.38 45.12,9.97 89.88,21.9 134,35.61 28.02,8.7 56.2,21.61 85,27.17 18.39,3.54 37.35,2.83 56,2.8 30.57,-0.05 62.58,-14.18 92,-21.63 58.68,-14.86 117.55,-29.1 177,-40.57 171.06,-32.99 343.98,-49.38 518,-41.76 115.68,5.07 234.22,22.32 346,53.38 33.5,9.31 67.01,18.58 100,29.58 35.72,11.91 68.72,25.34 107,18.39 47.84,-8.69 87.13,-47.08 97.58,-94.39 9.09,-41.19 3.42,-87.95 3.42,-130 v -242 -1197 -298 c 0,-54.03 5.91,-109.31 -28.88,-155 -27.08,-35.55297 -66.85,-49.03797 -107.12,-64.04997 -65.98,-24.598 -132.9,-45.928 -201,-63.834 -252.73,-66.454 -515.51,-73.56 -772,-25.505 -78.88,14.778 -157.55,34.306 -234,58.733 -27.09,8.655 -54.08,17.487 -81,26.659 -10.31,3.512 -24.08,11.78 -35,11.779 -5.94,0 -12.53,-4.074 -18,-6.101 -13.97,-5.171 -27.92,-10.451 -42,-15.337 -46.55,-16.158 -93.43,-31.308 -141,-44.193 -124.1,-33.609 -251.61,-55.572 -380,-61.19 -30.34,-1.328 -60.55,-1.961 -91,-1.961 -14.08,0 -29.03,-1.41 -43,0.424 m 599,2036.57597 c -20.45,-2.75 -40.89,-10.35 -61,-15.12 -39.74,-9.42 -79.76,-17.64 -120,-24.63 -124.78,-21.68 -252.42,-31.34 -379,-28.24 -125.51,3.08 -251.22,16.1 -375,38.41 -38.78901,7 -77.50101,14.55 -116.00001,23 -21.505,4.73 -44.069,12.79 -66,14.58 v -1713 c 28.716,-6.64 56.742,-18.77 85,-27.28 58.616,-17.65 118.01001,-32.73 178.00001,-44.92 197.08,-40.05 400.75,-41.44 598,-2 62.76,12.55 123.79,30.04 185,48.48 16.5,4.97 32.67,10.89 49,16.39 5.72,1.92 16.12,3.78 20.4,8.15 4.59,4.69 1.6,21.87 1.6,28.18 v 80 320 1278 m 1346,0 c -20.2,-1.76 -41.22,-10.43 -61,-15.12 -39.73,-9.41 -79.77,-17.64 -120,-24.63 -124.77,-21.68 -252.43,-31.34 -379,-28.24 -125.52,3.08 -251.21,16.1 -375,38.41 -38.79,7 -77.5,14.55 -116,23 -21.48,4.72 -44.11,12.79 -66,14.58 v -1713 c 28.72,-6.64 56.74,-18.77 85,-27.28 56.66,-17.07 114.05,-31.72 172,-43.72 198.94,-41.18 404.74,-43.05 604,-3.2 63.4,12.68 125.31,30 187,49.17 16.43,5.11 32.87,10.43 49,16.45 5.28,1.98 14.38,3.3 18.4,7.4 4.59,4.69 1.6,21.87 1.6,28.18 v 80 321 z"
id="path2509" />
</svg>

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="948.25177"
height="963.42358"
viewBox="0 0 948.25177 963.42358"
version="1.1"
id="svg2472"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs2465">
<style
id="style2463">
.cls-1, .cls-2 {
fill: none;
stroke: #335012;
stroke-width: 23.02px;
}
.cls-2 {
fill-rule: evenodd;
}
</style>
</defs>
<path
style="display:inline;fill:#334f11;stroke:none"
d="m 400.70851,955.4236 1,-3 7,2 v 1 h -4 l 9,3 3,-3 4,1 c 0.855,3.992 4.47,3 8,3 8.79,0 17.256,-0.147 26,0 v 1 l -2,2 c 10.406,-5.231 14.011,0.255 24,1 l -2,-4 27,3 1,-3 c 4.053,2.829 21.988,1.935 25,-2 13.111,3.867 25.672,-6.677 38,-9.33 7.51,-1.617 14.515,2.685 22.004,1.987 13.009,-1.211 27.582,-6.655 39.996,-10.686 6.831,-2.219 8.641,-7.382 14.043,-11.318 3.604,-2.626 8.779,-3.645 12.957,-5.113 7.734,-2.717 16.56,-3.316 24,-6.611 12.432,-5.505 23.59,-13.984 35,-21.234 33.417,-21.233 60.864,-44.559 89,-72.695 23.063,-23.063 49.104,-47.323 67.957,-74 10.847,-15.349 17.711,-34.078 25.453,-51 13.432,-29.36 30.478,-59.413 38.834,-91 9.72,-36.743 10.86,-76.469 10.756,-114 l 2,1 -2,-17 c 6.904,-6.04 -2.866,-26.537 1,-35 -3.732,-7.464 -2.254,-19.636 -3.285,-28 -2.83,-22.971 -4.435,-47.101 -12.41,-69 -15.989,-43.903 -34.618,-90.956 -60.66,-130 -8.605,-12.901 -20.143,-23.335 -30.22,-35 -29.218,-33.822 -61.804,-67.519 -97.425,-94.763905 -94.941,-72.616 -222.451,-96.3015 -339,-79.5069096 -22.135,3.18969 -45.59,5.6623096 -67,12.2963096 -75.727,23.4642 -139.839,68.1748 -196,122.959505 -24.629,24.026 -49.286501,50.654 -67.574801,80.015 -26.7349,42.922 -52.0378,94.365 -63.0008,144 -8.2519396,37.361 -9.25326955,77.26 -9.96914955,115 -0.727837,38.37 0.7225,78.122 9.43204995,116 11.0322996,47.979 34.1703996,97.426 58.5401996,140 17.0579,29.801 43.483501,55.911 67.572501,80 37.161,37.161 74.168,71.776 121,96.677 11.056,5.878 24.605,7.288 36,12.725 12.597,6.01 23.718,13.675 37,18.545 23.357,8.563 47.629,3.417 71,12.053 m 56,-913.714505 c 52.501,-6.1947 110.253,6.7624 159,24.1674 8.435,3.0119 17.542,3.2923 26,6.2423 24.489,8.5409 49.358,22.1616 71,36.383805 69.694,45.799 125.493,113.811 159.138,189.921 7.958,18.002 11.94,37.459 18.202,55.985 2.512,7.431 6.794,14.268 9.091,22.015 8.743,29.497 11.569,63.278 11.569,94 0,24.038 0.834,49.252 -3.329,73 -4.136,23.595 -11.951,46.208 -18.757,69 -4.964,16.623 -8.73,33.212 -16.234,49 -9.993,21.024 -23.912,41.273 -36.256,61 -11.634,18.595 -25.877,33.825 -39.309,51 -5.167,6.607 -14.064,17.759 -23.115,18.271 -12.486,0.706 -19.597,-4.806 -21.674,-17.271 -2.497,-14.977 -0.035,-29.996 -4.264,-45 -3.692,-13.096 -11.068,-24.234 -17.548,-36 -9.478,-17.208 -17.67,-34.035 -29.398,-50 -24.655,-33.561 -57.883,-63.283 -94.116,-84.128 -10.667,-6.137 -22.935,-10.473 -33,-17.466 -4.263,-2.963 -9.35,-6.713 -9.681,-12.406 -0.667,-11.442 17.978,-21.389 25.681,-27.35 20.973,-16.227 39.882,-38.375 52.694,-61.65 21.68,-39.383 24.401,-81.786 14.731,-125 -2.089,-9.338 -2.788,-19.169 -6.737,-28 -11.95,-26.72 -31.171,-48.483 -51.688,-69 -19.043,-19.043 -40.661,-38.431 -67,-46.279 -43.936,-13.092 -92.511,-13.204 -135,6.179 -22.521,10.275 -42.833,31.045 -59.17,49.1 -10.559,11.67 -21.49,22.725 -30.135,36 -18.979,29.143 -24.695,61.855 -24.695,96 0,13.992 -0.163,27.469 4.025,41 10.973,35.448 34.058,66.083 59.975,92 9.469,9.469 34.821,22.422 32.772,38 -0.859,6.526 -6.454,10.312 -11.772,13.23 -11.374,6.24 -23.589,10.81 -35,17.082 -35.57,19.548 -65.964,49.471 -90.127,81.688 -20.797,27.73 -42.779,63.776 -50.054,98 -1.967,9.251 -1.243,19.557 -1.909,29 -0.846,12.005 -5.117,24.266 -18.91,22.895 -8.367,-0.832 -16.87,-8.073 -22.536,-13.815 -14.67,-14.866 -26.765,-34.111 -38.891,-51.08 -17.542601,-24.547 -33.847501,-54.649 -44.508201,-83 -3.5315,-9.392 -4.4129,-19.54 -7.7091,-29 -8.5794,-24.622 -16.7531,-51.024 -20.0702,-77 -3.1995,-25.055 -1.2855,-49.911 -1.2855,-75 0,-43.961 9.6749,-82.845 23.7585,-124 4.8743,-14.244 7.1474,-29.119 13.3125,-43 3.5716,-8.042 9.614,-15.142 13.6705,-23 43.101501,-83.497 110.714501,-154.617 197.258501,-194.099505 10.521,-4.7998 22.092,-6.198 33,-9.6459 10.97,-3.4674 20.953,-10.018 32,-12.8765 35.597,-9.2104 70.838,-10.8258 107,-15.0926 m 489,425.714505 -1,1 1,-1 m -450,492 v 1 l -6,-1 h 6 m -38,2 v 1 h 6 v -2 l -6,1 m -8,0 1,1 -1,-1 m 32,0 v 1 h 3 z"
id="path2476" />
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 48 KiB

BIN
build/img/watermark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

@@ -17,7 +17,6 @@
"balping/laravel-hashslug": "^2.2",
"barryvdh/laravel-dompdf": "^0.9",
"barryvdh/laravel-snappy": "^0.4.7",
"box/spout": "^3.3",
"browner12/helpers": "^3.0",
"cesargb/laravel-cascade-delete": "^1.2",
"coduo/php-humanizer": "^4.0",
@@ -26,9 +25,10 @@
"darryldecode/cart": "^4.1",
"datatables/datatables": "^1.10",
"ddzobov/laravel-pivot-softdeletes": "^2.1",
"dmcbrn/laravel-email-database-log": "^5.2",
"dompdf/dompdf": "^1.0.2",
"dyrynda/laravel-cascade-soft-deletes": "^4.1",
"eduardokum/laravel-mail-auto-embed": "^1.0",
"eduardokum/laravel-mail-auto-embed": "^2.0",
"erjanmx/laravel-migrate-check": "^2.1",
"fico7489/laravel-eloquent-join": "^4.1",
"fideloper/proxy": "^4.0",
@@ -69,7 +69,6 @@
"proengsoft/laravel-jsvalidation": "^4.5",
"protonemedia/laravel-cross-eloquent-search": "^3.0",
"protonemedia/laravel-eloquent-where-not": "^1.2",
"qoraiche/laravel-mail-editor": "^3.2",
"rahul900day/laravel-captcha": "^1.0",
"ralphjsmit/laravel-seo": "^1.0",
"reedware/laravel-relation-joins": "^3.0",
@@ -87,15 +86,18 @@
"spatie/laravel-backup": "^7.0",
"spatie/laravel-collection-macros": "^7.12",
"spatie/laravel-cookie-consent": "^3.2",
"spatie/laravel-database-mail-templates": "^3.5",
"spatie/laravel-mail-preview": "^4.0",
"spatie/laravel-medialibrary": "^9.6",
"spatie/laravel-stats": "^2.0",
"staudenmeir/belongs-to-through": "^2.11",
"staudenmeir/eloquent-has-many-deep": "^1.13",
"stillat/numeral.php": "^2.0",
"symfony/http-client": "^6.2",
"thomasjohnkane/snooze": "^2.2",
"toin0u/geocoder-laravel": "^4.2",
"unicodeveloper/laravel-password": "^1.0",
"unisharp/laravel-filemanager": "^2.5",
"venturecraft/revisionable": "^1.39",
"watson/rememberable": "^5.0",
"wildside/userstamps": "^2.1",
@@ -110,7 +112,7 @@
"facade/ignition": "^2.9",
"fakerphp/faker": "^1.13",
"fossbarrow/laravel-phpcs": "dev-main",
"imanghafoori/laravel-microscope": "^1.0",
"imanghafoori/laravel-microscope": "1.0.278",
"kevincobain2000/laravel-erd": "^1.3",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.4",
@@ -133,7 +135,8 @@
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"dealerdirect/phpcodesniffer-composer-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"php-http/discovery": true
}
},
"extra": {

View File

@@ -0,0 +1,24 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateMailTemplatesTable extends Migration
{
public function up()
{
Schema::create('mail_templates', function (Blueprint $table) {
$table->increments('id');
$table->string('mailable');
$table->json('subject')->nullable();
$table->json('html_template');
$table->json('text_template')->nullable();
$table->unsignedInteger('created_by')->nullable();
$table->unsignedInteger('updated_by')->nullable();
$table->unsignedInteger('deleted_by')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
}

View File

@@ -72,6 +72,7 @@
"font-awesome": "^4.7.0",
"formBuilder": "^3.2.3",
"formiojs": "^4.11.2",
"gasparesganga-jquery-loading-overlay": "^2.1.7",
"grunt": "^1.0.4",
"grunt-contrib-clean": "^2.0.0",
"grunt-contrib-concat": "^1.0.1",
@@ -102,6 +103,7 @@
"jquery-json": "^2.6.0",
"jquery-migrate": "^3.3.1",
"jquery-placeholder": "^2.3.1",
"jquery-plainoverlay": "^1.0.1",
"jquery-serializejson": "^3.2.0",
"jquery-slidePanel": "^0.3.5",
"jquery-slimscroll": "^1.3.8",

View File

@@ -0,0 +1,38 @@
@extends('layout.index', [
'title' => __('Admin.mail_logs.title'),
'subtitle' => __('Admin.mail_logs.list'),
])
@section('content')
@component('components.card')
@include('components.datatable', [
'route' => route('Admin.Core.Mail.MailLog.index'),
'model' => 'mail_logs',
'with_add' => false,
'with_print' => false,
'with_filters' => true,
'show_callback' => 'MailLogShow(id);',
])
@endcomponent
@component('components.layout.modal-filters', ['title' => 'Filters', 'id' => 'modal-mail_logs-filters'])
@include('admin.Core.Mail.MailLog.partials.filters', ['model' => 'mail_logs'])
@endcomponent
@endsection
@include('load.form.select2')
@push('js')
<script>
function MailLogShow(id) {
var url_open = "{{ route('Admin.Core.Mail.MailLog.show') }}/" + id;
openModal("{{ __('admin.Core.MailLog.modal') }}", '#mail_log-form', url_open, false, false, "xl");
}
$(document).ready(function () {
initSelect2();
});
</script>
@endpush

View File

@@ -0,0 +1,16 @@
<div class="row">
<div class="col-6">
<strong>@lang('from') : </strong>
{{ $message['from'] }}<br/>
<strong>@lang('subject') : </strong>
{{ $message['subject'] }}<br/>
<strong class="text-uppercase">@lang('to') : </strong>
{{ $message['to_name'] }} {{ $message['to_email'] }}<br/>
</div>
</div>
<div class="row mb-3">
<div class="col-12 text-dark">
{!! $message['content'] !!}
</div>
</div>

View File

@@ -0,0 +1,28 @@
<form id="{{ $model }}-filters">
<div class="row mb-3">
<label class="col-4 text-right">{{ __('application') }}</label>
<div class="col-8">
@include('components.form.select', [
'name' => 'application_id',
'list' => $applications ?? [],
'value' => $filters['application_id'] ?? null,
'class' => 'select2',
'with_empty' => __('all'),
])
</div>
</div>
<div class="row mb-3">
<label class="col-4 text-right">{{ __('module') }}</label>
<div class="col-8">
@include('components.form.select', [
'name' => 'application_module_id',
'list' => $application_modules ?? [],
'value' => $filters['application_module_id'] ?? null,
'class' => 'select2',
'with_empty' => __('all'),
])
</div>
</div>
</form>

View File

@@ -0,0 +1,63 @@
@extends('layout.index', [
'title' => __('Core.mail_templates.title'),
'subtitle' => __('Core.mail_templates.list'),
'breadcrumb' => [
]
])
@section('content')
<x-card>
@include('components.datatable', [
'route' => route('Admin.Core.Mail.MailTemplate.index'),
'model' => 'mail_templates',
'with_add' => true,
'with_print' => false,
'with_filters' => true,
'create_callback' => 'MailTemplateCreate();',
'edit_callback' => 'MailTemplateEdit(id);',
'show_callback' => 'MailTemplateView(id)',
])
</x-card>
@component('components.layout.modal-filters', ['title' => 'Filters', 'id' => 'modal-mail_templates-filters'])
@include('admin.Core.Mail.MailTemplate.partials.filters', ['model' => 'mail_templates'])
@endcomponent
@endsection
@include('load.form.datepicker')
@include('load.form.select2')
@include('load.form.editor')
@include('load.form.upload.fileinput')
@push('js')
<script>
function MailTemplateCreate() {
var url_open = "{{ route('Admin.Core.Mail.MailTemplate.modalCreate') }}";
var url_save = "{{ route('Admin.Core.Mail.MailTemplate.storeAjax') }}";
openModal("{{ __('Core.mail_templates.add') }}", '#mail_template-form', url_open, url_save, "MailTemplateRefresh();", "xl");
}
function MailTemplateEdit(id) {
var url_open = "{{ route('Admin.Core.Mail.MailTemplate.modalEdit') }}/" + id;
var url_save = "{{ route('Admin.Core.Mail.MailTemplate.storeAjax') }}";
openModal("{{ __('Core.mail_templates.edit') }}", '#mail_template-form', url_open, url_save, "MailTemplateRefresh();", "xl");
}
function MailTemplateView(id) {
var url_open = "{{ route('Admin.Core.Mail.MailTemplate.modalPreview') }}/" + id;
openModal("{{ __('Core.preview') }}", '#preview_template-form', url_open);
}
function MailTemplateRefresh()
{
reloadDatatable("mail_templates");
}
$(document).ready(function () {
initSelect2();
});
</script>
@endpush

View File

@@ -0,0 +1,123 @@
{{ Form::open(['route' => 'Admin.Core.Mail.MailTemplate.storeAjax', 'id' => 'mail_template-form', 'autocomplete' => 'off', 'files' => true]) }}
<input type="hidden" id="id" name="id" value="{{ $mail_template['id'] ?? null }}">
<div class="row mb-3">
<div class="col-3">
@include('components.form.input', [
'name' => 'name',
'value' => $mail_template['name'] ?? '',
'label' => __('Core.name'),
'required' => true,
])
</div>
<div class="col-3">
@include('components.form.select', [
'name' => 'mailable',
'value' => $mail_template['mailable'] ?? '',
'list' => $mailables ?? [],
'label' => __('Core.mailables'),
'with_empty' => '',
'required' => true,
])
</div>
<div class="col-4">
<div id="mail_template-vars">
@include('admin.Core.Mail.MailTemplate.partials.vars', ['vars' => $mail_template['vars'] ?? []])
</div>
</div>
<div class="col-2 text-right">
<label>@lang('Core.change_to')</label><br/>
<img id="lang_en" class="lang" data-lang="en" role="button" src="{{ asset('vendor/blade-flags/language-en.svg') }}" width="32" height="32"/>
<img id="lang_fr" class="lang d-none" data-lang="fr" role="button" src="{{ asset('vendor/blade-flags/language-fr.svg') }}" width="32" height="32"/>
</div>
</div>
<div id="mode_fr" class="">
<div class="row mb-3">
<div class="col-6">
@include('components.form.input', [
'name' => 'subject[fr]',
'value' => $mail_template['subject_translations']['fr'] ?? '',
'label' => __('Core.subject'),
'required' => true,
])
</div>
</div>
<div class="row mb-3">
<div class="col-12">
@include('components.form.editor', [
'name' => 'html_template[fr]',
'value' => $mail_template['html_template_translations']['fr'] ?? '',
'label' => 'HTML',
'rows' => 10,
])
</div>
</div>
<div class="row mb-3">
<div class="col-12">
@include('components.form.textarea', [
'name' => 'text_template[fr]',
'value' => $mail_template['text_template_translations']['fr'] ?? '',
'label' => 'Text',
])
</div>
</div>
</div>
<div id="mode_en" class="d-none">
<div class="row mb-3">
<div class="col-6">
@include('components.form.input', [
'name' => 'subject[en]',
'value' => $mail_template['subject_translations']['en'] ?? '',
'label' => __('Core.subject'),
'required' => true,
])
</div>
<div class ="col-6">
</div>
</div>
<div class="row mb-3">
<div class="col-12">
@include('components.form.editor', [
'name' => 'html_template[en]',
'value' => $mail_template['html_template_translations']['en'] ?? '',
'label' => 'HTML',
'rows' => 10,
])
</div>
</div>
<div class="row mb-3">
<div class="col-12">
@include('components.form.textarea', [
'name' => 'text_template[en]',
'value' => $mail_template['text_template_translations']['en'] ?? '',
'label' => 'Text',
])
</div>
</div>
</div>
{{ Form::close() }}
<script>
$(function() {
initSelect2();
initEditor();
$('.lang').click(function() {
var lang = $(this).data('lang');
$('#mode_en').toggleClass('d-none');
$('#mode_fr').toggleClass('d-none');
$('#lang_en').toggleClass('d-none');
$('#lang_fr').toggleClass('d-none');
});
});
</script>

View File

@@ -0,0 +1,3 @@
<form id="{{ $model }}-filters">
</form>

View File

@@ -0,0 +1,37 @@
{{ Form::open(['route' => 'Admin.Core.Mail.MailTemplate.storeAjax', 'id' => 'preview_template-form', 'autocomplete' => 'off', 'files' => true]) }}
<input type="hidden" name="id" id="template_id" value="{{ $id ?? null }}">
<div class="row mb-3">
<div class="col-6">
@include('components.form.select', [
'id_name' => 'user_id',
'name' => 'user_id',
'list' => $users,
'class' => 'select2',
'with_empty' => '',
'label' => __('Core.users.name'),
])
</div>
</div>
<x-card title="Preview">
<div id="previewTemplate"></div>
</x-card>
{{ Form::close() }}
<script>
initSelect2();
$('#user_id').change(function() {
console.log('ici');
var user_id = $(this).find(":selected").val();
var template_id = $('#template_id').val();
console.log(user_id);
console.log(template_id);
var url = "{{ route('Admin.Core.Mail.MailTemplate.preview') }}/" + template_id + '/' + user_id;
$.get(url, function(data) {
$('#previewTemplate').html(data);
});
})
</script>

View File

@@ -0,0 +1,8 @@
@if ($vars)
<label>
@lang('Core.variables')
</label><br>
@foreach ($vars as $var)
<span class="badge badge-pill badge-light mr-2">{{ $var }}</span>
@endforeach
@endif

View File

@@ -1,3 +1,14 @@
<div class="row">
<div class="col-4">
{{ Form::label('product_type', 'Famille de produit') }}
@include('components.form.select', [
'name' => 'product_type',
'value' => $article_nature['product_type'] ?? null,
'list' => $product_types ?? null,
'required' => true,
])
</div>
</div>
<div class="row">
<div class="col-md-8">
<div class="row mb-3">

View File

@@ -10,6 +10,6 @@
<input type="hidden" name="id" id="id" value="{{ $article['id'] ?? null }}">
@include('Admin.Shop.Articles.form')
</form>
{{ Form::close() }}
@endsection

View File

@@ -25,17 +25,6 @@
])
</div>
<div class="col-3">
{{ Form::label('ref', 'Référence') }}<br>
@include('components.form.input', ['name' => 'ref', 'value' => $article['ref'] ?? null])
</div>
</div>
<div class="row mb-3">
<div class="col-8">
{{ Form::label('name', 'Nom') }}<br>
@include('components.form.input', ['name' => 'name', 'value' => $article['name'] ?? null, 'required' => true])
</div>
<div class="col-4">
{{ Form::label('article_nature_id', __('shop.article_natures.name')) }}<br>
@include('components.form.select', [
'name' => 'article_nature_id',
@@ -49,6 +38,17 @@
</div>
</div>
<div class="row mb-3">
<div class="col-8">
{{ Form::label('name', 'Nom') }}<br>
@include('components.form.input', ['name' => 'name', 'value' => $article['name'] ?? null, 'required' => true])
</div>
<div class="col-4">
{{ Form::label('ref', 'Référence') }}<br>
@include('components.form.input', ['name' => 'ref', 'value' => $article['ref'] ?? null])
</div>
</div>
<div class="row mb-3">
<div class="col-8">
{{ Form::label('categories', __('shop.shelves.title')) }}<br>
@@ -156,25 +156,37 @@
switch (product_type) {
case 'App\\Models\\Botanic\\Specie':
var url = '{{ route('Admin.Botanic.Species.getSelect') }}';
var product_type = 1;
break;
case 'App\\Models\\Botanic\\Variety':
var url = '{{ route('Admin.Botanic.Varieties.getSelect') }}';
var product_type = 1;
break;
case 'App\\Models\\Shop\\Merchandise':
var url = '{{ route('Admin.Shop.Merchandises.getSelect') }}';
var product_type = 2;
break;
}
loadProducts(url);
var url = '{{ route('Admin.Shop.ArticleNatures.getOptions') }}';
loadArticleNatures(url);
});
function loadArticleNatures(url) {
$.ajax({
url : url,
method : 'POST',
data: {product_type: $('#product_type').val()},
success : function(data) {
setOptions('#article_nature_id', data);
// $("#product_id").select2({data: data});
// $("#product_id").trigger('change');
}
});
}
function loadProducts(url) {
$.ajax({
url : url,
method : 'POST',
data: {model: $('#product_type').val()},
data: {article_nature_id: $('#article_nature_id').val()},
success : function(data) {
setOptions('#product_id', data);
// $("#product_id").select2({data: data});

View File

@@ -11,7 +11,7 @@
@if ($inherited['tags'])
<h6> Tags</h6>
@foreach ($inherited['tags'] as $tag)
<button type="button" class="btn btn-secondary btn-xs">{{ $tag['tag_group']['name'] }}-{{ $tag['name'] ?? $tag['name'] }}</button>
<button type="button" class="btn btn-secondary btn-xs">{{ $tag['tag_group']['name'] ?? '' }}-{{ $tag['name'] ?? '' }}</button>
@endforeach
@endif
@endcomponent

View File

@@ -3,7 +3,7 @@
'data' => $article['offers']['semences'],
'title' => 'Semence',
'model' => 'semences',
'bgClass' => 'bg-yellow',
'bgClass' => 'bg-green-light',
])
@endif
@@ -12,7 +12,7 @@
'data' => $article['offers']['plants'],
'title' => 'Plant',
'model' => 'plants',
'bgClass' => 'bg-green-dark',
'bgClass' => 'bg-green-light',
])
@endif
@@ -21,6 +21,7 @@
'data' => $article['offers']['legumes'],
'title' => 'Légume',
'model' => 'legumes',
'bgClass' => 'bg-green-light',
])
@endif

View File

@@ -1,4 +1,4 @@
<a href="{{ route('Shop.Articles.show', ['id' => $article['semences']['article_id'] ?? false ]) }}" class="{{ ($product_type == 'botanic') ? 'green-dark' : 'green-dark' }}">
<a href="{{ route('Shop.Articles.show', ['id' => $article['id'] ?? false ]) }}" class="green-dark">
<div class="card">
<img src="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" class="card-img-top" alt="{{ $product_name }}">
<div class="card-body p-2 pb-1">
@@ -9,7 +9,7 @@
</div>
</div>
@include('Shop.Articles.partials.article_' . $product_type)
<button type="button" class="btn btn-link bg-green text-white w-100">
<button type="button" class="btn btn-link bg-green text-white w-100" data-id=="{{ $article['id'] }}">
Ajout rapide
</button>
</div>

View File

@@ -9,12 +9,12 @@
</div>
</div>
<div class="row">
<div class="col-4">
<div class="col-lg-4 col-xs-12">
<div style="max-width: 360px;">
@include('components.multi-images', ['images' => $article['images']])
@include('components.multi-images', ['image' => $article['image'], 'images' => $article['images']])
</div>
</div>
<div class="col-5 text-justify">
<div class="col-lg-5 col-xs-12 text-justify">
{!! $article['description']['semences'] ?? null !!}
{!! $article['description']['plants'] ?? null !!}
{!! $article['description']['variety'] ?? null !!}
@@ -44,7 +44,7 @@
@endif
</div>
<div class="col-3">
<div class="col-lg-3 col-xs-12">
@include('Shop.Articles.partials.ArticleAddBasket')
</div>
</div>

View File

@@ -1,4 +1,31 @@
<div class="row">
<div class="row mb-3">
<div class="col-4">
<div class="row h-100 products @if($article_nature == 1) shadow2 @endif" data-id="semences">
<div class="col-lg-6 col-xs-12">
<img src="/img/article_natures/semences.png" class="img-fluid">
</div>
<div class="col-lg-6 col-xs-12 green-dark" style="font-size: 2rem;"> Semences </div>
</div>
</div>
<div class="col-4">
<div class="row h-100 products @if($article_nature == 2) shadow2 @endif" data-id="plants">
<div class="col-lg-6 col-xs-12">
<img src="/img/article_natures/plants.png" class="img-fluid" class="img-fluid">
</div>
<div class="col-lg-6 col-xs-12 green-dark" style="font-size: 2rem;"> Plants </div>
</div>
</div>
<div class="col-4">
<div class="row h-100 products @if($article_nature == 3) shadow2 @endif" data-id="legumes">
<div class="col-lg-6 col-xs-12">
<img src="/img/article_natures/legumes.png" class="img-fluid" class="img-fluid">
</div>
<div class="col-lg-6 col-xs-12 green-dark" style="font-size: 2rem;"> Légumes </div>
</div>
</div>
</div>
<div class="row d-none">
<div class="col-12 text-right">
@include('components.form.button', [
'data_id' => 'semences',
@@ -12,7 +39,6 @@
'class' => 'products bg-green text-white' . (($article_nature == 'plants') ? ' d-none' : ''),
'title' => 'Par plants',
])
</div>
</div>

View File

@@ -1,11 +1,9 @@
<div class="row">
@if ($articles ?? false)
@foreach ($articles as $product_name => $article)
@if ((($product_type == 'botanic') && (($article['semences'] ?? false) || ($article['plants'] ?? false))) || (($product_type == 'merchandise') &&($article['mercchandises'] ?? false)))
<div class="col-3 mb-3">
@include('Shop.Articles.partials.article')
</div>
@endif
<div class="col-lg-3 col-xs-12 mb-3">
@include('Shop.Articles.partials.article')
</div>
@endforeach
@endif
</div>

View File

@@ -17,14 +17,6 @@
@include('Shop.Shelves.partials.display-type')
</div>
</div>
<div class="row">
<div class="col-3">
@include('Shop._partials.display_filters')
</div>
<div class="col-9">
@include('Shop.Shelves.partials.category_add')
</div>
</div>
<div class="row">
<div class="col-12">
@@ -32,8 +24,17 @@
</div>
</div>
<div class="row">
<div class="col-12">
@include('Shop.Shelves.partials.category_add')
</div>
</div>
<div class="mb-3">
@include('Shop._partials.display_filters')
</div>
@include('Shop.Tags.partials.filter')
@if ($display_by_rows ?? false)
@include('Shop.Shelves.partials.category_articles_rows')
@else

View File

@@ -1,6 +1,8 @@
<a href="{{ route('Shop.Basket.basket') }}" class="text-white">
<button type="button" class="btn green p-0">
<i class="fa fa-2x fa-fw fa-shopping-basket mr-2"></i>
<button type="button" class="btn green-dark p-0">
<img src="/img/header/basket.svg" width="36px">
<span class="ml-2 badge bg-yellow green-dark">
<span id="count-basket">{{ \App\Repositories\Core\User\ShopCart::getTotalQuantity() }}</span>
Articles

View File

@@ -1,5 +1,5 @@
<a href="https://www.jardinenvie.com/boutique/commander">
<button type="button" class="btn bg-light green p-0">
<i class="fa fa-2x fa-fw fa-book-open"></i>
<button type="button" class="btn bg-light green-dark p-0">
<img src="/img/header/catalogue.svg" width="36px">
</button>
</a>

View File

@@ -1,8 +1,8 @@
<button type="button" class="btn bg-light green p-0" data-toggle="dropdown">
<button type="button" class="btn bg-light green-dark p-0" data-toggle="dropdown">
@if (App\Repositories\Shop\Customers::isConnected())
<img src="{{ App\Repositories\Shop\Customers::getAvatar() }}" class="img-fluid" title="{{ App\Repositories\Shop\Customers::getName() }}">
@else
<i class="fa fa-2x fa-fw fa-user"></i>
<img src="/img/header/login.svg" width="36px">
@endif
</button>

View File

@@ -5,11 +5,9 @@
<div class="container p-0">
<div class="row m-0 shadow bg-white p-2 w-100">
<div class="col mb-4">
<strong>
<a class="green-dark @if (($category['id'] ?? false) == $menu['id']) active @endif" href="{{ route('Shop.Categories.show', ['id' => $menu['id']]) }}">
Tous les articles
</a>
</strong><br>
<a class="green-dark @if (($category['id'] ?? false) == $menu['id']) active @endif" href="{{ route('Shop.Categories.show', ['id' => $menu['id']]) }}">
<div class="w-100"><strong>Tous les articles</strong></div>
</a>
@for ($i = 0; $i < count($submenu[0]); $i++)
@include('Shop.layout.partials.megamenu_leafs', ['menu_children' => $submenu[0][$i]])
@endfor

View File

@@ -1,8 +1,6 @@
<strong>
<a class="green-dark @if (($category['id'] ?? false) == $menu_children['id']) active @endif" href="{{ route('Shop.Categories.show', ['id' => $menu_children['id']]) }}">
{{ $menu_children['name'] }}
</a>
</strong><br>
<a class="green-dark @if (($category['id'] ?? false) == $menu_children['id']) active @endif" href="{{ route('Shop.Categories.show', ['id' => $menu_children['id']]) }}">
<div class="w-100"><strong>{{ $menu_children['name'] }}</strong></div>
</a>
@foreach ($menu_children['children'] ?? [] as $leaf)
<a class="green-dark @if (($category['id'] ?? false) == $leaf['id']) active @endif" href="{{ route('Shop.Categories.show', ['id' => $leaf['id']]) }}">
<div class="w-100">{{ $leaf['name'] }}</div>

View File

@@ -1,8 +1,14 @@
<div class="sp-loading"><img src="images/sp-loading.gif" alt=""><br>LOADING IMAGES</div>
<div class="sp-wrap" style="width: 100%;">
@foreach ($images as $image)
<a href="{{ App\Repositories\Core\Images::getImageSrc($image) }}"><img src="{{ App\Repositories\Core\Images::getNormalSrc($image) }}"></a>
@endforeach
@if ($images)
@foreach ($images as $image)
<a href="{{ App\Repositories\Core\Images::getImageSrc($image) }}">
<img src="{{ App\Repositories\Core\Images::getNormalSrc($image) }}" class="img-fluid">
</a>
@endforeach
@else
<img src="{{ $image }}" class="img-fluid">
@endif
</div>
@push('js')

View File

@@ -1,42 +1,90 @@
@if(!defined('LOAD_TINYMCE'))
@push('js')
<script src="{!! asset('/assets/plugins/tinymce/jquery.tinymce.min.js') !!}"></script>
<script src="{!! asset('/assets/plugins/tinymce/tinymce.min.js') !!}"></script>
<script>
tinymce.defaultSettings = {
plugins: "autoresize fullscreen codemirror link lists table media image imagetools paste customalign stickytoolbar",
toolbar: "undo redo | styleselect | bold italic underline | customalignleft aligncenter customalignright | link media image | bullist numlist | table | code fullscreen",
contextmenu: "link image imagetools table spellchecker bold italic underline",
sticky_toolbar_container: '.tox-editor-header',
toolbar_drawer: "sliding",
sticky_offset: $('nav.main-header').outerHeight(),
codemirror: { config: { theme: 'storm' } },
menubar: false,
removed_menuitems: 'newdocument',
remove_linebreaks: false,
forced_root_block: false,
force_p_newlines: true,
relative_urls: false,
verify_html: false,
branding: false,
statusbar: false,
browser_spellcheck: true,
encoding: 'UTF-8',
image_uploadtab: false,
paste_preprocess: function(plugin, args) {
args.content = args.content.replace(/<(\/)*(\\?xml:|meta|link|span|font|del|ins|st1:|[ovwxp]:)((.|\s)*?)>/gi, ''); // Unwanted tags
args.content = args.content.replace(/\s(class|style|type|start)=("(.*?)"|(\w*))/gi, ''); // Unwanted attributes
args.content = args.content.replace(/<(p|a|div|span|strike|strong|i|u)[^>]*?>(\s|&nbsp;|<br\/>|\r|\n)*?<\/(p|a|div|span|strike|strong|i|u)>/gi, ''); // Empty tags
},
skin : "boilerplate",
language: '{{ App::getLocale() }}'
};
<script src="/assets/plugins/tinymce/jquery.tinymce.min.js"></script>
<script src="/assets/plugins/tinymce/tinymce.min.js"></script>
@component('boilerplate::minify')
<script>
function initEditor(sel) {
var selector = (typeof(sel) == 'undefined') ? '.editor' : sel;
$(selector).tinymce({});
}
</script>
tinymce.defaultSettings = {
path_absolute : "/",
plugins: "autolink autoresize fullscreen codemirror link lists table media preview image paste customalign stickytoolbar",
toolbar: "insertfile undo redo | styleselect | bold italic underline | customalignleft aligncenter customalignright | link media image | bullist numlist | table | code fullscreen",
contextmenu: "link image imagetools table spellchecker bold italic underline",
sticky_toolbar_container: '.tox-editor-header',
toolbar_drawer: "sliding",
sticky_offset: $('nav.main-header').outerHeight(),
codemirror: { config: { theme: 'storm' } },
menubar: false,
removed_menuitems: 'newdocument',
remove_linebreaks: false,
forced_root_block: false,
force_p_newlines: true,
relative_urls: false,
verify_html: false,
branding: false,
statusbar: false,
browser_spellcheck: true,
encoding: 'UTF-8',
image_uploadtab: false,
paste_preprocess: function(plugin, args) {
args.content = args.content.replace(/<(\/)*(\\?xml:|meta|link|span|font|del|ins|st1:|[ovwxp]:)((.|\s)*?)>/gi, ''); // Unwanted tags
args.content = args.content.replace(/\s(class|style|type|start)=("(.*?)"|(\w*))/gi, ''); // Unwanted attributes
args.content = args.content.replace(/<(p|a|div|span|strike|strong|i|u)[^>]*?>(\s|&nbsp;|<br\/>|\r|\n)*?<\/(p|a|div|span|strike|strong|i|u)>/gi, ''); // Empty tags
},
skin : "boilerplate",
language: '{{ App::getLocale() }}',
file_picker_callback : function(callback, value, meta) {
var x = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;
var y = window.innerHeight|| document.documentElement.clientHeight|| document.getElementsByTagName('body')[0].clientHeight;
var cmsURL = tinymce.defaultSettings.path_absolute + 'filemanager?editor=' + meta.fieldname;
if (meta.filetype == 'image') {
cmsURL = cmsURL + "&type=Images";
} else {
cmsURL = cmsURL + "&type=Files";
}
tinyMCE.activeEditor.windowManager.openUrl({
url : cmsURL,
title : 'Filemanager',
width : x * 0.8,
height : y * 0.8,
resizable : "yes",
close_previous : "no",
onMessage: (api, message) => {
callback(message.content);
}
});
}
};
// Prevent Bootstrap dialog from blocking focusin
$(document).on('focusin', function(e) {
if ($(e.target).closest(".tox-tinymce, .tox-tinymce-aux, .moxman-window, .tam-assetmanager-root").length) {
e.stopImmediatePropagation();
}
});
function initEditor(sel, options) {
var selector = (typeof(sel) == 'undefined') ? '.editor' : sel;
var options = (typeof(options) == 'undefined') ? {} : options;
var setup = {
setup: function(ed) {
if ($('#'+ed.id).prop('readonly')) {
ed.settings.readonly = true;
}
}
};
options = Object.assign(options, setup);
for (var i = tinymce.editors.length - 1 ; i > -1 ; i--) {
tinyMCE.execCommand("mceRemoveEditor", true, tinymce.editors[i].id);
}
$(selector).tinymce(options);
}
</script>
@endcomponent
@endpush
@php(define('LOAD_TINYMCE', true))
@endif

View File

@@ -0,0 +1,6 @@
<?php
Route::prefix('MailLog')->name('MailLog.')->group(function () {
Route::match(['get', 'post'], '', 'MailLogController@index')->name('index');
Route::get('show/{id?}', 'MailLogController@show')->name('show');
});

View File

@@ -0,0 +1,12 @@
<?php
Route::prefix('MailTemplate')->name('MailTemplate.')->group(function () {
Route::any('destroy/{id?}', 'MailTemplateController@destroy')->name('delete');
Route::get('modalCreate', 'MailTemplateController@modalCreate')->name('modalCreate');
Route::any('modalEdit/{id?}', 'MailTemplateController@modalEdit')->name('modalEdit');
Route::post('storeAjax', 'MailTemplateController@storeAjax')->name('storeAjax');
Route::any('', 'MailTemplateController@index')->name('index');
Route::get('getVars/{mailable?}', 'MailTemplateController@getVarsByMailable')->name('getVarsByMailable');
Route::get('preview/{template_id?}/{user_id?}', 'MailTemplateController@preview')->name('preview');
Route::get('modalPreview/{template_id?}', 'MailTemplateController@modalPreview')->name('modalPreview');
});

View File

@@ -0,0 +1,6 @@
<?php
Route::prefix('Mail')->name('Mail.')->namespace('Mail')->group(function () {
include __DIR__.'/MailLog.php';
include __DIR__.'/MailTemplate.php';
});

View File

@@ -2,4 +2,5 @@
Route::prefix('Core')->namespace('Core')->name('Core.')->group(function () {
include( __DIR__ . '/Comments.php');
include( __DIR__ . '/Mail/route.php');
});

View File

@@ -6,5 +6,5 @@ Route::prefix('ArticleNatures')->name('ArticleNatures.')->group(function () {
Route::delete('destroy/{id?}', 'ArticleNatureController@destroy')->name('destroy');
Route::post('store', 'ArticleNatureController@store')->name('store');
Route::get('edit/{id}', 'ArticleNatureController@edit')->name('edit');
Route::get('getOptions/{id}', 'ArticleNatureController@getOptions')->name('getOptions');
Route::post('getOptions', 'ArticleNatureController@getOptions')->name('getOptions');
});