Add preview from father, add new features
This commit is contained in:
@@ -7,23 +7,13 @@ use App\Http\Controllers\Controller;
|
|||||||
|
|
||||||
class HomeController extends Controller
|
class HomeController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
public function __construct()
|
||||||
* Create a new controller instance.
|
{
|
||||||
*
|
$this->middleware('auth');
|
||||||
* @return void
|
}
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->middleware('auth');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public function index()
|
||||||
* Show the application dashboard.
|
{
|
||||||
*
|
return view('home');
|
||||||
* @return \Illuminate\Contracts\Support\Renderable
|
}
|
||||||
*/
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
// return redirect('dashboard');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,48 +11,48 @@ use App\Datatables\Botanic\FamiliesDataTable;
|
|||||||
class FamilyController extends Controller
|
class FamilyController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
public function index(FamiliesDataTable $dataTable)
|
public function index(FamiliesDataTable $dataTable)
|
||||||
{
|
{
|
||||||
return $dataTable->render('Botanic.Admin.Families.list');
|
return $dataTable->render('Botanic.Admin.Families.list');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDatatable(Request $request)
|
public function getDatatable(Request $request)
|
||||||
{
|
{
|
||||||
return Families::getTables($request->all());
|
return Families::getTables($request->all());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
return view('Botanic.Admin.Families.create', $data);
|
return view('Botanic.Admin.Families.create', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$ret = Families::store($request);
|
$ret = Families::store($request);
|
||||||
return redirect()->route('Botanic.Admin.Families.index');
|
return redirect()->route('Botanic.Admin.Families.index');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
$data = Families::get($id);
|
$data = Families::get($id);
|
||||||
return view('Botanic.Admin.Families.view', $data);
|
return view('Botanic.Admin.Families.view', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
$data['family'] = Families::get($id)->toArray();
|
$data['family'] = Families::get($id)->toArray();
|
||||||
return view('Botanic.Admin.Families.edit', $data);
|
return view('Botanic.Admin.Families.edit', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
return Families::destroy($id);
|
return Families::destroy($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function exportExcel()
|
public function exportExcel()
|
||||||
{
|
{
|
||||||
return Families::exportExcel();
|
return Families::exportExcel();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,23 +7,23 @@ use App\Http\Controllers\Controller;
|
|||||||
|
|
||||||
class HomeController extends Controller
|
class HomeController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new controller instance.
|
* Create a new controller instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->middleware('auth');
|
$this->middleware('auth');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the application dashboard.
|
* Show the application dashboard.
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Contracts\Support\Renderable
|
* @return \Illuminate\Contracts\Support\Renderable
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return redirect('dashboard');
|
return redirect('dashboard');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,27 +10,27 @@ use App\Repositories\Shop\Categories;
|
|||||||
|
|
||||||
class HomeController extends Controller
|
class HomeController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new controller instance.
|
* Create a new controller instance.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// $this->middleware('auth');
|
// $this->middleware('auth');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the application dashboard.
|
* Show the application dashboard.
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Contracts\Support\Renderable
|
* @return \Illuminate\Contracts\Support\Renderable
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$data['categories'] = Categories::getTree();
|
$data['categories'] = Categories::getTree();
|
||||||
$data['category'] = Categories::get(15)->toArray();
|
$data['category'] = Categories::get(15)->toArray();
|
||||||
$data['articles'] = Articles::getByCategory(0)->toArray();
|
$data['articles'] = Articles::getByCategory(0)->toArray();
|
||||||
// dump($data);
|
// dump($data);
|
||||||
return view('Shop.home', $data);
|
return view('Shop.home', $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,25 +2,18 @@
|
|||||||
|
|
||||||
namespace App\Repositories\Botanic;
|
namespace App\Repositories\Botanic;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
use Yajra\DataTables\DataTables;
|
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
|
||||||
|
use App\Repositories\Core\Tag;
|
||||||
|
use App\Repositories\Core\Media;
|
||||||
use App\Models\Botanic\Variety;
|
use App\Models\Botanic\Variety;
|
||||||
use App\Exports\Botanic\VarietiesExport;
|
use App\Exports\Botanic\VarietiesExport;
|
||||||
|
|
||||||
class Varieties
|
class Varieties
|
||||||
{
|
{
|
||||||
|
|
||||||
public static function getDatatable()
|
|
||||||
{
|
|
||||||
$model = Variety::with('specie');
|
|
||||||
return Datatables::of($model)->make(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getOptions()
|
public static function getOptions()
|
||||||
{
|
{
|
||||||
return Variety::orderBy('name')->get()->pluck('name','id')->toArray();
|
return Variety::orderBy('name')->get()->pluck('name','id')->toArray();
|
||||||
@@ -30,8 +23,7 @@ class Varieties
|
|||||||
{
|
{
|
||||||
$varieties = Variety::with('specie')->get();
|
$varieties = Variety::with('specie')->get();
|
||||||
$data = [];
|
$data = [];
|
||||||
foreach ($varieties as $variety)
|
foreach ($varieties as $variety) {
|
||||||
{
|
|
||||||
$data[$variety->id] = (isset($variety->specie->name) ? $variety->specie->name . ' ' : '') . $variety->name;
|
$data[$variety->id] = (isset($variety->specie->name) ? $variety->specie->name . ' ' : '') . $variety->name;
|
||||||
}
|
}
|
||||||
asort($data, SORT_NATURAL | SORT_FLAG_CASE);
|
asort($data, SORT_NATURAL | SORT_FLAG_CASE);
|
||||||
@@ -45,7 +37,7 @@ class Varieties
|
|||||||
|
|
||||||
public static function get($id)
|
public static function get($id)
|
||||||
{
|
{
|
||||||
return Variety::find($id);
|
return Variety::findOrFail($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFull($id)
|
public static function getFull($id)
|
||||||
@@ -58,8 +50,7 @@ class Varieties
|
|||||||
|
|
||||||
public static function getTagsByVariety($variety)
|
public static function getTagsByVariety($variety)
|
||||||
{
|
{
|
||||||
$tags = $variety->tags;
|
return Tag::getTagsByModel($variety);
|
||||||
return $tags ? $tags->pluck('id')->toArray() : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -89,7 +80,7 @@ class Varieties
|
|||||||
public static function update($data, $id = false)
|
public static function update($data, $id = false)
|
||||||
{
|
{
|
||||||
$id = $id ? $id : $data['id'];
|
$id = $id ? $id : $data['id'];
|
||||||
$variety = Variety::find($id);
|
$variety = self::get($id);
|
||||||
$ret = $variety->update($data);
|
$ret = $variety->update($data);
|
||||||
return $variety;
|
return $variety;
|
||||||
}
|
}
|
||||||
@@ -101,43 +92,22 @@ class Varieties
|
|||||||
|
|
||||||
public static function storeTags($variety, $tags)
|
public static function storeTags($variety, $tags)
|
||||||
{
|
{
|
||||||
if ($tags) {
|
return Tag::storeTags($variety, $tags);
|
||||||
$tags = collect($tags)->transform(function ($item, $key) {
|
|
||||||
return (int) $item;
|
|
||||||
})->toArray();
|
|
||||||
return $variety->syncTags($tags, true);
|
|
||||||
} else return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function storeImages($variety, $files)
|
public static function storeImages($variety, $files)
|
||||||
{
|
{
|
||||||
if ($files) {
|
return Media::storeImages($variety, $files);
|
||||||
foreach ($files as $file) {
|
|
||||||
$variety->addMedia($file)->withResponsiveImages()->toMediaCollection('images');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getImages($id)
|
public static function getImages($id)
|
||||||
{
|
{
|
||||||
$variety = self::get($id);
|
return Media::getImages(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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function deleteImage($id, $index)
|
public static function deleteImage($id, $index)
|
||||||
{
|
{
|
||||||
$variety = self::get($id);
|
return Media::deleteImage(self::get($id), $index);
|
||||||
$variety->getMedia();
|
|
||||||
$ret = $variety->media[$index]->delete();
|
|
||||||
return "1";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function exportExcel()
|
public static function exportExcel()
|
||||||
|
|||||||
@@ -2,113 +2,172 @@
|
|||||||
|
|
||||||
namespace App\Repositories\Core;
|
namespace App\Repositories\Core;
|
||||||
|
|
||||||
use \Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use \League\Period\Period;
|
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
|
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)
|
public static function getPeriodsLastMonthWithLabels($nb, $with_actual = true)
|
||||||
{
|
{
|
||||||
$end = static::lastWeek();
|
$periods = DateRange::PeriodsToCarbon(DateRange::getPeriodsLastMonth($nb, $with_actual));
|
||||||
$begin = $end->copy()->subWeek($nb);
|
$labels = DateRange::getMonthNames($periods);
|
||||||
return static::getPeriodsbyWeek($begin, $end);
|
foreach ($labels as $label) {
|
||||||
}
|
$data[$label] = $periods;
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
public static function getPeriodsLastDay($nb)
|
public static function getAllMonthNames()
|
||||||
{
|
{
|
||||||
$end = static::lastDay();
|
return self::getMonthNames(self::PeriodsToCarbon(self::getPeriodsLastMonth(12)));
|
||||||
$begin = $end->copy()->subDay($nb);
|
}
|
||||||
return static::getPeriodsbyDay($begin, $end);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function byDay()
|
public static function getPeriodsLastMonth($nb = 1, $with_actual = true)
|
||||||
{
|
{
|
||||||
return [Carbon::now()->startOfDay(), Carbon::now()->endOfDay()];
|
$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()
|
public static function getMonthNamesByPeriods($periods)
|
||||||
{
|
{
|
||||||
return [Carbon::now()->startOfWeek(), Carbon::now()->endOfWeek()];
|
$months = [];
|
||||||
}
|
foreach ($periods as $period) {
|
||||||
|
$date = self::DatePointToCarbon($period->getStartDate());
|
||||||
|
$months[] = DateTime::getMonthName($date);
|
||||||
|
}
|
||||||
|
return $months;
|
||||||
|
}
|
||||||
|
|
||||||
public static function byMonth()
|
public static function getMonthNames($periods)
|
||||||
{
|
{
|
||||||
return [Carbon::now()->startOfMonth(), Carbon::now()->endOfMonth()];
|
$months = [];
|
||||||
}
|
foreach ($periods as $period) {
|
||||||
|
$months[] = DateTime::getMonthName($period['start']);
|
||||||
|
}
|
||||||
|
return $months;
|
||||||
|
}
|
||||||
|
|
||||||
public static function byQuarter()
|
public static function getPeriodsLastWeek($nb = 1, $with_actual = true)
|
||||||
{
|
{
|
||||||
return [Carbon::now()->startOfQuarter(), Carbon::now()->endOfQuarter()];
|
$end = $with_actual ? Carbon::now()->endOfWeek() : self::lastWeek();
|
||||||
}
|
$begin = $end->copy()->subWeek($nb);
|
||||||
|
return static::getPeriodsbyWeek($begin, $end);
|
||||||
|
}
|
||||||
|
|
||||||
public static function bySemester()
|
public static function getPeriodsLastDay($nb = 1, $with_actual = true)
|
||||||
{
|
{
|
||||||
$quarter = Carbon::now()->quarter;
|
$end = $with_actual ? Carbon::now()->endOfDay() : static::lastDay();
|
||||||
switch ($quarter) {
|
$begin = $end->copy()->subDay($nb);
|
||||||
case 1:
|
return static::getPeriodsbyDay($begin, $end);
|
||||||
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 byYear()
|
public static function byDay()
|
||||||
{
|
{
|
||||||
return [Carbon::now()->startOfYear(), Carbon::now()->endOfYear()];
|
return [Carbon::now()->startOfDay(), Carbon::now()->endOfDay()];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function lastMonth()
|
public static function byWeek()
|
||||||
{
|
{
|
||||||
$start = Carbon::parse('first day of last month');
|
return [Carbon::now()->startOfWeek(), Carbon::now()->endOfWeek()];
|
||||||
$start->addMonth()->startOfDay();
|
}
|
||||||
return $start;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function lastWeek()
|
public static function byMonth()
|
||||||
{
|
{
|
||||||
return Carbon::parse('last monday');
|
return [Carbon::now()->startOfMonth(), Carbon::now()->endOfMonth()];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function lastDay()
|
public static function byQuarter()
|
||||||
{
|
{
|
||||||
return Carbon::parse('yesterday');
|
return [Carbon::now()->startOfQuarter(), Carbon::now()->endOfQuarter()];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getPeriodsbyMonth($begin, $end)
|
public static function bySemester()
|
||||||
{
|
{
|
||||||
return (static::getPeriods($begin, $end, 'MONTH'));
|
$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)
|
public static function byYear()
|
||||||
{
|
{
|
||||||
return (static::getPeriods($begin, $end, 'WEEK'));
|
return [Carbon::now()->startOfYear(), Carbon::now()->endOfYear()];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getPeriodsbyDay($begin, $end)
|
public static function lastMonth()
|
||||||
{
|
{
|
||||||
return (static::getPeriods($begin, $end, 'DAY'));
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,58 +2,146 @@
|
|||||||
|
|
||||||
namespace App\Repositories\Core;
|
namespace App\Repositories\Core;
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Jenssegers\Date\Date;
|
use Jenssegers\Date\Date;
|
||||||
|
|
||||||
|
use App\Repositories\Languages;
|
||||||
|
|
||||||
class DateTime
|
class DateTime
|
||||||
{
|
{
|
||||||
public static function getLang()
|
public static function getMonthName($date, $short = true)
|
||||||
{
|
{
|
||||||
return session('locale') ? session('locale') : 'fr';
|
return $short ? self::getUltraShortMonthName($date) : $date->monthName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function convert($date)
|
public static function getShortMonthName($date)
|
||||||
{
|
{
|
||||||
return $date ? Carbon::createFromFormat('d/m/Y', $date)->isoFormat('Y-MM-DD') : null;
|
return $date->shortMonthName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function convertTime($date)
|
public static function getUltraShortMonthName($date)
|
||||||
{
|
{
|
||||||
return $date ? Carbon::createFromFormat('d/m/Y H:i', $date)->isoFormat('Y-MM-DD HH:mm:ss') : null;
|
return strtoupper(Str::ascii(mb_substr($date->shortMonthName,0,3)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function toFr($date)
|
public static function getDayName($date, $short = true)
|
||||||
{
|
{
|
||||||
return $date ? Carbon::parse($date)->isoFormat('DD/MM/Y') : null;
|
return $short ? $date->shortDayName : $date->dayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function toFrTime($date)
|
public static function DatetoLocale($date = null)
|
||||||
{
|
{
|
||||||
return $date ? Carbon::parse($date)->isoFormat('DD/MM/Y HH:mm:ss') : 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)
|
public static function DatetimeToLocale($date = null)
|
||||||
{
|
{
|
||||||
return $date ? Carbon::createFromFormat('d/m/Y H:i:s', $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)
|
public static function getDateTime()
|
||||||
{
|
{
|
||||||
return $date ? self::FromDatetimeFr($date)->isoFormat('Y-MM-DD HH:mm:ss') : null;
|
return self::DatetimeToLocale(date('Y-m-d H:i:s'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function DatetimeToDate($date)
|
public static function getDate()
|
||||||
{
|
{
|
||||||
return $date ? self::FromDatetimeFr($date)->isoFormat('DD/MM/Y') : null;
|
return self::DateToLocale(date('Y-m-d'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function DatetimeToTime($date)
|
public static function getLang()
|
||||||
{
|
{
|
||||||
return $date ? self::FromDatetimeFr($date)->isoFormat('HH:mm') : null;
|
return session('locale') ? session('locale') : 'fr';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isPast($date)
|
public static function convert($date)
|
||||||
{
|
{
|
||||||
return self::FromDatetimeFr($date)->isPast();
|
$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()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
33
app/Repositories/Core/Mailer.php
Normal file
33
app/Repositories/Core/Mailer.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repositories\Core;
|
||||||
|
|
||||||
|
use Qoraiche\MailEclipse\MailEclipse;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class Mailer
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function getTemplates()
|
||||||
|
{
|
||||||
|
// $mailables = MailEclipse::getMailables();
|
||||||
|
// DB::rollBack();
|
||||||
|
// dump($mailables);
|
||||||
|
/*
|
||||||
|
$mailables = (null !== $mailables) ? $mailables->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];
|
||||||
|
}
|
||||||
|
}
|
||||||
56
app/Repositories/Core/Media.php
Normal file
56
app/Repositories/Core/Media.php
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repositories\Core;
|
||||||
|
|
||||||
|
class Media
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function getImages($model) {
|
||||||
|
if ($model) {
|
||||||
|
$model->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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
25
app/Repositories/Core/Tag.php
Normal file
25
app/Repositories/Core/Tag.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repositories\Core;
|
||||||
|
|
||||||
|
class Tag
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function getTagsByModel($model)
|
||||||
|
{
|
||||||
|
$tags = $model->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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Repositories\Core;
|
|
||||||
|
|
||||||
use Yajra\DataTables\DataTables;
|
|
||||||
|
|
||||||
use App\Models\Botanic\Family;
|
|
||||||
|
|
||||||
class Tags
|
|
||||||
{
|
|
||||||
|
|
||||||
public static function getDatatable()
|
|
||||||
{
|
|
||||||
$model = Family::orderBy('name');
|
|
||||||
return Datatables::of($model)->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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -8,94 +8,157 @@ use Intervention\Image\Facades\Image as Image;
|
|||||||
|
|
||||||
class Upload
|
class Upload
|
||||||
{
|
{
|
||||||
public static function getData($file)
|
public static function getData($file)
|
||||||
{
|
{
|
||||||
$data['filename'] = $file->getClientOriginalName();
|
$data['filename'] = $file->getClientOriginalName();
|
||||||
$data['filetype'] = $file->extension();
|
$data['filetype'] = $file->getClientOriginalExtension();
|
||||||
$data['filesize'] = $file->getSize();
|
$data['filesize'] = $file->getSize();
|
||||||
return $data;
|
$data['mime'] = $file->getMimeType();
|
||||||
}
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
public static function getUuid($file, $data)
|
public static function getUuid($file, $data)
|
||||||
{
|
{
|
||||||
$data = (is_array($data)) ? (object) $data : $data;
|
$data = (is_array($data)) ? (object) $data : $data;
|
||||||
$pos = strrpos($file, '/');
|
$pos = strrpos($file, '/');
|
||||||
$uuid = substr($file, $pos+1);
|
$uuid = substr($file, $pos+1);
|
||||||
$uuid = str_replace('.' . $data->filetype, '', $uuid);
|
$uuid = pathinfo($uuid, PATHINFO_FILENAME);
|
||||||
return $uuid;
|
// $uuid = str_replace('.' . strtolower($data->filetype), '', $uuid);
|
||||||
}
|
// $uuid = str_replace('.' . $data->filetype, '', $uuid);
|
||||||
|
return $uuid;
|
||||||
|
}
|
||||||
|
|
||||||
public static function store($file, $filepath)
|
public static function storeByVar($var, $path, $public = false)
|
||||||
{
|
{
|
||||||
return $file->store($filepath);
|
// 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)
|
public static function store($file, $path)
|
||||||
{
|
{
|
||||||
// exit;
|
return Storage::putFile($path, $file);
|
||||||
$filepath = 'public/' . $filepath;
|
// return $file->store($filepath);
|
||||||
return $file->store($filepath);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static function delete($file)
|
public static function storePublic($file, $filepath)
|
||||||
{
|
{
|
||||||
return Storage::delete($file);
|
return Storage::putFile($filepath, $file, 'public');
|
||||||
}
|
// $filepath = 'public/' . $filepath;
|
||||||
|
// return $file->store($filepath);
|
||||||
|
}
|
||||||
|
|
||||||
public static function createThumb($file, $size, $sub = false)
|
public static function createThumb($file, $size, $sub = false)
|
||||||
{
|
{
|
||||||
$thumb = self::getThumbPath($file, $sub);
|
$thumb = self::getThumbPath($file, $sub);
|
||||||
$filename = self::getPublicPath($file);
|
$filename = self::getPublicPath($file);
|
||||||
return Image::make($filename)->orientate()->widen($size)->save($thumb);
|
return Image::make($filename)->orientate()->widen($size)->save($thumb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public static function getPath($file) {
|
public static function getPath($file) {
|
||||||
return 'public/' . self::getFilename($file);
|
return 'public/' . self::getFilename($file);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static function getPublicPath($file)
|
public static function getPublicPath($file)
|
||||||
{
|
{
|
||||||
return storage_path('app/public/' . self::getFilename($file));
|
return storage_path('app/public/' . self::getFilename($file));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getPrivatePath($file)
|
public static function getPrivatePath($file)
|
||||||
{
|
{
|
||||||
return storage_path('app/' . self::getFilename($file));
|
return storage_path('app/' . self::getFilename($file));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getSrc($file)
|
public static function getSrc($file)
|
||||||
{
|
{
|
||||||
return '/storage/' . self::getFilename($file);
|
return '/storage/' . self::getFilename($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getThumbPath($file)
|
public static function getThumbPath($file)
|
||||||
{
|
{
|
||||||
return storage_path('app/public/' . self::getThumbFilename($file));
|
return storage_path('app/public/' . self::getThumbFilename($file));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getThumbSrc($file)
|
public static function getThumbSrc($file)
|
||||||
{
|
{
|
||||||
return '/storage/' . self::getThumbFilename($file);
|
return '/storage/' . self::getThumbFilename($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFilename($file)
|
public static function getFilename($file)
|
||||||
{
|
{
|
||||||
$file = (is_array($file)) ? (object) $file : $file;
|
$file = (is_array($file)) ? (object) $file : $file;
|
||||||
return $file->filepath . '/' . self::getName($file);
|
return $file->filepath . '/' . self::getName($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getThumbFilename($file, $sub = false)
|
public static function getThumbFilename($file, $sub = false)
|
||||||
{
|
{
|
||||||
$sub = $sub ? $sub : 'thumbs/';
|
$sub = $sub ? $sub : 'thumbs/';
|
||||||
$file = (is_array($file)) ? (object) $file : $file;
|
$file = (is_array($file)) ? (object) $file : $file;
|
||||||
return $file->filepath . '/' . $sub . self::getName($file);
|
return $file->filepath . '/' . $sub . self::getName($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getName($file)
|
public static function getName($file)
|
||||||
{
|
{
|
||||||
$file = (is_array($file)) ? (object) $file : $file;
|
$file = (is_array($file)) ? (object) $file : $file;
|
||||||
return $file->uuid . '.' .$file->filetype;
|
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');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
63
app/Repositories/Core/User/Basket.php
Normal file
63
app/Repositories/Core/User/Basket.php
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repositories\Core\User;
|
||||||
|
|
||||||
|
class Basket
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function first($key)
|
||||||
|
{
|
||||||
|
$data = self::get($key);
|
||||||
|
return array_shift($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function last($key)
|
||||||
|
{
|
||||||
|
$data = self::get($key);
|
||||||
|
return $data ? array_pop($data) : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function set($key, $data)
|
||||||
|
{
|
||||||
|
return session([$key => $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();
|
||||||
|
}
|
||||||
|
}
|
||||||
66
app/Repositories/Core/User/Notifications/NewUser.php
Normal file
66
app/Repositories/Core/User/Notifications/NewUser.php
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repositories\Core\User\Notifications;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
use Illuminate\Notifications\Notification;
|
||||||
|
|
||||||
|
class NewUser extends Notification
|
||||||
|
{
|
||||||
|
use Queueable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the notification's delivery channels.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function via($notifiable)
|
||||||
|
{
|
||||||
|
return ['mail'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the mail representation of the notification.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||||
|
*/
|
||||||
|
public function toMail($notifiable)
|
||||||
|
{
|
||||||
|
$currentUser = \Auth::user();
|
||||||
|
|
||||||
|
return (new MailMessage())
|
||||||
|
->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 [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
31
app/Repositories/Core/User/Notifications/ResetPassword.php
Normal file
31
app/Repositories/Core/User/Notifications/ResetPassword.php
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repositories\Core\User\Notifications;
|
||||||
|
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
|
||||||
|
class ResetPassword extends \Illuminate\Auth\Notifications\ResetPassword
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the mail representation of the notification.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
public function toMail($notifiable)
|
||||||
|
{
|
||||||
|
return (new MailMessage())
|
||||||
|
->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'));
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
19
app/Repositories/Core/User/PasswordResets.php
Normal file
19
app/Repositories/Core/User/PasswordResets.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repositories\Core\User;
|
||||||
|
|
||||||
|
use App\Models\Core\Auth\PasswordReset;
|
||||||
|
|
||||||
|
class PasswordResets
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function getTokenByEmail($email)
|
||||||
|
{
|
||||||
|
return PasswordReset::byEmail($email)->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getEmailByToken($token)
|
||||||
|
{
|
||||||
|
return PasswordReset::byToken($token)->first();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,12 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Repositories\Shop;
|
namespace App\Repositories\Shop;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Str;
|
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\Species;
|
||||||
use App\Repositories\Botanic\Varieties;
|
use App\Repositories\Botanic\Varieties;
|
||||||
use App\Models\Shop\Article;
|
use App\Models\Shop\Article;
|
||||||
@@ -15,12 +13,6 @@ use App\Models\Shop\Article;
|
|||||||
class Articles
|
class Articles
|
||||||
{
|
{
|
||||||
|
|
||||||
public static function getDatatable()
|
|
||||||
{
|
|
||||||
$model = Article::orderBy('name');
|
|
||||||
return Datatables::of($model)->make(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getAll()
|
public static function getAll()
|
||||||
{
|
{
|
||||||
return Article::orderBy('name','asc')->get();
|
return Article::orderBy('name','asc')->get();
|
||||||
@@ -28,11 +20,11 @@ class Articles
|
|||||||
|
|
||||||
public static function getFull($id)
|
public static function getFull($id)
|
||||||
{
|
{
|
||||||
$article = Article::with('product')->findOrFail($id);
|
$article = Article::with('product.tags')->findOrFail($id);
|
||||||
$data = $article->toArray();
|
$data['article'] = $article->toArray();
|
||||||
$data['categories'] = self::getCategoriesByArticle($article);
|
$data['article']['categories'] = self::getCategoriesByArticle($article);
|
||||||
$data['tags'] = self::getTagsByArticle($article);
|
$data['article']['tags'] = self::getTagsByArticle($article);
|
||||||
$data['prices'] = self::getPricesByArticle($article);
|
$data['article']['prices'] = self::getPricesByArticle($article);
|
||||||
self::getMeta($data);
|
self::getMeta($data);
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
@@ -53,7 +45,6 @@ class Articles
|
|||||||
|
|
||||||
public static function getByCategory($category_id)
|
public static function getByCategory($category_id)
|
||||||
{
|
{
|
||||||
// TODO add category
|
|
||||||
return Article::with(['prices','product','image'])->get();
|
return Article::with(['prices','product','image'])->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +100,7 @@ class Articles
|
|||||||
public static function update($data, $id = false)
|
public static function update($data, $id = false)
|
||||||
{
|
{
|
||||||
$id = $id ? $id : $data['id'];
|
$id = $id ? $id : $data['id'];
|
||||||
$article = Article::find($id);
|
$article = self::get($id);
|
||||||
$ret = $article->update($data);
|
$ret = $article->update($data);
|
||||||
return $article;
|
return $article;
|
||||||
}
|
}
|
||||||
@@ -133,12 +124,7 @@ class Articles
|
|||||||
|
|
||||||
public static function storeTags($article, $tags)
|
public static function storeTags($article, $tags)
|
||||||
{
|
{
|
||||||
if ($tags) {
|
return Tag::storeTags($article, $tags);
|
||||||
$tags = collect($tags)->transform(function ($item, $key) {
|
|
||||||
return (int) $item;
|
|
||||||
})->toArray();
|
|
||||||
return $article->syncTags($tags, true);
|
|
||||||
} else return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function storePrices($article, $prices)
|
public static function storePrices($article, $prices)
|
||||||
@@ -148,55 +134,27 @@ class Articles
|
|||||||
|
|
||||||
public static function storeImages($article, $files)
|
public static function storeImages($article, $files)
|
||||||
{
|
{
|
||||||
if ($files) {
|
return Media::storeImages($article, $files);
|
||||||
foreach ($files as $file) {
|
|
||||||
self::storeImage($article, $file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function storeImage($article, $file)
|
public static function storeImage($article, $file)
|
||||||
{
|
{
|
||||||
return $article->addMedia($file)->withResponsiveImages()->toMediaCollection('images');
|
return Media::storeImage($article, $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getImages($id)
|
public static function getImages($id)
|
||||||
{
|
{
|
||||||
$article = self::get($id);
|
return Media::getImages(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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getThumbSrc($image)
|
public static function getThumbSrc($image)
|
||||||
{
|
{
|
||||||
if (!$image) {
|
return Media::getThumbSrc($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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function deleteImage($id, $index)
|
public static function deleteImage($id, $index)
|
||||||
{
|
{
|
||||||
$article = self::get($id);
|
return Media::deleteImage(self::get($id), $index);
|
||||||
$article->getMedia();
|
|
||||||
$ret = $article->media[$index]->delete();
|
|
||||||
return "1";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
"beyondcode/laravel-comments": "^1.2",
|
"beyondcode/laravel-comments": "^1.2",
|
||||||
"box/spout": "^3.1",
|
"box/spout": "^3.1",
|
||||||
"browner12/helpers": "^3.0",
|
"browner12/helpers": "^3.0",
|
||||||
|
"cesargb/laravel-cascade-delete": "^1.2",
|
||||||
"coduo/php-humanizer": "^3.0",
|
"coduo/php-humanizer": "^3.0",
|
||||||
"consoletvs/charts": "^6.5",
|
"consoletvs/charts": "^6.5",
|
||||||
"cornford/googlmapper": "^2.3",
|
"cornford/googlmapper": "^2.3",
|
||||||
@@ -67,8 +68,8 @@
|
|||||||
"rinvex/laravel-categories": "^3.0",
|
"rinvex/laravel-categories": "^3.0",
|
||||||
"rinvex/laravel-tags": "^3.0",
|
"rinvex/laravel-tags": "^3.0",
|
||||||
"rutorika/sortable": "^6.0",
|
"rutorika/sortable": "^6.0",
|
||||||
"santigarcor/laratrust": "^5.2",
|
"santigarcor/laratrust": "^6.0",
|
||||||
"sebastienheyd/boilerplate": "^7.1",
|
"sebastienheyd/boilerplate": "^7.3",
|
||||||
"sebastienheyd/boilerplate-email-editor": "^8.0",
|
"sebastienheyd/boilerplate-email-editor": "^8.0",
|
||||||
"sebastienheyd/boilerplate-media-manager": "^7.0",
|
"sebastienheyd/boilerplate-media-manager": "^7.0",
|
||||||
"sensiolabs/security-checker": "^6.0",
|
"sensiolabs/security-checker": "^6.0",
|
||||||
|
|||||||
@@ -96,6 +96,7 @@
|
|||||||
"izimodal": "^1.5.1",
|
"izimodal": "^1.5.1",
|
||||||
"jQuery-QueryBuilder": "^2.5.2",
|
"jQuery-QueryBuilder": "^2.5.2",
|
||||||
"jqtree": "^1.4.12",
|
"jqtree": "^1.4.12",
|
||||||
|
"jquery": "^3.5.1",
|
||||||
"jquery-confirm": "^3.3.4",
|
"jquery-confirm": "^3.3.4",
|
||||||
"jquery-form": "^4.2.2",
|
"jquery-form": "^4.2.2",
|
||||||
"jquery-jeditable": "^2.0.13",
|
"jquery-jeditable": "^2.0.13",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
{{ Form::open(['route' => 'Shop.Admin.Articles.store', 'id' => 'article-form', 'autocomplete' => 'off', 'files' => true]) }}
|
{{ Form::open(['route' => 'Shop.Admin.Articles.store', 'id' => 'article-form', 'autocomplete' => 'off', 'files' => true]) }}
|
||||||
<input type="hidden" name="id" id="id" value="{{ $id }}">
|
<input type="hidden" name="id" id="id" value="{{ $article['id'] ?? null }}">
|
||||||
|
|
||||||
@include('Shop.Admin.Articles.form')
|
@include('Shop.Admin.Articles.form')
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -4,53 +4,58 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-2">
|
<div class="col-2">
|
||||||
{{ Form::label('ref', 'Référence') }}<br>
|
{{ Form::label('ref', 'Référence') }}<br>
|
||||||
@include('components.input', ['name' => 'ref', 'value' => isset($ref) ? $ref : null])
|
@include('components.input', ['name' => 'ref', 'value' => $article['ref'] ?? null])
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
{{ Form::label('model', 'Familles de produit') }}<br>
|
{{ Form::label('model', 'Familles de produit') }}<br>
|
||||||
@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'])
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
{{ Form::label('model_id', 'Produit') }}<br>
|
{{ Form::label('model_id', 'Produit') }}<br>
|
||||||
@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'])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
{{ Form::label('name', 'Nom') }}<br>
|
{{ Form::label('name', 'Nom') }}<br>
|
||||||
@include('components.input', ['name' => 'name', 'value' => isset($name) ? $name : null, 'required' => true])
|
@include('components.input', ['name' => 'name', 'value' => $article['name'] ?? null, 'required' => true])
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
{{ Form::label('family_id', 'Famille d\'articles') }}<br>
|
{{ Form::label('family_id', 'Famille d\'articles') }}<br>
|
||||||
@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'])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
{{ Form::label('categories', 'Rayons') }}<br>
|
{{ Form::label('categories', 'Rayons') }}<br>
|
||||||
@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])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
{{ Form::label('tags', 'Tags') }}<br>
|
{{ Form::label('tags', 'Tags') }}<br>
|
||||||
@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])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
{{ Form::label('description', 'Description') }}
|
{{ 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])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
@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' ])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
@include('Shop.Admin.Articles.partials.prices.prices', ['prices' => $prices['prices'] ?? null])
|
@include('Shop.Admin.Articles.partials.prices.prices', ['prices' => $article['prices']['prices'] ?? null])
|
||||||
@include('Shop.Admin.Articles.partials.generic_prices.generic_prices', ['generics' => $prices['generics'] ?? null])
|
@include('Shop.Admin.Articles.partials.generic_prices.generic_prices', ['generics' => $article['prices']['generics'] ?? null])
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
<div class="datatable-export-buttons">
|
|
||||||
|
|
||||||
@include('components.datatables.buttons.print')
|
|
||||||
|
|
||||||
@if (isset($with_exports) && $with_exports)
|
|
||||||
@include('components.datatables.buttons.download')
|
|
||||||
@endif
|
|
||||||
|
|
||||||
</div>
|
|
||||||
@@ -38,7 +38,11 @@
|
|||||||
headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'},
|
headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'},
|
||||||
success: function(){
|
success: function(){
|
||||||
// line.remove();
|
// line.remove();
|
||||||
table.draw();
|
@if (isset($delete_callback))
|
||||||
|
{{ $delete_callback }}
|
||||||
|
@else
|
||||||
|
table.draw();
|
||||||
|
@endif
|
||||||
growl("{{ __('admin.deletesuccess') }}", 'success');
|
growl("{{ __('admin.deletesuccess') }}", 'success');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@include('load.autocomplete')
|
@include('load.form.autocomplete')
|
||||||
|
|
||||||
<input type="hidden" name="{{ $name }}_id" id="{{ $name }}_id" value="{{ $data['id'] ?? null }}">
|
<input type="hidden" name="{{ $name }}_id" id="{{ $name }}_id" value="{{ $data['id'] ?? null }}">
|
||||||
<input type="text" name="{{ $name }}_name" class="form-control autocomplete" value="{{ $data['name'] ?? ''}}" data-url="{{ $url ?? ''}}" data-field="{{ $name }}_id" autocomplete="off">
|
<input type="text" name="{{ $name }}_name" class="form-control autocomplete" value="{{ $data['name'] ?? ''}}" data-url="{{ $url ?? ''}}" data-field="{{ $name }}_id" autocomplete="off">
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@include('load.datepicker')
|
@include('load.form.datepicker')
|
||||||
|
|
||||||
<div class="input-group date" data-target-input="nearest">
|
<div class="input-group date" data-target-input="nearest">
|
||||||
@include('components.input', ['class' => 'datepicker', 'meta' => 'data-target="#'.str_slug($name).'"', 'placeholder' => App\Repositories\Core\DateTime::getLocaleFormatDate() ])
|
@include('components.input', ['class' => 'datepicker', 'meta' => 'data-target="#'.str_slug($name).'"', 'placeholder' => App\Repositories\Core\DateTime::getLocaleFormatDate() ])
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
|
|
||||||
@if(!defined('LOAD_EDITOR'))
|
@if(!defined('LOAD_EDITOR'))
|
||||||
@include('load.editor')
|
@include('load.form.editor.editor')
|
||||||
@push('js')
|
@push('js')
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
@include('components.input', ['type' => 'number', 'meta' => "step = '.01'"])
|
@include('components.input', ['type' => 'number', 'meta' => "step = '.01'"])
|
||||||
|
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<button class="btn btn-outline-secondary" type="button" aria-haspopup="true" aria-expanded="false">
|
<button class="btn bg-light" type="button" aria-haspopup="false" aria-expanded="false">
|
||||||
%
|
%
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -15,5 +15,5 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
@if(!defined('LOAD_SELECT2'))
|
@if(!defined('LOAD_SELECT2'))
|
||||||
@include('load.select2')
|
@include('load.form.select2')
|
||||||
@endif
|
@endif
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
<input type="checkbox" name="{{ $name ?? ''}}" id="{{ $id_name ?? $name ?? '' }}" class="{{ $class ?? 'toggle'}}" value="{{ $val ?? 1}}" data-toggle="toggle" data-on="{{ $on ?? __('yes') }}" data-off="{{ $off ?? __('no') }}" data-onstyle="{{ $onstyle ?? 'outline-success'}}" data-offstyle="{{ $offstyle ?? 'outline-danger'}}" data-size="{{ $size ?? 'sm' }}" @if ( (isset($value) && isset($val) && ($value == $val)) || (!isset($val) && isset($value) && $value)) checked @endif {{ $disabled ?? ''}} {{ $meta ?? ''}} >
|
<input type="hidden" name="{{ $name ?? ''}}" value="0">
|
||||||
|
<input type="checkbox" name="{{ $name ?? ''}}" id="{{ $id_name ?? $name ?? '' }}" class="{{ $class ?? 'toggle'}}" value="{{ $val ?? 1}}" data-toggle="toggle" data-on="{{ $on ?? __('yes') }}" data-off="{{ $off ?? __('no') }}" data-onstyle="{{ $onstyle ?? 'outline-success'}}" data-offstyle="{{ $offstyle ?? 'outline-danger'}}" data-size="{{ $size ?? '' }}" @if ( (isset($value) && isset($val) && ($value == $val)) || (!isset($val) && isset($value) && $value)) checked @endif {{ $disabled ?? ''}} {{ $meta ?? ''}} >
|
||||||
|
|
||||||
@include('load.toggle')
|
@include('load.form.toggle')
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
<button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#{{ $id }}" aria-expanded="false" aria-controls="{{ $id }}">
|
<button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#{{ $id }}" aria-expanded="false" aria-controls="{{ $id }}">
|
||||||
<i class="fa fa-chevron-right"></i>
|
<i class="fa fa-chevron-right"></i>
|
||||||
</button>
|
</button>
|
||||||
{!! $title !!}
|
{!! $title ?? null !!}
|
||||||
@if (isset($required) && $required)
|
@if (isset($required) && $required)
|
||||||
<sup>*</sup>
|
<sup>*</sup>
|
||||||
@endif
|
@endif
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<div class="col row-new-image row-image mt-3 mb-2">
|
<div class="col {{ $prefix ?? '' }}row-new-image row-image mt-3 mb-2">
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<button type="button" class="btn btn-danger delete-new-image-btn"><i class="fa fa-minus-circle"></i></button>
|
<button type="button" class="btn btn-danger {{ $prefix ?? '' }}delete-new-image-btn"><i class="fa fa-minus-circle"></i></button>
|
||||||
Photo <span class="row-image-number"></span>
|
Photo <span class="{{ $prefix ?? '' }}row-image-number"></span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<input name="images[]" type="file" class="file" data-show-upload="false" data-show-caption="true" data-msg-placeholder="Choisissez une photo">
|
<input name="{{ $prefix ?? '' }}images[]" type="file" class="file" data-show-upload="false" data-show-caption="true" data-msg-placeholder="Choisissez une photo">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,19 +2,23 @@
|
|||||||
@foreach($images as $key => $image)
|
@foreach($images as $key => $image)
|
||||||
<figure class="mr-2">
|
<figure class="mr-2">
|
||||||
<img src="{{ $image['url'] }}" class="img-thumbnail img-caption" style="max-height:92px;">
|
<img src="{{ $image['url'] }}" class="img-thumbnail img-caption" style="max-height:92px;">
|
||||||
<figcaption class="text-center pt-2">
|
@if ($can_edit ?? true)
|
||||||
<button type="button" class="btn btn-xs btn-outline-secondary">
|
<figcaption class="text-center pt-2">
|
||||||
<i class="fas fa-expand-alt"></i>
|
<button type="button" class="btn btn-xs btn-outline-secondary">
|
||||||
</button>
|
<i class="fas fa-expand-alt"></i>
|
||||||
<button type="button" class="btn btn-xs btn-outline-danger">
|
</button>
|
||||||
<i class="fas fa-trash" data-index="{{ $key }}"></i>
|
<button type="button" class="btn btn-xs btn-outline-danger">
|
||||||
</button>
|
<i class="fas fa-trash" data-index="{{ $key }}"></i>
|
||||||
</figcaption>
|
</button>
|
||||||
|
</figcaption>
|
||||||
|
@endif
|
||||||
</figure>
|
</figure>
|
||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<script>
|
@if ($can_edit ?? true)
|
||||||
handleDeleteImages();
|
<script>
|
||||||
handleEnlargeImages();
|
{{ $prefix ?? '' }}handleDeleteImages();
|
||||||
</script>
|
{{ $prefix ?? '' }}handleEnlargeImages();
|
||||||
|
</script>
|
||||||
|
@endif
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
<div class="row" id="uploader-mini-gallery"></div>
|
<div class="row" id="{{ $prefix ?? '' }}uploader-mini-gallery"></div>
|
||||||
|
|
||||||
<div class="modal fade" id="mini-gallery-lightbox" tabindex="-1" role="dialog" aria-labelledby="mini-gallery-lightbox" aria-hidden="true">
|
<div class="modal fade" id="{{ $prefix ?? '' }}mini-gallery-lightbox" tabindex="-1" role="dialog" aria-labelledby="mini-gallery-lightbox" aria-hidden="true">
|
||||||
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title" id="mini-gallery-title-lightbox"></h5>
|
<h5 class="modal-title"></h5>
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<img src="" id="mini-gallery-img-lightbox" class="img-fluid" >
|
<img src="" class="img-fluid lightbox" >
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
@push('js')
|
@push('js')
|
||||||
<script>
|
<script>
|
||||||
function handleDeleteImages() {
|
function {{ $prefix ?? '' }}handleDeleteImages() {
|
||||||
$('#uploader-mini-gallery .fa-trash').click(function() {
|
$('#{{ $prefix ?? '' }}uploader-mini-gallery .fa-trash').click(function() {
|
||||||
id = $('#id').val();
|
id = $('#id').val();
|
||||||
index = $(this).data('index');
|
index = $(this).data('index');
|
||||||
console.log(id);
|
console.log(id);
|
||||||
@@ -35,13 +35,13 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleEnlargeImages() {
|
function {{ $prefix ?? '' }}handleEnlargeImages() {
|
||||||
$('#uploader-mini-gallery .fa-expand-alt').click(function() {
|
$('#{{ $prefix ?? '' }}uploader-mini-gallery .fa-expand-alt').click(function() {
|
||||||
$img = $(this).parents('figure').find('.img-thumbnail');
|
$img = $(this).parents('figure').find('.img-thumbnail');
|
||||||
url = $img.attr('src');
|
url = $img.attr('src');
|
||||||
console.log(url);
|
console.log(url);
|
||||||
$('#mini-gallery-img-lightbox').attr('src', url);
|
$('#{{ $prefix ?? '' }}mini-gallery-lightbox .lightbox').attr('src', url);
|
||||||
$('#mini-gallery-lightbox').modal('show');
|
$('#{{ $prefix ?? '' }}mini-gallery-lightbox').modal('show');
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -2,51 +2,57 @@
|
|||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title">Photos</h3>
|
<h3 class="card-title">{{ $title }}</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body pt-3 pb-0">
|
<div class="card-body pt-3 pb-0">
|
||||||
@if (isset($id))
|
@if (isset($article['id']))
|
||||||
@include('components.uploader.mini-gallery')
|
@include('components.uploader.mini-gallery')
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<div id="uploader-new-images"></div>
|
@if ($can_edit ?? true)
|
||||||
@include('components.uploader.block_image_new', ['name' => 'images[]', 'required' => true])
|
<div id="{{ $prefix ?? '' }}uploader-new-images"></div>
|
||||||
</div>
|
@include('components.uploader.block_image_new', ['name' => 'images[]', 'required' => true])
|
||||||
<div class="card-footer">
|
@endif
|
||||||
<button type="button" class="btn btn-xs btn-primary add-image pull-right">Ajout <i class="fa fa-plus"></i></button>
|
|
||||||
</div>
|
</div>
|
||||||
|
@if ($can_edit ?? true)
|
||||||
|
<div class="card-footer">
|
||||||
|
<button type="button" class="btn btn-xs btn-primary {{ $prefix ?? '' }}add-image pull-right">Ajout <i class="fa fa-plus"></i></button>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@push('js')
|
@push('js')
|
||||||
<script>
|
<script>
|
||||||
function append_image() {
|
function {{ $prefix ?? '' }}append_image() {
|
||||||
$("#uploader-new-images .file").fileinput();
|
$("#{{ $prefix ?? '' }}uploader-new-images .file").fileinput();
|
||||||
$("#uploader-new-images .file").focus();
|
$("#{{ $prefix ?? '' }}uploader-new-images .file").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#uploader-new-images").appender({
|
$("#{{ $prefix ?? '' }}uploader-new-images").appender({
|
||||||
rowSection: '.row-new-image',
|
rowSection: '.{{ $prefix ?? '' }}row-new-image',
|
||||||
type: '.row-image',
|
type: '.{{ $prefix ?? '' }}row-image',
|
||||||
addBtn: '.add-image',
|
addBtn: '.{{ $prefix ?? '' }}add-image',
|
||||||
appendEffect: 'fade',
|
appendEffect: 'fade',
|
||||||
addClass: 'animated fadeIn',
|
addClass: 'animated fadeIn',
|
||||||
rowNumber: '.row-image-number',
|
rowNumber: '.{{ $prefix ?? '' }}row-image-number',
|
||||||
deleteBtn: '.delete-new-image-btn',
|
deleteBtn: '.{{ $prefix ?? '' }}delete-new-image-btn',
|
||||||
callback: append_image,
|
callback: {{ $prefix ?? '' }}append_image,
|
||||||
hideSection: true
|
hideSection: true
|
||||||
});
|
});
|
||||||
|
|
||||||
function loadImages()
|
function loadImages()
|
||||||
{
|
{
|
||||||
$gallery = $("#uploader-mini-gallery");
|
$gallery = $("#{{ $prefix ?? '' }}uploader-mini-gallery");
|
||||||
if ($gallery) {
|
if ($gallery) {
|
||||||
$gallery.load("{{ $load_url }}");
|
$gallery.load("{{ $load_url }}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadImages();
|
$(function() {
|
||||||
|
loadImages();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
TEST
|
@component('components.layout.box-collapse', ['title' => __('person_in_charge'), 'id' => 'form-contact'])
|
||||||
|
TEST
|
||||||
|
@endcomponent
|
||||||
|
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
|
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
|
||||||
<a class="dropdown-item" href="{{ route('admin') }}"><i class="fa fa-cog"></i> Accès à l'administration</a>
|
|
||||||
|
|
||||||
<a class="dropdown-item" href="{{ route('logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
|
<a class="dropdown-item" href="{{ route('logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
|
||||||
Déconnexion
|
Déconnexion
|
||||||
|
|||||||
77
resources/views/load/form/appender.blade.php
Normal file
77
resources/views/load/form/appender.blade.php
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
@if(!defined('LOAD_APPENDER'))
|
||||||
|
@push('js')
|
||||||
|
<script>
|
||||||
|
|
||||||
|
(function ($) {
|
||||||
|
$.fn.appender = function (settings) {
|
||||||
|
let appendArea = this;
|
||||||
|
let rowHtml = $(settings.rowSection)[0].outerHTML;
|
||||||
|
|
||||||
|
settings.hideSection ? $(settings.rowSection).remove() : "";
|
||||||
|
|
||||||
|
let rowCounter = 1;
|
||||||
|
|
||||||
|
if (settings.rowNumberStart) {
|
||||||
|
rowCounter = Number(settings.rowNumberStart);
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).on('click', settings.addBtn, function (event) {
|
||||||
|
$(appendArea).append(rowHtml);
|
||||||
|
|
||||||
|
if (settings.appendEffect === 'fade') {
|
||||||
|
$(settings.rowSection).last().hide().fadeIn();
|
||||||
|
} else if (settings.appendEffect === 'slide') {
|
||||||
|
$(settings.rowSection).last().hide().slideDown(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
$(settings.rowSection).last().addClass(settings.addClass);
|
||||||
|
|
||||||
|
$(settings.rowNumber).last().text(rowCounter);
|
||||||
|
|
||||||
|
type = (settings.type) ? settings.type : settings.rowSection;
|
||||||
|
|
||||||
|
$(type).each(function(rowIndex) {
|
||||||
|
$(this).find('input[name]').each(function() {
|
||||||
|
var name = $(this).attr('name');
|
||||||
|
name = name.replace(/\[[0-9]?\]/g, '['+rowIndex+']');
|
||||||
|
$(this).attr('name',name);
|
||||||
|
});
|
||||||
|
$(this).find('select[name]').each(function() {
|
||||||
|
var name = $(this).attr('name');
|
||||||
|
name = name.replace(/\[[0-9]?\]/g, '['+rowIndex+']');
|
||||||
|
$(this).attr('name',name);
|
||||||
|
});
|
||||||
|
$(this).find('textarea[name]').each(function() {
|
||||||
|
var name = $(this).attr('name');
|
||||||
|
name = name.replace(/\[[0-9]?\]/g, '['+rowIndex+']');
|
||||||
|
$(this).attr('name',name);
|
||||||
|
});
|
||||||
|
$(this).find('.appender').each(function() {
|
||||||
|
$(this).data('id',rowIndex);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
rowCounter++;
|
||||||
|
|
||||||
|
if (settings.callback) {
|
||||||
|
settings.callback();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if (settings.deleteBtn) {
|
||||||
|
$(document).on('click', settings.deleteBtn, function (e) {
|
||||||
|
$(e.target).closest(settings.rowSection).remove();
|
||||||
|
if (settings.callback) {
|
||||||
|
settings.callback();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}(jQuery));
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
@php(define('LOAD_APPENDER', true))
|
||||||
|
@endif
|
||||||
6
resources/views/load/form/builder/formbuilder.blade.php
Normal file
6
resources/views/load/form/builder/formbuilder.blade.php
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
@if(!defined('LOAD_FORMBUILDER'))
|
||||||
|
@push('scripts')
|
||||||
|
<script src="{{ asset('/assets/plugins/formBuilder/form-builder.min.js') }}"></script>
|
||||||
|
@endpush
|
||||||
|
@php(define('LOAD_FORMBUILDER', true))
|
||||||
|
@endif
|
||||||
9
resources/views/load/form/builder/formio.blade.php
Normal file
9
resources/views/load/form/builder/formio.blade.php
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
@if(!defined('LOAD_FORMIOJS'))
|
||||||
|
@push('css')
|
||||||
|
<link rel="stylesheet" href="{{ asset('/assets/plugins/formiojs/formio.full.min.css') }}">
|
||||||
|
@endpush
|
||||||
|
@push('scripts')
|
||||||
|
<script src="{{ asset('/assets/plugins/formiojs/formio.full.min.js') }}"></script>
|
||||||
|
@endpush
|
||||||
|
@php(define('LOAD_FORMIOJS', true))
|
||||||
|
@endif
|
||||||
39
resources/views/load/form/check_fields.blade.php
Normal file
39
resources/views/load/form/check_fields.blade.php
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
function checkCollapsedFields(selector)
|
||||||
|
{
|
||||||
|
var fields = selector + ' input,' + selector + ' textarea,' + selector + ' select';
|
||||||
|
console.log(fields);
|
||||||
|
|
||||||
|
var nb_fields = $(fields).length;
|
||||||
|
console.log(nb_fields);
|
||||||
|
var nb_required = $(fields).filter('[required]').length;
|
||||||
|
console.log(nb_required);
|
||||||
|
var nb_filled = 0;
|
||||||
|
var nb_necessary = 0;
|
||||||
|
|
||||||
|
$(fields).each(function(i, field){
|
||||||
|
if ($(field).val() != '')
|
||||||
|
{
|
||||||
|
nb_filled++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(fields).filter('[required]').each(function(i, required){
|
||||||
|
if ($(required).val() != '')
|
||||||
|
{
|
||||||
|
nb_necessary++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var result = nb_filled + " / " + nb_fields;
|
||||||
|
result = result + " | " + nb_necessary + " / " + nb_required;
|
||||||
|
|
||||||
|
console.log(result);
|
||||||
|
|
||||||
|
var check = $(selector).parent().find('.check');
|
||||||
|
console.log(check);
|
||||||
|
|
||||||
|
// $(selector).parent().find('.check').html(result);
|
||||||
|
if (nb_necessary < nb_required) {
|
||||||
|
$(selector).collapse('show');
|
||||||
|
}
|
||||||
|
}
|
||||||
22
resources/views/load/form/color.blade.php
Normal file
22
resources/views/load/form/color.blade.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
@if(!defined('LOAD_COLOR'))
|
||||||
|
@push('scripts')
|
||||||
|
<script src="{{ asset('/assets/plugins/jquery-minicolors/jquery.minicolors.min.js') }}"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function initColor(sel) {
|
||||||
|
var selector = (typeof(sel) == 'undefined') ? '.color' : sel;
|
||||||
|
var settings = {
|
||||||
|
position: 'bottom left',
|
||||||
|
theme: 'bootstrap'
|
||||||
|
};
|
||||||
|
$(selector).minicolors(settings);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@push('css')
|
||||||
|
<link rel="stylesheet" href="{{ asset('/assets/plugins/jquery-minicolors/jquery.minicolors.css') }}">
|
||||||
|
@endpush
|
||||||
|
@php(define('LOAD_COLOR', true))
|
||||||
|
@endif
|
||||||
25
resources/views/load/form/duallist.blade.php
Normal file
25
resources/views/load/form/duallist.blade.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
@if(!defined('LOAD_DUALLIST'))
|
||||||
|
@push('scripts')
|
||||||
|
<script src="{{ asset('/assets/plugins/bootstrap4-duallistbox/jquery.bootstrap-duallistbox.min.js') }}"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function initDualList(sel) {
|
||||||
|
var selector = (typeof(sel) == 'undefined') ? '.duallist' : sel;
|
||||||
|
var settings = {
|
||||||
|
nonSelectedListLabel: 'Non-selected',
|
||||||
|
selectedListLabel: 'Selected',
|
||||||
|
preserveSelectionOnMove: 'moved',
|
||||||
|
moveOnSelect: true,
|
||||||
|
nonSelectedFilter: ''
|
||||||
|
};
|
||||||
|
$(selector).bootstrapDualListbox(settings);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@push('css')
|
||||||
|
<link rel="stylesheet" href="{{ asset('/assets/plugins/bootstrap4-duallistbox/bootstrap-duallistbox.min.css') }}">
|
||||||
|
@endpush
|
||||||
|
@php(define('LOAD_DUALLIST', true))
|
||||||
|
@endif
|
||||||
15
resources/views/load/form/editor/editor.blade.php
Normal file
15
resources/views/load/form/editor/editor.blade.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
@if(!defined('LOAD_EDITOR'))
|
||||||
|
|
||||||
|
@include('load.form.editor.tinymce')
|
||||||
|
|
||||||
|
@push('js')
|
||||||
|
<script>
|
||||||
|
function initEditor(selector) {
|
||||||
|
var selector = '.editor';
|
||||||
|
$(selector).tinymce({});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@php(define('LOAD_EDITOR', true))
|
||||||
|
@endif
|
||||||
41
resources/views/load/form/editor/tinymce.blade.php
Normal file
41
resources/views/load/form/editor/tinymce.blade.php
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
@if(!defined('LOAD_TINYMCE'))
|
||||||
|
@push('js')
|
||||||
|
<script src="{!! mix('/js/tinymce/tinymce.min.js', '/assets/vendor/boilerplate') !!}"></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| |<br\/>|\r|\n)*?<\/(p|a|div|span|strike|strong|i|u)>/gi, ''); // Empty tags
|
||||||
|
},
|
||||||
|
skin : "boilerplate",
|
||||||
|
language: '{{ App::getLocale() }}'
|
||||||
|
};
|
||||||
|
|
||||||
|
function initEditor(sel) {
|
||||||
|
var selector = (typeof(sel) == 'undefined') ? '.editor' : sel;
|
||||||
|
$(selector).tinymce({});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
@php(define('LOAD_TINYMCE', true))
|
||||||
|
@endif
|
||||||
18
resources/views/load/form/select2.blade.php
Normal file
18
resources/views/load/form/select2.blade.php
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
@if(!defined('LOAD_SELECT2'))
|
||||||
|
@push('scripts')
|
||||||
|
<script src="{!! mix('/js/select2/select2.full.min.js', '/assets/vendor/boilerplate') !!}"></script>
|
||||||
|
<script src="{!! asset('/assets/vendor/boilerplate/js/select2/i18n/'.config('boilerplate.app.locale').'.js') !!}"></script>
|
||||||
|
<script>
|
||||||
|
function initSelect2() {
|
||||||
|
$(".select2").select2({
|
||||||
|
placeholder: "{{ __('select_a_value') }}",
|
||||||
|
allowClear: false,
|
||||||
|
width: {
|
||||||
|
value: '100%'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
@php(define('LOAD_SELECT2', true))
|
||||||
|
@endif
|
||||||
25
resources/views/load/form/set_options.blade.php
Normal file
25
resources/views/load/form/set_options.blade.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
@if(!defined('LOAD_SET_OPTIONS'))
|
||||||
|
@push('js')
|
||||||
|
<script>
|
||||||
|
function setOptions(selector,data,selected,all) {
|
||||||
|
// console.log(data);
|
||||||
|
console.log(selector);
|
||||||
|
var $el = $(selector);
|
||||||
|
$el.empty(); // remove old options
|
||||||
|
if (all) {
|
||||||
|
$el.append($("<option></option>").attr("value",'').text('{{ __("all") }}'));
|
||||||
|
}
|
||||||
|
$.each(data, function(key, name) {
|
||||||
|
if (key != null) {
|
||||||
|
if (key == selected) {
|
||||||
|
$el.append($("<option selected='selected'></option>").attr("value", key).text(name));
|
||||||
|
} else {
|
||||||
|
$el.append($("<option></option>").attr("value", key).text(name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
@php(define('LOAD_SET_OPTIONS', true))
|
||||||
|
@endif
|
||||||
34
resources/views/load/form/toggle.blade.php
Normal file
34
resources/views/load/form/toggle.blade.php
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
@if(!defined('LOAD_TOGGLE'))
|
||||||
|
@push('scripts')
|
||||||
|
<script src="{{ asset('/assets/plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js') }}"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function initToggle(url, sel, data, callback) {
|
||||||
|
var selector = (typeof(sel) == 'undefined') ? '.toggle' : sel;
|
||||||
|
if (typeof(data) == 'undefined') {
|
||||||
|
var data = {};
|
||||||
|
}
|
||||||
|
$(selector).bootstrapToggle();
|
||||||
|
|
||||||
|
$('input' + selector).change(function() {
|
||||||
|
console.log($(this));
|
||||||
|
data['id'] = $(this).data('id');
|
||||||
|
data['active'] = $(this).is(':checked');
|
||||||
|
if (data['id'] && (typeof(url) != 'undefined') && (url != '')) {
|
||||||
|
var dataJson = Object.assign({}, data);
|
||||||
|
$.post(url, dataJson);
|
||||||
|
}
|
||||||
|
if (typeof(callback) != 'undefined') {
|
||||||
|
eval(callback);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@push('css')
|
||||||
|
<link rel="stylesheet" href="{{ asset('/assets/plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css') }}">
|
||||||
|
@endpush
|
||||||
|
@php(define('LOAD_TOGGLE', true))
|
||||||
|
@endif
|
||||||
25
resources/views/load/form/upload/fileinput.blade.php
Normal file
25
resources/views/load/form/upload/fileinput.blade.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
@if(!defined('LOAD_FILEINPUT'))
|
||||||
|
@push('css')
|
||||||
|
<link rel="stylesheet" href="{!! mix('/js/fileinput/bootstrap-fileinput.min.css', '/assets/vendor/boilerplate') !!}">
|
||||||
|
@endpush
|
||||||
|
@push('js')
|
||||||
|
<script src="{!! mix('/js/fileinput/bootstrap-fileinput.min.js', '/assets/vendor/boilerplate') !!}"></script>
|
||||||
|
@if(App::getLocale() !== 'en')
|
||||||
|
<script src="{!! asset('/assets/vendor/boilerplate/js/fileinput/locales/'.config('boilerplate.app.locale').'.js') !!}"></script>
|
||||||
|
<script>
|
||||||
|
$.fn.fileinput.defaults.language = '{{ config('boilerplate.app.locale') }}';
|
||||||
|
</script>
|
||||||
|
@endif
|
||||||
|
@endpush
|
||||||
|
<script>
|
||||||
|
function initUpload(selector) {
|
||||||
|
var selector = '.file';
|
||||||
|
$(selector).fileinput({
|
||||||
|
showCaption: false,
|
||||||
|
dropZoneEnabled: false,
|
||||||
|
showUpload: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
@php(define('LOAD_FILEINPUT', true))
|
||||||
|
@endif
|
||||||
29
resources/views/load/form/upload/upload.blade.php
Normal file
29
resources/views/load/form/upload/upload.blade.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
@if(!defined('LOAD_FILEINPUT'))
|
||||||
|
@push('css')
|
||||||
|
<link rel="stylesheet" href="{!! mix('/js/fileinput/bootstrap-fileinput.min.css', '/assets/vendor/boilerplate') !!}">
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@push('js')
|
||||||
|
<script src="{!! mix('/js/fileinput/bootstrap-fileinput.min.js', '/assets/vendor/boilerplate') !!}"></script>
|
||||||
|
@if(App::getLocale() !== 'en')
|
||||||
|
<script src="{!! asset('/assets/vendor/boilerplate/js/fileinput/locales/' . App::getLocale() . '.js') !!}"></script>
|
||||||
|
<script>
|
||||||
|
$.fn.fileinput.defaults.language = '{{ App::getLocale() }}';
|
||||||
|
</script>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function initUpload(sel) {
|
||||||
|
var selector = (typeof(sel) == 'undefined') ? '.file' : sel;
|
||||||
|
$(selector).fileinput({
|
||||||
|
showCaption: false,
|
||||||
|
dropZoneEnabled: false,
|
||||||
|
showUpload: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@php(define('LOAD_FILEINPUT', true))
|
||||||
|
@endif
|
||||||
16
resources/views/load/form/url.blade.php
Normal file
16
resources/views/load/form/url.blade.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
@if(!defined('LOAD_URL'))
|
||||||
|
@include('load.layout.modal')
|
||||||
|
@push('js')
|
||||||
|
<script>
|
||||||
|
function initLoadUrl(sel) {
|
||||||
|
var selector = (typeof(sel) == 'undefined') ? '.btn-web' : sel;
|
||||||
|
|
||||||
|
$(selector).off().click(function() {
|
||||||
|
var url = $(this).closest('.input-group').find('.url').val();
|
||||||
|
viewModal(url);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
@php(define('LOAD_URL', true))
|
||||||
|
@endif
|
||||||
114
resources/views/load/layout/modal.blade.php
Normal file
114
resources/views/load/layout/modal.blade.php
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
@if(!defined('LOAD_MODAL'))
|
||||||
|
|
||||||
|
@push('js')
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function openModal(title, form_id, url_open, url_save, callback, size, no_confirm) {
|
||||||
|
var status = 0;
|
||||||
|
var dialog = bootbox.dialog({
|
||||||
|
title: title,
|
||||||
|
message: '<p><i class="fa fa-spin fa-spinner"></i> {{ __('loading') }} ...</p>',
|
||||||
|
size: size ? size : 'large',
|
||||||
|
scrollable: true,
|
||||||
|
onHide: function(e) {
|
||||||
|
console.log(status);
|
||||||
|
},
|
||||||
|
buttons: buildModalButtons(form_id, no_confirm)
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
changeModalContent(dialog, url_open);
|
||||||
|
var callback = handlePostModal(form_id,url_save, callback);
|
||||||
|
handlePostModal(form_id,url_save, callback);
|
||||||
|
*/
|
||||||
|
|
||||||
|
dialog.init(function() {
|
||||||
|
$.get(url_open, function(data) {
|
||||||
|
dialog.find('.bootbox-body').html(data);
|
||||||
|
handlePostModal(form_id,url_save, callback);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeModalContent(dialog, url, callback) {
|
||||||
|
dialog.init(function() {
|
||||||
|
$.get(url, function(data) {
|
||||||
|
dialog.find('.bootbox-body').html(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function viewModal(url, size, title) {
|
||||||
|
var dialog = bootbox.dialog({
|
||||||
|
title: title ? title : 'Web viewer',
|
||||||
|
message: '<iframe style="border:0;" src="' + url + '" height="400" width="100%"></iframe>',
|
||||||
|
size: size ? size : 'xl',
|
||||||
|
scrollable: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildModalButtons(form_id, no_confirm) {
|
||||||
|
if (!no_confirm) {
|
||||||
|
var buttons = {
|
||||||
|
cancel: {
|
||||||
|
label: '{{ __('cancel') }}',
|
||||||
|
className: 'btn-secondary'
|
||||||
|
},
|
||||||
|
confirm: {
|
||||||
|
label: '{{ __('save') }}',
|
||||||
|
className: 'btn-success',
|
||||||
|
callback: function() {
|
||||||
|
submitModal(form_id);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
buttons = '';
|
||||||
|
}
|
||||||
|
return buttons;
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitModal(form_id) {
|
||||||
|
/*
|
||||||
|
var data = $(form_id).serialize();
|
||||||
|
$.post(url_save, data)
|
||||||
|
.done(function(data) {
|
||||||
|
if (callback) {
|
||||||
|
eval(callback);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
if (typeof(tinyMCE) != 'undefined') {
|
||||||
|
tinyMCE.triggerSave();
|
||||||
|
}
|
||||||
|
var oForm = 'form' + form_id;
|
||||||
|
$(oForm).submit();
|
||||||
|
status = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePostModal(form_id,url_save, callback) {
|
||||||
|
var oForm = 'form'+form_id;
|
||||||
|
$(oForm).submit(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var formData = new FormData(this);
|
||||||
|
$.ajax({
|
||||||
|
url: url_save,
|
||||||
|
type: 'POST',
|
||||||
|
data: formData,
|
||||||
|
success: function (data) {
|
||||||
|
if (callback) {
|
||||||
|
eval(callback);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cache: false,
|
||||||
|
contentType: false,
|
||||||
|
processData: false
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@php(define('LOAD_MODAL', true))
|
||||||
|
@endif
|
||||||
29
resources/views/load/layout/nicescroll.blade.php
Normal file
29
resources/views/load/layout/nicescroll.blade.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
@if(!defined('LOAD_NICESCROLL'))
|
||||||
|
@push('scripts')
|
||||||
|
<script type="text/javascript" src="{{ asset('/assets/plugins/jquery.slimscroll.min.js') }}"></script>
|
||||||
|
<script>
|
||||||
|
function initScroll(selector) {
|
||||||
|
var selector = (typeof(selector) == 'undefined') ? '.nicescrollable' : selector;
|
||||||
|
|
||||||
|
$(selector).niceScroll({
|
||||||
|
horizrailenabled: false,
|
||||||
|
cursorborder: "0",
|
||||||
|
cursorwidth: "8px",
|
||||||
|
cursorcolor: "#fff",
|
||||||
|
zindex: "5555",
|
||||||
|
autohidemode: true,
|
||||||
|
bouncescroll: true,
|
||||||
|
mousescrollstep: 40,
|
||||||
|
scrollspeed: 100,
|
||||||
|
background: "#cdcdcd",
|
||||||
|
cursoropacitymin: 0.3,
|
||||||
|
cursoropacitymax: 0.7,
|
||||||
|
cursorborderradius: 0,
|
||||||
|
railpadding: {top:0,right:1,left:0,bottom:0}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
@php(define('LOAD_NICESCROLL', true))
|
||||||
|
@endif
|
||||||
6
resources/views/load/layout/slimscroll.blade.php
Normal file
6
resources/views/load/layout/slimscroll.blade.php
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
@if(!defined('LOAD_SLIMSCROLL'))
|
||||||
|
@push('scripts')
|
||||||
|
<script type="text/javascript" src="{{ asset('/assets/plugins/jquery.slimscroll.min.js') }}"></script>
|
||||||
|
@endpush
|
||||||
|
@php(define('LOAD_SLIMSCROLL', true))
|
||||||
|
@endif
|
||||||
39
resources/views/load/layout/tabs.blade.php
Normal file
39
resources/views/load/layout/tabs.blade.php
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
@if(!defined('LOAD_TABS'))
|
||||||
|
@push('scripts')
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function addTab(name, id, txt, url) {
|
||||||
|
|
||||||
|
var navContainer = $('#'+name);
|
||||||
|
var tabContainer = $('#'+name + '-tab');
|
||||||
|
var newTab = name + '-' + id;
|
||||||
|
var newTabId = '#' + newTab;
|
||||||
|
// create the tab
|
||||||
|
$('<a href="'+newTabId+'" data-toggle="tab" class="nav-item nav-link" role="tab">'+txt+'</a>').appendTo(navContainer);
|
||||||
|
|
||||||
|
var url_open = url + id;
|
||||||
|
|
||||||
|
$.get(url_open, function(content) {
|
||||||
|
$('<div class="tab-pane fade pt-0 pb-0" id="'+newTab+'"><div class="card mb-0 card-outline card-info"><div class="card-body">'+content+'</div></div></div>').appendTo(tabContainer);
|
||||||
|
|
||||||
|
// make the new tab active
|
||||||
|
// console.log('#' + tabname + ' .nav-item a:last');
|
||||||
|
// $('#' + tabname + ' .nav-item a:last').tab('show');
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeTab(name, id) {
|
||||||
|
var tabId = '#' + name + '-' + id;
|
||||||
|
// console.log('#' + name + "a[href='" + tabId + "'])");
|
||||||
|
$('#' + name + " a[href='" + tabId + "']").remove();
|
||||||
|
// console.log('remove ' + tabId);
|
||||||
|
$(tabId).remove();
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@php(define('LOAD_TABS', true))
|
||||||
|
@endif
|
||||||
Reference in New Issue
Block a user