[WIP] Order process

This commit is contained in:
Ludovic CANDELLIER
2022-07-03 22:38:08 +02:00
parent bcb3e15f33
commit 06cfb92757
60 changed files with 1146 additions and 295 deletions

View File

@@ -26,6 +26,7 @@ var cssSite = [
'node_modules/bootstrap/dist/css/bootstrap.min.css',
'node_modules/@fortawesome/fontawesome-free/css/all.min.css',
'node_modules/animate.css/animate.min.css',
'node_modules/icheck-bootstrap/icheck-bootstrap.min.css',
'build/js/plugins/smooth_products/css/smoothproducts.css',
'build/css/shadow.css',
'build/css/site.css',

View File

@@ -2,6 +2,7 @@
namespace App\Datatables\Botanic;
use App\Repositories\Shop\Tags;
use Yajra\DataTables\Html\Column;
use App\Datatables\ParentDataTable as DataTable;
use App\Models\Botanic\Specie;

View File

@@ -2,8 +2,8 @@
namespace App\Http\Controllers\Admin\Core\Auth;
use Auth;
use Image;
use Illuminate\Support\Facades\Auth;
use Intervention\Image\Facades\Image;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Str;

View File

@@ -40,8 +40,6 @@ class ResetPasswordController extends Controller
public function showResetForm(Request $request, $token = null)
{
dump('ici');
exit;
$data['token'] = $token;
$data['email'] = $request->email;
return view('auth.passwords.reset', $data);

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers\Shop\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ConfirmsPasswords;
class ConfirmPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Confirm Password Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password confirmations and
| uses a simple trait to include the behavior. You're free to explore
| this trait and override any functions that require customization.
|
*/
use ConfirmsPasswords;
/**
* Where to redirect users when the intended url fails.
*
* @var string
*/
protected $redirectTo = '';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
}

View File

@@ -3,22 +3,27 @@
namespace App\Http\Controllers\Shop\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Password;
class ForgotPasswordController extends Controller
{
use SendsPasswordResetEmails;
/**
* Get password request form view.
*
* @return Application|Factory|View
*/
protected function guard()
{
return Auth::guard('customer');
}
public function broker()
{
return Password::broker('customers');
}
public function showLinkRequestForm()
{
return view('boilerplate::auth.passwords.email');
return view('Shop.auth.passwords.email');
}
}

View File

@@ -25,8 +25,7 @@ class LoginController extends Controller
public function showLoginForm()
{
$data['url'] = route('Shop.login.post');
return view('Shop.auth.login', $data);
return view('Shop.auth.login');
}
public function login(Request $request)
@@ -36,7 +35,7 @@ class LoginController extends Controller
'password' => 'required|min:8',
]);
if (Auth::guard('customer')->attempt($credentials, $request->get('remember'))) {
if ($this->guard()->attempt($credentials, $request->get('remember'))) {
$request->session()->regenerate();
return redirect()->intended(route('home'));
}

View File

@@ -2,9 +2,12 @@
namespace App\Http\Controllers\Shop\Auth;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Password;
use Illuminate\Foundation\Auth\ResetsPasswords;
use App\Rules\Password as PasswordRules;
class ResetPasswordController extends Controller
{
@@ -19,8 +22,29 @@ class ResetPasswordController extends Controller
public function showResetForm(Request $request, $token = null)
{
$data['token'] = $token;
$data['email'] = $request->email;
return view('Auth.passwords.reset', $data);
$token = $request->route()->parameter('token');
return view('Shop.auth.passwords.reset')->with(
['token' => $token, 'email' => $request->email]
);
}
protected function rules()
{
return [
'token' => 'required',
'email' => 'required|email',
'password' => ['required', 'confirmed', new PasswordRules()],
];
}
public function broker()
{
return Password::broker('customers');
}
protected function guard()
{
return Auth::guard('customer');
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace App\Http\Controllers\Shop\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\VerifiesEmails;
class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
use VerifiesEmails;
/**
* Where to redirect users after verification.
*
* @var string
*/
protected $redirectTo = '/';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
}

View File

@@ -1,6 +1,6 @@
<?php
namespace App\Http\Controllers\Commercial;
namespace App\Http\Controllers\Shop;
use App\Http\Controllers\Controller as ParentController;

View File

@@ -9,47 +9,27 @@ use App\Repositories\Shop\Customers;
class CustomerController extends Controller
{
/**
* Display the specified resource.
*
* @param \App\Customer $customer
* @return \Illuminate\Http\Response
*/
public function show(Customer $customer)
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Customer $customer
* @return \Illuminate\Http\Response
*/
public function edit(Customer $customer)
public function edit(C$id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Customer $customer
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Customer $customer)
public function update(Request $request)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Customer $customer
* @return \Illuminate\Http\Response
*/
public function destroy(Customer $customer)
public function destroy($id)
{
//
}
public function profile($id)
{
//
}

View File

@@ -2,6 +2,7 @@
namespace App\Http\Controllers\Shop;
use App\Models\Shop\Invoice;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
@@ -9,79 +10,14 @@ use App\Repositories\Shop\Invoices;
class InvoiceController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
public function show($id)
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param \App\Invoice $invoice
* @return \Illuminate\Http\Response
*/
public function show(Invoice $invoice)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Invoice $invoice
* @return \Illuminate\Http\Response
*/
public function edit(Invoice $invoice)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Invoice $invoice
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Invoice $invoice)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Invoice $invoice
* @return \Illuminate\Http\Response
*/
public function destroy(Invoice $invoice)
{
//
$data = Invoices::get($id);
return view('Shop.Invoices.show', $data);
}
}

View File

@@ -6,6 +6,7 @@ use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Repositories\Core\User\ShopCart;
use App\Repositories\Shop\Deliveries;
use App\Repositories\Shop\Orders;
use App\Repositories\Shop\Offers;
use App\Repositories\Shop\SaleChannels;
@@ -15,7 +16,15 @@ class OrderController extends Controller
public function order()
{
$data['basket'] = ShopCart::getSummary();
$data['deliveries'] = Deliveries::getAllWithSaleChannel()->toArray();
$data['sale_channel'] = SaleChannels::getDefault();
return view('Shop.Orders.order', $data);
}
public function store(Request $request)
{
$data = $request->all();
dump($data);
exit;
}
}

