69 lines
1.9 KiB
PHP
69 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Shop\Admin;
|
|
|
|
use Illuminate\Http\Request;
|
|
use App\Http\Controllers\Controller;
|
|
|
|
use App\Models\Shop\PriceGeneric;
|
|
use App\Repositories\Shop\PriceGenerics;
|
|
use App\Repositories\Shop\PriceGenericCategories;
|
|
use App\Repositories\Shop\Taxes;
|
|
use App\Repositories\Shop\Packages;
|
|
use App\Repositories\Shop\Unities;
|
|
use App\DataTables\Shop\PriceGenericsDataTable;
|
|
|
|
class PriceGenericController extends Controller
|
|
{
|
|
public function index(PriceGenericsDataTable $dataTable)
|
|
{
|
|
$data['categories'] = PriceGenericCategories::getOptions();
|
|
return $dataTable->render('Shop.Admin.PriceGenerics.list', $data);
|
|
}
|
|
|
|
public function getDatatable(Request $request)
|
|
{
|
|
return PriceGenerics::getTables($request->all());
|
|
}
|
|
|
|
public function create()
|
|
{
|
|
$data['unities'] = Unities::getOptions();
|
|
$data['taxes_options'] = Taxes::getOptions();
|
|
$data['categories'] = PriceGenericCategories::getOptions();
|
|
return view('Shop.Admin.PriceGenerics.create',$data);
|
|
}
|
|
|
|
public function edit($id)
|
|
{
|
|
$data['generic'] = PriceGenerics::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'] = PriceGenericCategories::getOptions();
|
|
return view('Shop.Admin.PriceGenerics.edit', $data);
|
|
}
|
|
|
|
public function store(Request $request)
|
|
{
|
|
$ret = PriceGenerics::store($request->all());
|
|
return redirect()->route('Shop.Admin.PriceGenerics.index');
|
|
}
|
|
|
|
public function show($id)
|
|
{
|
|
$data = PriceGenerics::get($id);
|
|
return view('Shop.Admin.PriceGenerics.view', $data);
|
|
}
|
|
|
|
public function destroy($id)
|
|
{
|
|
return PriceGenerics::destroy($id);
|
|
}
|
|
|
|
public function getPrice($id) {
|
|
$data['generic'] = PriceGenerics::getFull($id);
|
|
return view('Shop.Admin.PriceGenerics.partials.table-prices', $data);
|
|
}
|
|
}
|