This commit is contained in:
Sampanna Rimal
2024-09-11 12:32:15 +05:45
parent 82fab174dc
commit afb2c202d6
170 changed files with 3352 additions and 363 deletions

View File

@ -5,8 +5,10 @@ namespace Modules\Product\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Modules\Product\Models\FabricCategory;
use Modules\Product\Models\Product;
use Modules\Product\Repositories\CategoryRepository;
use Modules\Product\Repositories\FabricCategoryRepository;
use Modules\Product\Repositories\ProductInterface;
use Modules\Product\Repositories\ProductRepository;
use Modules\Product\Repositories\SubCategoryRepository;
@ -19,6 +21,7 @@ class ProductController extends Controller
private $productRepository;
private $categoryRepository;
private $subCategoryRepository;
private $fabricCategoryRepository;
private $warehouseRepository;
private $supplierRepository;
@ -29,11 +32,13 @@ class ProductController extends Controller
CategoryRepository $categoryRepository,
SubCategoryRepository $subCategoryRepository,
SupplierRepository $supplierRepository,
FabricCategoryRepository $fabricCategoryRepository,
WarehouseRepository $warehouseRepository)
{
$this->productRepository = $productRepository;
$this->categoryRepository = $categoryRepository;
$this->subCategoryRepository = $subCategoryRepository;
$this->fabricCategoryRepository = $fabricCategoryRepository;
$this->supplierRepository = $supplierRepository;
$this->warehouseRepository = $warehouseRepository;
}
@ -52,6 +57,7 @@ class ProductController extends Controller
{
$data['title'] = 'Create Product';
$data['category'] = $this->categoryRepository->pluck();
$data['fabricCategory'] = $this->fabricCategoryRepository->pluck();
$data['subCategory'] = $this->subCategoryRepository->pluck();
$data['supplier'] = $this->supplierRepository->pluck();
$data['warehouse'] = $this->warehouseRepository->pluck();
@ -92,6 +98,7 @@ class ProductController extends Controller
$data['title'] = 'Show Product';
$data['category'] = $this->categoryRepository->pluck();
$data['subCategory'] = $this->subCategoryRepository->pluck();
$data['fabricCategory'] = $this->fabricCategoryRepository->pluck();
$data['supplier'] = $this->supplierRepository->pluck();
$data['warehouse'] = $this->warehouseRepository->pluck();
$data['product'] = $this->productRepository->getProductById($id);
@ -127,4 +134,18 @@ class ProductController extends Controller
return response()->json(['status' => true, 'message' => 'Product Delete Succesfully']);
}
public function getProductDetail(Request $request)
{
try {
$productModel = $this->productRepository->getProductById($request->id);
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return response()->json([
'status' => true,
'data' => $productModel,
]);
}
}