first commit
This commit is contained in:
0
Modules/Order/app/Http/Controllers/.gitkeep
Normal file
0
Modules/Order/app/Http/Controllers/.gitkeep
Normal file
105
Modules/Order/app/Http/Controllers/OrderController.php
Normal file
105
Modules/Order/app/Http/Controllers/OrderController.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Order\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Customer\Repositories\CustomerInterface;
|
||||
use Modules\Product\Repositories\ProductInterface;
|
||||
use Modules\Supplier\Repositories\SupplierInterface;
|
||||
|
||||
|
||||
|
||||
class OrderController extends Controller
|
||||
{
|
||||
|
||||
private $supplierRepository;
|
||||
private $productRepository;
|
||||
private $customerRepository;
|
||||
|
||||
public function __construct(SupplierInterface $supplierRepository, ProductInterface $productRepository, CustomerInterface $customerRepository )
|
||||
{
|
||||
$this->supplierRepository = $supplierRepository;
|
||||
$this->productRepository = $productRepository;
|
||||
$this->customerRepository = $customerRepository;
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Order List';
|
||||
$data['orders'] = [];
|
||||
return view('order::order.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Order';
|
||||
$data['productList'] = $this->productRepository->pluck();
|
||||
$data['supplierList'] = $this->supplierRepository->pluck();
|
||||
$data['customerList'] = $this->customerRepository->pluck();
|
||||
|
||||
|
||||
|
||||
return view('order::order.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('order::order.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('order::order.edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function cloneProduct(Request $request)
|
||||
{
|
||||
$data = [];
|
||||
$numInc = $request->numberInc;
|
||||
$script = true;
|
||||
$productList= $this->productRepository->pluck();
|
||||
|
||||
return response()->json([
|
||||
'view' => view('order::order.clone-product', compact('data', 'numInc', 'script', 'productList'))->render(),
|
||||
]);
|
||||
}
|
||||
}
|
0
Modules/Order/app/Http/Requests/.gitkeep
Normal file
0
Modules/Order/app/Http/Requests/.gitkeep
Normal file
0
Modules/Order/app/Models/.gitkeep
Normal file
0
Modules/Order/app/Models/.gitkeep
Normal file
24
Modules/Order/app/Models/Order.php
Normal file
24
Modules/Order/app/Models/Order.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Order\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Order\Database\Factories\OrderFactory;
|
||||
|
||||
class Order extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $table = 'tbl_orders';
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
protected static function newFactory(): OrderFactory
|
||||
{
|
||||
//return OrderFactory::new();
|
||||
}
|
||||
}
|
22
Modules/Order/app/Models/OrderDetail.php
Normal file
22
Modules/Order/app/Models/OrderDetail.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Order\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Order\Database\Factories\OrderDetailFactory;
|
||||
|
||||
class OrderDetail extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [];
|
||||
|
||||
protected static function newFactory(): OrderDetailFactory
|
||||
{
|
||||
//return OrderDetailFactory::new();
|
||||
}
|
||||
}
|
0
Modules/Order/app/Observers/.gitkeep
Normal file
0
Modules/Order/app/Observers/.gitkeep
Normal file
0
Modules/Order/app/Providers/.gitkeep
Normal file
0
Modules/Order/app/Providers/.gitkeep
Normal file
114
Modules/Order/app/Providers/OrderServiceProvider.php
Normal file
114
Modules/Order/app/Providers/OrderServiceProvider.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Order\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class OrderServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'Order';
|
||||
|
||||
protected string $moduleNameLower = 'order';
|
||||
|
||||
/**
|
||||
* 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(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register commands in the format of Command::class
|
||||
*/
|
||||
protected function registerCommands(): void
|
||||
{
|
||||
// $this->commands([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register command Schedules.
|
||||
*/
|
||||
protected function registerCommandSchedules(): void
|
||||
{
|
||||
// $this->app->booted(function () {
|
||||
// $schedule = $this->app->make(Schedule::class);
|
||||
// $schedule->command('inspire')->hourly();
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*/
|
||||
public function registerTranslations(): void
|
||||
{
|
||||
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom($langPath);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*/
|
||||
protected function registerConfig(): void
|
||||
{
|
||||
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower . '.php')], 'config');
|
||||
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*/
|
||||
public function registerViews(): void
|
||||
{
|
||||
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
|
||||
$sourcePath = module_path($this->moduleName, 'resources/views');
|
||||
|
||||
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower . '-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
|
||||
$componentNamespace = str_replace('/', '\\', config('modules.namespace') . '\\' . $this->moduleName . '\\' . ltrim(config('modules.paths.generator.component-class.path'), config('modules.paths.app_folder', '')));
|
||||
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (config('view.paths') as $path) {
|
||||
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
|
||||
$paths[] = $path . '/modules/' . $this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
|
||||
return $paths;
|
||||
}
|
||||
}
|
49
Modules/Order/app/Providers/RouteServiceProvider.php
Normal file
49
Modules/Order/app/Providers/RouteServiceProvider.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Order\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
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('Order', '/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('Order', '/routes/api.php'));
|
||||
}
|
||||
}
|
0
Modules/Order/app/Repositories/.gitkeep
Normal file
0
Modules/Order/app/Repositories/.gitkeep
Normal file
15
Modules/Order/app/Repositories/EmployeeInterface.php
Normal file
15
Modules/Order/app/Repositories/EmployeeInterface.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Employee\Repositories;
|
||||
|
||||
interface EmployeeInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getEmployeeById($employeeId);
|
||||
public function getEmployeeByEmail($email);
|
||||
public function delete($employeeId);
|
||||
public function create($EmployeeDetails);
|
||||
public function update($employeeId, array $newDetails);
|
||||
public function pluck();
|
||||
|
||||
}
|
64
Modules/Order/app/Repositories/EmployeeRepository.php
Normal file
64
Modules/Order/app/Repositories/EmployeeRepository.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Employee\Repositories;
|
||||
|
||||
use Modules\Employee\Models\Employee;
|
||||
|
||||
class EmployeeRepository implements EmployeeInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Employee::when(true, function ($query) {
|
||||
if (auth()->user()->hasRole('employee')) {
|
||||
$user = \Auth::user();
|
||||
dd($user, $user->employee_id);
|
||||
$query->where('id', $user->employee_id);
|
||||
}
|
||||
})->paginate(20);
|
||||
}
|
||||
|
||||
public function getEmployeeById($employeeId)
|
||||
{
|
||||
return Employee::findOrFail($employeeId);
|
||||
}
|
||||
|
||||
public function getEmployeeByEmail($email)
|
||||
{
|
||||
return Employee::where('email', $email)->first();
|
||||
}
|
||||
|
||||
public function delete($employeeId)
|
||||
{
|
||||
Employee::destroy($employeeId);
|
||||
}
|
||||
|
||||
public function create($employeeDetails)
|
||||
{
|
||||
return Employee::create($employeeDetails);
|
||||
}
|
||||
|
||||
public function update($employeeId, array $newDetails)
|
||||
{
|
||||
return Employee::whereId($employeeId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck()
|
||||
{
|
||||
return Employee::pluck('first_name', 'id');
|
||||
}
|
||||
|
||||
// public function uploadImage($file)
|
||||
// {
|
||||
// if ($req->file()) {
|
||||
// $fileName = time() . '_' . $req->file->getClientOriginalName();
|
||||
// $filePath = $req->file('file')->storeAs('uploads', $fileName, 'public');
|
||||
// $fileModel->name = time() . '_' . $req->file->getClientOriginalName();
|
||||
// $fileModel->file_path = '/storage/' . $filePath;
|
||||
// $fileModel->save();
|
||||
// return back()
|
||||
// ->with('success', 'File has been uploaded.')
|
||||
// ->with('file', $fileName);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
15
Modules/Order/app/Repositories/OrderInterface.php
Normal file
15
Modules/Order/app/Repositories/OrderInterface.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Order\Repositories;
|
||||
|
||||
interface OrderInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getOrderById($OrderId);
|
||||
public function getOrderByEmail($email);
|
||||
public function delete($OrderId);
|
||||
public function create($OrderDetails);
|
||||
public function update($OrderId, array $newDetails);
|
||||
public function pluck();
|
||||
|
||||
}
|
46
Modules/Order/app/Repositories/OrderRepository.php
Normal file
46
Modules/Order/app/Repositories/OrderRepository.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Order\Repositories;
|
||||
|
||||
use Modules\Order\Models\Order;
|
||||
|
||||
class OrderRepository implements OrderInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Order::when(true, function ($query) {
|
||||
|
||||
})->paginate(20);
|
||||
}
|
||||
|
||||
public function getOrderById($OrderId)
|
||||
{
|
||||
return Order::findOrFail($OrderId);
|
||||
}
|
||||
|
||||
public function getOrderByEmail($email)
|
||||
{
|
||||
return Order::where('email', $email)->first();
|
||||
}
|
||||
|
||||
public function delete($OrderId)
|
||||
{
|
||||
Order::destroy($OrderId);
|
||||
}
|
||||
|
||||
public function create($OrderDetails)
|
||||
{
|
||||
return Order::create($OrderDetails);
|
||||
}
|
||||
|
||||
public function update($OrderId, array $newDetails)
|
||||
{
|
||||
return Order::whereId($OrderId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck()
|
||||
{
|
||||
return Order::pluck('name', 'id');
|
||||
}
|
||||
|
||||
}
|
30
Modules/Order/composer.json
Normal file
30
Modules/Order/composer.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "nwidart/order",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Widart",
|
||||
"email": "n.widart@gmail.com"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Order\\": "app/",
|
||||
"Modules\\Order\\Database\\Factories\\": "database/factories/",
|
||||
"Modules\\Order\\Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Modules\\Order\\Tests\\": "tests/"
|
||||
}
|
||||
}
|
||||
}
|
0
Modules/Order/config/.gitkeep
Normal file
0
Modules/Order/config/.gitkeep
Normal file
5
Modules/Order/config/config.php
Normal file
5
Modules/Order/config/config.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Order',
|
||||
];
|
0
Modules/Order/database/factories/.gitkeep
Normal file
0
Modules/Order/database/factories/.gitkeep
Normal file
0
Modules/Order/database/migrations/.gitkeep
Normal file
0
Modules/Order/database/migrations/.gitkeep
Normal file
@ -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_orders', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('order_code')->nullable();
|
||||
$table->unsignedBigInteger('order_detail_id')->nullable();
|
||||
$table->unsignedBigInteger('customer_id')->nullable();
|
||||
$table->unsignedBigInteger('buyer_id')->nullable();
|
||||
$table->date('order_date')->nullable();
|
||||
$table->date('delivery_date')->nullable();
|
||||
$table->float('discount_amt', 14, 2)->nullable();
|
||||
$table->float('tax', 14, 2)->nullable();
|
||||
$table->float('sub_total', 14, 2)->nullable();
|
||||
$table->float('total_amt', 14, 2)->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tbl_orders');
|
||||
}
|
||||
};
|
@ -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
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tbl_order_details', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('supplier_name')->nullable();
|
||||
$table->string('nationalities_id')->nullable();
|
||||
$table->string('email')->nullable();
|
||||
$table->string('contact')->nullable();
|
||||
$table->string('profile_picture')->nullable();
|
||||
$table->text('permanent_address')->nullable();
|
||||
$table->string('status')->nullable()->default(11);
|
||||
$table->string('remarks')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tbl_order_details');
|
||||
}
|
||||
};
|
0
Modules/Order/database/seeders/.gitkeep
Normal file
0
Modules/Order/database/seeders/.gitkeep
Normal file
16
Modules/Order/database/seeders/TaxationDatabaseSeeder.php
Normal file
16
Modules/Order/database/seeders/TaxationDatabaseSeeder.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Order\database\seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class OrderDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// $this->call([]);
|
||||
}
|
||||
}
|
11
Modules/Order/module.json
Normal file
11
Modules/Order/module.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Order",
|
||||
"alias": "order",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\Order\\Providers\\OrderServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
15
Modules/Order/package.json
Normal file
15
Modules/Order/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/Order/resources/assets/.gitkeep
Normal file
0
Modules/Order/resources/assets/.gitkeep
Normal file
0
Modules/Order/resources/assets/js/app.js
Normal file
0
Modules/Order/resources/assets/js/app.js
Normal file
0
Modules/Order/resources/assets/sass/app.scss
Normal file
0
Modules/Order/resources/assets/sass/app.scss
Normal file
0
Modules/Order/resources/views/.gitkeep
Normal file
0
Modules/Order/resources/views/.gitkeep
Normal file
29
Modules/Order/resources/views/layouts/master.blade.php
Normal file
29
Modules/Order/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>Order 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-order', 'resources/assets/sass/app.scss') }} --}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@yield('content')
|
||||
|
||||
{{-- Vite JS --}}
|
||||
{{-- {{ module_vite('build-order', 'resources/assets/js/app.js') }} --}}
|
||||
</body>
|
39
Modules/Order/resources/views/order/clone-product.blade.php
Normal file
39
Modules/Order/resources/views/order/clone-product.blade.php
Normal file
@ -0,0 +1,39 @@
|
||||
<div class="card card-body product-card card-border-secondary mb-2 border">
|
||||
<div class="row gy-2 mb-2">
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Product')->class('form-label') }}
|
||||
{{ html()->select('product_id', $productList)->class('form-control')->placeholder('Enter Product Name')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
{{ html()->label('Unit')->class('form-label') }}
|
||||
{{ html()->text('unit')->class('form-control')->placeholder('Enter Unit')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
{{ html()->label('Rate')->class('form-label') }}
|
||||
{{ html()->text('rate')->class('form-control product-price cleave-numeral')->placeholder('Enter Rate')->attributes(['id' => 'cleave-numeral']) }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
{{ html()->label('Quantity')->class('form-label') }}
|
||||
{{ html()->text('qty')->class('form-control product-quantity cleave-numeral')->placeholder('Enter QTY')->attributes(['id' => 'cleave-numeral']) }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
{{ html()->label('Amount')->class('form-label') }}
|
||||
{{ html()->text('amt')->class('form-control product-line-price bg-light')->placeholder('Enter Amount')->isReadOnly() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{{ html()->label('Description')->class('form-label') }}
|
||||
{{ html()->text('desc')->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>
|
27
Modules/Order/resources/views/order/create.blade.php
Normal file
27
Modules/Order/resources/views/order/create.blade.php
Normal file
@ -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('order.store') }}" class="needs-validation" novalidate method="post">
|
||||
@csrf
|
||||
@include('order::order.partials.action')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
47
Modules/Order/resources/views/order/edit.blade.php
Normal file
47
Modules/Order/resources/views/order/edit.blade.php
Normal file
@ -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-8">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
{{ html()->modelForm($leave, 'PUT')->route('leave.update', $leave->id)->class(['needs-validation'])->attributes(['novalidate'])->open() }}
|
||||
|
||||
@include('leave::leave.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
|
68
Modules/Order/resources/views/order/index.blade.php
Normal file
68
Modules/Order/resources/views/order/index.blade.php
Normal file
@ -0,0 +1,68 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
|
||||
<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('order.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>Id</th>
|
||||
<th>Created By</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($orders as $key => $leaveType)
|
||||
<tr>
|
||||
<td>{{ $key + 1 }}</td>
|
||||
<td>{{ $leaveType->employee_id }}</td>
|
||||
<td>{{ $leaveType->start_date }}</td>
|
||||
<td>{{ $leaveType->end_date }}</td>
|
||||
<td>{{ $leaveType->created_at }}</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">
|
||||
<i class="ri-eye-line"></i>
|
||||
</a>
|
||||
<a href="{{ route('leaveType.edit', $leaveType->leaveType_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('leaveType.destroy', $leaveType->leaveType_id) }}"
|
||||
data-id="{{ $leaveType->leave_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
|
206
Modules/Order/resources/views/order/partials/action.blade.php
Normal file
206
Modules/Order/resources/views/order/partials/action.blade.php
Normal file
@ -0,0 +1,206 @@
|
||||
<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('Customer')->class('form-label') }}
|
||||
{{ html()->select('customer_id', $customerList)->class('form-control')->placeholder('Select Customer')->required() }}
|
||||
{{ html()->div('Please select customer')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Order No.')->class('form-label') }}
|
||||
{{ html()->text('order_code')->class('form-control')->placeholder('Enter Order No')->attributes(['id' => 'cleave-prefix']) }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('VAT No.')->class('form-label') }}
|
||||
{{ html()->text('vat_no')->class('form-control')->placeholder('Enter VAT No') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Order Date')->class('form-label') }}
|
||||
{{ html()->date('order_date')->class('form-control')->placeholder('Choose Order Date')->required() }}
|
||||
{{ html()->div('Please choose order date')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Delivery Date')->class('form-label') }}
|
||||
{{ html()->date('delivery_date')->class('form-control')->placeholder('Choose Bill Issue Date')->required() }}
|
||||
{{ html()->div('Please choose order date')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row gy-1 my-2">
|
||||
<h5 class="text-primary text-center">Buyer Details</h5>
|
||||
<div class="border border-dashed"></div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Buyer')->class('form-label') }}
|
||||
{{ html()->select('buyer_id', $supplierList)->class('form-control')->placeholder('Select Buyer') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Address No.')->class('form-label') }}
|
||||
{{ html()->text('buyer_address')->class('form-control')->placeholder('Enter Address') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('VAT No.')->class('form-label') }}
|
||||
{{ html()->text('vat_no')->class('form-control')->placeholder('Enter Buyer VAT No') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Sales Date')->class('form-label') }}
|
||||
{{ html()->date('sales_date')->class('form-control')->placeholder('Enter Sales Date') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Mode of Payment')->class('form-label') }}
|
||||
{{ html()->select('buyer_id', [1 => 'Cash', 2 => 'Bank', 3 => 'Credit'])->class('form-control')->placeholder('Select Payment Mode') }}
|
||||
</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>
|
||||
@include('order::order.clone-product')
|
||||
<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="discoumt_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="mb-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 = $('.product-card').length
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{ route('cloneProduct') }}',
|
||||
data: {
|
||||
numberInc: numberInc
|
||||
},
|
||||
success: function(response) {
|
||||
$('.appendProductCard').append(response.view)
|
||||
// $('#order-container').html(response.view).fadeIn()
|
||||
},
|
||||
error: function(xhr) {
|
||||
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
$("body").on('click', '.btn-remove', function() {
|
||||
if ($('.product-card').length > 1) {
|
||||
$(this).parents(".product-card").remove();
|
||||
}
|
||||
recalculate();
|
||||
});
|
||||
|
||||
|
||||
function amountKeyup() {
|
||||
$("body").on('keyup', '.product-price', function() {
|
||||
var priceInput = $(this);
|
||||
var qtyInput = priceInput.closest(".row").find(".product-quantity");
|
||||
var linePrice = priceInput.closest(".row").find(".product-line-price");
|
||||
updateQuantity(priceInput.val(), qtyInput.val(), linePrice);
|
||||
});
|
||||
|
||||
$("body").on('keyup', '.product-quantity', function() {
|
||||
var priceInput = $(this);
|
||||
var qtyInput = priceInput.closest(".row").find(".product-price");
|
||||
var linePrice = priceInput.closest(".row").find(".product-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;
|
||||
$(".product-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(total.toFixed(2));
|
||||
// $("#totalamountInput").val(total.toFixed(2));
|
||||
// $("#amountTotalPay").val(total.toFixed(2));
|
||||
}
|
||||
</script>
|
||||
@endpush
|
16
Modules/Order/resources/views/order/partials/view.blade.php
Normal file
16
Modules/Order/resources/views/order/partials/view.blade.php
Normal file
@ -0,0 +1,16 @@
|
||||
<div class="modal fade" id="viewModal" tabindex="-1" aria-labelledby="viewModalLabel" aria-modal="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalgridLabel">View Leave</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="{{ route('leave.store') }}" class="needs-validation" novalidate method="post">
|
||||
@csrf
|
||||
@include('leave::leave.partials.action')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
0
Modules/Order/resources/views/order/show.blade.php
Normal file
0
Modules/Order/resources/views/order/show.blade.php
Normal file
0
Modules/Order/routes/.gitkeep
Normal file
0
Modules/Order/routes/.gitkeep
Normal file
19
Modules/Order/routes/api.php
Normal file
19
Modules/Order/routes/api.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Order\Http\Controllers\OrderController;
|
||||
|
||||
/*
|
||||
*--------------------------------------------------------------------------
|
||||
* 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('order', OrderController::class)->names('order');
|
||||
});
|
21
Modules/Order/routes/web.php
Normal file
21
Modules/Order/routes/web.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Order\Http\Controllers\OrderController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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('order', OrderController::class)->names('order');
|
||||
Route::get('clone-product', [OrderController::class, 'cloneProduct'])->name('cloneProduct');
|
||||
|
||||
});
|
26
Modules/Order/vite.config.js
Normal file
26
Modules/Order/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-order',
|
||||
emptyOutDir: true,
|
||||
manifest: true,
|
||||
},
|
||||
plugins: [
|
||||
laravel({
|
||||
publicDirectory: '../../public',
|
||||
buildDirectory: 'build-order',
|
||||
input: [
|
||||
__dirname + '/resources/assets/sass/app.scss',
|
||||
__dirname + '/resources/assets/js/app.js'
|
||||
],
|
||||
refresh: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
//export const paths = [
|
||||
// 'Modules/Order/resources/assets/sass/app.scss',
|
||||
// 'Modules/Order/resources/assets/js/app.js',
|
||||
//];
|
Reference in New Issue
Block a user