This commit is contained in:
Sampanna Rimal
2024-09-11 12:32:15 +05:45
parent 82fab174dc
commit afb2c202d6
170 changed files with 3352 additions and 363 deletions

View File

@ -0,0 +1,97 @@
<?php
namespace Modules\Stock\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Modules\Product\Repositories\ProductRepository;
use Modules\Stock\Models\Stock;
use Modules\Stock\Repositories\StockLocationRepository;
use Modules\Stock\Repositories\StockRepository;
class StockController extends Controller
{
private $stockRepository;
private $productRepository;
private $stockLocationRepository;
public function __construct(StockRepository $stockRepository,
StockLocationRepository $stockLocationRepository,
ProductRepository $productRepository)
{
$this->stockRepository = $stockRepository;
$this->productRepository = $productRepository;
$this->stockLocationRepository = $stockLocationRepository;
}
public function index()
{
$data['title'] = 'Stocks List';
$data['stocks'] = $this->stockRepository->findAll();
return view('stock::stock.index', $data);
}
public function create()
{
$data['title'] = 'Create Stock';
$data['stockLocation'] = $this->stockLocationRepository->pluck();
$data['product'] = $this->productRepository->pluck();
$data['status'] = Stock::STATUS;
return view('stock::stock.create', $data);
}
public function store(Request $request): RedirectResponse
{
$request->request->add(['slug' => slugify($request->title)]);
$inputData = $request->all();
$this->stockRepository->create($inputData);
toastr()->success('Stock Created Successfully');
return redirect()->route('stock.index');
}
public function show($id)
{
$data['title'] = 'Show Stock';
$data['status'] = Stock::STATUS;
$data['stock'] = $this->stockRepository->getStockById($id);
return view('stock::stock.show', $data);
}
public function edit($id)
{
$data['title'] = 'Edit Stock';
$data['stockLocation'] = $this->stockLocationRepository->pluck();
$data['product'] = $this->productRepository->pluck();
$data['status'] = Stock::STATUS;
$data['stock'] = $this->stockRepository->getStockById($id);
return view('stock::stock.edit', $data);
}
public function update(Request $request, $id): RedirectResponse
{
$inputData = $request->except(['_method', '_token']);
$this->stockRepository->update($id, $inputData);
return redirect()->route('stock.index');
}
public function destroy($id)
{
try {
$stock = $this->stockRepository->getStockById($id);
$stock->delete();
toastr()->success('Stock Deleted Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return response()->json(['status' => true, 'message' => 'Stock Deleted Successfully']);
}
}

View File

@ -0,0 +1,84 @@
<?php
namespace Modules\Stock\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Modules\Stock\Models\StockLocation;
use Modules\Stock\Repositories\StockLocationRepository;
class StockLocationController extends Controller
{
private $stockLocationRepository;
public function __construct(StockLocationRepository $stockLocationRepository)
{
$this->stockLocationRepository = $stockLocationRepository;
}
public function index()
{
$data['title'] = 'Stocks List';
$data['stockLocations'] = $this->stockLocationRepository->findAll();
return view('stock::stockLocation.index', $data);
}
public function create()
{
$data['title'] = 'Create StockLocation';
$data['status'] = StockLocation::STATUS;
return view('stock::stockLocation.create', $data);
}
public function store(Request $request): RedirectResponse
{
$request->request->add(['slug' => slugify($request->title)]);
$inputData = $request->all();
$this->stockLocationRepository->create($inputData);
toastr()->success('StockLocation Created Successfully');
return redirect()->route('stockLocation.index');
}
public function show($id)
{
$data['title'] = 'Show StockLocation';
$data['status'] = StockLocation::STATUS;
$data['stockLocation'] = $this->stockLocationRepository->getStockLocationById($id);
return view('stock::stockLocation.show', $data);
}
public function edit($id)
{
$data['title'] = 'Edit StockLocation';
$data['status'] = StockLocation::STATUS;
$data['stockLocation'] = $this->stockLocationRepository->getStockLocationById($id);
return view('stock::stockLocation.edit', $data);
}
public function update(Request $request, $id): RedirectResponse
{
$inputData = $request->except(['_method', '_token']);
$this->stockLocationRepository->update($id, $inputData);
return redirect()->route('stockLocation.index');
}
public function destroy($id)
{
try {
$stock = $this->stockLocationRepository->getStockLocationById($id);
$stock->delete();
toastr()->success('Stock Location Deleted Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return response()->json(['status' => true, 'message' => 'Stock Location Deleted Successfully']);
}
}

View File

View File

View File

@ -0,0 +1,27 @@
<?php
namespace Modules\Stock\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Modules\Product\Models\Product;
class Stock extends Model
{
use StatusTrait;
protected $table = 'tbl_stocks';
protected $guarded = [];
protected $appends = ['status_name'];
public function stockLocation()
{
return $this->belongsTo(StockLocation::class, 'stocklocation_id');
}
public function product()
{
return $this->belongsTo(Product::class, 'product_id');
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace Modules\Stock\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
class StockLocation extends Model
{
USE StatusTrait;
protected $table = 'tbl_stocklocations';
protected $guarded = [];
protected $appends = ['status_name'];
}

View File

View File

View File

@ -0,0 +1,32 @@
<?php
namespace Modules\Stock\Providers;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event handler mappings for the application.
*
* @var array<string, array<int, string>>
*/
protected $listen = [];
/**
* Indicates if events should be discovered.
*
* @var bool
*/
protected static $shouldDiscoverEvents = true;
/**
* Configure the proper event listeners for email verification.
*
* @return void
*/
protected function configureEmailVerification(): void
{
}
}

View File

@ -0,0 +1,49 @@
<?php
namespace Modules\Stock\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
* Called before routes are registered.
*
* Register any model bindings or pattern based filters.
*/
public function boot(): void
{
parent::boot();
}
/**
* Define the routes for the application.
*/
public function map(): void
{
$this->mapApiRoutes();
$this->mapWebRoutes();
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*/
protected function mapWebRoutes(): void
{
Route::middleware('web')->group(module_path('Stock', '/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('Stock', '/routes/api.php'));
}
}

View File

@ -0,0 +1,123 @@
<?php
namespace Modules\Stock\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use Modules\Stock\Repositories\StockInterface;
use Modules\Stock\Repositories\StockRepository;
class StockServiceProvider extends ServiceProvider
{
protected string $moduleName = 'Stock';
protected string $moduleNameLower = 'stock';
/**
* Boot the application events.
*/
public function boot(): void
{
$this->registerCommands();
$this->registerCommandSchedules();
$this->registerTranslations();
$this->registerConfig();
$this->registerViews();
$this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations'));
}
/**
* Register the service provider.
*/
public function register(): void
{
$this->app->register(EventServiceProvider::class);
$this->app->register(RouteServiceProvider::class);
$this->app->bind(StockInterface::class, StockRepository::class);
}
/**
* Register commands in the format of Command::class
*/
protected function registerCommands(): void
{
// $this->commands([]);
}
/**
* Register command Schedules.
*/
protected function registerCommandSchedules(): void
{
// $this->app->booted(function () {
// $schedule = $this->app->make(Schedule::class);
// $schedule->command('inspire')->hourly();
// });
}
/**
* Register translations.
*/
public function registerTranslations(): void
{
$langPath = resource_path('lang/modules/'.$this->moduleNameLower);
if (is_dir($langPath)) {
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
$this->loadJsonTranslationsFrom($langPath);
} else {
$this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower);
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang'));
}
}
/**
* Register config.
*/
protected function registerConfig(): void
{
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config');
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
}
/**
* Register views.
*/
public function registerViews(): void
{
$viewPath = resource_path('views/modules/'.$this->moduleNameLower);
$sourcePath = module_path($this->moduleName, 'resources/views');
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']);
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
$componentNamespace = str_replace('/', '\\', config('modules.namespace').'\\'.$this->moduleName.'\\'.ltrim(config('modules.paths.generator.component-class.path'), config('modules.paths.app_folder', '')));
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
}
/**
* Get the services provided by the provider.
*
* @return array<string>
*/
public function provides(): array
{
return [];
}
/**
* @return array<string>
*/
private function getPublishableViewPaths(): array
{
$paths = [];
foreach (config('view.paths') as $path) {
if (is_dir($path.'/modules/'.$this->moduleNameLower)) {
$paths[] = $path.'/modules/'.$this->moduleNameLower;
}
}
return $paths;
}
}

View File

View File

@ -0,0 +1,15 @@
<?php
namespace Modules\Stock\Repositories;
interface StockInterface
{
public function findAll();
public function getStockById($StockId);
public function getStockByEmail($email);
public function delete($StockId);
public function create($StockDetails);
public function update($StockId, array $newDetails);
public function pluck();
}

View File

@ -0,0 +1,15 @@
<?php
namespace Modules\Stock\Repositories;
interface StockLocationInterface
{
public function findAll();
public function getStockLocationById($StockLocationId);
public function getStockLocationByEmail($email);
public function delete($StockLocationId);
public function create($StockLocationDetails);
public function update($StockLocationId, array $newDetails);
public function pluck();
}

View File

@ -0,0 +1,46 @@
<?php
namespace Modules\Stock\Repositories;
use Modules\Stock\Models\StockLocation;
class StockLocationRepository implements StockLocationInterface
{
public function findAll()
{
return StockLocation::when(true, function ($query) {
})->paginate(20);
}
public function getStockLocationById($StockLocationId)
{
return StockLocation::findOrFail($StockLocationId);
}
public function getStockLocationByEmail($email)
{
return StockLocation::where('email', $email)->first();
}
public function delete($StockLocationId)
{
StockLocation::destroy($StockLocationId);
}
public function create($StockLocationDetails)
{
return StockLocation::create($StockLocationDetails);
}
public function update($StockLocationId, array $newDetails)
{
return StockLocation::whereId($StockLocationId)->update($newDetails);
}
public function pluck()
{
return StockLocation::pluck('title', 'id');
}
}

View File

@ -0,0 +1,46 @@
<?php
namespace Modules\Stock\Repositories;
use Modules\Stock\Models\Stock;
class StockRepository implements StockInterface
{
public function findAll()
{
return Stock::when(true, function ($query) {
})->paginate(20);
}
public function getStockById($StockId)
{
return Stock::findOrFail($StockId);
}
public function getStockByEmail($email)
{
return Stock::where('email', $email)->first();
}
public function delete($StockId)
{
Stock::destroy($StockId);
}
public function create($StockDetails)
{
return Stock::create($StockDetails);
}
public function update($StockId, array $newDetails)
{
return Stock::whereId($StockId)->update($newDetails);
}
public function pluck()
{
return Stock::pluck('title', 'id');
}
}

View File

@ -0,0 +1,30 @@
{
"name": "nwidart/stock",
"description": "",
"authors": [
{
"name": "Nicolas Widart",
"email": "n.widart@gmail.com"
}
],
"extra": {
"laravel": {
"providers": [],
"aliases": {
}
}
},
"autoload": {
"psr-4": {
"Modules\\Stock\\": "app/",
"Modules\\Stock\\Database\\Factories\\": "database/factories/",
"Modules\\Stock\\Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Modules\\Stock\\Tests\\": "tests/"
}
}
}

View File

View File

@ -0,0 +1,5 @@
<?php
return [
'name' => 'Stock',
];

View File

View File

@ -0,0 +1,16 @@
<?php
namespace Modules\Stock\Database\Seeders;
use Illuminate\Database\Seeder;
class StockDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// $this->call([]);
}
}

11
Modules/Stock/module.json Normal file
View File

@ -0,0 +1,11 @@
{
"name": "Stock",
"alias": "stock",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\Stock\\Providers\\StockServiceProvider"
],
"files": []
}

View 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"
}
}

View File

View File

View File

View File

@ -0,0 +1,19 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
@include('layouts.partials.breadcrumb', ['title' => $title])
{{ html()->form('POST')->route('stock.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
@include('stock::stock.partials.action')
{{ html()->form()->close() }}
</div>
</div>
@endsection
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

@ -0,0 +1,23 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
<!-- start page title -->
@include('layouts.partials.breadcrumb', ['title' => $title])
<!-- end page title -->
{{ html()->modelForm($stock, 'PUT')->route('stock.update', $stock->id)->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
@include('stock::stock.partials.action')
{{ html()->closeModelForm() }}
</div>
<!-- container-fluid -->
</div>
@endsection
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

@ -0,0 +1,83 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
@include('layouts.partials.breadcrumb', ['title' => $title])
<div class="mb-2 text-end">
@can('stock.create')
<a href="{{ route('stock.create') }}" class="btn btn-success btn-md waves-effect waves-light"><i
class="ri-add-fill me-1 align-bottom"></i> Add</a>
@endcan
</div>
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<div class="table-responsive">
<table id="buttons-datatables" class="display table-sm table-bordered table" style="width:100%">
<thead>
<tr>
<th>S.N</th>
<th>Stock Location</th>
<th>Product</th>
<th>Product Code</th>
<th>S</th>
<th>M</th>
<th>L</th>
<th>XL</th>
<th>XXL</th>
<th>XXXL</th>
<th>FS</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@forelse ($stocks as $key => $stock)
<tr>
<td>{{ $key + 1 }}</td>
<td>{{ ($stock->stockLocation)->title }}</td>
<td>{{ ($stock->product)->name }}</td>
<td>{{ ($stock->product)->code }}</td>
<td>{{ $stock->s }}</td>
<td>{{ $stock->m }}</td>
<td>{{ $stock->l }}</td>
<td>{{ $stock->xl }}</td>
<td>{{ $stock->xxl }}</td>
<td>{{ $stock->xxxl }}</td>
<td>{{ $stock->fs }}</td>
<td>
<div class="hstack flex-wrap gap-3">
@can('stock.show')
<a href="{{ route('stock.show', $stock->id) }}" class="link-info fs-15">
<i class="ri-eye-line"></i>
</a>
@endcan
@can('stock.edit')
<a href="{{ route('stock.edit', $stock->id) }}"
class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-line"></i></a>
@endcan
@can('stock.destroy')
<a href="javascript:void(0);" data-link="{{ route('stock.destroy', $stock->id) }}"
data-id="{{ $stock->id }}" class="link-danger fs-15 remove-item-btn"><i
class="ri-delete-bin-line"></i></a>
@endcan
</div>
</td>
</tr>
@empty
@endforelse
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!--end row-->
</div>
</div>
@endsection

View File

@ -0,0 +1,83 @@
<div class="row">
<div class="col-lg-9">
<div class="card">
<div class="card-body">
<div class="row gy-1">
<div class="col-md-6">
{{ html()->label('Title')->class('form-label') }}
{{ html()->text('title')->class('form-control')->placeholder('Enter Title')->required() }}
</div>
<div class="col-md-6">
{{ html()->label('Stock Location')->class('form-label') }}
{{ html()->select('stocklocation_id', $stockLocation)->class('form-select select2')->placeholder('Select Stock Location')->id('stockLocation_id')->required() }}
</div>
<div class="col-md-6">
{{ html()->label('Product')->class('form-label') }}
{{ html()->select('product_id', $product)->class('form-select select2')->placeholder('Select Product')->id('product_id')->required() }}
</div>
<div class="col-md-6">
{{ html()->label('S')->class('form-label') }}
{{ html()->text('s')->class('form-control')->placeholder('Enter S') }}
</div>
<div class="col-md-6">
{{ html()->label('M')->class('form-label') }}
{{ html()->text('m')->class('form-control')->placeholder('Enter M') }}
</div>
<div class="col-md-6">
{{ html()->label('L')->class('form-label') }}
{{ html()->text('l')->class('form-control')->placeholder('Enter L') }}
</div>
<div class="col-md-6">
{{ html()->label('xl')->class('form-label') }}
{{ html()->text('xl')->class('form-control')->placeholder('Enter xl') }}
</div>
<div class="col-md-6">
{{ html()->label('xxl')->class('form-label') }}
{{ html()->text('xxl')->class('form-control')->placeholder('Enter xxl') }}
</div>
<div class="col-md-6">
{{ html()->label('xxxl')->class('form-label') }}
{{ html()->text('xxxl')->class('form-control')->placeholder('Enter xxxl') }}
</div>
<div class="col-md-6">
{{ html()->label('fs')->class('form-label') }}
{{ html()->text('fs')->class('form-control')->placeholder('Enter fs') }}
</div>
</div>
<!-- end card -->
</div>
<!-- end card -->
</div>
<div class="mb-3 text-end">
<a href="{{ route('stock.index') }}" class="btn btn-danger w-sm">Cancel</a>
<button type="submit" class="btn btn-success w-sm">Save</button>
</div>
</div>
<!-- end col -->
<div class="col-lg-3">
<div class="card">
<div class="card-header">
<h5 class="card-title mb-0">Publish</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-12">
{{ html()->label('Status')->class('form-label') }}
{{ html()->select('status', $status)->class('form-control')->placeholder('Select Status')->required() }}
</div>
</div>
<!-- end card -->
</div>
<!-- end col -->
</div>

View File

@ -0,0 +1,82 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
@include('layouts.partials.breadcrumb', ['title' => $title])
<div class="row">
<div class="col-md-8">
<div class="card card-body p-4">
<div>
<div class="table-responsive">
<table class="table-borderless mb-0 table">
<tbody>
<tr>
<th><span class="fw-medium">Stock Name</span></th>
<td>{{ $stock->title }}</td>
</tr>
<tr>
<th><span class="fw-medium">Stock Location</span></th>
<td>{{ ($stock->stockLocation)->title }}</td>
</tr>
<tr>
<th><span class="fw-medium">Product</span></th>
<td>{{ ($stock->product)->title }}</td>
</tr>
<tr>
<th><span class="fw-medium">Product Code</span></th>
<td>{{ ($stock->product)->code }}</td>
</tr>
<tr>
<th><span class="fw-medium">S</span></th>
<td>{{ $stock->s }}</td>
</tr>
<tr>
<th><span class="fw-medium">M</span></th>
<td>{{ $stock->m }}</td>
</tr>
<tr>
<th><span class="fw-medium">L</span></th>
<td>{{ $stock->l }}</td>
</tr>
<tr>
<th><span class="fw-medium">XL</span></th>
<td>{{ $stock->xl }}</td>
</tr>
<tr>
<th><span class="fw-medium">XXL</span></th>
<td>{{ $stock->xxl }}</td>
</tr>
<tr>
<th><span class="fw-medium">XXXL</span></th>
<td>{{ $stock->xxxl }}</td>
</tr>
<tr>
<th><span class="fw-medium">FS</span></th>
<td>{{ $stock->fs }}</td>
</tr>
<tr>
<th><span class="fw-medium">Status</span></th>
<td>{{ $stock->status }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="mb-3 text-end">
<a href="{{ route('stock.index') }}" class="btn btn-secondary w-sm">Back</a>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

@ -0,0 +1,16 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
@include('layouts.partials.breadcrumb', ['title' => $title])
{{ html()->form('POST')->route('stockLocation.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
@include('stock::stocklocation.partials.action')
{{ html()->form()->close() }}
</div>
</div>
@endsection
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

@ -0,0 +1,23 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
<!-- start page title -->
@include('layouts.partials.breadcrumb', ['title' => $title])
<!-- end page title -->
{{ html()->modelForm($stockLocation, 'PUT')->route('stockLocation.update', $stockLocation->id)->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
@include('stock::stockLocation.partials.action')
{{ html()->closeModelForm() }}
</div>
<!-- container-fluid -->
</div>
@endsection
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

@ -0,0 +1,70 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
@include('layouts.partials.breadcrumb', ['title' => $title])
<div class="mb-2 text-end">
@can('stockLocation.create')
<a href="{{ route('stockLocation.create') }}" class="btn btn-success btn-md waves-effect waves-light"><i
class="ri-add-fill me-1 align-bottom"></i> Add</a>
@endcan
</div>
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<div class="table-responsive">
<table id="buttons-datatables" class="display table-sm table-bordered table" style="width:100%">
<thead>
<tr>
<th>S.N</th>
<th>Title</th>
<th>Slug</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@forelse ($stockLocations as $key => $stockLocation)
<tr>
<td>{{ $key + 1 }}</td>
<td>{{ $stockLocation->title }}</td>
<td>{{ $stockLocation->slug }}</td>
<td>{!! $stockLocation->status_name !!}</td>
<td>
<div class="hstack flex-wrap gap-3">
@can('stockLocation.show')
<a href="{{ route('stockLocation.show', $stockLocation->id) }}" class="link-info fs-15">
<i class="ri-eye-line"></i>
</a>
@endcan
@can('stockLocation.edit')
<a href="{{ route('stockLocation.edit', $stockLocation->id) }}"
class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-line"></i></a>
@endcan
@can('stockLocation.destroy')
<a href="javascript:void(0);"
data-link="{{ route('stockLocation.destroy', $stockLocation->id) }}"
data-id="{{ $stockLocation->id }}" class="link-danger fs-15 remove-item-btn"><i
class="ri-delete-bin-line"></i></a>
@endcan
</div>
</td>
</tr>
@empty
@endforelse
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!--end row-->
</div>
</div>
@endsection

View File

@ -0,0 +1,54 @@
<div class="row">
<div class="col-lg-8">
<div class="card">
<div class="card-body">
<div class="row gy-1">
<div class="col-md-12">
{{ html()->label('Title')->class('form-label') }}
{{ html()->text('title')->class('form-control')->placeholder('Enter Title')->required() }}
</div>
<div class="col-md-12">
{{ html()->label('Description')->class('form-label') }}
{{ html()->text('description')->class('form-control')->placeholder('Enter Description') }}
</div>
<div class="col-md-12">
{{ html()->label('Remarks')->class('form-label') }}
{{ html()->text('remarks')->class('form-control')->placeholder('Enter Remarks') }}
</div>
</div>
</div>
</div>
<!-- end card -->
<div class="mb-3 text-end">
<a href="{{ route('stockLocation.index') }}" class="btn btn-danger w-sm">Cancel</a>
<button type="submit" class="btn btn-success w-sm">Save</button>
</div>
</div>
<!-- end col -->
<div class="col-lg-4">
<div class="card">
<div class="card-header">
<h5 class="card-title mb-0">Publish</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-12">
{{ html()->label('Status')->class('form-label') }}
{{-- {{ html()->select('status', '11')->class('form-control')->placeholder('Select Status') }}
--}}
{{ html()->select('status', $status)->class('form-control')->placeholder('Select Status')->required() }}
</div>
</div>
</div>
<!-- end card body -->
</div>
<!-- end card -->
</div>
</div>

View File

@ -0,0 +1,45 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
@include('layouts.partials.breadcrumb', ['title' => $title])
<div class="row">
<div class="col-md-8">
<div class="card card-body p-4">
<div>
<div class="table-responsive">
<table class="table-borderless mb-0 table">
<tbody>
<tr>
<th><span class="fw-medium">Title</span></th>
<td>{{ $stockLocation->title }}</td>
</tr>
<tr>
<th><span class="fw-medium">Description</span></th>
<td>{{ $stockLocation->description }}</td>
</tr>
<tr>
<th><span class="fw-medium">Remarks</span></th>
<td>{{ $stockLocation->remarks }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="mb-3 text-end">
<a href="{{ route('stockLocation.index') }}" class="btn btn-secondary w-sm">Back</a>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

@ -0,0 +1,7 @@
@extends('stock::layouts.master')
@section('content')
<h1>Hello World</h1>
<p>Module: {!! config('stock.name') !!}</p>
@endsection

View 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>Stock 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-stock', 'resources/assets/sass/app.scss') }} --}}
</head>
<body>
@yield('content')
{{-- Vite JS --}}
{{-- {{ module_vite('build-stock', 'resources/assets/js/app.js') }} --}}
</body>

View File

View File

@ -0,0 +1,19 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Stock\Http\Controllers\StockController;
/*
*--------------------------------------------------------------------------
* 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('stock', StockController::class)->names('stock');
});

View File

@ -0,0 +1,23 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Stock\Http\Controllers\StockController;
use Modules\Stock\Http\Controllers\StockLocationController;
/*
|--------------------------------------------------------------------------
| 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('stock', StockController::class)->names('stock');
Route::resource('stockLocation', StockLocationController::class)->names('stockLocation');
});

View File

@ -0,0 +1,26 @@
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
build: {
outDir: '../../public/build-stock',
emptyOutDir: true,
manifest: true,
},
plugins: [
laravel({
publicDirectory: '../../public',
buildDirectory: 'build-stock',
input: [
__dirname + '/resources/assets/sass/app.scss',
__dirname + '/resources/assets/js/app.js'
],
refresh: true,
}),
],
});
//export const paths = [
// 'Modules/Stock/resources/assets/sass/app.scss',
// 'Modules/Stock/resources/assets/js/app.js',
//];