diff --git a/Modules/Ingredient/app/Http/Controllers/.gitkeep b/Modules/Ingredient/app/Http/Controllers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Ingredient/app/Http/Controllers/IngredientCategoryController.php b/Modules/Ingredient/app/Http/Controllers/IngredientCategoryController.php new file mode 100644 index 0000000..2bf6c14 --- /dev/null +++ b/Modules/Ingredient/app/Http/Controllers/IngredientCategoryController.php @@ -0,0 +1,105 @@ +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']); + } +} diff --git a/Modules/Ingredient/app/Http/Controllers/IngredientController.php b/Modules/Ingredient/app/Http/Controllers/IngredientController.php new file mode 100644 index 0000000..307bebc --- /dev/null +++ b/Modules/Ingredient/app/Http/Controllers/IngredientController.php @@ -0,0 +1,152 @@ +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]); + } + + +} diff --git a/Modules/Ingredient/app/Http/Controllers/UnitController.php b/Modules/Ingredient/app/Http/Controllers/UnitController.php new file mode 100644 index 0000000..7000dd7 --- /dev/null +++ b/Modules/Ingredient/app/Http/Controllers/UnitController.php @@ -0,0 +1,111 @@ +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']); + } + +} + + diff --git a/Modules/Ingredient/app/Http/Requests/.gitkeep b/Modules/Ingredient/app/Http/Requests/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Ingredient/app/Models/.gitkeep b/Modules/Ingredient/app/Models/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Ingredient/app/Models/Ingredient.php b/Modules/Ingredient/app/Models/Ingredient.php new file mode 100644 index 0000000..e7bdb7b --- /dev/null +++ b/Modules/Ingredient/app/Models/Ingredient.php @@ -0,0 +1,33 @@ +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'); + } +} diff --git a/Modules/Ingredient/app/Models/IngredientCategory.php b/Modules/Ingredient/app/Models/IngredientCategory.php new file mode 100644 index 0000000..7599d90 --- /dev/null +++ b/Modules/Ingredient/app/Models/IngredientCategory.php @@ -0,0 +1,16 @@ +> + */ + 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 + { + + } +} diff --git a/Modules/Ingredient/app/Providers/IngredientServiceProvider.php b/Modules/Ingredient/app/Providers/IngredientServiceProvider.php new file mode 100644 index 0000000..a95a831 --- /dev/null +++ b/Modules/Ingredient/app/Providers/IngredientServiceProvider.php @@ -0,0 +1,120 @@ +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 + */ + public function provides(): array + { + return []; + } + + /** + * @return array + */ + 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; + } +} diff --git a/Modules/Ingredient/app/Providers/RouteServiceProvider.php b/Modules/Ingredient/app/Providers/RouteServiceProvider.php new file mode 100644 index 0000000..dd76332 --- /dev/null +++ b/Modules/Ingredient/app/Providers/RouteServiceProvider.php @@ -0,0 +1,49 @@ +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')); + } +} diff --git a/Modules/Ingredient/app/Repositories/.gitkeep b/Modules/Ingredient/app/Repositories/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Ingredient/app/Repositories/IngredientCategoryInterface.php b/Modules/Ingredient/app/Repositories/IngredientCategoryInterface.php new file mode 100644 index 0000000..e81cb50 --- /dev/null +++ b/Modules/Ingredient/app/Repositories/IngredientCategoryInterface.php @@ -0,0 +1,15 @@ +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'); + } + +} diff --git a/Modules/Ingredient/app/Repositories/IngredientInterface.php b/Modules/Ingredient/app/Repositories/IngredientInterface.php new file mode 100644 index 0000000..54209be --- /dev/null +++ b/Modules/Ingredient/app/Repositories/IngredientInterface.php @@ -0,0 +1,16 @@ +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'); + } + +} + \ No newline at end of file diff --git a/Modules/Ingredient/app/Repositories/UnitInterface.php b/Modules/Ingredient/app/Repositories/UnitInterface.php new file mode 100644 index 0000000..46bf886 --- /dev/null +++ b/Modules/Ingredient/app/Repositories/UnitInterface.php @@ -0,0 +1,15 @@ +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'); + } + +} diff --git a/Modules/Ingredient/composer.json b/Modules/Ingredient/composer.json new file mode 100644 index 0000000..8389fde --- /dev/null +++ b/Modules/Ingredient/composer.json @@ -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/" + } + } +} diff --git a/Modules/Ingredient/config/.gitkeep b/Modules/Ingredient/config/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Ingredient/config/config.php b/Modules/Ingredient/config/config.php new file mode 100644 index 0000000..9a8a507 --- /dev/null +++ b/Modules/Ingredient/config/config.php @@ -0,0 +1,5 @@ + 'Ingredient', +]; diff --git a/Modules/Ingredient/database/factories/.gitkeep b/Modules/Ingredient/database/factories/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Ingredient/database/migrations/.gitkeep b/Modules/Ingredient/database/migrations/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Ingredient/database/migrations/2024_09_19_122905_create_ingredient_categories_table.php b/Modules/Ingredient/database/migrations/2024_09_19_122905_create_ingredient_categories_table.php new file mode 100644 index 0000000..2f6b125 --- /dev/null +++ b/Modules/Ingredient/database/migrations/2024_09_19_122905_create_ingredient_categories_table.php @@ -0,0 +1,31 @@ +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'); + } +}; diff --git a/Modules/Ingredient/database/migrations/2024_09_19_123152_create_ingredients_table.php b/Modules/Ingredient/database/migrations/2024_09_19_123152_create_ingredients_table.php new file mode 100644 index 0000000..3f1b743 --- /dev/null +++ b/Modules/Ingredient/database/migrations/2024_09_19_123152_create_ingredients_table.php @@ -0,0 +1,37 @@ +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'); + } +}; diff --git a/Modules/Ingredient/database/migrations/2024_09_19_123348_create_units_table.php b/Modules/Ingredient/database/migrations/2024_09_19_123348_create_units_table.php new file mode 100644 index 0000000..bd97fc5 --- /dev/null +++ b/Modules/Ingredient/database/migrations/2024_09_19_123348_create_units_table.php @@ -0,0 +1,35 @@ +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'); + } +}; \ No newline at end of file diff --git a/Modules/Ingredient/database/seeders/.gitkeep b/Modules/Ingredient/database/seeders/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Ingredient/database/seeders/IngredientDatabaseSeeder.php b/Modules/Ingredient/database/seeders/IngredientDatabaseSeeder.php new file mode 100644 index 0000000..364ad2d --- /dev/null +++ b/Modules/Ingredient/database/seeders/IngredientDatabaseSeeder.php @@ -0,0 +1,16 @@ +call([]); + } +} diff --git a/Modules/Ingredient/module.json b/Modules/Ingredient/module.json new file mode 100644 index 0000000..f723191 --- /dev/null +++ b/Modules/Ingredient/module.json @@ -0,0 +1,11 @@ +{ + "name": "Ingredient", + "alias": "ingredient", + "description": "", + "keywords": [], + "priority": 0, + "providers": [ + "Modules\\Ingredient\\Providers\\IngredientServiceProvider" + ], + "files": [] +} diff --git a/Modules/Ingredient/package.json b/Modules/Ingredient/package.json new file mode 100644 index 0000000..d6fbfc8 --- /dev/null +++ b/Modules/Ingredient/package.json @@ -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" + } +} diff --git a/Modules/Ingredient/resources/assets/.gitkeep b/Modules/Ingredient/resources/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Ingredient/resources/assets/js/app.js b/Modules/Ingredient/resources/assets/js/app.js new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Ingredient/resources/assets/sass/app.scss b/Modules/Ingredient/resources/assets/sass/app.scss new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Ingredient/resources/views/.gitkeep b/Modules/Ingredient/resources/views/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Ingredient/resources/views/index.blade.php b/Modules/Ingredient/resources/views/index.blade.php new file mode 100644 index 0000000..0bccb18 --- /dev/null +++ b/Modules/Ingredient/resources/views/index.blade.php @@ -0,0 +1,7 @@ +@extends('ingredient::layouts.master') + +@section('content') +

