better management of shipping and basket summary display

This commit is contained in:
ludo
2023-12-03 00:40:47 +01:00
parent a84995e0ce
commit 5d5ea92127
26 changed files with 317 additions and 477 deletions

View File

@@ -2,7 +2,7 @@
namespace App\Http\Controllers\Admin\Shop;
use App\Datatables\Shop\PriceListsDataTable;
use App\Datatables\Admin\Shop\PriceListsDataTable;
use App\Http\Controllers\Controller;
use App\Repositories\Shop\PriceLists;
use App\Repositories\Shop\SaleChannels;
@@ -14,45 +14,20 @@ class PriceListController extends Controller
{
public function index(PriceListsDataTable $dataTable)
{
$data = [];
return $dataTable->render('Admin.Shop.PriceLists.list', $data);
return $dataTable->render('Admin.Shop.PriceLists.list');
}
public function create()
public function modalCreate($tariffId)
{
$data = [];
$data['sale_channels'] = SaleChannels::getOptions();
return view('Admin.Shop.PriceLists.create', $data);
}
public function edit($id)
{
$data['price_list'] = PriceLists::get($id);
$data['sale_channels'] = SaleChannels::getOptions();
return view('Admin.Shop.PriceLists.edit', $data);
}
public function modalCreate($tariff_id)
{
$data = [];
$data['price_list']['tariff_id'] = $tariff_id;
$data['price_list']['price_list_values'] = array_fill(0, 3, '');
$data['sale_channels'] = SaleChannels::getOptions();
$data['statuses'] = Tariffs::getStatuses();
$data['taxes'] = Taxes::getOptions();
$data = PriceLists::init($tariffId);
return view('Admin.Shop.PriceLists.modal', $data);
}
public function modalEdit($id)
{
$data = PriceLists::init();
$data['price_list'] = PriceLists::edit($id);
$data['sale_channels'] = SaleChannels::getOptions();
$data['statuses'] = Tariffs::getStatuses();
$data['taxes'] = Taxes::getOptions();
return view('Admin.Shop.PriceLists.modal', $data);
}

View File

@@ -25,32 +25,22 @@ class TariffController extends Controller
public function create()
{
$data['sale_channels'] = SaleChannels::getOptions();
$data['statuses'] = Tariffs::getStatuses();
$data['tariff_unities'] = TariffUnities::getOptions();
$model = new PriceListsDataTable();
$data['datatables']['price_lists'] = $model->html();
$data = Tariffs::init();
return view('Admin.Shop.Tariffs.create', $data);
}
public function show($id)
{
$data['tariff'] = Tariffs::getFull($id);
$data['tariff'] = Tariffs::getArray($id);
return view('Admin.Shop.Tariffs.view', $data);
}
public function edit($id)
{
$data = Tariffs::init();
$data['tariff'] = Tariffs::get($id);
$data['sale_channels'] = SaleChannels::getOptions();
$data['statuses'] = Tariffs::getStatuses();
$data['tariff_unities'] = TariffUnities::getOptions();
$model = new PriceListsDataTable();
$data['datatables']['price_lists'] = $model->html();
return view('Admin.Shop.Tariffs.edit', $data);
}

View File

@@ -5,8 +5,7 @@ namespace App\Http\Controllers\Shop;
use App\Http\Controllers\Controller;
use App\Repositories\Core\User\ShopCart;
use App\Repositories\Shop\Baskets;
use App\Repositories\Shop\Deliveries;
use App\Repositories\Shop\DeliveryTypes;
use App\Repositories\Shop\Customers;
use App\Repositories\Shop\Offers;
use App\Repositories\Shop\Orders;
use App\Repositories\Users;
@@ -67,7 +66,7 @@ class BasketController extends Controller
public function getBasketTotal($deliveryId = false, $deliveryTypeId = false)
{
$data['basket'] = Baskets::getBasketTotal($deliveryId, $deliveryTypeId);
return view('Shop.Baskets.partials.basketTotal', $data);
}