View File

@@ -11,9 +11,10 @@ class SearchController extends Controller
{
public function search(Request $request)
{
$articles = Searches::getResults($request->input());
$data = [
'articles' => Searches::getResults($request->input()),
'articles_count' => $data['articles'] ? count($data['articles']) : 0,
'articles' => $articles,
'articles_count' => $articles ? count($articles) : 0,
'search' => $request->input(),
'product_type' => $request->input('product_type'),
];

View File

@@ -4,7 +4,6 @@ namespace App\Models\Core\Auth;
use Carbon\Carbon;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\SoftDeletes;
use Yadahan\AuthenticationLog\AuthenticationLogable;
// use HighIdeas\UsersOnline\Traits\UsersOnlineTrait;
use Sebastienheyd\Boilerplate\Models\User as parentUser;
@@ -12,22 +11,23 @@ use Sebastienheyd\Boilerplate\Models\User as parentUser;
class User extends parentUser
{
// use UserHasTeams, UsersOnlineTrait;
use AuthenticationLogable, SoftDeletes;
use AuthenticationLogable;
protected $fillable = ['active', 'last_name', 'first_name', 'username', 'email', 'password', 'remember_token', 'last_login'];
protected $hidden = ['password', 'remember_token'];
protected $casts = [
'email_verified_at' => 'datetime',
'settings' => 'array',
];
public function passwordSecurity()
{
return $this->hasOne('App\Models\Core\Auth\PasswordSecurity');
return $this->hasOne(PasswordSecurity::class);
}
public function teams()
{
return $this->hasManyThrough(Team::class, TeamUser::class, 'user_id', 'id', 'id', 'team_id');
return $this->belongsToMany(Team::class, TeamUser::class);
}
public function scopeByTeam($query, $id)

View File

@@ -4,18 +4,22 @@ namespace App\Models\Shop;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Yadahan\AuthenticationLog\AuthenticationLogable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Yadahan\AuthenticationLog\AuthenticationLogable;
use App\Notifications\NewUser;
use App\Notifications\ResetPassword;
use App\Notifications\VerifyEmail;
class Customer extends Authenticatable
{
use AuthenticationLogable, SoftDeletes;
use AuthenticationLogable, Notifiable, SoftDeletes;
protected $guarded = ['id'];
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',];
protected $casts = ['email_verified_at' => 'datetime'];
public function addresses()
{
@@ -34,7 +38,7 @@ class Customer extends Authenticatable
public function deliveries()
{
return $this->belongsToMany(Delivery::class, 'shop_customer_deliveries');
return $this->belongsToMany(Delivery::class, CustomerDelivery::class);
}
public function deliveries2()
@@ -47,8 +51,16 @@ class Customer extends Authenticatable
return $this->hasMany(Order::class);
}
public function User()
public function sendEmailVerificationNotification()
{
return $this->belongsTo('App\User');
if (config('boilerplate.auth.verify_email')) {
$this->notify(new VerifyEmail());
}
}
public function sendPasswordResetNotification($token)
{
$this->notify(new ResetPassword($token));
}
}

View File

@@ -0,0 +1,63 @@
<?php
namespace App\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('boilerplate::notifications.email')
->greeting(__('boilerplate::notifications.greeting', ['firstname' => $notifiable->first_name]))
->subject(__('boilerplate::notifications.newuser.subject', ['name' => config('app.name')]))
->line(__('boilerplate::notifications.newuser.intro', [
'name' => $currentUser->first_name.' '.$currentUser->last_name,
]))
->action(
__('boilerplate::notifications.newuser.button'),
route('boilerplate.users.firstlogin', $notifiable->remember_token)
)
->salutation(__('boilerplate::notifications.salutation', [
'name' => $currentUser->first_name.' '.$currentUser->last_name,
]))
->line(__('boilerplate::notifications.newuser.outro'));
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\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('boilerplate::notifications.email')
->greeting(__('boilerplate::notifications.greeting', ['firstname' => $notifiable->first_name]))
->subject(__('boilerplate::notifications.resetpassword.subject'))
->line(__('boilerplate::notifications.resetpassword.intro'))
->action(
__('boilerplate::notifications.resetpassword.button'),
route('Shop.password.reset', $this->token)
)
->line(__('boilerplate::notifications.resetpassword.outro'));
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace App\Notifications;
use Illuminate\Auth\Notifications\VerifyEmail as BaseEmail;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\URL;
class VerifyEmail extends BaseEmail
{
protected function verificationUrl($notifiable)
{
if (static::$createUrlCallback) {
return call_user_func(static::$createUrlCallback, $notifiable);
}
return URL::temporarySignedRoute(
'boilerplate.verification.verify',
Carbon::now()->addMinutes(Config::get('auth.verification.expire', 60)),
[
'id' => $notifiable->getKey(),
'hash' => sha1($notifiable->getEmailForVerification()),
]
);
}
/**
* Get the verify email notification mail message for the given URL.
*
* @param string $url
* @return \Illuminate\Notifications\Messages\MailMessage
*/
protected function buildMailMessage($url)
{
return (new MailMessage)
->markdown('boilerplate::notifications.email')
->subject(__('Verify Email Address'))
->line(__('Please click the button below to verify your email address.'))
->action(__('Verify Email Address'), $url)
->line(__('If you did not create an account, no further action is required.'));
}
}

View File

@@ -44,7 +44,9 @@ class Cities
// dump($adresse);
$geocode = app('geocoder')->geocode($adresse)->get();
// dump($geocode);
if (count($geocode)) {
if (!count($geocode)) {
return false;
}
// dump($geocode);
$res = $geocode[0]->getCoordinates()->toArray();
// dump($res);
@@ -53,9 +55,7 @@ class Cities
// dump($latitude);
// dump($longitude);
return ['latitude' => $latitude, 'longitude' => $longitude];
} else {
return false;
}
}
public static function getCoordsByCity($id)

View File

@@ -133,7 +133,8 @@ class Debug
dump($msg);
}
if (self::isDebug()) {
if (!self::isDebug()){
return;}
if (static::isCLI()) {
self::dumpCli($msg, $cat);
}
@@ -143,7 +144,7 @@ class Debug
if (static::isClockwork()) {
self::dumpClockwork($msg, $cat);
}
}
}
public static function dumpDebugbar($msg, $cat = '', $force = false)

