change registration or connection in order page, change filter on shelve page, add new api to get article_nature by product_type, css fixes

This commit is contained in:
Ludovic CANDELLIER
2023-02-10 23:11:48 +01:00
parent 405effe43e
commit cafd0a49e7
14 changed files with 74 additions and 24 deletions

View File

@@ -101,5 +101,4 @@ class ArticleController extends Controller
$data = Articles::toggleHomepage($request->input('id'), ($request->input('homepage') == 'true') ? 1 : 0);
return response()->json(['error' => 0]);
}
}

View File

@@ -41,4 +41,9 @@ class ArticleNatureController extends Controller
{
return ArticleNatures::destroy($id);
}
public static function getOptions($product_type)
{
return response()->json(['0' => ''] + ArticleNatures::getOptionsByProductType($product_type));
}
}

View File

@@ -9,8 +9,6 @@ use App\Repositories\Shop\Producers;
use App\Repositories\Shop\TagGroups;
use App\Datatables\Shop\MerchandisesDataTable;
use App\Models\Shop\Merchandise;
class MerchandiseController extends Controller
{
public function index(MerchandisesDataTable $dataTable)

View File

@@ -24,4 +24,19 @@ class ArticleNature extends Model
{
return $query->where($this->table . '.id', $id);
}
public function scopeByBotanic($query);
{
return $query->where($this->table . '.product_type', 1);
}
public function scopeByMerchandise($query);
{
return $query->where($this->table . '.product_type', 2);
}
public function scopeByProductType($query, $type)
{
return $query->where($this->table . '.product_type', $type);
}
}

View File

@@ -11,6 +11,21 @@ class ArticleNatures
return ArticleNature::get()->pluck('name', 'id')->toArray();
}
public static function getOptionsByMerchandise()
{
return self::getOptionsByProductType(2);
}
public static function getOptionsByBotanic()
{
return self::getOptionsByProductType(1);
}
public static function getOptionsByProductType($type)
{
return ArticleNature::byProductType($type)->get()->pluck('name', 'id')->toArray();
}
public static function getAll()
{
return ArticleNature::orderBy('name', 'asc')->get();

View File

@@ -108,16 +108,13 @@ a.nav-link {
background-color: #f3f8f1;
}
.green {
color: #517C39;
}
a.green {
.green, a.green {
color: #517C39 !important;
}
.green-dark, a.green-dark {
color: #335012;
text-decoration: none;
}
a.green-dark:hover {

View File

@@ -39,6 +39,7 @@
{{ Form::label('article_nature_id', __('shop.article_natures.name')) }}<br>
@include('components.form.select', [
'name' => 'article_nature_id',
'id_name' => 'article_nature_id',
'list' => $natures_options,
'value' => $article['article_nature_id'] ?? null,
'class' => 'select2',
@@ -155,12 +156,15 @@
switch (product_type) {
case 'App\\Models\\Botanic\\Specie':
var url = '{{ route('Admin.Botanic.Species.getSelect') }}';
var product_type = 1;
break;
case 'App\\Models\\Botanic\\Variety':
var url = '{{ route('Admin.Botanic.Varieties.getSelect') }}';
var product_type = 1;
break;
case 'App\\Models\\Shop\\Merchandise':
var url = '{{ route('Admin.Shop.Merchandises.getSelect') }}';
var product_type = 2;
break;
}
loadProducts(url);

View File

@@ -38,6 +38,13 @@
</x-card>
</div>
</div>
@else
<div class="row">
<div class="col-8">
<h1>Panier</h1>
Votre panier est vide
</div>
</div>
@endif
@endsection

View File

@@ -15,16 +15,14 @@
</div>
</div>
<div class="row">
<div class="col-12">
<div class="col-6">
@include('components.form.input', [
'name' => 'company',
'value' => $customer['company'] ?? '',
'label' => 'Société',
])
</div>
</div>
<div class="row">
<div class="col-12">
<div class="col-6">
@include('components.form.input', [
'name' => 'tva',
'value' => $customer['tva'] ?? '',

View File

@@ -4,7 +4,7 @@
@section('content')
<div class="row">
<div class="col-8">
<div class="@if ($basket['count']) col-8 @else col-12 @endif">
@if (!App\Repositories\Shop\Customers::isConnected())
<p>
<a href="#" id="customer" class="pr-5">Déja client ?</a>
@@ -39,11 +39,13 @@
{!! Form::close() !!}
</div>
<div class="col-4">
<x-card class='shadow'>
@include('Shop.Baskets.partials.basketTotal')
</x-card>
</div>
@if ($basket['count'])
<div class="col-4">
<x-card class='shadow'>
@include('Shop.Baskets.partials.basketTotal')
</x-card>
</div>
@endif
</div>
@endsection

View File

@@ -1,7 +1,11 @@
@if ($articles ?? false)
@foreach ($articles as $product_name => $article)
@include('Shop.Articles.partials.article_rows')
@endforeach
<div class="row">
<div class="col-12">
@foreach ($articles as $product_name => $article)
@include('Shop.Articles.partials.article_rows')
@endforeach
</div>
</div>
@endif
@push('js')

View File

@@ -42,7 +42,7 @@
<div class="row mbm">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 text-center">
<button type="submit" class="btn btn-primary">
<button type="submit" class="btn btn-green-dark">
{{ __('boilerplate::auth.register.register_button') }}
</button>
</div>

View File

@@ -25,7 +25,7 @@
</li>
@else
<li class="dropdown-item">
<a href="{{ route('Shop.login') }}" title="Identifiez-vous" rel="nofollow">
<a href="{{ route('Shop.Orders.order') }}" title="Identifiez-vous" rel="nofollow">
<span>Connexion</span>
</a>
</li>
@@ -34,5 +34,11 @@
<span>Creer votre compte</span>
</a>
</li>
<li class="dropdown-item">
<a href="https://www.jardinenvie.com/boutique/commander" title="Télécharger le catalogue" rel="nofollow">
<span>Télécharger le catalogue</span>
</a>
</li>
@endif
</ul>

View File

@@ -6,5 +6,5 @@ Route::prefix('ArticleNatures')->name('ArticleNatures.')->group(function () {
Route::delete('destroy/{id?}', 'ArticleNatureController@destroy')->name('destroy');
Route::post('store', 'ArticleNatureController@store')->name('store');
Route::get('edit/{id}', 'ArticleNatureController@edit')->name('edit');
Route::get('getOptions/{id}', 'ArticleNatureController@getOptions')->name('getOptions');
});