fixes, add weight
This commit is contained in:
@@ -22,18 +22,18 @@ class OffersDataTable extends DataTable
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public static function filterByArticleNature($model, $article_nature_id = false)
|
||||
public static function filterByArticleNature($model, $articleNatureId = false)
|
||||
{
|
||||
$article_nature_id = $article_nature_id ? $article_nature_id : self::isFilteredByField('article_nature_id');
|
||||
$articleNatureId = $articleNatureId ? $articleNatureId : self::isFilteredByField('article_nature_id');
|
||||
|
||||
return $article_nature_id ? $model->byArticleNature($article_nature_id) : $model;
|
||||
return $articleNatureId ? $model->byArticleNature($articleNatureId) : $model;
|
||||
}
|
||||
|
||||
public static function filterByPackage($model, $package_id = false)
|
||||
public static function filterByPackage($model, $packageId = false)
|
||||
{
|
||||
$package_id = $package_id ? $package_id : self::isFilteredByField('package_id');
|
||||
$packageId = $packageId ? $packageId : self::isFilteredByField('package_id');
|
||||
|
||||
return $package_id ? $model->byPackage($package_id) : $model;
|
||||
return $packageId ? $model->byPackage($packageId) : $model;
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
@@ -49,7 +49,7 @@ class OffersDataTable extends DataTable
|
||||
'on' => __('active'),
|
||||
'off' => __('inactive'),
|
||||
'meta' => 'data-id='.$offer->id,
|
||||
'size' => 'sm',
|
||||
'size' => 'xs',
|
||||
]);
|
||||
})
|
||||
->editColumn('stock_delayed', function (Offer $offer) {
|
||||
@@ -63,15 +63,16 @@ class OffersDataTable extends DataTable
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('status_id')->title('')->width(40),
|
||||
Column::make('article.article_nature.name')->title('Nature')->defaultContent(''),
|
||||
Column::make('thumb')->title('')->width(40)->searchable(false)->order(false),
|
||||
Column::make('status_id')->title('')->width(40)->searchable(false),
|
||||
Column::make('article.article_nature.name')->title('Nature')->defaultContent('')->searchable(false),
|
||||
Column::make('thumb')->title('')->width(30)->searchable(false)->addClass('text-center'),
|
||||
Column::make('article.name')->title('Article')->defaultContent(''),
|
||||
Column::make('variation.name')->title('Déclinaison')->defaultContent(''),
|
||||
Column::make('tariff.name')->title('Tarif')->defaultContent(''),
|
||||
Column::make('stock_current')->title('Appro im')->searchable(false),
|
||||
Column::make('stock_delayed')->title('Appro délai')->searchable(false),
|
||||
Column::make('stock_ondemand')->title('Dmde')->searchable(false),
|
||||
Column::make('variation.name')->title('Déclinaison')->defaultContent('')->searchable(false),
|
||||
Column::make('weight')->title('Poids')->searchable(false)->addClass('text-right'),
|
||||
Column::make('tariff.name')->title('Tarif')->defaultContent('')->searchable(false),
|
||||
Column::make('stock_current')->title('Appro im')->searchable(false)->addClass('text-right'),
|
||||
Column::make('stock_delayed')->title('Appro délai')->searchable(false)->addClass('text-right'),
|
||||
Column::make('stock_ondemand')->title('Dmde')->searchable(false)->addClass('text-right'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -3,18 +3,19 @@
|
||||
namespace App\Http\Controllers\Shop\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Shop\RegisterCustomer;
|
||||
use App\Repositories\Shop\CustomerAddresses;
|
||||
use App\Repositories\Shop\Customers;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Foundation\Auth\EmailVerificationRequest;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Sebastienheyd\Boilerplate\Rules\Password;
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
use RegistersUsers;
|
||||
// use RegistersUsers;
|
||||
|
||||
protected $redirectTo;
|
||||
|
||||
@@ -28,21 +29,31 @@ class RegisterController extends Controller
|
||||
return route(config('boilerplate.app.redirectTo', 'boilerplate.dashboard'));
|
||||
}
|
||||
|
||||
protected function validator(array $data)
|
||||
{
|
||||
return Validator::make($data, [
|
||||
'last_name' => 'required|max:255',
|
||||
'first_name' => 'required|max:255',
|
||||
'email' => 'required|email|max:255|unique:shop_customers,email,NULL,id,deleted_at,NULL',
|
||||
'password' => ['required', 'confirmed', new Password()],
|
||||
]);
|
||||
}
|
||||
|
||||
public function showRegistrationForm()
|
||||
{
|
||||
return view('Shop.auth.register');
|
||||
}
|
||||
|
||||
public function register(Request $request)
|
||||
{
|
||||
dump('ici');
|
||||
exit;
|
||||
// event(new Registered($user = $this->create($request->all())));
|
||||
$user = $this->create($request->all());
|
||||
dump($user);
|
||||
exit;
|
||||
|
||||
$this->guard()->login($user);
|
||||
|
||||
if ($response = $this->registered($request, $user)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
return $request->wantsJson()
|
||||
? new JsonResponse([], 201)
|
||||
: redirect($this->redirectPath());
|
||||
}
|
||||
|
||||
protected function create(array $data)
|
||||
{
|
||||
$user = Customers::create($data);
|
||||
|
||||
24
app/Http/Requests/Shop/RegisterCustomer.php
Normal file
24
app/Http/Requests/Shop/RegisterCustomer.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Shop;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Sebastienheyd\Boilerplate\Rules\Password;
|
||||
|
||||
class RegisterCustomer extends FormRequest
|
||||
{
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'last_name' => 'required|max:255',
|
||||
'first_name' => 'required|max:255',
|
||||
'email' => 'required|email|max:255|unique:shop_customers,email,NULL,id,deleted_at,NULL',
|
||||
'password' => ['required', 'confirmed', new Password()],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -159,16 +159,17 @@ return [
|
||||
'confirmdelete' => 'Confirmez-vous la suppression de l\'offre ?',
|
||||
],
|
||||
'packages' => [
|
||||
'title' => 'Packages',
|
||||
'description' => 'Gérer les packages',
|
||||
'add' => 'Ajouter un package',
|
||||
'edit' => 'Editer un package',
|
||||
'del' => 'Effacer un package',
|
||||
'list' => 'Liste des packages',
|
||||
'successadd' => 'Le package été correctement ajouté',
|
||||
'successmod' => 'Le package a été correctement modifié',
|
||||
'successdel' => 'Le package a été correctement effacé',
|
||||
'confirmdelete' => 'Confirmez-vous la suppression du package ?',
|
||||
'title' => 'Déclinaisons',
|
||||
'name' => 'Déclinaison',
|
||||
'description' => 'Gérer les déclinaisons',
|
||||
'add' => 'Ajouter une déclinaison',
|
||||
'edit' => 'Editer une déclinaison',
|
||||
'del' => 'Effacer une déclinaison',
|
||||
'list' => 'Liste des déclinaisons',
|
||||
'successadd' => 'La déclinaison été correctement ajoutée',
|
||||
'successmod' => 'La déclinaison a été correctement modifiée',
|
||||
'successdel' => 'La déclinaison a été correctement effacée',
|
||||
'confirmdelete' => 'Confirmez-vous la suppression de la déclinaison ?',
|
||||
],
|
||||
'prices' => [
|
||||
'title' => 'Prix',
|
||||
|
||||
@@ -1,56 +1,97 @@
|
||||
<div class="row mb-3">
|
||||
<div class="col-6">
|
||||
<div class="col-8">
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
{{ Form::label('article_id', 'Article') }}
|
||||
@include('components.form.select', ['name' => 'article_id', 'id_name' => 'article_id', 'list' => $articles ?? null, 'value' => $offer['article_id'] ?? null, 'with_empty' => '', 'class' => 'select2 select_article'])
|
||||
@include('components.form.select', [
|
||||
'name' => 'article_id',
|
||||
'id_name' => 'article_id',
|
||||
'list' => $articles ?? null,
|
||||
'value' => $offer['article_id'] ?? null,
|
||||
'with_empty' => '',
|
||||
'class' => 'select2 select_article',
|
||||
'label' => 'Article',
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
{{ Form::label('variation_id', 'Déclinaison') }}
|
||||
@include('components.form.select', ['name' => 'variation_id', 'id_name' => 'variation_id', 'list' => $variations ?? null, 'value' => $offer['variation_id'] ?? null, 'with_empty' => '', 'class' => 'select2 select_variation'])
|
||||
<div class="col-4">
|
||||
@include('components.form.select', [
|
||||
'name' => 'variation_id',
|
||||
'id_name' => 'variation_id',
|
||||
'list' => $variations ?? null,
|
||||
'value' => $offer['variation_id'] ?? null,
|
||||
'with_empty' => '',
|
||||
'class' => 'select2 select_variation',
|
||||
'label' => __('shop.packages.name'),
|
||||
'required' => true,
|
||||
])
|
||||
</div>
|
||||
<div class="col-4">
|
||||
@include('components.form.select', [
|
||||
'name' => 'tariff_id',
|
||||
'id_name' => 'tariff_id',
|
||||
'list' => $tariffs ?? null,
|
||||
'value' => $offer['tariff_id'] ?? null,
|
||||
'with_empty' => '',
|
||||
'class' => 'select2 select_tariffs',
|
||||
'label' => 'Tarif',
|
||||
'required' => true,
|
||||
])
|
||||
</div>
|
||||
<div class="col-4">
|
||||
@include('components.form.input', [
|
||||
'name' => 'weight',
|
||||
'value' => $offer['weight'] ?? null,
|
||||
'label' => 'Poids en g',
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
{{ Form::label('tariff_id', 'Tarif') }}
|
||||
@include('components.form.select', ['name' => 'tariff_id', 'id_name' => 'tariff_id', 'list' => $tariffs ?? null, 'value' => $offer['tariff_id'] ?? null, 'with_empty' => '', 'class' => 'select2 select_tariffs'])
|
||||
@component('components.card', ['title' => 'Disponibilité', 'class' => 'mt-5'])
|
||||
<div class="row mb-3 mt-3">
|
||||
<div class="col-4">
|
||||
@include('components.form.inputs.money', [
|
||||
'name' => 'stock_current',
|
||||
'value' => $offer['stock_current'] ?? 0,
|
||||
'label' => 'Appro immédiate',
|
||||
])
|
||||
</div>
|
||||
<div class="col-4">
|
||||
@include('components.form.inputs.money', [
|
||||
'name' => 'stock_delayed',
|
||||
'value' => $offer['stock_delayed'] ?? 0,
|
||||
'label' => 'Appro sur delai',
|
||||
])
|
||||
</div>
|
||||
|
||||
@component('components.card', ['title' => 'Disponibilité'])
|
||||
<div class="row mb-3">
|
||||
<div class="col-12 col-xl-6">
|
||||
{{ Form::label('stock_current', 'Appro immédiate') }}
|
||||
@include('components.form.inputs.money', ['name' => 'stock_current', 'value' => $offer['stock_current'] ?? 0])
|
||||
<div class="col-4">
|
||||
@include('components.form.input', [
|
||||
'name' => 'delay_type',
|
||||
'value' => $offer['delay_type'] ?? null,
|
||||
'label' => 'Délai type',
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-6">
|
||||
{{ Form::label('stock_delayed', 'Appro sur delai') }}
|
||||
@include('components.form.inputs.money', ['name' => 'stock_delayed', 'value' => $offer['stock_delayed'] ?? 0])
|
||||
@include('components.form.toggle', [
|
||||
'name' => 'stock_ondemand',
|
||||
'value' => $offer['stock_ondemand'] ?? 0,
|
||||
'label' => 'Appro sur demande',
|
||||
'size' => 'md',
|
||||
])
|
||||
</div>
|
||||
<div class="col-6">
|
||||
{{ Form::label('delay_type', 'Délai type') }}
|
||||
@include('components.form.input', ['name' => 'delay_type', 'value' => $offer['delay_type'] ?? null])
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-6">
|
||||
{{ Form::label('stock_ondemand', 'Appro sur demande') }}
|
||||
@include('components.form.toggle', ['name' => 'stock_ondemand', 'value' => $offer['stock_ondemand'] ?? 0])
|
||||
</div>
|
||||
<div class="col-6">
|
||||
{{ Form::label('minimum_ondemand', 'Minimum de quantité') }}
|
||||
@include('components.form.inputs.money', ['name' => 'minimum_ondemand', 'value' => $offer['minimum_ondemand'] ?? 0])
|
||||
@include('components.form.inputs.money', [
|
||||
'name' => 'minimum_ondemand',
|
||||
'value' => $offer['minimum_ondemand'] ?? 0,
|
||||
'label' => 'Minimum de quantité',
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
@endcomponent
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="col-4">
|
||||
@component('components.card', ['title' => 'Previsualisation'])
|
||||
<div id="preview-article"></div>
|
||||
<div id="preview-variation"></div>
|
||||
|
||||
@@ -6,7 +6,12 @@
|
||||
|
||||
@section('content')
|
||||
@component('components.card')
|
||||
@include('components.datatable', ['route' => route('Admin.Shop.Offers.index'), 'model' => 'offers', 'with_filters' => true, 'callback' => 'handleOffer();'])
|
||||
@include('components.datatable', [
|
||||
'route' => route('Admin.Shop.Offers.index'),
|
||||
'model' => 'offers',
|
||||
'with_filters' => true,
|
||||
'callback' => 'handleOffer();',
|
||||
])
|
||||
@component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-offers-filters'])
|
||||
@include('Admin.Shop.Offers.partials.filters', ['model' => 'offers'])
|
||||
@endcomponent
|
||||
|
||||
@@ -2,13 +2,37 @@
|
||||
<div class="row mb-3">
|
||||
<label class="col-4">{{ __('shop.article_natures.title') }}</label>
|
||||
<div class="col-8">
|
||||
@include('components.form.select', ['name' => 'article_nature_id', 'list' => $article_natures ?? [], 'value' => $filters['article_nature_id'] ?? null, 'class' => 'form-control-sm select2', 'with_empty' => ''])
|
||||
@include('components.form.select', [
|
||||
'name' => 'article_nature_id',
|
||||
'list' => $article_natures ?? [],
|
||||
'value' => $filters['article_nature_id'] ?? null,
|
||||
'class' => 'form-control-sm select2',
|
||||
'with_empty' => '',
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label class="col-4">{{ __('shop.packages.title') }}</label>
|
||||
<div class="col-8">
|
||||
@include('components.form.select', ['name' => 'package_id', 'list' => $packages ?? [], 'value' => $filters['package_id'] ?? null, 'class' => 'form-control-sm select2', 'with_empty' => ''])
|
||||
@include('components.form.select', [
|
||||
'name' => 'package_id',
|
||||
'list' => $packages ?? [],
|
||||
'value' => $filters['package_id'] ?? null,
|
||||
'class' => 'form-control-sm select2',
|
||||
'with_empty' => '',
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<label class="col-4">{{ __('shop.prices.title') }}</label>
|
||||
<div class="col-8">
|
||||
@include('components.form.select', [
|
||||
'name' => 'tariff_id',
|
||||
'list' => $prices ?? [],
|
||||
'value' => $filters['tariff_id'] ?? null,
|
||||
'class' => 'form-control-sm select2',
|
||||
'with_empty' => '',
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
<a href="{{ route('Shop.Articles.show', ['id' => $article['id'] ?? false ]) }}" class="green-dark">
|
||||
<div class="content">
|
||||
<div class="content-overlay"></div>
|
||||
<img class="content-image card-img-top" src="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" alt="{{ $product_name }}">
|
||||
<img class="content-image card-img-top"
|
||||
src="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" alt="{{ $product_name }}">
|
||||
<div class="content-details fadeIn-bottom">
|
||||
<h3 class="content-title d-none"></h3>
|
||||
<p class="content-text">{!! $article['description'] !!}</p>
|
||||
@@ -19,14 +20,16 @@
|
||||
</div>
|
||||
@include('Shop.Articles.partials.article_' . $product_type)
|
||||
</a>
|
||||
@switch ($article_nature)
|
||||
@switch ($article_nature ?? 0)
|
||||
@case(1)
|
||||
<button type="button" class="btn btn-link bg-green text-white w-100 basket" data-id="{{ $article['semences']['id'] ?? false }}">
|
||||
<button type="button" class="btn btn-link bg-green text-white w-100 basket"
|
||||
data-id="{{ $article['semences']['id'] ?? false }}">
|
||||
Ajout rapide
|
||||
</button>
|
||||
@break
|
||||
@case(2)
|
||||
<button type="button" class="btn btn-link bg-green text-white w-100 basket" data-id="{{ $article['plants']['id'] ?? false }}">
|
||||
<button type="button" class="btn btn-link bg-green text-white w-100 basket"
|
||||
data-id="{{ $article['plants']['id'] ?? false }}">
|
||||
Ajout rapide
|
||||
</button>
|
||||
@break
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
'name' => 'email',
|
||||
'value' => $customer['email'] ?? '',
|
||||
'label' => 'Email',
|
||||
'required' => true,
|
||||
])
|
||||
</div>
|
||||
<div class="col-6">
|
||||
|
||||
@@ -34,7 +34,10 @@
|
||||
|
||||
<div class="row d-none" id="address_delivery">
|
||||
<div class="col-12">
|
||||
@include('Shop.Customers.partials.address', ['label' => 'Adresse de livraison', 'prefix' => 'delivery_'])
|
||||
@include('Shop.Customers.partials.address', [
|
||||
'label' => 'Adresse de livraison',
|
||||
'prefix' => 'delivery_'
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -50,8 +53,7 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{!! Form::close() !!}
|
||||
|
||||
</form>
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@include('components.form.label')
|
||||
|
||||
<input type="checkbox" name="{{ $name ?? ''}}" id="{{ $id_name ?? $name ?? '' }}"
|
||||
class="{{ $class ?? 'toggle'}}"
|
||||
value="{{ $val ?? 1}}"
|
||||
|
||||
Reference in New Issue
Block a user