View File

@@ -75,12 +75,16 @@ class Export
if (isset($options[$key])) {
$txt = $options[$key][$txt];
}
if (isset($multioptions[$key])) {
if (!isset($multioptions[$key])){
$this->writeCell($this->lig, $col, $txt);
$this->nb++;
$col++;
continue;}
$tabs = self::getReverseMultiOptions($txt);
foreach ($tabs as $key2 => $value) {
$txt .= $multioptions[$key][$key2] . '\n';
}
}
$this->writeCell($this->lig, $col, $txt);
$this->nb++;
$col++;
@@ -114,7 +118,8 @@ class Export
public function close()
{
if (!$this->debug) {
if ($this->debug){
return;}
// Debug::message($this->xls);
$objWriter = PHPExcel_IOFactory::createWriter($this->xls, 'Excel2007');
// Debug::message($objWriter);
@@ -126,7 +131,7 @@ class Export
// $objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$objWriter->save('text.xlsx');
}
}
}
public function conv($lig, $col)

View File

@@ -16,7 +16,6 @@ class File
public static function checkDir($dir)
{
// File::isDirectory($path)
return is_dir($dir);
}
@@ -27,8 +26,7 @@ class File
public static function createDir($dir)
{
Storage::makeDirectory($dir);
return true;
return mkdir($dir, '0777', true);
}
public static function deleteDir($dir)

View File

