migrate to gtea from bistbucket
This commit is contained in:
@@ -0,0 +1,235 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\WarehouseAddon\App\Http\Controllers;
|
||||
|
||||
use App\Models\Branch;
|
||||
use App\Models\Warehouse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Product;
|
||||
|
||||
class AcnooWarehouseController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('check.permission:warehouses.read')->only(['index']);
|
||||
$this->middleware('check.permission:warehouses.create')->only(['store']);
|
||||
$this->middleware('check.permission:warehouses.update')->only(['update']);
|
||||
$this->middleware('check.permission:warehouses.delete')->only(['destroy', 'deleteAll']);
|
||||
}
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
$businessId = auth()->user()->business_id;
|
||||
$branches = Branch::withTrashed()->where('business_id', $businessId)->latest()->get();
|
||||
|
||||
$warehouses = Warehouse::with('branch:id,name')
|
||||
->where('business_id', $businessId)
|
||||
->withSum(['stocks as total_qty' => function ($query) {
|
||||
$query->when(request()->has('branch_id'), function ($q) {
|
||||
$q->whereColumn('stocks.branch_id', 'warehouses.branch_id');
|
||||
});
|
||||
}], 'productStock')
|
||||
->withSum(['stocks as total_value' => function ($query) {
|
||||
$query->when(request()->has('branch_id'), function ($q) {
|
||||
$q->whereColumn('stocks.branch_id', 'warehouses.branch_id');
|
||||
});
|
||||
}], DB::raw('productStock * productPurchasePrice'))
|
||||
->when($request->branch_id, function ($q) use ($request) {
|
||||
$q->where('branch_id', $request->branch_id);
|
||||
})
|
||||
->when(request('search'), function ($q) use ($request) {
|
||||
$q->where(function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%')
|
||||
->orWhere('email', 'like', '%' . $request->search . '%')
|
||||
->orWhere('address', 'like', '%' . $request->search . '%')
|
||||
->orWhere('phone', 'like', '%' . $request->search . '%')
|
||||
->orWhereHas('branch', function ($q) use ($request) {
|
||||
$q->where('name', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
});
|
||||
})
|
||||
->latest()
|
||||
->paginate($request->per_page ?? 20)->appends($request->query());
|
||||
|
||||
if ($request->ajax()) {
|
||||
return response()->json([
|
||||
'data' => view('warehouseaddon::warehouse.datas', compact('warehouses', 'branches'))->render()
|
||||
]);
|
||||
}
|
||||
|
||||
return view('warehouseaddon::warehouse.index', compact('warehouses', 'branches'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'phone' => 'nullable|string|max:20',
|
||||
'address' => 'nullable|string|max:500',
|
||||
'email' => [
|
||||
'nullable',
|
||||
'email',
|
||||
'max:255',
|
||||
Rule::unique('warehouses')->where(fn ($q) =>
|
||||
$q->where('business_id', $user->business_id)
|
||||
),
|
||||
],
|
||||
]);
|
||||
|
||||
$data = $request->except(['business_id', 'branch_id']);
|
||||
$data['business_id'] = $user->business_id;
|
||||
|
||||
if (moduleCheck('MultiBranchAddon')) {
|
||||
$data['branch_id'] = $request->branch_id ?? $user->branch_id ?? $user->active_branch_id;
|
||||
}
|
||||
|
||||
Warehouse::create($data);
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Warehouse saved successfully.'),
|
||||
'redirect' => route('warehouse.warehouses.index'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$user = auth()->user();
|
||||
$warehouse = Warehouse::findOrFail($id);
|
||||
|
||||
$request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'phone' => 'nullable|string|max:20',
|
||||
'address' => 'nullable|string|max:500',
|
||||
'email' => [
|
||||
'nullable',
|
||||
'email',
|
||||
'max:255',
|
||||
Rule::unique('warehouses')
|
||||
->ignore($warehouse->id)
|
||||
->where(fn ($q) => $q->where('business_id', $user->business_id)),
|
||||
],
|
||||
]);
|
||||
|
||||
$data = $request->except(['business_id', 'branch_id']);
|
||||
|
||||
if (moduleCheck('MultiBranchAddon')) {
|
||||
$data['branch_id'] = $request->branch_id ?? $user->branch_id ?? $user->active_branch_id;
|
||||
}
|
||||
|
||||
$warehouse->update($data);
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Warehouse updated successfully.'),
|
||||
'redirect' => route('warehouse.warehouses.index'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$warehouse = Warehouse::findOrFail($id);
|
||||
$warehouse->delete();
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Warehouse deleted successfully'),
|
||||
'redirect' => route('warehouse.warehouses.index'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function deleteAll(Request $request)
|
||||
{
|
||||
Warehouse::whereIn('id', $request->ids)->delete();
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Selected items deleted successfully.'),
|
||||
'redirect' => route('warehouse.warehouses.index'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function branchWiseWarehouses(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
// Determine the branch
|
||||
$branchId = $user->branch_id ?? $user->active_branch_id;
|
||||
|
||||
$query = Warehouse::query()->where('business_id', $user->business_id);
|
||||
|
||||
if ($request->filled('branch_id')) {
|
||||
$query->where('branch_id', $request->branch_id);
|
||||
} elseif ($branchId) {
|
||||
$query->where('branch_id', $branchId);
|
||||
}
|
||||
|
||||
$warehouses = $query->get();
|
||||
|
||||
return response()->json($warehouses);
|
||||
}
|
||||
|
||||
public function warehouseProduct(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
$businessId = $user->business_id;
|
||||
$activeBranchId = $user->branch_id ?? $user->active_branch_id;
|
||||
|
||||
$search = $request->input('search');
|
||||
|
||||
$products = Product::with([
|
||||
'stocks',
|
||||
'unit:id,unitName',
|
||||
'brand:id,brandName',
|
||||
'category:id,categoryName',
|
||||
'warehouse:id,name',
|
||||
'rack:id,name',
|
||||
'shelf:id,name'
|
||||
])
|
||||
->where('business_id', $businessId)
|
||||
->whereHas('stocks', function ($query) use ($activeBranchId) {
|
||||
$query->whereNotNull('warehouse_id')
|
||||
->when($activeBranchId, fn($q) => $q->where('branch_id', $activeBranchId));
|
||||
})
|
||||
->when($search, function ($q) use ($search) {
|
||||
$q->where(function ($q) use ($search) {
|
||||
$q->where('productName', 'like', '%' . $search . '%')
|
||||
->orWhere('productCode', 'like', '%' . $search . '%')
|
||||
->orWhere('productPurchasePrice', 'like', '%' . $search . '%')
|
||||
->orWhere('productSalePrice', 'like', '%' . $search . '%')
|
||||
->orWhereHas('category', function ($q) use ($search) {
|
||||
$q->where('categoryName', 'like', '%' . $search . '%');
|
||||
})
|
||||
->orWhereHas('brand', function ($q) use ($search) {
|
||||
$q->where('brandName', 'like', '%' . $search . '%');
|
||||
})
|
||||
->orWhereHas('unit', function ($q) use ($search) {
|
||||
$q->where('unitName', 'like', '%' . $search . '%');
|
||||
});
|
||||
});
|
||||
})
|
||||
->latest()
|
||||
->paginate($request->per_page ?? 20)->appends($request->query());
|
||||
|
||||
if ($request->ajax()) {
|
||||
return response()->json([
|
||||
'data' => view('warehouseaddon::warehouse.products.datas', compact('products'))->render()
|
||||
]);
|
||||
}
|
||||
|
||||
return view('warehouseaddon::warehouse.products.index', compact('products'));
|
||||
}
|
||||
|
||||
public function getWarehouses()
|
||||
{
|
||||
$business_id = auth()->user()->business_id;
|
||||
|
||||
$warehouses = Warehouse::where('business_id', $business_id)->select('id', 'name')->latest()->get();
|
||||
|
||||
return response()->json([
|
||||
'warehouses' => $warehouses,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\WarehouseAddon\App\Http\Controllers\Api;
|
||||
|
||||
use App\Models\Warehouse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\Rule;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class WarehouseController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$businessId = auth()->user()->business_id;
|
||||
$data = Warehouse::with(['products.stocks'])
|
||||
->where('business_id', $businessId)
|
||||
->latest()
|
||||
->get()
|
||||
->map(function ($warehouse) {
|
||||
$totalQty = 0;
|
||||
$totalValue = 0;
|
||||
|
||||
foreach ($warehouse->products as $product) {
|
||||
foreach ($product->stocks as $stock) {
|
||||
$totalQty += $stock->productStock;
|
||||
$totalValue += $stock->productStock * $stock->productPurchasePrice;
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => $warehouse->id,
|
||||
'business_id' => $warehouse->business_id,
|
||||
'name' => $warehouse->name,
|
||||
'phone' => $warehouse->phone,
|
||||
'email' => $warehouse->email,
|
||||
'address' => $warehouse->address,
|
||||
'total_quantity' => $totalQty,
|
||||
'total_value' => $totalValue,
|
||||
];
|
||||
});
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Data fetched successfully.'),
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'phone' => 'nullable|string|max:20',
|
||||
'address' => 'nullable|string|max:500',
|
||||
'email' => [
|
||||
'nullable',
|
||||
'email',
|
||||
'max:255',
|
||||
Rule::unique('warehouses')->where(function ($query) {
|
||||
return $query->where('business_id', auth()->user()->business_id);
|
||||
}),
|
||||
],
|
||||
]);
|
||||
|
||||
$data = Warehouse::create($request->except('business_id') + [
|
||||
'business_id' => auth()->user()->business_id,
|
||||
'branch_id' => $request->branch_id ?? auth()->user()->branch_id ?? auth()->user()->active_branch_id,
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Data saved successfully.'),
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
$warehouse = Warehouse::find($id);
|
||||
if (!$warehouse) {
|
||||
return response()->json([
|
||||
'message' => __('Warehouse not found.'),
|
||||
'data' => null,
|
||||
], 404);
|
||||
}
|
||||
|
||||
$request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'phone' => 'nullable|string|max:20',
|
||||
'address' => 'nullable|string|max:500',
|
||||
'email' => [
|
||||
'nullable',
|
||||
'email',
|
||||
'max:255',
|
||||
Rule::unique('warehouses')->ignore($warehouse->id)->where(function ($query) {
|
||||
return $query->where('business_id', auth()->user()->business_id);
|
||||
}),
|
||||
],
|
||||
]);
|
||||
|
||||
$warehouse->update($request->except('branch_id', 'business_id') + [
|
||||
'branch_id' => $request->branch_id ?? auth()->user()->branch_id ?? auth()->user()->active_branch_id,
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Data saved successfully.'),
|
||||
'data' => $warehouse,
|
||||
]);
|
||||
}
|
||||
|
||||
public function destroy(string $id)
|
||||
{
|
||||
$warehouse = Warehouse::find($id);
|
||||
|
||||
if (!$warehouse) {
|
||||
return response()->json([
|
||||
'message' => __('Warehouse not found.'),
|
||||
], 404);
|
||||
}
|
||||
|
||||
$warehouse->delete();
|
||||
return response()->json([
|
||||
'message' => __('Data deleted successfully.'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
0
Modules/WarehouseAddon/App/Providers/.gitkeep
Normal file
0
Modules/WarehouseAddon/App/Providers/.gitkeep
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\WarehouseAddon\App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The module namespace to assume when generating URLs to actions.
|
||||
*/
|
||||
protected string $moduleNamespace = 'Modules\WarehouseAddon\App\Http\Controllers';
|
||||
|
||||
/**
|
||||
* 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')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('WarehouseAddon', '/routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*/
|
||||
protected function mapApiRoutes(): void
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('WarehouseAddon', '/routes/api.php'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\WarehouseAddon\App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class WarehouseAddonServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'WarehouseAddon';
|
||||
|
||||
protected string $moduleNameLower = 'warehouseaddon';
|
||||
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Register command Schedules.
|
||||
*/
|
||||
protected function registerCommandSchedules(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 . '\\' . config('modules.paths.generator.component-class.path'));
|
||||
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;
|
||||
}
|
||||
}
|
||||
0
Modules/WarehouseAddon/Database/Seeders/.gitkeep
Normal file
0
Modules/WarehouseAddon/Database/Seeders/.gitkeep
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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::table('warehouses', function (Blueprint $table) {
|
||||
$table->dropUnique('warehouses_email_unique');
|
||||
$table->string('email')->nullable()->change();
|
||||
$table->foreignId('branch_id')->nullable()->after('business_id')->constrained('branches')->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('warehouses', function (Blueprint $table) {
|
||||
$table->string('email')->unique()->nullable()->change();
|
||||
$table->dropColumn('branch_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
31
Modules/WarehouseAddon/composer.json
Normal file
31
Modules/WarehouseAddon/composer.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "nwidart/warehouseaddon",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Widart",
|
||||
"email": "n.widart@gmail.com"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\WarehouseAddon\\": "",
|
||||
"Modules\\WarehouseAddon\\App\\": "app/",
|
||||
"Modules\\WarehouseAddon\\Database\\Factories\\": "database/factories/",
|
||||
"Modules\\WarehouseAddon\\Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Modules\\WarehouseAddon\\Tests\\": "tests/"
|
||||
}
|
||||
}
|
||||
}
|
||||
0
Modules/WarehouseAddon/config/.gitkeep
Normal file
0
Modules/WarehouseAddon/config/.gitkeep
Normal file
5
Modules/WarehouseAddon/config/config.php
Normal file
5
Modules/WarehouseAddon/config/config.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'WarehouseAddon',
|
||||
];
|
||||
12
Modules/WarehouseAddon/module.json
Normal file
12
Modules/WarehouseAddon/module.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "WarehouseAddon",
|
||||
"alias": "warehouseaddon",
|
||||
"version": "1.2",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\WarehouseAddon\\App\\Providers\\WarehouseAddonServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
||||
15
Modules/WarehouseAddon/package.json
Normal file
15
Modules/WarehouseAddon/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/WarehouseAddon/resources/views/.gitkeep
Normal file
0
Modules/WarehouseAddon/resources/views/.gitkeep
Normal file
@@ -0,0 +1,22 @@
|
||||
<div class="modal fade" id="multi-delete-modal" tabindex="-1" aria-labelledby="multi-delete-modal-label" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="text-end">
|
||||
<button type="button" class="btn-close m-3 mb-0" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body pt-0">
|
||||
<div class="delete-modal">
|
||||
<h5>{{ __('Are You Sure?') }}</h5>
|
||||
<p>{{ __("You want to delete everything!") }}</p>
|
||||
</div>
|
||||
<div class="multiple-button-group">
|
||||
<button class="btn reset-btn" data-bs-dismiss="modal">{{ __('Cancel') }}</button>
|
||||
<form id="dynamic-delete-form" method="POST" class="ajaxform_instant_reload">
|
||||
@csrf
|
||||
<button class="btn theme-btn submit-btn create-all-delete" type="submit">{{ __('Yes, Delete It!') }}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,60 @@
|
||||
<div class="modal fade common-validation-modal" id="warehouses-create-modal">
|
||||
<div class="modal-dialog modal-dialog-centered modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5">{{ __('Create Warehouse') }}</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="personal-info">
|
||||
<form action="{{ route('warehouse.warehouses.store') }}" method="post" class="ajaxform_instant_reload">
|
||||
@csrf
|
||||
<div class="row">
|
||||
@if((moduleCheck('MultiBranchAddon') && multibranch_active()) && !auth()->user()->active_branch_id)
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('Branch') }}</label>
|
||||
<div class="gpt-up-down-arrow position-relative">
|
||||
<select name="branch_id" class="form-control table-select w-100 role">
|
||||
<option value=""> {{ __('Select one') }}</option>
|
||||
@foreach ($branches as $branch)
|
||||
<option value="{{ $branch->id }}"> {{ ucfirst($branch->name) }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span></span>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('Name') }}</label>
|
||||
<input type="text" name="name" class="form-control" placeholder="{{ __('Enter name') }}" required>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<label>{{ __('Phone') }}</label>
|
||||
<input type="text" name="phone" class="form-control" placeholder="{{ __('Enter phone') }}">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<label>{{ __('Email') }}</label>
|
||||
<input type="text" name="email" class="form-control" placeholder="{{ __('Enter email') }}">
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<label>{{ __('Address') }}</label>
|
||||
<input type="text" name="address" class="form-control" placeholder="{{ __('Enter address') }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-12">
|
||||
<div class="button-group text-center mt-5">
|
||||
<button type="reset" class="theme-btn border-btn m-2">{{ __('Reset') }}</button>
|
||||
@usercan('warehouses.create')
|
||||
<button class="theme-btn m-2 submit-btn">{{ __('Save') }}</button>
|
||||
@endusercan
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,99 @@
|
||||
<div class="responsive-table m-0">
|
||||
<table class="table" id="datatable">
|
||||
<thead>
|
||||
<tr>
|
||||
@usercan('warehouses.delete')
|
||||
<th class="w-60">
|
||||
<div class="d-flex align-items-center gap-3">
|
||||
<input type="checkbox" class="select-all-delete multi-delete">
|
||||
</div>
|
||||
</th>
|
||||
@endusercan
|
||||
<th>{{ __('SL') }}.</th>
|
||||
@if (moduleCheck('MultiBranchAddon') && multibranch_active())
|
||||
<th class="text-start">{{ __('Branch') }}</th>
|
||||
@endif
|
||||
<th class="text-start">{{ __('Name') }}</th>
|
||||
<th class="text-start">{{ __('Phone') }}</th>
|
||||
<th class="text-start">{{ __('Email') }}</th>
|
||||
<th class="text-start">{{ __('Address') }}</th>
|
||||
<th class="text-start">{{ __('Stock Qty') }}</th>
|
||||
<th class="text-start">{{ __('Stock Value') }}</th>
|
||||
<th>{{ __('Action') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($warehouses as $warehouse)
|
||||
<tr>
|
||||
@usercan('warehouses.delete')
|
||||
<td class="w-60 checkbox">
|
||||
<input type="checkbox" name="ids[]" class="delete-checkbox-item multi-delete"
|
||||
value="{{ $warehouse->id }}">
|
||||
</td>
|
||||
@endusercan
|
||||
<td>{{ ($warehouses->currentPage() - 1) * $warehouses->perPage() + $loop->iteration }}</td>
|
||||
@if (moduleCheck('MultiBranchAddon') && multibranch_active())
|
||||
<td class="text-start">{{ $warehouse->branch->name ?? '' }}</td>
|
||||
@endif
|
||||
<td class="text-start">{{ $warehouse->name }}</td>
|
||||
<td class="text-start">{{ $warehouse->phone }}</td>
|
||||
<td class="text-start">{{ $warehouse->email }}</td>
|
||||
<td class="text-start">{{ $warehouse->address }}</td>
|
||||
<td class="text-start">{{ $warehouse->total_qty }}</td>
|
||||
<td class="text-start">{{ currency_format($warehouse->total_value, currency: business_currency()) }}</td>
|
||||
|
||||
<td class="d-print-none">
|
||||
<div class="dropdown table-action">
|
||||
<button type="button" data-bs-toggle="dropdown">
|
||||
<i class="far fa-ellipsis-v"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
|
||||
@usercan('warehouses.read')
|
||||
<li>
|
||||
<a href="#warehouse-view" class="warehouse-view-btn" data-bs-toggle="modal"
|
||||
data-warehouse-name="{{ $warehouse->name }}"
|
||||
data-branch-name="{{ $warehouse->branch->name ?? '' }}"
|
||||
data-warehouse-email="{{ $warehouse->email }}"
|
||||
data-warehouse-phone="{{ $warehouse->phone }}"
|
||||
data-warehouse-address="{{ $warehouse->address }}">
|
||||
<i class="fal fa-eye"></i>
|
||||
{{ __('View') }}
|
||||
</a>
|
||||
</li>
|
||||
@endusercan
|
||||
|
||||
@usercan('warehouses.update')
|
||||
<li>
|
||||
<a href="#warehouses-edit-modal" data-bs-toggle="modal" class="warehouse-edit-btn"
|
||||
data-url="{{ route('warehouse.warehouses.update', $warehouse->id) }}"
|
||||
data-name="{{ $warehouse->name }}"
|
||||
data-branch-id="{{ $warehouse->branch->id ?? '' }}"
|
||||
data-phone="{{ $warehouse->phone }}" data-email="{{ $warehouse->email }}"
|
||||
data-address="{{ $warehouse->address }}">
|
||||
<i class="fal fa-edit"></i></i>{{ __('Edit') }}
|
||||
</a>
|
||||
</li>
|
||||
@endusercan
|
||||
|
||||
@usercan('warehouses.delete')
|
||||
<li>
|
||||
<a href="{{ route('warehouse.warehouses.destroy', $warehouse->id) }}"
|
||||
class="confirm-action" data-method="DELETE">
|
||||
<i class="fal fa-trash-alt"></i>
|
||||
{{ __('Delete') }}
|
||||
</a>
|
||||
</li>
|
||||
@endusercan
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
{{ $warehouses->links('vendor.pagination.bootstrap-5') }}
|
||||
</div>
|
||||
@@ -0,0 +1,63 @@
|
||||
<div class="modal fade common-validation-modal" id="warehouses-edit-modal">
|
||||
<div class="modal-dialog modal-dialog-centered modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5">{{ __('Edit Warehouse') }}</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="personal-info">
|
||||
<form action="" method="post" enctype="multipart/form-data" class="ajaxform_instant_reload warehouseUpdateForm">
|
||||
@csrf
|
||||
@method('put')
|
||||
<div class="row">
|
||||
@if((moduleCheck('MultiBranchAddon') && multibranch_active()) && !auth()->user()->active_branch_id)
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('Branch') }}</label>
|
||||
<div class="gpt-up-down-arrow position-relative">
|
||||
<select name="branch_id" id="branch_id" class="form-control table-select w-100 role">
|
||||
<option value=""> {{ __('Select one') }}</option>
|
||||
@foreach ($branches as $branch)
|
||||
<option value="{{ $branch->id }}"> {{ ucfirst($branch->name) }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span></span>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class="col-lg-6 mb-2">
|
||||
<label>{{ __('Name') }}</label>
|
||||
<input type="text" name="name" id="name" class="form-control" placeholder="{{ __('Enter name') }}" required>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<label>{{ __('Phone') }}</label>
|
||||
<input type="text" name="phone" id="phone" class="form-control" placeholder="{{ __('Enter phone') }}">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<label>{{ __('Email') }}</label>
|
||||
<input type="text" name="email" id="email" class="form-control" placeholder="{{ __('Enter email') }}">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<label>{{ __('Address') }}</label>
|
||||
<input type="text" name="address" id="address" class="form-control" placeholder="{{ __('Enter address') }}">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-lg-12">
|
||||
<div class="button-group text-center mt-5">
|
||||
<a href="{{ route('warehouse.warehouses.index') }}" class="theme-btn border-btn m-2">{{ __('Cancel') }}</a>
|
||||
@usercan('warehouses.update')
|
||||
<button class="theme-btn m-2 submit-btn">{{ __('Save') }}</button>
|
||||
@endusercan
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,84 @@
|
||||
@extends('layouts.business.master')
|
||||
|
||||
@section('title')
|
||||
{{ __('Warehouses List') }}
|
||||
@endsection
|
||||
|
||||
@section('main_content')
|
||||
<div class="erp-table-section">
|
||||
<div class="container-fluid">
|
||||
<div class="card">
|
||||
<div class="card-bodys">
|
||||
|
||||
<div class="table-header p-16">
|
||||
<h4>{{ __('Warehouses List') }}</h4>
|
||||
@usercan('warehouses.create')
|
||||
<a type="button" href="#warehouses-create-modal" data-bs-toggle="modal" class="add-order-btn rounded-2"><i class="fas fa-plus-circle me-1"></i>{{ __('Add new') }}</a>
|
||||
@endusercan
|
||||
</div>
|
||||
|
||||
<div class="table-top-form p-16-0">
|
||||
<form action="{{ route('warehouse.warehouses.index') }}" method="GET" class="filter-form" table="#warehouses-data">
|
||||
|
||||
<div class="table-top-left d-flex gap-3 margin-lr-16 flex-wrap">
|
||||
|
||||
<div class="gpt-up-down-arrow position-relative">
|
||||
<select name="per_page" class="form-control">
|
||||
<option @selected(request('per_page') == 20) value="20">{{ __('Show 20') }}</option>
|
||||
<option @selected(request('per_page') == 50) value="50">{{ __('Show 50') }}</option>
|
||||
<option @selected(request('per_page') == 100) value="100">{{ __('Show 100') }}</option>
|
||||
<option @selected(request('per_page') == 500) value="500">{{ __('Show 500') }}</option>
|
||||
</select>
|
||||
<span></span>
|
||||
</div>
|
||||
|
||||
@if(moduleCheck('MultiBranchAddon') && multibranch_active())
|
||||
<div class="table-search position-relative">
|
||||
<div class="gpt-up-down-arrow position-relative">
|
||||
<select name="branch_id" class="form-control">
|
||||
<option value="">{{ __('Select Branch') }}</option>
|
||||
@foreach ($branches as $branch)
|
||||
<option value="{{ $branch->id }}" @selected(request('branch_id') == $branch->id)>{{ $branch->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span></span>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="table-search position-relative">
|
||||
<input type="text" name="search" class="form-control" placeholder="{{ __('Search...') }}" value="{{ request('search') }}">
|
||||
<span class="position-absolute">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M14.582 14.582L18.332 18.332" stroke="#4D4D4D" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M16.668 9.16797C16.668 5.02584 13.3101 1.66797 9.16797 1.66797C5.02584 1.66797 1.66797 5.02584 1.66797 9.16797C1.66797 13.3101 5.02584 16.668 9.16797 16.668C13.3101 16.668 16.668 13.3101 16.668 9.16797Z" stroke="#4D4D4D" stroke-width="1.25" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="delete-item delete-show d-none">
|
||||
<div class="delete-item-show">
|
||||
<p class="fw-bold"><span class="selected-count"></span> {{ __('items show') }}</p>
|
||||
<button data-bs-toggle="modal" class="trigger-modal" data-bs-target="#multi-delete-modal" data-url="{{ route('warehouse.warehouses.delete-all') }}">{{ __('Delete') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="warehouses-data">
|
||||
@include('warehouseaddon::warehouse.datas')
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('modal')
|
||||
@include('warehouseaddon::component.delete-modal')
|
||||
@include('warehouseaddon::warehouse.create')
|
||||
@include('warehouseaddon::warehouse.edit')
|
||||
@include('warehouseaddon::warehouse.view')
|
||||
@endpush
|
||||
@@ -0,0 +1,86 @@
|
||||
<div class="responsive-table m-0">
|
||||
<table class="table" id="datatable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> {{ __('SL') }}. </th>
|
||||
<th> {{ __('Image') }} </th>
|
||||
<th> {{ __('Product Name') }} </th>
|
||||
<th class="d-print-none"> {{ __('Code') }} </th>
|
||||
<th> {{ __('Brand') }} </th>
|
||||
<th> {{ __('Category') }} </th>
|
||||
<th> {{ __('Warehouse') }} </th>
|
||||
<th> {{ __('Unit') }} </th>
|
||||
<th> {{ __('Purchase price') }}</th>
|
||||
<th> {{ __('Sale price') }}</th>
|
||||
<th> {{ __('Stock') }}</th>
|
||||
<th> {{ __('Rack') }}</th>
|
||||
<th> {{ __('Shelf') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($products as $product)
|
||||
@php
|
||||
$nonEmptyStock = $product->stocks->firstWhere('productStock', '>', 0);
|
||||
$fallbackStock = $product->stocks->first(); // fallback if no stock > 0
|
||||
$stock = $nonEmptyStock ?? $fallbackStock;
|
||||
|
||||
$latestPurchasePrice = $stock?->productPurchasePrice ?? 0;
|
||||
$latestSalePrice = $stock?->productSalePrice ?? 0;
|
||||
$latestWholeSalePrice = $stock?->productWholeSalePrice ?? 0;
|
||||
$latestDealerPrice = $stock?->productDealerPrice ?? 0;
|
||||
$productStock = $product->total_stock ?? 0;
|
||||
@endphp
|
||||
<tr>
|
||||
|
||||
<td>{{ ($products->currentPage() - 1) * $products->perPage() + $loop->iteration }}</td>
|
||||
|
||||
<td><img src="{{ asset($product->productPicture ?? 'assets/images/logo/upload2.jpg') }}"
|
||||
alt="Img" class="table-product-img"></td>
|
||||
|
||||
<td class="d-print-none">
|
||||
@php
|
||||
$stocks = $product->stocks->map(function ($batch) use ($product) {
|
||||
$hasWeight = $product->category ? $product->category->variationWeight : false;
|
||||
return [
|
||||
'id' => $batch->id,
|
||||
'batch_no' => $batch->batch_no,
|
||||
'expire_date' => $batch->expire_date ? formatted_date($batch->expire_date) : 'N/A',
|
||||
'productStock' => $batch->productStock ?? 0,
|
||||
'productSalePrice' => $batch->productSalePrice ?? 0,
|
||||
'productPurchasePrice' => $batch->productPurchasePrice ?? 0,
|
||||
'productWholeSalePrice' => $batch->productWholeSalePrice ?? 0,
|
||||
'productDealerPrice' => $batch->productDealerPrice ?? 0,
|
||||
'warehouse' => $batch->warehouse->name ?? '',
|
||||
'rack' => $product->rack->name ?? '',
|
||||
'shelf' => $product->shelf->name ?? '',
|
||||
'weight' => $hasWeight ? $product->weight : null,
|
||||
'showWeight' => $hasWeight ? 1 : 0,
|
||||
];
|
||||
});
|
||||
@endphp
|
||||
<a href="javascript:void(0);" class="stock-view-data text-primary"
|
||||
data-stocks='@json($stocks)'>
|
||||
{{ $product->productName }}
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<td>{{ $product->productCode }}</td>
|
||||
<td>{{ $product->brand->brandName ?? '' }}</td>
|
||||
<td>{{ $product->category->categoryName ?? '' }}</td>
|
||||
<td>{{ $fallbackStock->warehouse->name ?? '' }}</td>
|
||||
<td>{{ $product->unit->unitName ?? '' }}</td>
|
||||
<td>{{ currency_format($latestPurchasePrice, currency: business_currency()) }}</td>
|
||||
<td>{{ currency_format($latestSalePrice, currency: business_currency()) }}</td>
|
||||
<td class="{{ $product->total_stock <= $product->alert_qty ? 'text-danger' : 'text-success' }}">
|
||||
{{ $product->total_stock }}</td>
|
||||
<td>{{ $product->rack->name ?? '' }}</td>
|
||||
<td>{{ $product->shelf->name ?? '' }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
{{ $products->links('vendor.pagination.bootstrap-5') }}
|
||||
</div>
|
||||
@@ -0,0 +1,74 @@
|
||||
@extends('layouts.business.master')
|
||||
|
||||
@section('title')
|
||||
{{ __('Product List') }}
|
||||
@endsection
|
||||
|
||||
@php
|
||||
$modules = product_setting()->modules ?? [];
|
||||
@endphp
|
||||
|
||||
@section('main_content')
|
||||
<div class="erp-table-section">
|
||||
<div class="container-fluid">
|
||||
<div class="card">
|
||||
<div class="card-bodys">
|
||||
|
||||
<div class="table-header p-16">
|
||||
<h4>{{ __('Product List') }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="table-top-form p-16-0">
|
||||
<form action="{{ route('warehouse.warehouses.product') }}" method="GET" class="filter-form" table="#product-data">
|
||||
|
||||
<div class="table-top-left d-flex gap-3 margin-l-16">
|
||||
|
||||
<div class="gpt-up-down-arrow position-relative">
|
||||
<select name="per_page" class="form-control">
|
||||
<option @selected(request('per_page') == 20) value="20">{{ __('Show 20') }}</option>
|
||||
<option @selected(request('per_page') == 50) value="50">{{ __('Show 50') }}</option>
|
||||
<option @selected(request('per_page') == 100) value="100">{{ __('Show 100') }}</option>
|
||||
<option @selected(request('per_page') == 500) value="500">{{ __('Show 500') }}</option>
|
||||
</select>
|
||||
<span></span>
|
||||
</div>
|
||||
|
||||
<div class="table-search position-relative">
|
||||
<input type="text" name="search" class="form-control" placeholder="{{ __('Search...') }}" value="{{ request('search') }}">
|
||||
<span class="position-absolute">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M14.582 14.582L18.332 18.332" stroke="#4D4D4D" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M16.668 9.16797C16.668 5.02584 13.3101 1.66797 9.16797 1.66797C5.02584 1.66797 1.66797 5.02584 1.66797 9.16797C1.66797 13.3101 5.02584 16.668 9.16797 16.668C13.3101 16.668 16.668 13.3101 16.668 9.16797Z" stroke="#4D4D4D" stroke-width="1.25" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="product-data">
|
||||
@include('warehouseaddon::warehouse.products.datas')
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@usercan('stocks.price')
|
||||
<input type="hidden" id="canStockPrice" value="1">
|
||||
@endusercan
|
||||
<input type="hidden" id="canStockPrice" value="0">
|
||||
<input type="hidden" id="show_expire_date" value="{{ is_module_enabled($modules, 'show_expire_date') ? 1 : 0 }}">
|
||||
<input type="hidden" id="warehouse_module_check" value="{{ moduleCheck('WarehouseAddon') ? 1 : 0 }}">
|
||||
<input type="hidden" id="show_weight" value="{{ is_module_enabled($modules, 'show_weight') ? 1 : 0 }}">
|
||||
<input type="hidden" id="show_warehouse" value="{{ is_module_enabled($modules, 'show_warehouse') ? 1 : 0 }}">
|
||||
<input type="hidden" id="show_rack" value="{{ is_module_enabled($modules, 'show_rack') ? 1 : 0 }}">
|
||||
<input type="hidden" id="show_shelf" value="{{ is_module_enabled($modules, 'show_shelf') ? 1 : 0 }}">
|
||||
|
||||
|
||||
@endsection
|
||||
|
||||
@push('modal')
|
||||
@include('warehouseaddon::warehouse.products.stock-modal')
|
||||
@endpush
|
||||
@@ -0,0 +1,53 @@
|
||||
<div class="modal fade p-0" id="stock-modal-view" >
|
||||
<div class="modal-dialog modal-dialog-centered modal-xl">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5">{{ __('View Stock') }}</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body order-form-section">
|
||||
<div class="costing-list">
|
||||
<div class="table-responsive mt-3">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ __('Batch') }}</th>
|
||||
<th>{{ __('Stock') }}</th>
|
||||
@usercan('stocks.price')
|
||||
<th>{{ __('Purchase Price') }}</th>
|
||||
@endusercan
|
||||
<th>{{ __('MRP') }}</th>
|
||||
<th>{{ __('WholeSale Price') }}</th>
|
||||
<th>{{ __('Dealer Price') }}</th>
|
||||
@if (is_module_enabled($modules, 'show_expire_date'))
|
||||
<th>{{ __('Expire Date') }}</th>
|
||||
@endif
|
||||
@if (moduleCheck('WarehouseAddon') && is_module_enabled($modules, 'show_warehouse'))
|
||||
<th>{{ __('Warehouse') }}</th>
|
||||
@endif
|
||||
@if (is_module_enabled($modules, 'show_weight'))
|
||||
<th id="weight-header" class="d-none">{{ __('Weight') }}</th>
|
||||
@endif
|
||||
@if (is_module_enabled($modules, 'show_rack'))
|
||||
<th>{{ __('Rack') }}</th>
|
||||
@endif
|
||||
@if (is_module_enabled($modules, 'show_shelf'))
|
||||
<th>{{ __('Shelf') }}</th>
|
||||
@endif
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="stocks-table-data">
|
||||
{{-- Filled via jQuery --}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<div class="modal fade p-0" id="warehouse-view">
|
||||
<div class="modal-dialog modal-dialog-centered modal-md">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5">{{ __('View') }}</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body order-form-section">
|
||||
<div class="">
|
||||
<table class="info-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{{ __('Name') }}</td>
|
||||
<td>:</td>
|
||||
<td id="warehouseName"></td>
|
||||
</tr>
|
||||
|
||||
@if(auth()->user()->accessToMultiBranch())
|
||||
<tr>
|
||||
<td>{{ __('Branch') }}</td>
|
||||
<td>:</td>
|
||||
<td id="branchName"></td>
|
||||
</tr>
|
||||
@endif
|
||||
|
||||
<tr>
|
||||
<td>{{ __('Phone') }}</td>
|
||||
<td>:</td>
|
||||
<td id="warehousePhone"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('Email') }}</td>
|
||||
<td>:</td>
|
||||
<td id="warehouseEmail"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('Address') }}</td>
|
||||
<td>:</td>
|
||||
<td id="warehouseAddress"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
0
Modules/WarehouseAddon/routes/.gitkeep
Normal file
0
Modules/WarehouseAddon/routes/.gitkeep
Normal file
10
Modules/WarehouseAddon/routes/api.php
Normal file
10
Modules/WarehouseAddon/routes/api.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\WarehouseAddon\App\Http\Controllers\Api\WarehouseController;
|
||||
|
||||
Route::prefix('v1')->group(function () {
|
||||
Route::group(['middleware' => ['auth:sanctum']], function () {
|
||||
Route::apiResource('warehouses', WarehouseController::class)->except('show');
|
||||
});
|
||||
});
|
||||
19
Modules/WarehouseAddon/routes/web.php
Normal file
19
Modules/WarehouseAddon/routes/web.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\WarehouseAddon\App\Http\Controllers as Warehouse;
|
||||
|
||||
Route::group(['as' => 'warehouse.', 'prefix' => 'warehouse', 'middleware' => ['users', 'expired']], function () {
|
||||
|
||||
//Warehouse
|
||||
Route::resource('warehouses', Warehouse\AcnooWarehouseController::class)->except('show');
|
||||
Route::post('warehouses/filter', [Warehouse\AcnooWarehouseController::class, 'acnooFilter'])->name('warehouses.filter');
|
||||
Route::post('warehouses/status/{id}', [Warehouse\AcnooWarehouseController::class, 'status'])->name('warehouses.status');
|
||||
Route::post('warehouses/delete-all', [Warehouse\AcnooWarehouseController::class, 'deleteAll'])->name('warehouses.delete-all');
|
||||
Route::get('/warehouses-by-branch/{branch_id?}', [Warehouse\AcnooWarehouseController::class, 'branchWiseWarehouses'])->name('warehouses.branch');
|
||||
Route::get('/warehouses/list', [Warehouse\AcnooWarehouseController::class, 'getWarehouses'])->name('warehouses.list');
|
||||
|
||||
//products
|
||||
Route::get('/warehouse/products', [Warehouse\AcnooWarehouseController::class, 'warehouseProduct'])->name('warehouses.product');
|
||||
|
||||
});
|
||||
26
Modules/WarehouseAddon/vite.config.js
Normal file
26
Modules/WarehouseAddon/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-warehouseaddon',
|
||||
emptyOutDir: true,
|
||||
manifest: true,
|
||||
},
|
||||
plugins: [
|
||||
laravel({
|
||||
publicDirectory: '../../public',
|
||||
buildDirectory: 'build-warehouseaddon',
|
||||
input: [
|
||||
__dirname + '/resources/assets/sass/app.scss',
|
||||
__dirname + '/resources/assets/js/app.js'
|
||||
],
|
||||
refresh: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
//export const paths = [
|
||||
// 'Modules/$STUDLY_NAME$/resources/assets/sass/app.scss',
|
||||
// 'Modules/$STUDLY_NAME$/resources/assets/js/app.js',
|
||||
//];
|
||||
Reference in New Issue
Block a user