Filters collapsed, customer auth and register, fix on basket recalculation

This commit is contained in:
Ludovic CANDELLIER
2022-04-20 00:16:16 +02:00
parent 483aa59750
commit 6837954fc9
31 changed files with 218 additions and 251 deletions

View File

@@ -20,7 +20,7 @@ class LoginController extends Controller
public function showLoginForm() public function showLoginForm()
{ {
return view('Shop.auth.login', $data); return view('Shop.auth.login', $data ?? []);
} }
public function authenticated(Request $request, $user) public function authenticated(Request $request, $user)

View File

@@ -7,64 +7,39 @@ use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Repositories\Layout;
use App\Repositories\Languages;
use App\Repositories\Shop\Customers;
class LoginController extends Controller class LoginController extends Controller
{ {
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers; use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = '/'; protected $redirectTo = '/';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct() public function __construct()
{ {
// $this->middleware('guest')->except('logout'); // $this->middleware('guest')->except('logout');
} }
protected function guard()
{
return Auth::guard('customer');
}
public function showLoginForm() public function showLoginForm()
{ {
$data['url'] = route('Shop.login.post'); $data['url'] = route('Shop.login.post');
return view('Shop.auth.login', $data); return view('Shop.auth.login', $data);
} }
protected function guard()
{
return Auth::guard('guest');
}
public function login(Request $request) public function login(Request $request)
{ {
$this->validate($request, [ $this->validate($request, [
'username' => 'required|email', 'email' => 'required|email',
'password' => 'required|min:8' 'password' => 'required|min:8',
]); ]);
if (Auth::guard('guest')->attempt(['username' => $request->username, 'password' => $request->password], $request->get('remember'))) { if (Auth::guard('customer')->attempt(['email' => $request->email, 'password' => $request->password], $request->get('remember'))) {
return redirect()->intended(route('home')); return redirect()->intended(route('home'));
} }
return back()->withInput($request->only('username', 'remember')); return back()->withInput($request->only('email', 'remember'));
} }
public function logout(Request $request) public function logout(Request $request)

View File

@@ -16,114 +16,52 @@ use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use Sebastienheyd\Boilerplate\Rules\Password; use Sebastienheyd\Boilerplate\Rules\Password;
use App\Models\Shop\Customer;
class RegisterController extends Controller class RegisterController extends Controller
{ {
use RegistersUsers; use RegistersUsers;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo; protected $redirectTo;
/** protected function guard()
* Is registering the first user ?
*
* @var bool
*/
protected $firstUser;
/**
* Create a new controller instance.
*/
public function __construct()
{ {
$userModel = config('auth.providers.users.model'); return Auth::guard('customer');
$this->firstUser = $userModel::whereRoleIs('admin')->count() === 0;
} }
/**
* Return route where to redirect after login success.
*
* @return string
*/
protected function redirectTo() protected function redirectTo()
{ {
return route(config('boilerplate.app.redirectTo', 'boilerplate.dashboard')); 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) protected function validator(array $data)
{ {
return Validator::make($data, [ return Validator::make($data, [
'last_name' => 'required|max:255', 'last_name' => 'required|max:255',
'first_name' => 'required|max:255', 'first_name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users,email,NULL,id,deleted_at,NULL', 'email' => 'required|email|max:255|unique:shop_customers,email,NULL,id,deleted_at,NULL',
'password' => ['required', 'confirmed', new Password()], 'password' => ['required', 'confirmed', new Password()],
]); ]);
} }
/**
* Show the application registration form.
*
* @return Application|Factory|View
*/
public function showRegistrationForm() public function showRegistrationForm()
{ {
if (! $this->firstUser && ! config('boilerplate.auth.register')) { return view('Shop.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) protected function create(array $data)
{ {
if (! $this->firstUser && ! config('boilerplate.auth.register')) { $user = Customer::withTrashed()->updateOrCreate(['email' => $data['email']], [
abort('404');
}
$userModel = config('auth.providers.users.model');
$roleModel = config('laratrust.models.role');
$user = $userModel::withTrashed()->updateOrCreate(['email' => $data['email']], [
'active' => true, 'active' => true,
'first_name' => $data['first_name'], 'first_name' => $data['first_name'],
'last_name' => $data['last_name'], 'last_name' => $data['last_name'],
'email' => $data['email'], 'email' => $data['email'],
'password' => bcrypt($data['password']), '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; return $user;
} }
/**
* Show message to verify e-mail.
*
* @return Application|Factory|View
*/
public function emailVerify() public function emailVerify()
{ {
if (Auth::user()->hasVerifiedEmail()) { if (Auth::user()->hasVerifiedEmail()) {
@@ -133,25 +71,12 @@ class RegisterController extends Controller
return view('boilerplate::auth.verify-email'); 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) public function emailVerifyRequest(EmailVerificationRequest $request)
{ {
$request->fulfill(); $request->fulfill();
return redirect(route(config('boilerplate.app.redirectTo', 'boilerplate.dashboard'))); return redirect(route(config('boilerplate.app.redirectTo', 'boilerplate.dashboard')));
} }
/**
* Send verification e-mail.
*
* @param Request $request
* @return RedirectResponse
*/
public function emailSendVerification(Request $request) public function emailSendVerification(Request $request)
{ {
$request->user()->sendEmailVerificationNotification(); $request->user()->sendEmailVerificationNotification();

View File

@@ -8,31 +8,10 @@ use Illuminate\Foundation\Auth\ResetsPasswords;
class ResetPasswordController extends Controller class ResetPasswordController extends Controller
{ {
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords; use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo = '/'; protected $redirectTo = '/';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct() public function __construct()
{ {
$this->middleware('guest'); $this->middleware('guest');

View File

@@ -18,12 +18,14 @@ class CategoryController extends Controller
return $dataTable->render('Shop.Categories.list'); return $dataTable->render('Shop.Categories.list');
} }
public function show(Request $request, $category_id) public function show($category_id, $by_rows = false)
{ {
$data = self::init(); $data = self::init();
$data['display_by_rows'] = $request->input('by_rows') ?? false; $data['display_by_rows'] = $by_rows;
$data['category'] = Categories::getFull($category_id); $data['category'] = Categories::getFull($category_id);
$data['articles'] = Articles::getArticlesToSell(['category_id' => $category_id]); $data['articles'] = Articles::getArticlesToSell(['category_id' => $category_id]);
// dump($data['articles']);
// exit;
$data['tags'] = TagGroups::getWithTagsAndCountOffers(); $data['tags'] = TagGroups::getWithTagsAndCountOffers();
return view('Shop.shelve', $data); return view('Shop.shelve', $data);
} }

View File

@@ -6,29 +6,16 @@ use Carbon\Carbon;
use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use Yadahan\AuthenticationLog\AuthenticationLogable; use Yadahan\AuthenticationLog\AuthenticationLogable;
use HighIdeas\UsersOnline\Traits\UsersOnlineTrait; // use HighIdeas\UsersOnline\Traits\UsersOnlineTrait;
use Sebastienheyd\Boilerplate\Models\User as parentUser; use Sebastienheyd\Boilerplate\Models\User as parentUser;
class User extends parentUser class User extends parentUser
{ {
// use UserHasTeams; // use UserHasTeams, UsersOnlineTrait;
use AuthenticationLogable, SoftDeletes, UsersOnlineTrait; use AuthenticationLogable, SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['active', 'last_name', 'first_name', 'username', 'email', 'password', 'remember_token', 'last_login']; protected $fillable = ['active', 'last_name', 'first_name', 'username', 'email', 'password', 'remember_token', 'last_login'];
protected $hidden = ['password', 'remember_token']; protected $hidden = ['password', 'remember_token'];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [ protected $casts = [
'email_verified_at' => 'datetime', 'email_verified_at' => 'datetime',
]; ];

View File

@@ -94,6 +94,21 @@ class Article extends Model implements HasMedia
return $query->where($this->table . '.article_nature_id', $id); return $query->where($this->table . '.article_nature_id', $id);
} }
public function scopeByCategories($query, $categories_id)
{
return $categories_id ? $query->whereHas('categories', function ($query) use ($categories_id) {
$query->whereIn('id', $categories_id);
}) : $query;
}
public function scopeByCategoryParent($query, $category_id)
{
$category = Category::find($category_id);
return $category_id ? $query->whereHas('categories', function ($query) use ($category) {
$query->where('_lft', '>=', $category->_lft)->where('_rgt', '<=', $category->_rgt);
}) : $query;
}
public function scopeByCategory($query, $category_id) public function scopeByCategory($query, $category_id)
{ {
return $category_id ? $query->whereHas('categories', function ($query) use ($category_id) { return $category_id ? $query->whereHas('categories', function ($query) use ($category_id) {

View File

@@ -3,11 +3,19 @@
namespace App\Models\Shop; namespace App\Models\Shop;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Yadahan\AuthenticationLog\AuthenticationLogable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class Customer extends Model class Customer extends Authenticatable
{ {
use AuthenticationLogable, SoftDeletes;
protected $guarded = ['id']; protected $guarded = ['id'];
protected $table = 'shop_customers'; protected $table = 'shop_customers';
protected $fillable = ['active', 'last_name', 'first_name', 'username', 'email', 'password', 'remember_token', 'settings', 'last_login'];
protected $hidden = ['password', 'remember_token'];
protected $casts = ['email_verified_at' => 'datetime',];
public function addresses() public function addresses()
{ {

View File

@@ -12,10 +12,13 @@ class ShopCart
{ {
if (self::has($item['id'])) { if (self::has($item['id'])) {
if ($update) { if ($update) {
self::remove($id); self::remove($item['id']);
$ret = self::get()->add($item); $ret = self::get()->add($item);
// $ret = self::get()->update($item['id'], ['quantity' => $item['quantity']]);
} else { } else {
$ret = self::get()->update($item['id'], ['quantity' => $item['quantity']]); $ret = self::get()->update($item['id'], ['quantity' => $item['quantity']]);
// self::remove($item['id']);
// $ret = self::get()->add($item);
} }
} else { } else {
$ret = self::get()->add($item); $ret = self::get()->add($item);
@@ -45,7 +48,7 @@ class ShopCart
public static function clear() public static function clear()
{ {
Cart::clear(); Cart::clear();
return Cart::session(Auth::id())->clear(); return self::get()->clear();
} }
public static function has($id) public static function has($id)
@@ -70,7 +73,17 @@ class ShopCart
public static function getTotal() public static function getTotal()
{ {
return self::get()->getTotal(); return number_format(round(self::get()->getTotal(),2),2);
}
public static function getItemQuantity($id)
{
return self::getItem($id) ? (int) self::getItem($id)->quantity : 0;
}
public static function getItem($id)
{
return Cart::get($id);
} }
public static function getContent() public static function getContent()
@@ -80,6 +93,6 @@ class ShopCart
public static function get() public static function get()
{ {
return Cart::session(Users::getId()); return Cart::session('_token');
} }
} }

View File

@@ -195,7 +195,7 @@ class Articles
$model = ($options['homepage'] ?? false) ? Article::homepage()->visible() : Article::visible(); $model = ($options['homepage'] ?? false) ? Article::homepage()->visible() : Article::visible();
// exit; // exit;
$data = $model->byCategory($category_id)->byTags($tags)->withAvailableOffers($sale_channel_id)->with([ $data = $model->byCategoryParent($category_id)->byTags($tags)->withAvailableOffers($sale_channel_id)->with([
'image', 'image',
'product', 'product',
'article_nature', 'article_nature',

View File

@@ -31,7 +31,8 @@ class Offers
'tariff.price_lists.price_list_values', 'tariff.price_lists.price_list_values',
'variation', 'variation',
])->find($id); ])->find($id);
$offer->article->image = Articles::getFullImageByArticle($offer->article); $images = Articles::getFullImagesByArticle($offer->article);
$offer->article->image = Articles::getPreviewSrc($images[0] ?? false);
return $offer; return $offer;
} }

View File

@@ -14,7 +14,7 @@ class TagGroups
return TagGroup::get()->SortBy('name')->pluck('name', 'id')->toArray(); return TagGroup::get()->SortBy('name')->pluck('name', 'id')->toArray();
} }
public static function getWithTagsAndCountOffers() public static function getWithTagsAndCountOffers($category_id = false)
{ {
$tags = Tag::withCount(['articles'])->get()->toArray(); $tags = Tag::withCount(['articles'])->get()->toArray();
$tag_groups = TagGroup::pluck('name', 'id')->toArray(); $tag_groups = TagGroup::pluck('name', 'id')->toArray();

View File

@@ -30,6 +30,19 @@ a.green-dark:hover {
text-shadow: 4px black; text-shadow: 4px black;
} }
.btn-green-dark {
color: #fff;
background-color: #335012;
border-color: #28a745;
}
.btn-green-dark a:hover {
color: #fff;
font-weight: 900;
text-decoration: none;
text-shadow: 4px black;
}
.green-light { .green-light {
color: #F1F7EE; color: #F1F7EE;
} }
@@ -60,6 +73,10 @@ a.green-dark:hover {
width: 100% width: 100%
} }
.slick-prev:before, .slick-next:before {
color: #335012!important;
}
@font-face { @font-face {
font-family: 'noto_sanscondensed'; font-family: 'noto_sanscondensed';
src: url('/fonts/notosans-condensed/notosans-condensed-webfont.eot'); src: url('/fonts/notosans-condensed/notosans-condensed-webfont.eot');

View File

@@ -35,7 +35,6 @@
"geo6/geocoder-php-addok-provider": "^1.1", "geo6/geocoder-php-addok-provider": "^1.1",
"gzero/eloquent-tree": "^3.1", "gzero/eloquent-tree": "^3.1",
"hassankhan/config": "^2.1", "hassankhan/config": "^2.1",
"highideas/laravel-users-online": "^3.0",
"intervention/image": "^2.5", "intervention/image": "^2.5",
"intervention/imagecache": "^2.4", "intervention/imagecache": "^2.4",
"jasonlewis/expressive-date": "^1.0", "jasonlewis/expressive-date": "^1.0",

View File

@@ -46,6 +46,11 @@ return [
'provider' => 'guests', 'provider' => 'guests',
], ],
'customer' => [
'driver' => 'session',
'provider' => 'customers',
],
'api' => [ 'api' => [
'driver' => 'token', 'driver' => 'token',
'provider' => 'users', 'provider' => 'users',
@@ -81,6 +86,11 @@ return [
'model' => App\Models\Shop\Customer::class, 'model' => App\Models\Shop\Customer::class,
], ],
'customers' => [
'driver' => 'eloquent',
'model' => App\Models\Shop\Customer::class,
],
// 'users' => [ // 'users' => [
// 'driver' => 'database', // 'driver' => 'database',
// 'table' => 'users', // 'table' => 'users',
@@ -115,6 +125,12 @@ return [
'expire' => 60, 'expire' => 60,
'throttle' => 60, 'throttle' => 60,
], ],
'customers' => [
'provider' => 'customers',
'table' => 'shop_customer_password_resets',
'expire' => 60,
'throttle' => 60,
],
], ],
/* /*

View File

@@ -3,18 +3,18 @@
<img src="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" class="card-img-top" alt="{{ $product_name }}"> <img src="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" class="card-img-top" alt="{{ $product_name }}">
<div class="card-body"> <div class="card-body">
<div class="row card-title"> <div class="row card-title">
<div class="col-10"> <div class="col-12">
<div class="mb-0" style="font-size: 1.3em;">{{ $article['parent_name'] }}</div> <!--
{{ $article['product_name'] }} <i class="fa fa-heart red"></i>
</div> -->
<div class="col-2 p-0 text-right" style="font-size: 2em; color: red;"> <div class="text-truncate mb-0" style="font-size: 1.3em;">{{ $article['parent_name'] }}</div>
<i class="fa fa-heart"></i> <div class="text-truncate">{{ $article['product_name'] }}</div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-6">
<strong>Semence</strong> <strong>Semence</strong><br/>
@if ($article['semences'] ?? false) @if ($article['semences'] ?? false)
<span style="font-size: 1.4em">{{ $article['semences']['price'] ?? null }}</span> <br> <span style="font-size: 1.4em">{{ $article['semences']['price'] ?? null }}</span> <br>
@else @else
@@ -22,7 +22,7 @@
@endif @endif
</div> </div>
<div class="col-6"> <div class="col-6">
<strong>Plant</strong> <strong>Plant</strong><br/>
@if ($article['plants'] ?? false) @if ($article['plants'] ?? false)
<span style="font-size: 1.4em">{{ $article['plants']['price'] }}</span> <br> <span style="font-size: 1.4em">{{ $article['plants']['price'] }}</span> <br>
@else @else

View File

@@ -1,47 +1,60 @@
<div class="row pb-3" style="background-color: #CCC;"> <div class="row pb-3 bg-light">
<div class="col-8"> <div class="col-8">
<div class="row pt-2"> <div class="row pt-2">
<div class="col-10"> <div class="col-10">
<a href="{{ route('Shop.Articles.show', ['id' => $article['semences']['article_id'] ?? false ]) }}" class="text-decoration-none"> <a href="{{ route('Shop.Articles.show', ['id' => $article['id'] ?? false ]) }}" class="green-dark">
<div style="font-weight: bold; color: green; font-size: 1.5em;">{{ $product_name }}</div> <div style="font-size: 1.5em;">{{ $product_name }}</div>
</a> </a>
</div> </div>
<div class="col-2 text-right"> <div class="col-2 text-right">
<!--
<span style="font-size: 2em; color: red;"> <span style="font-size: 2em; color: red;">
<i class="fa fa-heart"></i> <i class="fa fa-heart"></i>
</span> </span>
-->
</div> </div>
</div> </div>
<a href="{{ route('Shop.Articles.show', ['id' => $article['semences']['article_id'] ?? false ]) }}" class="text-decoration-none"> <a href="{{ route('Shop.Articles.show', ['id' => $article['id'] ?? false ]) }}" class="green-dark">
<div class="row"> <div class="row">
<div class="col-2"> <div class="col-2">
<img src="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" class="card-img-top" alt="..."> <img src="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" class="card-img-top" alt="...">
</div> </div>
<div class="col-10"> <div class="col-10 text-justify">
{!! $article['description'] !!} {!! $article['description'] !!}
</div> </div>
</div> </div>
</a> </a>
</div> </div>
<div class="col-4"> <div class="col-4">
<div class="row h-100" style="color: green; display: flex;"> <div class="row h-100">
<div class="col-6 text-center" style="background-color: rgba(0,128,0,0.3); margin: auto;"> <div class="col-6">
@if ($article['semences'] ?? false) @if ($article['semences'] ?? false)
<span style="font-size: 1.4em; font-weight: bold;">{{ $article['semences']['price'] ?? null }}</span> <br> <div class="w-100 mt-3 p-1 bg-green-light green-dark rounded-lg border border-success text-center">
{{ $article['semences']['variation'] }} <span style="font-size: 1.4em; font-weight: bold;">{{ $article['semences']['price'] ?? null }}</span> <br>
<div> {{ $article['semences']['variation'] }}
Quantité : <div>
Quantité : 1
</div>
@include('components.form.button', [
'class' => 'btn-green-dark basket semences mb-3 mt-2 shadow',
'txt' => 'Ajouter au panier',
])
</div> </div>
@include('components.form.button', [
'class' => 'btn-success basket semences',
'txt' => 'Ajouter au panier',
])
@endif @endif
</div> </div>
<div class="col-6 text-center"> <div class="col-6">
@if ($article['plants'] ?? false) @if ($article['plants'] ?? false)
<span style="font-size: 1.4em; font-weight: bold;">{{ $article['plants']['price'] }}</span> <br> <div class="w-100 mt-3 p-1 bg-yellow-light yellow-dark border border-warning text-center">
{{ $article['plants']['variation'] }} <span style="font-size: 1.4em; font-weight: bold;">{{ $article['plants']['price'] ?? null }}</span> <br>
{{ $article['plants']['variation'] }}
<div>
Quantité : 1
</div>
@include('components.form.button', [
'class' => 'btn-success basket semences mb-3 mt-2 shadow',
'txt' => 'Ajouter au panier',
])
</div>
@endif @endif
</div> </div>
</div> </div>

View File

@@ -17,7 +17,7 @@
</div> </div>
</div> </div>
@foreach ($basket as $nature => $items) @foreach ($basket as $nature => $items)
<div class="row mb-3 p-2 bg-green-light border"> <div class="row ml-1 mb-3 p-2 bg-green-light border">
<div class="col-12"> <div class="col-12">
<h2 style="font-size: 1.6em;">{{ ucfirst($nature) }}</h2> <h2 style="font-size: 1.6em;">{{ ucfirst($nature) }}</h2>
@foreach ($items as $item) @foreach ($items as $item)
@@ -75,10 +75,11 @@
$('.basket-quantity').change(function() { $('.basket-quantity').change(function() {
var offer_id = $(this).data('id'); var offer_id = $(this).data('id');
var quantity = $(this).val(); var quantity = $(this).val();
var $row = $(this).parents('.row');
console.log("add basket"); console.log("add basket");
console.log(quantity); console.log(quantity);
updateBasket(offer_id, quantity, function() { updateBasket(offer_id, quantity, function() {
calculatePrice($(this).parents('.basket-row')); calculatePrice($row);
calculateTotal(); calculateTotal();
}); });
}); });
@@ -98,6 +99,8 @@
} }
function calculatePrice($that) { function calculatePrice($that) {
console.log('calculatePrice');
console.log($that);
var quantity = $that.find('.basket-quantity').val(); var quantity = $that.find('.basket-quantity').val();
var price = $that.find('.basket-price').text(); var price = $that.find('.basket-price').text();
var total_price = fixNumber(quantity * price); var total_price = fixNumber(quantity * price);

View File

@@ -1,4 +1,4 @@
<div class="row mb-3 basket-row" id="basket_offer-{{ $item['id'] }}" data-id={{ $item['id'] }}> <div class="row basket-row" id="basket_offer-{{ $item['id'] }}" data-id={{ $item['id'] }}>
<div class="col-2 text-center"> <div class="col-2 text-center">
<img src="{{ $item['image'] }}" class="img-fluid"> <img src="{{ $item['image'] }}" class="img-fluid">
</div> </div>

View File

@@ -2,7 +2,7 @@
<div class="col-5"> <div class="col-5">
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-6">
<img src="{{ App\Repositories\Shop\Articles::getPreviewSrc($offer['article']['image'] ?? false) }}" class="card-img-top" alt="..."> <img src="{{ $offer['article']['image'] }}" class="card-img-top" alt="...">
</div> </div>
<div class="col-6"> <div class="col-6">
<div class="text-uppercase"> <div class="text-uppercase">

View File

@@ -2,22 +2,24 @@
<div class="mb-3 bg-green-light"> <div class="mb-3 bg-green-light">
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-6">
<h1 class="green" style="font-size: 2em;">{{ $shelve['name'] }}</h1> <h1 class="green p-2" style="font-size: 2em;">{{ $shelve['name'] }}</h1>
</div> </div>
<div class="col-6 text-right"> <div class="col-6 text-right">
<a class="green-dark btn" href="{{ route('Shop.Categories.show', ['id' => $shelve['id']]) }}">Découvrir la sélection</a> <a class="mt-2 btn btn-green-dark" href="{{ route('Shop.Categories.show', ['id' => $shelve['id']]) }}">Découvrir la sélection</a>
<a class="green-dark btn" href="{{ route('Shop.Categories.show', ['id' => $shelve['id']]) }}">Tout voir</a> <a class="mt-2 green-dark btn" href="{{ route('Shop.Categories.show', ['id' => $shelve['id']]) }}">Tout voir</a>
</div> </div>
</div> </div>
<div class="row shelve_slider_{{ $shelve['id'] }} slider"> <div class="row">
@foreach ($shelve['articles'] as $name => $article) <div class="col-11 mx-auto shelve_slider_{{ $shelve['id'] }} slider">
<div class="text-center pr-2 pl-2"> @foreach ($shelve['articles'] as $name => $article)
<a class="green-dark" href="{{ route('Shop.Articles.show', ['id' => $article['id']]) }}"> <div class="text-center pr-2 pl-2">
<img data-lazy="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" class="d-block w-100" alt="{{ $name }}"/> <a class="green-dark" href="{{ route('Shop.Articles.show', ['id' => $article['id']]) }}">
{{ $name }} <img data-lazy="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" class="d-block w-100" alt="{{ $name }}"/>
</a> {{ $name }}
</div> </a>
@endforeach </div>
@endforeach
</div>
</div> </div>
</div> </div>
@endif @endif

View File

@@ -1,5 +1,5 @@
<aside class="main-sidebar float-left d-none" id="sidebar" style="width: 300px;"> <aside class="main-sidebar float-left d-none" id="sidebar" style="width: 300px;">
<section class="sidebar" style="height: auto;"> <section class="sidebar shadow" style="height: auto;">
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
@@ -7,17 +7,21 @@
</div> </div>
</div> </div>
@foreach ($tags as $group) @foreach ($tags as $tag_group_id => $group)
<h5>{{ $group['name'] }}</h5> @component('components.layout.box-collapse', [
@foreach ($group['tags'] as $tag) 'title' => $group['name'],
<div> 'id' => 'tag_group_' . $tag_group_id,
@include('components.form.checkbox', [ ])
'name' => 'tag[]', @foreach ($group['tags'] as $tag)
'val' => $tag['id'], <div>
]) @include('components.form.checkbox', [
{{ $tag['name'] }} ({{ $tag['count'] }}) 'name' => 'tag[]',
</div> 'val' => $tag['id'],
@endforeach ])
{{ $tag['name'] }} ({{ $tag['count'] }})
</div>
@endforeach
@endcomponent
@endforeach @endforeach
</section> </section>

View File

@@ -4,7 +4,7 @@
]) ])
@section('content') @section('content')
{!! Form::open(['route' => 'boilerplate.login', 'method' => 'post', 'autocomplete'=> 'off']) !!} {!! Form::open(['route' => 'Shop.login.post', 'method' => 'post', 'autocomplete'=> 'off']) !!}
<div class="row" style="width: 380px;"> <div class="row" style="width: 380px;">
<div class="col-12 text-center"> <div class="col-12 text-center">
<img src="/img/logo.png" height="128"> <img src="/img/logo.png" height="128">
@@ -14,33 +14,38 @@
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="form-group {{ $errors->has('email') ? 'has-error' : '' }}"> <div class="form-group {{ $errors->has('email') ? 'has-error' : '' }}">
{{ Form::email('email', old('email'), ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.email'), 'required', 'autofocus']) }} {{ Form::email('email', old('email'), ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.email'), 'required', 'autofocus']) }}
<span class="glyphicon glyphicon-envelope form-control-feedback"></span> <span class="fa fa-email form-control-feedback"></span>
{!! $errors->first('email','<p class="text-danger"><strong>:message</strong></p>') !!} {!! $errors->first('email','<p class="text-danger"><strong>:message</strong></p>') !!}
</div> </div>
</div> </div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="form-group {{ $errors->has('password') ? 'has-error' : '' }}"> <div class="form-group {{ $errors->has('password') ? 'has-error' : '' }}">
{{ Form::password('password', ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.password')]) }} {{ Form::password('password', ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.password')]) }}
<span class="glyphicon glyphicon-lock form-control-feedback"></span> <span class="fa fa-lock form-control-feedback"></span>
{!! $errors->first('password','<p class="text-danger"><strong>:message</strong></p>') !!} {!! $errors->first('password','<p class="text-danger"><strong>:message</strong></p>') !!}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-12 col-lg-8"> <div class="col-12 col-lg-6 mbs">
<button type="submit" class="btn btn-primary btn-block btn-flat">{{ __('Se connecter') }}</button>
</div>
<div class="col-12 col-lg-6">
<a href="{{ route('Shop.password.reset') }}">{{ __('Mot de passe oublié ?') }}</a><br>
<!--
<div class="checkbox icheck"> <div class="checkbox icheck">
<label style="padding-left: 0"> <label style="padding-left: 0">
<input type="checkbox" name="remember" class="icheck" {{ old('remember') ? 'checked' : '' }}> <input type="checkbox" name="remember" class="icheck" {{ old('remember') ? 'checked' : '' }}>
{{ __('boilerplate::auth.login.rememberme') }} {{ __('boilerplate::auth.login.rememberme') }}
</label> </label>
</div> </div>
</div> -->
<div class="col-12 col-lg-4 mbs">
<button type="submit" class="btn btn-primary btn-block btn-flat">{{ __('boilerplate::auth.login.signin') }}</button>
</div> </div>
</div> </div>
{!! Form::close() !!} {!! Form::close() !!}
<a href="{{ route('boilerplate.password.request') }}">{{ __('boilerplate::auth.login.forgotpassword') }}</a><br>
@if(config('boilerplate.auth.register')) <p class="mt-3">
<a href="{{ route('boilerplate.register') }}" class="text-center">{{ __('boilerplate::auth.login.register') }}</a> Vous n'avez pas encore de compte ?
@endif <a href="{{ route('Shop.register') }}" class="text-center">{{ __('Inscrivez-vous') }}</a>
</p>
@endsection @endsection

View File

@@ -3,7 +3,7 @@
@section('content') @section('content')
@component('boilerplate::auth.loginbox') @component('boilerplate::auth.loginbox')
<p class="login-box-msg">{{ __('boilerplate::auth.register.intro') }}</p> <p class="login-box-msg">{{ __('boilerplate::auth.register.intro') }}</p>
{!! Form::open(['route' => 'boilerplate.register', 'method' => 'post', 'autocomplete'=> 'off']) !!} {!! Form::open(['route' => 'Shop.register.post', 'method' => 'post', 'autocomplete'=> 'off']) !!}
<div class="form-group {{ $errors->has('first_name') ? 'has-error' : '' }}"> <div class="form-group {{ $errors->has('first_name') ? 'has-error' : '' }}">
{{ Form::text('first_name', old('first_name'), ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.first_name'), 'required', 'autofocus']) }} {{ Form::text('first_name', old('first_name'), ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.first_name'), 'required', 'autofocus']) }}
{!! $errors->first('first_name','<p class="text-danger"><strong>:message</strong></p>') !!} {!! $errors->first('first_name','<p class="text-danger"><strong>:message</strong></p>') !!}
@@ -32,8 +32,5 @@
</div> </div>
</div> </div>
{!! Form::close() !!} {!! Form::close() !!}
@if(!$firstUser)
<a href="{{ route('boilerplate.login') }}">{{ __('boilerplate::auth.register.login_link') }}</a><br>
@endif
@endcomponent @endcomponent
@endsection @endsection

View File

@@ -31,7 +31,7 @@
slidesToScroll: 1, slidesToScroll: 1,
dots: true, dots: true,
autoplay: true, autoplay: true,
autoplaySpeed: 2000 autoplaySpeed: 5000
}); });
}); });
</script> </script>

View File

@@ -28,7 +28,7 @@
@include("Shop.layout.partials.header") @include("Shop.layout.partials.header")
<div class="content-wrapper"> <div class="content-wrapper">
<section class="content"> <section class="content">
<div class="container-fluid"> <div class="container-fluid p-0">
@yield('content') @yield('content')
</div> </div>
</section> </section>

View File

@@ -1,19 +1,19 @@
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-6">
<button type="button" class="btn btn-success"> <button type="button" class="btn btn-success shadow">
<i class="fa fa-3x fa-seedling float-left"></i> <i class="fa fa-3x fa-seedling float-left"></i>
Ajouter au panier la liste des <strong>semences</strong> Ajouter au panier<br>la liste des <strong>semences</strong>
</button> </button>
</div> </div>
<div class="col-6"> <div class="col-6">
<button type="button" class="btn btn-warning"> <button type="button" class="btn btn-warning shadow">
<i class="fab fa-3x fa-pagelines float-left"></i> <i class="fab fa-3x fa-pagelines float-left"></i>
Ajouter au panier la liste des <strong>plants</strong> Ajouter au panier<br>la liste des <strong>plants</strong>
</button> </button>
</div> </div>
</div> </div>
<div class="row"> <div class="row pt-3">
<div class="col-12"> <div class="col-12">
Il y a {{ $articles ? count($articles) : 0 }} article(s) dans la liste Il y a {{ $articles ? count($articles) : 0 }} article(s) dans la liste
</div> </div>
@@ -25,21 +25,23 @@
@include('components.form.button', ['id' => 'by_rows', 'icon' => 'fa-list', 'class' => 'btn-success']) @include('components.form.button', ['id' => 'by_rows', 'icon' => 'fa-list', 'class' => 'btn-success'])
</div> </div>
<div class="col-6"> <div class="col-6">
<form name="product_sorting"> <!--
<form name="product_sorting" class="mt-0">
<label>Trier par</label> <label>Trier par</label>
@include('components.form.select', ['name' => 'sorting', 'list' => ['Pertinence']]) @include('components.form.select', ['name' => 'sorting', 'list' => ['Pertinence']])
</form> </form>
-->
</div> </div>
</div> </div>
@push('js') @push('js')
<script> <script>
$('#by_rows').click(function() { $('#by_rows').click(function() {
var url = "{{ url()->current() }}" + '?by_rows=1'; var url = "{{ route('Shop.Categories.show', ['id' => $category['id'], 'by_rows' => true]) }}";
window.location = url; window.location = url;
}) })
$('#by_cards').click(function() { $('#by_cards').click(function() {
var url = "{{ url()->current() }}"; var url = "{{ route('Shop.Categories.show', ['id' => $category['id']]) }}";
window.location = url; window.location = url;
}) })
</script> </script>

View File

@@ -7,7 +7,7 @@
<ul class="dropdown-menu" aria-labelledby="dLabel"> <ul class="dropdown-menu" aria-labelledby="dLabel">
<li> <li>
<a href="fr/mon-compte" title="Identifiez-vous" rel="nofollow"> <a href="{{ route('Shop.login') }}" title="Identifiez-vous" rel="nofollow">
<span>Connexion</span> <span>Connexion</span>
</a> </a>
</li> </li>

View File

@@ -1,7 +1,7 @@
<div class="card {{ $class ?? '' }}"> <div class="card {{ $class ?? '' }}">
<div class="card-header p-0"> <div class="card-header p-0">
<div class="row"> <div class="row">
<div class="col-6"> <div class="{{ ($collapse_right ?? false) ? 'col-6' : 'col-12' }}">
<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 {{ ($collapsed ?? true) ? 'fa-chevron-right' : 'fa-chevron-down' }}"></i> <i class="fa {{ ($collapsed ?? true) ? 'fa-chevron-right' : 'fa-chevron-down' }}"></i>
</button> </button>
@@ -14,9 +14,11 @@
<span class="check ml-5 error"></span> <span class="check ml-5 error"></span>
</div> </div>
<div class="col-6"> @if ($collapse_right ?? false)
{!! $collapse_right ?? '' !!} <div class="col-6">
</div> {!! $collapse_right ?? '' !!}
</div>
@endif
</div> </div>
</div> </div>
<div id="{{ $id }}" class="card-body collapse {{ ($collapsed ?? true) ? '' : 'show' }} {{ $class_body ?? '' }}"> <div id="{{ $id }}" class="card-body collapse {{ ($collapsed ?? true) ? '' : 'show' }} {{ $class_body ?? '' }}">

View File

@@ -2,7 +2,7 @@
Route::prefix('Categories')->name('Categories.')->group(function () { Route::prefix('Categories')->name('Categories.')->group(function () {
Route::get('', 'CategoryController@index')->name('index'); Route::get('', 'CategoryController@index')->name('index');
Route::get('show/{id}', 'CategoryController@show')->name('show'); Route::get('show/{id}/{by_rows?}', 'CategoryController@show')->name('show');
Route::get('getTree', 'CategoryController@getTree')->name('getTree'); Route::get('getTree', 'CategoryController@getTree')->name('getTree');
}); });

View File

@@ -7,6 +7,8 @@ Route::prefix('Shop')->namespace('Shop')->name('Shop.')->group(function () {
Route::get('invite/{token?}/{event_id?}', 'Auth\LoginController@invite')->name('invite'); Route::get('invite/{token?}/{event_id?}', 'Auth\LoginController@invite')->name('invite');
Route::get('password/reset/{token?}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset'); Route::get('password/reset/{token?}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update'); Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update');
Route::get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
Route::post('register', 'Auth\RegisterController@register')->name('register.post');
}); });
Route::prefix('Shop')->namespace('Shop')->name('Shop.')->group(function () { Route::prefix('Shop')->namespace('Shop')->name('Shop.')->group(function () {