From 719e4481d7452a7f910bcb46949190b3f1dffc06 Mon Sep 17 00:00:00 2001 From: Ludovic CANDELLIER Date: Sun, 3 Jul 2022 22:38:08 +0200 Subject: [PATCH] [WIP] Order process --- Gruntfile.js | 1 + app/Datatables/Botanic/SpeciesDataTable.php | 1 + .../Admin/Core/Auth/UserController.php | 4 +- .../Auth/ResetPasswordController.php | 2 - .../Shop/Auth/ConfirmPasswordController.php | 40 +++++ .../Shop/Auth/ForgotPasswordController.php | 23 +-- .../Controllers/Shop/Auth/LoginController.php | 5 +- .../Shop/Auth/ResetPasswordController.php | 32 +++- .../Shop/Auth/VerificationController.php | 41 +++++ app/Http/Controllers/Shop/Controller.php | 2 +- .../Controllers/Shop/CustomerController.php | 38 ++--- .../Controllers/Shop/InvoiceController.php | 72 +-------- app/Http/Controllers/Shop/OrderController.php | 9 ++ .../Controllers/Shop/SearchController.php | 5 +- app/Models/Core/Auth/User.php | 8 +- app/Models/Shop/Customer.php | 24 ++- app/Notifications/NewUser.php | 63 ++++++++ app/Notifications/ResetPassword.php | 28 ++++ app/Notifications/VerifyEmail.php | 44 +++++ app/Repositories/Cities.php | 8 +- app/Repositories/Core/Debug.php | 5 +- app/Repositories/Core/Export.php | 13 +- app/Repositories/Core/File.php | 4 +- app/Repositories/Core/Geolocation.php | 12 +- app/Repositories/Core/Menu/Item.php | 4 +- app/Repositories/Core/Menu/Menu.php | 4 +- app/Repositories/Core/User/ShopCart.php | 16 +- app/Repositories/Shop/Articles.php | 67 ++++---- app/Repositories/Shop/Categories.php | 13 +- app/Repositories/Shop/Customers.php | 70 ++++++-- app/Repositories/Shop/Deliveries.php | 5 + app/Repositories/Shop/TagGroups.php | 15 +- app/Rules/Password.php | 59 +++++++ app/Traits/Auth/SendsPasswordResetEmails.php | 111 +++++++++++++ build/css/site.css | 4 + composer.json | 6 +- config/laravolt/avatar.php | 151 ++++++++++++++++++ ..._20_212813_create_shop_customers_table.php | 1 + ...05_11_202752_create_activity_log_table.php | 33 ++++ ...2022_05_11_202752_create_clients_table.php | 36 +++++ .../2022_05_11_202752_create_media_table.php | 32 ++++ ...022_05_11_202752_teamwork_setup_tables.php | 83 ++++++++++ .../Admin/Shop/Deliveries/form.blade.php | 19 ++- resources/views/Shop/Orders/order.blade.php | 38 +++-- .../Shop/Orders/partials/deliveries.blade.php | 15 ++ .../Shop/Orders/partials/payments.blade.php | 37 +++++ resources/views/Shop/auth/layout.blade.php | 7 + resources/views/Shop/auth/login.blade.php | 8 +- .../views/Shop/auth/partials/login.blade.php | 2 +- .../auth/partials/lost_password.blade.php | 16 ++ .../views/Shop/auth/passwords/email.blade.php | 35 ++-- .../views/Shop/auth/passwords/reset.blade.php | 7 +- .../layout/partials/header-profile.blade.php | 37 +++-- .../views/components/form/radio.blade.php | 4 + .../components/form/radios/icheck.blade.php | 4 + routes/Admin/route.php | 6 +- routes/Shop/Customers.php | 4 +- routes/Shop/Orders.php | 1 + routes/Shop/route.php | 4 +- routes/web.php | 3 +- 60 files changed, 1146 insertions(+), 295 deletions(-) create mode 100644 app/Http/Controllers/Shop/Auth/ConfirmPasswordController.php create mode 100644 app/Http/Controllers/Shop/Auth/VerificationController.php create mode 100644 app/Notifications/NewUser.php create mode 100644 app/Notifications/ResetPassword.php create mode 100644 app/Notifications/VerifyEmail.php create mode 100644 app/Rules/Password.php create mode 100644 app/Traits/Auth/SendsPasswordResetEmails.php create mode 100644 config/laravolt/avatar.php create mode 100644 database/migrations/2022_05_11_202752_create_activity_log_table.php create mode 100644 database/migrations/2022_05_11_202752_create_clients_table.php create mode 100644 database/migrations/2022_05_11_202752_create_media_table.php create mode 100644 database/migrations/2022_05_11_202752_teamwork_setup_tables.php create mode 100644 resources/views/Shop/Orders/partials/deliveries.blade.php create mode 100644 resources/views/Shop/Orders/partials/payments.blade.php create mode 100644 resources/views/Shop/auth/partials/lost_password.blade.php create mode 100644 resources/views/components/form/radio.blade.php create mode 100644 resources/views/components/form/radios/icheck.blade.php diff --git a/Gruntfile.js b/Gruntfile.js index 62c38fd7..797a9101 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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', diff --git a/app/Datatables/Botanic/SpeciesDataTable.php b/app/Datatables/Botanic/SpeciesDataTable.php index fb95eee2..27973b30 100644 --- a/app/Datatables/Botanic/SpeciesDataTable.php +++ b/app/Datatables/Botanic/SpeciesDataTable.php @@ -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; diff --git a/app/Http/Controllers/Admin/Core/Auth/UserController.php b/app/Http/Controllers/Admin/Core/Auth/UserController.php index 62197764..392f431e 100644 --- a/app/Http/Controllers/Admin/Core/Auth/UserController.php +++ b/app/Http/Controllers/Admin/Core/Auth/UserController.php @@ -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; diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index a429bdec..15358f32 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -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); diff --git a/app/Http/Controllers/Shop/Auth/ConfirmPasswordController.php b/app/Http/Controllers/Shop/Auth/ConfirmPasswordController.php new file mode 100644 index 00000000..038cbf3b --- /dev/null +++ b/app/Http/Controllers/Shop/Auth/ConfirmPasswordController.php @@ -0,0 +1,40 @@ +middleware('auth'); + } +} diff --git a/app/Http/Controllers/Shop/Auth/ForgotPasswordController.php b/app/Http/Controllers/Shop/Auth/ForgotPasswordController.php index dca0bc0d..e348a1d7 100644 --- a/app/Http/Controllers/Shop/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Shop/Auth/ForgotPasswordController.php @@ -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'); } } diff --git a/app/Http/Controllers/Shop/Auth/LoginController.php b/app/Http/Controllers/Shop/Auth/LoginController.php index 5226dea8..7831fe30 100644 --- a/app/Http/Controllers/Shop/Auth/LoginController.php +++ b/app/Http/Controllers/Shop/Auth/LoginController.php @@ -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')); } diff --git a/app/Http/Controllers/Shop/Auth/ResetPasswordController.php b/app/Http/Controllers/Shop/Auth/ResetPasswordController.php index 2cf76c69..2a3803c9 100644 --- a/app/Http/Controllers/Shop/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Shop/Auth/ResetPasswordController.php @@ -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'); } } diff --git a/app/Http/Controllers/Shop/Auth/VerificationController.php b/app/Http/Controllers/Shop/Auth/VerificationController.php new file mode 100644 index 00000000..a7ac017e --- /dev/null +++ b/app/Http/Controllers/Shop/Auth/VerificationController.php @@ -0,0 +1,41 @@ +middleware('auth'); + $this->middleware('signed')->only('verify'); + $this->middleware('throttle:6,1')->only('verify', 'resend'); + } +} diff --git a/app/Http/Controllers/Shop/Controller.php b/app/Http/Controllers/Shop/Controller.php index b55e7501..d31997ee 100644 --- a/app/Http/Controllers/Shop/Controller.php +++ b/app/Http/Controllers/Shop/Controller.php @@ -1,6 +1,6 @@ toArray(); $data['sale_channel'] = SaleChannels::getDefault(); return view('Shop.Orders.order', $data); } + + public function store(Request $request) + { + $data = $request->all(); + dump($data); + exit; + } } diff --git a/app/Http/Controllers/Shop/SearchController.php b/app/Http/Controllers/Shop/SearchController.php index 48086635..01be573c 100644 --- a/app/Http/Controllers/Shop/SearchController.php +++ b/app/Http/Controllers/Shop/SearchController.php @@ -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'), ]; diff --git a/app/Models/Core/Auth/User.php b/app/Models/Core/Auth/User.php index 0c254db1..185ca6b2 100644 --- a/app/Models/Core/Auth/User.php +++ b/app/Models/Core/Auth/User.php @@ -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) diff --git a/app/Models/Shop/Customer.php b/app/Models/Shop/Customer.php index 197b2551..fd8bc529 100644 --- a/app/Models/Shop/Customer.php +++ b/app/Models/Shop/Customer.php @@ -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)); + } + } diff --git a/app/Notifications/NewUser.php b/app/Notifications/NewUser.php new file mode 100644 index 00000000..d9a7c172 --- /dev/null +++ b/app/Notifications/NewUser.php @@ -0,0 +1,63 @@ +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 [ + // + ]; + } +} diff --git a/app/Notifications/ResetPassword.php b/app/Notifications/ResetPassword.php new file mode 100644 index 00000000..c0c02824 --- /dev/null +++ b/app/Notifications/ResetPassword.php @@ -0,0 +1,28 @@ +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')); + } +} diff --git a/app/Notifications/VerifyEmail.php b/app/Notifications/VerifyEmail.php new file mode 100644 index 00000000..bbf1edf3 --- /dev/null +++ b/app/Notifications/VerifyEmail.php @@ -0,0 +1,44 @@ +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.')); + } +} diff --git a/app/Repositories/Cities.php b/app/Repositories/Cities.php index faae2b7e..2d03a86d 100644 --- a/app/Repositories/Cities.php +++ b/app/Repositories/Cities.php @@ -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) diff --git a/app/Repositories/Core/Debug.php b/app/Repositories/Core/Debug.php index 17281af5..b812c112 100644 --- a/app/Repositories/Core/Debug.php +++ b/app/Repositories/Core/Debug.php @@ -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) diff --git a/app/Repositories/Core/Export.php b/app/Repositories/Core/Export.php index ec69b799..5cf9a4c3 100644 --- a/app/Repositories/Core/Export.php +++ b/app/Repositories/Core/Export.php @@ -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) diff --git a/app/Repositories/Core/File.php b/app/Repositories/Core/File.php index 1fea4338..ef7f5c7e 100644 --- a/app/Repositories/Core/File.php +++ b/app/Repositories/Core/File.php @@ -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) diff --git a/app/Repositories/Core/Geolocation.php b/app/Repositories/Core/Geolocation.php index 9a2d24b0..ee714900 100644 --- a/app/Repositories/Core/Geolocation.php +++ b/app/Repositories/Core/Geolocation.php @@ -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) { diff --git a/app/Repositories/Core/Menu/Item.php b/app/Repositories/Core/Menu/Item.php index 94b47e7c..449292c6 100644 --- a/app/Repositories/Core/Menu/Item.php +++ b/app/Repositories/Core/Menu/Item.php @@ -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; } diff --git a/app/Repositories/Core/Menu/Menu.php b/app/Repositories/Core/Menu/Menu.php index b1d10d38..c2634e87 100644 --- a/app/Repositories/Core/Menu/Menu.php +++ b/app/Repositories/Core/Menu/Menu.php @@ -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]; } - } } diff --git a/app/Repositories/Core/User/ShopCart.php b/app/Repositories/Core/User/ShopCart.php index 545a5d14..2b2694a8 100644 --- a/app/Repositories/Core/User/ShopCart.php +++ b/app/Repositories/Core/User/ShopCart.php @@ -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) diff --git a/app/Repositories/Shop/Articles.php b/app/Repositories/Shop/Articles.php index 64b4259e..40cdb7bd 100644 --- a/app/Repositories/Shop/Articles.php +++ b/app/Repositories/Shop/Articles.php @@ -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) diff --git a/app/Repositories/Shop/Categories.php b/app/Repositories/Shop/Categories.php index 75dce938..59229f52 100644 --- a/app/Repositories/Shop/Categories.php +++ b/app/Repositories/Shop/Categories.php @@ -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) diff --git a/app/Repositories/Shop/Customers.php b/app/Repositories/Shop/Customers.php index d7c0f066..b636ea67 100644 --- a/app/Repositories/Shop/Customers.php +++ b/app/Repositories/Shop/Customers.php @@ -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; + } } diff --git a/app/Repositories/Shop/Deliveries.php b/app/Repositories/Shop/Deliveries.php index 7e6b52d0..2e6042f5 100644 --- a/app/Repositories/Shop/Deliveries.php +++ b/app/Repositories/Shop/Deliveries.php @@ -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); diff --git a/app/Repositories/Shop/TagGroups.php b/app/Repositories/Shop/TagGroups.php index 6f011827..5a46f500 100644 --- a/app/Repositories/Shop/TagGroups.php +++ b/app/Repositories/Shop/TagGroups.php @@ -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; } diff --git a/app/Rules/Password.php b/app/Rules/Password.php new file mode 100644 index 00000000..261f38f2 --- /dev/null +++ b/app/Rules/Password.php @@ -0,0 +1,59 @@ +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; + } +} diff --git a/app/Traits/Auth/SendsPasswordResetEmails.php b/app/Traits/Auth/SendsPasswordResetEmails.php new file mode 100644 index 00000000..d6cdda7a --- /dev/null +++ b/app/Traits/Auth/SendsPasswordResetEmails.php @@ -0,0 +1,111 @@ +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(); + } +} diff --git a/build/css/site.css b/build/css/site.css index 9e67382c..78d7f2d6 100644 --- a/build/css/site.css +++ b/build/css/site.css @@ -3,6 +3,10 @@ body { /* line-height: 1em!important; */ } +.content-wrapper { + min-height: calc(100vh - 340px); +} + .bg-green { background-color: #517C39; } diff --git a/composer.json b/composer.json index fea9c897..d52bcb2b 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/config/laravolt/avatar.php b/config/laravolt/avatar.php new file mode 100644 index 00000000..cdb22896 --- /dev/null +++ b/config/laravolt/avatar.php @@ -0,0 +1,151 @@ + 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', + ], + ], + ], +]; diff --git a/database/migrations/2020_04_20_212813_create_shop_customers_table.php b/database/migrations/2020_04_20_212813_create_shop_customers_table.php index 5473db21..ad39187c 100644 --- a/database/migrations/2020_04_20_212813_create_shop_customers_table.php +++ b/database/migrations/2020_04_20_212813_create_shop_customers_table.php @@ -15,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(); diff --git a/database/migrations/2022_05_11_202752_create_activity_log_table.php b/database/migrations/2022_05_11_202752_create_activity_log_table.php new file mode 100644 index 00000000..d2743d38 --- /dev/null +++ b/database/migrations/2022_05_11_202752_create_activity_log_table.php @@ -0,0 +1,33 @@ +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')); + } +} diff --git a/database/migrations/2022_05_11_202752_create_clients_table.php b/database/migrations/2022_05_11_202752_create_clients_table.php new file mode 100644 index 00000000..23018a0d --- /dev/null +++ b/database/migrations/2022_05_11_202752_create_clients_table.php @@ -0,0 +1,36 @@ +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'); + } +} diff --git a/database/migrations/2022_05_11_202752_create_media_table.php b/database/migrations/2022_05_11_202752_create_media_table.php new file mode 100644 index 00000000..df5dac1d --- /dev/null +++ b/database/migrations/2022_05_11_202752_create_media_table.php @@ -0,0 +1,32 @@ +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(); + }); + } +} diff --git a/database/migrations/2022_05_11_202752_teamwork_setup_tables.php b/database/migrations/2022_05_11_202752_teamwork_setup_tables.php new file mode 100644 index 00000000..144f40c9 --- /dev/null +++ b/database/migrations/2022_05_11_202752_teamwork_setup_tables.php @@ -0,0 +1,83 @@ +integer('current_team_id')->unsigned()->nullable(); + }); + + Schema::create(\Config::get('teamwork.teams_table'), function (Blueprint $table) { + $table->increments('id')->unsigned(); + $table->integer('owner_id')->unsigned()->nullable(); + $table->string('name'); + $table->timestamps(); + }); + + Schema::create(\Config::get('teamwork.team_user_table'), function (Blueprint $table) { + $table->bigInteger('user_id')->unsigned(); + $table->integer('team_id')->unsigned(); + $table->timestamps(); + + $table->foreign('user_id') + ->references(\Config::get('teamwork.user_foreign_key')) + ->on(\Config::get('teamwork.users_table')) + ->onUpdate('cascade') + ->onDelete('cascade'); + + $table->foreign('team_id') + ->references('id') + ->on(\Config::get('teamwork.teams_table')) + ->onDelete('cascade'); + }); + + Schema::create(\Config::get('teamwork.team_invites_table'), function (Blueprint $table) { + $table->increments('id'); + $table->bigInteger('user_id')->unsigned(); + $table->integer('team_id')->unsigned(); + $table->enum('type', ['invite', 'request']); + $table->string('email'); + $table->string('accept_token'); + $table->string('deny_token'); + $table->timestamps(); + $table->foreign('team_id') + ->references('id') + ->on(\Config::get('teamwork.teams_table')) + ->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table(\Config::get('teamwork.users_table'), function (Blueprint $table) { + $table->dropColumn('current_team_id'); + }); + + Schema::table(\Config::get('teamwork.team_user_table'), function (Blueprint $table) { + if (DB::getDriverName() !== 'sqlite') { + $table->dropForeign(\Config::get('teamwork.team_user_table').'_user_id_foreign'); + } + if (DB::getDriverName() !== 'sqlite') { + $table->dropForeign(\Config::get('teamwork.team_user_table').'_team_id_foreign'); + } + }); + + Schema::drop(\Config::get('teamwork.team_user_table')); + Schema::drop(\Config::get('teamwork.team_invites_table')); + Schema::drop(\Config::get('teamwork.teams_table')); + } +} diff --git a/resources/views/Admin/Shop/Deliveries/form.blade.php b/resources/views/Admin/Shop/Deliveries/form.blade.php index 02b15dcf..423c2d52 100644 --- a/resources/views/Admin/Shop/Deliveries/form.blade.php +++ b/resources/views/Admin/Shop/Deliveries/form.blade.php @@ -8,15 +8,15 @@
- {{ Form::label('active', __('active')) }}
+ {{ Form::label('active', __('Actif')) }}
@include("components.form.toggle", ['name' => 'active', 'value' => $delivery['active'] ?? false, 'on' => __('active'), 'off' => __('inactive')])
- {{ 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é')])
- {{ Form::label('at_house', __('defaut')) }} + {{ Form::label('at_house', __('Défaut')) }} @include('components.form.checkboxes.icheck', ['name' => 'at_house', 'value' => $delivery['at_house'] ?? null])
@@ -24,20 +24,27 @@
- {{ Form::label('name', __('name')) }} + {{ Form::label('name', __('Nom')) }} @include('components.form.input', ['name' => 'name', 'value' => $delivery['name'] ?? null, 'required' => true])
+
+
+ {{ Form::label('', __('Description')) }} + +
+
+ @include('components.address', ['with_country' => false])
- {{ 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])
- {{ 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])
diff --git a/resources/views/Shop/Orders/order.blade.php b/resources/views/Shop/Orders/order.blade.php index 50ecf4cb..3163fbaf 100644 --- a/resources/views/Shop/Orders/order.blade.php +++ b/resources/views/Shop/Orders/order.blade.php @@ -5,29 +5,33 @@ @section('content')
- Déja client ? - + @if (!App\Repositories\Shop\Customers::isConnected()) + Déja client ? + - - @include('Shop.auth.partials.login') - + + @include('Shop.auth.partials.login') + - - @include('Shop.auth.partials.register') - + + @include('Shop.auth.partials.register') + + @endif - - - + {{ Form::open(['route' => 'Admin.Shop.Orders.store', 'id' => 'order-form', 'autocomplete' => 'off']) }} - - - + + + - - - + + @include('Shop.Orders.partials.deliveries') + + + @include('Shop.Orders.partials.payments') + +
diff --git a/resources/views/Shop/Orders/partials/deliveries.blade.php b/resources/views/Shop/Orders/partials/deliveries.blade.php new file mode 100644 index 00000000..0cbd4abc --- /dev/null +++ b/resources/views/Shop/Orders/partials/deliveries.blade.php @@ -0,0 +1,15 @@ +@foreach ($deliveries as $delivery) +
+
+ +
+
+ {{ $delivery['name'] }} - Tarif appliqué {{ $delivery['sale_channel']['name'] }}
+ {!! $delivery['sale_channel']['description'] !!} +
+
+@endforeach + +Si vous voulez laisser un message à propos de votre commande, merci de bien vouloir le rensiegner dans le champs ci-contre + + \ No newline at end of file diff --git a/resources/views/Shop/Orders/partials/payments.blade.php b/resources/views/Shop/Orders/partials/payments.blade.php new file mode 100644 index 00000000..34fd8eb9 --- /dev/null +++ b/resources/views/Shop/Orders/partials/payments.blade.php @@ -0,0 +1,37 @@ +
+
+ +
+
+ PAIEMENT PAR CARTE BANCAIRE +
+
+ +
+
+ +
+
+ PAIEMENT PAR CHEQUE +
+
+ +
+
+ +
+
+ PAIEMENT PAR VIREMENT BANCAIRE +
+
+ +
+
+ +
+
+ J'ai lu les conditions générales de vente et j'y adhère sans réserve +
+
+ + \ No newline at end of file diff --git a/resources/views/Shop/auth/layout.blade.php b/resources/views/Shop/auth/layout.blade.php index 89fcf408..614e587c 100644 --- a/resources/views/Shop/auth/layout.blade.php +++ b/resources/views/Shop/auth/layout.blade.php @@ -11,6 +11,13 @@ @stack('css') + +
+
+ +
+
+ @yield('content') @stack('js') diff --git a/resources/views/Shop/auth/login.blade.php b/resources/views/Shop/auth/login.blade.php index 0153e3f4..7e69b3c7 100644 --- a/resources/views/Shop/auth/login.blade.php +++ b/resources/views/Shop/auth/login.blade.php @@ -1,16 +1,10 @@ -@extends('auth.layout', [ +@extends('Shop.auth.layout', [ 'title' => __('boilerplate::auth.login.title'), 'bodyClass' => 'hold-transition login-page' ]) @section('content') -
-
- -
-
- @include('Shop.auth.partials.login')

diff --git a/resources/views/Shop/auth/partials/login.blade.php b/resources/views/Shop/auth/partials/login.blade.php index 87979ac7..d731b65e 100644 --- a/resources/views/Shop/auth/partials/login.blade.php +++ b/resources/views/Shop/auth/partials/login.blade.php @@ -20,7 +20,7 @@