first commit
This commit is contained in:
0
Modules/Product/app/Http/Controllers/.gitkeep
Normal file
0
Modules/Product/app/Http/Controllers/.gitkeep
Normal file
105
Modules/Product/app/Http/Controllers/CategoryController.php
Normal file
105
Modules/Product/app/Http/Controllers/CategoryController.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Product\Models\Category;
|
||||
use Modules\Product\Repositories\CategoryRepository;
|
||||
|
||||
class CategoryController extends Controller
|
||||
{
|
||||
private $categoryRepository;
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function __construct(
|
||||
CategoryRepository $categoryRepository) {
|
||||
$this->categoryRepository = $categoryRepository;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Categories List';
|
||||
$data['categories'] = $this->categoryRepository->findAll();
|
||||
return view('product::category.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Category';
|
||||
$data['status'] = Category::STATUS;
|
||||
|
||||
return view('product::category.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$request->request->add(['slug' => slugify($request->title)]);
|
||||
$inputData = $request->all();
|
||||
$this->categoryRepository->create($inputData);
|
||||
toastr()->success('Category Created Succesfully');
|
||||
|
||||
return redirect()->route('category.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$data['title'] = 'Show Category';
|
||||
$data['status'] = Category::STATUS;
|
||||
$data['category'] = $this->categoryRepository->getCategoryById($id);
|
||||
|
||||
return view('product::category.show', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Category';
|
||||
$data['status'] = Category::STATUS;
|
||||
|
||||
$data['category'] = $this->categoryRepository->getCategoryById($id);
|
||||
|
||||
return view('product::category.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$inputData = $request->except(['_method', '_token']);
|
||||
$this->categoryRepository->update($id, $inputData);
|
||||
|
||||
return redirect()->route('category.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$CategoryModel = $this->categoryRepository->getCategoryById($id);
|
||||
$CategoryModel->delete();
|
||||
|
||||
toastr()->success('Product Delete Succesfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['status' => true, 'message' => 'Category Delete Succesfully']);
|
||||
}
|
||||
}
|
130
Modules/Product/app/Http/Controllers/ProductController.php
Normal file
130
Modules/Product/app/Http/Controllers/ProductController.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Product\Models\Product;
|
||||
use Modules\Product\Repositories\CategoryRepository;
|
||||
use Modules\Product\Repositories\ProductInterface;
|
||||
use Modules\Product\Repositories\ProductRepository;
|
||||
use Modules\Product\Repositories\SubCategoryRepository;
|
||||
use Modules\Product\Repositories\WarehouseRepository;
|
||||
use Modules\Supplier\Models\Supplier;
|
||||
use Modules\Supplier\Repositories\SupplierRepository;
|
||||
|
||||
class ProductController extends Controller
|
||||
{
|
||||
private $productRepository;
|
||||
private $categoryRepository;
|
||||
private $subCategoryRepository;
|
||||
private $warehouseRepository;
|
||||
private $supplierRepository;
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function __construct(ProductRepository $productRepository,
|
||||
CategoryRepository $categoryRepository,
|
||||
SubCategoryRepository $subCategoryRepository,
|
||||
SupplierRepository $supplierRepository,
|
||||
WarehouseRepository $warehouseRepository)
|
||||
{
|
||||
$this->productRepository = $productRepository;
|
||||
$this->categoryRepository = $categoryRepository;
|
||||
$this->subCategoryRepository = $subCategoryRepository;
|
||||
$this->supplierRepository = $supplierRepository;
|
||||
$this->warehouseRepository = $warehouseRepository;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = "Product Lists";
|
||||
$data['products'] = $this->productRepository->findAll();
|
||||
return view('product::product.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Product';
|
||||
$data['category'] = $this->categoryRepository->pluck();
|
||||
$data['subCategory'] = $this->subCategoryRepository->pluck();
|
||||
$data['supplier'] = $this->supplierRepository->pluck();
|
||||
$data['warehouse'] = $this->warehouseRepository->pluck();
|
||||
$data['status'] = Product::STATUS;
|
||||
|
||||
return view('product::product.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$inputData = $request->all();
|
||||
$this->productRepository->create($inputData);
|
||||
toastr()->success('Product Created Succesfully');
|
||||
|
||||
return redirect()->route('product.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$data['title'] = 'Show Product';
|
||||
$data['product'] = $this->productRepository->getProductById($id);
|
||||
$data['status'] = Product::STATUS;
|
||||
|
||||
return view('product::product.show', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Show Product';
|
||||
$data['category'] = $this->categoryRepository->pluck();
|
||||
$data['subCategory'] = $this->subCategoryRepository->pluck();
|
||||
$data['supplier'] = $this->supplierRepository->pluck();
|
||||
$data['warehouse'] = $this->warehouseRepository->pluck();
|
||||
$data['product'] = $this->productRepository->getProductById($id);
|
||||
$data['status'] = Product::STATUS;
|
||||
|
||||
return view('product::product.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$inputData = $request->except(['_method', '_token']);
|
||||
$this->productRepository->update($id, $inputData);
|
||||
|
||||
return redirect()->route('product.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$ProductModel = $this->productRepository->getProductById($id);
|
||||
$ProductModel->delete();
|
||||
|
||||
toastr()->success('Product Delete Succesfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['status' => true, 'message' => 'Product Delete Succesfully']);
|
||||
}
|
||||
}
|
124
Modules/Product/app/Http/Controllers/SubCategoryController.php
Normal file
124
Modules/Product/app/Http/Controllers/SubCategoryController.php
Normal file
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Product\Models\SubCategory;
|
||||
use Modules\Product\Repositories\CategoryRepository;
|
||||
use Modules\Product\Repositories\SubCategoryRepository;
|
||||
|
||||
class SubCategoryController extends Controller
|
||||
{
|
||||
private $subCategoryRepository;
|
||||
private $categoryRepository;
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function __construct(
|
||||
SubCategoryRepository $subCategoryRepository,
|
||||
CategoryRepository $categoryRepository)
|
||||
{
|
||||
$this->subCategoryRepository = $subCategoryRepository;
|
||||
$this->categoryRepository = $categoryRepository;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Sub Categories List';
|
||||
$data['sub_categories'] = $this->subCategoryRepository->findAll();
|
||||
|
||||
return view('product::sub_category.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Sub Categories';
|
||||
$data['status'] = SubCategory::STATUS;
|
||||
$data['category'] = $this->categoryRepository->pluck();
|
||||
|
||||
return view('product::sub_category.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
|
||||
$request->request->add(['slug' => slugify($request->title)]);
|
||||
$inputData = $request->all();
|
||||
$this->subCategoryRepository->create($inputData);
|
||||
toastr()->success('Category Created Succesfully');
|
||||
|
||||
return redirect()->route('subCategory.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$data['title'] = 'Show Category';
|
||||
$data['status'] = SubCategory::STATUS;
|
||||
$data['sub_category'] = $this->subCategoryRepository->getSubCategoryById($id);
|
||||
|
||||
return view('product::sub_category.show', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Category';
|
||||
$data['status'] = SubCategory::STATUS;
|
||||
$data['category'] = $this->categoryRepository->pluck();
|
||||
$data['sub_category'] = $this->subCategoryRepository->getSubCategoryById($id);
|
||||
|
||||
return view('product::sub_category.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$inputData = $request->except(['_method', '_token']);
|
||||
$this->subCategoryRepository->update($id, $inputData);
|
||||
|
||||
return redirect()->route('subCategory.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$SubCategoryModel = $this->subCategoryRepository->getSubCategoryById($id);
|
||||
$SubCategoryModel->delete();
|
||||
|
||||
toastr()->success('Sub Category Delete Succesfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['status' => true, 'message' => 'Sub Category Delete Succesfully']);
|
||||
}
|
||||
|
||||
public function getSubCategories(Request $request)
|
||||
{
|
||||
$category_id = $request->category_id;
|
||||
$subcategories = SubCategory::where('category_id',$category_id)->get();
|
||||
return response()->json(['status'=>200, 'message'=>$subcategories]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
103
Modules/Product/app/Http/Controllers/WarehouseController.php
Normal file
103
Modules/Product/app/Http/Controllers/WarehouseController.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Product\Models\Warehouse;
|
||||
use Modules\Product\Repositories\WarehouseRepository;
|
||||
|
||||
class WarehouseController extends Controller
|
||||
{
|
||||
private $warehouseRepository;
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function __construct(WarehouseRepository $warehouseRepository)
|
||||
{
|
||||
$this->warehouseRepository = $warehouseRepository;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'WareHouse List';
|
||||
$data['warehouses'] = $this->warehouseRepository->findAll();
|
||||
|
||||
return view('product::warehouse.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Warehouse';
|
||||
$data['status'] = Warehouse::STATUS;
|
||||
return view('product::warehouse.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$inputData = $request->all();
|
||||
$this->warehouseRepository->create($inputData);
|
||||
toastr()->success('Warehouse Created Succesfully');
|
||||
|
||||
return redirect()->route('warehouse.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$data['title'] = 'Show Warehouse';
|
||||
$data['warehouse'] = $this->warehouseRepository->getWarehouseById($id);
|
||||
$data['status'] = Warehouse::STATUS;
|
||||
|
||||
return view('product::warehouse.show', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Category';
|
||||
$data['warehouse'] = $this->warehouseRepository->getWarehouseById($id);
|
||||
$data['status'] = Warehouse::STATUS;
|
||||
|
||||
return view('product::warehouse.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$inputData = $request->except(['_method', '_token']);
|
||||
$this->warehouseRepository->update($id, $inputData);
|
||||
|
||||
return redirect()->route('warehouse.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$WarehouseModel = $this->warehouseRepository->getWarehouseById($id);
|
||||
$WarehouseModel->delete();
|
||||
|
||||
toastr()->success('Warehouse Delete Succesfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['status' => true, 'message' => 'Warehouse Delete Succesfully']);
|
||||
}
|
||||
}
|
0
Modules/Product/app/Http/Requests/.gitkeep
Normal file
0
Modules/Product/app/Http/Requests/.gitkeep
Normal file
16
Modules/Product/app/Models/Category.php
Normal file
16
Modules/Product/app/Models/Category.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Models;
|
||||
|
||||
use App\Traits\StatusTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Category extends Model
|
||||
{
|
||||
USE StatusTrait;
|
||||
|
||||
protected $table = 'tbl_categories';
|
||||
protected $guarded = [];
|
||||
protected $appends = ['status_name'];
|
||||
|
||||
}
|
36
Modules/Product/app/Models/Product.php
Normal file
36
Modules/Product/app/Models/Product.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Models;
|
||||
|
||||
use App\Traits\StatusTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Modules\Supplier\Models\Supplier;
|
||||
|
||||
class Product extends Model
|
||||
{
|
||||
USE StatusTrait;
|
||||
|
||||
protected $table = 'tbl_products';
|
||||
protected $guarded = [];
|
||||
protected $appends = ['status_name'];
|
||||
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(Category::class, 'category_id');
|
||||
}
|
||||
|
||||
public function subCategory()
|
||||
{
|
||||
return $this->belongsTo(SubCategory::class, 'sub_category_id');
|
||||
}
|
||||
|
||||
public function warehouse()
|
||||
{
|
||||
return $this->belongsTo(Warehouse::class, 'warehouse_id');
|
||||
}
|
||||
public function supplier()
|
||||
{
|
||||
return $this->belongsTo(Supplier::class, 'supplier_id');
|
||||
}
|
||||
}
|
11
Modules/Product/app/Models/ProductStock.php
Normal file
11
Modules/Product/app/Models/ProductStock.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProductStock extends Model
|
||||
{
|
||||
protected $table = 'tbl_product_stocks';
|
||||
protected $guarded = [];
|
||||
}
|
21
Modules/Product/app/Models/SubCategory.php
Normal file
21
Modules/Product/app/Models/SubCategory.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Models;
|
||||
|
||||
use App\Traits\StatusTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SubCategory extends Model
|
||||
{
|
||||
USE StatusTrait;
|
||||
protected $table = 'tbl_sub_categories';
|
||||
protected $guarded = [];
|
||||
protected $appends = ['status_name'];
|
||||
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(Category::class, 'category_id');
|
||||
}
|
||||
|
||||
}
|
15
Modules/Product/app/Models/Warehouse.php
Normal file
15
Modules/Product/app/Models/Warehouse.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Models;
|
||||
|
||||
use App\Traits\StatusTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Warehouse extends Model
|
||||
{
|
||||
USE StatusTrait;
|
||||
protected $table = 'tbl_warehouses';
|
||||
protected $guarded = [];
|
||||
protected $appends = ['status_name'];
|
||||
|
||||
}
|
0
Modules/Product/app/Observers/.gitkeep
Normal file
0
Modules/Product/app/Observers/.gitkeep
Normal file
0
Modules/Product/app/Providers/.gitkeep
Normal file
0
Modules/Product/app/Providers/.gitkeep
Normal file
117
Modules/Product/app/Providers/ProductServiceProvider.php
Normal file
117
Modules/Product/app/Providers/ProductServiceProvider.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Product\Repositories\ProductInterface;
|
||||
use Modules\Product\Repositories\ProductRepository;
|
||||
|
||||
class ProductServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'Product';
|
||||
|
||||
protected string $moduleNameLower = 'product';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerCommands();
|
||||
$this->registerCommandSchedules();
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->bind(ProductInterface::class,ProductRepository::class);
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register commands in the format of Command::class
|
||||
*/
|
||||
protected function registerCommands(): void
|
||||
{
|
||||
// $this->commands([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register command Schedules.
|
||||
*/
|
||||
protected function registerCommandSchedules(): void
|
||||
{
|
||||
// $this->app->booted(function () {
|
||||
// $schedule = $this->app->make(Schedule::class);
|
||||
// $schedule->command('inspire')->hourly();
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*/
|
||||
public function registerTranslations(): void
|
||||
{
|
||||
$langPath = resource_path('lang/modules/'.$this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom($langPath);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*/
|
||||
protected function registerConfig(): void
|
||||
{
|
||||
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config');
|
||||
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*/
|
||||
public function registerViews(): void
|
||||
{
|
||||
$viewPath = resource_path('views/modules/'.$this->moduleNameLower);
|
||||
$sourcePath = module_path($this->moduleName, 'resources/views');
|
||||
|
||||
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
|
||||
$componentNamespace = str_replace('/', '\\', config('modules.namespace').'\\'.$this->moduleName.'\\'.ltrim(config('modules.paths.generator.component-class.path'), config('modules.paths.app_folder','')));
|
||||
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (config('view.paths') as $path) {
|
||||
if (is_dir($path.'/modules/'.$this->moduleNameLower)) {
|
||||
$paths[] = $path.'/modules/'.$this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
|
||||
return $paths;
|
||||
}
|
||||
}
|
49
Modules/Product/app/Providers/RouteServiceProvider.php
Normal file
49
Modules/Product/app/Providers/RouteServiceProvider.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Called before routes are registered.
|
||||
*
|
||||
* Register any model bindings or pattern based filters.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*/
|
||||
public function map(): void
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*/
|
||||
protected function mapWebRoutes(): void
|
||||
{
|
||||
Route::middleware('web')->group(module_path('Product', '/routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*/
|
||||
protected function mapApiRoutes(): void
|
||||
{
|
||||
Route::middleware('api')->prefix('api')->name('api.')->group(module_path('Product', '/routes/api.php'));
|
||||
}
|
||||
}
|
0
Modules/Product/app/Repositories/.gitkeep
Normal file
0
Modules/Product/app/Repositories/.gitkeep
Normal file
15
Modules/Product/app/Repositories/CategoryInterface.php
Normal file
15
Modules/Product/app/Repositories/CategoryInterface.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Repositories;
|
||||
|
||||
interface CategoryInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getCategoryById($CategoryId);
|
||||
public function getCategoryByEmail($email);
|
||||
public function delete($CategoryId);
|
||||
public function create($CategoryDetails);
|
||||
public function update($CategoryId, array $newDetails);
|
||||
public function pluck();
|
||||
|
||||
}
|
46
Modules/Product/app/Repositories/CategoryRepository.php
Normal file
46
Modules/Product/app/Repositories/CategoryRepository.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Repositories;
|
||||
|
||||
use Modules\Product\Models\Category;
|
||||
|
||||
class CategoryRepository implements CategoryInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Category::when(true, function ($query) {
|
||||
|
||||
})->paginate(20);
|
||||
}
|
||||
|
||||
public function getCategoryById($CategoryId)
|
||||
{
|
||||
return Category::findOrFail($CategoryId);
|
||||
}
|
||||
|
||||
public function getCategoryByEmail($email)
|
||||
{
|
||||
return Category::where('email', $email)->first();
|
||||
}
|
||||
|
||||
public function delete($CategoryId)
|
||||
{
|
||||
Category::destroy($CategoryId);
|
||||
}
|
||||
|
||||
public function create($CategoryDetails)
|
||||
{
|
||||
return Category::create($CategoryDetails);
|
||||
}
|
||||
|
||||
public function update($CategoryId, array $newDetails)
|
||||
{
|
||||
return Category::whereId($CategoryId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck()
|
||||
{
|
||||
return Category::pluck('title', 'id');
|
||||
}
|
||||
|
||||
}
|
15
Modules/Product/app/Repositories/ProductInterface.php
Normal file
15
Modules/Product/app/Repositories/ProductInterface.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Repositories;
|
||||
|
||||
interface ProductInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getProductById($ProductId);
|
||||
public function getProductByEmail($email);
|
||||
public function delete($ProductId);
|
||||
public function create($ProductDetails);
|
||||
public function update($ProductId, array $newDetails);
|
||||
public function pluck();
|
||||
|
||||
}
|
46
Modules/Product/app/Repositories/ProductRepository.php
Normal file
46
Modules/Product/app/Repositories/ProductRepository.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Repositories;
|
||||
|
||||
use Modules\Product\Models\Product;
|
||||
|
||||
class ProductRepository implements ProductInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Product::when(true, function ($query) {
|
||||
|
||||
})->paginate(20);
|
||||
}
|
||||
|
||||
public function getProductById($ProductId)
|
||||
{
|
||||
return Product::findOrFail($ProductId);
|
||||
}
|
||||
|
||||
public function getProductByEmail($email)
|
||||
{
|
||||
return Product::where('email', $email)->first();
|
||||
}
|
||||
|
||||
public function delete($ProductId)
|
||||
{
|
||||
Product::destroy($ProductId);
|
||||
}
|
||||
|
||||
public function create($ProductDetails)
|
||||
{
|
||||
return Product::create($ProductDetails);
|
||||
}
|
||||
|
||||
public function update($ProductId, array $newDetails)
|
||||
{
|
||||
return Product::whereId($ProductId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck()
|
||||
{
|
||||
return Product::pluck('name', 'id');
|
||||
}
|
||||
|
||||
}
|
15
Modules/Product/app/Repositories/SubCategoryInterface.php
Normal file
15
Modules/Product/app/Repositories/SubCategoryInterface.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Repositories;
|
||||
|
||||
interface SubCategoryInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getSubCategoryById($SubCategoryId);
|
||||
public function getSubCategoryByEmail($email);
|
||||
public function delete($SubCategoryId);
|
||||
public function create($SubCategoryDetails);
|
||||
public function update($SubCategoryId, array $newDetails);
|
||||
public function pluck();
|
||||
|
||||
}
|
46
Modules/Product/app/Repositories/SubCategoryRepository.php
Normal file
46
Modules/Product/app/Repositories/SubCategoryRepository.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Repositories;
|
||||
|
||||
use Modules\Product\Models\SubCategory;
|
||||
|
||||
class SubCategoryRepository implements SubCategoryInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return SubCategory::when(true, function ($query) {
|
||||
|
||||
})->paginate(20);
|
||||
}
|
||||
|
||||
public function getSubCategoryById($SubCategoryId)
|
||||
{
|
||||
return SubCategory::findOrFail($SubCategoryId);
|
||||
}
|
||||
|
||||
public function getSubCategoryByEmail($email)
|
||||
{
|
||||
return SubCategory::where('email', $email)->first();
|
||||
}
|
||||
|
||||
public function delete($SubCategoryId)
|
||||
{
|
||||
SubCategory::destroy($SubCategoryId);
|
||||
}
|
||||
|
||||
public function create($SubCategoryDetails)
|
||||
{
|
||||
return SubCategory::create($SubCategoryDetails);
|
||||
}
|
||||
|
||||
public function update($SubCategoryId, array $newDetails)
|
||||
{
|
||||
return SubCategory::whereId($SubCategoryId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck()
|
||||
{
|
||||
return SubCategory::pluck('title', 'id');
|
||||
}
|
||||
|
||||
}
|
15
Modules/Product/app/Repositories/WarehouseInterface.php
Normal file
15
Modules/Product/app/Repositories/WarehouseInterface.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Repositories;
|
||||
|
||||
interface WarehouseInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getWarehouseById($WarehouseId);
|
||||
public function getWarehouseByEmail($email);
|
||||
public function delete($WarehouseId);
|
||||
public function create($WarehouseDetails);
|
||||
public function update($WarehouseId, array $newDetails);
|
||||
public function pluck();
|
||||
|
||||
}
|
46
Modules/Product/app/Repositories/WarehouseRepository.php
Normal file
46
Modules/Product/app/Repositories/WarehouseRepository.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\Repositories;
|
||||
|
||||
use Modules\Product\Models\Warehouse;
|
||||
|
||||
class WarehouseRepository implements WarehouseInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Warehouse::when(true, function ($query) {
|
||||
|
||||
})->paginate(20);
|
||||
}
|
||||
|
||||
public function getWarehouseById($WarehouseId)
|
||||
{
|
||||
return Warehouse::findOrFail($WarehouseId);
|
||||
}
|
||||
|
||||
public function getWarehouseByEmail($email)
|
||||
{
|
||||
return Warehouse::where('email', $email)->first();
|
||||
}
|
||||
|
||||
public function delete($WarehouseId)
|
||||
{
|
||||
Warehouse::destroy($WarehouseId);
|
||||
}
|
||||
|
||||
public function create($WarehouseDetails)
|
||||
{
|
||||
return Warehouse::create($WarehouseDetails);
|
||||
}
|
||||
|
||||
public function update($WarehouseId, array $newDetails)
|
||||
{
|
||||
return Warehouse::whereId($WarehouseId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck()
|
||||
{
|
||||
return Warehouse::pluck('title', 'id');
|
||||
}
|
||||
|
||||
}
|
30
Modules/Product/composer.json
Normal file
30
Modules/Product/composer.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "nwidart/product",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Widart",
|
||||
"email": "n.widart@gmail.com"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Product\\": "app/",
|
||||
"Modules\\Product\\Database\\Factories\\": "database/factories/",
|
||||
"Modules\\Product\\Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Modules\\Product\\Tests\\": "tests/"
|
||||
}
|
||||
}
|
||||
}
|
0
Modules/Product/config/.gitkeep
Normal file
0
Modules/Product/config/.gitkeep
Normal file
5
Modules/Product/config/config.php
Normal file
5
Modules/Product/config/config.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Product',
|
||||
];
|
0
Modules/Product/database/factories/.gitkeep
Normal file
0
Modules/Product/database/factories/.gitkeep
Normal file
0
Modules/Product/database/migrations/.gitkeep
Normal file
0
Modules/Product/database/migrations/.gitkeep
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tbl_products', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->longText('desc')->nullable();
|
||||
$table->decimal('price', 10, 2);
|
||||
$table->integer('qty');
|
||||
$table->unsignedBigInteger('category_id')->nullable();
|
||||
$table->unsignedBigInteger('sub_category_id')->nullable();
|
||||
$table->unsignedBigInteger('supplier_id')->nullable();
|
||||
$table->unsignedBigInteger('warehouse_id')->nullable();
|
||||
$table->integer('status')->default(11);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tbl_products');
|
||||
}
|
||||
};
|
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tbl_product_stocks', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('product_id')->nullable();
|
||||
$table->unsignedBigInteger('warehouse_id')->nullable();
|
||||
$table->decimal('qty_available', 10, 2);
|
||||
$table->integer('min_stock_level');
|
||||
$table->integer('max_stock_level');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tbl_product_stocks');
|
||||
}
|
||||
};
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tbl_categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title');
|
||||
$table->string('code')->nullable();
|
||||
$table->string('slug')->nullable();
|
||||
$table->integer('status')->default(11);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tbl_categories');
|
||||
}
|
||||
};
|
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tbl_sub_categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title');
|
||||
$table->string('code')->nullable();
|
||||
$table->string('slug')->nullable();
|
||||
$table->longText('description')->nullable();
|
||||
$table->unsignedBigInteger('category_id')->nullable();
|
||||
$table->integer('status')->default(11);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tbl_sub_categories');
|
||||
}
|
||||
};
|
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tbl_warehouses', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title');
|
||||
$table->integer('capacity')->default(11);
|
||||
$table->string('phone')->nullable();
|
||||
$table->string('email')->nullable();
|
||||
$table->longText('address')->nullable();
|
||||
$table->integer('status')->default(11);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tbl_warehouses');
|
||||
}
|
||||
};
|
0
Modules/Product/database/seeders/.gitkeep
Normal file
0
Modules/Product/database/seeders/.gitkeep
Normal file
16
Modules/Product/database/seeders/ProductDatabaseSeeder.php
Normal file
16
Modules/Product/database/seeders/ProductDatabaseSeeder.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Product\database\seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ProductDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// $this->call([]);
|
||||
}
|
||||
}
|
11
Modules/Product/module.json
Normal file
11
Modules/Product/module.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Product",
|
||||
"alias": "product",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\Product\\Providers\\ProductServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
15
Modules/Product/package.json
Normal file
15
Modules/Product/package.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^1.1.2",
|
||||
"laravel-vite-plugin": "^0.7.5",
|
||||
"sass": "^1.69.5",
|
||||
"postcss": "^8.3.7",
|
||||
"vite": "^4.0.0"
|
||||
}
|
||||
}
|
0
Modules/Product/resources/assets/.gitkeep
Normal file
0
Modules/Product/resources/assets/.gitkeep
Normal file
0
Modules/Product/resources/assets/js/app.js
Normal file
0
Modules/Product/resources/assets/js/app.js
Normal file
0
Modules/Product/resources/assets/sass/app.scss
Normal file
0
Modules/Product/resources/assets/sass/app.scss
Normal file
0
Modules/Product/resources/views/.gitkeep
Normal file
0
Modules/Product/resources/views/.gitkeep
Normal file
18
Modules/Product/resources/views/category/create.blade.php
Normal file
18
Modules/Product/resources/views/category/create.blade.php
Normal file
@@ -0,0 +1,18 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
{{ html()->form('POST')->route('category.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
@include('product::category.partials.action')
|
||||
{{ html()->form()->close() }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
22
Modules/Product/resources/views/category/edit.blade.php
Normal file
22
Modules/Product/resources/views/category/edit.blade.php
Normal file
@@ -0,0 +1,22 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
<!-- end page title -->
|
||||
|
||||
{{ html()->modelForm($category, 'PUT')->route('category.update', $category->id)->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
@include('product::category.partials.action')
|
||||
{{ html()->closeModelForm() }}
|
||||
<!--end row-->
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
71
Modules/Product/resources/views/category/index.blade.php
Normal file
71
Modules/Product/resources/views/category/index.blade.php
Normal file
@@ -0,0 +1,71 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
|
||||
<div class="mb-2 text-end">
|
||||
@can('category.create')
|
||||
<a href="{{ route('category.create') }}" class="btn btn-success btn-md waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Add</a>
|
||||
@endcan
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="buttons-datatables" class="display table-sm table-bordered table" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>S.N</th>
|
||||
<th>Title</th>
|
||||
<th>Code</th>
|
||||
<th>Slug</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($categories as $key => $category)
|
||||
<tr>
|
||||
<td>{{ $key + 1 }}</td>
|
||||
<td>{{ $category->title }}</td>
|
||||
<td>{{ $category->code }}</td>
|
||||
<td>{{ $category->slug }}</td>
|
||||
<td>{!! $category->status_name !!}</td>
|
||||
<td>
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
@can('category.show')
|
||||
<a href="{{ route('category.show', $category->id) }}" class="link-info fs-15">
|
||||
<i class="ri-eye-line"></i>
|
||||
</a>
|
||||
@endcan
|
||||
@can('category.edit')
|
||||
<a href="{{ route('category.edit', $category->id) }}"
|
||||
class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-line"></i></a>
|
||||
@endcan
|
||||
@can('category.destroy')
|
||||
<a href="javascript:void(0);" data-link="{{ route('category.destroy', $category->id) }}"
|
||||
data-id="{{ $category->id }}" class="link-danger fs-15 remove-item-btn"><i
|
||||
class="ri-delete-bin-line"></i></a>
|
||||
@endcan
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end row-->
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@@ -0,0 +1,51 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row gy-1">
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Title')->class('form-label') }}
|
||||
{{ html()->text('title')->class('form-control')->placeholder('Enter Title')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Code')->class('form-label') }}
|
||||
{{ html()->text('code')->class('form-control')->placeholder('Enter Code') }}
|
||||
</div>
|
||||
|
||||
<!-- <div class="col-md-6">
|
||||
{{ html()->label('Slug')->class('form-label') }}
|
||||
{{ html()->text('slug')->class('form-control')->placeholder('Enter Slug') }}
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card -->
|
||||
<div class="mb-3 text-end">
|
||||
<a href="{{ route('category.index') }}" class="btn btn-danger w-sm">Cancel</a>
|
||||
<button type="submit" class="btn btn-success w-sm">Save</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- end col -->
|
||||
<div class="col-lg-4">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title mb-0">Publish</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Status')->class('form-label') }}
|
||||
{{ html()->select('status', $status)->class('form-control')->placeholder('Enter Status')->required() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
</div>
|
||||
</div>
|
49
Modules/Product/resources/views/category/show.blade.php
Normal file
49
Modules/Product/resources/views/category/show.blade.php
Normal file
@@ -0,0 +1,49 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="card card-body p-4">
|
||||
<div>
|
||||
<div class="table-responsive">
|
||||
<table class="table-borderless mb-0 table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Category</span></th>
|
||||
<td>{{ $category->title }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Code</span></th>
|
||||
<td>{{ $category->code }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Slug</span></th>
|
||||
<td>{{ $category->slug }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Status</span></th>
|
||||
<td>{{ $category->status }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 text-end">
|
||||
<a href="{{ route('category.index') }}" class="btn btn-secondary w-sm">Back</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
7
Modules/Product/resources/views/index.blade.php
Normal file
7
Modules/Product/resources/views/index.blade.php
Normal file
@@ -0,0 +1,7 @@
|
||||
@extends('product::layouts.master')
|
||||
|
||||
@section('content')
|
||||
<h1>Hello World</h1>
|
||||
|
||||
<p>Module: {!! config('product.name') !!}</p>
|
||||
@endsection
|
29
Modules/Product/resources/views/layouts/master.blade.php
Normal file
29
Modules/Product/resources/views/layouts/master.blade.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
||||
<title>Product Module - {{ config('app.name', 'Laravel') }}</title>
|
||||
|
||||
<meta name="description" content="{{ $description ?? '' }}">
|
||||
<meta name="keywords" content="{{ $keywords ?? '' }}">
|
||||
<meta name="author" content="{{ $author ?? '' }}">
|
||||
|
||||
<!-- Fonts -->
|
||||
<link rel="preconnect" href="https://fonts.bunny.net">
|
||||
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
|
||||
|
||||
{{-- Vite CSS --}}
|
||||
{{-- {{ module_vite('build-product', 'resources/assets/sass/app.scss') }} --}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@yield('content')
|
||||
|
||||
{{-- Vite JS --}}
|
||||
{{-- {{ module_vite('build-product', 'resources/assets/js/app.js') }} --}}
|
||||
</body>
|
19
Modules/Product/resources/views/product/create.blade.php
Normal file
19
Modules/Product/resources/views/product/create.blade.php
Normal file
@@ -0,0 +1,19 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
{{ html()->form('POST')->route('product.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
|
||||
@include('product::product.partials.action')
|
||||
|
||||
{{ html()->form()->close() }}
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
22
Modules/Product/resources/views/product/edit.blade.php
Normal file
22
Modules/Product/resources/views/product/edit.blade.php
Normal file
@@ -0,0 +1,22 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
<!-- end page title -->
|
||||
|
||||
{{ html()->modelForm($product, 'PUT')->route('product.update', $product->id)->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
@include('product::product.partials.action')
|
||||
{{ html()->closeModelForm() }}
|
||||
<!--end row-->
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
79
Modules/Product/resources/views/product/index.blade.php
Normal file
79
Modules/Product/resources/views/product/index.blade.php
Normal file
@@ -0,0 +1,79 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
|
||||
<div class="mb-2 text-end">
|
||||
@can('product.create')
|
||||
<a href="{{ route('product.create') }}" class="btn btn-success btn-md waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Add</a>
|
||||
@endcan
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="buttons-datatables" class="display table-sm table-bordered table" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>S.N</th>
|
||||
<th>Name</th>
|
||||
<th>Price</th>
|
||||
<th>Quantity</th>
|
||||
<th>Category</th>
|
||||
<th>Sub Category</th>
|
||||
<th>Supplier</th>
|
||||
<th>Warehouse</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($products as $key => $product)
|
||||
<tr>
|
||||
<td>{{ $key + 1 }}</td>
|
||||
<td>{{ $product->name }}</td>
|
||||
<td>{{ $product->price }}</td>
|
||||
<td>{{ $product->qty }}</td>
|
||||
<td>{{ optional($product->category)->title }}</td>
|
||||
<td>{{ optional($product->subCategory)->title }}</td>
|
||||
<td>{{ optional($product->supplier)->supplier_name }}</td>
|
||||
<td>{{ optional($product->warehouse)->title }}</td>
|
||||
<td>{!! $product->status_name !!}</td>
|
||||
<td>
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
@can('product.show')
|
||||
<a href="{{ route('product.show', $product->id) }}" class="link-info fs-15">
|
||||
<i class="ri-eye-line"></i>
|
||||
</a>
|
||||
@endcan
|
||||
@can('product.edit')
|
||||
<a href="{{ route('product.edit', $product->id) }}"
|
||||
class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-line"></i></a>
|
||||
@endcan
|
||||
@can('product.destroy')
|
||||
<a href="javascript:void(0);" data-link="{{ route('product.destroy', $product->id) }}"
|
||||
data-id="{{ $product->id }}" class="link-danger fs-15 remove-item-btn"><i
|
||||
class="ri-delete-bin-line"></i></a>
|
||||
@endcan
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end row-->
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@@ -0,0 +1,98 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-9">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row gy-1">
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Product Name')->class('form-label') }}
|
||||
{{ html()->text('name')->class('form-control')->placeholder('Enter Product Name')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Price')->class('form-label') }}
|
||||
{{ html()->text('price')->class('form-control')->placeholder('Enter Price')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Quantity')->class('form-label') }}
|
||||
{{ html()->text('qty')->class('form-control')->placeholder('Enter Quantity')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Category')->class('form-label') }}
|
||||
{{ html()->select('category_id', $category)->class('form-select select2')->placeholder('Select Category')->id('category_id') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Sub Category')->class('form-label') }}
|
||||
{{ html()->select('sub_category_id', $subCategory)->class('form-select select2')->placeholder('Select Sub Category')->id('sub_category_id') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Supplier')->class('form-label') }}
|
||||
{{ html()->select('supplier_id', $supplier)->class('form-select select2')->placeholder('Select Supplier') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Warehouse')->class('form-label') }}
|
||||
{{ html()->select('warehouse_id', $warehouse)->class('form-select select2')->placeholder('Select Warehouse') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Description')->class('form-label') }}
|
||||
{{ html()->textarea('desc')->class('form-control')->placeholder('Enter Description')->required() }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- end card -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
</div>
|
||||
<div class="mb-3 text-end">
|
||||
<a href="{{ route('product.index') }}" class="btn btn-danger w-sm">Cancel</a>
|
||||
<button type="submit" class="btn btn-success w-sm">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end col -->
|
||||
<div class="col-lg-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title mb-0">Publish</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Status')->class('form-label') }}
|
||||
{{ html()->select('status', $status)->class('form-control')->placeholder('Select Status')->required() }}
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card -->
|
||||
</div>
|
||||
<!-- end col -->
|
||||
</div>
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
$(document).on('change', '#category_id', function(e) {
|
||||
e.preventDefault();
|
||||
var category_id = $(this).val();
|
||||
if (category_id) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "{{ route('getSubCategories') }}",
|
||||
data: {
|
||||
'category_id': category_id
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(response) {
|
||||
$('#sub_category_id').html('<option value="#" selected disabled>Select Sub Category</option>');
|
||||
$.each(response.message, function(key, value) {
|
||||
$('#sub_category_id').append('<option value=' + value.id + '>' + value.title + '</option>');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
65
Modules/Product/resources/views/product/show.blade.php
Normal file
65
Modules/Product/resources/views/product/show.blade.php
Normal file
@@ -0,0 +1,65 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="card card-body p-4">
|
||||
<div>
|
||||
<div class="table-responsive">
|
||||
<table class="table-borderless mb-0 table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Product Name</span></th>
|
||||
<td>{{ $product->name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Price</span></th>
|
||||
<td>{{ $product->price }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Quantity</span></th>
|
||||
<td>{{ $product->qty }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Category</span></th>
|
||||
<td>{{ optional($product->category)->title }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Sub Category</span></th>
|
||||
<td>{{ optional($product->subCategory)->title }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Supplier</span></th>
|
||||
<td>{{ optional($product->supplier)->supplier_name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Warehouse</span></th>
|
||||
<td>{{ optional($product->warehouse)->title }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Status</span></th>
|
||||
<td>{{ $product->status }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 text-end">
|
||||
<a href="{{ route('product.index') }}" class="btn btn-secondary w-sm">Back</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
@@ -0,0 +1,16 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
{{ html()->form('POST')->route('subCategory.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
@include('product::sub_category.partials.action')
|
||||
{{ html()->form()->close() }}
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
22
Modules/Product/resources/views/sub_category/edit.blade.php
Normal file
22
Modules/Product/resources/views/sub_category/edit.blade.php
Normal file
@@ -0,0 +1,22 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
<!-- end page title -->
|
||||
|
||||
{{ html()->modelForm($sub_category, 'PUT')->route('subCategory.update', $sub_category->id)->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
@include('product::sub_category.partials.action')
|
||||
{{ html()->closeModelForm() }}
|
||||
<!--end row-->
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
74
Modules/Product/resources/views/sub_category/index.blade.php
Normal file
74
Modules/Product/resources/views/sub_category/index.blade.php
Normal file
@@ -0,0 +1,74 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
|
||||
<div class="mb-2 text-end">
|
||||
@can('subCategory.create')
|
||||
<a href="{{ route('subCategory.create') }}" class="btn btn-success btn-md waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Add</a>
|
||||
@endcan
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="buttons-datatables" class="display table-sm table-bordered table" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>S.N</th>
|
||||
<th>Title</th>
|
||||
<th>Code</th>
|
||||
<th>Slug</th>
|
||||
<th>Category</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($sub_categories as $key => $sub_category)
|
||||
<tr>
|
||||
<td>{{ $key + 1 }}</td>
|
||||
<td>{{ $sub_category->title }}</td>
|
||||
<td>{{ $sub_category->code }}</td>
|
||||
<td>{{ $sub_category->slug }}</td>
|
||||
<td>{{ optional($sub_category->category)->title }}</td>
|
||||
<td>{!! $sub_category->status_name !!}</td>
|
||||
<td>
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
@can('subCategory.show')
|
||||
<a href="{{ route('subCategory.show', $sub_category->id) }}" class="link-info fs-15">
|
||||
<i class="ri-eye-line"></i>
|
||||
</a>
|
||||
@endcan
|
||||
@can('subCategory.edit')
|
||||
<a href="{{ route('subCategory.edit', $sub_category->id) }}"
|
||||
class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-line"></i></a>
|
||||
@endcan
|
||||
@can('subCategory.destroy')
|
||||
<a href="javascript:void(0);"
|
||||
data-link="{{ route('subCategory.destroy', $sub_category->id) }}"
|
||||
data-id="{{ $sub_category->id }}" class="link-danger fs-15 remove-item-btn"><i
|
||||
class="ri-delete-bin-line"></i></a>
|
||||
@endcan
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end row-->
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@@ -0,0 +1,63 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row gy-1">
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Title')->class('form-label') }}
|
||||
{{ html()->text('title')->class('form-control')->placeholder('Enter Title')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Code')->class('form-label') }}
|
||||
{{ html()->text('code')->class('form-control')->placeholder('Enter Code') }}
|
||||
</div>
|
||||
|
||||
<!-- <div class="col-md-6">
|
||||
{{ html()->label('Slug')->class('form-label') }}
|
||||
{{ html()->text('slug')->class('form-control')->placeholder('Enter Slug') }}
|
||||
</div> -->
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Description')->class('form-label') }}
|
||||
{{ html()->text('description')->class('form-control')->placeholder('Enter Description') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Category')->class('form-label') }}
|
||||
{{ html()->select('category_id', $category)->class('form-select select2')->placeholder('Select Category') }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card -->
|
||||
<div class="mb-3 text-end">
|
||||
<a href="{{ route('category.index') }}" class="btn btn-danger w-sm">Cancel</a>
|
||||
<button type="submit" class="btn btn-success w-sm">Save</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- end col -->
|
||||
<div class="col-lg-4">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title mb-0">Publish</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Status')->class('form-label') }}
|
||||
{{-- {{ html()->select('status', '11')->class('form-control')->placeholder('Select Status') }}
|
||||
--}}
|
||||
{{ html()->select('status', $status)->class('form-control')->placeholder('Select Status')->required() }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
</div>
|
||||
</div>
|
49
Modules/Product/resources/views/sub_category/show.blade.php
Normal file
49
Modules/Product/resources/views/sub_category/show.blade.php
Normal file
@@ -0,0 +1,49 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="card card-body p-4">
|
||||
<div>
|
||||
<div class="table-responsive">
|
||||
<table class="table-borderless mb-0 table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Client Name</span></th>
|
||||
<td>{{ $sub_category->client_name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Company</span></th>
|
||||
<td>{{ $sub_category->company }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Email</span></th>
|
||||
<td>{{ $sub_category->email_address }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Address</span></th>
|
||||
<td>{{ $sub_category->address }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 text-end">
|
||||
<a href="{{ route('sub_category.index') }}" class="btn btn-secondary w-sm">Back</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
16
Modules/Product/resources/views/warehouse/create.blade.php
Normal file
16
Modules/Product/resources/views/warehouse/create.blade.php
Normal file
@@ -0,0 +1,16 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
{{ html()->form('POST')->route('warehouse.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
@include('product::warehouse.partials.action')
|
||||
{{ html()->form()->close() }}
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
22
Modules/Product/resources/views/warehouse/edit.blade.php
Normal file
22
Modules/Product/resources/views/warehouse/edit.blade.php
Normal file
@@ -0,0 +1,22 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
<!-- end page title -->
|
||||
|
||||
{{ html()->modelForm($warehouse, 'PUT')->route('warehouse.update', $warehouse->id)->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
@include('product::warehouse.partials.action')
|
||||
{{ html()->closeModelForm() }}
|
||||
<!--end row-->
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
75
Modules/Product/resources/views/warehouse/index.blade.php
Normal file
75
Modules/Product/resources/views/warehouse/index.blade.php
Normal file
@@ -0,0 +1,75 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
|
||||
<div class="mb-2 text-end">
|
||||
@can('warehouse.create')
|
||||
<a href="{{ route('warehouse.create') }}" class="btn btn-success btn-md waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Add</a>
|
||||
@endcan
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="buttons-datatables" class="display table-sm table-bordered table" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>S.N</th>
|
||||
<th>Title</th>
|
||||
<th>Capacity</th>
|
||||
<th>Phone</th>
|
||||
<th>Email</th>
|
||||
<th>Address</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($warehouses as $key => $warehouse)
|
||||
<tr>
|
||||
<td>{{ $key + 1 }}</td>
|
||||
<td>{{ $warehouse->title }}</td>
|
||||
<td>{{ $warehouse->capacity }}</td>
|
||||
<td>{{ $warehouse->phone }}</td>
|
||||
<td>{{ $warehouse->email }}</td>
|
||||
<td>{{ $warehouse->address }}</td>
|
||||
<td>{!! $warehouse->status_name !!}</td>
|
||||
<td>
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
@can('warehouse.show')
|
||||
<a href="{{ route('warehouse.show', $warehouse->id) }}" class="link-info fs-15">
|
||||
<i class="ri-eye-line"></i>
|
||||
</a>
|
||||
@endcan
|
||||
@can('warehouse.edit')
|
||||
<a href="{{ route('warehouse.edit', $warehouse->id) }}"
|
||||
class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-line"></i></a>
|
||||
@endcan
|
||||
@can('warehouse.destroy')
|
||||
<a href="javascript:void(0);" data-link="{{ route('warehouse.destroy', $warehouse->id) }}"
|
||||
data-id="{{ $warehouse->id }}" class="link-danger fs-15 remove-item-btn"><i
|
||||
class="ri-delete-bin-line"></i></a>
|
||||
@endcan
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end row-->
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@@ -0,0 +1,60 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row gy-1">
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Warehouse Name')->class('form-label') }}
|
||||
{{ html()->text('title')->class('form-control')->placeholder('Enter Warehouse')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Capacity')->class('form-label') }}
|
||||
{{ html()->text('capacity')->class('form-control')->placeholder('Enter Capacity')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Contact')->class('form-label') }}
|
||||
{{ html()->text('phone')->class('form-control')->placeholder('Enter Phone')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Email')->class('form-label') }}
|
||||
{{ html()->email('email')->class('form-control')->placeholder('Enter Email') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Address')->class('form-label') }}
|
||||
{{ html()->text('address')->class('form-control')->placeholder('Enter Address')->placeholder('Enter Email') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card -->
|
||||
<div class="mb-3 text-end">
|
||||
<a href="{{ route('warehouse.index') }}" class="btn btn-danger w-sm">Cancel</a>
|
||||
<button type="submit" class="btn btn-success w-sm">Save</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- end col -->
|
||||
<div class="col-lg-4">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title mb-0">Publish</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Status')->class('form-label') }}
|
||||
{{ html()->select('status', $status)->class('form-control')->placeholder('Select Status') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
</div>
|
||||
<!-- end col -->
|
||||
</div>
|
57
Modules/Product/resources/views/warehouse/show.blade.php
Normal file
57
Modules/Product/resources/views/warehouse/show.blade.php
Normal file
@@ -0,0 +1,57 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="card card-body p-4">
|
||||
<div>
|
||||
<div class="table-responsive">
|
||||
<table class="table-borderless mb-0 table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Title</span></th>
|
||||
<td>{{ $warehouse->title }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Capacity</span></th>
|
||||
<td>{{ $warehouse->capacity }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Phone</span></th>
|
||||
<td>{{ $warehouse->phone }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Email</span></th>
|
||||
<td>{{ $warehouse->email }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Email</span></th>
|
||||
<td>{{ $warehouse->address }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Status</span></th>
|
||||
<td>{{ $warehouse->status }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 text-end">
|
||||
<a href="{{ route('warehouse.index') }}" class="btn btn-secondary w-sm">Back</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
0
Modules/Product/routes/.gitkeep
Normal file
0
Modules/Product/routes/.gitkeep
Normal file
19
Modules/Product/routes/api.php
Normal file
19
Modules/Product/routes/api.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Product\Http\Controllers\ProductController;
|
||||
|
||||
/*
|
||||
*--------------------------------------------------------------------------
|
||||
* API Routes
|
||||
*--------------------------------------------------------------------------
|
||||
*
|
||||
* Here is where you can register API routes for your application. These
|
||||
* routes are loaded by the RouteServiceProvider within a group which
|
||||
* is assigned the "api" middleware group. Enjoy building your API!
|
||||
*
|
||||
*/
|
||||
|
||||
Route::middleware(['auth:sanctum'])->prefix('v1')->group(function () {
|
||||
Route::apiResource('product', ProductController::class)->names('product');
|
||||
});
|
28
Modules/Product/routes/web.php
Normal file
28
Modules/Product/routes/web.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Product\Http\Controllers\CategoryController;
|
||||
use Modules\Product\Http\Controllers\ProductController;
|
||||
use Modules\Product\Http\Controllers\SubCategoryController;
|
||||
use Modules\Product\Http\Controllers\WarehouseController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Web Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register web routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| contains the "web" middleware group. Now create something great!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::group([], function () {
|
||||
Route::resource('product', ProductController::class)->names('product');
|
||||
Route::resource('category', CategoryController::class)->names('category');
|
||||
Route::resource('sub-category', SubCategoryController::class)->names('subCategory');
|
||||
Route::resource('warehouse', WarehouseController::class)->names('warehouse');
|
||||
Route::get('get-sub-categories', [SubCategoryController::class, 'getSubCategories'])->name('getSubCategories');
|
||||
|
||||
|
||||
});
|
26
Modules/Product/vite.config.js
Normal file
26
Modules/Product/vite.config.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import laravel from 'laravel-vite-plugin';
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
outDir: '../../public/build-product',
|
||||
emptyOutDir: true,
|
||||
manifest: true,
|
||||
},
|
||||
plugins: [
|
||||
laravel({
|
||||
publicDirectory: '../../public',
|
||||
buildDirectory: 'build-product',
|
||||
input: [
|
||||
__dirname + '/resources/assets/sass/app.scss',
|
||||
__dirname + '/resources/assets/js/app.js'
|
||||
],
|
||||
refresh: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
//export const paths = [
|
||||
// 'Modules/Product/resources/assets/sass/app.scss',
|
||||
// 'Modules/Product/resources/assets/js/app.js',
|
||||
//];
|
Reference in New Issue
Block a user