@@ -6,12 +6,15 @@ class Geolocation
{
public static function getCoords($address, $zipcode, $city)
{
if (!empty($address) && !empty($zipcode) && !empty($city)) {
if (!(!empty($address) && !empty($zipcode) && !empty($city))){
return;}
$address = $address . ' , ' . $city . ' ' . $zipcode . ' , ' . 'France';
$geocode = app('geocoder')->geocode($address)->get();
if (count($geocode)) {
if (!count($geocode)) {
return false;
}
$res = $geocode[0]->getCoordinates()->toArray();
// dump($res);
$longitude = $res[0];
@@ -20,11 +23,8 @@ class Geolocation
// dump($longitude);
// exit;
return ['latitude' => $latitude, 'longitude' => $longitude];
} else {
return false;
}
}
}
public static function autocomplete($query)
{

View File

@@ -50,7 +50,8 @@ class Item extends LavaryMenuItem
foreach ($routes as $pattern) {
$arr = [$pattern];
if (if_route_pattern($arr)) {
if (!if_route_pattern($arr)){
continue;}
$this->activate();
if (strstr($this->title, 'circle-o')) {
@@ -59,7 +60,6 @@ class Item extends LavaryMenuItem
// dump($this);
return $this;
}
}
return $this;
}

View File

@@ -9,7 +9,8 @@ class Menu extends LavaryMenu
{
public function make($name, $callback)
{
if (is_callable($callback)) {
if (!is_callable($callback)){
return;}
if (!array_key_exists($name, $this->menu)) {
$this->menu[$name] = new Builder($name, $this->loadConf($name));
}
@@ -25,5 +26,4 @@ class Menu extends LavaryMenu
return $this->menu[$name];
}
}
}

View File

@@ -13,15 +13,12 @@ class ShopCart
if (self::has($item['id'])) {
if ($update) {
self::remove($item['id']);
$ret = self::get()->add($item);
// $ret = self::get()->update($item['id'], ['quantity' => $item['quantity']]);
self::get()->add($item);
} else {
$ret = self::get()->update($item['id'], ['quantity' => $item['quantity']]);
// self::remove($item['id']);
// $ret = self::get()->add($item);
self::get()->update($item['id'], ['quantity' => $item['quantity']]);
}
} else {
$ret = self::get()->add($item);
self::get()->add($item);
}
return [
'count' => self::count(),
@@ -73,7 +70,12 @@ class ShopCart
public static function getTotal()
{
return number_format(round(self::get()->getTotal(),2),2);
return self::fixDecimal(self::get()->getTotal());
}
public static function fixDecimal($number)
{
return number_format(round($number, 2), 2);
}
public static function getItemQuantity($id)

View File

@@ -173,14 +173,15 @@ class Articles
$articles = self::getArticlesWithOffers($options);
foreach ($articles as $article) {
$price_lists = $article->offers[0]->tariff->price_lists->toArray();
if (count($price_lists)) {
if (!is_array($data[$article->name] ?? false)) {
$data[$article->name] = self::getDataForSale($article);
}
$prices = $price_lists[0]['price_list_values'][0];
$article_nature_name = strtolower($article->article_nature->name);
$data[$article->name][$article_nature_name] = self::getDataPriceForSale($article, $prices);
if (!count($price_lists)) {
continue;
}
if (!is_array($data[$article->name] ?? false)) {
$data[$article->name] = self::getDataForSale($article);
}
$prices = $price_lists[0]['price_list_values'][0];
$article_nature_name = strtolower($article->article_nature->name);
$data[$article->name][$article_nature_name] = self::getDataPriceForSale($article, $prices);
}
if ($data ?? false) {
ksort($data);
@@ -511,25 +512,26 @@ class Articles
public static function getFullImageByArticle($article)
{
$image = $article->image;
if (!$image) {
switch ($article->product_type) {
case 'App\Models\Botanic\Variety':
$variety = $article->product;
$image = $variety->image ?? false;
if (!$image) {
$specie = $variety->specie;
$image = $specie->image ?? false;
}
break;
case 'App\Models\Botanic\Specie':
$specie = $article->product;
if ($image) {
return $image;
}
switch ($article->product_type) {
case 'App\Models\Botanic\Variety':
$variety = $article->product;
$image = $variety->image ?? false;
if (!$image) {
$specie = $variety->specie;
$image = $specie->image ?? false;
break;
case 'App\Models\Shop\Merchandise':
$merchandise = $article->product;
$image = $merchandise->image ?? false;
break;
}
}
break;
case 'App\Models\Botanic\Specie':
$specie = $article->product;
$image = $specie->image ?? false;
break;
case 'App\Models\Shop\Merchandise':
$merchandise = $article->product;
$image = $merchandise->image ?? false;
break;
}
return $image;
}
@@ -581,16 +583,15 @@ class Articles
public static function storeCategories($article, $categories)
{
if ($categories) {
$categories = collect($categories)->transform(
function ($item, $key) {
return (int) $item;
}
)->toArray();
return $article->syncCategories($categories, true);
} else {
if (!$categories) {
return false;
}
$categories = collect($categories)->transform(
function ($item, $key) {
return (int) $item;
}
)->toArray();
return $article->syncCategories($categories, true);
}
public static function storeTags($article, $tags)

View File

@@ -116,15 +116,14 @@ class Categories
public static function getImages($id)
{
$category = self::get($id);
if ($category) {
$category->getMedia();
foreach ($category->media as $key => $media) {
$category->media[$key]['url'] = $media->getUrl();
}
return $category->media;
} else {
if (!$category) {
return false;
}
$category->getMedia();
foreach ($category->media as $key => $media) {
$category->media[$key]['url'] = $media->getUrl();
}
return $category->media;
}
public static function deleteImage($id, $index)

View File

@@ -3,18 +3,56 @@
namespace App\Repositories\Shop;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Str;
use Laravolt\Avatar\Avatar;
use App\Repositories\Core\File;
use App\Models\Shop\Customer;
class Customers
{
public static function getAvatar()
public static function getAvatar($id = false)
{
$customer = $id ? self::get($id) : self::getAuth();
$file = self::makeAvatarFilename($customer);
if (!File::checkFile($file)) {
self::createAvatar($customer);
}
return self::getPublic(self::getAvatarFilename($customer));
}
public static function createAvatar($customer)
{
$filename = self::makeAvatarFilename($customer);
$name = $customer->first_name . ' ' . $customer->last_name;
$avatar = new Avatar();
$ret = $avatar->create($name)
->setBackground($bgColor)
->setBorder(1, '#29292e')
->setFontFamily('Roboto Condensed')
->setDimension(40)
->setFontSize(16)
->save($filename);
return $ret;
}
public static function makeAvatarFilename($customer)
{
$path = storage_path(self::getStorage());
if (File::checkDirOrCreate($path)) {
$filename = $path . 'user-' . $customer->uuid . '.png';
}
return $filename ?? false;
}
public static function getAvatarFilename($customer)
{
return 'user-' . $customer->uuid . '.png';
}
public static function getName()
{
$user = self::getAuth();
@@ -85,16 +123,15 @@ class Customers
public static function storeDeliveries($customer, $deliveries)
{
if ($deliveries) {
$deliveries = collect($deliveries)->transform(
function ($item, $key) {
return (int) $item;
}
)->toArray();
return $customer->deliveries()->sync($deliveries);
} else {
if (!$deliveries) {
return false;
}
$deliveries = collect($deliveries)->transform(
function ($item, $key) {
return (int) $item;
}
)->toArray();
return $customer->deliveries()->sync($deliveries);
}
public static function storeAddresses($customer, $addresses)
@@ -107,6 +144,7 @@ class Customers
public static function create($data)
{
$data['uuid'] = Str::uuid()->toString();
return Customer::create($data);
}
@@ -122,4 +160,16 @@ class Customers
{
return Customer::destroy($id);
}
public static function getStorage($filename = false)
{
$path = '/app/public/Customers/';
return $filename ? $path . $filename : $path;
}
public static function getPublic($filename = false)
{
$path = '/storage/Customers/';
return $filename ? $path . $filename : $path;
}
}

View File

@@ -16,6 +16,11 @@ class Deliveries
return Delivery::orderBy('name', 'asc')->get();
}
public static function getAllWithSaleChannel()
{
return Delivery::orderBy('name', 'asc')->active()->public()->with('sale_channel')->get();
}
public static function get($id)
{
return Delivery::find($id);

View File

@@ -21,13 +21,14 @@ class TagGroups
$tag_groups = TagGroup::pluck('name', 'id')->toArray();
foreach ($tags as $tag) {
$data[$tag['tag_group_id']]['name'] = $tag_groups[$tag['tag_group_id']];
if ($tag['articles_count']) {
$data[$tag['tag_group_id']]['tags'][] = [
'id' => $tag['id'],
'name' => $tag['name'],
'count' => $tag['articles_count'],
];
}
if (!$tag['articles_count']) {
continue;
}
$data[$tag['tag_group_id']]['tags'][] = [
'id' => $tag['id'],
'name' => $tag['name'],
'count' => $tag['articles_count'],
];
}
return $data;
}

59
app/Rules/Password.php Normal file
View File

@@ -0,0 +1,59 @@
<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
class Password implements Rule
{
private $length;
private $message;
/**
* Create a new rule instance.
*
* @return void
*/
public function __construct($length = 8)
{
$this->length = $length;
}
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
$rules = [
'#.{'.$this->length.',}#' => 'boilerplate::password.rules.length',
'#[a-z]+#' => 'boilerplate::password.rules.letter',
'#[A-Z]+#' => 'boilerplate::password.rules.capital',
'#[0-9]+#' => 'boilerplate::password.rules.number',
'#[^A-Za-z0-9]+#' => 'boilerplate::password.rules.special',
];
foreach ($rules as $rule => $msg) {
if (! preg_match($rule, $value)) {
$this->message = __($msg, ['min' => $this->length]);
return false;
}
}
return true;
}
/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
return $this->message;
}
}

View File

@@ -0,0 +1,111 @@
<?php
namespace App\Traits\Auth;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password;
use Illuminate\Validation\ValidationException;
trait SendsPasswordResetEmails
{
/**
* Display the form to request a password reset link.
*
* @return \Illuminate\View\View
*/
public function showLinkRequestForm()
{
return view('auth.passwords.email');
}
/**
* Send a reset link to the given user.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
*/
public function sendResetLinkEmail(Request $request)
{
$this->validateEmail($request);
// We will send the password reset link to this user. Once we have attempted
// to send the link, we will examine the response then see the message we
// need to show to the user. Finally, we'll send out a proper response.
$response = $this->broker()->sendResetLink(
$this->credentials($request)
);
return $response == Password::RESET_LINK_SENT
? $this->sendResetLinkResponse($request, $response)
: $this->sendResetLinkFailedResponse($request, $response);
}
/**
* Validate the email for the given request.
*
* @param \Illuminate\Http\Request $request
* @return void
*/
protected function validateEmail(Request $request)
{
$request->validate(['email' => 'required|email']);
}
/**
* Get the needed authentication credentials from the request.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
protected function credentials(Request $request)
{
return $request->only('email');
}
/**
* Get the response for a successful password reset link.
*
* @param \Illuminate\Http\Request $request
* @param string $response
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
*/
protected function sendResetLinkResponse(Request $request, $response)
{
return $request->wantsJson()
? new JsonResponse(['message' => trans($response)], 200)
: back()->with('status', trans($response));
}
/**
* Get the response for a failed password reset link.
*
* @param \Illuminate\Http\Request $request
* @param string $response
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Illuminate\Validation\ValidationException
*/
protected function sendResetLinkFailedResponse(Request $request, $response)
{
if ($request->wantsJson()) {
throw ValidationException::withMessages([
'email' => [trans($response)],
]);
}
return back()
->withInput($request->only('email'))
->withErrors(['email' => trans($response)]);
}
/**
* Get the broker to be used during password reset.
*
* @return \Illuminate\Contracts\Auth\PasswordBroker
*/
public function broker()
{
return Password::broker();
}
}

View File

@@ -3,6 +3,10 @@ body {
/* line-height: 1em!important; */
}
.content-wrapper {
min-height: calc(100vh - 340px);
}
.bg-green {
background-color: #517C39;
}

View File

@@ -9,13 +9,13 @@
"license": "proprietary",
"require": {
"php": "^7.4|^8.0",
"akaunting/laravel-apexcharts": "^2.0",
"alexisgeneau/mailvalidate": "dev-master",
"arcanedev/log-viewer": "^8.1",
"arrilot/laravel-widgets": "^3.13",
"awobaz/compoships": "^2.1",
"barryvdh/laravel-dompdf": "^0.9",
"barryvdh/laravel-snappy": "^0.4.7",
"bencoderus/min-auth": "^1.0",
"box/spout": "^3.3",
"browner12/helpers": "^3.0",
"cesargb/laravel-cascade-delete": "^1.2",
@@ -51,6 +51,7 @@
"laravel/tinker": "^2.5",
"laravel/ui": "^3.2",
"laravelcollective/html": "^6.0",
"laravolt/avatar": "^4.1",
"lavary/laravel-menu": "1.8.1",
"league/climate": "^3.5",
"league/period": "^4.9",
@@ -65,6 +66,8 @@
"orangehill/iseed": "^3.0",
"php-console/php-console": "^3.1",
"proengsoft/laravel-jsvalidation": "^4.5",
"protonemedia/laravel-cross-eloquent-search": "^3.0",
"protonemedia/laravel-eloquent-where-not": "^1.2",
"qoraiche/laravel-mail-editor": "^3.2",
"rahul900day/laravel-captcha": "^1.0",
"ralphjsmit/laravel-seo": "^1.0",
@@ -91,7 +94,6 @@
"thomasjohnkane/snooze": "^2.2",
"toin0u/geocoder-laravel": "^4.2",
"unicodeveloper/laravel-password": "^1.0",
"voku/stringy": "^6.2",
"watson/rememberable": "^5.0",
"wildside/userstamps": "^2.1",
"yadahan/laravel-authentication-log": "^1.2",

151
config/laravolt/avatar.php Normal file
View File

@@ -0,0 +1,151 @@
<?php
/*
* Set specific configuration variables here
*/
return [
/*
|--------------------------------------------------------------------------
| Image Driver
|--------------------------------------------------------------------------
| Avatar use Intervention Image library to process image.
| Meanwhile, Intervention Image supports "GD Library" and "Imagick" to process images
| internally. You may choose one of them according to your PHP
| configuration. By default PHP's "Imagick" implementation is used.
|
| Supported: "gd", "imagick"
|
*/
'driver' => env('IMAGE_DRIVER', 'gd'),
// Initial generator class
'generator' => \Laravolt\Avatar\Generator\DefaultGenerator::class,
// Whether all characters supplied must be replaced with their closest ASCII counterparts
'ascii' => false,
// Image shape: circle or square
'shape' => 'circle',
// Image width, in pixel
'width' => 100,
// Image height, in pixel
'height' => 100,
// Number of characters used as initials. If name consists of single word, the first N character will be used
'chars' => 2,
// font size
'fontSize' => 48,
// convert initial letter in uppercase
'uppercase' => false,
// Right to Left (RTL)
'rtl' => false,
// Fonts used to render text.
// If contains more than one fonts, randomly selected based on name supplied
'fonts' => [__DIR__ . '/../fonts/OpenSans-Bold.ttf', __DIR__ . '/../fonts/rockwell.ttf'],
// List of foreground colors to be used, randomly selected based on name supplied
'foregrounds' => [
'#FFFFFF',
],
// List of background colors to be used, randomly selected based on name supplied
'backgrounds' => [
'#f44336',
'#E91E63',
'#9C27B0',
'#673AB7',
'#3F51B5',
'#2196F3',
'#03A9F4',
'#00BCD4',
'#009688',
'#4CAF50',
'#8BC34A',
'#CDDC39',
'#FFC107',
'#FF9800',
'#FF5722',
],
'border' => [
'size' => 1,
// border color, available value are:
// 'foreground' (same as foreground color)
// 'background' (same as background color)
// or any valid hex ('#aabbcc')
'color' => 'background',
// border radius, currently only work for SVG
'radius' => 0,
],
// List of theme name to be used when rendering avatar
// Possible values are:
// 1. Theme name as string: 'colorful'
// 2. Or array of string name: ['grayscale-light', 'grayscale-dark']
// 3. Or wildcard "*" to use all defined themes
'theme' => ['colorful'],
// Predefined themes
// Available theme attributes are:
// shape, chars, backgrounds, foregrounds, fonts, fontSize, width, height, ascii, uppercase, and border.
'themes' => [
'grayscale-light' => [
'backgrounds' => ['#edf2f7', '#e2e8f0', '#cbd5e0'],
'foregrounds' => ['#a0aec0'],
],
'grayscale-dark' => [
'backgrounds' => ['#2d3748', '#4a5568', '#718096'],
'foregrounds' => ['#e2e8f0'],
],
'colorful' => [
'backgrounds' => [
'#f44336',
'#E91E63',
'#9C27B0',
'#673AB7',
'#3F51B5',
'#2196F3',
'#03A9F4',
'#00BCD4',
'#009688',
'#4CAF50',
'#8BC34A',
'#CDDC39',
'#FFC107',
'#FF9800',
'#FF5722',
],
'foregrounds' => ['#FFFFFF'],
],
'pastel' => [
'backgrounds' => [
'#ef9a9a',
'#F48FB1',
'#CE93D8',
'#B39DDB',
'#9FA8DA',
'#90CAF9',
'#81D4FA',
'#80DEEA',
'#80CBC4',
'#A5D6A7',
'#E6EE9C',
'#FFAB91',
'#FFCCBC',
'#D7CCC8',
],
'foregrounds' => [
'#FFF',
],
],
],
];

View File

@@ -15,6 +15,7 @@ class CreateShopCustomersTable extends Migration {
Schema::create('shop_customers', function(Blueprint $table)
{
$table->increments('id');
$table->uuid('uuid')->nullable();
$table->string('first_name')->nullable();
$table->string('last_name')->nullable();
$table->string('email')->unique();

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateActivityLogTable extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::connection(config('activitylog.database_connection'))->create(config('activitylog.table_name'), function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('log_name')->nullable();
$table->text('description');
$table->nullableMorphs('subject', 'subject');
$table->nullableMorphs('causer', 'causer');
$table->json('properties')->nullable();
$table->timestamps();
$table->index('log_name');
});
}
/**
* Reverse the migrations.
*/
public function down()
{
Schema::connection(config('activitylog.database_connection'))->dropIfExists(config('activitylog.table_name'));
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateClientsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('clients', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->ipAddress('ip');
$table->string('api_key');
$table->boolean('is_blacklisted')->default(false);
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('clients');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateMediaTable extends Migration
{
public function up()
{
Schema::create('media', function (Blueprint $table) {
$table->bigIncrements('id');
$table->morphs('model');
$table->uuid('uuid')->nullable()->unique();
$table->string('collection_name');
$table->string('name');
$table->string('file_name');
$table->string('mime_type')->nullable();
$table->string('disk');
$table->string('conversions_disk')->nullable();
$table->unsignedBigInteger('size');
$table->json('manipulations');
$table->json('custom_properties');
$table->json('generated_conversions');
$table->json('responsive_images');
$table->unsignedInteger('order_column')->nullable()->index();
$table->nullableTimestamps();
});
}
}

View File

@@ -0,0 +1,83 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class TeamworkSetupTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table(\Config::get('teamwork.users_table'), function (Blueprint $table) {
$table->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'));
}
}

View File

@@ -8,15 +8,15 @@
<div class="col-6">
<div class="row">
<div class="col-5">
{{ Form::label('active', __('active')) }}<br/>
{{ Form::label('active', __('Actif')) }}<br/>
@include("components.form.toggle", ['name' => 'active', 'value' => $delivery['active'] ?? false, 'on' => __('active'), 'off' => __('inactive')])
</div>
<div class="col-3">
{{ Form::label('is_public', __('type')) }}
{{ Form::label('is_public', __('Type')) }}
@include('components.form.toggle', ['name' => 'is_public', 'value' => $delivery['is_public'] ?? false, 'on' => __('public'), 'off' => __('administré')])
</div>
<div class="col-4">
{{ Form::label('at_house', __('defaut')) }}
{{ Form::label('at_house', __('faut')) }}
@include('components.form.checkboxes.icheck', ['name' => 'at_house', 'value' => $delivery['at_house'] ?? null])
</div>
</div>
@@ -24,20 +24,27 @@
</div>
<div class="row mb-3">
<div class="col-12">
{{ Form::label('name', __('name')) }}
{{ Form::label('name', __('Nom')) }}
@include('components.form.input', ['name' => 'name', 'value' => $delivery['name'] ?? null, 'required' => true])
</div>
</div>
<div class="row mb-3">
<div class="col-12">
{{ Form::label('', __('Description')) }}
<textarea name="description" class="form-control">{{ $delivery['description'] }}</textarea>
</div>
</div>
@include('components.address', ['with_country' => false])
<div class="row mb-3">
<div class="col-3">
{{ Form::label('event_date_begin', __('date')) }}
{{ Form::label('event_date_begin', __('Date de début')) }}
@include('components.form.datepicker', ['name' => 'event_date_begin', 'value' => $delivery['event_date_begin'] ?? null])
</div>
<div class="col-3">
{{ Form::label('event_date_end', __('date')) }}
{{ Form::label('event_date_end', __('Date de fin')) }}
@include('components.form.datepicker', ['name' => 'event_date_end', 'value' => $delivery['event_date_end'] ?? null])
</div>

View File

@@ -5,29 +5,33 @@
@section('content')
<div class="row">
<div class="col-8">
Déja client ?
<button class="btn">Créez mon compte</button>
@if (!App\Repositories\Shop\Customers::isConnected())
Déja client ?
<button class="btn">Créez mon compte</button>
<x-layout.collapse id="identification" title="Déjà client">
@include('Shop.auth.partials.login')
</x-layout.collapse>
<x-layout.collapse id="identification" title="Déjà client">
@include('Shop.auth.partials.login')
</x-layout.collapse>
<x-layout.collapse id="personal_data" title="Informations personnelles">
@include('Shop.auth.partials.register')
</x-layout.collapse>
<x-layout.collapse id="personal_data" title="Informations personnelles">
@include('Shop.auth.partials.register')
</x-layout.collapse>
@endif
<x-layout.collapse id="adresses" title="Adresses">
</x-layout.collapse>
{{ Form::open(['route' => 'Admin.Shop.Orders.store', 'id' => 'order-form', 'autocomplete' => 'off']) }}
<x-layout.collapse id="delivery_mode" title="Mode de livraison">
</x-layout.collapse>
<x-layout.collapse id="adresses" title="Adresses">
</x-layout.collapse>
<x-layout.collapse id="payment" title="Paiement">
</x-layout.collapse>
<x-layout.collapse id="delivery_mode" title="Mode de livraison">
@include('Shop.Orders.partials.deliveries')
</x-layout.collapse>
<x-layout.collapse id="payment" title="Paiement">
@include('Shop.Orders.partials.payments')
</x-layout.collapse>
</form>
</div>
<div class="col-4">
<x-card class='shadow bg-light'>

View File

@@ -0,0 +1,15 @@
@foreach ($deliveries as $delivery)
<div class="row">
<div class="col-1">
<x-form.radios.icheck name="delivery_id" val="{{ $delivery['id'] }}" id="delivery_{{ $delivery['id'] }}"/>
</div>
<div class="col-11">
<strong>{{ $delivery['name'] }} - Tarif appliqué {{ $delivery['sale_channel']['name'] }}</strong><br/>
{!! $delivery['sale_channel']['description'] !!}
</div>
</div>
@endforeach
Si vous voulez laisser un message à propos de votre commande, merci de bien vouloir le rensiegner dans le champs ci-contre
<textarea name="comment" class="form-control"></textarea>

View File

@@ -0,0 +1,37 @@
<div class="row">
<div class="col-1">
<x-form.radios.icheck name="payment" val="card" id="payment_card"/>
</div>
<div class="col-11">
PAIEMENT PAR CARTE BANCAIRE
</div>
</div>
<div class="row">
<div class="col-1">
<x-form.radios.icheck name="payment" val="check" id="payment_check"/>
</div>
<div class="col-11">
PAIEMENT PAR CHEQUE
</div>
</div>
<div class="row">
<div class="col-1">
<x-form.radios.icheck name="payment" val="transfer" id="payment_transfer"/>
</div>
<div class="col-11">
PAIEMENT PAR VIREMENT BANCAIRE
</div>
</div>
<div class="row pt-5">
<div class="col-1">
<x-form.checkboxes.icheck name="agree" val="1"/>
</div>
<div class="col-11">
J'ai lu les conditions générales de vente et j'y adhère sans réserve
</div>
</div>
<button type="submit" class="btn btn-primary mt-5">COMMANDE AVEC OBLIGATION DE PAIEMENT</button>

View File

@@ -11,6 +11,13 @@
@stack('css')
</head>
<body class="{{ $bodyClass ?? 'login-page'}}">
<div class="row" style="width: 380px;">
<div class="col-12 text-center">
<img src="/img/logo.png" height="128">
</div>
</div>
@yield('content')
<script src="{{ mix('/boilerplate.min.js', '/assets/vendor/boilerplate') }}"></script>
@stack('js')

View File

@@ -1,16 +1,10 @@
@extends('auth.layout', [
@extends('Shop.auth.layout', [
'title' => __('boilerplate::auth.login.title'),
'bodyClass' => 'hold-transition login-page'
])
@section('content')
<div class="row" style="width: 380px;">
<div class="col-12 text-center">
<img src="/img/logo.png" height="128">
</div>
</div>
@include('Shop.auth.partials.login')
<p class="mt-3">

View File

@@ -20,7 +20,7 @@
</div>
<div class="col-12 col-lg-6">
<a href="{{ route('Shop.password.reset') }}">{{ __('Mot de passe oublié ?') }}</a><br>
<a href="{{ route('Shop.password.request') }}">{{ __('Mot de passe oublié ?') }}</a><br>
<!--
<div class="checkbox icheck">
<label style="padding-left: 0">

View File

@@ -0,0 +1,16 @@
{!! Form::open(['route' => 'Shop.password.email', 'method' => 'post', 'autocomplete'=> 'off']) !!}
<div class="form-group {{ $errors->has('email') ? 'has-error' : '' }}">
{{ Form::email('email', old('email'), ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.email'), 'required', 'autofocus']) }}
{!! $errors->first('email','<p class="text-danger"><strong>:message</strong></p>') !!}
</div>
<div class="form-group">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 text-center">
<button type="submit" class="btn btn-primary">
{{ __('boilerplate::auth.password.submit') }}
</button>
</div>
</div>
</div>
{!! Form::close() !!}
<a href="{{ route('Shop.login') }}">{{ __('boilerplate::auth.password.login_link') }}</a><br>

View File

@@ -1,28 +1,13 @@
@extends('boilerplate::auth.layout', ['title' => __('boilerplate::auth.password.title'), 'bodyClass' => 'hold-transition login-page'])
@extends('Shop.auth.layout', ['title' => __('boilerplate::auth.password.title'), 'bodyClass' => 'hold-transition login-page'])
@section('content')
@component('boilerplate::auth.loginbox')
<p class="login-box-msg">{{ __('boilerplate::auth.password.intro') }}</p>
@if (session('status'))
<div class="alert alert-success">
{{ session('status') }}
</div>
@endif
{!! Form::open(['route' => 'boilerplate.password.email', 'method' => 'post', 'autocomplete'=> 'off']) !!}
<div class="form-group {{ $errors->has('email') ? 'has-error' : '' }}">
{{ Form::email('email', old('email'), ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.email'), 'required', 'autofocus']) }}
{!! $errors->first('email','<p class="text-danger"><strong>:message</strong></p>') !!}
</div>
<div class="form-group">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 text-center">
<button type="submit" class="btn btn-primary">
{{ __('boilerplate::auth.password.submit') }}
</button>
</div>
</div>
</div>
{!! Form::close() !!}
<a href="{{ route('boilerplate.login') }}">{{ __('boilerplate::auth.password.login_link') }}</a><br>
@endcomponent
<p class="login-box-msg">{{ __('boilerplate::auth.password.intro') }}</p>
@if (session('status'))
<div class="alert alert-success">
{{ session('status') }}
</div>
@endif
@include('Shop.auth.partials.lost_password')
@endsection

View File

@@ -1,9 +1,12 @@
@extends('boilerplate::auth.layout', ['title' => __('boilerplate::auth.password_reset.title')])
@extends('Shop.auth.layout', [
'title' => __('boilerplate::auth.password_reset.title'),
'bodyClass' => 'hold-transition login-page'
])
@section('content')
@component('boilerplate::auth.loginbox')
<p class="login-box-msg">{{ __('boilerplate::auth.password_reset.intro') }}</p>
{!! Form::open(['route' => 'boilerplate.password.reset.post', 'method' => 'post', 'autocomplete'=> 'off']) !!}
{!! Form::open(['route' => 'Shop.password.update', 'method' => 'post', 'autocomplete'=> 'off']) !!}
{!! Form::hidden('token', $token) !!}
<div class="form-group {{ $errors->has('email') ? 'has-error' : '' }}">
{{ Form::email('email', old('email', $email), ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.email'), 'required', 'autofocus']) }}

View File

@@ -1,20 +1,37 @@
<div class="row">
<div class="col-12 text-right p-2">
<button type="button" class="btn bg-green-dark light" data-toggle="dropdown">
<i class="fa fa-2x fa-fw fa-user mr-2"></i>
@if (App\Repositories\Shop\Customers::getName())
<span id="username" class="ml-2 badge bg-yellow green-dark">
{{ App\Repositories\Shop\Customers::getName() }}
</span>
@if (App\Repositories\Shop\Customers::isConnected())
<img src="{{ App\Repositories\Shop\Customers::getAvatar() }}" class="img-fluid">
@else
<i class="fa fa-2x fa-fw fa-user mr-2"></i>
@endif
</button>
<ul class="dropdown-menu" aria-labelledby="dLabel">
<li class="dropdown-item">
<a href="{{ route('Shop.login') }}" title="Identifiez-vous" rel="nofollow">
<span>Connexion</span>
</a>
</li>
@if (App\Repositories\Shop\Customers::isConnected())
<li class="dropdown-item">
<a href="{{ route('Shop.Customers.profile') }}" title="Accèdez à vos factures, remises ..." rel="nofollow">
<span>Votre compte</span>
</a>
</li>
<li class="dropdown-item">
<a href="{{ route('Shop.logout') }}" title="Vous déconnectez" rel="nofollow">
<span>Se déconnecter</span>
</a>
</li>
@else
<li class="dropdown-item">
<a href="{{ route('Shop.login') }}" title="Identifiez-vous" rel="nofollow">
<span>Connexion</span>
</a>
</li>
<li class="dropdown-item">
<a href="{{ route('Shop.register') }}" title="Enregistrez-vous" rel="nofollow">
<span>Creer votre compte</span>
</a>
</li>
@endif
</ul>
</div>

View File

@@ -0,0 +1,4 @@
<input type="radio" name="{{ $name }}" id="{{ $id_name ?? $id ?? $name }}" class="{{ $class ?? ''}}" value="{{ $val ?? 1}}" {{ $meta ?? '' }}
@if ((($value ?? false) == ($val ?? false)) || (!isset($val) && $value)) checked @endif
@if ($disabled ?? false) disabled="disabled" @endif
>

View File

@@ -0,0 +1,4 @@
<div class="icheck-{{ $color ?? 'success' }} {{ $class ?? '' }}">
@include('components.form.radio')
<label class="control-label light" for="{{ $id_name ?? $id ?? $name }}">{{ $label ?? '' }}</label>
</div>

View File

@@ -2,7 +2,7 @@
Route::middleware('auth')->prefix('Admin')->namespace('Admin')->name('Admin.')->group(function () {
Route::get('', 'HomeController@index')->name('home');
include( __DIR__ . '/Botanic/route.php');
include( __DIR__ . '/Core/route.php');
include( __DIR__ . '/Shop/route.php');
include __DIR__ . '/Botanic/route.php';
include __DIR__ . '/Core/route.php';
include __DIR__ . '/Shop/route.php';
});

View File

@@ -1,6 +1,6 @@
<?php
Route::middleware('auth')->prefix('Customers')->name('Customers.')->group(function () {
Route::get('show/{id}', 'CustomerController@show')->name('show');
Route::get('show/{id}', 'CustomerController@show')->name('show');
Route::get('profile/{id?}', 'CustomerController@profile')->name('profile');
});

View File

@@ -2,5 +2,6 @@
Route::prefix('Orders')->name('Orders.')->group(function () {
Route::get('order', 'OrderController@order')->name('order');
Route::post('order', 'OrderController@store')->name('store');
});

View File

@@ -5,8 +5,10 @@ Route::prefix('Shop')->namespace('Shop')->name('Shop.')->group(function () {
Route::post('login', 'Auth\LoginController@login')->name('login.post');
Route::post('logout', 'Auth\LoginController@logout')->name('logout');
Route::get('invite/{token?}/{event_id?}', 'Auth\LoginController@invite')->name('invite');
Route::get('password/reset/{token?}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
Route::get('password/request', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update');
Route::get('password/reset/{token?}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
Route::get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
Route::post('register', 'Auth\RegisterController@register')->name('register.post');
});

View File

@@ -16,7 +16,6 @@ Auth::routes();
Route::get('', 'Shop\HomeController@index')->name('welcome');
Route::get('home', 'Shop\HomeController@index')->name('home');
// include( __DIR__ . '/boilerplate/route.php');
include( __DIR__ . '/Admin/route.php');
include( __DIR__ . '/Admin/route.php');
include( __DIR__ . '/Shop/route.php');
include( __DIR__ . '/Botanic/route.php');