add datatbles for invoices, add pdf icon, refactor icons components, add autocomplete on search, adapt searching to meilisearch
This commit is contained in:
@@ -50,19 +50,31 @@ class ParentDataTable extends DataTable
|
|||||||
return self::getButtonEdit().self::getButtonDel();
|
return self::getButtonEdit().self::getButtonDel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getButtonEdit()
|
public function getButtonEdit($field = 'id', $title = 'Modifier')
|
||||||
{
|
{
|
||||||
return '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-primary btn-edit mr-2"><i class="fa fa-fw fa-pencil-alt"></i></button>';
|
return view('components.form.buttons.edit', [
|
||||||
|
'dataId' => '{{$'.$field.'}}',
|
||||||
|
'class' => 'btn-sm mr-2',
|
||||||
|
'title' => $title,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getButtonShow()
|
public function getButtonShow($field = 'id', $title = 'Voir')
|
||||||
{
|
{
|
||||||
return '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-secondary btn-show mr-2"><i class="fa fa-fw fa-eye"></i></button>';
|
return view('components.form.buttons.show', [
|
||||||
|
'dataId' => '{{$'.$field.'}}',
|
||||||
|
'class' => 'btn-sm mr-2',
|
||||||
|
'title' => $title,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getButtonDel()
|
public function getButtonDel($field ='id', $title = 'Effacer')
|
||||||
{
|
{
|
||||||
return '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-danger btn-del"><i class="fa fa-fw fa-trash"></i></button>';
|
return view('components.form.buttons.delete', [
|
||||||
|
'dataId' => '{{$'.$field.'}}',
|
||||||
|
'class' => 'btn-sm mr-2',
|
||||||
|
'title' => $title,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function makeColumnButtons()
|
public function makeColumnButtons()
|
||||||
|
|||||||
80
app/Datatables/Shop/CustomerInvoicesDataTable.php
Normal file
80
app/Datatables/Shop/CustomerInvoicesDataTable.php
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Datatables\Shop;
|
||||||
|
|
||||||
|
use App\Datatables\ParentDataTable as DataTable;
|
||||||
|
use App\Models\Shop\Invoice;
|
||||||
|
use App\Repositories\Shop\InvoicePayments;
|
||||||
|
use App\Repositories\Shop\Invoices;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Yajra\DataTables\Html\Column;
|
||||||
|
|
||||||
|
class CustomerInvoicesDataTable extends DataTable
|
||||||
|
{
|
||||||
|
public $model_name = 'invoices';
|
||||||
|
|
||||||
|
public $sortedColumn = 1;
|
||||||
|
|
||||||
|
public $sortedOrder = 'desc';
|
||||||
|
|
||||||
|
public $stateSave = true;
|
||||||
|
|
||||||
|
public $url = null;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->url = route('Shop.Invoices.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function query(Invoice $model)
|
||||||
|
{
|
||||||
|
$customerId = Auth::id();
|
||||||
|
$model = $model->byCustomer($customerId)->with(['address']);
|
||||||
|
|
||||||
|
return $this->buildQuery($model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHtmlButtons()
|
||||||
|
{
|
||||||
|
$buttons = view('components.form.button', [
|
||||||
|
'dataId' => '{{$uuid}}',
|
||||||
|
'class' => 'btn-sm btn-secondary btn-invoice mr-2',
|
||||||
|
'icon' => 'fa-file-pdf',
|
||||||
|
'title' => 'Télécharger la facture',
|
||||||
|
'url' => route('Shop.Invoices.pdf') . '/{{$uuid}}',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$buttons .= self::getButtonShow('uuid', 'Voir la facture');
|
||||||
|
|
||||||
|
return $buttons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function modifier($datatables)
|
||||||
|
{
|
||||||
|
$datatables
|
||||||
|
->editColumn('status', function (Invoice $invoice) {
|
||||||
|
return Invoices::getStatus($invoice->status);
|
||||||
|
})
|
||||||
|
->editColumn('created_at', function (Invoice $invoice) {
|
||||||
|
return $invoice->created_at->isoFormat('DD/MM/YY HH:mm');
|
||||||
|
})
|
||||||
|
->editColumn('payment_type', function (Invoice $invoice) {
|
||||||
|
return InvoicePayments::getPaymentType($invoice->payment_type);
|
||||||
|
})
|
||||||
|
->rawColumns(['action']);
|
||||||
|
|
||||||
|
return parent::modifier($datatables);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getColumns()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Column::make('created_at')->title('Date'),
|
||||||
|
Column::make('ref')->title('Ref'),
|
||||||
|
Column::make('payment_type')->title('Règlement'),
|
||||||
|
Column::make('total_shipped')->title('Montant')->class('text-right'),
|
||||||
|
Column::make('status')->title('Statut'),
|
||||||
|
$this->makeColumnButtons(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,8 +4,8 @@ namespace App\Datatables\Shop;
|
|||||||
|
|
||||||
use App\Datatables\ParentDataTable as DataTable;
|
use App\Datatables\ParentDataTable as DataTable;
|
||||||
use App\Models\Shop\Order;
|
use App\Models\Shop\Order;
|
||||||
use App\Repositories\Shop\InvoicePayments;
|
|
||||||
use App\Repositories\Shop\Orders;
|
use App\Repositories\Shop\Orders;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Yajra\DataTables\Html\Column;
|
use Yajra\DataTables\Html\Column;
|
||||||
|
|
||||||
class CustomerOrdersDataTable extends DataTable
|
class CustomerOrdersDataTable extends DataTable
|
||||||
@@ -18,6 +18,8 @@ class CustomerOrdersDataTable extends DataTable
|
|||||||
|
|
||||||
public $stateSave = true;
|
public $stateSave = true;
|
||||||
|
|
||||||
|
public $url = null;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->url = route('Shop.Orders.index');
|
$this->url = route('Shop.Orders.index');
|
||||||
@@ -26,11 +28,16 @@ class CustomerOrdersDataTable extends DataTable
|
|||||||
public function query(Order $model)
|
public function query(Order $model)
|
||||||
{
|
{
|
||||||
$customerId = Auth::id();
|
$customerId = Auth::id();
|
||||||
$model = $model->byCustomer($customerId)->with(['delivery']);
|
$model = $model->byCustomer($customerId);
|
||||||
|
|
||||||
return $this->buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getHtmlButtons()
|
||||||
|
{
|
||||||
|
return self::getButtonShow('uuid', 'Voir la commande');
|
||||||
|
}
|
||||||
|
|
||||||
public function modifier($datatables)
|
public function modifier($datatables)
|
||||||
{
|
{
|
||||||
$datatables
|
$datatables
|
||||||
@@ -38,10 +45,7 @@ class CustomerOrdersDataTable extends DataTable
|
|||||||
return Orders::getStatus($order->status);
|
return Orders::getStatus($order->status);
|
||||||
})
|
})
|
||||||
->editColumn('created_at', function (Order $order) {
|
->editColumn('created_at', function (Order $order) {
|
||||||
return $order->created_at->toDateTimeString();
|
return $order->created_at->isoFormat('DD/MM/YY HH:mm');
|
||||||
})
|
|
||||||
->editColumn('payment_type', function (Order $order) {
|
|
||||||
return InvoicePayments::getPaymentType($order->payment_type);
|
|
||||||
})
|
})
|
||||||
->rawColumns(['action']);
|
->rawColumns(['action']);
|
||||||
|
|
||||||
@@ -53,7 +57,6 @@ class CustomerOrdersDataTable extends DataTable
|
|||||||
return [
|
return [
|
||||||
Column::make('created_at')->title('Date'),
|
Column::make('created_at')->title('Date'),
|
||||||
Column::make('ref')->title('Ref'),
|
Column::make('ref')->title('Ref'),
|
||||||
Column::make('payment_type')->title('Règlement'),
|
|
||||||
Column::make('total_shipped')->title('Montant')->class('text-right'),
|
Column::make('total_shipped')->title('Montant')->class('text-right'),
|
||||||
Column::make('status')->title('Statut'),
|
Column::make('status')->title('Statut'),
|
||||||
$this->makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
|
|||||||
@@ -6,4 +6,8 @@ use App\Http\Controllers\Controller as ParentController;
|
|||||||
|
|
||||||
class Controller extends ParentController
|
class Controller extends ParentController
|
||||||
{
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('auth.check');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,20 +2,26 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Shop;
|
namespace App\Http\Controllers\Shop;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Shop\Controller;
|
||||||
use App\Repositories\Shop\Customers;
|
use App\Repositories\Shop\Customers;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
|
|
||||||
class CustomerController extends Controller
|
class CustomerController extends Controller
|
||||||
{
|
{
|
||||||
public function profile($id = false)
|
public function profile()
|
||||||
{
|
{
|
||||||
$data = Customers::editProfile($id);
|
$data = Customers::editProfile(Customers::getId());
|
||||||
|
|
||||||
return view('Shop.Customers.profile', $data);
|
return view('Shop.Customers.profile', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function checkAuth()
|
||||||
|
{
|
||||||
|
if (Customers::isNotConnected()) {
|
||||||
|
return redirect()->route('Shop.login');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function modalProfile($id = false)
|
public function modalProfile($id = false)
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
@@ -27,9 +33,8 @@ class CustomerController extends Controller
|
|||||||
|
|
||||||
public function edit()
|
public function edit()
|
||||||
{
|
{
|
||||||
$id = Auth::id();
|
|
||||||
$data = [
|
$data = [
|
||||||
'customer' => Customers::edit($id),
|
'customer' => Customers::edit(Customers::getId()),
|
||||||
];
|
];
|
||||||
|
|
||||||
return view('Shop.Customers.edit', $data);
|
return view('Shop.Customers.edit', $data);
|
||||||
|
|||||||
@@ -2,22 +2,25 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Shop;
|
namespace App\Http\Controllers\Shop;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Shop\Controller;
|
||||||
|
use App\Datatables\Shop\CustomerInvoicesDataTable;
|
||||||
use App\Repositories\Shop\InvoicePDF;
|
use App\Repositories\Shop\InvoicePDF;
|
||||||
use App\Repositories\Shop\Invoices;
|
use App\Repositories\Shop\Invoices;
|
||||||
|
|
||||||
class InvoiceController extends Controller
|
class InvoiceController extends Controller
|
||||||
{
|
{
|
||||||
public function index()
|
public function index(CustomerInvoicesDataTable $dataTable)
|
||||||
{
|
{
|
||||||
//
|
return $dataTable->render('Shop.Invoices.partials.list');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($uuid)
|
public function view($uuid)
|
||||||
{
|
{
|
||||||
$data = Invoices::getByUUID($uuid);
|
$data = [
|
||||||
|
'invoice' => Invoices::view($uuid),
|
||||||
|
];
|
||||||
|
|
||||||
return view('Shop.Invoices.show', $data);
|
return view('Shop.Invoices.view', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pdf($uuid)
|
public function pdf($uuid)
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Shop;
|
namespace App\Http\Controllers\Shop;
|
||||||
|
|
||||||
use App\Datatables\Shop\OrdersDataTable;
|
use App\Datatables\Shop\CustomerOrdersDataTable;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Shop\Controller;
|
||||||
use App\Repositories\Core\User\ShopCart;
|
use App\Repositories\Core\User\ShopCart;
|
||||||
use App\Repositories\Shop\Baskets;
|
use App\Repositories\Shop\Baskets;
|
||||||
use App\Repositories\Shop\Customers;
|
use App\Repositories\Shop\Customers;
|
||||||
@@ -17,7 +17,7 @@ use Illuminate\Http\Request;
|
|||||||
|
|
||||||
class OrderController extends Controller
|
class OrderController extends Controller
|
||||||
{
|
{
|
||||||
public function index(OrdersDataTable $dataTable)
|
public function index(CustomerOrdersDataTable $dataTable)
|
||||||
{
|
{
|
||||||
return $dataTable->render('Shop.Orders.partials.list');
|
return $dataTable->render('Shop.Orders.partials.list');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ class SearchController extends Controller
|
|||||||
{
|
{
|
||||||
$data = $request->input();
|
$data = $request->input();
|
||||||
$data['product_type'] = 'botanic';
|
$data['product_type'] = 'botanic';
|
||||||
$articles = Searches::getResults($request->input());
|
// $articles = Searches::getResults($request->input());
|
||||||
|
$articles = Searches::search($request->input());
|
||||||
$data = [
|
$data = [
|
||||||
'articles' => $articles,
|
'articles' => $articles,
|
||||||
'articles_count' => $articles ? count($articles) : 0,
|
'articles_count' => $articles ? count($articles) : 0,
|
||||||
@@ -20,8 +21,6 @@ class SearchController extends Controller
|
|||||||
'product_type' => $data['product_type'],
|
'product_type' => $data['product_type'],
|
||||||
];
|
];
|
||||||
|
|
||||||
// dump($data);
|
|
||||||
// exit;
|
|
||||||
return view('Shop.Search.results', $data);
|
return view('Shop.Search.results', $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class Kernel extends HttpKernel
|
|||||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
|
'auth.check' => \App\Http\Middleware\CheckAuth::class,
|
||||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||||
|
|||||||
19
app/Http/Middleware/CheckAuth.php
Normal file
19
app/Http/Middleware/CheckAuth.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use App\Repositories\Shop\Customers;
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class CheckAuth
|
||||||
|
{
|
||||||
|
public function handle(Request $request, Closure $next)
|
||||||
|
{
|
||||||
|
if (Customers::isNotConnected()) {
|
||||||
|
return redirect('/login');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,6 @@ namespace App\Models\Shop;
|
|||||||
|
|
||||||
use App\Models\Botanic\Specie;
|
use App\Models\Botanic\Specie;
|
||||||
use App\Models\Botanic\Variety;
|
use App\Models\Botanic\Variety;
|
||||||
use App\Repositories\Shop\Articles;
|
|
||||||
use App\Traits\Model\HasComments;
|
use App\Traits\Model\HasComments;
|
||||||
use App\Traits\Model\Imageable;
|
use App\Traits\Model\Imageable;
|
||||||
use Fico7489\Laravel\EloquentJoin\Traits\EloquentJoin;
|
use Fico7489\Laravel\EloquentJoin\Traits\EloquentJoin;
|
||||||
@@ -105,7 +104,7 @@ class Article extends Model implements HasMedia
|
|||||||
return $query->where($this->table.'.name', 'LIKE', '%'.$str.'%');
|
return $query->where($this->table.'.name', 'LIKE', '%'.$str.'%');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeSearch($query, $str)
|
public function scopeRawSearch($query, $str)
|
||||||
{
|
{
|
||||||
return $query->where($this->table.'.name', 'LIKE', '%'.$str.'%');
|
return $query->where($this->table.'.name', 'LIKE', '%'.$str.'%');
|
||||||
}
|
}
|
||||||
@@ -148,6 +147,11 @@ class Article extends Model implements HasMedia
|
|||||||
return $query->whereIn($this->table.'.product_type', [Variety::class, Specie::class]);
|
return $query->whereIn($this->table.'.product_type', [Variety::class, Specie::class]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function scopeByIDs($query, $ids)
|
||||||
|
{
|
||||||
|
return $query->whereIN($this->table.'.id', $ids);
|
||||||
|
}
|
||||||
|
|
||||||
public function scopeMerchandise($query)
|
public function scopeMerchandise($query)
|
||||||
{
|
{
|
||||||
return $query->byProduct(Merchandise::class);
|
return $query->byProduct(Merchandise::class);
|
||||||
@@ -218,6 +222,7 @@ class Article extends Model implements HasMedia
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => (int) $this->id,
|
'id' => (int) $this->id,
|
||||||
|
'article_nature_id' => $this->article_nature_id,
|
||||||
'name' => $this->name,
|
'name' => $this->name,
|
||||||
'description' => html_entity_decode(strip_tags($description)),
|
'description' => html_entity_decode(strip_tags($description)),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -40,6 +40,11 @@ class Invoice extends Model
|
|||||||
return $this->belongsTo(CustomerAddress::class, 'invoice_address_id');
|
return $this->belongsTo(CustomerAddress::class, 'invoice_address_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function scopeByCustomer($query, $customerId)
|
||||||
|
{
|
||||||
|
return $query->where('customer_id', $customerId);
|
||||||
|
}
|
||||||
|
|
||||||
public function scopeByUUID($query, $uuid)
|
public function scopeByUUID($query, $uuid)
|
||||||
{
|
{
|
||||||
return $query->where('uuid', $uuid);
|
return $query->where('uuid', $uuid);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class Articles
|
|||||||
|
|
||||||
public static function autocomplete($str)
|
public static function autocomplete($str)
|
||||||
{
|
{
|
||||||
$data = Article::byAutocomplete($str)->orderBy('name')->limit(30)->pluck('name', 'id');
|
$data = Article::byAutocomplete($str)->orderBy('name')->limit(20)->pluck('name', 'id');
|
||||||
$export = [];
|
$export = [];
|
||||||
foreach ($data as $key => $name) {
|
foreach ($data as $key => $name) {
|
||||||
$export[] = ['value' => $key, 'text' => $name];
|
$export[] = ['value' => $key, 'text' => $name];
|
||||||
@@ -143,6 +143,7 @@ class Articles
|
|||||||
public static function getArticlesToSell($options)
|
public static function getArticlesToSell($options)
|
||||||
{
|
{
|
||||||
$articles = self::getArticlesWithOffers($options);
|
$articles = self::getArticlesWithOffers($options);
|
||||||
|
$searchOrder = array_flip($options['ids']->toArray() ?? []);
|
||||||
foreach ($articles as $article) {
|
foreach ($articles as $article) {
|
||||||
$price_lists = $article->offers[0]->tariff->price_lists->toArray();
|
$price_lists = $article->offers[0]->tariff->price_lists->toArray();
|
||||||
if (! count($price_lists)) {
|
if (! count($price_lists)) {
|
||||||
@@ -150,6 +151,7 @@ class Articles
|
|||||||
}
|
}
|
||||||
if (! is_array($data[$article->name] ?? false)) {
|
if (! is_array($data[$article->name] ?? false)) {
|
||||||
$data[$article->name] = self::getDataForSale($article);
|
$data[$article->name] = self::getDataForSale($article);
|
||||||
|
$data[$article->name]['searchOrder'] = $searchOrder[$article->id];
|
||||||
}
|
}
|
||||||
$prices = $price_lists[0]['price_list_values'][0];
|
$prices = $price_lists[0]['price_list_values'][0];
|
||||||
$article_nature_name = strtolower($article->article_nature->name);
|
$article_nature_name = strtolower($article->article_nature->name);
|
||||||
@@ -248,20 +250,17 @@ class Articles
|
|||||||
|
|
||||||
public static function getModelByOptions($options = false)
|
public static function getModelByOptions($options = false)
|
||||||
{
|
{
|
||||||
$category_id = $options['category_id'] ?? false;
|
|
||||||
$search = $options['search'] ?? false;
|
|
||||||
$tags = $options['tags'] ?? false;
|
|
||||||
$article_nature_id = $options['article_nature_id'] ?? false;
|
$article_nature_id = $options['article_nature_id'] ?? false;
|
||||||
$article_nature_ids = $options['article_nature_ids'] ?? false;
|
$article_nature_ids = $options['article_nature_ids'] ?? false;
|
||||||
$product_type = $options['product_type'] ?? false;
|
|
||||||
|
|
||||||
$model = $options['homepage'] ?? false ? Article::homepage()->visible() : Article::visible();
|
$model = $options['homepage'] ?? false ? Article::homepage()->visible() : Article::visible();
|
||||||
$model = $category_id ? $model->byCategoryParent($category_id) : $model;
|
$model = $options['category_id'] ?? false ? $model->byCategoryParent($options['category_id']) : $model;
|
||||||
$model = $tags ? $model->byTags($tags) : $model;
|
$model = $options['tags'] ?? false ? $model->byTags($options['tags']) : $model;
|
||||||
$model = $search ? $model->search($search) : $model;
|
$model = $options['search'] ?? false ? $model->rawSearch($options['search']) : $model;
|
||||||
|
$model = $options['ids'] ?? false ? $model->byIDs($options['ids']) : $model;
|
||||||
$model = $article_nature_id ? $model->byArticleNature($article_nature_id) : $model;
|
$model = $article_nature_id ? $model->byArticleNature($article_nature_id) : $model;
|
||||||
$model = $article_nature_ids ? $model->byArticleNatures($article_nature_ids) : $model;
|
$model = $article_nature_ids ? $model->byArticleNatures($article_nature_ids) : $model;
|
||||||
switch ($product_type) {
|
switch ($options['product_type'] ?? false) {
|
||||||
case 'botanic':
|
case 'botanic':
|
||||||
$model = $model->botanic();
|
$model = $model->botanic();
|
||||||
break;
|
break;
|
||||||
@@ -324,11 +323,6 @@ class Articles
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getPricesByArticle($article)
|
|
||||||
{
|
|
||||||
return Prices::getByArticle($article->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function storeFull($data)
|
public static function storeFull($data)
|
||||||
{
|
{
|
||||||
$images = $data['images'] ?? false;
|
$images = $data['images'] ?? false;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Repositories\Shop;
|
namespace App\Repositories\Shop;
|
||||||
|
|
||||||
|
use App\Datatables\Shop\CustomerInvoicesDataTable;
|
||||||
use App\Datatables\Shop\CustomerOrdersDataTable;
|
use App\Datatables\Shop\CustomerOrdersDataTable;
|
||||||
use App\Models\Shop\Customer;
|
use App\Models\Shop\Customer;
|
||||||
use App\Repositories\Core\File;
|
use App\Repositories\Core\File;
|
||||||
@@ -54,13 +55,14 @@ class Customers
|
|||||||
|
|
||||||
public static function editProfile($id = false)
|
public static function editProfile($id = false)
|
||||||
{
|
{
|
||||||
$id = $id ? $id : self::getId();
|
|
||||||
$datatableOrders = new CustomerOrdersDataTable();
|
$datatableOrders = new CustomerOrdersDataTable();
|
||||||
|
$datatableInvoices = new CustomerInvoicesDataTable();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'customer' => self::get($id, ['addresses', 'deliveries'])->toArray(),
|
'customer' => self::get($id, ['addresses', 'deliveries'])->toArray(),
|
||||||
'deliveries' => Deliveries::getAllWithSaleChannel()->toArray(),
|
'deliveries' => Deliveries::getAllWithSaleChannel()->toArray(),
|
||||||
'orders' => $datatableOrders->html(),
|
'orders' => $datatableOrders->html(),
|
||||||
|
'invoices' => $datatableInvoices->html(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,39 +29,54 @@ class Invoices
|
|||||||
public static function init()
|
public static function init()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'statuses' => Invoices::statuses(),
|
'statuses' => self::statuses(),
|
||||||
'payment_types' => InvoicePayments::paymentTypes(),
|
'payment_types' => InvoicePayments::paymentTypes(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFull($id)
|
public static function view($uuid)
|
||||||
{
|
{
|
||||||
return self::get($id, ['address', 'payments', 'order.customer', 'order.delivery_address', 'order.detail']);
|
$data = self::getFullByUUID($uuid)->toArray();
|
||||||
|
$data['payment_type'] = InvoicePayments::getPaymentType($data['payment_type']);
|
||||||
|
$data['status'] = self::getStatus($data['status']);
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getByUUID($uuid)
|
public static function getFullByUUID($id)
|
||||||
{
|
{
|
||||||
return Invoice::byUUID($uuid)->first();
|
return self::getByUUID($id, self::full());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getFull($id)
|
||||||
|
{
|
||||||
|
return self::get($id, self::full());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function full()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'address',
|
||||||
|
'customer',
|
||||||
|
'order.delivery_address',
|
||||||
|
'order.detail',
|
||||||
|
'order.sale_channel',
|
||||||
|
'payments',
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function saveInvoice($orderId, $data)
|
public static function saveInvoice($orderId, $data)
|
||||||
{
|
{
|
||||||
$data['order_id'] = $orderId;
|
$data['order_id'] = $orderId;
|
||||||
$data['date_invoice'] = date('Y-m-d');
|
$data['date_invoice'] = date('Y-m-d');
|
||||||
|
$data['date_due'] = Carbon::now()->addMonth()->format('Y-m-d');
|
||||||
|
|
||||||
return self::store($data);
|
return self::store($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function countByMonth()
|
|
||||||
{
|
|
||||||
$start = Carbon::now()->beginOfMonth();
|
|
||||||
|
|
||||||
return Invoice::where('created_at', '>', $start);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function create($data)
|
public static function create($data)
|
||||||
{
|
{
|
||||||
InvoiceStats::increase($data['total_taxed']);
|
InvoiceStats::increase($data['total']);
|
||||||
$data['uuid'] = Str::uuid()->toString();
|
$data['uuid'] = Str::uuid()->toString();
|
||||||
$data['ref'] = self::getNewRef();
|
$data['ref'] = self::getNewRef();
|
||||||
|
|
||||||
@@ -71,7 +86,7 @@ class Invoices
|
|||||||
public static function delete($id)
|
public static function delete($id)
|
||||||
{
|
{
|
||||||
$invoice = self::get($id);
|
$invoice = self::get($id);
|
||||||
InvoiceStats::decrease($invoice->total_priced);
|
InvoiceStats::decrease($invoice->total);
|
||||||
|
|
||||||
return Invoice::destroy($id);
|
return Invoice::destroy($id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,15 @@ class Orders
|
|||||||
{
|
{
|
||||||
use Basic, DateStats;
|
use Basic, DateStats;
|
||||||
|
|
||||||
|
public static function view($uuid)
|
||||||
|
{
|
||||||
|
$data = self::getFullByUUID($uuid)->toArray();
|
||||||
|
$data['payment_type'] = InvoicePayments::getPaymentType($data['payment_type']);
|
||||||
|
$data['status'] = self::getStatus($data['status']);
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
public static function getLast($nb = 10)
|
public static function getLast($nb = 10)
|
||||||
{
|
{
|
||||||
return Order::with('customer')->orderBy('id', 'DESC')->take($nb)->get();
|
return Order::with('customer')->orderBy('id', 'DESC')->take($nb)->get();
|
||||||
@@ -40,24 +49,12 @@ class Orders
|
|||||||
|
|
||||||
public static function getFullByUUID($uuid)
|
public static function getFullByUUID($uuid)
|
||||||
{
|
{
|
||||||
return self::getFull(self::getIdByUUID($uuid));
|
return self::getByUUID($uuid, self::full());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFull($id)
|
public static function getFull($id)
|
||||||
{
|
{
|
||||||
return Order::with(['customer', 'delivery', 'delivery_address', 'detail', 'invoice.address', 'sale_channel'])
|
return self::get($id, self::full());
|
||||||
->byID($id)->first();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function view($uuid)
|
|
||||||
{
|
|
||||||
$data = [];
|
|
||||||
$order = self::getFullByUUID($uuid);
|
|
||||||
$data = $order->toArray();
|
|
||||||
$data['payment_type'] = InvoicePayments::getPaymentType($order->payment_type);
|
|
||||||
$data['status'] = Orders::getStatus($order->status);
|
|
||||||
|
|
||||||
return $data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function saveOrder($data)
|
public static function saveOrder($data)
|
||||||
@@ -160,6 +157,11 @@ class Orders
|
|||||||
return $lastRef ? $lastRef->ref + 1 : $ref + 1;
|
return $lastRef ? $lastRef->ref + 1 : $ref + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function full()
|
||||||
|
{
|
||||||
|
return ['customer', 'delivery', 'delivery_address', 'detail', 'invoice.address', 'sale_channel'];
|
||||||
|
}
|
||||||
|
|
||||||
public static function getModel()
|
public static function getModel()
|
||||||
{
|
{
|
||||||
return Order::query();
|
return Order::query();
|
||||||
|
|||||||
@@ -6,9 +6,11 @@ use App\Models\Shop\Article;
|
|||||||
|
|
||||||
class Searches
|
class Searches
|
||||||
{
|
{
|
||||||
public static function search($query)
|
public static function search($options)
|
||||||
{
|
{
|
||||||
return Article::withAvailableOffers()->search($query)->get();
|
return collect(Articles::getArticlesToSell([
|
||||||
|
'ids' => Article::search($options['search_name'])->get()->pluck('id'),
|
||||||
|
]))->sortBy('searchOrder')->toArray();
|
||||||
}
|
}
|
||||||
public static function getResults($options)
|
public static function getResults($options)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -136,8 +136,8 @@ return [
|
|||||||
'key' => env('MEILISEARCH_KEY', null),
|
'key' => env('MEILISEARCH_KEY', null),
|
||||||
'index-settings' => [
|
'index-settings' => [
|
||||||
Article::class => [
|
Article::class => [
|
||||||
'filterableAttributes'=> ['id', 'name', 'description'],
|
'filterableAttributes'=> ['article_nature_id'],
|
||||||
'sortableAttributes' => ['created_at'],
|
'sortableAttributes' => ['name', 'created_at'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
@include('Shop.Orders.partials.list', ['dataTable' => $orders])
|
|
||||||
|
|
||||||
@if ($customer['orders'] ?? false)
|
|
||||||
<table class="table table-striped gradient-green1 green-fluo">
|
|
||||||
@foreach ($customer['orders'] as $order)
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
{{ Carbon\Carbon::parse($order['created_at'])->format('d-m-Y') }}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Numero facture
|
|
||||||
</td>
|
|
||||||
<td class="text-right">
|
|
||||||
{{ $order['total_shipped'] }} €
|
|
||||||
</td>
|
|
||||||
<td class="text-right">
|
|
||||||
<button class="btn btn-sm btn-secondary" data-id="{{ $order['id'] }}">
|
|
||||||
<i class="fa fa-fw fa-print" title="Imprimer"></i>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button class="btn btn-sm btn-secondary" data-id="{{ $order['id'] }}">
|
|
||||||
<i class="fa fa-fw fa-file-pdf" title="Télécharger"></i>
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
</table>
|
|
||||||
@endif
|
|
||||||
@@ -1,25 +1,35 @@
|
|||||||
<nav>
|
<nav>
|
||||||
<div class="nav nav-tabs pl-2">
|
<div class="nav nav-tabs pl-2">
|
||||||
<a href="#deliveries" data-toggle="tab" class="nav-item nav-link active" role="tab" aria-controls="deliveries"
|
<a href="#deliveriesTab" data-toggle="tab" class="nav-item nav-link active" role="tab" aria-selected="true">
|
||||||
aria-selected="true">
|
|
||||||
MON MODE D'ACHAT
|
MON MODE D'ACHAT
|
||||||
</a>
|
</a>
|
||||||
<a href="#invoices" data-toggle="tab" class="nav-item nav-link" role="tab" aria-controls="invoices"
|
<a href="#ordersTab" data-toggle="tab" class="nav-item nav-link" role="tab" aria-selected="false">
|
||||||
aria-selected="false">
|
SUIVI DE COMMANDES
|
||||||
FACTURES ET SUIVI DE COMMANDES
|
</a>
|
||||||
|
<a href="#invoicesTab" data-toggle="tab" class="nav-item nav-link" role="tab" aria-selected="false">
|
||||||
|
FACTURES
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div class="tab-pane fade show active pt-0 pb-0" id="deliveries">
|
<div class="tab-pane fade show active pt-0 pb-0" id="deliveriesTab">
|
||||||
<x-card classBody="bg-light">
|
<x-card classBody="bg-light">
|
||||||
@include('Shop.Customers.partials.deliveries')
|
@include('Shop.Customers.partials.deliveries')
|
||||||
</x-card>
|
</x-card>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade show pt-0 pb-0" id="invoices">
|
<div class="tab-pane fade show pt-0 pb-0" id="ordersTab">
|
||||||
<x-card classBody="bg-light">
|
<x-card classBody="bg-light">
|
||||||
@include('Shop.Customers.partials.invoices')
|
@include('Shop.Orders.partials.list', [
|
||||||
|
'dataTable' => $orders,
|
||||||
|
])
|
||||||
|
</x-card>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane fade show pt-0 pb-0" id="invoicesTab">
|
||||||
|
<x-card classBody="bg-light">
|
||||||
|
@include('Shop.Invoices.partials.list', [
|
||||||
|
'dataTable' => $invoices,
|
||||||
|
])
|
||||||
</x-card>
|
</x-card>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
2
resources/views/Shop/Invoices/partials/filters.blade.php
Normal file
2
resources/views/Shop/Invoices/partials/filters.blade.php
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<form id="{{ $model }}-filters">
|
||||||
|
</form>
|
||||||
26
resources/views/Shop/Invoices/partials/list.blade.php
Normal file
26
resources/views/Shop/Invoices/partials/list.blade.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
@include('components.datatable', [
|
||||||
|
'route' => route('Shop.Invoices.index'),
|
||||||
|
'model' => 'invoices',
|
||||||
|
'with_add' => false,
|
||||||
|
'with_filters' => true,
|
||||||
|
'with_exports' => false,
|
||||||
|
'with_print' => false,
|
||||||
|
'show_callback' => 'InvoiceView(id);',
|
||||||
|
])
|
||||||
|
|
||||||
|
@component('components.layout.modal-filters', ['title' => 'Filters', 'id' => 'modal-invoices-filters'])
|
||||||
|
@include('Shop.Invoices.partials.filters', ['model' => 'invoices'])
|
||||||
|
@endcomponent
|
||||||
|
|
||||||
|
@push('js')
|
||||||
|
<script>
|
||||||
|
function InvoiceView(id) {
|
||||||
|
var url_open = "{{ route('Shop.Invoices.view') }}/" + id;
|
||||||
|
openModal("Voir une facture", '#invoice-form', url_open, false, false, 'xl', {{ !($with_add ?? false) }});
|
||||||
|
}
|
||||||
|
|
||||||
|
function InvoiceRefresh() {
|
||||||
|
reloadDatatable("invoices");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
60
resources/views/Shop/Invoices/view.blade.php
Normal file
60
resources/views/Shop/Invoices/view.blade.php
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-6">
|
||||||
|
<h3>
|
||||||
|
@if ($invoice['customer']['company'])
|
||||||
|
{{ $invoice['customer']['company'] }}<br />
|
||||||
|
@endif
|
||||||
|
{{ $invoice['customer']['last_name'] }} {{ $invoice['customer']['first_name'] }}
|
||||||
|
</h3>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6">
|
||||||
|
<x-card title="Adresse de facturation">
|
||||||
|
@if ($invoice['address'])
|
||||||
|
{{ $invoice['address']['address'] }}<br />
|
||||||
|
@isset($invoice['address']['address2'])
|
||||||
|
{{ $invoice['address']['address2'] }}<br />
|
||||||
|
@endisset
|
||||||
|
{{ $invoice['address']['zipcode'] }}
|
||||||
|
{{ $invoice['address']['city'] }}<br />
|
||||||
|
@endif
|
||||||
|
</x-card>
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
<x-card title="Adresse de livraison">
|
||||||
|
@if ($invoice['order']['delivery_address'])
|
||||||
|
{{ $invoice['order']['delivery_address']['address'] }}<br />
|
||||||
|
@isset($invoice['order']['delivery_address']['address2'])
|
||||||
|
{{ $invoice['order']['delivery_address']['address2'] }}<br />
|
||||||
|
@endisset
|
||||||
|
{{ $invoice['order']['delivery_address']['zipcode'] }}
|
||||||
|
{{ $invoice['order']['delivery_address']['city'] }}<br />
|
||||||
|
@endif
|
||||||
|
</x-card>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-6" style="font-size: 1.2em; font-weight: 500;">
|
||||||
|
Facture N° {{ $invoice['ref'] }}<br />
|
||||||
|
du {{ Carbon\Carbon::parse($invoice['created_at'])->isoFormat('LLLL') }}
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
Statut : {{ $invoice['status'] }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-6">
|
||||||
|
Canal de vente : {{ $invoice['order']['sale_channel']['name'] }}
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
Règlement : {{ $invoice['payment_type'] }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@include('Admin.Shop.Orders.partials.detail', [
|
||||||
|
'detail_type' => 'facture',
|
||||||
|
'order' => $invoice['order'],
|
||||||
|
])
|
||||||
@@ -1,29 +1,26 @@
|
|||||||
@include('components.datatable', [
|
@include('components.datatable', [
|
||||||
'route' => route('Shop.Orders.index'),
|
'route' => route('Shop.Orders.index'),
|
||||||
'model' => 'orders',
|
'model' => 'orders',
|
||||||
'with_add' => false,
|
'with_add' => false,
|
||||||
'with_filters' => true,
|
'with_filters' => true,
|
||||||
'with_exports' => false,
|
'with_exports' => false,
|
||||||
'with_print' => false,
|
'with_print' => false,
|
||||||
'show_callback' => 'OrderView(id);',
|
'show_callback' => 'OrderView(id);',
|
||||||
])
|
])
|
||||||
|
|
||||||
@component('components.layout.modal-filters', ['title' => 'Filters', 'id' => 'modal-aml_risks-filters'])
|
@component('components.layout.modal-filters', ['title' => 'Filters', 'id' => 'modal-orders-filters'])
|
||||||
@include('Shop.Orders.partials.filters', ['model' => 'aml_risks'])
|
@include('Shop.Orders.partials.filters', ['model' => 'orders'])
|
||||||
@endcomponent
|
@endcomponent
|
||||||
|
|
||||||
@push('js')
|
@push('js')
|
||||||
<script>
|
<script>
|
||||||
|
function OrderView(id) {
|
||||||
|
var url_open = "{{ route('Shop.Orders.view') }}/" + id;
|
||||||
|
openModal("Voir une commande", '#order-form', url_open, false, false, 'xl', {{ !($with_add ?? false) }});
|
||||||
|
}
|
||||||
|
|
||||||
function OrderView(id) {
|
function OrderRefresh() {
|
||||||
var url_open = "{{ route('Shop.Orders.view') }}/" + id;
|
reloadDatatable("orders");
|
||||||
openModal("Voir une commande", '#model-form', url_open, false, false, 'xl', {{ !($with_add ?? false) }});
|
}
|
||||||
}
|
</script>
|
||||||
|
|
||||||
function OrderRefresh()
|
|
||||||
{
|
|
||||||
reloadDatatable("orders");
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
@endpush
|
@endpush
|
||||||
|
|||||||
@@ -9,49 +9,53 @@
|
|||||||
<meta name="robots" content="noindex, nofollow">
|
<meta name="robots" content="noindex, nofollow">
|
||||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
|
|
||||||
<title>Jardin'enVie</title>
|
<title>Jardin'enVie</title>
|
||||||
<meta name="description" content="Vente de semences, variété anciennes">
|
<meta name="description" content="Vente de semences, variété anciennes">
|
||||||
<meta name="keywords" content="">
|
<meta name="keywords" content="">
|
||||||
|
|
||||||
<link rel="icon" type="image/vnd.microsoft.icon" href="img/favicon.ico">
|
<link rel="icon" type="image/vnd.microsoft.icon" href="img/favicon.ico">
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
|
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
|
||||||
<link rel="stylesheet" href="/css/site.min.css?{{ date('Ymd') }}" type="text/css" media="all">
|
<link rel="stylesheet" href="/css/site.min.css?{{ date('Ymd') }}" type="text/css" media="all">
|
||||||
|
|
||||||
@stack('css')
|
@stack('css')
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="bg-green-dark">
|
<body class="bg-green-dark">
|
||||||
|
|
||||||
<div class="container bg-light" style="min-height: 100vh;">
|
<div class="container bg-light" style="min-height: 100vh;">
|
||||||
<main>
|
<main>
|
||||||
@include("Shop.layout.partials.header")
|
@include('Shop.layout.partials.header')
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
<section>
|
<section>
|
||||||
<div class="container-fluid p-0">
|
<div class="container-fluid p-0">
|
||||||
@yield('content')
|
@yield('content')
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
@include("Shop.layout.partials.footer")
|
@include('Shop.layout.partials.footer')
|
||||||
@include('cookie-consent::index')
|
@include('cookie-consent::index')
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="/js/site.min.js" ></script>
|
<script type="text/javascript" src="/js/site.min.js"></script>
|
||||||
|
|
||||||
@stack('scripts')
|
@stack('scripts')
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$.ajaxSetup({headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'}});
|
$.ajaxSetup({
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
@if(Session::has('growl'))
|
@if (Session::has('growl'))
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
@if(is_array(Session::get('growl')))
|
@if (is_array(Session::get('growl')))
|
||||||
growl("{!! Session::get('growl')[0] !!}", "{{ Session::get('growl')[1] }}");
|
growl("{!! Session::get('growl')[0] !!}", "{{ Session::get('growl')[1] }}");
|
||||||
@else
|
@else
|
||||||
growl("{{Session::get('growl')}}");
|
growl("{{ Session::get('growl') }}");
|
||||||
@endif
|
@endif
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -5,11 +5,11 @@
|
|||||||
<span class="green ml-3">Variétés Paysannes de la Semence à l'Assiette</span>
|
<span class="green ml-3">Variétés Paysannes de la Semence à l'Assiette</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-12 col-lg-3 pt-2">
|
<div class="col-sm-12 col-lg-4 pt-2">
|
||||||
@include('Shop.layout.partials.search')
|
@include('Shop.layout.partials.search')
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-12 col-lg-4 pt-2 text-right">
|
<div class="col-sm-12 col-lg-3 pt-2 text-right">
|
||||||
@include('Shop.layout.partials.header-catalog')
|
@include('Shop.layout.partials.header-catalog')
|
||||||
@include('Shop.layout.partials.header-profile')
|
@include('Shop.layout.partials.header-profile')
|
||||||
@include('Shop.layout.partials.header-basket')
|
@include('Shop.layout.partials.header-basket')
|
||||||
|
|||||||
@@ -1,18 +1,26 @@
|
|||||||
<form method="method" action="{{ route('Shop.Searches.search') }}" id="search-general">
|
<form method="method" action="{{ route('Shop.Searches.search') }}" id="search-general">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" name="search" value="{{ $search['search'] ?? null }}" class="form-control search-btn" aria-label="Chercher">
|
@include('components.form.autocomplete', [
|
||||||
<div class="input-group-append">
|
'name' => 'search',
|
||||||
<span class="input-group-text"><i class="btn btn-sm fa fa-search"></i></span>
|
'url' => route('Admin.Shop.Articles.autocomplete'),
|
||||||
</div>
|
'data' => [
|
||||||
</div>
|
'name' => $search['search_name'] ?? '',
|
||||||
|
],
|
||||||
|
])
|
||||||
|
<div class="input-group-append">
|
||||||
|
<span class="input-group-text"><i class="btn btn-sm fa fa-search"></i></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@push('js')
|
@push('js')
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
$('#search-general .fa-search').click(function() {
|
$('#search-general .fa-search').click(function() {
|
||||||
$('#search-general').submit();
|
$('#search-general').submit();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
</script>
|
initAutocomplete('#search_name');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
@include('load.form.autocomplete')
|
@include('load.form.autocomplete')
|
||||||
|
|
||||||
<input type="hidden" name="{{ $name }}_id" id="{{ $name }}_id" value="{{ $data[$name . '_id'] ?? null }}">
|
<input type="hidden" name="{{ $name }}_id" id="{{ $name }}_id" value="{{ $data[$name . '_id'] ?? null }}">
|
||||||
<input type="text" name="{{ $name }}_name" class="form-control autocomplete" value="{{ $data['name'] ?? ''}}" data-url="{{ $url ?? ''}}" data-field="{{ $name }}_id" autocomplete="off">
|
<input type="text" name="{{ $name }}_name" id="{{ $name }}_name" class="form-control autocomplete"
|
||||||
|
value="{{ $data['name'] ?? '' }}" data-url="{{ $url ?? '' }}" data-field="{{ $name }}_id"
|
||||||
|
autocomplete="off">
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
<button type="{{ $type ?? 'button' }}" class="btn {{ $class ?? ''}}"
|
@if ($url ?? false)
|
||||||
|
<a href="{{ $url }}">
|
||||||
|
@endif
|
||||||
|
<button type="{{ $type ?? 'button' }}" class="btn {{ $class ?? '' }}"
|
||||||
@isset($style) style="{{ $style }}" @endisset
|
@isset($style) style="{{ $style }}" @endisset
|
||||||
@isset($id) id="{{ $id }}" @endisset
|
@isset($id) id="{{ $id }}" @endisset
|
||||||
@isset($data_id) data-id="{{ $data_id }}" @endisset
|
@isset($data_id) data-id="{{ $data_id }}" @endisset
|
||||||
@isset($dataId) data-id="{{ $dataId }}" @endisset
|
@isset($dataId) data-id="{{ $dataId }}" @endisset
|
||||||
@isset($title) title="{{ $title }}" data-toggle="tooltip" @endisset
|
@isset($title) title="{{ $title }}" data-toggle="tooltip" @endisset
|
||||||
@isset($loading_text) data-loading-text="{{ $loading_text }}" @endisset
|
@isset($loading_text) data-loading-text="{{ $loading_text }}" @endisset
|
||||||
@isset($loadingText) data-loading-text="{{ $loadingText }}" @endisset
|
@isset($loadingText) data-loading-text="{{ $loadingText }}" @endisset
|
||||||
@isset($tooltip) data-toggle="tooltip" data-tooltip="{{ $tooltip }}" @endisset
|
@isset($tooltip) data-toggle="tooltip" data-tooltip="{{ $tooltip }}" @endisset
|
||||||
@isset($popover) data-toggle="popover" data-content="{{ $popover }}" @endisset
|
@isset($popover) data-toggle="popover" data-content="{{ $popover }}" @endisset
|
||||||
@@ -12,8 +15,10 @@
|
|||||||
@isset($trigger) data-trigger="{{ $trigger }}" @endisset
|
@isset($trigger) data-trigger="{{ $trigger }}" @endisset
|
||||||
@isset($container) data-container="{{ $container }}" @endisset
|
@isset($container) data-container="{{ $container }}" @endisset
|
||||||
@isset($html) data-html="true" @endisset
|
@isset($html) data-html="true" @endisset
|
||||||
@isset($metadata) {{ $metadata }} @endisset
|
@isset($metadata) {{ $metadata }} @endisset>
|
||||||
>
|
<i class="fa fa-fw {{ $icon ?? '' }}"></i>
|
||||||
<i class="fa fa-fw {{ $icon ?? '' }}"></i>
|
{{ $txt ?? '' }}
|
||||||
{{ $txt ?? '' }}
|
|
||||||
</button>
|
</button>
|
||||||
|
@if ($url ?? false)
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
|||||||
5
resources/views/components/form/buttons/add.blade.php
Normal file
5
resources/views/components/form/buttons/add.blade.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
@include('components.form.button', [
|
||||||
|
'class' => 'btn-primary ' . ($class ?? ''),
|
||||||
|
'icon' => 'fa-plus',
|
||||||
|
'title' => $title ?? 'Ajouter',
|
||||||
|
])
|
||||||
17
resources/views/components/form/buttons/cancel.blade.php
Normal file
17
resources/views/components/form/buttons/cancel.blade.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
@include('components.form.button', [
|
||||||
|
'class' => 'btn-secondary cancel ' . ($class ?? ''),
|
||||||
|
'icon' => 'fa-times',
|
||||||
|
'txt' => $title ?? 'Annuler',
|
||||||
|
])
|
||||||
|
|
||||||
|
@push('js')
|
||||||
|
<script>
|
||||||
|
$('.form-buttons .cancel').click(function() {
|
||||||
|
@if (isset($url))
|
||||||
|
window.location = "{{ $url }}";
|
||||||
|
@else
|
||||||
|
window.history.back();
|
||||||
|
@endif
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
6
resources/views/components/form/buttons/delete.blade.php
Normal file
6
resources/views/components/form/buttons/delete.blade.php
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
@include('components.form.button', [
|
||||||
|
'class' => 'btn-danger btn-del ' . ($class ?? ''),
|
||||||
|
'icon' => $icon ?? 'fa-trash-alt',
|
||||||
|
'title' => $title ?? 'Effacer',
|
||||||
|
'loading_text' => "<i class='fa fa-circle-o-notch fa-spin'></i>",
|
||||||
|
])
|
||||||
5
resources/views/components/form/buttons/edit.blade.php
Normal file
5
resources/views/components/form/buttons/edit.blade.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
@include('components.form.button', [
|
||||||
|
'class' => 'btn-primary btn-edit ' . ($class ?? ''),
|
||||||
|
'icon' => 'fa-pencil-alt',
|
||||||
|
'title' => $title ?? 'Modifier',
|
||||||
|
])
|
||||||
6
resources/views/components/form/buttons/save.blade.php
Normal file
6
resources/views/components/form/buttons/save.blade.php
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
@include('components.form.button', [
|
||||||
|
'class' => 'btn-success save ' . ($class ?? ''),
|
||||||
|
'icon' => 'fa-save',
|
||||||
|
'txt' => $title ?? 'Enregister',
|
||||||
|
'loading_text' => "<i class='fa fa-spinner fa-spin'></i> En cours",
|
||||||
|
])
|
||||||
5
resources/views/components/form/buttons/show.blade.php
Normal file
5
resources/views/components/form/buttons/show.blade.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
@include('components.form.button', [
|
||||||
|
'class' => 'btn-secondary btn-show ' . ($class ?? ''),
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'title' => $title ?? 'Voir',
|
||||||
|
])
|
||||||
8
resources/views/components/form/buttons/submit.blade.php
Normal file
8
resources/views/components/form/buttons/submit.blade.php
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
@include('components.form.button', [
|
||||||
|
'id' => $id_name ?? false,
|
||||||
|
'type' => $type ?? 'submit',
|
||||||
|
'class' => 'btn-success submit ' . ($class ?? ''),
|
||||||
|
'icon' => 'fa-save',
|
||||||
|
'txt' => __('submit'),
|
||||||
|
'loading_text' => "<i class='fa fa-spinner fa-spin'></i> Processing",
|
||||||
|
])
|
||||||
@@ -1,23 +1,25 @@
|
|||||||
@if(!defined('LOAD_AUTOCOMPLETE'))
|
@if (!defined('LOAD_AUTOCOMPLETE'))
|
||||||
@push('js')
|
@push('js')
|
||||||
<script src="{{ asset('/assets/plugins/autocomplete/bootstrap-autocomplete.min.js') }}"></script>
|
<script src="{{ asset('/assets/plugins/autocomplete/bootstrap-autocomplete.min.js') }}"></script>
|
||||||
<script>
|
<script>
|
||||||
function initAutocomplete(sel, callback) {
|
function initAutocomplete(sel, callback) {
|
||||||
var selector = (typeof(sel) == 'undefined') ? '.autocomplete' : sel;
|
var selector = (typeof(sel) == 'undefined') ? '.autocomplete' : sel;
|
||||||
$(selector).autoComplete();
|
$(selector).autoComplete({
|
||||||
|
noResultsText: ''
|
||||||
|
});
|
||||||
|
|
||||||
$(selector).on('autocomplete.select', function(evt, item) {
|
$(selector).on('autocomplete.select', function(evt, item) {
|
||||||
var field = $(this).data('field');
|
var field = $(this).data('field');
|
||||||
var id = item.value;
|
var id = item.value;
|
||||||
$('#'+field).val(id);
|
$('#' + field).val(id);
|
||||||
|
|
||||||
if (typeof(callback) != 'undefined') {
|
if (typeof(callback) != 'undefined') {
|
||||||
var c = callback + '(' + id + ')';
|
var c = callback + '(' + id + ')';
|
||||||
eval(c);
|
eval(c);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
@php(define('LOAD_AUTOCOMPLETE', true))
|
@php(define('LOAD_AUTOCOMPLETE', true))
|
||||||
@endif
|
@endif
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Route::prefix('Clients')->name('Customers.')->group(function () {
|
Route::prefix('Clients')->name('Customers.')->group(function () {
|
||||||
Route::get('show/{id}', 'CustomerController@show')->name('show');
|
Route::get('show/{id}', 'CustomerController@show')->name('show');
|
||||||
Route::get('profile/{id?}', 'CustomerController@profile')->name('profile');
|
Route::get('profile', 'CustomerController@profile')->name('profile');
|
||||||
Route::get('modalProfile/{id?}', 'CustomerController@modalProfile')->name('modalProfile');
|
Route::get('modalProfile/{id?}', 'CustomerController@modalProfile')->name('modalProfile');
|
||||||
Route::get('edit', 'CustomerController@edit')->name('edit');
|
Route::get('edit', 'CustomerController@edit')->name('edit');
|
||||||
Route::post('storeProfileAjax', 'CustomerController@storeProfileAjax')->name('storeProfileAjax');
|
Route::post('storeProfileAjax', 'CustomerController@storeProfileAjax')->name('storeProfileAjax');
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
Route::prefix('Factures')->name('Invoices.')->group(function () {
|
Route::prefix('Factures')->name('Invoices.')->group(function () {
|
||||||
Route::get('show/{uuid?}', 'InvoiceController@show')->name('show');
|
Route::any('', 'InvoiceController@index')->name('index');
|
||||||
|
Route::get('view/{uuid?}', 'InvoiceController@view')->name('view');
|
||||||
Route::get('pdf/{uuid?}', 'InvoiceController@pdf')->name('pdf');
|
Route::get('pdf/{uuid?}', 'InvoiceController@pdf')->name('pdf');
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user