Hello World

+ +

Module: {!! config('ingredient.name') !!}

+@endsection diff --git a/Modules/Ingredient/resources/views/ingredient/create.blade.php b/Modules/Ingredient/resources/views/ingredient/create.blade.php new file mode 100644 index 0000000..c172686 --- /dev/null +++ b/Modules/Ingredient/resources/views/ingredient/create.blade.php @@ -0,0 +1,27 @@ +@extends('layouts.app') + +@section('content') +
+
+ @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() }} +
+
+@endsection + +@push('js') + + +@endpush diff --git a/Modules/Ingredient/resources/views/ingredient/edit.blade.php b/Modules/Ingredient/resources/views/ingredient/edit.blade.php new file mode 100644 index 0000000..531b6cd --- /dev/null +++ b/Modules/Ingredient/resources/views/ingredient/edit.blade.php @@ -0,0 +1,30 @@ +@extends('layouts.app') + +@section('content') +
+
+ + @include('layouts.partials.breadcrumb', ['title' => $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() }} + + +
+ +
+@endsection + +@push('js') + + +@endpush diff --git a/Modules/Ingredient/resources/views/ingredient/index.blade.php b/Modules/Ingredient/resources/views/ingredient/index.blade.php new file mode 100644 index 0000000..5a0d116 --- /dev/null +++ b/Modules/Ingredient/resources/views/ingredient/index.blade.php @@ -0,0 +1,74 @@ +@extends('layouts.app') + +@section('content') +
+
+ @include('layouts.partials.breadcrumb', ['title' => $title]) + + +
+ @can('ingredient.create') + Add + @endcan +
+ +
+
+
+
+
+ + + + + + {{-- --}} + + + + + + + + @forelse ($ingredients as $key => $ingredient) + {{-- @dd($ingredient->fabricCategory) --}} + + + + {{-- --}} + + + + + + @empty + @endforelse + +
S.NTitleFabric CategoryIngredient CategoryIngredient CodeStatusAction
{{ $key + 1 }}{{ $ingredient->name }}{{ optional($ingredient->fabricCategory)->title }}{{ optional($ingredient->category)->title }}{{ $ingredient->code }}{!! $ingredient->status_name !!} +
+ @can('ingredient.show') + + + + @endcan + @can('ingredient.edit') + + @endcan + @can('ingredient.destroy') + + @endcan +
+
+
+
+
+
+
+ +
+
+@endsection diff --git a/Modules/Ingredient/resources/views/ingredient/partials/action.blade.php b/Modules/Ingredient/resources/views/ingredient/partials/action.blade.php new file mode 100644 index 0000000..1c68efb --- /dev/null +++ b/Modules/Ingredient/resources/views/ingredient/partials/action.blade.php @@ -0,0 +1,89 @@ +
+
+
+
+
+
+ {{ html()->label('Ingredient Name')->class('form-label') }} + {{ html()->text('name')->class('form-control')->placeholder('Enter Ingredient Name')->required() }} +
+ +
+ {{ html()->label('Ingredient Code')->class('form-label') }} + {{ html()->text('code')->class('form-control')->placeholder('Enter Ingredient Code')->required() }} +
+ +
+ {{ html()->label('Category')->class('form-label') }} + {{ html()->select('ingredient_category_id', $ingredientCategory)->class('form-select select2')->placeholder('Select Category')->id('ingredient_category_id') }} +
+ +
+ {{ 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() }} +
+ + +
+ {{ html()->label('Description')->class('form-label') }} + {{ html()->textarea('desc')->class('form-control')->placeholder('Enter Description') }} +
+ +
+ {{ html()->label('Remarks')->class('form-label') }} + {{ html()->textarea('remarks')->class('form-control')->placeholder('Enter Remarks') }} +
+ +
+ +
+ + +
+
+ Cancel + +
+
+ +
+
+
+
Publish
+
+
+
+
+ {{ html()->label('Status')->class('form-label') }} + {{ html()->select('status', $status)->class('form-control')->placeholder('Select Status')->required() }} +
+
+ +
+ +
+ +@push('js') +{{-- --}} +@endpush \ No newline at end of file diff --git a/Modules/Ingredient/resources/views/ingredient/show.blade.php b/Modules/Ingredient/resources/views/ingredient/show.blade.php new file mode 100644 index 0000000..462b392 --- /dev/null +++ b/Modules/Ingredient/resources/views/ingredient/show.blade.php @@ -0,0 +1,57 @@ +@extends('layouts.app') + +@section('content') +
+
+ @include('layouts.partials.breadcrumb', ['title' => $title]) + +
+
+
+
+
+ + + + + + + + + + + + + + + {{-- + + + --}} + + + + + + + + + +
Ingredient Name{{ $ingredient->name }}
Ingredient Code{{ $ingredient->code }}
Category{{ optional($ingredient->category)->title }}
Fabric Category{{ optional($ingredient->fabricCategory)->title }}
Description{{ optional($ingredient->desc) }}
Status{{ $ingredient->status }}
+
+
+
+
+ Back + +
+
+
+ +
+
+@endsection + +@push('js') + +@endpush diff --git a/Modules/Ingredient/resources/views/ingredientCategory/create.blade.php b/Modules/Ingredient/resources/views/ingredientCategory/create.blade.php new file mode 100644 index 0000000..9cea435 --- /dev/null +++ b/Modules/Ingredient/resources/views/ingredientCategory/create.blade.php @@ -0,0 +1,18 @@ +@extends('layouts.app') + +@section('content') +
+
+ @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() }} + +
+
+@endsection + +@push('js') + +@endpush diff --git a/Modules/Ingredient/resources/views/ingredientCategory/edit.blade.php b/Modules/Ingredient/resources/views/ingredientCategory/edit.blade.php new file mode 100644 index 0000000..7e56b83 --- /dev/null +++ b/Modules/Ingredient/resources/views/ingredientCategory/edit.blade.php @@ -0,0 +1,22 @@ +@extends('layouts.app') + +@section('content') +
+
+ + @include('layouts.partials.breadcrumb', ['title' => $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() }} + + +
+ +
+@endsection + +@push('js') + +@endpush diff --git a/Modules/Ingredient/resources/views/ingredientCategory/index.blade.php b/Modules/Ingredient/resources/views/ingredientCategory/index.blade.php new file mode 100644 index 0000000..df44065 --- /dev/null +++ b/Modules/Ingredient/resources/views/ingredientCategory/index.blade.php @@ -0,0 +1,71 @@ +@extends('layouts.app') + +@section('content') +
+
+ @include('layouts.partials.breadcrumb', ['title' => $title]) + + +
+ @can('ingredientCategory.create') + Add + @endcan +
+ +
+
+
+
+
+ + + + + + + + + + + + + @forelse ($categories as $key => $ingredientCategory) + + + + + + + + + @empty + @endforelse + +
S.NTitleCodeSlugStatusAction
{{ $key + 1 }}{{ $ingredientCategory->title }}{{ $ingredientCategory->code }}{{ $ingredientCategory->slug }}{!! $ingredientCategory->status_name !!} +
+ @can('ingredientCategory.show') + + + + @endcan + @can('ingredientCategory.edit') + + @endcan + @can('ingredientCategory.destroy') + + @endcan +
+
+
+
+
+
+
+ +
+
+@endsection diff --git a/Modules/Ingredient/resources/views/ingredientCategory/partials/action.blade.php b/Modules/Ingredient/resources/views/ingredientCategory/partials/action.blade.php new file mode 100644 index 0000000..04cb736 --- /dev/null +++ b/Modules/Ingredient/resources/views/ingredientCategory/partials/action.blade.php @@ -0,0 +1,51 @@ +
+
+
+
+
+ +
+ {{ html()->label('Title')->class('form-label') }} + {{ html()->text('title')->class('form-control')->placeholder('Enter Title')->required() }} +
+ +
+ {{ html()->label('Code')->class('form-label') }} + {{ html()->text('code')->class('form-control')->placeholder('Enter Code') }} +
+ + + +
+ +
+
+ +
+ Cancel + + +
+
+ +
+
+
+
Publish
+
+
+
+
+ {{ html()->label('Status')->class('form-label') }} + {{ html()->select('status', $status)->class('form-control')->placeholder('Enter Status')->required() }} +
+
+
+ +
+ +
+
diff --git a/Modules/Ingredient/resources/views/ingredientCategory/show.blade.php b/Modules/Ingredient/resources/views/ingredientCategory/show.blade.php new file mode 100644 index 0000000..6e9a236 --- /dev/null +++ b/Modules/Ingredient/resources/views/ingredientCategory/show.blade.php @@ -0,0 +1,49 @@ +@extends('layouts.app') + +@section('content') +
+
+ @include('layouts.partials.breadcrumb', ['title' => $title]) + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + +
Ingredient Category{{ $ingredientCategory->title }}
Code{{ $ingredientCategory->code }}
Slug{{ $ingredientCategory->slug }}
Status{{ $ingredientCategory->status }}
+
+
+
+
+ Back + +
+
+
+ +
+
+@endsection + +@push('js') + +@endpush diff --git a/Modules/Ingredient/resources/views/layouts/master.blade.php b/Modules/Ingredient/resources/views/layouts/master.blade.php new file mode 100644 index 0000000..4afb106 --- /dev/null +++ b/Modules/Ingredient/resources/views/layouts/master.blade.php @@ -0,0 +1,29 @@ + + + + + + + + + + Ingredient Module - {{ config('app.name', 'Laravel') }} + + + + + + + + + + {{-- Vite CSS --}} + {{-- {{ module_vite('build-ingredient', 'resources/assets/sass/app.scss') }} --}} + + + + @yield('content') + + {{-- Vite JS --}} + {{-- {{ module_vite('build-ingredient', 'resources/assets/js/app.js') }} --}} + diff --git a/Modules/Ingredient/resources/views/unit/create.blade.php b/Modules/Ingredient/resources/views/unit/create.blade.php new file mode 100644 index 0000000..15e085e --- /dev/null +++ b/Modules/Ingredient/resources/views/unit/create.blade.php @@ -0,0 +1,16 @@ +@extends('layouts.app') + +@section('content') +
+
+ @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() }} +
+
+@endsection + +@push('js') + +@endpush diff --git a/Modules/Ingredient/resources/views/unit/edit.blade.php b/Modules/Ingredient/resources/views/unit/edit.blade.php new file mode 100644 index 0000000..28dbc41 --- /dev/null +++ b/Modules/Ingredient/resources/views/unit/edit.blade.php @@ -0,0 +1,23 @@ +@extends('layouts.app') + +@section('content') +
+
+ + @include('layouts.partials.breadcrumb', ['title' => $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() }} + +
+ +
+@endsection + +@push('js') + +@endpush diff --git a/Modules/Ingredient/resources/views/unit/index.blade.php b/Modules/Ingredient/resources/views/unit/index.blade.php new file mode 100644 index 0000000..decf9ca --- /dev/null +++ b/Modules/Ingredient/resources/views/unit/index.blade.php @@ -0,0 +1,72 @@ +@extends('layouts.app') + +@section('content') +
+
+ @include('layouts.partials.breadcrumb', ['title' => $title]) + + +
+ @can('unit.create') + Add + @endcan +
+ +
+
+
+
+
+ + + + + + + + + + + + + @forelse ($units as $key => $unit) + + + + + + + + + @empty + @endforelse + +
S.NTitleSlugCodeStatusAction
{{ $key + 1 }}{{ $unit->title }}{{ $unit->slug }}{{ $unit->code }}{!! $unit->status_name !!} +
+ @can('unit.show') + + + + @endcan + @can('unit.edit') + + @endcan + @can('unit.destroy') + + @endcan +
+
+
+
+
+
+
+ +
+
+@endsection diff --git a/Modules/Ingredient/resources/views/unit/partials/action.blade.php b/Modules/Ingredient/resources/views/unit/partials/action.blade.php new file mode 100644 index 0000000..1fba294 --- /dev/null +++ b/Modules/Ingredient/resources/views/unit/partials/action.blade.php @@ -0,0 +1,60 @@ +
+
+
+
+
+ +
+ {{ html()->label('Title')->class('form-label') }} + {{ html()->text('title')->class('form-control')->placeholder('Enter Title')->required() }} +
+ +
+ {{ html()->label('code')->class('form-label') }} + {{ html()->text('code')->class('form-control')->placeholder('Enter code')->required() }} +
+ + +
+ {{ html()->label('Description')->class('form-label') }} + {{ html()->text('description')->class('form-control')->placeholder('Enter Description') }} +
+ +
+ {{ html()->label('Remarks')->class('form-label') }} + {{ html()->text('remarks')->class('form-control')->placeholder('Enter Remarks') }} +
+ + +
+
+
+ +
+ Cancel + + +
+
+ +
+
+
+
Publish
+
+
+
+
+ {{ 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() }} + +
+
+
+ +
+ +
+
diff --git a/Modules/Ingredient/resources/views/unit/show.blade.php b/Modules/Ingredient/resources/views/unit/show.blade.php new file mode 100644 index 0000000..eba19c5 --- /dev/null +++ b/Modules/Ingredient/resources/views/unit/show.blade.php @@ -0,0 +1,49 @@ +@extends('layouts.app') + +@section('content') +
+
+ @include('layouts.partials.breadcrumb', ['title' => $title]) + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + +
Title{{ $unit->title }}
Code{{ $unit->code }}
Description{{ $unit->description }}
Remarks{{ $unit->remarks }}
+
+
+
+
+ Back + +
+
+
+ +
+
+@endsection + +@push('js') + +@endpush diff --git a/Modules/Ingredient/routes/.gitkeep b/Modules/Ingredient/routes/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Ingredient/routes/api.php b/Modules/Ingredient/routes/api.php new file mode 100644 index 0000000..e7be8cd --- /dev/null +++ b/Modules/Ingredient/routes/api.php @@ -0,0 +1,19 @@ +prefix('v1')->group(function () { + Route::apiResource('ingredient', IngredientController::class)->names('ingredient'); +}); diff --git a/Modules/Ingredient/routes/web.php b/Modules/Ingredient/routes/web.php new file mode 100644 index 0000000..a1765a6 --- /dev/null +++ b/Modules/Ingredient/routes/web.php @@ -0,0 +1,27 @@ +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'); + + +}); diff --git a/Modules/Ingredient/vite.config.js b/Modules/Ingredient/vite.config.js new file mode 100644 index 0000000..443f351 --- /dev/null +++ b/Modules/Ingredient/vite.config.js @@ -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', +//]; \ No newline at end of file diff --git a/Modules/Product/resources/views/product/create.blade.php b/Modules/Product/resources/views/product/create.blade.php index 32ad617..ee759e3 100644 --- a/Modules/Product/resources/views/product/create.blade.php +++ b/Modules/Product/resources/views/product/create.blade.php @@ -16,4 +16,12 @@ @push('js') + @endpush diff --git a/Modules/Product/resources/views/product/index.blade.php b/Modules/Product/resources/views/product/index.blade.php index 8d9efba..af278ac 100644 --- a/Modules/Product/resources/views/product/index.blade.php +++ b/Modules/Product/resources/views/product/index.blade.php @@ -23,9 +23,9 @@ S.N Title - Fabric Category Product Category Product Code + Price Status Action @@ -36,9 +36,9 @@ {{ $key + 1 }} {{ $product->name }} - {{ optional($product->fabricCategory)->title }} {{ optional($product->category)->title }} {{ $product->code }} + {{ $product->price }} {!! $product->status_name !!}
diff --git a/Modules/Product/resources/views/product/partials/action.blade.php b/Modules/Product/resources/views/product/partials/action.blade.php index f53bb37..1f480e5 100644 --- a/Modules/Product/resources/views/product/partials/action.blade.php +++ b/Modules/Product/resources/views/product/partials/action.blade.php @@ -13,16 +13,17 @@ {{ html()->text('code')->class('form-control')->placeholder('Enter Product Code')->required() }}
-
- {{ html()->label('Fabric Category')->class('form-label') }} - {{ html()->select('fabriccategory_id', $fabricCategory)->class('form-select select2')->placeholder('Select Fabric Category')->id('fabric_category_id') }} -
-
{{ html()->label('Category')->class('form-label') }} {{ html()->select('category_id', $category)->class('form-select select2')->placeholder('Select Category')->id('category_id') }}
+
+ {{ 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() }} +
+ +
{{ html()->label('Description')->class('form-label') }} {{ html()->textarea('desc')->class('form-control')->placeholder('Enter Description') }} diff --git a/Modules/PurchaseEntry/app/Http/Controllers/.gitkeep b/Modules/PurchaseEntry/app/Http/Controllers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/PurchaseEntry/app/Http/Controllers/PurchaseEntryController.php b/Modules/PurchaseEntry/app/Http/Controllers/PurchaseEntryController.php new file mode 100644 index 0000000..55dd972 --- /dev/null +++ b/Modules/PurchaseEntry/app/Http/Controllers/PurchaseEntryController.php @@ -0,0 +1,163 @@ +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(), + ]); + } +} diff --git a/Modules/PurchaseEntry/app/Http/Requests/.gitkeep b/Modules/PurchaseEntry/app/Http/Requests/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/PurchaseEntry/app/Models/.gitkeep b/Modules/PurchaseEntry/app/Models/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/PurchaseEntry/app/Models/PurchaseEntry.php b/Modules/PurchaseEntry/app/Models/PurchaseEntry.php new file mode 100644 index 0000000..b70ea39 --- /dev/null +++ b/Modules/PurchaseEntry/app/Models/PurchaseEntry.php @@ -0,0 +1,42 @@ +hasMany(PurchaseEntryDetail::class,'purchaseentry_id'); + } + + public function supplier():BelongsTo{ + return $this->belongsTo(Supplier::class); + } + + public static function getFillableField(){ + return (new self())->fillable; + } +} diff --git a/Modules/PurchaseEntry/app/Models/PurchaseEntryDetail.php b/Modules/PurchaseEntry/app/Models/PurchaseEntryDetail.php new file mode 100644 index 0000000..94f4d1c --- /dev/null +++ b/Modules/PurchaseEntry/app/Models/PurchaseEntryDetail.php @@ -0,0 +1,39 @@ +belongsTo(PurchaseEntry::class); + } +} diff --git a/Modules/PurchaseEntry/app/Observers/.gitkeep b/Modules/PurchaseEntry/app/Observers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/PurchaseEntry/app/Providers/.gitkeep b/Modules/PurchaseEntry/app/Providers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/PurchaseEntry/app/Providers/EventServiceProvider.php b/Modules/PurchaseEntry/app/Providers/EventServiceProvider.php new file mode 100644 index 0000000..d50f8f6 --- /dev/null +++ b/Modules/PurchaseEntry/app/Providers/EventServiceProvider.php @@ -0,0 +1,32 @@ +> + */ + 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 + { + + } +} diff --git a/Modules/PurchaseEntry/app/Providers/PurchaseEntryServiceProvider.php b/Modules/PurchaseEntry/app/Providers/PurchaseEntryServiceProvider.php new file mode 100644 index 0000000..eceb1e5 --- /dev/null +++ b/Modules/PurchaseEntry/app/Providers/PurchaseEntryServiceProvider.php @@ -0,0 +1,133 @@ +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 + */ + public function provides(): array + { + return []; + } + + /** + * @return array + */ + 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; + } +} diff --git a/Modules/PurchaseEntry/app/Providers/RouteServiceProvider.php b/Modules/PurchaseEntry/app/Providers/RouteServiceProvider.php new file mode 100644 index 0000000..e873689 --- /dev/null +++ b/Modules/PurchaseEntry/app/Providers/RouteServiceProvider.php @@ -0,0 +1,49 @@ +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')); + } +} diff --git a/Modules/PurchaseEntry/app/Repositories/.gitkeep b/Modules/PurchaseEntry/app/Repositories/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/PurchaseEntry/app/Repositories/PurchaseEntryInterface.php b/Modules/PurchaseEntry/app/Repositories/PurchaseEntryInterface.php new file mode 100644 index 0000000..5ca6166 --- /dev/null +++ b/Modules/PurchaseEntry/app/Repositories/PurchaseEntryInterface.php @@ -0,0 +1,17 @@ +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'); + } +} diff --git a/Modules/PurchaseEntry/composer.json b/Modules/PurchaseEntry/composer.json new file mode 100644 index 0000000..0a0f3c1 --- /dev/null +++ b/Modules/PurchaseEntry/composer.json @@ -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/" + } + } +} diff --git a/Modules/PurchaseEntry/config/.gitkeep b/Modules/PurchaseEntry/config/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/PurchaseEntry/config/config.php b/Modules/PurchaseEntry/config/config.php new file mode 100644 index 0000000..6371572 --- /dev/null +++ b/Modules/PurchaseEntry/config/config.php @@ -0,0 +1,5 @@ + 'PurchaseEntry', +]; diff --git a/Modules/PurchaseEntry/database/factories/.gitkeep b/Modules/PurchaseEntry/database/factories/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/PurchaseEntry/database/migrations/.gitkeep b/Modules/PurchaseEntry/database/migrations/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/PurchaseEntry/database/migrations/2024_09_19_151913_create_purchaseentries_table.php b/Modules/PurchaseEntry/database/migrations/2024_09_19_151913_create_purchaseentries_table.php new file mode 100644 index 0000000..b1dea44 --- /dev/null +++ b/Modules/PurchaseEntry/database/migrations/2024_09_19_151913_create_purchaseentries_table.php @@ -0,0 +1,38 @@ +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'); + } +}; + diff --git a/Modules/PurchaseEntry/database/migrations/2024_09_19_151927_create_purchaseentrydetails_table.php b/Modules/PurchaseEntry/database/migrations/2024_09_19_151927_create_purchaseentrydetails_table.php new file mode 100644 index 0000000..27fbb2c --- /dev/null +++ b/Modules/PurchaseEntry/database/migrations/2024_09_19_151927_create_purchaseentrydetails_table.php @@ -0,0 +1,43 @@ +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'); + } +}; + diff --git a/Modules/PurchaseEntry/database/seeders/.gitkeep b/Modules/PurchaseEntry/database/seeders/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/PurchaseEntry/database/seeders/PurchaseEntryDatabaseSeeder.php b/Modules/PurchaseEntry/database/seeders/PurchaseEntryDatabaseSeeder.php new file mode 100644 index 0000000..037f2f9 --- /dev/null +++ b/Modules/PurchaseEntry/database/seeders/PurchaseEntryDatabaseSeeder.php @@ -0,0 +1,16 @@ +call([]); + } +} diff --git a/Modules/PurchaseEntry/module.json b/Modules/PurchaseEntry/module.json new file mode 100644 index 0000000..3023b04 --- /dev/null +++ b/Modules/PurchaseEntry/module.json @@ -0,0 +1,11 @@ +{ + "name": "PurchaseEntry", + "alias": "purchaseentry", + "description": "", + "keywords": [], + "priority": 0, + "providers": [ + "Modules\\PurchaseEntry\\Providers\\PurchaseEntryServiceProvider" + ], + "files": [] +} diff --git a/Modules/PurchaseEntry/package.json b/Modules/PurchaseEntry/package.json new file mode 100644 index 0000000..d6fbfc8 --- /dev/null +++ b/Modules/PurchaseEntry/package.json @@ -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" + } +} diff --git a/Modules/PurchaseEntry/resources/assets/.gitkeep b/Modules/PurchaseEntry/resources/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/PurchaseEntry/resources/assets/js/app.js b/Modules/PurchaseEntry/resources/assets/js/app.js new file mode 100644 index 0000000..e69de29 diff --git a/Modules/PurchaseEntry/resources/assets/sass/app.scss b/Modules/PurchaseEntry/resources/assets/sass/app.scss new file mode 100644 index 0000000..e69de29 diff --git a/Modules/PurchaseEntry/resources/views/.gitkeep b/Modules/PurchaseEntry/resources/views/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/PurchaseEntry/resources/views/index.blade.php b/Modules/PurchaseEntry/resources/views/index.blade.php new file mode 100644 index 0000000..dadb22e --- /dev/null +++ b/Modules/PurchaseEntry/resources/views/index.blade.php @@ -0,0 +1,7 @@ +@extends('purchaseentry::layouts.master') + +@section('content') +

