restaurant changes
This commit is contained in:
parent
0b438e302d
commit
2fa9d47a73
0
Modules/Ingredient/app/Http/Controllers/.gitkeep
Normal file
0
Modules/Ingredient/app/Http/Controllers/.gitkeep
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Ingredient\Models\IngredientCategory;
|
||||
use Modules\Ingredient\Repositories\IngredientCategoryRepository;
|
||||
|
||||
class IngredientCategoryController extends Controller
|
||||
{
|
||||
private $ingredientCategoryRepository;
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function __construct(
|
||||
IngredientCategoryRepository $ingredientCategoryRepository) {
|
||||
$this->ingredientCategoryRepository = $ingredientCategoryRepository;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Categories List';
|
||||
$data['categories'] = $this->ingredientCategoryRepository->findAll();
|
||||
return view('ingredient::ingredientCategory.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create IngredientCategory';
|
||||
$data['status'] = IngredientCategory::STATUS;
|
||||
|
||||
return view('ingredient::ingredientCategory.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->ingredientCategoryRepository->create($inputData);
|
||||
toastr()->success('IngredientCategory Created Succesfully');
|
||||
|
||||
return redirect()->route('ingredientCategory.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$data['title'] = 'Show IngredientCategory';
|
||||
$data['status'] = IngredientCategory::STATUS;
|
||||
$data['category'] = $this->ingredientCategoryRepository->getIngredientCategoryById($id);
|
||||
|
||||
return view('ingredient::ingredientCategory.show', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit IngredientCategory';
|
||||
$data['status'] = IngredientCategory::STATUS;
|
||||
|
||||
$data['category'] = $this->ingredientCategoryRepository->getIngredientCategoryById($id);
|
||||
|
||||
return view('ingredient::ingredientCategory.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$inputData = $request->except(['_method', '_token']);
|
||||
$this->ingredientCategoryRepository->update($id, $inputData);
|
||||
|
||||
return redirect()->route('ingredientCategory.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$IngredientCategoryModel = $this->ingredientCategoryRepository->getIngredientCategoryById($id);
|
||||
$IngredientCategoryModel->delete();
|
||||
|
||||
toastr()->success('Ingredient Delete Succesfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['status' => true, 'message' => 'IngredientCategory Delete Succesfully']);
|
||||
}
|
||||
}
|
152
Modules/Ingredient/app/Http/Controllers/IngredientController.php
Normal file
152
Modules/Ingredient/app/Http/Controllers/IngredientController.php
Normal file
@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Ingredient\Models\Unit;
|
||||
use Modules\Ingredient\Models\Ingredient;
|
||||
use Modules\Ingredient\Repositories\IngredientCategoryRepository;
|
||||
use Modules\Ingredient\Repositories\UnitRepository;
|
||||
use Modules\Ingredient\Repositories\IngredientInterface;
|
||||
use Modules\Ingredient\Repositories\IngredientRepository;
|
||||
use Modules\Supplier\Models\Supplier;
|
||||
use Modules\Supplier\Repositories\SupplierRepository;
|
||||
|
||||
class IngredientController extends Controller
|
||||
{
|
||||
private $ingredientRepository;
|
||||
private $ingredientCategoryRepository;
|
||||
private $unitRepository;
|
||||
private $supplierRepository;
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function __construct(IngredientRepository $ingredientRepository,
|
||||
IngredientCategoryRepository $ingredientCategoryRepository,
|
||||
SupplierRepository $supplierRepository,
|
||||
UnitRepository $unitRepository)
|
||||
{
|
||||
$this->ingredientRepository = $ingredientRepository;
|
||||
$this->ingredientCategoryRepository = $ingredientCategoryRepository;
|
||||
$this->unitRepository = $unitRepository;
|
||||
$this->supplierRepository = $supplierRepository;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = "Ingredient Lists";
|
||||
$data['ingredients'] = $this->ingredientRepository->findAll();
|
||||
return view('ingredient::ingredient.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Ingredient';
|
||||
$data['ingredientCategory'] = $this->ingredientCategoryRepository->pluck();
|
||||
$data['unit'] = $this->unitRepository->pluck();
|
||||
$data['supplier'] = $this->supplierRepository->pluck();
|
||||
$data['status'] = Ingredient::STATUS;
|
||||
|
||||
return view('ingredient::ingredient.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$inputData = $request->all();
|
||||
$this->ingredientRepository->create($inputData);
|
||||
toastr()->success('Ingredient Created Succesfully');
|
||||
|
||||
return redirect()->route('ingredient.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$data['title'] = 'Show Ingredient';
|
||||
$data['ingredient'] = $this->ingredientRepository->getIngredientById($id);
|
||||
$data['status'] = Ingredient::STATUS;
|
||||
|
||||
return view('ingredient::ingredient.show', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Show Ingredient';
|
||||
$data['ingredientCategory'] = $this->ingredientCategoryRepository->pluck();
|
||||
$data['unit'] = $this->unitRepository->pluck();
|
||||
$data['supplier'] = $this->supplierRepository->pluck();
|
||||
$data['ingredient'] = $this->ingredientRepository->getIngredientById($id);
|
||||
$data['status'] = Ingredient::STATUS;
|
||||
|
||||
return view('ingredient::ingredient.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$inputData = $request->except(['_method', '_token']);
|
||||
$this->ingredientRepository->update($id, $inputData);
|
||||
|
||||
return redirect()->route('ingredient.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$IngredientModel = $this->ingredientRepository->getIngredientById($id);
|
||||
$IngredientModel->delete();
|
||||
|
||||
toastr()->success('Ingredient Delete Succesfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['status' => true, 'message' => 'Ingredient Delete Succesfully']);
|
||||
}
|
||||
|
||||
public function getIngredientDetail(Request $request)
|
||||
{
|
||||
try {
|
||||
$ingredientModel = $this->ingredientRepository->getIngredientById($request->id);
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
|
||||
}
|
||||
return response()->json([
|
||||
'status' => true,
|
||||
'data' => $ingredientModel,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getIngredientsByCategory(Request $request)
|
||||
{
|
||||
$ingredientCategoryId = $request->ingredient_category_id;
|
||||
try {
|
||||
$ingredients = $this->ingredientRepository->getIngredientsByCategory($ingredientCategoryId);
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return response()->json(['ingredients' => $ingredients]);
|
||||
}
|
||||
|
||||
|
||||
}
|
111
Modules/Ingredient/app/Http/Controllers/UnitController.php
Normal file
111
Modules/Ingredient/app/Http/Controllers/UnitController.php
Normal file
@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Ingredient\Models\Unit;
|
||||
use Modules\Ingredient\Repositories\UnitRepository;
|
||||
|
||||
class UnitController extends Controller
|
||||
{
|
||||
private $unitRepository;
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function __construct(
|
||||
UnitRepository $unitRepository)
|
||||
{
|
||||
$this->unitRepository = $unitRepository;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Unit List';
|
||||
$data['units'] = $this->unitRepository->findAll();
|
||||
|
||||
return view('ingredient::unit.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Unit';
|
||||
$data['status'] = Unit::STATUS;
|
||||
|
||||
return view('ingredient::unit.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->unitRepository->create($inputData);
|
||||
toastr()->success('Unit Created Succesfully');
|
||||
|
||||
return redirect()->route('unit.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$data['title'] = 'Show Fabric Category';
|
||||
$data['status'] = Unit::STATUS;
|
||||
$data['unit'] = $this->unitRepository->getUnitById($id);
|
||||
|
||||
return view('ingredient::unit.show', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Fabric Category';
|
||||
$data['status'] = Unit::STATUS;
|
||||
$data['unit'] = $this->unitRepository->getUnitById($id);
|
||||
|
||||
return view('ingredient::unit.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$inputData = $request->except(['_method', '_token']);
|
||||
$this->unitRepository->update($id, $inputData);
|
||||
|
||||
return redirect()->route('unit.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$UnitModel = $this->unitRepository->getUnitById($id);
|
||||
$UnitModel->delete();
|
||||
|
||||
toastr()->success('Fabric Category Delete Succesfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['status' => true, 'message' => 'Fabric Category Delete Succesfully']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
0
Modules/Ingredient/app/Http/Requests/.gitkeep
Normal file
0
Modules/Ingredient/app/Http/Requests/.gitkeep
Normal file
0
Modules/Ingredient/app/Models/.gitkeep
Normal file
0
Modules/Ingredient/app/Models/.gitkeep
Normal file
33
Modules/Ingredient/app/Models/Ingredient.php
Normal file
33
Modules/Ingredient/app/Models/Ingredient.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Models;
|
||||
|
||||
use App\Traits\StatusTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Modules\Supplier\Models\Supplier;
|
||||
|
||||
class Ingredient extends Model
|
||||
{
|
||||
USE StatusTrait;
|
||||
|
||||
protected $table = 'tbl_ingredients';
|
||||
protected $guarded = [];
|
||||
protected $appends = ['status_name'];
|
||||
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(IngredientCategory::class, 'ingredient_category_id');
|
||||
}
|
||||
|
||||
public function unit()
|
||||
{
|
||||
return $this->belongsTo(Unit::class, 'unit_id');
|
||||
}
|
||||
|
||||
|
||||
public function supplier()
|
||||
{
|
||||
return $this->belongsTo(Supplier::class, 'supplier_id');
|
||||
}
|
||||
}
|
16
Modules/Ingredient/app/Models/IngredientCategory.php
Normal file
16
Modules/Ingredient/app/Models/IngredientCategory.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Models;
|
||||
|
||||
use App\Traits\StatusTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class IngredientCategory extends Model
|
||||
{
|
||||
USE StatusTrait;
|
||||
|
||||
protected $table = 'tbl_ingredient_categories';
|
||||
protected $guarded = [];
|
||||
protected $appends = ['status_name'];
|
||||
|
||||
}
|
16
Modules/Ingredient/app/Models/Unit.php
Normal file
16
Modules/Ingredient/app/Models/Unit.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Models;
|
||||
|
||||
use App\Traits\StatusTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Unit extends Model
|
||||
{
|
||||
USE StatusTrait;
|
||||
|
||||
protected $table = 'tbl_units';
|
||||
protected $guarded = [];
|
||||
protected $appends = ['status_name'];
|
||||
|
||||
}
|
0
Modules/Ingredient/app/Observers/.gitkeep
Normal file
0
Modules/Ingredient/app/Observers/.gitkeep
Normal file
0
Modules/Ingredient/app/Providers/.gitkeep
Normal file
0
Modules/Ingredient/app/Providers/.gitkeep
Normal file
32
Modules/Ingredient/app/Providers/EventServiceProvider.php
Normal file
32
Modules/Ingredient/app/Providers/EventServiceProvider.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event handler mappings for the application.
|
||||
*
|
||||
* @var array<string, array<int, string>>
|
||||
*/
|
||||
protected $listen = [];
|
||||
|
||||
/**
|
||||
* Indicates if events should be discovered.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected static $shouldDiscoverEvents = true;
|
||||
|
||||
/**
|
||||
* Configure the proper event listeners for email verification.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function configureEmailVerification(): void
|
||||
{
|
||||
|
||||
}
|
||||
}
|
120
Modules/Ingredient/app/Providers/IngredientServiceProvider.php
Normal file
120
Modules/Ingredient/app/Providers/IngredientServiceProvider.php
Normal file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class IngredientServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'Ingredient';
|
||||
|
||||
protected string $moduleNameLower = 'ingredient';
|
||||
|
||||
/**
|
||||
* 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->register(EventServiceProvider::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.
|
||||
*
|
||||
* @return array<string>
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string>
|
||||
*/
|
||||
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/Ingredient/app/Providers/RouteServiceProvider.php
Normal file
49
Modules/Ingredient/app/Providers/RouteServiceProvider.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\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('Ingredient', '/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('Ingredient', '/routes/api.php'));
|
||||
}
|
||||
}
|
0
Modules/Ingredient/app/Repositories/.gitkeep
Normal file
0
Modules/Ingredient/app/Repositories/.gitkeep
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Repositories;
|
||||
|
||||
interface IngredientCategoryInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getIngredientCategoryById($IngredientCategoryId);
|
||||
public function getIngredientCategoryByEmail($email);
|
||||
public function delete($IngredientCategoryId);
|
||||
public function create($IngredientCategoryDetails);
|
||||
public function update($IngredientCategoryId, array $newDetails);
|
||||
public function pluck();
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Repositories;
|
||||
|
||||
use Modules\Ingredient\Models\IngredientCategory;
|
||||
|
||||
class IngredientCategoryRepository implements IngredientCategoryInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return IngredientCategory::when(true, function ($query) {
|
||||
|
||||
})->paginate(20);
|
||||
}
|
||||
|
||||
public function getIngredientCategoryById($IngredientCategoryId)
|
||||
{
|
||||
return IngredientCategory::findOrFail($IngredientCategoryId);
|
||||
}
|
||||
|
||||
public function getIngredientCategoryByEmail($email)
|
||||
{
|
||||
return IngredientCategory::where('email', $email)->first();
|
||||
}
|
||||
|
||||
public function delete($IngredientCategoryId)
|
||||
{
|
||||
IngredientCategory::destroy($IngredientCategoryId);
|
||||
}
|
||||
|
||||
public function create($IngredientCategoryDetails)
|
||||
{
|
||||
return IngredientCategory::create($IngredientCategoryDetails);
|
||||
}
|
||||
|
||||
public function update($IngredientCategoryId, array $newDetails)
|
||||
{
|
||||
return IngredientCategory::whereId($IngredientCategoryId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck()
|
||||
{
|
||||
return IngredientCategory::pluck('title', 'id');
|
||||
}
|
||||
|
||||
}
|
16
Modules/Ingredient/app/Repositories/IngredientInterface.php
Normal file
16
Modules/Ingredient/app/Repositories/IngredientInterface.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Repositories;
|
||||
|
||||
interface IngredientInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getIngredientById($IngredientId);
|
||||
public function getIngredientByEmail($email);
|
||||
public function getIngredientsByCategory($categoryId);
|
||||
public function delete($IngredientId);
|
||||
public function create($IngredientDetails);
|
||||
public function update($IngredientId, array $newDetails);
|
||||
public function pluck();
|
||||
|
||||
}
|
52
Modules/Ingredient/app/Repositories/IngredientRepository.php
Normal file
52
Modules/Ingredient/app/Repositories/IngredientRepository.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Repositories;
|
||||
|
||||
use Modules\Ingredient\Models\Ingredient;
|
||||
|
||||
class IngredientRepository implements IngredientInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Ingredient::when(true, function ($query) {
|
||||
|
||||
})->paginate(20);
|
||||
}
|
||||
|
||||
public function getIngredientById($IngredientId)
|
||||
{
|
||||
return Ingredient::findOrFail($IngredientId);
|
||||
}
|
||||
|
||||
public function getIngredientByEmail($email)
|
||||
{
|
||||
return Ingredient::where('email', $email)->first();
|
||||
}
|
||||
|
||||
public function getIngredientsByCategory($ingredientCategoryId)
|
||||
{
|
||||
return Ingredient::where('ingredient_category_id', $ingredientCategoryId)->pluck('name', 'id');
|
||||
}
|
||||
|
||||
public function delete($IngredientId)
|
||||
{
|
||||
Ingredient::destroy($IngredientId);
|
||||
}
|
||||
|
||||
public function create($IngredientDetails)
|
||||
{
|
||||
return Ingredient::create($IngredientDetails);
|
||||
}
|
||||
|
||||
public function update($IngredientId, array $newDetails)
|
||||
{
|
||||
return Ingredient::whereId($IngredientId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck()
|
||||
{
|
||||
return Ingredient::pluck('name', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
|
15
Modules/Ingredient/app/Repositories/UnitInterface.php
Normal file
15
Modules/Ingredient/app/Repositories/UnitInterface.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Repositories;
|
||||
|
||||
interface UnitInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getUnitById($UnitId);
|
||||
public function getUnitByEmail($email);
|
||||
public function delete($UnitId);
|
||||
public function create($UnitDetails);
|
||||
public function update($UnitId, array $newDetails);
|
||||
public function pluck();
|
||||
|
||||
}
|
46
Modules/Ingredient/app/Repositories/UnitRepository.php
Normal file
46
Modules/Ingredient/app/Repositories/UnitRepository.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Repositories;
|
||||
|
||||
use Modules\Ingredient\Models\Unit;
|
||||
|
||||
class UnitRepository implements UnitInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Unit::when(true, function ($query) {
|
||||
|
||||
})->paginate(20);
|
||||
}
|
||||
|
||||
public function getUnitById($UnitId)
|
||||
{
|
||||
return Unit::findOrFail($UnitId);
|
||||
}
|
||||
|
||||
public function getUnitByEmail($email)
|
||||
{
|
||||
return Unit::where('email', $email)->first();
|
||||
}
|
||||
|
||||
public function delete($UnitId)
|
||||
{
|
||||
Unit::destroy($UnitId);
|
||||
}
|
||||
|
||||
public function create($UnitDetails)
|
||||
{
|
||||
return Unit::create($UnitDetails);
|
||||
}
|
||||
|
||||
public function update($UnitId, array $newDetails)
|
||||
{
|
||||
return Unit::whereId($UnitId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck()
|
||||
{
|
||||
return Unit::pluck('title', 'id');
|
||||
}
|
||||
|
||||
}
|
30
Modules/Ingredient/composer.json
Normal file
30
Modules/Ingredient/composer.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "nwidart/ingredient",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Widart",
|
||||
"email": "n.widart@gmail.com"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Ingredient\\": "app/",
|
||||
"Modules\\Ingredient\\Database\\Factories\\": "database/factories/",
|
||||
"Modules\\Ingredient\\Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Modules\\Ingredient\\Tests\\": "tests/"
|
||||
}
|
||||
}
|
||||
}
|
0
Modules/Ingredient/config/.gitkeep
Normal file
0
Modules/Ingredient/config/.gitkeep
Normal file
5
Modules/Ingredient/config/config.php
Normal file
5
Modules/Ingredient/config/config.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Ingredient',
|
||||
];
|
0
Modules/Ingredient/database/factories/.gitkeep
Normal file
0
Modules/Ingredient/database/factories/.gitkeep
Normal file
0
Modules/Ingredient/database/migrations/.gitkeep
Normal file
0
Modules/Ingredient/database/migrations/.gitkeep
Normal file
@ -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_ingredient_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_ingredient_categories');
|
||||
}
|
||||
};
|
@ -0,0 +1,37 @@
|
||||
<?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_ingredients', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('code');
|
||||
$table->longText('desc')->nullable();
|
||||
$table->longText('remarks')->nullable();
|
||||
$table->decimal('price', 10, 2)->nullable();
|
||||
$table->integer('qty')->nullable();
|
||||
$table->unsignedBigInteger('ingredient_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_ingredients');
|
||||
}
|
||||
};
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('tbl_units', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title')->nullable();
|
||||
$table->string('code')->nullable();
|
||||
$table->string('slug')->nullable();
|
||||
$table->text('description')->nullable();
|
||||
$table->integer('display_order')->nullable();
|
||||
$table->integer('status')->default(11);
|
||||
$table->text('remarks')->nullable();
|
||||
$table->dateTime('created_at')->nullable();
|
||||
$table->integer('createdby')->nullable();
|
||||
$table->dateTime('updated_at')->nullable();
|
||||
$table->integer('updatedby')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('tbl_masterunits');
|
||||
}
|
||||
};
|
0
Modules/Ingredient/database/seeders/.gitkeep
Normal file
0
Modules/Ingredient/database/seeders/.gitkeep
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class IngredientDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// $this->call([]);
|
||||
}
|
||||
}
|
11
Modules/Ingredient/module.json
Normal file
11
Modules/Ingredient/module.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Ingredient",
|
||||
"alias": "ingredient",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\Ingredient\\Providers\\IngredientServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
15
Modules/Ingredient/package.json
Normal file
15
Modules/Ingredient/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/Ingredient/resources/assets/.gitkeep
Normal file
0
Modules/Ingredient/resources/assets/.gitkeep
Normal file
0
Modules/Ingredient/resources/assets/js/app.js
Normal file
0
Modules/Ingredient/resources/assets/js/app.js
Normal file
0
Modules/Ingredient/resources/assets/sass/app.scss
Normal file
0
Modules/Ingredient/resources/assets/sass/app.scss
Normal file
0
Modules/Ingredient/resources/views/.gitkeep
Normal file
0
Modules/Ingredient/resources/views/.gitkeep
Normal file
7
Modules/Ingredient/resources/views/index.blade.php
Normal file
7
Modules/Ingredient/resources/views/index.blade.php
Normal file
@ -0,0 +1,7 @@
|
||||
@extends('ingredient::layouts.master')
|
||||
|
||||
@section('content')
|
||||
<h1>Hello World</h1>
|
||||
|
||||
<p>Module: {!! config('ingredient.name') !!}</p>
|
||||
@endsection
|
@ -0,0 +1,27 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
{{ html()->form('POST')->route('ingredient.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
|
||||
@include('ingredient::ingredient.partials.action')
|
||||
|
||||
{{ html()->form()->close() }}
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
<script>
|
||||
function validateNumericInput(input) {
|
||||
// Allow only numbers and remove any non-numeric input
|
||||
input.value = input.value.replace(/[^0-9.]/g, '');
|
||||
input.value = input.value.replace(/(\..*)\./g, '$1');
|
||||
input.value = input.value.replace(/^(\d+)(\.\d{0,2})?.*/, '$1$2');
|
||||
}
|
||||
</script>
|
||||
@endpush
|
30
Modules/Ingredient/resources/views/ingredient/edit.blade.php
Normal file
30
Modules/Ingredient/resources/views/ingredient/edit.blade.php
Normal file
@ -0,0 +1,30 @@
|
||||
@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($ingredient, 'PUT')->route('ingredient.update', $ingredient->id)->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
@include('ingredient::ingredient.partials.action')
|
||||
{{ html()->closeModelForm() }}
|
||||
<!--end row-->
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
<script>
|
||||
function validateNumericInput(input) {
|
||||
// Allow only numbers and remove any non-numeric input
|
||||
input.value = input.value.replace(/[^0-9.]/g, '');
|
||||
input.value = input.value.replace(/(\..*)\./g, '$1');
|
||||
input.value = input.value.replace(/^(\d+)(\.\d{0,2})?.*/, '$1$2');
|
||||
}
|
||||
</script>
|
||||
@endpush
|
@ -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('ingredient.create')
|
||||
<a href="{{ route('ingredient.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>Fabric Category</th> --}}
|
||||
<th>Ingredient Category</th>
|
||||
<th>Ingredient Code</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($ingredients as $key => $ingredient)
|
||||
{{-- @dd($ingredient->fabricCategory) --}}
|
||||
<tr>
|
||||
<td>{{ $key + 1 }}</td>
|
||||
<td>{{ $ingredient->name }}</td>
|
||||
{{-- <td>{{ optional($ingredient->fabricCategory)->title }}</td> --}}
|
||||
<td>{{ optional($ingredient->category)->title }}</td>
|
||||
<td>{{ $ingredient->code }}</td>
|
||||
<td>{!! $ingredient->status_name !!}</td>
|
||||
<td>
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
@can('ingredient.show')
|
||||
<a href="{{ route('ingredient.show', $ingredient->id) }}" class="link-info fs-15">
|
||||
<i class="ri-eye-line"></i>
|
||||
</a>
|
||||
@endcan
|
||||
@can('ingredient.edit')
|
||||
<a href="{{ route('ingredient.edit', $ingredient->id) }}"
|
||||
class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-line"></i></a>
|
||||
@endcan
|
||||
@can('ingredient.destroy')
|
||||
<a href="javascript:void(0);" data-link="{{ route('ingredient.destroy', $ingredient->id) }}"
|
||||
data-id="{{ $ingredient->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,89 @@
|
||||
<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('Ingredient Name')->class('form-label') }}
|
||||
{{ html()->text('name')->class('form-control')->placeholder('Enter Ingredient Name')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Ingredient Code')->class('form-label') }}
|
||||
{{ html()->text('code')->class('form-control')->placeholder('Enter Ingredient Code')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Category')->class('form-label') }}
|
||||
{{ html()->select('ingredient_category_id', $ingredientCategory)->class('form-select select2')->placeholder('Select Category')->id('ingredient_category_id') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Price')->class('form-label') }}
|
||||
{{ html()->text('price')->class('form-control product-price cleave-numeral rate~~')->placeholder('Enter Price')->attributes(['onkeyup' => 'validateNumericInput(this)'])->required() }}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Description')->class('form-label') }}
|
||||
{{ html()->textarea('desc')->class('form-control')->placeholder('Enter Description') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Remarks')->class('form-label') }}
|
||||
{{ html()->textarea('remarks')->class('form-control')->placeholder('Enter Remarks') }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- end card -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
</div>
|
||||
<div class="mb-3 text-end">
|
||||
<a href="{{ route('ingredient.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
|
57
Modules/Ingredient/resources/views/ingredient/show.blade.php
Normal file
57
Modules/Ingredient/resources/views/ingredient/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">Ingredient Name</span></th>
|
||||
<td>{{ $ingredient->name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Ingredient Code</span></th>
|
||||
<td>{{ $ingredient->code }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Category</span></th>
|
||||
<td>{{ optional($ingredient->category)->title }}</td>
|
||||
</tr>
|
||||
{{-- <tr>
|
||||
<th><span class="fw-medium">Fabric Category</span></th>
|
||||
<td>{{ optional($ingredient->fabricCategory)->title }}</td>
|
||||
</tr> --}}
|
||||
<tr>
|
||||
<th><span class="fw-medium">Description</span></th>
|
||||
<td>{{ optional($ingredient->desc) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Status</span></th>
|
||||
<td>{{ $ingredient->status }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 text-end">
|
||||
<a href="{{ route('ingredient.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,18 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
{{ html()->form('POST')->route('ingredientCategory.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
@include('ingredient::ingredientCategory.partials.action')
|
||||
{{ html()->form()->close() }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
@ -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($ingredientCategory, 'PUT')->route('ingredientCategory.update', $ingredientCategory->id)->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
@include('ingredient::ingredientCategory.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
|
@ -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('ingredientCategory.create')
|
||||
<a href="{{ route('ingredientCategory.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 => $ingredientCategory)
|
||||
<tr>
|
||||
<td>{{ $key + 1 }}</td>
|
||||
<td>{{ $ingredientCategory->title }}</td>
|
||||
<td>{{ $ingredientCategory->code }}</td>
|
||||
<td>{{ $ingredientCategory->slug }}</td>
|
||||
<td>{!! $ingredientCategory->status_name !!}</td>
|
||||
<td>
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
@can('ingredientCategory.show')
|
||||
<a href="{{ route('ingredientCategory.show', $ingredientCategory->id) }}" class="link-info fs-15">
|
||||
<i class="ri-eye-line"></i>
|
||||
</a>
|
||||
@endcan
|
||||
@can('ingredientCategory.edit')
|
||||
<a href="{{ route('ingredientCategory.edit', $ingredientCategory->id) }}"
|
||||
class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-line"></i></a>
|
||||
@endcan
|
||||
@can('ingredientCategory.destroy')
|
||||
<a href="javascript:void(0);" data-link="{{ route('ingredientCategory.destroy', $ingredientCategory->id) }}"
|
||||
data-id="{{ $ingredientCategory->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('ingredientCategory.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>
|
@ -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">Ingredient Category</span></th>
|
||||
<td>{{ $ingredientCategory->title }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Code</span></th>
|
||||
<td>{{ $ingredientCategory->code }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Slug</span></th>
|
||||
<td>{{ $ingredientCategory->slug }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Status</span></th>
|
||||
<td>{{ $ingredientCategory->status }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 text-end">
|
||||
<a href="{{ route('ingredientCategory.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
|
29
Modules/Ingredient/resources/views/layouts/master.blade.php
Normal file
29
Modules/Ingredient/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>Ingredient 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-ingredient', 'resources/assets/sass/app.scss') }} --}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@yield('content')
|
||||
|
||||
{{-- Vite JS --}}
|
||||
{{-- {{ module_vite('build-ingredient', 'resources/assets/js/app.js') }} --}}
|
||||
</body>
|
16
Modules/Ingredient/resources/views/unit/create.blade.php
Normal file
16
Modules/Ingredient/resources/views/unit/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('unit.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
@include('ingredient::unit.partials.action')
|
||||
{{ html()->form()->close() }}
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
23
Modules/Ingredient/resources/views/unit/edit.blade.php
Normal file
23
Modules/Ingredient/resources/views/unit/edit.blade.php
Normal file
@ -0,0 +1,23 @@
|
||||
@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($unit, 'PUT')->route('unit.update', $fabric_category->id)->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
|
||||
@include('ingredient::unit.partials.action')
|
||||
|
||||
{{ html()->closeModelForm() }}
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
72
Modules/Ingredient/resources/views/unit/index.blade.php
Normal file
72
Modules/Ingredient/resources/views/unit/index.blade.php
Normal file
@ -0,0 +1,72 @@
|
||||
@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('unit.create')
|
||||
<a href="{{ route('unit.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>Slug</th>
|
||||
<th>Code</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($units as $key => $unit)
|
||||
<tr>
|
||||
<td>{{ $key + 1 }}</td>
|
||||
<td>{{ $unit->title }}</td>
|
||||
<td>{{ $unit->slug }}</td>
|
||||
<td>{{ $unit->code }}</td>
|
||||
<td>{!! $unit->status_name !!}</td>
|
||||
<td>
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
@can('unit.show')
|
||||
<a href="{{ route('unit.show', $unit->id) }}" class="link-info fs-15">
|
||||
<i class="ri-eye-line"></i>
|
||||
</a>
|
||||
@endcan
|
||||
@can('unit.edit')
|
||||
<a href="{{ route('unit.edit', $unit->id) }}"
|
||||
class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-line"></i></a>
|
||||
@endcan
|
||||
@can('unit.destroy')
|
||||
<a href="javascript:void(0);"
|
||||
data-link="{{ route('unit.destroy', $unit->id) }}"
|
||||
data-id="{{ $unit->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('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')->required() }}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Description')->class('form-label') }}
|
||||
{{ html()->text('description')->class('form-control')->placeholder('Enter Description') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Remarks')->class('form-label') }}
|
||||
{{ html()->text('remarks')->class('form-control')->placeholder('Enter Remarks') }}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card -->
|
||||
<div class="mb-3 text-end">
|
||||
<a href="{{ route('unit.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/Ingredient/resources/views/unit/show.blade.php
Normal file
49
Modules/Ingredient/resources/views/unit/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">Title</span></th>
|
||||
<td>{{ $unit->title }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Code</span></th>
|
||||
<td>{{ $unit->code }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Description</span></th>
|
||||
<td>{{ $unit->description }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Remarks</span></th>
|
||||
<td>{{ $unit->remarks }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 text-end">
|
||||
<a href="{{ route('fabricCategory.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/Ingredient/routes/.gitkeep
Normal file
0
Modules/Ingredient/routes/.gitkeep
Normal file
19
Modules/Ingredient/routes/api.php
Normal file
19
Modules/Ingredient/routes/api.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Ingredient\Http\Controllers\IngredientController;
|
||||
|
||||
/*
|
||||
*--------------------------------------------------------------------------
|
||||
* 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('ingredient', IngredientController::class)->names('ingredient');
|
||||
});
|
27
Modules/Ingredient/routes/web.php
Normal file
27
Modules/Ingredient/routes/web.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Ingredient\Http\Controllers\IngredientCategoryController;
|
||||
use Modules\Ingredient\Http\Controllers\IngredientController;
|
||||
use Modules\Ingredient\Http\Controllers\UnitController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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('ingredient', IngredientController::class)->names('ingredient');
|
||||
Route::resource('ingredientCategory', IngredientCategoryController::class)->names('ingredientCategory');
|
||||
Route::resource('unit', UnitController::class)->names('unit');
|
||||
Route::get('ingredient-details', [IngredientController::class, 'getIngredientDetail'])->name('get-ingredient-detail');
|
||||
Route::get('/ingredients-by-category', [IngredientController::class, 'getIngredientsByCategory'])->name('ingredients-by-category');
|
||||
|
||||
|
||||
});
|
26
Modules/Ingredient/vite.config.js
Normal file
26
Modules/Ingredient/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-ingredient',
|
||||
emptyOutDir: true,
|
||||
manifest: true,
|
||||
},
|
||||
plugins: [
|
||||
laravel({
|
||||
publicDirectory: '../../public',
|
||||
buildDirectory: 'build-ingredient',
|
||||
input: [
|
||||
__dirname + '/resources/assets/sass/app.scss',
|
||||
__dirname + '/resources/assets/js/app.js'
|
||||
],
|
||||
refresh: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
//export const paths = [
|
||||
// 'Modules/Ingredient/resources/assets/sass/app.scss',
|
||||
// 'Modules/Ingredient/resources/assets/js/app.js',
|
||||
//];
|
@ -16,4 +16,12 @@
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
<script>
|
||||
function validateNumericInput(input) {
|
||||
// Allow only numbers and remove any non-numeric input
|
||||
input.value = input.value.replace(/[^0-9.]/g, '');
|
||||
input.value = input.value.replace(/(\..*)\./g, '$1');
|
||||
input.value = input.value.replace(/^(\d+)(\.\d{0,2})?.*/, '$1$2');
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
@ -23,9 +23,9 @@
|
||||
<tr>
|
||||
<th>S.N</th>
|
||||
<th>Title</th>
|
||||
<th>Fabric Category</th>
|
||||
<th>Product Category</th>
|
||||
<th>Product Code</th>
|
||||
<th>Price</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
@ -36,9 +36,9 @@
|
||||
<tr>
|
||||
<td>{{ $key + 1 }}</td>
|
||||
<td>{{ $product->name }}</td>
|
||||
<td>{{ optional($product->fabricCategory)->title }}</td>
|
||||
<td>{{ optional($product->category)->title }}</td>
|
||||
<td>{{ $product->code }}</td>
|
||||
<td>{{ $product->price }}</td>
|
||||
<td>{!! $product->status_name !!}</td>
|
||||
<td>
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
|
@ -13,16 +13,17 @@
|
||||
{{ html()->text('code')->class('form-control')->placeholder('Enter Product Code')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Fabric Category')->class('form-label') }}
|
||||
{{ html()->select('fabriccategory_id', $fabricCategory)->class('form-select select2')->placeholder('Select Fabric Category')->id('fabric_category_id') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ 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-6">
|
||||
{{ html()->label('Price')->class('form-label') }}
|
||||
{{ html()->text('price')->class('form-control product-price cleave-numeral rate~~')->placeholder('Enter Price')->attributes(['onkeyup' => 'validateNumericInput(this)'])->required() }}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Description')->class('form-label') }}
|
||||
{{ html()->textarea('desc')->class('form-control')->placeholder('Enter Description') }}
|
||||
|
0
Modules/PurchaseEntry/app/Http/Controllers/.gitkeep
Normal file
0
Modules/PurchaseEntry/app/Http/Controllers/.gitkeep
Normal file
@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\PurchaseEntry\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Admin\Repositories\FieldInterface;
|
||||
use Modules\Supplier\Repositories\SupplierInterface;
|
||||
use Modules\Ingredient\Repositories\IngredientCategoryInterface;
|
||||
use Modules\Ingredient\Repositories\IngredientInterface;
|
||||
use Modules\Ingredient\Repositories\UnitInterface;
|
||||
use Modules\PurchaseEntry\Models\PurchaseEntry;
|
||||
use Modules\PurchaseEntry\Repositories\PurchaseEntryInterface;
|
||||
use Modules\Stock\Repositories\StockInterface;
|
||||
|
||||
class PurchaseEntryController extends Controller
|
||||
{
|
||||
|
||||
private $ingredientRepository;
|
||||
private $supplierRepository;
|
||||
private $purchaseEntryRepository;
|
||||
private $ingredientCategoryRepository;
|
||||
private $stockRepository;
|
||||
private $unitRepository;
|
||||
private $fieldRepository;
|
||||
|
||||
public function __construct( IngredientInterface $ingredientRepository,
|
||||
SupplierInterface $supplierRepository,
|
||||
PurchaseEntryInterface $purchaseEntryRepository,
|
||||
IngredientCategoryInterface $ingredientCategoryRepository,
|
||||
StockInterface $stockRepository,
|
||||
FieldInterface $fieldRepository,
|
||||
UnitInterface $unitRepository)
|
||||
{
|
||||
$this->ingredientRepository = $ingredientRepository;
|
||||
$this->unitRepository = $unitRepository;
|
||||
$this->supplierRepository = $supplierRepository;
|
||||
$this->purchaseEntryRepository = $purchaseEntryRepository;
|
||||
$this->ingredientCategoryRepository = $ingredientCategoryRepository;
|
||||
$this->stockRepository = $stockRepository;
|
||||
$this->fieldRepository = $fieldRepository;
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$filters = $request->all();
|
||||
$data['title'] = 'Purchase Entries';
|
||||
$data['stockList'] = $this->stockRepository->pluck();
|
||||
$data['ingredientList'] = $this->ingredientRepository->pluck();
|
||||
$data['ingredientCategoryList'] = $this->ingredientCategoryRepository->pluck();
|
||||
$data['purchaseEntries'] = $this->purchaseEntryRepository->findAll($filters);
|
||||
return view('purchaseEntry::purchaseEntry.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'New Purchase Entry';
|
||||
$data['stockList'] = $this->stockRepository->pluck();
|
||||
$data['unitList'] = $this->unitRepository->pluck();
|
||||
$data['ingredientList'] = $this->ingredientRepository->pluck();
|
||||
$data['ingredientCategoryList'] = $this->ingredientCategoryRepository->pluck();
|
||||
$data['supplierList'] = $this->supplierRepository->pluck();
|
||||
$data['sizes'] = $this->fieldRepository->getDropdownByAlias('size');
|
||||
$data['paymentModes'] = $this->fieldRepository->getDropdownByAlias('payment-mode');
|
||||
$data['editable'] = false;
|
||||
|
||||
return view('purchaseEntry::purchaseEntry.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$this->purchaseEntryRepository->create($request);
|
||||
|
||||
return redirect()->route('purchaseEntry.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('purchaseEntry::purchaseEntry.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['supplierList'] = $this->supplierRepository->pluck();
|
||||
$data['ingredientCategoryList'] = $this->ingredientCategoryRepository->pluck();
|
||||
$data['stockList'] = $this->stockRepository->pluck();
|
||||
$data['unitList'] = $this->unitRepository->pluck();
|
||||
$data['ingredientList'] = $this->ingredientRepository->pluck();
|
||||
$data['sizes'] = $this->fieldRepository->getDropdownByAlias('size');
|
||||
$data['paymentModes'] = $this->fieldRepository->getDropdownByAlias('payment-mode');
|
||||
$data['order'] = PurchaseEntry::with('orderDetails')->find($id);
|
||||
$data['id'] = $id;
|
||||
$data['editable'] = true;
|
||||
$data['title'] = "Edit Purchase Entry";
|
||||
return view('purchaseEntry::purchaseEntry.edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$this->purchaseEntryRepository->update($id,$request);
|
||||
return redirect()->route('purchaseEntry.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
return $this->purchaseEntryRepository->delete($id);
|
||||
}
|
||||
|
||||
public function clonePurchaseIngredient(Request $request)
|
||||
{
|
||||
$data = [];
|
||||
$numInc = $request->numberInc;
|
||||
$script = true;
|
||||
$ingredientList= $this->ingredientRepository->pluck('id');
|
||||
$stockList= $this->stockRepository->pluck('id');
|
||||
$ingredientCategoryList= $this->ingredientCategoryRepository->pluck('id');
|
||||
$sizes = $this->fieldRepository->getDropdownByAlias('size');
|
||||
$paymentModes = $this->fieldRepository->getDropdownByAlias('payment-mode');
|
||||
|
||||
return response()->json([
|
||||
'view' => view('purchaseEntry::purchaseEntry.clone-product', compact('data', 'numInc', 'script', 'ingredientList', 'ingredientCategoryList', 'stockList', 'sizes', 'paymentModes'))->render(),
|
||||
]);
|
||||
}
|
||||
public function clonePurchaseProduct(Request $request)
|
||||
{
|
||||
$data = [];
|
||||
$numInc = $request->numberInc;
|
||||
$script = true;
|
||||
$ingredientList= $this->ingredientRepository->pluck('id');
|
||||
$stockList= $this->stockRepository->pluck('id');
|
||||
$unitList = $this->unitRepository->pluck('id');
|
||||
$ingredientCategoryList= $this->ingredientCategoryRepository->pluck('id');
|
||||
$sizes = $this->fieldRepository->getDropdownByAlias('size');
|
||||
$paymentModes = $this->fieldRepository->getDropdownByAlias('payment-mode');
|
||||
|
||||
return response()->json([
|
||||
'view' => view('purchaseEntry::purchaseEntry.clone-ingredient', compact('data', 'numInc', 'script', 'ingredientList', 'ingredientCategoryList', 'stockList', 'unitList', 'sizes', 'paymentModes'))->render(),
|
||||
]);
|
||||
}
|
||||
}
|
0
Modules/PurchaseEntry/app/Http/Requests/.gitkeep
Normal file
0
Modules/PurchaseEntry/app/Http/Requests/.gitkeep
Normal file
0
Modules/PurchaseEntry/app/Models/.gitkeep
Normal file
0
Modules/PurchaseEntry/app/Models/.gitkeep
Normal file
42
Modules/PurchaseEntry/app/Models/PurchaseEntry.php
Normal file
42
Modules/PurchaseEntry/app/Models/PurchaseEntry.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\PurchaseEntry\Models;
|
||||
|
||||
use App\Traits\StatusTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Modules\Customer\Models\Customer;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Modules\PurchaseEntry\Models\PurchaseEntryDetail;
|
||||
use Modules\Supplier\Models\Supplier;
|
||||
|
||||
class PurchaseEntry extends Model
|
||||
{
|
||||
USE StatusTrait;
|
||||
|
||||
protected $table = 'tbl_purchaseentries';
|
||||
protected $fillable = [
|
||||
'supplier_id',
|
||||
'purchase_date',
|
||||
'payment',
|
||||
'paymentmode_id',
|
||||
'paymentref',
|
||||
'total_amt',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
protected $appends = ['status_name'];
|
||||
|
||||
|
||||
public function purchaseEntryDetails():HasMany{
|
||||
return $this->hasMany(PurchaseEntryDetail::class,'purchaseentry_id');
|
||||
}
|
||||
|
||||
public function supplier():BelongsTo{
|
||||
return $this->belongsTo(Supplier::class);
|
||||
}
|
||||
|
||||
public static function getFillableField(){
|
||||
return (new self())->fillable;
|
||||
}
|
||||
}
|
39
Modules/PurchaseEntry/app/Models/PurchaseEntryDetail.php
Normal file
39
Modules/PurchaseEntry/app/Models/PurchaseEntryDetail.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\PurchaseEntry\Models;
|
||||
|
||||
use App\Traits\StatusTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Modules\PurchaseEntry\Models\PurchaseEntry;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Modules\Supplier\Models\Supplier;
|
||||
|
||||
|
||||
class PurchaseEntryDetail extends Model
|
||||
{
|
||||
USE StatusTrait;
|
||||
|
||||
protected $table = 'tbl_purchaseentrydetails';
|
||||
protected $fillable = [
|
||||
'purchaseentry_id',
|
||||
'product_id',
|
||||
'category_id',
|
||||
'stock_id',
|
||||
'size_id',
|
||||
'unit',
|
||||
'price',
|
||||
'rate',
|
||||
'quantity',
|
||||
'amount',
|
||||
'desc',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
protected $appends = ['status_name'];
|
||||
|
||||
|
||||
public function order(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PurchaseEntry::class);
|
||||
}
|
||||
}
|
0
Modules/PurchaseEntry/app/Observers/.gitkeep
Normal file
0
Modules/PurchaseEntry/app/Observers/.gitkeep
Normal file
0
Modules/PurchaseEntry/app/Providers/.gitkeep
Normal file
0
Modules/PurchaseEntry/app/Providers/.gitkeep
Normal file
32
Modules/PurchaseEntry/app/Providers/EventServiceProvider.php
Normal file
32
Modules/PurchaseEntry/app/Providers/EventServiceProvider.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\PurchaseEntry\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event handler mappings for the application.
|
||||
*
|
||||
* @var array<string, array<int, string>>
|
||||
*/
|
||||
protected $listen = [];
|
||||
|
||||
/**
|
||||
* Indicates if events should be discovered.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected static $shouldDiscoverEvents = true;
|
||||
|
||||
/**
|
||||
* Configure the proper event listeners for email verification.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function configureEmailVerification(): void
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\PurchaseEntry\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Ingredient\Repositories\IngredientCategoryInterface;
|
||||
use Modules\Ingredient\Repositories\IngredientCategoryRepository;
|
||||
use Modules\Ingredient\Repositories\IngredientInterface;
|
||||
use Modules\Ingredient\Repositories\IngredientRepository;
|
||||
use Modules\Ingredient\Repositories\UnitInterface;
|
||||
use Modules\Ingredient\Repositories\UnitRepository;
|
||||
use Modules\PurchaseEntry\Repositories\PurchaseEntryInterface;
|
||||
use Modules\PurchaseEntry\Repositories\PurchaseEntryRepository;
|
||||
|
||||
class PurchaseEntryServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'PurchaseEntry';
|
||||
|
||||
protected string $moduleNameLower = 'purchaseEntry';
|
||||
|
||||
/**
|
||||
* 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->register(EventServiceProvider::class);
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
$this->app->bind(PurchaseEntryInterface::class, PurchaseEntryRepository::class);
|
||||
$this->app->bind(IngredientInterface::class, IngredientRepository::class);
|
||||
$this->app->bind(UnitInterface::class, UnitRepository::class);
|
||||
$this->app->bind(IngredientCategoryInterface::class, IngredientCategoryRepository::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.
|
||||
*
|
||||
* @return array<string>
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string>
|
||||
*/
|
||||
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/PurchaseEntry/app/Providers/RouteServiceProvider.php
Normal file
49
Modules/PurchaseEntry/app/Providers/RouteServiceProvider.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\PurchaseEntry\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('PurchaseEntry', '/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('PurchaseEntry', '/routes/api.php'));
|
||||
}
|
||||
}
|
0
Modules/PurchaseEntry/app/Repositories/.gitkeep
Normal file
0
Modules/PurchaseEntry/app/Repositories/.gitkeep
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\PurchaseEntry\Repositories;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
interface PurchaseEntryInterface
|
||||
{
|
||||
public function findAll($filters);
|
||||
public function getPurchaseEntryById($PurchaseEntryId);
|
||||
public function getPurchaseEntryByEmail($email);
|
||||
public function delete($PurchaseEntryId);
|
||||
public function create(Request $request);
|
||||
public function update($PurchaseEntryId, Request $request);
|
||||
public function pluck();
|
||||
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\PurchaseEntry\Repositories;
|
||||
|
||||
use Flasher\Laravel\Http\Request;
|
||||
use Modules\PurchaseEntry\Models\PurchaseEntry;
|
||||
use Modules\PurchaseEntry\Models\PurchaseEntryDetail;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class PurchaseEntryRepository implements PurchaseEntryInterface
|
||||
{
|
||||
// public function findAll()
|
||||
// {
|
||||
// return PurchaseEntry::when(true, function ($query) {
|
||||
// })->paginate(20);
|
||||
// }
|
||||
public function findAll($filters = [], $limit = null, $offset = null)
|
||||
{
|
||||
return PurchaseEntry::when($filters, function ($query) use ($filters) {
|
||||
|
||||
if (isset($filters["ingredient_category_id"])) {
|
||||
$query->whereHas('purchaseEntryDetails', function ( $query) use ($filters) {
|
||||
$query->where('ingredient_category_id', '=', $filters["ingredient_category_id"]);
|
||||
});
|
||||
}
|
||||
if (isset($filters["ingredient_id"])) {
|
||||
$query->whereHas('purchaseEntryDetails', function ( $query) use ($filters) {
|
||||
$query->where('ingredient_id', '=', $filters["ingredient_id"]);
|
||||
});
|
||||
}
|
||||
// if (isset($filters["stock_id"])) {
|
||||
// $query->whereHas('purchaseEntryDetails', function ( $query) use ($filters) {
|
||||
// $query->where('stock_id', '=', $filters["stock_id"]);
|
||||
// });
|
||||
// }
|
||||
|
||||
if (isset($filters["date"])) {
|
||||
$explodeDate = explode("to", $filters['date']);
|
||||
$query->whereBetween("purchase_date", [$explodeDate[0], preg_replace('/\s+/', '', $explodeDate[1])]);
|
||||
}
|
||||
|
||||
})->get();
|
||||
}
|
||||
|
||||
public function getPurchaseEntryById($PurchaseEntryId)
|
||||
{
|
||||
return PurchaseEntry::findOrFail($PurchaseEntryId);
|
||||
}
|
||||
|
||||
public function getPurchaseEntryByEmail($email)
|
||||
{
|
||||
return PurchaseEntry::where('email', $email)->first();
|
||||
}
|
||||
|
||||
public function delete($PurchaseEntryId)
|
||||
{
|
||||
DB::transaction(function() use ($PurchaseEntryId) {
|
||||
PurchaseEntryDetail::where('purchaseentry_id', $PurchaseEntryId)->delete();
|
||||
|
||||
PurchaseEntry::destroy($PurchaseEntryId);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public function create($request)
|
||||
{
|
||||
$purchaseEntryDetails = $request->except(PurchaseEntry::getFillableField());
|
||||
|
||||
$purchaseEntry = $request->only(PurchaseEntry::getFillableField());
|
||||
$purchaseEntryData = PurchaseEntry::create($purchaseEntry);
|
||||
|
||||
$request->merge(['purchaseentry_id' => $purchaseEntryData->id]);
|
||||
|
||||
foreach ($purchaseEntryDetails['ingredient_id'] as $key => $ingredientId) {
|
||||
// dd($request->input('purchaseentry_id'));
|
||||
$data = [
|
||||
'purchaseentry_id' => $request->input('purchaseentry_id'),
|
||||
'ingredient_id' => $purchaseEntryDetails['ingredient_id'][$key],
|
||||
'ingredient_category_id' => $purchaseEntryDetails['ingredient_category_id'][$key],
|
||||
// 'stock_id' => $purchaseEntryDetails['stock_id'][$key],
|
||||
// 'size_id' => $purchaseEntryDetails['size_id'][$key],
|
||||
'rate' => $purchaseEntryDetails['price'][$key],
|
||||
'unit_id' => $purchaseEntryDetails['unit_id'][$key],
|
||||
'quantity' => $purchaseEntryDetails['qty'][$key],
|
||||
'amount' => $purchaseEntryDetails['amt'][$key],
|
||||
'desc' => $purchaseEntryDetails['desc'][$key],
|
||||
];
|
||||
PurchaseEntryDetail::create($data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function update($PurchaseEntryId, $request)
|
||||
{
|
||||
$fillableFields = PurchaseEntry::getFillableField();
|
||||
$purchaseEntryData = $request->only($fillableFields);
|
||||
|
||||
$purchaseEntry = PurchaseEntry::find($PurchaseEntryId);
|
||||
$purchaseEntry->update($purchaseEntryData);
|
||||
|
||||
|
||||
$additionalExcludes = ['_method', '_token'];
|
||||
$excludeFields = array_merge($fillableFields, $additionalExcludes);
|
||||
|
||||
$data = $request->except($excludeFields);
|
||||
|
||||
$updatedCombinations = [];
|
||||
|
||||
if (isset($data['product_id'])) {
|
||||
foreach ($data['product_id'] as $key => $productId) {
|
||||
$obj = [
|
||||
'purchaseentry_id' => $PurchaseEntryId,
|
||||
'product_id' => $productId,
|
||||
'unit' => $data['unit'][$key],
|
||||
'rate' => $data['rate'][$key],
|
||||
'quantity' => $data['qty'][$key],
|
||||
'amount' => $data['amt'][$key],
|
||||
'desc' => $data['desc'][$key],
|
||||
];
|
||||
|
||||
$combinationKey = "{$PurchaseEntryId}_{$productId}_{$data['unit'][$key]}";
|
||||
|
||||
$purchaseEntryDetail = $purchaseEntry->purchaseEntryDetails()->where('product_id', $productId)->where('unit', $data['unit'][$key])->first();
|
||||
if ($purchaseEntryDetail) {
|
||||
$purchaseEntryDetail->update($obj);
|
||||
} else {
|
||||
PurchaseEntryDetail::create($obj);
|
||||
}
|
||||
|
||||
$updatedCombinations[] = $combinationKey;
|
||||
}
|
||||
}
|
||||
|
||||
$purchaseEntry->purchaseEntryDetails()->each(function ($purchaseEntryDetail) use ($updatedCombinations) {
|
||||
$combinationKey = "{$purchaseEntryDetail->purchaseEntry_id}_{$purchaseEntryDetail->product_id}_{$purchaseEntryDetail->unit}";
|
||||
if (!in_array($combinationKey, $updatedCombinations)) {
|
||||
$purchaseEntryDetail->delete();
|
||||
}
|
||||
});
|
||||
|
||||
return $purchaseEntry;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function pluck()
|
||||
{
|
||||
return PurchaseEntry::pluck('name', 'id');
|
||||
}
|
||||
}
|
30
Modules/PurchaseEntry/composer.json
Normal file
30
Modules/PurchaseEntry/composer.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "nwidart/purchaseentry",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Widart",
|
||||
"email": "n.widart@gmail.com"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\PurchaseEntry\\": "app/",
|
||||
"Modules\\PurchaseEntry\\Database\\Factories\\": "database/factories/",
|
||||
"Modules\\PurchaseEntry\\Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Modules\\PurchaseEntry\\Tests\\": "tests/"
|
||||
}
|
||||
}
|
||||
}
|
0
Modules/PurchaseEntry/config/.gitkeep
Normal file
0
Modules/PurchaseEntry/config/.gitkeep
Normal file
5
Modules/PurchaseEntry/config/config.php
Normal file
5
Modules/PurchaseEntry/config/config.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'PurchaseEntry',
|
||||
];
|
0
Modules/PurchaseEntry/database/factories/.gitkeep
Normal file
0
Modules/PurchaseEntry/database/factories/.gitkeep
Normal file
0
Modules/PurchaseEntry/database/migrations/.gitkeep
Normal file
0
Modules/PurchaseEntry/database/migrations/.gitkeep
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('tbl_purchaseentries', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->date('purchase_date')->nullable();
|
||||
$table->unsignedBigInteger('supplier_id')->nullable();
|
||||
$table->string('payment')->nullable();
|
||||
$table->unsignedBigInteger('paymentmode_id')->nullable();
|
||||
$table->string('paymentref')->nullable();
|
||||
$table->decimal('total_amt', 10, 2)->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('tbl_purchaseentries');
|
||||
}
|
||||
};
|
||||
|
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('tbl_purchaseentrydetails', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('purchaseentry_id')->nullable();
|
||||
$table->unsignedBigInteger('ingredient_id')->nullable();
|
||||
$table->unsignedBigInteger('ingredient_category_id')->nullable();
|
||||
$table->unsignedBigInteger('unit_id')->nullable();
|
||||
$table->unsignedBigInteger('stock_id')->nullable();
|
||||
$table->integer('rate')->nullable();
|
||||
$table->integer('quantity')->nullable();
|
||||
$table->decimal('amount', 6);
|
||||
$table->text('desc')->nullable();
|
||||
$table->integer('status')->nullable();
|
||||
$table->text('remarks')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('tbl_purchaseentrydetails');
|
||||
}
|
||||
};
|
||||
|
0
Modules/PurchaseEntry/database/seeders/.gitkeep
Normal file
0
Modules/PurchaseEntry/database/seeders/.gitkeep
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\PurchaseEntry\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PurchaseEntryDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// $this->call([]);
|
||||
}
|
||||
}
|
11
Modules/PurchaseEntry/module.json
Normal file
11
Modules/PurchaseEntry/module.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "PurchaseEntry",
|
||||
"alias": "purchaseentry",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\PurchaseEntry\\Providers\\PurchaseEntryServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
15
Modules/PurchaseEntry/package.json
Normal file
15
Modules/PurchaseEntry/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/PurchaseEntry/resources/assets/.gitkeep
Normal file
0
Modules/PurchaseEntry/resources/assets/.gitkeep
Normal file
0
Modules/PurchaseEntry/resources/assets/js/app.js
Normal file
0
Modules/PurchaseEntry/resources/assets/js/app.js
Normal file
0
Modules/PurchaseEntry/resources/views/.gitkeep
Normal file
0
Modules/PurchaseEntry/resources/views/.gitkeep
Normal file
7
Modules/PurchaseEntry/resources/views/index.blade.php
Normal file
7
Modules/PurchaseEntry/resources/views/index.blade.php
Normal file
@ -0,0 +1,7 @@
|
||||
@extends('purchaseentry::layouts.master')
|
||||
|
||||
@section('content')
|
||||
<h1>Hello World</h1>
|
||||
|
||||
<p>Module: {!! config('purchaseentry.name') !!}</p>
|
||||
@endsection
|
@ -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>PurchaseEntry 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-purchaseentry', 'resources/assets/sass/app.scss') }} --}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@yield('content')
|
||||
|
||||
{{-- Vite JS --}}
|
||||
{{-- {{ module_vite('build-purchaseentry', 'resources/assets/js/app.js') }} --}}
|
||||
</body>
|
@ -0,0 +1,76 @@
|
||||
<div class="card card-body ingredient-card card-border-secondary mb-2 border">
|
||||
<div class="row gy-2 mb-2">
|
||||
<div class="col-md-2">
|
||||
{{ html()->label('Category')->class('form-label') }}
|
||||
@if (isset($editable) && $editable)
|
||||
{{ html()->select('ingredient_category_id[]', $ingredientCategoryList, $item->ingredient_category_id)->class('form-select ingredient_category_id')->attributes(['id' => 'ingredient_category_id'])->placeholder('Enter Category')->required() }}
|
||||
@else
|
||||
{{ html()->select('ingredient_category_id[]', $ingredientCategoryList)->class('form-select ingredient_category_id')->attributes(['id' => 'ingredient_category_id'])->placeholder('Enter Category')->required() }}
|
||||
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
{{ html()->label('Ingredient')->class('form-label') }}
|
||||
@if (isset($editable) && $editable)
|
||||
{{ html()->select('ingredient_id[]', $ingredientList, $item->ingredient_id)->class('form-select ingredient_id')->attributes(['id' => 'ingredient_id'])->placeholder('')->required() }}
|
||||
@else
|
||||
{{ html()->select('ingredient_id[]', [], null)->class('form-select ingredient_id')->attributes(['id' => 'ingredient_id'])->placeholder('')->required()->disabled() }}
|
||||
|
||||
@endif
|
||||
</div>
|
||||
{{-- <div class="col-md-2">
|
||||
{{ html()->label('Stock')->class('form-label') }}
|
||||
@if (isset($editable) && $editable)
|
||||
{{ html()->select('stock_id[]', $stockList, $item->stock_id)->class('form-select stock_id')->attributes(['id' => 'stock_id'])->placeholder('')->required() }}
|
||||
@else
|
||||
{{ html()->select('stock_id[]', $stockList)->class('form-select stock_id')->attributes(['id' => 'stock_id'])->placeholder('')->required()->disabled() }}
|
||||
|
||||
@endif
|
||||
</div> --}}
|
||||
{{-- <div class="col-md-1">
|
||||
{{ html()->label('Size')->class('form-label') }}
|
||||
{{ html()->select('size_id[]', $sizes)->class('form-select ')->placeholder('size') }}
|
||||
</div> --}}
|
||||
|
||||
<div class="col-md-2">
|
||||
{{ html()->label('Price')->class('form-label') }}
|
||||
{{ html()->text('price[]', isset($editable) && $editable ? $item->price : null)->class('form-control ingredient-price cleave-numeral rate~~')->placeholder('Price')->attributes(['id' => 'rate', 'onkeyup' => 'validatePriceInput(this)']) }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
{{ html()->label('Unit')->class('form-label') }}
|
||||
@if (isset($editable) && $editable)
|
||||
{{ html()->select('unit_id[]', $unitList, $item->unit_id)->class('form-select unit_id')->attributes(['id' => 'unit_id'])->placeholder('')->required() }}
|
||||
@else
|
||||
{{ html()->select('unit_id[]', $unitList)->class('form-select unit_id')->attributes(['id' => 'unit_id'])->placeholder('')->required() }}
|
||||
|
||||
@endif
|
||||
</div>
|
||||
|
||||
{{-- <div class="col-md-2">
|
||||
{{ html()->label('Unit')->class('form-label') }}
|
||||
{{ html()->text('unit[]', isset($editable) && $editable ? $item->unit : null)->class('form-control ingredient-unit cleave-numeral rate~~')->placeholder('Enter Unit')->required()}}
|
||||
</div> --}}
|
||||
|
||||
<div class="col-md-1">
|
||||
{{ html()->label('Quantity')->class('form-label') }}
|
||||
{{ html()->text('qty[]', isset($editable) && $editable ? $item->quantity : null)->class('form-control ingredient-quantity cleave-numeral qty')->placeholder('QTY')->attributes(['id' => 'qty', 'onkeyup' => 'validateNumericInput(this)']) }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
{{ html()->label('Amount')->class('form-label') }}
|
||||
{{ html()->text('amt[]', isset($editable) && $editable ? $item->amount : null)->class('form-control ingredient-line-price bg-light')->placeholder('Enter Amount')->isReadOnly() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Description')->class('form-label') }}
|
||||
{{ html()->text('desc[]', isset($editable) && $editable ? $item->desc : null)->class('form-control')->placeholder('Enter Description') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 d-flex justify-content-end align-items-end">
|
||||
<button type="button" class="btn btn-danger btn-icon waves-effect btn-remove waves-light"><i
|
||||
class="ri-delete-bin-5-line"></i></button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,27 @@
|
||||
@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 -->
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form action="{{ route('purchaseEntry.store') }}" class="needs-validation" novalidate method="post">
|
||||
@csrf
|
||||
@include('purchaseEntry::purchaseEntry.partials.action')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
@ -0,0 +1,47 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
|
||||
<h4 class="mb-sm-0">{{ $title }}</h4>
|
||||
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
|
||||
<li class="breadcrumb-item active">{{ $title }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
{{ html()->modelForm($order, 'PUT')->route('order.update', $id)->class(['needs-validation'])->attributes(['novalidate'])->open() }}
|
||||
|
||||
@include('order::order.partials.action')
|
||||
|
||||
{{ html()->closeModelForm() }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end row-->
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
@ -0,0 +1,71 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('purchaseEntry::purchaseEntry.partials.menu')
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header align-items-center d-flex">
|
||||
<h5 class="card-title flex-grow-1 mb-0">{{ $title }}</h5>
|
||||
<div class="flex-shrink-0">
|
||||
<a href="{{ route('purchaseEntry.create') }}" class="btn btn-success waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Add</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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>Supplier</th>
|
||||
<th>Purchase Date</th>
|
||||
<th>Total Amount</th>
|
||||
{{-- <th>Action</th> --}}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($purchaseEntries as $key => $item)
|
||||
{{-- @dd($item) --}}
|
||||
<tr>
|
||||
<td>{{ $key + 1 }}</td>
|
||||
<td>{{ $item->supplier->supplier_name }}</td>
|
||||
<td>{{ $item->purchase_date }}</td>
|
||||
<td>{{ $item->total_amt }}</td>
|
||||
{{-- <td>
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
<a href="javascript:void(0);" class="link-info fs-15 view-item-btn"
|
||||
data-bs-toggle="modal" data-bs-target="#viewModal" data-link="{{ route('purchaseEntry.show', $item->id) }}">
|
||||
|
||||
<i class="ri-eye-line"></i>
|
||||
</a>
|
||||
<a href="{{ route('purchaseEntry.edit', $item->id) }}"
|
||||
class="link-success fs-15 edit-item-btn"><i
|
||||
class="ri-edit-2-line"></i></a>
|
||||
|
||||
<a href="javascript:void(0);"
|
||||
data-link="{{ route('purchaseEntry.destroy', $item->id) }}"
|
||||
data-id="{{ $item->id }}"
|
||||
class="link-danger fs-15 remove-item-btn"><i
|
||||
class="ri-delete-bin-line"></i></a>
|
||||
|
||||
</div>
|
||||
</td> --}}
|
||||
</tr>
|
||||
@empty
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end row-->
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@ -0,0 +1,271 @@
|
||||
<div class="row gy-1">
|
||||
<h5 class="text-primary text-center">Order Details</h5>
|
||||
<div class="border border-dashed"></div>
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Purchase Date')->class('form-label') }}
|
||||
{{ html()->date('purchase_date')->class('form-control')->placeholder('Choose Purchase Date')->required() }}
|
||||
{{ html()->div('Please choose Purchase date')->class('invalid-feedback') }}
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
{{ html()->label('Supplier')->class('form-label') }}
|
||||
{{ html()->select('supplier_id', $supplierList)->class('form-control')->placeholder('Select Supplier')->required() }}
|
||||
{{ html()->div('Please select supplier')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{{-- <div class="row mt-2">
|
||||
<p class="text-primary">Shipping Details</p>
|
||||
<div class="border border-dashed"></div>
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Address')->class('form-label') }}
|
||||
{{ html()->text('address')->class('form-control')->placeholder('Enter Address') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Shipping Date')->class('form-label') }}
|
||||
{{ html()->date('shiiping_date')->class('form-control')->placeholder('Enter Temporary Address') }}
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
<div class="row gy-1 gx-2 mt-1">
|
||||
<div class="d-flex justify-content-end">
|
||||
<button type="button" class="btn btn-info btn-icon add-btn text-end"><i class="ri-add-line"></i></button>
|
||||
</div>
|
||||
@if ($editable && $purchaseEntry->purchaseEntryDetail->isNotEmpty())
|
||||
@foreach ($purchaseEntry->purchaseEntryDetail as $item)
|
||||
@include('purchaseEntry::purchaseEntry.clone-ingredient')
|
||||
@endforeach
|
||||
@else
|
||||
@include('purchaseEntry::purchaseEntry.clone-ingredient')
|
||||
@endif
|
||||
<div class="appendProductCard"></div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-end w-30 mb-2">
|
||||
<table class="table-borderless align-middle">
|
||||
<tbody>
|
||||
{{-- <tr>
|
||||
<th scope="row">Sub Total</th>
|
||||
<td style="width:150px;">
|
||||
<input type="text" name="sub_total" class="form-control bg-light border-0" id="subtotal"
|
||||
placeholder="$0.00" readonly="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Estimated Tax (11%)</th>
|
||||
<td>
|
||||
<input type="text" name="tax" class="form-control bg-light border-0" id="tax"
|
||||
placeholder="$0.00" readonly="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Discount</th>
|
||||
<td>
|
||||
<input type="text" name="discount_amt" class="form-control bg-light border-0" id="discount"
|
||||
placeholder="$0.00" readonly="">
|
||||
</td>
|
||||
</tr> --}}
|
||||
<tr class="border-top border-top-dashed">
|
||||
<th scope="row">Total Amount</th>
|
||||
<td>
|
||||
<input type="text" name="total_amt" class="form-control bg-light border-0" id="total"
|
||||
placeholder="$0.00" readonly="">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row gy-1 my-2 mb-4">
|
||||
<h5 class="text-primary text-center">Payment Details</h5>
|
||||
<div class="border border-dashed"></div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Payment')->class('form-label') }}
|
||||
{{ html()->text('payment')->class('form-control')->placeholder('Enter Payment') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Mode of Payment')->class('form-label') }}
|
||||
{{ html()->select('paymentmode_id', $paymentModes)->class('form-select select2')->placeholder('Select Payment Mode') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Payment Reference')->class('form-label') }}
|
||||
{{ html()->text('paymentref')->class('form-control')->placeholder('Enter Payment Reference') }}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mb-4 mt-4 text-end">
|
||||
<button type="submit" class="btn btn-success w-sm">Save</button>
|
||||
</div>
|
||||
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/libs/cleave.js/cleave.min.js') }}"></script>
|
||||
<script src="{{ asset('assets/js/pages/form-masks.init.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$("body").on('click', '.add-btn', function(e) {
|
||||
e.preventDefault();
|
||||
numberInc = $('.ingredient-card').length
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{ route('purchaseEntry.clonePurchaseProduct') }}',
|
||||
data: {
|
||||
numberInc: numberInc
|
||||
},
|
||||
success: function(response) {
|
||||
$('.appendProductCard').append(response.view)
|
||||
// $('#purchaseEntry-container').html(response.view).fadeIn()
|
||||
},
|
||||
error: function(xhr) {
|
||||
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
$("body").on('click', '.btn-remove', function() {0
|
||||
if ($('.ingredient-card').length > 1) {
|
||||
$(this).parents(".ingredient-card").remove();
|
||||
}
|
||||
recalculate();
|
||||
});
|
||||
|
||||
$(window).on('load', function() {
|
||||
recalculate();
|
||||
})
|
||||
|
||||
function validateNumericInput(input) {
|
||||
// Allow only numbers and remove any non-numeric input
|
||||
input.value = input.value.replace(/[^0-9]/g, '');
|
||||
}
|
||||
|
||||
|
||||
function amountKeyup() {
|
||||
$("body").on('keyup', '.ingredient-price', function() {
|
||||
var priceInput = $(this);
|
||||
var qtyInput = priceInput.closest(".row").find(".ingredient-quantity");
|
||||
var linePrice = priceInput.closest(".row").find(".ingredient-line-price");
|
||||
updateQuantity(priceInput.val(), qtyInput.val(), linePrice);
|
||||
});
|
||||
|
||||
$("body").on('keyup', '.ingredient-quantity', function() {
|
||||
var priceInput = $(this);
|
||||
var qtyInput = priceInput.closest(".row").find(".ingredient-price");
|
||||
var linePrice = priceInput.closest(".row").find(".ingredient-line-price");
|
||||
updateQuantity(priceInput.val(), qtyInput.val(), linePrice);
|
||||
});
|
||||
}
|
||||
|
||||
amountKeyup()
|
||||
|
||||
function updateQuantity(rate, qty, linePriceInput) {
|
||||
var amount = (rate * qty).toFixed(2);
|
||||
linePriceInput.val(amount);
|
||||
recalculate();
|
||||
}
|
||||
|
||||
function recalculate() {
|
||||
var subtotal = 0;
|
||||
$(".ingredient-line-price").each(function() {
|
||||
if ($(this).val()) {
|
||||
subtotal += parseFloat($(this).val());
|
||||
}
|
||||
});
|
||||
|
||||
// var tax = subtotal * 0.125;
|
||||
// var discount = subtotal * 0.15;
|
||||
// var shipping = subtotal > 0 ? 65 : 0;
|
||||
// var total = subtotal + tax + shipping - discount;
|
||||
|
||||
// $("#subtotal").val(subtotal.toFixed(2));
|
||||
// $("#tax").val(tax.toFixed(2));
|
||||
// $("#discount").val(discount.toFixed(2));
|
||||
// $("#shipping").val(shipping.toFixed(2));
|
||||
$("#total").val(subtotal.toFixed(2));
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.ingredient_id').prop('disabled', true);
|
||||
// $('.stock_id').prop('disabled', true);
|
||||
$('body').on('change', '.ingredient_id', function() {
|
||||
var selectedId = $(this).find(':selected').val();
|
||||
var formRow = $(this).closest('.row');
|
||||
|
||||
if (selectedId) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '{{ route('get-ingredient-detail') }}',
|
||||
data: {
|
||||
id: selectedId
|
||||
},
|
||||
success: function(response) {
|
||||
var qtyInput = formRow.find('#qty').val(response.data.qty);
|
||||
formRow.find('#unit').val(response.data.unit);
|
||||
var priceInput = formRow.find('#rate').val(response.data.price);
|
||||
var linePrice = priceInput.closest(".row").find(".ingredient-line-price");
|
||||
|
||||
|
||||
updateQuantity(priceInput.val(), qtyInput.val(), linePrice);
|
||||
},
|
||||
error: function(xhr) {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// When category is selected, load ingredients dynamically
|
||||
$('body').on('change', '.ingredient_category_id', function () {
|
||||
var ingredientCategoryId = $(this).val();
|
||||
var formRow = $(this).closest('.row');
|
||||
var ingredientSelect = formRow.find('.ingredient_id');
|
||||
// var stockSelect = formRow.find('.stock_id');
|
||||
|
||||
// Reset stock field
|
||||
|
||||
if (ingredientCategoryId) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '{{ route('ingredients-by-category') }}', // Route to get ingredients by category
|
||||
data: {ingredient_category_id:ingredientCategoryId},
|
||||
success: function (response) {
|
||||
ingredientSelect.empty().append('<option value="">Select Product</option>');
|
||||
ingredientSelect.prop('disabled', false);
|
||||
|
||||
$.each(response.ingredients, function (id, name) {
|
||||
ingredientSelect.append('<option value="' + id + '">' + name + '</option>');
|
||||
});
|
||||
},
|
||||
error: function (xhr) {
|
||||
// Handle error
|
||||
}
|
||||
});
|
||||
// stockSelect.empty().prop('disabled', true);
|
||||
|
||||
} else {
|
||||
ingredientSelect.prop('disabled', true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
<script>
|
||||
function validateNumericInput(input) {
|
||||
// Allow only numbers and remove any non-numeric input
|
||||
input.value = input.value.replace(/[^0-9.]/g, '');
|
||||
input.value = input.value.replace(/(\..*)\./g, '$1');
|
||||
input.value = input.value.replace(/^(\d+)(\.\d{0,2})?.*/, '$1$2');
|
||||
}
|
||||
</script>
|
||||
|
||||
@endpush
|
@ -0,0 +1,74 @@
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row g-2">
|
||||
<div class="col-sm-12">
|
||||
{{ html()->form('GET')->route('purchaseEntry.index')->open() }}
|
||||
<div class="row g-8">
|
||||
{{-- <div class="col-xl-3">
|
||||
<div class="search-box">
|
||||
{{ html()->text('search')->class('form-control search')->value(request('search'))->placeholder('Search...') }}
|
||||
<i class="ri-search-line search-icon"></i>
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div class="">
|
||||
{{ html()->text('date')->class('form-control')->value(request('date'))->placeholder('Date Range')->attributes([
|
||||
'id' => 'datepicker-range',
|
||||
'data-provider' => 'flatpickr',
|
||||
'data-date-format' => 'Y-m-d',
|
||||
'data-range-date' => 'true',
|
||||
]) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-2">
|
||||
<div class="search-box">
|
||||
{{ html()->select('ingredient_category_id', $ingredientCategoryList)->class('form-control select2')->value(request('ingredient_category_id'))->placeholder('By Category') }}
|
||||
</div>
|
||||
</div>
|
||||
{{-- <div class="col-sm-2">
|
||||
<div class="search-box">
|
||||
{{ html()->select('stock_id', $stockList)->class('form-control select2')->value(request('stock_id'))->placeholder('By Stock') }}
|
||||
</div>
|
||||
</div> --}}
|
||||
<div class="col-sm-2">
|
||||
<div class="search-box">
|
||||
{{ html()->select('ingredient_id', $ingredientList)->class('form-control select2')->value(request('ingredient_id'))->placeholder('By Product') }}
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
{{-- <div class="align-item-right"> --}}
|
||||
<div class="col-sm-1 offset-lg-1">
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="ri-equalizer-fill me-2"></i>Filters</button>
|
||||
{{-- <a href="{{ route('task.index') }}" class="btn btn-danger">
|
||||
<i class="ri-bin-fill me-2"></i>Reset</a> --}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-1">
|
||||
<div>
|
||||
<a href="{{ route('purchaseEntry.index') }}" class="btn btn-primary">
|
||||
<i class="ri-loop-right-line me-2"></i>Reset</a>
|
||||
{{-- <a href="{{ route('task.index') }}" class="btn btn-danger">
|
||||
<i class="ri-bin-fill me-2"></i>Reset</a> --}}
|
||||
</div>
|
||||
</div>
|
||||
{{-- </div> --}}
|
||||
<!--end col-->
|
||||
</div>
|
||||
<!--end row-->
|
||||
{{ html()->form()->close() }}
|
||||
|
||||
</div>
|
||||
<!--end col-->
|
||||
|
||||
</div>
|
||||
<!--end row-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
</script>
|
0
Modules/PurchaseEntry/routes/.gitkeep
Normal file
0
Modules/PurchaseEntry/routes/.gitkeep
Normal file
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user