diff --git a/app/Http/Controllers/Admin/Shop/MerchandiseController.php b/app/Http/Controllers/Admin/Shop/MerchandiseController.php new file mode 100644 index 00000000..4567bcb2 --- /dev/null +++ b/app/Http/Controllers/Admin/Shop/MerchandiseController.php @@ -0,0 +1,69 @@ +render('Admin.Shop.Merchandises.list'); + } + + public function create() + { + $data['tags_list'] = TagGroups::getTreeTags(); + return view('Admin.Shop.Merchandises.create', $data); + } + + public function store(Request $request) + { + $data = $request->all(); + Merchandises::storeFull($data); + return redirect()->route('Admin.Shop.Merchandises.index'); + } + + public function show($id) + { + return view('Admin.Shop.Merchandises.view', Merchandises::get($id)); + } + + public function edit($id) + { + $data['merchandise'] = Merchandises::getFull($id); + $data['tags_list'] = TagGroups::getTreeTags(); + return view('Admin.Shop.Merchandises.edit', $data); + } + + public function destroy($id) + { + return Merchandises::destroy($id); + } + + public function getImages(Request $request, $id = false, $can_edit = true) + { + $id = $id ? $id : $request->input('id'); + $data['images'] = Merchandises::getImages($id); + $data['can_edit'] = $can_edit; + return view('components.uploader.mini-gallery-items', $data); + } + + public function deleteImage(Request $request) + { + $id = $request->input('id'); + $index = $request->input('index'); + return Merchandises::deleteImage($id, $index); + } + + public function exportExcel() + { + return Merchandises::exportExcel(); + } +} diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index b5e17ce6..c4597183 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -6,8 +6,6 @@ use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\AuthenticatesUsers; use Illuminate\Support\Facades\Auth; use Illuminate\Http\Request; -use App\Repositories\Layout; -use Carbon\Carbon; class LoginController extends Controller { @@ -22,25 +20,11 @@ class LoginController extends Controller public function showLoginForm() { - $data = \App\Repositories\Config::init(); - return view('auth.login', $data); + return view('Shop.auth.login', $data); } public function authenticated(Request $request, $user) { - $request->session()->forget('password_expired_id'); - - if ($user->passwordSecurity->password_expiry_days > 0) { - $password_updated_at = $user->passwordSecurity->password_updated_at; - $password_expiry_days = $user->passwordSecurity->password_expiry_days; - $password_expiry_at = Carbon::parse($password_updated_at)->addDays($password_expiry_days); - if ($password_expiry_at->lessThan(Carbon::now())) { - $request->session()->put('password_expired_id', $user->id); - auth()->logout(); - return redirect('/reset-password')->with('message', "Your password is expired. You need to change your password."); - } - } - return redirect()->intended($this->redirectPath()); } diff --git a/app/Http/Controllers/Shop/Auth/ForgotPasswordController.php b/app/Http/Controllers/Shop/Auth/ForgotPasswordController.php new file mode 100644 index 00000000..dca0bc0d --- /dev/null +++ b/app/Http/Controllers/Shop/Auth/ForgotPasswordController.php @@ -0,0 +1,24 @@ +middleware('customer')->except('logout'); + // $this->middleware('guest')->except('logout'); } public function showLoginForm() { - $data['url'] = route('Shop.Auth.login.post'); - return view('Shop.Auth.login', $data); + $data['url'] = route('Shop.login.post'); + return view('Shop.auth.login', $data); } protected function guard() { - return Auth::guard('customer'); + return Auth::guard('guest'); } public function login(Request $request) { $this->validate($request, [ 'username' => 'required|email', - 'password' => 'required|min:6' + 'password' => 'required|min:8' ]); - if (Auth::guard('customer')->attempt(['username' => $request->username, 'password' => $request->password], $request->get('remember'))) { - return redirect()->intended(route('Conferencing.event')); + if (Auth::guard('guest')->attempt(['username' => $request->username, 'password' => $request->password], $request->get('remember'))) { + return redirect()->intended(route('home')); } return back()->withInput($request->only('username', 'remember')); } public function logout(Request $request) { - - // Get the session key for this user $sessionKey = $this->guard()->getName(); - $this->guard()->logout(); - - // Delete single session key (just for this user) $request->session()->forget($sessionKey); - return redirect()->route('home'); } public function username() { - return 'username'; + return 'email'; } } diff --git a/app/Http/Controllers/Shop/Auth/RegisterController.php b/app/Http/Controllers/Shop/Auth/RegisterController.php new file mode 100644 index 00000000..4bd5a0bd --- /dev/null +++ b/app/Http/Controllers/Shop/Auth/RegisterController.php @@ -0,0 +1,161 @@ +firstUser = $userModel::whereRoleIs('admin')->count() === 0; + } + + /** + * Return route where to redirect after login success. + * + * @return string + */ + protected function redirectTo() + { + return route(config('boilerplate.app.redirectTo', 'boilerplate.dashboard')); + } + + /** + * Get a validator for an incoming registration request. + * + * @param array $data + * @return \Illuminate\Contracts\Validation\Validator + */ + protected function validator(array $data) + { + return Validator::make($data, [ + 'last_name' => 'required|max:255', + 'first_name' => 'required|max:255', + 'email' => 'required|email|max:255|unique:users,email,NULL,id,deleted_at,NULL', + 'password' => ['required', 'confirmed', new Password()], + ]); + } + + /** + * Show the application registration form. + * + * @return Application|Factory|View + */ + public function showRegistrationForm() + { + if (! $this->firstUser && ! config('boilerplate.auth.register')) { + abort('404'); + } + + return view('boilerplate::auth.register', ['firstUser' => $this->firstUser]); + } + + /** + * Create a new user instance after a valid registration. + * + * @param array $data + * @return mixed + */ + protected function create(array $data) + { + if (! $this->firstUser && ! config('boilerplate.auth.register')) { + abort('404'); + } + + $userModel = config('auth.providers.users.model'); + $roleModel = config('laratrust.models.role'); + + $user = $userModel::withTrashed()->updateOrCreate(['email' => $data['email']], [ + 'active' => true, + 'first_name' => $data['first_name'], + 'last_name' => $data['last_name'], + 'email' => $data['email'], + 'password' => bcrypt($data['password']), + 'last_login' => Carbon::now()->toDateTimeString(), + ]); + + if ($this->firstUser) { + $admin = $roleModel::whereName('admin')->first(); + $user->attachRole($admin); + } else { + $user->restore(); + $role = $roleModel::whereName(config('boilerplate.auth.register_role'))->first(); + $user->roles()->sync([$role->id]); + } + + return $user; + } + + /** + * Show message to verify e-mail. + * + * @return Application|Factory|View + */ + public function emailVerify() + { + if (Auth::user()->hasVerifiedEmail()) { + return redirect(route(config('boilerplate.app.redirectTo', 'boilerplate.dashboard'))); + } + + return view('boilerplate::auth.verify-email'); + } + + /** + * If e-mail has been verified, redirect to the given route. + * + * @param EmailVerificationRequest $request + * @return Application|RedirectResponse|Redirector + */ + public function emailVerifyRequest(EmailVerificationRequest $request) + { + $request->fulfill(); + + return redirect(route(config('boilerplate.app.redirectTo', 'boilerplate.dashboard'))); + } + + /** + * Send verification e-mail. + * + * @param Request $request + * @return RedirectResponse + */ + public function emailSendVerification(Request $request) + { + $request->user()->sendEmailVerificationNotification(); + + return back()->with('message', 'Verification link sent!'); + } +} diff --git a/app/Http/Controllers/Shop/BasketController.php b/app/Http/Controllers/Shop/BasketController.php index e4a17822..468d8c3c 100644 --- a/app/Http/Controllers/Shop/BasketController.php +++ b/app/Http/Controllers/Shop/BasketController.php @@ -7,6 +7,8 @@ use App\Http\Controllers\Controller; use App\Repositories\Core\User\ShopCart; use App\Repositories\Shop\Offers; +use App\Repositories\Shop\Orders; + class BasketController extends Controller { @@ -52,6 +54,12 @@ class BasketController extends Controller return ShopCart::count(); } + public function getSummary() + { + $data = ShopCart::getSummary(); + return response()->json(['data' => $data, 'code' => '200']); + } + public function order(Request $request) { ShopCart::clear(); @@ -60,8 +68,6 @@ class BasketController extends Controller $data['user_id'] = Users::getId(); Orders::newOrder($data); return response()->json(['code' => '200']); - - // return redirect()->route('ThirdParty.select'); } public function clearBasket() diff --git a/app/Http/Controllers/Shop/Controller.php b/app/Http/Controllers/Shop/Controller.php new file mode 100644 index 00000000..65c8466f --- /dev/null +++ b/app/Http/Controllers/Shop/Controller.php @@ -0,0 +1,13 @@ +middleware('auth:guest'); + } +} diff --git a/app/Http/Controllers/Shop/HomeController.php b/app/Http/Controllers/Shop/HomeController.php index 27cc3fa5..f2feba9c 100644 --- a/app/Http/Controllers/Shop/HomeController.php +++ b/app/Http/Controllers/Shop/HomeController.php @@ -6,19 +6,11 @@ use Illuminate\Http\Request; use App\Http\Controllers\Controller; use App\Repositories\Shop\Articles; -use App\Repositories\Shop\Categories; -use App\Repositories\Shop\Offers; -use App\Repositories\Shop\Tags; use App\Repositories\Shop\TagGroups; use App\Repositories\Shop\Homepages; class HomeController extends Controller { - public function __construct() - { - // $this->middleware('auth'); - } - public function index(Request $request) { $input = $request->input(); diff --git a/app/Menu/Botanic.php b/app/Menu/Botanic.php index 08163c80..64aa561a 100644 --- a/app/Menu/Botanic.php +++ b/app/Menu/Botanic.php @@ -9,18 +9,24 @@ class Botanic { public function make(Builder $menu) { - $menu->add('Botanique', [ 'permission' => 'backend_access', 'icon' => 'leaf' ]) + $menu->add('Botanique', ['icon' => 'leaf' ]) ->id('botanic') - ->activeIfRoute('botanic') ->order(5); - $menu->addTo('botanic', 'Familles', [ 'route' => 'Admin.Botanic.Families.index', 'permission' => 'backend_access' ]) - ->activeIfRoute(['Admin.Botanic.Families.*'])->order(1); - $menu->addTo('botanic', 'Genres', [ 'route' => 'Admin.Botanic.Genres.index', 'permission' => 'backend_access' ]) - ->activeIfRoute(['Admin.Botanic.Genres.*'])->order(2); - $menu->addTo('botanic', 'Espèces', [ 'route' => 'Admin.Botanic.Species.index', 'permission' => 'backend_access' ]) - ->activeIfRoute(['Admin.Botanic.Species.*'])->order(3); - $menu->addTo('botanic', 'Variétés', [ 'route' => 'Admin.Botanic.Varieties.index', 'permission' => 'backend_access' ]) - ->activeIfRoute(['Admin.Botanic.Varieties.*'])->order(4); + $menu->addTo('botanic', 'Familles', [ + 'route' => 'Admin.Botanic.Families.index', + ])->activeIfRoute(['Admin.Botanic.Families.*'])->order(1); + + $menu->addTo('botanic', 'Genres', [ + 'route' => 'Admin.Botanic.Genres.index', + ])->activeIfRoute(['Admin.Botanic.Genres.*'])->order(2); + + $menu->addTo('botanic', 'Espèces', [ + 'route' => 'Admin.Botanic.Species.index', + ])->activeIfRoute(['Admin.Botanic.Species.*'])->order(3); + + $menu->addTo('botanic', 'Variétés', [ + 'route' => 'Admin.Botanic.Varieties.index', + ])->activeIfRoute(['Admin.Botanic.Varieties.*'])->order(4); } } diff --git a/app/Menu/Customers.php b/app/Menu/Customers.php index dc88e587..cf725150 100644 --- a/app/Menu/Customers.php +++ b/app/Menu/Customers.php @@ -8,15 +8,12 @@ class Customers { public function make(Builder $menu) { - $menu->add('Clients finaux', [ 'permission' => 'backend_access', 'icon' => 'address-card' ]) + $menu->add('Clients finaux', ['icon' => 'address-card' ]) ->id('customers') - ->activeIfRoute('customers') ->order(4); $menu->addTo('customers', __('customer.customers.name'), [ 'route' => 'Admin.Shop.Customers.index', - 'permission' => 'backend_access', - ]) - ->activeIfRoute(['Admin.Shop.Customers.*'])->order(1); + ])->activeIfRoute(['Admin.Shop.Customers.*'])->order(1); } } diff --git a/app/Menu/Deliveries.php b/app/Menu/Deliveries.php index dc72386f..ab3c723e 100644 --- a/app/Menu/Deliveries.php +++ b/app/Menu/Deliveries.php @@ -8,24 +8,16 @@ class Deliveries { public function make(Builder $menu) { - $menu->add('Modes de vente', [ - 'permission' => 'backend_access', - 'icon' => 'address-card' - ]) + $menu->add('Modes de vente', ['icon' => 'store']) ->id('sales_mode') - ->activeIfRoute('sales_mode') ->order(3); $menu->addTo('sales_mode', __('shop.sale_channels.name'), [ 'route' => 'Admin.Shop.SaleChannels.index', - 'permission' => 'backend_access', - ]) - ->activeIfRoute(['Admin.Shop.SaleChannels.*'])->order(1); + ])->activeIfRoute(['Admin.Shop.SaleChannels.*'])->order(1); $menu->addTo('sales_mode', __('shop.deliveries.title'), [ 'route' => 'Admin.Shop.Deliveries.index', - 'permission' => 'backend_access', - ]) - ->activeIfRoute(['Admin.Shop.Deliveries.*'])->order(1); + ])->activeIfRoute(['Admin.Shop.Deliveries.*'])->order(1); } } diff --git a/app/Menu/Orders.php b/app/Menu/Orders.php index a4b1a8d6..6f7b84c6 100644 --- a/app/Menu/Orders.php +++ b/app/Menu/Orders.php @@ -8,18 +8,24 @@ class Orders { public function make(Builder $menu) { - $menu->add('Commandes', [ 'permission' => 'backend_access', 'icon' => 'shopping-basket' ]) + $menu->add('Commandes', ['icon' => 'shopping-basket']) ->id('orders') - ->activeIfRoute('orders') ->order(1); - $menu->addTo('orders', 'Commandes', [ 'route' => 'Admin.Shop.Orders.index', 'permission' => 'backend_access' ]) - ->activeIfRoute(['Admin.Shop.Orders.*'])->order(1); - $menu->addTo('orders', 'Factures', [ 'route' => 'Admin.Shop.Invoices.index', 'permission' => 'backend_access' ]) - ->activeIfRoute(['Admin.Shop.Invoices.*'])->order(2); - $menu->addTo('orders', 'Avoirs', [ 'route' => 'Admin.Shop.Invoices.index', 'permission' => 'backend_access' ]) - ->activeIfRoute(['Admin.Shop.Invoices.*'])->order(3); - $menu->addTo('orders', 'Bons de livraison', [ 'route' => 'Admin.Shop.Invoices.index', 'permission' => 'backend_access' ]) - ->activeIfRoute(['Admin.Shop.Invoices.*'])->order(4); + $menu->addTo('orders', 'Commandes', [ + 'route' => 'Admin.Shop.Orders.index', + ])->activeIfRoute(['Admin.Shop.Orders.*'])->order(1); + + $menu->addTo('orders', 'Factures', [ + 'route' => 'Admin.Shop.Invoices.index', + ])->activeIfRoute(['Admin.Shop.Invoices.*'])->order(2); + + $menu->addTo('orders', 'Avoirs', [ + 'route' => 'Admin.Shop.Invoices.index', + ])->activeIfRoute(['Admin.Shop.Invoices.*'])->order(3); + + $menu->addTo('orders', 'Bons de livraison', [ + 'route' => 'Admin.Shop.Invoices.index', + ])->activeIfRoute(['Admin.Shop.Invoices.*'])->order(4); } } diff --git a/app/Menu/Shop.php b/app/Menu/Shop.php index e6694e11..2dd8528c 100644 --- a/app/Menu/Shop.php +++ b/app/Menu/Shop.php @@ -8,43 +8,57 @@ class Shop { public function make(Builder $menu) { - $menu->add('En vente', [ 'permission' => 'backend_access', 'icon' => 'store' ]) + $menu->add('En vente', ['icon' => 'shopping-cart' ]) ->id('shop') ->activeIfRoute('shop') ->order(2); - $menu->addTo('shop', 'Articles', [ 'route' => 'Admin.Shop.Articles.index', 'permission' => 'backend_access' ]) - ->activeIfRoute(['Admin.Shop.Articles.*'])->order(1); - $menu->addTo('shop', 'Déclinaisons', [ 'route' => 'Admin.Shop.Variations.index', 'permission' => 'backend_access' ]) - ->activeIfRoute(['Admin.Shop.Variations.*'])->order(2); - $menu->addTo('shop', 'Tarifs', [ 'route' => 'Admin.Shop.Tariffs.index', 'permission' => 'backend_access' ]) - ->activeIfRoute(['Admin.Shop.Tariffs.*'])->order(3); - $menu->addTo('shop', 'Offres', [ 'route' => 'Admin.Shop.Offers.index', 'permission' => 'backend_access' ]) - ->activeIfRoute(['Admin.Shop.Offers.*'])->order(4); + $menu->addTo('shop', 'Articles', [ + 'route' => 'Admin.Shop.Articles.index', + ])->activeIfRoute(['Admin.Shop.Articles.*'])->order(1); + + $menu->addTo('shop', 'Déclinaisons', [ + 'route' => 'Admin.Shop.Variations.index', + ])->activeIfRoute(['Admin.Shop.Variations.*'])->order(2); + + $menu->addTo('shop', 'Tarifs', [ + 'route' => 'Admin.Shop.Tariffs.index', + ])->activeIfRoute(['Admin.Shop.Tariffs.*'])->order(3); + + $menu->addTo('shop', 'Offres', [ + 'route' => 'Admin.Shop.Offers.index', + ])->activeIfRoute(['Admin.Shop.Offers.*'])->order(4); - $menu->addTo('shop', 'Rayons', [ 'route' => 'Admin.Shop.Categories.index', 'permission' => 'backend_access' ]) - ->activeIfRoute(['Admin.Shop.Categories.*'])->order(6); + $menu->addTo('shop', 'Rayons', [ + 'route' => 'Admin.Shop.Categories.index', + ])->activeIfRoute(['Admin.Shop.Categories.*'])->order(6); - $menu->addTo('shop', 'Tags', [ 'route' => 'Admin.Shop.Tags.index', 'permission' => 'backend_access' ]) - ->activeIfRoute(['Admin.Shop.Tags.*'])->order(8); + $menu->addTo('shop', 'Tags', [ + 'route' => 'Admin.Shop.Tags.index', + ])->activeIfRoute(['Admin.Shop.Tags.*'])->order(8); - $menu->addTo('shop', 'Groupes de tags', [ 'route' => 'Admin.Shop.TagGroups.index', 'permission' => 'backend_access' ]) - ->activeIfRoute(['Admin.Shop.TagGroups.*'])->order(8); + $menu->addTo('shop', 'Groupes de tags', [ + 'route' => 'Admin.Shop.TagGroups.index', + ])->activeIfRoute(['Admin.Shop.TagGroups.*'])->order(8); - $menu->addTo('shop', 'Natures d\'articles', [ 'route' => 'Admin.Shop.ArticleNatures.index', 'permission' => 'backend_access' ]) - ->activeIfRoute(['Admin.Shop.ArticleNatures.*'])->order(9); + $menu->addTo('shop', 'Natures d\'articles', [ + 'route' => 'Admin.Shop.ArticleNatures.index', + ])->activeIfRoute(['Admin.Shop.ArticleNatures.*'])->order(9); - $menu->addTo('shop', 'Packages', [ 'route' => 'Admin.Shop.Packages.index', 'permission' => 'backend_access' ]) - ->activeIfRoute(['Admin.Shop.Packages.*'])->order(12); + $menu->addTo('shop', 'Packages', [ + 'route' => 'Admin.Shop.Packages.index', + ])->activeIfRoute(['Admin.Shop.Packages.*'])->order(12); - $menu->addTo('shop', 'Unités de tarifs', [ 'route' => 'Admin.Shop.TariffUnities.index', 'permission' => 'backend_access' ]) - ->activeIfRoute(['Admin.Shop.TariffUnities.*'])->order(13); + $menu->addTo('shop', 'Unités de tarifs', [ + 'route' => 'Admin.Shop.TariffUnities.index', + ])->activeIfRoute(['Admin.Shop.TariffUnities.*'])->order(13); - $menu->addTo('shop', 'Unités', [ 'route' => 'Admin.Shop.Unities.index', 'permission' => 'backend_access' ]) - ->activeIfRoute(['Admin.Shop.Unities.*'])->order(14); - - $menu->addTo('shop', 'Accueil', [ 'route' => 'Admin.Shop.Homepages.index', 'permission' => 'backend_access' ]) - ->activeIfRoute(['Admin.Shop.Homepages.*'])->order(14); + $menu->addTo('shop', 'Unités', [ + 'route' => 'Admin.Shop.Unities.index', + ])->activeIfRoute(['Admin.Shop.Unities.*'])->order(14); + $menu->addTo('shop', 'Accueil', [ + 'route' => 'Admin.Shop.Homepages.index', + ])->activeIfRoute(['Admin.Shop.Homepages.*'])->order(14); } } diff --git a/app/Models/Shop/Category.php b/app/Models/Shop/Category.php index d877422f..69292255 100644 --- a/app/Models/Shop/Category.php +++ b/app/Models/Shop/Category.php @@ -2,22 +2,15 @@ namespace App\Models\Shop; -use Illuminate\Database\Eloquent\Model; - -use Spatie\MediaLibrary\HasMedia; -use Spatie\MediaLibrary\InteractsWithMedia; -use Spatie\MediaLibrary\MediaCollections\Models\Media; - -// use Rinvex\Categories\Traits\Categorizable; use Cesargb\Database\Support\CascadeDelete; use Rinvex\Tags\Traits\Taggable; use Wildside\Userstamps\Userstamps; -// use Kalnoy\Nestedset\NodeTrait; - use Rinvex\Categories\Models\Category as parentCategory; use Kalnoy\Nestedset\NestedSet; +use App\Repositories\Shop\SaleChannels; + class Category extends parentCategory { use CascadeDelete, Taggable, Userstamps; @@ -72,4 +65,12 @@ class Category extends parentCategory { return $query->where('id', '<>', 1); } + + public function scopeHasAvailableOffers($query, $sale_channel_id = false) + { + $sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID(); + return $query->whereHas('articles', function ($query) use ($sale_channel_id) { + $query->WithAvailableOffers($sale_channel_id); + }); + } } diff --git a/app/Models/Shop/Homepage.php b/app/Models/Shop/Homepage.php index eeee427d..e89bb2da 100644 --- a/app/Models/Shop/Homepage.php +++ b/app/Models/Shop/Homepage.php @@ -7,4 +7,6 @@ use Illuminate\Database\Eloquent\Model; class Homepage extends Model { protected $guarded = ['id']; + protected $table = 'shop_homepages'; + } diff --git a/app/Repositories/Core/Categories.php b/app/Repositories/Core/Categories.php index 91ccd930..1e18469b 100644 --- a/app/Repositories/Core/Categories.php +++ b/app/Repositories/Core/Categories.php @@ -33,9 +33,10 @@ class Categories return self::getModel()->defaultOrder()->get()->toTree(); } - public static function getCategoryTreeVisibles() + public static function getCategoryTreeVisibles($sale_channel_id = false) { - return self::getModel()->defaultOrder()->where('visible', 1)->get()->toTree(); + // return self::getModel()->defaultOrder()->visible()->hasAvailableOffers($sale_channel_id)->get()->toTree(); + return self::getModel()->defaultOrder()->visible()->get()->toTree(); } public static function getChildren($data, $withFolder = false) diff --git a/app/Repositories/Core/User/ShopCart.php b/app/Repositories/Core/User/ShopCart.php index 417b7a23..21cb4af0 100644 --- a/app/Repositories/Core/User/ShopCart.php +++ b/app/Repositories/Core/User/ShopCart.php @@ -19,6 +19,15 @@ class ShopCart ]; } + public static function getSummary() + { + return [ + 'count' => self::count(), + 'quantity' => self::getTotalQuantity(), + 'total' => self::getTotal(), + ]; + } + public static function remove($id) { return self::get()->remove($id); diff --git a/app/Repositories/Shop/Articles.php b/app/Repositories/Shop/Articles.php index bfc0aeeb..a63f493f 100644 --- a/app/Repositories/Shop/Articles.php +++ b/app/Repositories/Shop/Articles.php @@ -486,5 +486,4 @@ class Articles { return self::update(['homepage' => $homepage], $id); } - } diff --git a/app/Traits/Repository/Imageable.php b/app/Traits/Repository/Imageable.php index a45469fd..2b66d79e 100644 --- a/app/Traits/Repository/Imageable.php +++ b/app/Traits/Repository/Imageable.php @@ -33,7 +33,7 @@ trait Imageable public static function getPreviewSrc($image) { - return $image ? Medias::getPreviewSrc($image) : null; + return $image ? Medias::getPreviewSrc($image) : '/img/visuel-non-disponible.jpg'; } public static function getImage($image) @@ -43,7 +43,7 @@ trait Imageable public static function getImageSrc($image) { - return $image ? Medias::getImageSrc($image) : null; + return $image ? Medias::getImageSrc($image) : '/img/visuel-non-disponible.jpg'; } public static function deleteImage($id, $index) diff --git a/build/js/site.js b/build/js/site.js index 04302416..f6eb0e3b 100644 --- a/build/js/site.js +++ b/build/js/site.js @@ -1,18 +1,17 @@ // Prevent closing from click inside dropdown $(document).on('click', '.dropdown-menu', function (e) { e.stopPropagation(); - }); +}); - // make it as accordion for smaller screens - if ($(window).width() < 992) { - $('.dropdown-menu a').click(function(e){ - e.preventDefault(); - if($(this).next('.submenu').length){ - $(this).next('.submenu').toggle(); +// make it as accordion for smaller screens +if ($(window).width() < 992) { + $('.dropdown-menu a').click(function(e) { + e.preventDefault(); + if ($(this).next('.submenu').length) { + $(this).next('.submenu').toggle(); } $('.dropdown').on('hide.bs.dropdown', function () { - $(this).find('.submenu').hide(); - }) + $(this).find('.submenu').hide(); + }); }); - } - \ No newline at end of file +} diff --git a/composer.json b/composer.json index 11442ac4..8298f6e4 100644 --- a/composer.json +++ b/composer.json @@ -62,7 +62,6 @@ "mpdf/mpdf": "^8.0", "mpociot/teamwork": "^6.1", "nicmart/tree": "^0.3", - "olssonm/laravel-backup-shield": "^3.1", "orangehill/iseed": "^3.0", "php-console/php-console": "^3.1", "proengsoft/laravel-jsvalidation": "^4.5", @@ -79,7 +78,7 @@ "spatie/eloquent-sortable": "^4.0", "spatie/image-optimizer": "^1.4", "spatie/laravel-activitylog": "^3.6", - "spatie/laravel-backup": "^6.16", + "spatie/laravel-backup": "^7.0", "spatie/laravel-mail-preview": "^4.0", "spatie/laravel-medialibrary": "^9.6", "spatie/laravel-stats": "^1.0", diff --git a/config/auth.php b/config/auth.php index aaf982bc..811e37e0 100644 --- a/config/auth.php +++ b/config/auth.php @@ -41,6 +41,11 @@ return [ 'provider' => 'users', ], + 'guest' => [ + 'driver' => 'session', + 'provider' => 'guests', + ], + 'api' => [ 'driver' => 'token', 'provider' => 'users', @@ -71,6 +76,11 @@ return [ 'model' => App\User::class, ], + 'guests' => [ + 'driver' => 'eloquent', + 'model' => App\Models\Shop\Customer::class, + ], + // 'users' => [ // 'driver' => 'database', // 'table' => 'users', @@ -99,6 +109,12 @@ return [ 'expire' => 60, 'throttle' => 60, ], + 'guests' => [ + 'provider' => 'guests', + 'table' => 'shop_customer_password_resets', + 'expire' => 60, + 'throttle' => 60, + ], ], /* diff --git a/config/backup-shield.php b/config/backup-shield.php deleted file mode 100644 index 1927265c..00000000 --- a/config/backup-shield.php +++ /dev/null @@ -1,12 +0,0 @@ - env('APP_KEY'), - 'encryption' => \Olssonm\BackupShield\Encryption::ENCRYPTION_DEFAULT - - // Available encryption methods: - // \Olssonm\BackupShield\Encryption::ENCRYPTION_DEFAULT (AES 128) - // \Olssonm\BackupShield\Encryption::ENCRYPTION_WINZIP_AES_128 (AES 128) - // \Olssonm\BackupShield\Encryption::ENCRYPTION_WINZIP_AES_192 (AES 192) - // \Olssonm\BackupShield\Encryption::ENCRYPTION_WINZIP_AES_256 (AES 256) - ]; diff --git a/config/boilerplate/app.php b/config/boilerplate/app.php index 056f6494..2db442aa 100644 --- a/config/boilerplate/app.php +++ b/config/boilerplate/app.php @@ -13,5 +13,5 @@ return [ // Backend locale 'locale' => config('app.locale'), - 'logs' => false, + 'logs' => true, ]; diff --git a/database/migrations/2020_04_20_212813_create_shop_customers_table.php b/database/migrations/2020_04_20_212813_create_shop_customers_table.php index 8493bc80..5473db21 100644 --- a/database/migrations/2020_04_20_212813_create_shop_customers_table.php +++ b/database/migrations/2020_04_20_212813_create_shop_customers_table.php @@ -15,13 +15,14 @@ class CreateShopCustomersTable extends Migration { Schema::create('shop_customers', function(Blueprint $table) { $table->increments('id'); - $table->string('name', 50)->default('0'); - $table->string('address1', 50)->default('0'); - $table->string('address2', 50)->default('0'); - $table->string('zipcode', 50)->default('0'); - $table->string('city', 50)->default('0'); - $table->string('country', 50)->default('0'); + $table->string('first_name')->nullable(); + $table->string('last_name')->nullable(); + $table->string('email')->unique(); + $table->dateTime('email_verified_at')->nullable(); + $table->string('password'); + $table->string('remember_token', 100)->nullable(); $table->timestamps(); + $table->softDeletes(); }); } diff --git a/database/migrations/2021_06_05_192053_teamwork_setup_tables.php b/database/migrations/2021_06_05_192053_teamwork_setup_tables.php deleted file mode 100644 index 144f40c9..00000000 --- a/database/migrations/2021_06_05_192053_teamwork_setup_tables.php +++ /dev/null @@ -1,83 +0,0 @@ -integer('current_team_id')->unsigned()->nullable(); - }); - - Schema::create(\Config::get('teamwork.teams_table'), function (Blueprint $table) { - $table->increments('id')->unsigned(); - $table->integer('owner_id')->unsigned()->nullable(); - $table->string('name'); - $table->timestamps(); - }); - - Schema::create(\Config::get('teamwork.team_user_table'), function (Blueprint $table) { - $table->bigInteger('user_id')->unsigned(); - $table->integer('team_id')->unsigned(); - $table->timestamps(); - - $table->foreign('user_id') - ->references(\Config::get('teamwork.user_foreign_key')) - ->on(\Config::get('teamwork.users_table')) - ->onUpdate('cascade') - ->onDelete('cascade'); - - $table->foreign('team_id') - ->references('id') - ->on(\Config::get('teamwork.teams_table')) - ->onDelete('cascade'); - }); - - Schema::create(\Config::get('teamwork.team_invites_table'), function (Blueprint $table) { - $table->increments('id'); - $table->bigInteger('user_id')->unsigned(); - $table->integer('team_id')->unsigned(); - $table->enum('type', ['invite', 'request']); - $table->string('email'); - $table->string('accept_token'); - $table->string('deny_token'); - $table->timestamps(); - $table->foreign('team_id') - ->references('id') - ->on(\Config::get('teamwork.teams_table')) - ->onDelete('cascade'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table(\Config::get('teamwork.users_table'), function (Blueprint $table) { - $table->dropColumn('current_team_id'); - }); - - Schema::table(\Config::get('teamwork.team_user_table'), function (Blueprint $table) { - if (DB::getDriverName() !== 'sqlite') { - $table->dropForeign(\Config::get('teamwork.team_user_table').'_user_id_foreign'); - } - if (DB::getDriverName() !== 'sqlite') { - $table->dropForeign(\Config::get('teamwork.team_user_table').'_team_id_foreign'); - } - }); - - Schema::drop(\Config::get('teamwork.team_user_table')); - Schema::drop(\Config::get('teamwork.team_invites_table')); - Schema::drop(\Config::get('teamwork.teams_table')); - } -} diff --git a/package.json b/package.json index 4a8c3ed9..a62e5c43 100644 --- a/package.json +++ b/package.json @@ -86,6 +86,7 @@ "handlebars-layouts": "^3.1.4", "highcharts": "^9.1.2", "highcharts-export-server": "^2.1.0", + "html-number-spinner": "^1.1.2", "icheck": "^1.0.2", "icheck-bootstrap": "^3.0.1", "input-switch": "^1.1.0", diff --git a/resources/views/Admin/Shop/Merchandises/create.blade.php b/resources/views/Admin/Shop/Merchandises/create.blade.php new file mode 100644 index 00000000..15dd0396 --- /dev/null +++ b/resources/views/Admin/Shop/Merchandises/create.blade.php @@ -0,0 +1,11 @@ +@extends('layout.index', [ + 'title' => __('shop.merchandises.title'), + 'subtitle' => __('shop.merchandises.add'), + 'breadcrumb' => [__('shop.merchandises.title'), __('shop.merchandises.add')] +]) + +@section('content') + {{ Form::open(['route' => 'Admin.Shop.Merchandises.store', 'id' => 'form', 'autocomplete' => 'off', 'files' => true]) }} + @include('Admin.Shop.Merchandises.form') + +@endsection diff --git a/resources/views/Admin/Shop/Merchandises/edit.blade.php b/resources/views/Admin/Shop/Merchandises/edit.blade.php new file mode 100644 index 00000000..fcb94a29 --- /dev/null +++ b/resources/views/Admin/Shop/Merchandises/edit.blade.php @@ -0,0 +1,12 @@ +@extends('layout.index', [ + 'title' => __('Shop.merchandises.title'), + 'subtitle' => __('Shop.merchandises.edit'), + 'breadcrumb' => [__('Shop.merchandises.title'), __('Shop.merchandises.edit')] +]) + +@section('content') + {{ Form::open(['route' => 'Admin.Shop.Merchandises.store', 'id' => 'form', 'autocomplete' => 'off', 'files' => true]) }} + + @include('Admin.Shop.Merchandises.form') + +@endsection diff --git a/resources/views/Admin/Shop/Merchandises/form.blade.php b/resources/views/Admin/Shop/Merchandises/form.blade.php new file mode 100644 index 00000000..562ec17a --- /dev/null +++ b/resources/views/Admin/Shop/Merchandises/form.blade.php @@ -0,0 +1,62 @@ +
- @endif
+
+ {{ __('boilerplate::auth.firstlogin.intro') }}
+:message
') !!} +:message
') !!} +
+ :message
') !!} +:message
') !!} +{{ __('boilerplate::auth.password.intro') }}
+ @if (session('status')) +:message
') !!} +{{ __('boilerplate::auth.password_reset.intro') }}
+ {!! Form::open(['route' => 'boilerplate.password.reset.post', 'method' => 'post', 'autocomplete'=> 'off']) !!} + {!! Form::hidden('token', $token) !!} +:message
') !!} +:message
') !!} +:message
') !!} +{{ __('boilerplate::auth.register.intro') }}
+ {!! Form::open(['route' => 'boilerplate.register', 'method' => 'post', 'autocomplete'=> 'off']) !!} +:message
') !!} +:message
') !!} +:message
') !!} +:message
') !!} +:message
') !!} +