Hello World

+ +

Module: {!! config('purchaseentry.name') !!}

+@endsection diff --git a/Modules/PurchaseEntry/resources/views/layouts/master.blade.php b/Modules/PurchaseEntry/resources/views/layouts/master.blade.php new file mode 100644 index 0000000..d1e7fdb --- /dev/null +++ b/Modules/PurchaseEntry/resources/views/layouts/master.blade.php @@ -0,0 +1,29 @@ + + + + + + + + + + PurchaseEntry Module - {{ config('app.name', 'Laravel') }} + + + + + + + + + + {{-- Vite CSS --}} + {{-- {{ module_vite('build-purchaseentry', 'resources/assets/sass/app.scss') }} --}} + + + + @yield('content') + + {{-- Vite JS --}} + {{-- {{ module_vite('build-purchaseentry', 'resources/assets/js/app.js') }} --}} + diff --git a/Modules/PurchaseEntry/resources/views/purchaseEntry/clone-ingredient.blade.php b/Modules/PurchaseEntry/resources/views/purchaseEntry/clone-ingredient.blade.php new file mode 100644 index 0000000..ea62808 --- /dev/null +++ b/Modules/PurchaseEntry/resources/views/purchaseEntry/clone-ingredient.blade.php @@ -0,0 +1,76 @@ +
+
+
+ {{ 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 +
+
+ {{ 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 +
+ {{--
+ {{ 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 +
--}} + {{--
+ {{ html()->label('Size')->class('form-label') }} + {{ html()->select('size_id[]', $sizes)->class('form-select ')->placeholder('size') }} +
--}} + +
+ {{ 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)']) }} +
+ +
+ {{ 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 +
+ + {{--
+ {{ 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()}} +
--}} + +
+ {{ 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)']) }} +
+ +
+ {{ 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() }} +
+ +
+ {{ html()->label('Description')->class('form-label') }} + {{ html()->text('desc[]', isset($editable) && $editable ? $item->desc : null)->class('form-control')->placeholder('Enter Description') }} +
+ +
+ +
+ +
+
diff --git a/Modules/PurchaseEntry/resources/views/purchaseEntry/create.blade.php b/Modules/PurchaseEntry/resources/views/purchaseEntry/create.blade.php new file mode 100644 index 0000000..78bc2c7 --- /dev/null +++ b/Modules/PurchaseEntry/resources/views/purchaseEntry/create.blade.php @@ -0,0 +1,27 @@ +@extends('layouts.app') + +@section('content') +
+
+ + @include('layouts.partials.breadcrumb', ['title' => $title]) + + +
+
+
+ @csrf + @include('purchaseEntry::purchaseEntry.partials.action') +
+
+
+ + +
+ +
+@endsection + +@push('js') + +@endpush diff --git a/Modules/PurchaseEntry/resources/views/purchaseEntry/edit.blade.php b/Modules/PurchaseEntry/resources/views/purchaseEntry/edit.blade.php new file mode 100644 index 0000000..63c621c --- /dev/null +++ b/Modules/PurchaseEntry/resources/views/purchaseEntry/edit.blade.php @@ -0,0 +1,47 @@ +@extends('layouts.app') + +@section('content') +
+
+ +
+
+
+

{{ $title }}

+ +
+ +
+ +
+
+
+ +
+
+
+
+ + {{ html()->modelForm($order, 'PUT')->route('order.update', $id)->class(['needs-validation'])->attributes(['novalidate'])->open() }} + + @include('order::order.partials.action') + + {{ html()->closeModelForm() }} + +
+
+
+
+ + +
+ +
+@endsection + +@push('js') + +@endpush diff --git a/Modules/PurchaseEntry/resources/views/purchaseEntry/index.blade.php b/Modules/PurchaseEntry/resources/views/purchaseEntry/index.blade.php new file mode 100644 index 0000000..ed7ebea --- /dev/null +++ b/Modules/PurchaseEntry/resources/views/purchaseEntry/index.blade.php @@ -0,0 +1,71 @@ +@extends('layouts.app') +@section('content') +
+
+@include('purchaseEntry::purchaseEntry.partials.menu') + +
+
+
+
+
{{ $title }}
+
+ Add +
+
+ +
+
+ + + + + + + + {{-- --}} + + + + @forelse ($purchaseEntries as $key => $item) + {{-- @dd($item) --}} + + + + + + {{-- --}} + + @empty + @endforelse + +
S.NSupplierPurchase DateTotal AmountAction
{{ $key + 1 }}{{ $item->supplier->supplier_name }}{{ $item->purchase_date }}{{ $item->total_amt }} +
+ + + + + + + + +
+
+
+
+
+
+
+ +
+
+@endsection diff --git a/Modules/PurchaseEntry/resources/views/purchaseEntry/partials/action.blade.php b/Modules/PurchaseEntry/resources/views/purchaseEntry/partials/action.blade.php new file mode 100644 index 0000000..5c35e3a --- /dev/null +++ b/Modules/PurchaseEntry/resources/views/purchaseEntry/partials/action.blade.php @@ -0,0 +1,271 @@ +
+
Order Details
+
+
+ {{ 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') }} +
+
+ {{ 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') }} +
+ +
+ + + +{{--
+

Shipping Details

+
+
+ {{ html()->label('Address')->class('form-label') }} + {{ html()->text('address')->class('form-control')->placeholder('Enter Address') }} +
+ +
+ {{ html()->label('Shipping Date')->class('form-label') }} + {{ html()->date('shiiping_date')->class('form-control')->placeholder('Enter Temporary Address') }} +
+
--}} + +
+
+ +
+ @if ($editable && $purchaseEntry->purchaseEntryDetail->isNotEmpty()) + @foreach ($purchaseEntry->purchaseEntryDetail as $item) + @include('purchaseEntry::purchaseEntry.clone-ingredient') + @endforeach + @else + @include('purchaseEntry::purchaseEntry.clone-ingredient') + @endif +
+
+ +
+ + + {{-- + + + + + + + + + + + --}} + + + + + +
Sub Total + +
Estimated Tax (11%) + +
Discount + +
Total Amount + +
+ +
+ +
+
Payment Details
+
+ +
+ {{ html()->label('Payment')->class('form-label') }} + {{ html()->text('payment')->class('form-control')->placeholder('Enter Payment') }} +
+ +
+ {{ html()->label('Mode of Payment')->class('form-label') }} + {{ html()->select('paymentmode_id', $paymentModes)->class('form-select select2')->placeholder('Select Payment Mode') }} +
+ +
+ {{ html()->label('Payment Reference')->class('form-label') }} + {{ html()->text('paymentref')->class('form-control')->placeholder('Enter Payment Reference') }} +
+ + +
+ +
+ +
+ + +@push('js') + + + + + + +@endpush diff --git a/Modules/PurchaseEntry/resources/views/purchaseEntry/partials/menu.blade.php b/Modules/PurchaseEntry/resources/views/purchaseEntry/partials/menu.blade.php new file mode 100644 index 0000000..c855e74 --- /dev/null +++ b/Modules/PurchaseEntry/resources/views/purchaseEntry/partials/menu.blade.php @@ -0,0 +1,74 @@ +
+
+
+
+ {{ html()->form('GET')->route('purchaseEntry.index')->open() }} +
+ {{--
+ +
--}} + +
+
+ {{ 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', + ]) }} +
+
+ +
+ +
+ {{--
+ +
--}} +
+ +
+ + {{--
--}} +
+
+ + {{-- + Reset --}} +
+
+
+
+ + Reset + {{-- + Reset --}} +
+
+ {{--
--}} + +
+ + {{ html()->form()->close() }} + +
+ + +
+ +
+
+ + diff --git a/Modules/PurchaseEntry/resources/views/purchaseEntry/show.blade.php b/Modules/PurchaseEntry/resources/views/purchaseEntry/show.blade.php new file mode 100644 index 0000000..e69de29 diff --git a/Modules/PurchaseEntry/routes/.gitkeep b/Modules/PurchaseEntry/routes/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/PurchaseEntry/routes/api.php b/Modules/PurchaseEntry/routes/api.php new file mode 100644 index 0000000..f8c85c6 --- /dev/null +++ b/Modules/PurchaseEntry/routes/api.php @@ -0,0 +1,19 @@ +prefix('v1')->group(function () { + Route::apiResource('purchaseentry', PurchaseEntryController::class)->names('purchaseentry'); +}); diff --git a/Modules/PurchaseEntry/routes/web.php b/Modules/PurchaseEntry/routes/web.php new file mode 100644 index 0000000..cb5ff85 --- /dev/null +++ b/Modules/PurchaseEntry/routes/web.php @@ -0,0 +1,20 @@ +names('purchaseEntry'); + Route::get('clone-purchase-product', [PurchaseEntryController::class, 'clonePurchaseProduct'])->name('purchaseEntry.clonePurchaseProduct'); +}); diff --git a/Modules/PurchaseEntry/vite.config.js b/Modules/PurchaseEntry/vite.config.js new file mode 100644 index 0000000..2a50494 --- /dev/null +++ b/Modules/PurchaseEntry/vite.config.js @@ -0,0 +1,26 @@ +import { defineConfig } from 'vite'; +import laravel from 'laravel-vite-plugin'; + +export default defineConfig({ + build: { + outDir: '../../public/build-purchaseentry', + emptyOutDir: true, + manifest: true, + }, + plugins: [ + laravel({ + publicDirectory: '../../public', + buildDirectory: 'build-purchaseentry', + input: [ + __dirname + '/resources/assets/sass/app.scss', + __dirname + '/resources/assets/js/app.js' + ], + refresh: true, + }), + ], +}); + +//export const paths = [ +// 'Modules/PurchaseEntry/resources/assets/sass/app.scss', +// 'Modules/PurchaseEntry/resources/assets/js/app.js', +//]; \ No newline at end of file diff --git a/Modules/SalesEntry/app/Models/SalesEntryDetail.php b/Modules/SalesEntry/app/Models/SalesEntryDetail.php index ca500e3..38e1d80 100644 --- a/Modules/SalesEntry/app/Models/SalesEntryDetail.php +++ b/Modules/SalesEntry/app/Models/SalesEntryDetail.php @@ -21,6 +21,7 @@ class SalesEntryDetail extends Model 'stock_id', 'size_id', 'unit', + 'price', 'rate', 'quantity', 'amount', diff --git a/Modules/SalesEntry/app/Repositories/SalesEntryInterface.php b/Modules/SalesEntry/app/Repositories/SalesEntryInterface.php index 3ddf639..7373abf 100644 --- a/Modules/SalesEntry/app/Repositories/SalesEntryInterface.php +++ b/Modules/SalesEntry/app/Repositories/SalesEntryInterface.php @@ -3,7 +3,7 @@ namespace Modules\SalesEntry\Repositories; use Illuminate\Http\Request; - + interface SalesEntryInterface { public function findAll($filters); diff --git a/Modules/SalesEntry/app/Repositories/SalesEntryRepository.php b/Modules/SalesEntry/app/Repositories/SalesEntryRepository.php index 250a838..97964c5 100644 --- a/Modules/SalesEntry/app/Repositories/SalesEntryRepository.php +++ b/Modules/SalesEntry/app/Repositories/SalesEntryRepository.php @@ -71,15 +71,15 @@ class SalesEntryRepository implements SalesEntryInterface $request->merge(['salesentry_id' => $salesEntryData->id]); - foreach ($salesEntryDetails['stock_id'] as $key => $stockId) { + foreach ($salesEntryDetails['product_id'] as $key => $productId) { // dd($request->input('salesentry_id')); $data = [ 'salesentry_id' => $request->input('salesentry_id'), 'product_id' => $salesEntryDetails['product_id'][$key], 'category_id' => $salesEntryDetails['category_id'][$key], - 'stock_id' => $salesEntryDetails['stock_id'][$key], - 'size_id' => $salesEntryDetails['size_id'][$key], - 'rate' => $salesEntryDetails['rate'][$key], + // 'stock_id' => $salesEntryDetails['stock_id'][$key], + // 'size_id' => $salesEntryDetails['size_id'][$key], + 'rate' => $salesEntryDetails['price'][$key], // 'unit' => $salesEntryDetails['unit'][$key], 'quantity' => $salesEntryDetails['qty'][$key], 'amount' => $salesEntryDetails['amt'][$key], @@ -112,7 +112,7 @@ class SalesEntryRepository implements SalesEntryInterface 'salesentry_id' => $SalesEntryId, 'product_id' => $productId, 'unit' => $data['unit'][$key], - 'rate' => $data['rate'][$key], + 'price' => $data['price'][$key], 'quantity' => $data['qty'][$key], 'amount' => $data['amt'][$key], 'desc' => $data['desc'][$key], diff --git a/Modules/SalesEntry/resources/views/salesEntry/clone-product.blade.php b/Modules/SalesEntry/resources/views/salesEntry/clone-product.blade.php index 854b6b3..6926455 100644 --- a/Modules/SalesEntry/resources/views/salesEntry/clone-product.blade.php +++ b/Modules/SalesEntry/resources/views/salesEntry/clone-product.blade.php @@ -1,6 +1,6 @@
-
+
{{ html()->label('Category')->class('form-label') }} @if (isset($editable) && $editable) {{ html()->select('category_id[]', $categoryList, $item->category_id)->class('form-select category_id')->attributes(['id' => 'category_id'])->placeholder('Enter Category')->required() }} @@ -18,7 +18,7 @@ @endif
-
+ {{--
{{ 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() }} @@ -26,18 +26,18 @@ {{ html()->select('stock_id[]', $stockList)->class('form-select stock_id')->attributes(['id' => 'stock_id'])->placeholder('')->required()->disabled() }} @endif -
-
+
--}} + {{--
{{ html()->label('Size')->class('form-label') }} {{ html()->select('size_id[]', $sizes)->class('form-select ')->placeholder('size') }} +
--}} + +
+ {{ html()->label('Price')->class('form-label') }} + {{ html()->text('price[]', isset($editable) && $editable ? $item->price : null)->class('form-control product-price cleave-numeral rate~~')->placeholder('Enter Price')->attributes(['id' => 'rate', 'onkeyup' => 'validatePriceInput(this)']) }}
-
- {{ html()->label('Rate')->class('form-label') }} - {{ html()->text('rate[]', isset($editable) && $editable ? $item->rate : null)->class('form-control product-price cleave-numeral rate~~')->placeholder('Enter Rate')->attributes(['id' => 'rate', 'onkeyup' => 'validateNumericInput(this)']) }} -
- -
+
{{ html()->label('Quantity')->class('form-label') }} {{ html()->text('qty[]', isset($editable) && $editable ? $item->quantity : null)->class('form-control product-quantity cleave-numeral qty')->placeholder('Enter QTY')->attributes(['id' => 'qty', 'onkeyup' => 'validateNumericInput(this)']) }}
diff --git a/Modules/SalesEntry/resources/views/salesEntry/partials/action.blade.php b/Modules/SalesEntry/resources/views/salesEntry/partials/action.blade.php index 62a0a03..830525b 100644 --- a/Modules/SalesEntry/resources/views/salesEntry/partials/action.blade.php +++ b/Modules/SalesEntry/resources/views/salesEntry/partials/action.blade.php @@ -194,7 +194,7 @@ $(document).ready(function() { $('.product_id').prop('disabled', true); - $('.stock_id').prop('disabled', true); + // $('.stock_id').prop('disabled', true); $('body').on('change', '.product_id', function() { var selectedId = $(this).find(':selected').val(); var formRow = $(this).closest('.row'); @@ -227,7 +227,7 @@ var categoryId = $(this).val(); var formRow = $(this).closest('.row'); var productSelect = formRow.find('.product_id'); - var stockSelect = formRow.find('.stock_id'); + // var stockSelect = formRow.find('.stock_id'); // Reset stock field @@ -248,7 +248,7 @@ // Handle error } }); - stockSelect.empty().prop('disabled', true); + // stockSelect.empty().prop('disabled', true); } else { productSelect.prop('disabled', true); @@ -256,36 +256,44 @@ }); // When product is selected, load stocks dynamically - $('body').on('change', '.product_id', function () { - var productId = $(this).val(); - var formRow = $(this).closest('.row'); - var productSelect = formRow.find('.product_id'); - var stockSelect = formRow.find('.stock_id'); + // $('body').on('change', '.product_id', function () { + // var productId = $(this).val(); + // var formRow = $(this).closest('.row'); + // var productSelect = formRow.find('.product_id'); + // var stockSelect = formRow.find('.stock_id'); - if (productId) { - $.ajax({ - type: 'GET', - url: '{{ route('stocks-by-product') }}', // Route to get stocks by product - data: {product_id:productId}, - success: function (response) { - stockSelect.empty().append(''); - stockSelect.prop('disabled', false); + // if (productId) { + // $.ajax({ + // type: 'GET', + // url: '{{ route('stocks-by-product') }}', // Route to get stocks by product + // data: {product_id:productId}, + // success: function (response) { + // stockSelect.empty().append(''); + // stockSelect.prop('disabled', false); - $.each(response.stocks, function (id, title) { - stockSelect.append(''); - }); - }, - error: function (xhr) { - // Handle error - } - }); - } else { - stockSelect.prop('disabled', true); - } - }); + // $.each(response.stocks, function (id, title) { + // stockSelect.append(''); + // }); + // }, + // error: function (xhr) { + // // Handle error + // } + // }); + // } else { + // stockSelect.prop('disabled', true); + // } + // }); }); + @endpush diff --git a/Modules/User/database/migrations/2024_04_07_095204_add_employee_id_to_users_table.php b/Modules/User/database/migrations/2023_04_07_095204_add_employee_id_to_users_table.php similarity index 92% rename from Modules/User/database/migrations/2024_04_07_095204_add_employee_id_to_users_table.php rename to Modules/User/database/migrations/2023_04_07_095204_add_employee_id_to_users_table.php index f28ac96..d554e43 100644 --- a/Modules/User/database/migrations/2024_04_07_095204_add_employee_id_to_users_table.php +++ b/Modules/User/database/migrations/2023_04_07_095204_add_employee_id_to_users_table.php @@ -22,7 +22,7 @@ return new class extends Migration public function down(): void { Schema::table('users', function (Blueprint $table) { - + $table->dropColumn('employee_id'); }); } }; diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2024_10_12_000000_create_users_table.php similarity index 100% rename from database/migrations/2014_10_12_000000_create_users_table.php rename to database/migrations/2024_10_12_000000_create_users_table.php diff --git a/modules_statuses.json b/modules_statuses.json index 0a1d677..ff3dbf9 100644 --- a/modules_statuses.json +++ b/modules_statuses.json @@ -20,5 +20,7 @@ "Stocks": true, "Stock": true, "Setting": true, - "SalesEntry": true + "SalesEntry": true, + "PurchaseEntry": true, + "Ingredient": true } \ No newline at end of file diff --git a/resources/views/layouts/partials/sidebar.blade.php b/resources/views/layouts/partials/sidebar.blade.php index 41eace5..274df27 100644 --- a/resources/views/layouts/partials/sidebar.blade.php +++ b/resources/views/layouts/partials/sidebar.blade.php @@ -119,22 +119,55 @@ Suppliers + {{-- PURCHASES --}} + + - + + + + + + + {{-- SALES --}} + + + + + + {{-- + --}} + + + - + --}} - + --}} - + --}} - + - + --}} {{--