StocksNew/Modules/Order/app/Http/Controllers/OrderController.php
Sampanna Rimal afb2c202d6 changes
2024-09-11 12:32:15 +05:45

107 lines
2.5 KiB
PHP

<?php
namespace Modules\Order\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Modules\Customer\Repositories\CustomerInterface;
use Modules\Product\Repositories\ProductInterface;
use Modules\Supplier\Repositories\SupplierInterface;
class OrderController extends Controller
{
private $supplierRepository;
private $productRepository;
private $customerRepository;
public function __construct(SupplierInterface $supplierRepository, ProductInterface $productRepository, CustomerInterface $customerRepository )
{
$this->supplierRepository = $supplierRepository;
$this->productRepository = $productRepository;
$this->customerRepository = $customerRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Order List';
$data['orders'] = [];
return view('order::order.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Order';
$data['productList'] = $this->productRepository->pluck();
$data['supplierList'] = $this->supplierRepository->pluck();
$data['customerList'] = $this->customerRepository->pluck();
return view('order::order.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
//
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('order::order.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
return view('order::order.edit');
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
public function cloneProduct(Request $request)
{
$data = [];
$numInc = $request->numberInc;
$script = true;
$productList= $this->productRepository->pluck('id');
dd($productList);
return response()->json([
'view' => view('order::order.clone-product', compact('data', 'numInc', 'script', 'productList'))->render(),
]);
}
}