From f5ca57fdf2ab0a38ef3efd5db70a4d7430bcab9e Mon Sep 17 00:00:00 2001 From: Ludovic CANDELLIER Date: Sun, 11 Apr 2021 00:36:41 +0200 Subject: [PATCH] Add preview from father, add new features --- app/Http/Controllers/Admin/HomeController.php | 26 +- .../Botanic/Admin/FamilyController.php | 72 +++--- .../Controllers/Shop/Admin/HomeController.php | 36 +-- app/Http/Controllers/Shop/HomeController.php | 44 ++-- app/Repositories/Botanic/Varieties.php | 50 +--- app/Repositories/Core/DateRange.php | 241 +++++++++++------- app/Repositories/Core/DateTime.php | 168 +++++++++--- app/Repositories/Core/Mailer.php | 33 +++ app/Repositories/Core/Media.php | 56 ++++ app/Repositories/Core/Tag.php | 25 ++ app/Repositories/Core/Tags.php | 55 ---- app/Repositories/Core/Upload.php | 217 ++++++++++------ app/Repositories/Core/User/Basket.php | 63 +++++ .../Core/User/Notifications/NewUser.php | 66 +++++ .../Core/User/Notifications/ResetPassword.php | 31 +++ app/Repositories/Core/User/PasswordResets.php | 19 ++ app/Repositories/Shop/Articles.php | 70 +---- composer.json | 5 +- package.json | 1 + .../views/Shop/Admin/Articles/edit.blade.php | 2 +- .../partials/characteristics.blade.php | 23 +- .../Admin/Articles/partials/prices.blade.php | 4 +- .../datatables/buttons/exports.blade.php | 9 - .../datatables/js/datatable.blade.php | 6 +- .../components/form/autocomplete.blade.php | 2 +- .../components/form/datepicker.blade.php | 2 +- .../views/components/form/editor.blade.php | 2 +- .../views/components/form/percent.blade.php | 2 +- .../views/components/form/tags.blade.php | 2 +- .../views/components/form/toggle.blade.php | 5 +- .../components/layout/box-collapse.blade.php | 2 +- .../uploader/block_image_new.blade.php | 8 +- .../uploader/mini-gallery-items.blade.php | 28 +- .../uploader/mini-gallery.blade.php | 20 +- .../components/uploader/widget.blade.php | 44 ++-- resources/views/home.blade.php | 5 +- .../layouts/partials/site/topbar.blade.php | 1 - resources/views/load/form/appender.blade.php | 77 ++++++ .../load/{ => form}/autocomplete.blade.php | 0 .../load/form/builder/formbuilder.blade.php | 6 + .../views/load/form/builder/formio.blade.php | 9 + .../views/load/form/check_fields.blade.php | 39 +++ resources/views/load/form/color.blade.php | 22 ++ .../load/{ => form}/datepicker.blade.php | 0 resources/views/load/form/duallist.blade.php | 25 ++ .../views/load/form/editor/editor.blade.php | 15 ++ .../views/load/form/editor/tinymce.blade.php | 41 +++ resources/views/load/form/select2.blade.php | 18 ++ .../views/load/form/set_options.blade.php | 25 ++ resources/views/load/form/toggle.blade.php | 34 +++ .../load/form/upload/fileinput.blade.php | 25 ++ .../views/load/form/upload/upload.blade.php | 29 +++ resources/views/load/form/url.blade.php | 16 ++ .../views/load/{ => layout}/chevron.blade.php | 0 resources/views/load/layout/modal.blade.php | 114 +++++++++ .../views/load/layout/nicescroll.blade.php | 29 +++ .../views/load/layout/slimscroll.blade.php | 6 + resources/views/load/layout/tabs.blade.php | 39 +++ 58 files changed, 1482 insertions(+), 532 deletions(-) create mode 100644 app/Repositories/Core/Mailer.php create mode 100644 app/Repositories/Core/Media.php create mode 100644 app/Repositories/Core/Tag.php delete mode 100644 app/Repositories/Core/Tags.php create mode 100644 app/Repositories/Core/User/Basket.php create mode 100644 app/Repositories/Core/User/Notifications/NewUser.php create mode 100644 app/Repositories/Core/User/Notifications/ResetPassword.php create mode 100644 app/Repositories/Core/User/PasswordResets.php delete mode 100644 resources/views/components/datatables/buttons/exports.blade.php create mode 100644 resources/views/load/form/appender.blade.php rename resources/views/load/{ => form}/autocomplete.blade.php (100%) create mode 100644 resources/views/load/form/builder/formbuilder.blade.php create mode 100644 resources/views/load/form/builder/formio.blade.php create mode 100644 resources/views/load/form/check_fields.blade.php create mode 100644 resources/views/load/form/color.blade.php rename resources/views/load/{ => form}/datepicker.blade.php (100%) create mode 100644 resources/views/load/form/duallist.blade.php create mode 100644 resources/views/load/form/editor/editor.blade.php create mode 100644 resources/views/load/form/editor/tinymce.blade.php create mode 100644 resources/views/load/form/select2.blade.php create mode 100644 resources/views/load/form/set_options.blade.php create mode 100644 resources/views/load/form/toggle.blade.php create mode 100644 resources/views/load/form/upload/fileinput.blade.php create mode 100644 resources/views/load/form/upload/upload.blade.php create mode 100644 resources/views/load/form/url.blade.php rename resources/views/load/{ => layout}/chevron.blade.php (100%) create mode 100644 resources/views/load/layout/modal.blade.php create mode 100644 resources/views/load/layout/nicescroll.blade.php create mode 100644 resources/views/load/layout/slimscroll.blade.php create mode 100644 resources/views/load/layout/tabs.blade.php diff --git a/app/Http/Controllers/Admin/HomeController.php b/app/Http/Controllers/Admin/HomeController.php index 8586dcb7..cdf19022 100644 --- a/app/Http/Controllers/Admin/HomeController.php +++ b/app/Http/Controllers/Admin/HomeController.php @@ -7,23 +7,13 @@ use App\Http\Controllers\Controller; class HomeController extends Controller { - /** - * Create a new controller instance. - * - * @return void - */ - public function __construct() - { - $this->middleware('auth'); - } + public function __construct() + { + $this->middleware('auth'); + } - /** - * Show the application dashboard. - * - * @return \Illuminate\Contracts\Support\Renderable - */ - public function index() - { - // return redirect('dashboard'); - } + public function index() + { + return view('home'); + } } diff --git a/app/Http/Controllers/Botanic/Admin/FamilyController.php b/app/Http/Controllers/Botanic/Admin/FamilyController.php index 20d3bb7d..d0e21465 100644 --- a/app/Http/Controllers/Botanic/Admin/FamilyController.php +++ b/app/Http/Controllers/Botanic/Admin/FamilyController.php @@ -11,48 +11,48 @@ use App\Datatables\Botanic\FamiliesDataTable; class FamilyController extends Controller { - public function index(FamiliesDataTable $dataTable) - { - return $dataTable->render('Botanic.Admin.Families.list'); - } + public function index(FamiliesDataTable $dataTable) + { + return $dataTable->render('Botanic.Admin.Families.list'); + } - public function getDatatable(Request $request) - { - return Families::getTables($request->all()); - } + public function getDatatable(Request $request) + { + return Families::getTables($request->all()); + } - public function create() - { - $data = []; - return view('Botanic.Admin.Families.create', $data); - } + public function create() + { + $data = []; + return view('Botanic.Admin.Families.create', $data); + } - public function store(Request $request) - { - $ret = Families::store($request); - return redirect()->route('Botanic.Admin.Families.index'); - } + public function store(Request $request) + { + $ret = Families::store($request); + return redirect()->route('Botanic.Admin.Families.index'); + } - public function show($id) - { - $data = Families::get($id); - return view('Botanic.Admin.Families.view', $data); - } + public function show($id) + { + $data = Families::get($id); + return view('Botanic.Admin.Families.view', $data); + } - public function edit($id) - { - $data['family'] = Families::get($id)->toArray(); - return view('Botanic.Admin.Families.edit', $data); - } + public function edit($id) + { + $data['family'] = Families::get($id)->toArray(); + return view('Botanic.Admin.Families.edit', $data); + } - public function destroy($id) - { - return Families::destroy($id); - } + public function destroy($id) + { + return Families::destroy($id); + } - public function exportExcel() - { - return Families::exportExcel(); - } + public function exportExcel() + { + return Families::exportExcel(); + } } diff --git a/app/Http/Controllers/Shop/Admin/HomeController.php b/app/Http/Controllers/Shop/Admin/HomeController.php index 9507f89b..48675fad 100644 --- a/app/Http/Controllers/Shop/Admin/HomeController.php +++ b/app/Http/Controllers/Shop/Admin/HomeController.php @@ -7,23 +7,23 @@ use App\Http\Controllers\Controller; class HomeController extends Controller { - /** - * Create a new controller instance. - * - * @return void - */ - public function __construct() - { - $this->middleware('auth'); - } + /** + * Create a new controller instance. + * + * @return void + */ + public function __construct() + { + $this->middleware('auth'); + } - /** - * Show the application dashboard. - * - * @return \Illuminate\Contracts\Support\Renderable - */ - public function index() - { - return redirect('dashboard'); - } + /** + * Show the application dashboard. + * + * @return \Illuminate\Contracts\Support\Renderable + */ + public function index() + { + return redirect('dashboard'); + } } diff --git a/app/Http/Controllers/Shop/HomeController.php b/app/Http/Controllers/Shop/HomeController.php index 8836a637..a042d567 100644 --- a/app/Http/Controllers/Shop/HomeController.php +++ b/app/Http/Controllers/Shop/HomeController.php @@ -10,27 +10,27 @@ use App\Repositories\Shop\Categories; class HomeController extends Controller { - /** - * Create a new controller instance. - * - * @return void - */ - public function __construct() - { - // $this->middleware('auth'); - } + /** + * Create a new controller instance. + * + * @return void + */ + public function __construct() + { + // $this->middleware('auth'); + } - /** - * Show the application dashboard. - * - * @return \Illuminate\Contracts\Support\Renderable - */ - public function index() - { - $data['categories'] = Categories::getTree(); - $data['category'] = Categories::get(15)->toArray(); - $data['articles'] = Articles::getByCategory(0)->toArray(); - // dump($data); - return view('Shop.home', $data); - } + /** + * Show the application dashboard. + * + * @return \Illuminate\Contracts\Support\Renderable + */ + public function index() + { + $data['categories'] = Categories::getTree(); + $data['category'] = Categories::get(15)->toArray(); + $data['articles'] = Articles::getByCategory(0)->toArray(); + // dump($data); + return view('Shop.home', $data); + } } diff --git a/app/Repositories/Botanic/Varieties.php b/app/Repositories/Botanic/Varieties.php index 7f0d8113..f9d708f5 100644 --- a/app/Repositories/Botanic/Varieties.php +++ b/app/Repositories/Botanic/Varieties.php @@ -2,25 +2,18 @@ namespace App\Repositories\Botanic; -use Illuminate\Support\Facades\Storage; -use Illuminate\Support\Facades\DB; use Illuminate\Support\Str; -use Yajra\DataTables\DataTables; use Maatwebsite\Excel\Facades\Excel; +use App\Repositories\Core\Tag; +use App\Repositories\Core\Media; use App\Models\Botanic\Variety; use App\Exports\Botanic\VarietiesExport; class Varieties { - public static function getDatatable() - { - $model = Variety::with('specie'); - return Datatables::of($model)->make(true); - } - public static function getOptions() { return Variety::orderBy('name')->get()->pluck('name','id')->toArray(); @@ -30,8 +23,7 @@ class Varieties { $varieties = Variety::with('specie')->get(); $data = []; - foreach ($varieties as $variety) - { + foreach ($varieties as $variety) { $data[$variety->id] = (isset($variety->specie->name) ? $variety->specie->name . ' ' : '') . $variety->name; } asort($data, SORT_NATURAL | SORT_FLAG_CASE); @@ -45,7 +37,7 @@ class Varieties public static function get($id) { - return Variety::find($id); + return Variety::findOrFail($id); } public static function getFull($id) @@ -58,8 +50,7 @@ class Varieties public static function getTagsByVariety($variety) { - $tags = $variety->tags; - return $tags ? $tags->pluck('id')->toArray() : null; + return Tag::getTagsByModel($variety); } @@ -89,7 +80,7 @@ class Varieties public static function update($data, $id = false) { $id = $id ? $id : $data['id']; - $variety = Variety::find($id); + $variety = self::get($id); $ret = $variety->update($data); return $variety; } @@ -101,43 +92,22 @@ class Varieties public static function storeTags($variety, $tags) { - if ($tags) { - $tags = collect($tags)->transform(function ($item, $key) { - return (int) $item; - })->toArray(); - return $variety->syncTags($tags, true); - } else return false; + return Tag::storeTags($variety, $tags); } public static function storeImages($variety, $files) { - if ($files) { - foreach ($files as $file) { - $variety->addMedia($file)->withResponsiveImages()->toMediaCollection('images'); - } - } + return Media::storeImages($variety, $files); } public static function getImages($id) { - $variety = self::get($id); - if ($variety) { - $variety->getMedia(); - foreach ($variety->media as $key => $media) { - $variety->media[$key]['url'] = $media->getUrl(); - } - return $variety->media; - } else { - return false; - } + return Media::getImages(self::get($id)); } public static function deleteImage($id, $index) { - $variety = self::get($id); - $variety->getMedia(); - $ret = $variety->media[$index]->delete(); - return "1"; + return Media::deleteImage(self::get($id), $index); } public static function exportExcel() diff --git a/app/Repositories/Core/DateRange.php b/app/Repositories/Core/DateRange.php index db01073e..0321aaa3 100644 --- a/app/Repositories/Core/DateRange.php +++ b/app/Repositories/Core/DateRange.php @@ -2,113 +2,172 @@ namespace App\Repositories\Core; -use \Carbon\Carbon; -use \League\Period\Period; +use Carbon\Carbon; +use League\Period\Period; +use League\Period\Duration; +use League\Period\Sequence; +use League\Period\Chart\Dataset; +use function League\Period\duration; +use function League\Period\interval_after; class DateRange { - public static function getPeriodsLastMonth($nb) - { - $end = static::lastMonth(); - $begin = $end->copy()->subMonth($nb); - return static::getPeriodsbyMonth($begin, $end); - } - public static function getPeriodsLastWeek($nb) - { - $end = static::lastWeek(); - $begin = $end->copy()->subWeek($nb); - return static::getPeriodsbyWeek($begin, $end); - } + public static function getPeriodsLastMonthWithLabels($nb, $with_actual = true) + { + $periods = DateRange::PeriodsToCarbon(DateRange::getPeriodsLastMonth($nb, $with_actual)); + $labels = DateRange::getMonthNames($periods); + foreach ($labels as $label) { + $data[$label] = $periods; + } + return $data; + } - public static function getPeriodsLastDay($nb) - { - $end = static::lastDay(); - $begin = $end->copy()->subDay($nb); - return static::getPeriodsbyDay($begin, $end); - } + public static function getAllMonthNames() + { + return self::getMonthNames(self::PeriodsToCarbon(self::getPeriodsLastMonth(12))); + } - public static function byDay() - { - return [Carbon::now()->startOfDay(), Carbon::now()->endOfDay()]; - } + public static function getPeriodsLastMonth($nb = 1, $with_actual = true) + { + $end = $with_actual ? Carbon::now()->endOfMonth() : self::lastMonth(); + $begin = ($nb == 1) ? $end->copy()->startOfMonth() : $end->copy()->startOfMonth()->subMonth($nb-1); + $t = self::getPeriodsbyMonth($begin, $end); + return self::getPeriodsbyMonth($begin, $end); + } - public static function byWeek() - { - return [Carbon::now()->startOfWeek(), Carbon::now()->endOfWeek()]; - } + public static function getMonthNamesByPeriods($periods) + { + $months = []; + foreach ($periods as $period) { + $date = self::DatePointToCarbon($period->getStartDate()); + $months[] = DateTime::getMonthName($date); + } + return $months; + } - public static function byMonth() - { - return [Carbon::now()->startOfMonth(), Carbon::now()->endOfMonth()]; - } + public static function getMonthNames($periods) + { + $months = []; + foreach ($periods as $period) { + $months[] = DateTime::getMonthName($period['start']); + } + return $months; + } - public static function byQuarter() - { - return [Carbon::now()->startOfQuarter(), Carbon::now()->endOfQuarter()]; - } + public static function getPeriodsLastWeek($nb = 1, $with_actual = true) + { + $end = $with_actual ? Carbon::now()->endOfWeek() : self::lastWeek(); + $begin = $end->copy()->subWeek($nb); + return static::getPeriodsbyWeek($begin, $end); + } - public static function bySemester() - { - $quarter = Carbon::now()->quarter; - switch ($quarter) { - case 1: - case 2: - $date = Carbon::now()->startOfYear(); - break; - case 3: - $date = Carbon::now()->startOfQuarter(); - break; - case 4: - $date = Carbon::now()->subMonth(3)->startOfQuarter(); - break; - } - return [$date, $date->addMonth(6)]; - } + public static function getPeriodsLastDay($nb = 1, $with_actual = true) + { + $end = $with_actual ? Carbon::now()->endOfDay() : static::lastDay(); + $begin = $end->copy()->subDay($nb); + return static::getPeriodsbyDay($begin, $end); + } - public static function byYear() - { - return [Carbon::now()->startOfYear(), Carbon::now()->endOfYear()]; - } + public static function byDay() + { + return [Carbon::now()->startOfDay(), Carbon::now()->endOfDay()]; + } - public static function lastMonth() - { - $start = Carbon::parse('first day of last month'); - $start->addMonth()->startOfDay(); - return $start; - } + public static function byWeek() + { + return [Carbon::now()->startOfWeek(), Carbon::now()->endOfWeek()]; + } - public static function lastWeek() - { - return Carbon::parse('last monday'); - } + public static function byMonth() + { + return [Carbon::now()->startOfMonth(), Carbon::now()->endOfMonth()]; + } - public static function lastDay() - { - return Carbon::parse('yesterday'); - } + public static function byQuarter() + { + return [Carbon::now()->startOfQuarter(), Carbon::now()->endOfQuarter()]; + } - public static function getPeriodsbyMonth($begin, $end) - { - return (static::getPeriods($begin, $end, 'MONTH')); - } + public static function bySemester() + { + $quarter = Carbon::now()->quarter; + switch ($quarter) { + case 1: + case 2: + $date = Carbon::now()->startOfYear(); + break; + case 3: + $date = Carbon::now()->startOfQuarter(); + break; + case 4: + $date = Carbon::now()->subMonth(3)->startOfQuarter(); + break; + } + return [$date, $date->addMonth(6)]; + } - public static function getPeriodsbyWeek($begin, $end) - { - return (static::getPeriods($begin, $end, 'WEEK')); - } + public static function byYear() + { + return [Carbon::now()->startOfYear(), Carbon::now()->endOfYear()]; + } - public static function getPeriodsbyDay($begin, $end) - { - return (static::getPeriods($begin, $end, 'DAY')); - } + public static function lastMonth() + { + return Carbon::now()->subMonth()->startOfMonth(); + } + + public static function lastWeek() + { + return Carbon::now()->subWeek()->startOfWeek(); + } + + public static function lastDay() + { + return Carbon::now()->subDay()->startOfDay(); + } + + public static function getPeriodsbyMonth($begin, $end, $interval = 1) + { + return self::getPeriods($begin, $end, "$interval MONTH"); + } + + public static function getPeriodsbyWeek($begin, $end, $interval = 1) + { + return self::getPeriods($begin, $end, "$interval WEEK"); + } + + public static function getPeriodsbyDay($begin, $end, $interval = 1) + { + return self::getPeriods($begin, $end, "$interval DAY"); + } + + public static function getPeriods($begin, $end, $duration, $interval = 1) + { + $period = new Period($begin, $end); + foreach ($period->getDatePeriod($duration) as $day) { + $daterange[] = interval_after($day, $duration); + } + return $daterange; + } + + public static function PeriodsToCarbon($periods) + { + $data = []; + foreach ($periods as $period) { + $data[] = self::PeriodToCarbon($period); + } + return $data; + } + + public static function PeriodToCarbon($period) + { + return ['start' => self::DatePointToCarbon($period->getStartDate()), 'end' => self::DatePointToCarbon($period->getEndDate())]; + } + + public static function DatePointToCarbon($date) + { + return Carbon::createFromFormat('Y-m-d H:i:s', $date->format('Y-m-d H:i:s')); + } - public static function getPeriods($begin, $end, $interval) - { - $period = new Period($begin, new \DateTime($end)); - foreach ($period->getDatePeriod("1 $interval") as $day) { - $daterange[] = Period::createFromDuration($day->format('Y-m-d H:i:s'), "1 $interval"); - } - return ($daterange); - } } diff --git a/app/Repositories/Core/DateTime.php b/app/Repositories/Core/DateTime.php index b5a72822..b34fe2a6 100644 --- a/app/Repositories/Core/DateTime.php +++ b/app/Repositories/Core/DateTime.php @@ -2,58 +2,146 @@ namespace App\Repositories\Core; +use Illuminate\Support\Str; use Carbon\Carbon; use Jenssegers\Date\Date; +use App\Repositories\Languages; + class DateTime { - public static function getLang() - { - return session('locale') ? session('locale') : 'fr'; - } + public static function getMonthName($date, $short = true) + { + return $short ? self::getUltraShortMonthName($date) : $date->monthName; + } - public static function convert($date) - { - return $date ? Carbon::createFromFormat('d/m/Y', $date)->isoFormat('Y-MM-DD') : null; - } + public static function getShortMonthName($date) + { + return $date->shortMonthName; + } - public static function convertTime($date) - { - return $date ? Carbon::createFromFormat('d/m/Y H:i', $date)->isoFormat('Y-MM-DD HH:mm:ss') : null; - } + public static function getUltraShortMonthName($date) + { + return strtoupper(Str::ascii(mb_substr($date->shortMonthName,0,3))); + } - public static function toFr($date) - { - return $date ? Carbon::parse($date)->isoFormat('DD/MM/Y') : null; - } + public static function getDayName($date, $short = true) + { + return $short ? $date->shortDayName : $date->dayName; + } - public static function toFrTime($date) - { - return $date ? Carbon::parse($date)->isoFormat('DD/MM/Y HH:mm:ss') : null; - } + public static function DatetoLocale($date = null) + { + $format = self::getLocaleFormatDate(); + if (!is_null($date) && !empty($date)) { + $date = Carbon::parse($date)->format($format); + } elseif ($date == 'now') { + $date = Carbon::now()->format($format); + } + return $date; + } - public static function FromDatetimeFr($date) - { - return $date ? Carbon::createFromFormat('d/m/Y H:i:s', $date) : null; - } + public static function DatetimeToLocale($date = null) + { + $format = self::getLocaleFormatDatetime(); + if (!is_null($date) && !empty($date)) { + $date = Carbon::parse($date)->format($format); + } elseif ($date == 'now') { + $date = Carbon::now()->format($format); + } + return $date; + } - public static function DatetimeToStamp($date) - { - return $date ? self::FromDatetimeFr($date)->isoFormat('Y-MM-DD HH:mm:ss') : null; - } + public static function getDateTime() + { + return self::DatetimeToLocale(date('Y-m-d H:i:s')); + } - public static function DatetimeToDate($date) - { - return $date ? self::FromDatetimeFr($date)->isoFormat('DD/MM/Y') : null; - } + public static function getDate() + { + return self::DateToLocale(date('Y-m-d')); + } - public static function DatetimeToTime($date) - { - return $date ? self::FromDatetimeFr($date)->isoFormat('HH:mm') : null; - } + public static function getLang() + { + return session('locale') ? session('locale') : 'fr'; + } - public static function isPast($date) - { - return self::FromDatetimeFr($date)->isPast(); - } + public static function convert($date) + { + $format = self::getLocaleFormatDate(); + return !empty($date) ? Carbon::createFromFormat($format, $date)->isoFormat('Y-MM-DD') : null; + } + + public static function convertTime($date) + { + $format = self::getLocaleFormatDatetime(); + return !empty($date) ? Carbon::createFromFormat($format, $date)->isoFormat('Y-MM-DD HH:mm:ss') : null; + } + + public static function toFr($date) + { + return !empty($date) ? Carbon::parse($date)->isoFormat('DD/MM/Y') : null; + } + + public static function toFrTime($date) + { + return !empty($date) ? Carbon::parse($date)->isoFormat('DD/MM/Y HH:mm:ss') : null; + } + + public static function getYearFromDate($date) + { + // return date_format(DateTime::convert($signature_date), 'Y'); + $date = DateTime::convert($date); + $date = date_create($date); + return date_format($date, 'Y'); + } + + + public static function getLocaleFormatDate() + { + $locale = self::getLang(); + switch ($locale) { + case 'fr': + case 'en': + $format = 'd/m/Y'; + break; + default: + $format = 'Y-m-d'; + } + return $format; + } + + public static function getLocaleFormatDatetime() + { + $locale = self::getLang(); + switch ($locale) { + case 'fr': + case 'en': + $format = 'd/m/Y H:i:s'; + break; + default: + $format = 'Y-m-d H:i:s'; + } + return $format; + } + + public static function getLocaleDateFull($date) + { + return Carbon::parse($date)->isoFormat('LLLL'); + } + + public static function getLocaleDateFullShort($date) + { + return Carbon::parse($date)->isoFormat('lll'); + } + + public static function getLocaleHour($date) + { + return Carbon::parse($date)->isoFormat(''); + } + + public static function relativeTime() + { + } } diff --git a/app/Repositories/Core/Mailer.php b/app/Repositories/Core/Mailer.php new file mode 100644 index 00000000..2ff68bb7 --- /dev/null +++ b/app/Repositories/Core/Mailer.php @@ -0,0 +1,33 @@ +sortBy('name') : collect([]); + foreach ($mailables as $mailable) + { + $templates[] = $mailable['name']; + } + +*/ + $templates = ['EventInscription','EventSaveTheDate','MatinalesBadge','MatinalesThanks','MatinalesReplays']; + return $templates; + } + + public static function getTemplate($template_id) + { + $templates = self::getTemplates(); + return $templates[$template_id]; + } +} diff --git a/app/Repositories/Core/Media.php b/app/Repositories/Core/Media.php new file mode 100644 index 00000000..f729afc0 --- /dev/null +++ b/app/Repositories/Core/Media.php @@ -0,0 +1,56 @@ +getMedia(); + foreach ($model->media as $key => $media) { + $model->media[$key]['url'] = $media->getUrl(); + } + return $model->media; + } else { + return false; + } + } + + public static function storeImages($model, $files) + { + if ($files) { + foreach ($files as $file) { + self::storeImage($model, $file); + } + } + } + + public static function storeImage($model, $file) + { + return $model->addMedia($file)->withResponsiveImages()->toMediaCollection('images'); + } + + public static function deleteImage($model, $index) + { + $model->getMedia(); + $ret = $model->media[$index]->delete(); + return "1"; + } + + public static function getThumbSrc($image) + { + if (!$image) { + return null; + } + $id = $image['id']; + $images = json_decode($image['responsive_images'], true); + $urls = $images['medialibrary_original']['urls']; + + $img = $urls[count($urls)-1]; + $src = "storage/$id/responsive-images/$img"; + return $src; + } + + +} diff --git a/app/Repositories/Core/Tag.php b/app/Repositories/Core/Tag.php new file mode 100644 index 00000000..6c4c1457 --- /dev/null +++ b/app/Repositories/Core/Tag.php @@ -0,0 +1,25 @@ +tags; + return $tags ? $tags->pluck('id')->toArray() : null; + } + + public static function storeTags($model, $tags) + { + if ($tags) { + $tags = collect($tags)->transform(function ($item, $key) { + return (int) $item; + })->toArray(); + return $model->syncTags($tags, true); + } else return false; + } + + +} diff --git a/app/Repositories/Core/Tags.php b/app/Repositories/Core/Tags.php deleted file mode 100644 index 8d8f5042..00000000 --- a/app/Repositories/Core/Tags.php +++ /dev/null @@ -1,55 +0,0 @@ -make(true); - } - - public static function getOptions() - { - return Family::get()->SortBy('name')->pluck('name','id')->toArray(); - } - - public static function getAll() - { - return Family::orderBy('name','asc')->get(); - } - - public static function get($id) - { - return Family::find($id); - } - - public static function store($data) - { - $id = isset($data['id']) ? $data['id'] : false; - $item = $id ? self::update($data) : self::create($data); - return $item->id; - } - - public static function create($data) - { - return Family::create($data); - } - - public static function update($data) - { - return Family::find($id)->update($data); - } - - public static function destroy($id) - { - return Family::destroy($id); - } - -} diff --git a/app/Repositories/Core/Upload.php b/app/Repositories/Core/Upload.php index cf6fdde6..57653781 100644 --- a/app/Repositories/Core/Upload.php +++ b/app/Repositories/Core/Upload.php @@ -8,94 +8,157 @@ use Intervention\Image\Facades\Image as Image; class Upload { - public static function getData($file) - { - $data['filename'] = $file->getClientOriginalName(); - $data['filetype'] = $file->extension(); - $data['filesize'] = $file->getSize(); - return $data; - } + public static function getData($file) + { + $data['filename'] = $file->getClientOriginalName(); + $data['filetype'] = $file->getClientOriginalExtension(); + $data['filesize'] = $file->getSize(); + $data['mime'] = $file->getMimeType(); + return $data; + } - public static function getUuid($file, $data) - { - $data = (is_array($data)) ? (object) $data : $data; - $pos = strrpos($file, '/'); - $uuid = substr($file, $pos+1); - $uuid = str_replace('.' . $data->filetype, '', $uuid); - return $uuid; - } + public static function getUuid($file, $data) + { + $data = (is_array($data)) ? (object) $data : $data; + $pos = strrpos($file, '/'); + $uuid = substr($file, $pos+1); + $uuid = pathinfo($uuid, PATHINFO_FILENAME); + // $uuid = str_replace('.' . strtolower($data->filetype), '', $uuid); + // $uuid = str_replace('.' . $data->filetype, '', $uuid); + return $uuid; + } - public static function store($file, $filepath) - { - return $file->store($filepath); - } + public static function storeByVar($var, $path, $public = false) + { + // check if filename exists + // store + // Storage::disk('local')->put('file.txt', 'Contents'); + // $path = Storage::putFile('avatars', $request->file('avatar')); + // $path = $request->file('avatar')->storeAs('avatars',$request->user()->id,'s3'); + // $path = $request->file('avatar')->storePublicly('avatars', 's3'); + return $request->has($var) ? basename($request->file($var)->store($path)) : false; + } - public static function storePublic($file, $filepath) - { - // exit; - $filepath = 'public/' . $filepath; - return $file->store($filepath); - } + public static function store($file, $path) + { + return Storage::putFile($path, $file); + // return $file->store($filepath); + } - public static function delete($file) - { - return Storage::delete($file); - } + public static function storePublic($file, $filepath) + { + return Storage::putFile($filepath, $file, 'public'); + // $filepath = 'public/' . $filepath; + // return $file->store($filepath); + } - public static function createThumb($file, $size, $sub = false) - { - $thumb = self::getThumbPath($file, $sub); - $filename = self::getPublicPath($file); - return Image::make($filename)->orientate()->widen($size)->save($thumb); - } + public static function createThumb($file, $size, $sub = false) + { + $thumb = self::getThumbPath($file, $sub); + $filename = self::getPublicPath($file); + return Image::make($filename)->orientate()->widen($size)->save($thumb); + } - /* - public static function getPath($file) { - return 'public/' . self::getFilename($file); - } - */ - - public static function getPublicPath($file) - { - return storage_path('app/public/' . self::getFilename($file)); - } + /* + public static function getPath($file) { + return 'public/' . self::getFilename($file); + } + */ + + public static function getPublicPath($file) + { + return storage_path('app/public/' . self::getFilename($file)); + } - public static function getPrivatePath($file) - { - return storage_path('app/' . self::getFilename($file)); - } + public static function getPrivatePath($file) + { + return storage_path('app/' . self::getFilename($file)); + } - public static function getSrc($file) - { - return '/storage/' . self::getFilename($file); - } + public static function getSrc($file) + { + return '/storage/' . self::getFilename($file); + } - public static function getThumbPath($file) - { - return storage_path('app/public/' . self::getThumbFilename($file)); - } + public static function getThumbPath($file) + { + return storage_path('app/public/' . self::getThumbFilename($file)); + } - public static function getThumbSrc($file) - { - return '/storage/' . self::getThumbFilename($file); - } + public static function getThumbSrc($file) + { + return '/storage/' . self::getThumbFilename($file); + } - public static function getFilename($file) - { - $file = (is_array($file)) ? (object) $file : $file; - return $file->filepath . '/' . self::getName($file); - } + public static function getFilename($file) + { + $file = (is_array($file)) ? (object) $file : $file; + return $file->filepath . '/' . self::getName($file); + } - public static function getThumbFilename($file, $sub = false) - { - $sub = $sub ? $sub : 'thumbs/'; - $file = (is_array($file)) ? (object) $file : $file; - return $file->filepath . '/' . $sub . self::getName($file); - } + public static function getThumbFilename($file, $sub = false) + { + $sub = $sub ? $sub : 'thumbs/'; + $file = (is_array($file)) ? (object) $file : $file; + return $file->filepath . '/' . $sub . self::getName($file); + } - public static function getName($file) - { - $file = (is_array($file)) ? (object) $file : $file; - return $file->uuid . '.' .$file->filetype; - } + public static function getName($file) + { + $file = (is_array($file)) ? (object) $file : $file; + return $file->uuid . '.' . strtolower($file->filetype); + } + + /** + * [fix problem path with Storage on Windows] + * @param [type] $path [description] + * @return [type] [description] + */ + public static function fix($path) + { + if (self::isWindows()) { + return str_replace('/', '\\', $path); + } else { + return $path; + } + } + + public static function move($source, $dest) + { + if (Storage::exists($dest)) { + self::delete($dest); + } + return Storage::move($source, $dest); // transfère et renomme le fichier du dossier temporaire au dossier du client + } + + public static function delete($file) + { + // Storage::delete($file); + // return unlink($file); + return Storage::delete($file); + } + + public static function deleteFile($path) + { + if (Storage::exists($path)) { + return Storage::delete($path); + } else { + return false; + } + } + + public static function deleteRecursive($path) + { + rmdir_recursive($targetDir); + } + + public function make_dir($path, $permissions = 0777) + { + return is_dir($path) || mkdir($path, $permissions, true); + } + + public static function isWindows() + { + return (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'); + } } diff --git a/app/Repositories/Core/User/Basket.php b/app/Repositories/Core/User/Basket.php new file mode 100644 index 00000000..359f6986 --- /dev/null +++ b/app/Repositories/Core/User/Basket.php @@ -0,0 +1,63 @@ + $data]); + } + + public static function get($key) + { + return session($key); + } + + public static function add($key, $value) + { + $data = self::isExist($key) ? self::get($key) : []; + if (array_search($value, $data) === false) { + array_push($data, $value); + self::set($key, $data); + } + return count($data); + } + + public static function remove($key, $value) + { + $data = self::get($key); + if (($index = array_search($value, $data)) !== false) { + unset($data[$index]); + } + return self::set($key, $data); + } + + public static function isExist($key) + { + return session()->has($key); + } + + public static function reset($key) + { + return session()->forget($key); + } + + public static function resetAll() + { + return session()->flush(); + } +} diff --git a/app/Repositories/Core/User/Notifications/NewUser.php b/app/Repositories/Core/User/Notifications/NewUser.php new file mode 100644 index 00000000..7dc1bc73 --- /dev/null +++ b/app/Repositories/Core/User/Notifications/NewUser.php @@ -0,0 +1,66 @@ +markdown('notifications.email') + ->greeting(__('notifications.greeting', ['firstname' => $notifiable->first_name])) + ->subject(__('notifications.newuser.subject', ['name' => config('app.name')])) + ->line(__('notifications.newuser.intro', [ + 'name' => $currentUser->first_name.' '.$currentUser->last_name, + ])) + ->action( + __('notifications.newuser.button'), + route('users.firstlogin', $notifiable->remember_token) + ) + ->salutation(__('notifications.salutation', [ + 'name' => $currentUser->first_name.' '.$currentUser->last_name, + ])) + ->line(__('notifications.newuser.outro')); + } + + /** + * Get the array representation of the notification. + * + * @param mixed $notifiable + * + * @return array + */ + public function toArray($notifiable) + { + return [ + // + ]; + } +} diff --git a/app/Repositories/Core/User/Notifications/ResetPassword.php b/app/Repositories/Core/User/Notifications/ResetPassword.php new file mode 100644 index 00000000..763d1691 --- /dev/null +++ b/app/Repositories/Core/User/Notifications/ResetPassword.php @@ -0,0 +1,31 @@ +markdown('notifications.email') + ->greeting(__('notifications.greeting', ['firstname' => $notifiable->first_name])) + ->subject(__('notifications.resetpassword.subject')) + ->line(__('notifications.resetpassword.intro')) + ->action( + __('notifications.resetpassword.button'), + route('password.reset', $this->token) + ) + ->line(__('notifications.resetpassword.outro')); + } +*/ +} diff --git a/app/Repositories/Core/User/PasswordResets.php b/app/Repositories/Core/User/PasswordResets.php new file mode 100644 index 00000000..9c397b1f --- /dev/null +++ b/app/Repositories/Core/User/PasswordResets.php @@ -0,0 +1,19 @@ +first(); + } + + public static function getEmailByToken($token) + { + return PasswordReset::byToken($token)->first(); + } +} diff --git a/app/Repositories/Shop/Articles.php b/app/Repositories/Shop/Articles.php index 77a27f78..f13a840b 100644 --- a/app/Repositories/Shop/Articles.php +++ b/app/Repositories/Shop/Articles.php @@ -2,12 +2,10 @@ namespace App\Repositories\Shop; -use Illuminate\Support\Facades\Storage; -use Illuminate\Support\Facades\DB; use Illuminate\Support\Str; -use Yajra\DataTables\DataTables; - +use App\Repositories\Core\Tag; +use App\Repositories\Core\Media; use App\Repositories\Botanic\Species; use App\Repositories\Botanic\Varieties; use App\Models\Shop\Article; @@ -15,12 +13,6 @@ use App\Models\Shop\Article; class Articles { - public static function getDatatable() - { - $model = Article::orderBy('name'); - return Datatables::of($model)->make(true); - } - public static function getAll() { return Article::orderBy('name','asc')->get(); @@ -28,11 +20,11 @@ class Articles public static function getFull($id) { - $article = Article::with('product')->findOrFail($id); - $data = $article->toArray(); - $data['categories'] = self::getCategoriesByArticle($article); - $data['tags'] = self::getTagsByArticle($article); - $data['prices'] = self::getPricesByArticle($article); + $article = Article::with('product.tags')->findOrFail($id); + $data['article'] = $article->toArray(); + $data['article']['categories'] = self::getCategoriesByArticle($article); + $data['article']['tags'] = self::getTagsByArticle($article); + $data['article']['prices'] = self::getPricesByArticle($article); self::getMeta($data); return $data; } @@ -53,7 +45,6 @@ class Articles public static function getByCategory($category_id) { - // TODO add category return Article::with(['prices','product','image'])->get(); } @@ -109,7 +100,7 @@ class Articles public static function update($data, $id = false) { $id = $id ? $id : $data['id']; - $article = Article::find($id); + $article = self::get($id); $ret = $article->update($data); return $article; } @@ -133,12 +124,7 @@ class Articles public static function storeTags($article, $tags) { - if ($tags) { - $tags = collect($tags)->transform(function ($item, $key) { - return (int) $item; - })->toArray(); - return $article->syncTags($tags, true); - } else return false; + return Tag::storeTags($article, $tags); } public static function storePrices($article, $prices) @@ -148,55 +134,27 @@ class Articles public static function storeImages($article, $files) { - if ($files) { - foreach ($files as $file) { - self::storeImage($article, $file); - } - } + return Media::storeImages($article, $files); } public static function storeImage($article, $file) { - return $article->addMedia($file)->withResponsiveImages()->toMediaCollection('images'); + return Media::storeImage($article, $file); } public static function getImages($id) { - $article = self::get($id); - if ($article) - { - $article->getMedia(); - foreach ($article->media as $key => $media) { - $article->media[$key]['url'] = $media->getUrl(); - } - return $article->media; - } else { - return false; - } + return Media::getImages(self::get($id)); } public static function getThumbSrc($image) { - if (!$image) { - return null; - } - $id = $image['id']; - $images = json_decode($image['responsive_images'], true); - $urls = $images['medialibrary_original']['urls']; - - $img = $urls[count($urls)-1]; - $src = "storage/$id/responsive-images/$img"; - return $src; + return Media::getThumbSrc($image); } - public static function deleteImage($id, $index) { - $article = self::get($id); - $article->getMedia(); - $ret = $article->media[$index]->delete(); - return "1"; + return Media::deleteImage(self::get($id), $index); } - } diff --git a/composer.json b/composer.json index 30084f34..05cfc26c 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,7 @@ "beyondcode/laravel-comments": "^1.2", "box/spout": "^3.1", "browner12/helpers": "^3.0", + "cesargb/laravel-cascade-delete": "^1.2", "coduo/php-humanizer": "^3.0", "consoletvs/charts": "^6.5", "cornford/googlmapper": "^2.3", @@ -67,8 +68,8 @@ "rinvex/laravel-categories": "^3.0", "rinvex/laravel-tags": "^3.0", "rutorika/sortable": "^6.0", - "santigarcor/laratrust": "^5.2", - "sebastienheyd/boilerplate": "^7.1", + "santigarcor/laratrust": "^6.0", + "sebastienheyd/boilerplate": "^7.3", "sebastienheyd/boilerplate-email-editor": "^8.0", "sebastienheyd/boilerplate-media-manager": "^7.0", "sensiolabs/security-checker": "^6.0", diff --git a/package.json b/package.json index 2e5cbbcc..afe84933 100644 --- a/package.json +++ b/package.json @@ -96,6 +96,7 @@ "izimodal": "^1.5.1", "jQuery-QueryBuilder": "^2.5.2", "jqtree": "^1.4.12", + "jquery": "^3.5.1", "jquery-confirm": "^3.3.4", "jquery-form": "^4.2.2", "jquery-jeditable": "^2.0.13", diff --git a/resources/views/Shop/Admin/Articles/edit.blade.php b/resources/views/Shop/Admin/Articles/edit.blade.php index eced2b7b..362668be 100644 --- a/resources/views/Shop/Admin/Articles/edit.blade.php +++ b/resources/views/Shop/Admin/Articles/edit.blade.php @@ -7,7 +7,7 @@ @section('content') {{ Form::open(['route' => 'Shop.Admin.Articles.store', 'id' => 'article-form', 'autocomplete' => 'off', 'files' => true]) }} - + @include('Shop.Admin.Articles.form') diff --git a/resources/views/Shop/Admin/Articles/partials/characteristics.blade.php b/resources/views/Shop/Admin/Articles/partials/characteristics.blade.php index b4ba84e3..79ef2709 100644 --- a/resources/views/Shop/Admin/Articles/partials/characteristics.blade.php +++ b/resources/views/Shop/Admin/Articles/partials/characteristics.blade.php @@ -4,53 +4,58 @@
{{ Form::label('ref', 'Référence') }}
- @include('components.input', ['name' => 'ref', 'value' => isset($ref) ? $ref : null]) + @include('components.input', ['name' => 'ref', 'value' => $article['ref'] ?? null])
{{ Form::label('model', 'Familles de produit') }}
- @include('components.select', ['name' => 'product_type', 'id_name' => 'product_type', 'list' => $models_options, 'value' => isset($product_type) ? $product_type : null, 'class' => 'select2 form-control']) + @include('components.select', ['name' => 'product_type', 'id_name' => 'product_type', 'list' => $models_options, 'value' => $article['product_type'] ?? null, 'class' => 'select2 form-control'])
{{ Form::label('model_id', 'Produit') }}
- @include('components.select', ['name' => 'product_id', 'id_name' => 'product_id', 'list' => $products ?? [], 'value' => isset($product_id) ? $product_id : null, 'class' => 'select2 form-control']) + @include('components.select', ['name' => 'product_id', 'id_name' => 'product_id', 'list' => $products ?? [], 'value' => $article['product_id'] ?? null, 'class' => 'select2 form-control'])
{{ Form::label('name', 'Nom') }}
- @include('components.input', ['name' => 'name', 'value' => isset($name) ? $name : null, 'required' => true]) + @include('components.input', ['name' => 'name', 'value' => $article['name'] ?? null, 'required' => true])
{{ Form::label('family_id', 'Famille d\'articles') }}
- @include('components.select', ['name' => 'article_family_id', 'list' => $families_options, 'value' => isset($article_family_id) ? $article_family_id : null, 'class' => 'select2 form-control']) + @include('components.select', ['name' => 'article_family_id', 'list' => $families_options, 'value' => $article['article_family_id'] ?? null, 'class' => 'select2 form-control'])
{{ Form::label('categories', 'Rayons') }}
- @include('components.select', ['name' => 'categories[]', 'list' => $categories_options, 'values' => isset($categories) ? $categories : null, 'class' => 'select2 form-control', 'multiple' => true]) + @include('components.select', ['name' => 'categories[]', 'list' => $categories_options, 'values' => $article['categories'] ?? null, 'class' => 'select2 form-control', 'multiple' => true])
{{ Form::label('tags', 'Tags') }}
- @include('components.select-tree', ['name' => 'tags[]', 'list' => $tags_list, 'values' => isset($tags) ? $tags : null, 'class' => 'select2 form-control', 'multiple' => true]) + @include('components.select-tree', ['name' => 'tags[]', 'list' => $tags_list, 'values' => $article['tags'] ?? null, 'class' => 'select2 form-control', 'multiple' => true])
{{ Form::label('description', 'Description') }} - @include('components.textarea', ['name' => 'description', 'value' => isset($description) ? $description : null, 'class' => 'editor', 'required' => true]) + @if (!empty($article['product']['description'])) + @component('components.layout.box-collapse', ['id' => 'product_description', 'title' => 'Description produit']) + {{ $article['product']['description'] }} + @endcomponent + @endif + @include('components.textarea', ['name' => 'description', 'value' => $article['description'] ?? null, 'class' => 'editor', 'required' => true])
- @include('components.uploader.widget', ['load_url' => route('Shop.Admin.Articles.getImages', ['id' => (isset($id)) ? $id : false]), 'delete_url' => route('Shop.Admin.Articles.deleteImage') ]) + @include('components.uploader.widget', ['load_url' => route('Shop.Admin.Articles.getImages', ['id' => $article['id'] ?? false]), 'delete_url' => route('Shop.Admin.Articles.deleteImage'), 'title' => 'Photos' ])
diff --git a/resources/views/Shop/Admin/Articles/partials/prices.blade.php b/resources/views/Shop/Admin/Articles/partials/prices.blade.php index 154b37ce..2f5943d9 100644 --- a/resources/views/Shop/Admin/Articles/partials/prices.blade.php +++ b/resources/views/Shop/Admin/Articles/partials/prices.blade.php @@ -1,2 +1,2 @@ -@include('Shop.Admin.Articles.partials.prices.prices', ['prices' => $prices['prices'] ?? null]) -@include('Shop.Admin.Articles.partials.generic_prices.generic_prices', ['generics' => $prices['generics'] ?? null]) +@include('Shop.Admin.Articles.partials.prices.prices', ['prices' => $article['prices']['prices'] ?? null]) +@include('Shop.Admin.Articles.partials.generic_prices.generic_prices', ['generics' => $article['prices']['generics'] ?? null]) diff --git a/resources/views/components/datatables/buttons/exports.blade.php b/resources/views/components/datatables/buttons/exports.blade.php deleted file mode 100644 index 1233bda8..00000000 --- a/resources/views/components/datatables/buttons/exports.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -
- - @include('components.datatables.buttons.print') - - @if (isset($with_exports) && $with_exports) - @include('components.datatables.buttons.download') - @endif - -
diff --git a/resources/views/components/datatables/js/datatable.blade.php b/resources/views/components/datatables/js/datatable.blade.php index 502bfd86..40db9644 100644 --- a/resources/views/components/datatables/js/datatable.blade.php +++ b/resources/views/components/datatables/js/datatable.blade.php @@ -38,7 +38,11 @@ headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'}, success: function(){ // line.remove(); - table.draw(); + @if (isset($delete_callback)) + {{ $delete_callback }} + @else + table.draw(); + @endif growl("{{ __('admin.deletesuccess') }}", 'success'); } }); diff --git a/resources/views/components/form/autocomplete.blade.php b/resources/views/components/form/autocomplete.blade.php index 0d76a6d5..a79cc318 100644 --- a/resources/views/components/form/autocomplete.blade.php +++ b/resources/views/components/form/autocomplete.blade.php @@ -1,4 +1,4 @@ -@include('load.autocomplete') +@include('load.form.autocomplete') diff --git a/resources/views/components/form/datepicker.blade.php b/resources/views/components/form/datepicker.blade.php index a32bcbd9..fd4ad378 100644 --- a/resources/views/components/form/datepicker.blade.php +++ b/resources/views/components/form/datepicker.blade.php @@ -1,4 +1,4 @@ -@include('load.datepicker') +@include('load.form.datepicker')
@include('components.input', ['class' => 'datepicker', 'meta' => 'data-target="#'.str_slug($name).'"', 'placeholder' => App\Repositories\Core\DateTime::getLocaleFormatDate() ]) diff --git a/resources/views/components/form/editor.blade.php b/resources/views/components/form/editor.blade.php index c5a2b646..c476950f 100644 --- a/resources/views/components/form/editor.blade.php +++ b/resources/views/components/form/editor.blade.php @@ -7,7 +7,7 @@ @if(!defined('LOAD_EDITOR')) - @include('load.editor') + @include('load.form.editor.editor') @push('js') \ No newline at end of file +@if ($can_edit ?? true) + +@endif \ No newline at end of file diff --git a/resources/views/components/uploader/mini-gallery.blade.php b/resources/views/components/uploader/mini-gallery.blade.php index b4713295..599cfd96 100644 --- a/resources/views/components/uploader/mini-gallery.blade.php +++ b/resources/views/components/uploader/mini-gallery.blade.php @@ -1,14 +1,14 @@ - + -