diff --git a/app/Http/Controllers/Shop/ArticleController.php b/app/Http/Controllers/Shop/ArticleController.php index f0788485..8ace1f33 100644 --- a/app/Http/Controllers/Shop/ArticleController.php +++ b/app/Http/Controllers/Shop/ArticleController.php @@ -6,12 +6,16 @@ use Illuminate\Http\Request; use App\Http\Controllers\Controller; use App\Repositories\Shop\Articles; +use App\Repositories\Shop\Categories; class ArticleController extends Controller { public function show($id) { $data['article'] = Articles::getArticleToSell($id); + // $data['breadcrumb'] = Categories::getAncestorsByCategory($category_id); + // dump($data); + // exit; return view('Shop.Articles.show', $data); } } diff --git a/app/Http/Controllers/Shop/Auth/RegisterController.php b/app/Http/Controllers/Shop/Auth/RegisterController.php index 7a40a159..160e99a4 100644 --- a/app/Http/Controllers/Shop/Auth/RegisterController.php +++ b/app/Http/Controllers/Shop/Auth/RegisterController.php @@ -15,6 +15,8 @@ use Illuminate\Routing\Redirector; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Validator; use Sebastienheyd\Boilerplate\Rules\Password; +use App\Repositories\Shop\Customers; +use App\Repositories\Shop\CustomerAddresses; use App\Models\Shop\Customer; @@ -51,14 +53,8 @@ class RegisterController extends Controller protected function create(array $data) { - $user = Customer::withTrashed()->updateOrCreate(['email' => $data['email']], [ - 'active' => true, - 'first_name' => $data['first_name'], - 'last_name' => $data['last_name'], - 'email' => $data['email'], - 'password' => bcrypt($data['password']), - ]); - + $user = Customers::create($data); + CustomerAddresses::add($user->id, $data); return $user; } diff --git a/app/Repositories/Core/Categories.php b/app/Repositories/Core/Categories.php index 7c7dd25d..82e57acc 100644 --- a/app/Repositories/Core/Categories.php +++ b/app/Repositories/Core/Categories.php @@ -54,6 +54,7 @@ class Categories } $tree[] = $leaf; } + $tree = collect($tree)->sortBy('name')->toArray(); return $tree; } diff --git a/app/Repositories/Shop/CustomerAddresses.php b/app/Repositories/Shop/CustomerAddresses.php index 8e32f501..e069ee2e 100644 --- a/app/Repositories/Shop/CustomerAddresses.php +++ b/app/Repositories/Shop/CustomerAddresses.php @@ -21,6 +21,17 @@ class CustomerAddresses return CustomerAddress::find($id); } + public static function add($user_id, $data) + { + return self::store([ + 'customer_id' => $user_id, + 'address' => $data['delivery_address'], + 'address2' => $data['delivery_address2'], + 'zipcode' => $data['delivery_zipcode'], + 'city' => $data['city'], + ]); + } + public static function store($data) { $id = $data['id'] ?? false; diff --git a/app/Repositories/Shop/Customers.php b/app/Repositories/Shop/Customers.php index a4259c77..610012e6 100644 --- a/app/Repositories/Shop/Customers.php +++ b/app/Repositories/Shop/Customers.php @@ -148,8 +148,22 @@ class Customers public static function create($data) { - $data['uuid'] = Str::uuid()->toString(); - return Customer::create($data); + $user = Customer::create([ + 'uuid' => Str::uuid(), + 'active' => true, + 'first_name' => $data['first_name'], + 'last_name' => $data['last_name'], + 'company' => $data['company'], + 'tva' => $data['tva'], + 'phone' => $data['phone'], + 'address' => $data['address'], + 'address2' => $data['address2'], + 'zipcode' => $data['zipcode'], + 'city' => $data['city'], + 'email' => $data['email'], + 'password' => bcrypt($data['password']), + ]); + return $user; } public static function update($data, $id = false) diff --git a/app/Repositories/Shop/Homepages.php b/app/Repositories/Shop/Homepages.php index e1609eaa..16d11a90 100644 --- a/app/Repositories/Shop/Homepages.php +++ b/app/Repositories/Shop/Homepages.php @@ -20,12 +20,12 @@ class Homepages public static function getFooter() { - return self::get(2)->text ?? ''; + return self::get(2)->text ?? ''; } public static function getExtraFooter() { - return self::get(3)->text ?? ''; + return self::get(3)->text ?? ''; } public static function get($id) diff --git a/build/css/site.css b/build/css/site.css index b1ba35c5..a1c1950a 100644 --- a/build/css/site.css +++ b/build/css/site.css @@ -60,6 +60,10 @@ label { color: #517C39; } +a.green { + color: #517C39 !important; +} + .green-dark { color: #335012; } diff --git a/composer.json b/composer.json index 14483abb..ef9924d3 100644 --- a/composer.json +++ b/composer.json @@ -130,7 +130,11 @@ "config": { "optimize-autoloader": true, "preferred-install": "dist", - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "pestphp/pest-plugin": true, + "dealerdirect/phpcodesniffer-composer-installer": true + } }, "extra": { "laravel": { diff --git a/resources/views/Shop/Articles/partials/article.blade.php b/resources/views/Shop/Articles/partials/article.blade.php index 9a54912d..04db5939 100644 --- a/resources/views/Shop/Articles/partials/article.blade.php +++ b/resources/views/Shop/Articles/partials/article.blade.php @@ -3,7 +3,7 @@ {{ $product_name }}
-
+
diff --git a/resources/views/Shop/Articles/show.blade.php b/resources/views/Shop/Articles/show.blade.php index f2da5313..7527ae54 100644 --- a/resources/views/Shop/Articles/show.blade.php +++ b/resources/views/Shop/Articles/show.blade.php @@ -28,10 +28,10 @@ @if (count($article['tags'] ?? []))

Caractéristiques

@foreach ($article['tags'] as $tag_group => $items) -
+
{{ $tag_group }} : @foreach ($items as $tag) - {{ $tag }} + {{ $tag }} @endforeach
@endforeach diff --git a/resources/views/Shop/Customers/partials/address.blade.php b/resources/views/Shop/Customers/partials/address.blade.php new file mode 100644 index 00000000..1686142c --- /dev/null +++ b/resources/views/Shop/Customers/partials/address.blade.php @@ -0,0 +1,36 @@ +
+
+ @include('components.form.input', [ + 'name' => ($prefix ?? '') . 'address', + 'value' => $customer['address'] ?? '', + 'label' => $label ?? '', + ]) +
+
+ +
+
+ @include('components.form.input', [ + 'name' => ($prefix ?? '') . 'address2', + 'value' => $customer['address2'] ?? '', + 'label' => 'Complément d\'adresse', + ]) +
+
+ +
+
+ @include('components.form.input', [ + 'name' => ($prefix ?? '') . 'zipcode', + 'value' => $customer['zipcode'] ?? '', + 'label' => 'Code postal', + ]) +
+
+ @include('components.form.input', [ + 'name' => ($prefix ?? '') . 'city', + 'value' => $customer['city'] ?? '', + 'label' => 'Ville', + ]) +
+
\ No newline at end of file diff --git a/resources/views/Shop/Customers/partials/delivery.blade.php b/resources/views/Shop/Customers/partials/delivery.blade.php new file mode 100644 index 00000000..4cb07d82 --- /dev/null +++ b/resources/views/Shop/Customers/partials/delivery.blade.php @@ -0,0 +1,36 @@ +
+
+ @include('components.form.input', [ + 'name' => 'delivery_address', + 'value' => $customer['address'] ?? '', + 'label' => $label ?? '', + ]) +
+
+ +
+
+ @include('components.form.input', [ + 'name' => 'delivery_address2', + 'value' => $customer['address2'] ?? '', + 'label' => 'Complément d\'adresse', + ]) +
+
+ +
+
+ @include('components.form.input', [ + 'name' => 'delivery_zipcode', + 'value' => $customer['zipcode'] ?? '', + 'label' => 'Code postal', + ]) +
+
+ @include('components.form.input', [ + 'name' => 'delivery_city', + 'value' => $customer['city'] ?? '', + 'label' => 'Ville', + ]) +
+
\ No newline at end of file diff --git a/resources/views/Shop/Customers/partials/registration.blade.php b/resources/views/Shop/Customers/partials/registration.blade.php index 463d43fb..ffb5351d 100644 --- a/resources/views/Shop/Customers/partials/registration.blade.php +++ b/resources/views/Shop/Customers/partials/registration.blade.php @@ -49,40 +49,4 @@
-
-
- @include('components.form.input', [ - 'name' => 'address', - 'value' => $customer['address'] ?? '', - 'label' => 'Adresse de facturation', - ]) -
-
- -
-
- @include('components.form.input', [ - 'name' => 'address2', - 'value' => $customer['address2'] ?? '', - 'label' => 'Complément d\'adresse', - ]) -
-
- -
-
- @include('components.form.input', [ - 'name' => 'zipcode', - 'value' => $customer['zipcode'] ?? '', - 'label' => 'Code postal', - ]) -
-
- @include('components.form.input', [ - 'name' => 'city', - 'value' => $customer['city'] ?? '', - 'label' => 'Ville', - ]) -
-
- +@include('Shop.Customers.partials.address', ['label' => 'Adresse de facturation']) diff --git a/resources/views/Shop/Homepage/partials/sliderByShelve.blade.php b/resources/views/Shop/Homepage/partials/sliderByShelve.blade.php index 7d816b29..eee3e8fb 100644 --- a/resources/views/Shop/Homepage/partials/sliderByShelve.blade.php +++ b/resources/views/Shop/Homepage/partials/sliderByShelve.blade.php @@ -1,8 +1,8 @@ @if ($shelve['articles']) -
+
-

{{ $shelve['name'] }}

+

{{ $shelve['name'] }}

Découvrir la sélection @@ -13,7 +13,7 @@
@foreach ($shelve['articles'] as $name => $article)
- + {{ $name }} {{ $name }} diff --git a/resources/views/Shop/Orders/order.blade.php b/resources/views/Shop/Orders/order.blade.php index 21aab310..18f099a8 100644 --- a/resources/views/Shop/Orders/order.blade.php +++ b/resources/views/Shop/Orders/order.blade.php @@ -11,11 +11,11 @@

- + @include('Shop.auth.partials.login') - + @include('Shop.auth.partials.register') @endif @@ -23,15 +23,15 @@ {{ Form::open(['route' => 'Shop.Orders.store', 'id' => 'order-form', 'autocomplete' => 'off']) }}
- + @include('Shop.Orders.partials.addresses') - + @include('Shop.Orders.partials.deliveries') - + @include('Shop.Orders.partials.payments')
@@ -40,7 +40,7 @@
- + @include('Shop.Baskets.partials.basketTotal')
diff --git a/resources/views/Shop/auth/partials/register.blade.php b/resources/views/Shop/auth/partials/register.blade.php index d0fb3628..e03213dd 100644 --- a/resources/views/Shop/auth/partials/register.blade.php +++ b/resources/views/Shop/auth/partials/register.blade.php @@ -1,5 +1,5 @@ {!! Form::open(['route' => 'Shop.register.post', 'method' => 'post', 'autocomplete'=> 'off']) !!} -
+
@@ -8,11 +8,13 @@
+ {{ Form::password('password', ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.password'), 'required']) }} {!! $errors->first('password','

:message

') !!}
+
{{ Form::password('password_confirmation', ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.password_confirm'), 'required']) }} {!! $errors->first('password_confirmation','

:message

') !!} @@ -22,8 +24,17 @@
- @include('components.form.checkbox', ['name' => 'use_for_delivery', 'value' => false]) - Utiliser une autre adresse pour la livraison + @include('components.form.checkboxes.icheck', [ + 'name' => 'use_for_delivery', + 'value' => false, + 'label' => 'Utiliser une autre adresse pour la livraison', + ]) +
+
+ +
+
+ @include('Shop.Customers.partials.address', ['label' => 'Adresse de livraison', 'prefix' => 'delivery_'])
@@ -40,3 +51,12 @@
{!! Form::close() !!} + + +@push('js') + +@endpush \ No newline at end of file diff --git a/resources/views/Shop/layout/layout.blade.php b/resources/views/Shop/layout/layout.blade.php index 859af558..3d29495c 100644 --- a/resources/views/Shop/layout/layout.blade.php +++ b/resources/views/Shop/layout/layout.blade.php @@ -23,7 +23,7 @@ -
+
@include("Shop.layout.partials.header")
diff --git a/resources/views/Shop/layout/partials/header-basket.blade.php b/resources/views/Shop/layout/partials/header-basket.blade.php index 646b2866..94964971 100644 --- a/resources/views/Shop/layout/partials/header-basket.blade.php +++ b/resources/views/Shop/layout/partials/header-basket.blade.php @@ -1,7 +1,7 @@
-