fixes
This commit is contained in:
@@ -17,9 +17,19 @@ class CustomerAddressesDataTable extends DataTable
|
|||||||
|
|
||||||
public function query(CustomerAddress $model)
|
public function query(CustomerAddress $model)
|
||||||
{
|
{
|
||||||
|
$model = self::filterByCustomer($model);
|
||||||
|
|
||||||
return $this->buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function filterByCustomer($model, $customerId = false)
|
||||||
|
{
|
||||||
|
$customerId = $customerId ? $customerId : self::isFilteredByField('customer_id');
|
||||||
|
|
||||||
|
return $customerId ? $model->byCustomer($customerId) : $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|||||||
26
app/Http/Controllers/Admin/Core/Mail/MailLogController.php
Normal file
26
app/Http/Controllers/Admin/Core/Mail/MailLogController.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin\Core\Mail;
|
||||||
|
|
||||||
|
use App\Datatables\Admin\Core\Mail\MailLogsDataTable;
|
||||||
|
use App\Repositories\Core\Mail\MailLogs;
|
||||||
|
|
||||||
|
class MailLogController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
// $this->middleware('ability:admin');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(MailLogsDataTable $dataTable)
|
||||||
|
{
|
||||||
|
return $dataTable->render('admin.Core.Mail.MailLog.index', $data ?? []);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$data['message'] = MailLogs::getParsed($id);
|
||||||
|
|
||||||
|
return view('admin.Core.Mail.MailLog.modal', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@ class CustomerAddressController extends Controller
|
|||||||
{
|
{
|
||||||
public function index(CustomerAddressesDataTable $dataTable)
|
public function index(CustomerAddressesDataTable $dataTable)
|
||||||
{
|
{
|
||||||
return $dataTable->render('Admin.Shop.Customers.list');
|
return $dataTable->render('Admin.Shop.CustomerAddresses.list');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
|
|||||||
24
app/Http/Controllers/Admin/Shop/DashboardController.php
Normal file
24
app/Http/Controllers/Admin/Shop/DashboardController.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin\Shop;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Repositories\Shop\Dashboards;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class DashboardController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('auth');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$data = $request->all();
|
||||||
|
$data = Dashboards::getStats($data);
|
||||||
|
dump($data);
|
||||||
|
|
||||||
|
return view('Admin.Shop.Dashboard.index', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
75
app/Http/Controllers/Admin/Shop/PriceListValueController.php
Normal file
75
app/Http/Controllers/Admin/Shop/PriceListValueController.php
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin\Shop;
|
||||||
|
|
||||||
|
use App\Datatables\Shop\PriceListValuesDataTable;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Repositories\Shop\Packages;
|
||||||
|
use App\Repositories\Shop\PriceListValueCategories;
|
||||||
|
use App\Repositories\Shop\PriceListValues;
|
||||||
|
use App\Repositories\Shop\Taxes;
|
||||||
|
use App\Repositories\Shop\Unities;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class PriceListValueController extends Controller
|
||||||
|
{
|
||||||
|
public function index(PriceListValuesDataTable $dataTable)
|
||||||
|
{
|
||||||
|
$data['categories'] = PriceListValueCategories::getOptions();
|
||||||
|
|
||||||
|
return $dataTable->render('Admin.Shop.PriceListValues.list', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$data['unities'] = Unities::getOptions();
|
||||||
|
$data['taxes_options'] = Taxes::getOptions();
|
||||||
|
$data['categories'] = PriceListValueCategories::getOptions();
|
||||||
|
|
||||||
|
return view('Admin.Shop.PriceListValues.create', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$data['generic'] = PriceListValues::getFull($id)->toArray();
|
||||||
|
$data['packages'] = Packages::getSelectByFamily($data['generic']['category']['article_family_id']);
|
||||||
|
$data['unities'] = ($data['packages']['id'] ?? false) ? Unities::getSelectByPackage($data['packages']['id']) : [];
|
||||||
|
$data['taxes_options'] = Taxes::getOptions();
|
||||||
|
$data['categories'] = PriceListValueCategories::getOptions();
|
||||||
|
|
||||||
|
return view('Admin.Shop.PriceListValues.edit', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$ret = PriceListValues::store($request->all());
|
||||||
|
|
||||||
|
return redirect()->route('Admin.Shop.PriceListValues.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$data = PriceListValues::get($id);
|
||||||
|
|
||||||
|
return view('Admin.Shop.PriceListValues.view', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
return PriceListValues::destroy($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPrice($id)
|
||||||
|
{
|
||||||
|
$data['generic'] = PriceListValues::getFull($id);
|
||||||
|
|
||||||
|
return view('Admin.Shop.PriceListValues.partials.table-prices', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addPrice($index)
|
||||||
|
{
|
||||||
|
$data['index'] = $index;
|
||||||
|
|
||||||
|
return view('Admin.Shop.PriceListValues.partials.row_price', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,24 +3,35 @@
|
|||||||
namespace App\Http\Controllers\Shop\Auth;
|
namespace App\Http\Controllers\Shop\Auth;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Requests\Shop\RegisterCustomer;
|
||||||
use App\Repositories\Shop\CustomerAddresses;
|
use App\Repositories\Shop\CustomerAddresses;
|
||||||
use App\Repositories\Shop\Customers;
|
use App\Repositories\Shop\Customers;
|
||||||
use Illuminate\Foundation\Auth\EmailVerificationRequest;
|
use Illuminate\Foundation\Auth\EmailVerificationRequest;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Sebastienheyd\Boilerplate\Rules\Password;
|
||||||
|
|
||||||
|
|
||||||
class RegisterController extends Controller
|
class RegisterController extends Controller
|
||||||
{
|
{
|
||||||
protected $redirectTo;
|
protected $redirectTo;
|
||||||
|
|
||||||
public function showRegistrationForm()
|
public function showRegistrationForm(Request $request)
|
||||||
{
|
{
|
||||||
return view('Shop.auth.register');
|
return view('Shop.auth.register', ['customer' => $request->old()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function register(Request $request)
|
public function register(RegisterCustomer $request)
|
||||||
{
|
{
|
||||||
|
$validatedData = $request->validateWithBag('Errors', [
|
||||||
|
'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()],
|
||||||
|
|
||||||
|
]);
|
||||||
|
|
||||||
$user = $this->create($request->all());
|
$user = $this->create($request->all());
|
||||||
|
|
||||||
$this->guard()->login($user);
|
$this->guard()->login($user);
|
||||||
@@ -34,7 +45,7 @@ class RegisterController extends Controller
|
|||||||
|
|
||||||
return $request->wantsJson()
|
return $request->wantsJson()
|
||||||
? new JsonResponse([], 201)
|
? new JsonResponse([], 201)
|
||||||
: redirect($this->redirectPath());
|
: redirect('home');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function emailVerify()
|
public function emailVerify()
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ use Illuminate\Support\Facades\Auth;
|
|||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use LangleyFoxall\LaravelNISTPasswordRules\PasswordRules;
|
|
||||||
use Laratrust\Traits\LaratrustUserTrait;
|
use Laratrust\Traits\LaratrustUserTrait;
|
||||||
|
|
||||||
class Users
|
class Users
|
||||||
@@ -113,32 +112,6 @@ class Users
|
|||||||
return $user ? $user->hasRole($role) : false;
|
return $user ? $user->hasRole($role) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function hasPermission($permission, $user = false)
|
|
||||||
{
|
|
||||||
if (self::isAdmin()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
$user = $user ? $user : self::getUser();
|
|
||||||
$permissions = self::getPermissions($user);
|
|
||||||
|
|
||||||
return $user ? self::checkPermission($permissions, $permission) : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function checkPermission($permissions, $permission)
|
|
||||||
{
|
|
||||||
if (! strpos($permission, '*')) {
|
|
||||||
return in_array($permission, $permissions);
|
|
||||||
}
|
|
||||||
$permission = str_replace('*', '', $permission);
|
|
||||||
foreach ($permissions as $item) {
|
|
||||||
if (stripos($item, $permission) !== false) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getRoles($user = false)
|
public static function getRoles($user = false)
|
||||||
{
|
{
|
||||||
$user = $user ? $user : self::getUser();
|
$user = $user ? $user : self::getUser();
|
||||||
@@ -146,33 +119,6 @@ class Users
|
|||||||
return $user ? $user->roles->pluck('name')->toArray() : false;
|
return $user ? $user->roles->pluck('name')->toArray() : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getRolesToEdit()
|
|
||||||
{
|
|
||||||
return Roles::getListByRights();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getPermissions($user = false)
|
|
||||||
{
|
|
||||||
$user = $user ? $user : self::getUser();
|
|
||||||
|
|
||||||
return $user ? $user->allPermissions()->pluck('name')->toArray() : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getByTeam($id)
|
|
||||||
{
|
|
||||||
return User::byTeam($id)->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getByUniqueTeam($id)
|
|
||||||
{
|
|
||||||
return User::byTeam($id)->byUniqueTeam()->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function destroyByUniqueTeam($id)
|
|
||||||
{
|
|
||||||
return User::byTeam($id)->byUniqueTeam()->delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getAvatar($user_id)
|
public static function getAvatar($user_id)
|
||||||
{
|
{
|
||||||
$avatar = self::get($user_id)->avatar;
|
$avatar = self::get($user_id)->avatar;
|
||||||
@@ -224,11 +170,6 @@ class Users
|
|||||||
return User::find($id)->update(['password' => $password]);
|
return User::find($id)->update(['password' => $password]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function validate($username, $field = 'current_password')
|
|
||||||
{
|
|
||||||
return PasswordRules::changePassword($username, $field);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getModel()
|
public static function getModel()
|
||||||
{
|
{
|
||||||
return User::query();
|
return User::query();
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
@component('components.card')
|
<x-card>
|
||||||
@include('components.datatable', [
|
@include('components.datatable', [
|
||||||
'route' => route('Admin.Shop.CustomerAddresses.index'),
|
'route' => route('Admin.Shop.CustomerAddresses.index'),
|
||||||
'model' => 'customer_addresses',
|
'model' => 'customer_addresses',
|
||||||
|
'with_print' => false,
|
||||||
|
'with_filters' => false,
|
||||||
])
|
])
|
||||||
@endcomponent
|
<x-layout.modal title="Filtres" id="modal-customer_addresses-filters">
|
||||||
|
@include('Admin.Shop.CustomerAddresses.partials.filters', ['model' => 'customer_addresses'])
|
||||||
|
</x-layout.modal>
|
||||||
|
</x-card>
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<form id="{{ $model }}-filters">
|
||||||
|
<input type="text" name="customer_id" value="{{ $customer['id'] ?? false }}">
|
||||||
|
</form>
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
f{{ Form::open(['route' => 'Admin.Shop.Customers.store', 'id' => 'customer-form', 'autocomplete' => 'off']) }}
|
|
||||||
<input type="hidden" name="id" value="{{ $customer['id'] ?? false }}">
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
|
{{ Form::open(['route' => 'Admin.Shop.Customers.store', 'id' => 'customer-form', 'autocomplete' => 'off']) }}
|
||||||
|
<input type="hidden" name="id" value="{{ $customer['id'] ?? false }}">
|
||||||
<x-card>
|
<x-card>
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
@@ -113,13 +112,13 @@ f{{ Form::open(['route' => 'Admin.Shop.Customers.store', 'id' => 'customer-form'
|
|||||||
</div>
|
</div>
|
||||||
</x-card>
|
</x-card>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<x-layout.box-collapse title='Adresses' id='form-customer-address'>
|
<x-layout.box-collapse title='Adresses' id='form-customer-address'>
|
||||||
@include('Admin.Shop.CustomerAddresses.list', ['dataTable' => $customer_addresses])
|
@include('Admin.Shop.CustomerAddresses.list', ['dataTable' => $customer_addresses])
|
||||||
</x-layout.box-collapse>
|
</x-layout.box-collapse>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
|
||||||
|
|
||||||
<x-save />
|
<x-save />
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
'route' => route('Admin.Shop.Customers.index'),
|
'route' => route('Admin.Shop.Customers.index'),
|
||||||
'model' => 'customers',
|
'model' => 'customers',
|
||||||
'with_filters' => true,
|
'with_filters' => true,
|
||||||
|
'with_print' => false,
|
||||||
])
|
])
|
||||||
<x-layout.modal title="Filtres" id="modal-customers-filters">
|
<x-layout.modal title="Filtres" id="modal-customers-filters">
|
||||||
@include('Admin.Shop.Customers.partials.filters', ['model' => 'customers'])
|
@include('Admin.Shop.Customers.partials.filters', ['model' => 'customers'])
|
||||||
|
|||||||
@@ -1,9 +1,20 @@
|
|||||||
|
@if ($errors->any())
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<ul>
|
||||||
|
@foreach ($errors->all() as $error)
|
||||||
|
<li>{{ $error }}</li>
|
||||||
|
@endforeach
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
@include('components.form.input', [
|
@include('components.form.input', [
|
||||||
'name' => 'first_name',
|
'name' => 'first_name',
|
||||||
'value' => $customer['first_name'] ?? '',
|
'value' => $customer['first_name'] ?? '',
|
||||||
'label' => 'Prénom',
|
'label' => 'Prénom',
|
||||||
|
'required' => true,
|
||||||
])
|
])
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
@@ -11,6 +22,7 @@
|
|||||||
'name' => 'last_name',
|
'name' => 'last_name',
|
||||||
'value' => $customer['last_name'] ?? '',
|
'value' => $customer['last_name'] ?? '',
|
||||||
'label' => 'Nom',
|
'label' => 'Nom',
|
||||||
|
'required' => true,
|
||||||
])
|
])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,58 +1,66 @@
|
|||||||
{!! Form::open(['route' => 'Shop.register.post', 'method' => 'post', 'autocomplete'=> 'off']) !!}
|
{!! Form::open(['route' => 'Shop.register.post', 'method' => 'post', 'autocomplete' => 'off']) !!}
|
||||||
<div class="row green">
|
<div class="row green">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<x-card title='Créez votre compte' class='mt-3 mb-3'>
|
<x-card title='Créez votre compte' class='mt-3 mb-3'>
|
||||||
|
|
||||||
@include('Shop.Customers.partials.registration')
|
@include('Shop.Customers.partials.registration')
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<div class="form-group {{ $errors->has('password') ? 'has-error' : '' }}">
|
<div class="form-group {{ $errors->has('password') ? 'has-error' : '' }}">
|
||||||
<label>Mot de passe</label>
|
<label>Mot de passe *</label>
|
||||||
{{ Form::password('password', ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.password'), 'required']) }}
|
{{ Form::password('password', [
|
||||||
{!! $errors->first('password','<p class="text-danger"><strong>:message</strong></p>') !!}
|
'class' => 'form-control',
|
||||||
</div>
|
'placeholder' => __('boilerplate::auth.fields.password'),
|
||||||
</div>
|
'required',
|
||||||
<div class="col-6">
|
]) }}
|
||||||
<label>Confirmation du mot de passe</label>
|
{!! $errors->first('password', '<p class="text-danger"><strong>:message</strong></p>') !!}
|
||||||
<div class="form-group {{ $errors->has('password_confirmation') ? 'has-error' : '' }}">
|
|
||||||
{{ Form::password('password_confirmation', ['class' => 'form-control', 'placeholder' => __('boilerplate::auth.fields.password_confirm'), 'required']) }}
|
|
||||||
{!! $errors->first('password_confirmation','<p class="text-danger"><strong>:message</strong></p>') !!}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
<div class="row">
|
<label>Confirmation du mot de passe *</label>
|
||||||
<div class="col-12">
|
<div class="form-group {{ $errors->has('password_confirmation') ? 'has-error' : '' }}">
|
||||||
@include('components.form.checkboxes.icheck', [
|
{{ Form::password('password_confirmation', [
|
||||||
'name' => 'use_for_delivery',
|
'class' => 'form-control',
|
||||||
'value' => false,
|
'placeholder' => __('boilerplate::auth.fields.password_confirm'),
|
||||||
'label' => 'Utiliser une autre adresse pour la livraison',
|
'required',
|
||||||
])
|
]) }}
|
||||||
|
{!! $errors->first('password_confirmation', '<p class="text-danger"><strong>:message</strong></p>') !!}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row d-none" id="address_delivery">
|
|
||||||
<div class="col-12">
|
|
||||||
@include('Shop.Customers.partials.address', [
|
|
||||||
'label' => 'Adresse de livraison',
|
|
||||||
'prefix' => 'delivery_'
|
|
||||||
])
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</x-card>
|
|
||||||
|
|
||||||
<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-green-dark">
|
|
||||||
{{ __('boilerplate::auth.register.register_button') }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
@include('components.form.checkboxes.icheck', [
|
||||||
|
'name' => 'use_for_delivery',
|
||||||
|
'value' => false,
|
||||||
|
'label' => 'Utiliser une autre adresse pour la livraison',
|
||||||
|
])
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row d-none" id="address_delivery">
|
||||||
|
<div class="col-12">
|
||||||
|
@include('Shop.Customers.partials.address', [
|
||||||
|
'label' => 'Adresse de livraison',
|
||||||
|
'prefix' => 'delivery_',
|
||||||
|
])
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</x-card>
|
||||||
|
|
||||||
|
<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-green-dark">
|
||||||
|
{{ __('boilerplate::auth.register.register_button') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@push('js')
|
@push('js')
|
||||||
@@ -61,4 +69,4 @@
|
|||||||
$('#address_delivery').toggleClass('d-none');
|
$('#address_delivery').toggleClass('d-none');
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
|||||||
@@ -1,27 +1,32 @@
|
|||||||
<div class="datatable-export-buttons float-left mr-3">
|
<div class="datatable-export-buttons float-left mr-3">
|
||||||
|
|
||||||
@if (!isset($with_print) || $with_print)
|
@if (!isset($with_print) || $with_print)
|
||||||
@include('components.datatables.buttons.print')
|
@include('components.datatables.buttons.print')
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if (isset($with_exports) && $with_exports)
|
@if (isset($with_exports) && $with_exports)
|
||||||
@include('components.datatables.buttons.excel')
|
@include('components.datatables.buttons.excel')
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if (isset($with_mailing) && $with_mailing)
|
@if (isset($with_mailing) && $with_mailing)
|
||||||
@include('components.datatables.buttons.mail')
|
@include('components.datatables.buttons.mail')
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if (isset($with_buttons))
|
@if (isset($with_buttons))
|
||||||
@foreach ($with_buttons as $button)
|
@foreach ($with_buttons as $button)
|
||||||
@include($button)
|
@include($button)
|
||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@if (isset($left_buttons))
|
||||||
|
@foreach ($left_buttons as $button)
|
||||||
|
@include('components.form.button', [
|
||||||
|
'class' => $button['class'] ?? null,
|
||||||
|
'icon' => $button['icon'] ?? null,
|
||||||
|
'txt' => $button['txt'] ?? null,
|
||||||
|
'id' => $button['id'] ?? null,
|
||||||
|
])
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
|
||||||
@if (isset($left_buttons))
|
|
||||||
@foreach ($left_buttons as $button)
|
|
||||||
@include('components.form.button', ['class' => $button['class'] ?? null, 'icon' => $button['icon'] ?? null, 'txt' => $button['txt'] ?? null, 'id' => $button['id'] ?? null ])
|
|
||||||
@endforeach
|
|
||||||
@endif
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,26 +1,31 @@
|
|||||||
<div class="row table-header" id="{{ $model }}-table-header">
|
<div class="row table-header" id="{{ $model }}-table-header">
|
||||||
<div class="col-lg-6 col-md-8 col-12 mb-2">
|
<div class="col-lg-6 col-md-8 col-12 mb-2">
|
||||||
@include('components.datatables.search')
|
@include('components.datatables.search')
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-4 col-md-3 col-6">
|
<div class="col-lg-4 col-md-3 col-6">
|
||||||
@include('components.datatables.buttons')
|
@include('components.datatables.buttons')
|
||||||
@if (isset($add_buttons))
|
@if (isset($add_buttons))
|
||||||
@include($add_buttons)
|
@include($add_buttons)
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-2 col-md-1 col-6 text-right">
|
<div class="col-lg-2 col-md-1 col-6 text-right">
|
||||||
@if (isset($right_buttons))
|
@if (isset($right_buttons))
|
||||||
@foreach ($right_buttons as $button)
|
@foreach ($right_buttons as $button)
|
||||||
@include('components.form.button', ['class' => $button['class'] ?? null, 'icon' => $button['icon'] ?? null, 'txt' => $button['txt'] ?? null, 'id' => $button['id'] ?? null ])
|
@include('components.form.button', [
|
||||||
@endforeach
|
'class' => $button['class'] ?? null,
|
||||||
@endif
|
'icon' => $button['icon'] ?? null,
|
||||||
|
'txt' => $button['txt'] ?? null,
|
||||||
@if (isset($right_content))
|
'id' => $button['id'] ?? null,
|
||||||
{!! $right_content !!}
|
])
|
||||||
@endif
|
@endforeach
|
||||||
|
@endif
|
||||||
|
|
||||||
@if (!(isset($with_add) && (!$with_add)))
|
@if (isset($right_content))
|
||||||
@include('components.datatables.buttons.add')
|
{!! $right_content !!}
|
||||||
@endif
|
@endif
|
||||||
</div>
|
|
||||||
</div>
|
@if (!(isset($with_add) && !$with_add))
|
||||||
|
@include('components.datatables.buttons.add')
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -1,78 +1,57 @@
|
|||||||
<script>
|
<script>
|
||||||
|
$('#{{ $model }}-table').on('draw.dt', function() {
|
||||||
|
|
||||||
$('#{{ $model }}-table').on( 'draw.dt', function () {
|
var table = getDatatable("{{ $model }}");
|
||||||
|
|
||||||
var table = getDatatable("{{ $model }}");
|
$('#{{ $model }}-table .btn-edit').off('click').click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
$('#{{ $model }}-table .btn-edit').off('click').click(function(e) {
|
var id = $(this).data('id');
|
||||||
e.preventDefault();
|
@if (isset($edit_callback))
|
||||||
// var id = table.row(this).id();
|
{{ $edit_callback }}
|
||||||
var id = $(this).data('id');
|
@else
|
||||||
@if (isset($edit_callback))
|
url = '{{ $route }}' + '/edit/' + id;
|
||||||
{{ $edit_callback }}
|
openURL(url);
|
||||||
@else
|
@endif
|
||||||
url = '{{ $route }}' + '/edit/' + id;
|
});
|
||||||
openURL(url);
|
|
||||||
@endif
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#{{ $model }}-table .btn-show').off('click').click(function(e) {
|
$('#{{ $model }}-table .btn-show').off('click').click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
// var id = table.row(this).id();
|
var id = $(this).data('id');
|
||||||
var id = $(this).data('id');
|
@if (isset($show_callback))
|
||||||
@if (isset($show_callback))
|
{{ $show_callback }}
|
||||||
{{ $show_callback }}
|
@else
|
||||||
@else
|
url = '{{ $route }}' + '/show/' + id;
|
||||||
url = '{{ $route }}' + '/show/' + id;
|
openURL(url);
|
||||||
openURL(url);
|
@endif
|
||||||
@endif
|
});
|
||||||
});
|
|
||||||
|
|
||||||
$('#{{ $model }}-table .btn-del').off('click').click(function (e) {
|
$('#{{ $model }}-table .btn-del').off('click').click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
// var id = table.row(this).id();
|
var id = $(this).data('id');
|
||||||
var id = $(this).data('id');
|
|
||||||
|
|
||||||
bootbox.confirm("{{ __('fg.confirmdelete') }}", function (result) {
|
bootbox.confirm("{{ __('fg.confirmdelete') }}", function(result) {
|
||||||
if (result === false) return;
|
if (result === false) return;
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '{{ $route }}' + '/destroy/' + id,
|
url: '{{ $route }}' + '/destroy/' + id,
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'},
|
headers: {
|
||||||
success: function(){
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||||
// line.remove();
|
},
|
||||||
@if (isset($delete_callback))
|
success: function() {
|
||||||
{{ $delete_callback }}
|
@if (isset($delete_callback))
|
||||||
@else
|
{{ $delete_callback }}
|
||||||
table.draw();
|
@else
|
||||||
@endif
|
table.draw();
|
||||||
growl("{{ __('fg.deletesuccess') }}", 'success');
|
@endif
|
||||||
}
|
growl("{{ __('fg.deletesuccess') }}", 'success');
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
{{ $callback ?? '' }}
|
{{ $callback ?? '' }}
|
||||||
|
|
||||||
var state = table.state.loaded();
|
var state = table.state.loaded();
|
||||||
// console.log('state');
|
});
|
||||||
// console.log(state);
|
|
||||||
if ( state ) {
|
|
||||||
/*
|
|
||||||
table.columns().eq( 0 ).each( function ( colIdx ) {
|
|
||||||
var colSearch = state.columns[colIdx].search;
|
|
||||||
if ( colSearch.search ) {
|
|
||||||
$('.search-input-text').eq(colIdx).val( colSearch.search );
|
|
||||||
}
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// datatablesHelper.getDatatableLength('{{ $model }}', 34);
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,30 @@
|
|||||||
@include('components.form.label')
|
@include('components.form.label')
|
||||||
|
|
||||||
@if (($disabled ?? false) || ($readonly ?? false))
|
@if (($disabled ?? false) || ($readonly ?? false))
|
||||||
@include('components.form.input', ['type' => 'hidden', 'label' => false, 'disabled' => false, 'readonly' => false])
|
@include('components.form.input', [
|
||||||
|
'type' => 'hidden',
|
||||||
|
'label' => false,
|
||||||
|
'disabled' => false,
|
||||||
|
'readonly' => false,
|
||||||
|
])
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<input type="{{ $type ?? 'text'}}" name="{{ $name }}" id="{{ $id_name ?? str_slug($name,'-') }}" class="form-control {{ $class ?? ''}}" value="{{ $value ?? null}}"
|
<input type="{{ $type ?? 'text' }}" name="{{ $name }}" id="{{ $id_name ?? str_slug($name, '-') }}"
|
||||||
@if ($required ?? false) required @endif
|
class="form-control {{ $class ?? '' }}" value="{{ $value ?? (old($name) ?? '') }}"
|
||||||
@if ($disabled ?? false) disabled @endif
|
@if ($required ?? false) required @endif @if ($disabled ?? false) disabled @endif
|
||||||
@if ($readonly ?? false) readonly @endif
|
@if ($readonly ?? false) readonly @endif @if ($autofocus ?? false) autofocus @endif
|
||||||
@if ($autofocus ?? false) autofocus @endif
|
@if ($size ?? false) size="{{ $size }}" @endif
|
||||||
@if ($size ?? false) size="{{ $size }}" @endif
|
@if ($autocomplete ?? false) autocomplete="{{ $autocomplete }}" @endif
|
||||||
@if ($autocomplete ?? false) autocomplete="{{ $autocomplete }}" @endif
|
@if ($minlength ?? false) minlength={{ $minlength }} @endif
|
||||||
@if ($minlength ?? false) minlength={{ $minlength }} @endif
|
@if ($maxlength ?? false) maxlength={{ $maxlength }} @endif
|
||||||
@if ($maxlength ?? false) maxlength={{ $maxlength }} @endif
|
@if ($formid ?? false) form="{{ $formid }}" @endif
|
||||||
@if ($formid ?? false) form="{{ $formid }}" @endif
|
@if ($mask ?? false) data-inputmask="'mask': '{{ $mask }}'" @endif
|
||||||
@if ($mask ?? false) data-inputmask="'mask': '{{ $mask }}'" @endif
|
@if ($pattern ?? false) pattern="{{ $pattern }}" @endif
|
||||||
@if ($pattern ?? false) pattern="{{ $pattern }}" @endif
|
@if ($placeholder ?? false) placeholder="{{ $placeholder }}" @endif
|
||||||
@if ($placeholder ?? false) placeholder="{{ $placeholder }}" @endif
|
@if ($step ?? false) step="{{ $step }}" @endif {!! $meta ?? '' !!}>
|
||||||
@if ($step ?? false) step="{{ $step }}" @endif
|
|
||||||
{!! $meta ?? '' !!} >
|
@error($name)
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
<strong>{{ $message }}</strong>
|
||||||
|
</span>
|
||||||
|
@enderror
|
||||||
|
|||||||
@@ -1,131 +1,130 @@
|
|||||||
@if(!defined('LOAD_DATATABLES'))
|
@if (!defined('LOAD_DATATABLES'))
|
||||||
@push('css')
|
@push('css')
|
||||||
<link rel="stylesheet" href="{{ asset('assets/plugins/datatables.min.css') }}">
|
<link rel="stylesheet" href="{{ asset('assets/plugins/datatables.min.css') }}">
|
||||||
@endpush
|
@endpush
|
||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
@include('boilerplate::load.moment')
|
@include('boilerplate::load.moment')
|
||||||
<script src="{{ asset('assets/plugins/datatables.min.js') }}"></script>
|
<script src="{{ asset('assets/plugins/datatables.min.js') }}"></script>
|
||||||
<script src="{{ asset('vendor/datatables/buttons.server-side.js') }}"></script>
|
<script src="{{ asset('vendor/datatables/buttons.server-side.js') }}"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$.extend( true, $.fn.dataTable.defaults, {
|
$.extend(true, $.fn.dataTable.defaults, {
|
||||||
language: {
|
language: {
|
||||||
url: "/assets/plugins/datatables_lang/{{ \App::getLocale() }}.json"
|
url: "/assets/plugins/datatables_lang/{{ \App::getLocale() }}.json"
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function removeAccents ( data ) {
|
function removeAccents(data) {
|
||||||
if ( data.normalize ) {
|
if (data.normalize) {
|
||||||
return data +' '+ data.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
return data + ' ' + data.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function reloadDatatable(name) {
|
function reloadDatatable(name) {
|
||||||
getDatatable(name).ajax.reload(null,false);
|
getDatatable(name).ajax.reload(null, false);
|
||||||
// getDatatable(name).columns.adjust().draw();
|
// getDatatable(name).columns.adjust().draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDatatable(name) {
|
function getDatatable(name) {
|
||||||
return (typeof(window.LaravelDataTables) !== 'undefined') ? window.LaravelDataTables[name + "-table"] : false;
|
return (typeof(window.LaravelDataTables) !== 'undefined') ? window.LaravelDataTables[name + "-table"] : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDatatableOrderArray(name) {
|
function getDatatableOrderArray(name) {
|
||||||
var order = [];
|
var order = [];
|
||||||
order['name'] = getDatatableOrderName(name);
|
order['name'] = getDatatableOrderName(name);
|
||||||
order['sort'] = getDatatableOrderSort(name);
|
order['sort'] = getDatatableOrderSort(name);
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDatatableOrderJson(name) {
|
function getDatatableOrderJson(name) {
|
||||||
return {
|
return {
|
||||||
'name': getDatatableOrderName(name),
|
'name': getDatatableOrderName(name),
|
||||||
'sort': getDatatableOrderSort(name)
|
'sort': getDatatableOrderSort(name)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDatatableOrderName(name) {
|
function getDatatableOrderName(name) {
|
||||||
var id = getDatatableOrderIndex(name);
|
var id = getDatatableOrderIndex(name);
|
||||||
return id ? getDatatableColumnNameById(name, id) : false;
|
return id ? getDatatableColumnNameById(name, id) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDatatableOrderIndex(name) {
|
function getDatatableOrderIndex(name) {
|
||||||
var table = getDatatable(name);
|
var table = getDatatable(name);
|
||||||
var order = table.order();
|
var order = table.order();
|
||||||
var col = order ? order[0][0] : false;
|
var col = order ? order[0][0] : false;
|
||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDatatableOrderSort(name) {
|
function getDatatableOrderSort(name) {
|
||||||
var table = getDatatable(name);
|
var table = getDatatable(name);
|
||||||
var order = table.order();
|
var order = table.order();
|
||||||
var sort = order[0][1];
|
var sort = order[0][1];
|
||||||
return sort;
|
return sort;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDatatableState(name) {
|
function getDatatableState(name) {
|
||||||
var table = getDatatable(name);
|
var table = getDatatable(name);
|
||||||
return table ? table.state.loaded() : false;
|
return table ? table.state.loaded() : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDatatableColumnNameById(name, id) {
|
function getDatatableColumnNameById(name, id) {
|
||||||
var column = getDatatableColumnById(name, id);
|
var column = getDatatableColumnById(name, id);
|
||||||
return column ? column.name : false;
|
return column ? column.name : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDatatableColumnById(name, id) {
|
function getDatatableColumnById(name, id) {
|
||||||
var columns = getDatatableColumns(name);
|
var columns = getDatatableColumns(name);
|
||||||
return columns ? columns[id] : false;
|
return columns ? columns[id] : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDatatableColumns(name) {
|
function getDatatableColumns(name) {
|
||||||
var table = getDatatable(name);
|
var table = getDatatable(name);
|
||||||
return table ? table.settings().init().columns : false;
|
return table ? table.settings().init().columns : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setAlertWhenFiltered(model) {
|
function setAlertWhenFiltered(model) {
|
||||||
var selector = '#' + model + '-filters';
|
var selector = '#' + model + '-filters';
|
||||||
if (checkFilterHasValues(selector)) {
|
if (checkFilterHasValues(selector)) {
|
||||||
$(selector + '-badge').show();
|
$(selector + '-badge').show();
|
||||||
} else {
|
} else {
|
||||||
$(selector + '-badge').hide();
|
$(selector + '-badge').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkFilterHasValues(selector) {
|
function checkFilterHasValues(selector) {
|
||||||
var tab = $(selector).serializeArray();
|
var tab = $(selector).serializeArray();
|
||||||
var hasValue = false;
|
var hasValue = false;
|
||||||
for (item of tab) {
|
for (item of tab) {
|
||||||
if (item.value) {
|
if (item.value) {
|
||||||
var selector2 = selector + ' input[name="' + item.name + '"]';
|
var selector2 = selector + ' input[name="' + item.name + '"]';
|
||||||
var isHidden = ( $(selector2).attr('type') == 'hidden' );
|
var isHidden = ($(selector2).attr('type') == 'hidden');
|
||||||
if (!isHidden) hasValue = true;
|
if (!isHidden) hasValue = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return hasValue;
|
return hasValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var searchType = jQuery.fn.DataTable.ext.type.search;
|
var searchType = jQuery.fn.DataTable.ext.type.search;
|
||||||
|
|
||||||
searchType.string = function ( data ) {
|
|
||||||
return ! data ? '' : typeof data === 'string' ? removeAccents( data ) : data;
|
|
||||||
};
|
|
||||||
|
|
||||||
searchType.html = function ( data ) {
|
|
||||||
return ! data ? '' : typeof data === 'string' ? removeAccents( data.replace( /<.*?>/g, '' ) ) : data;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
searchType.string = function(data) {
|
||||||
@endpush
|
return !data ? '' : typeof data === 'string' ? removeAccents(data) : data;
|
||||||
|
};
|
||||||
|
|
||||||
@php(define('LOAD_DATATABLES', true))
|
searchType.html = function(data) {
|
||||||
|
return !data ? '' : typeof data === 'string' ? removeAccents(data.replace(/<.*?>/g, '')) : data;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@php(define('LOAD_DATATABLES', true))
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
@if ($dataTable)
|
@if ($dataTable)
|
||||||
{{ $dataTable->scripts() }}
|
{{ $dataTable->scripts() }}
|
||||||
@endif
|
@endif
|
||||||
@endpush
|
@endpush
|
||||||
|
|||||||
Reference in New Issue
Block a user