first commit
This commit is contained in:
0
Modules/Supplier/app/Http/Controllers/.gitkeep
Normal file
0
Modules/Supplier/app/Http/Controllers/.gitkeep
Normal file
138
Modules/Supplier/app/Http/Controllers/SupplierController.php
Normal file
138
Modules/Supplier/app/Http/Controllers/SupplierController.php
Normal file
@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Supplier\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Admin\Repositories\FieldInterface;
|
||||
use Modules\Admin\Services\AdminService;
|
||||
use Modules\Supplier\Repositories\SupplierInterface;
|
||||
use Modules\User\Repositories\UserInterface;
|
||||
|
||||
class SupplierController extends Controller
|
||||
{
|
||||
private $userRepository;
|
||||
private $supplierRepository;
|
||||
private $adminService;
|
||||
private $fieldRepository;
|
||||
|
||||
public function __construct(
|
||||
FieldInterface $fieldRepository,
|
||||
UserInterface $userRepository,
|
||||
AdminService $adminService,
|
||||
SupplierInterface $supplierRepository) {
|
||||
$this->userRepository = $userRepository;
|
||||
$this->adminService = $adminService;
|
||||
$this->fieldRepository = $fieldRepository;
|
||||
$this->supplierRepository = $supplierRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = 'Supplier List';
|
||||
$data['suppliers'] = $this->supplierRepository->findAll();
|
||||
|
||||
return view('supplier::supplier.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Supplier';
|
||||
$data['nationalityList'] = $this->fieldRepository->getDropdownByAlias('nationality');
|
||||
return view('supplier::supplier.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$inputData = $request->all();
|
||||
try {
|
||||
|
||||
if ($request->hasFile('profile_picture')) {
|
||||
$inputData['profile_picture'] = uploadImage($request->profile_picture);
|
||||
}
|
||||
$this->supplierRepository->create($inputData);
|
||||
|
||||
sendNotification(auth()->user(), [
|
||||
'msg' => 'Supplier Created',
|
||||
]);
|
||||
|
||||
toastr()->success('supplier Created Succesfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
echo $th->getMessage();
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('supplier.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$data['title'] = 'Show Suppliers';
|
||||
$data['supplier'] = $this->supplierRepository->getSupplierById($id);
|
||||
return view('supplier::supplier.show', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Supplier';
|
||||
$data['supplier'] = $this->supplierRepository->getSupplierById($id);
|
||||
$data['nationalityList'] = $this->fieldRepository->getDropdownByAlias('nationality');
|
||||
return view('supplier::supplier.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$inputData = $request->except(['_method', '_token']);
|
||||
try {
|
||||
if ($request->hasFile('profile_picture')) {
|
||||
$inputData['profile_picture'] = uploadImage($request->profile_picture);
|
||||
}
|
||||
$this->supplierRepository->update($id, $inputData);
|
||||
|
||||
sendNotification(auth()->user(), [
|
||||
'msg' => 'supplier Updated',
|
||||
]);
|
||||
|
||||
toastr()->success('supplier Updated Succesfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('supplier.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$CustomerModel = $this->supplierRepository->getSupplierById($id);
|
||||
$CustomerModel->delete();
|
||||
|
||||
toastr()->success('Supplier Delete Succesfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['status' => true, 'message' => 'supplier Delete Succesfully']);
|
||||
|
||||
}
|
||||
}
|
0
Modules/Supplier/app/Http/Requests/.gitkeep
Normal file
0
Modules/Supplier/app/Http/Requests/.gitkeep
Normal file
0
Modules/Supplier/app/Models/.gitkeep
Normal file
0
Modules/Supplier/app/Models/.gitkeep
Normal file
11
Modules/Supplier/app/Models/Supplier.php
Normal file
11
Modules/Supplier/app/Models/Supplier.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Supplier\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Supplier extends Model
|
||||
{
|
||||
protected $table = 'tbl_suppliers';
|
||||
protected $guarded = [];
|
||||
}
|
0
Modules/Supplier/app/Observers/.gitkeep
Normal file
0
Modules/Supplier/app/Observers/.gitkeep
Normal file
0
Modules/Supplier/app/Providers/.gitkeep
Normal file
0
Modules/Supplier/app/Providers/.gitkeep
Normal file
49
Modules/Supplier/app/Providers/RouteServiceProvider.php
Normal file
49
Modules/Supplier/app/Providers/RouteServiceProvider.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Supplier\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('Supplier', '/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('Supplier', '/routes/api.php'));
|
||||
}
|
||||
}
|
117
Modules/Supplier/app/Providers/SupplierServiceProvider.php
Normal file
117
Modules/Supplier/app/Providers/SupplierServiceProvider.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Supplier\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Supplier\Repositories\SupplierInterface;
|
||||
use Modules\Supplier\Repositories\SupplierRepository;
|
||||
|
||||
class SupplierServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'Supplier';
|
||||
|
||||
protected string $moduleNameLower = 'supplier';
|
||||
|
||||
/**
|
||||
* 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->bind(SupplierInterface::class, SupplierRepository::class);
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register commands in the format of Command::class
|
||||
*/
|
||||
protected function registerCommands(): void
|
||||
{
|
||||
// $this->commands([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register command Schedules.
|
||||
*/
|
||||
protected function registerCommandSchedules(): void
|
||||
{
|
||||
// $this->app->booted(function () {
|
||||
// $schedule = $this->app->make(Schedule::class);
|
||||
// $schedule->command('inspire')->hourly();
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*/
|
||||
public function registerTranslations(): void
|
||||
{
|
||||
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom($langPath);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*/
|
||||
protected function registerConfig(): void
|
||||
{
|
||||
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower . '.php')], 'config');
|
||||
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*/
|
||||
public function registerViews(): void
|
||||
{
|
||||
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
|
||||
$sourcePath = module_path($this->moduleName, 'resources/views');
|
||||
|
||||
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower . '-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
|
||||
$componentNamespace = str_replace('/', '\\', config('modules.namespace') . '\\' . $this->moduleName . '\\' . ltrim(config('modules.paths.generator.component-class.path'), config('modules.paths.app_folder', '')));
|
||||
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*/
|
||||
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/Supplier/app/Repositories/.gitkeep
Normal file
0
Modules/Supplier/app/Repositories/.gitkeep
Normal file
15
Modules/Supplier/app/Repositories/SupplierInterface.php
Normal file
15
Modules/Supplier/app/Repositories/SupplierInterface.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Supplier\Repositories;
|
||||
|
||||
interface SupplierInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getSupplierById($SupplierId);
|
||||
public function getSupplierByEmail($email);
|
||||
public function delete($SupplierId);
|
||||
public function create($SupplierDetails);
|
||||
public function update($SupplierId, array $newDetails);
|
||||
public function pluck();
|
||||
|
||||
}
|
49
Modules/Supplier/app/Repositories/SupplierRepository.php
Normal file
49
Modules/Supplier/app/Repositories/SupplierRepository.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Supplier\Repositories;
|
||||
|
||||
use Modules\Supplier\Models\Supplier;
|
||||
|
||||
class SupplierRepository implements SupplierInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Supplier::when(true, function ($query) {
|
||||
// if (auth()->user()->hasRole('Supplier')) {
|
||||
// $user = \Auth::user();
|
||||
// $query->where('id', $user->Supplier_id);
|
||||
// }
|
||||
})->paginate(20);
|
||||
}
|
||||
|
||||
public function getSupplierById($SupplierId)
|
||||
{
|
||||
return Supplier::findOrFail($SupplierId);
|
||||
}
|
||||
|
||||
public function getSupplierByEmail($email)
|
||||
{
|
||||
return Supplier::where('email', $email)->first();
|
||||
}
|
||||
|
||||
public function delete($SupplierId)
|
||||
{
|
||||
Supplier::destroy($SupplierId);
|
||||
}
|
||||
|
||||
public function create($SupplierDetails)
|
||||
{
|
||||
return Supplier::create($SupplierDetails);
|
||||
}
|
||||
|
||||
public function update($SupplierId, array $newDetails)
|
||||
{
|
||||
return Supplier::whereId($SupplierId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck()
|
||||
{
|
||||
return Supplier::pluck('supplier_name', 'id');
|
||||
}
|
||||
|
||||
}
|
30
Modules/Supplier/composer.json
Normal file
30
Modules/Supplier/composer.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "nwidart/supplier",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Widart",
|
||||
"email": "n.widart@gmail.com"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Supplier\\": "app/",
|
||||
"Modules\\Supplier\\Database\\Factories\\": "database/factories/",
|
||||
"Modules\\Supplier\\Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Modules\\Supplier\\Tests\\": "tests/"
|
||||
}
|
||||
}
|
||||
}
|
0
Modules/Supplier/config/.gitkeep
Normal file
0
Modules/Supplier/config/.gitkeep
Normal file
5
Modules/Supplier/config/config.php
Normal file
5
Modules/Supplier/config/config.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Supplier',
|
||||
];
|
0
Modules/Supplier/database/factories/.gitkeep
Normal file
0
Modules/Supplier/database/factories/.gitkeep
Normal file
0
Modules/Supplier/database/migrations/.gitkeep
Normal file
0
Modules/Supplier/database/migrations/.gitkeep
Normal file
@ -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_suppliers', 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_suppliers');
|
||||
}
|
||||
};
|
0
Modules/Supplier/database/seeders/.gitkeep
Normal file
0
Modules/Supplier/database/seeders/.gitkeep
Normal file
16
Modules/Supplier/database/seeders/SupplierDatabaseSeeder.php
Normal file
16
Modules/Supplier/database/seeders/SupplierDatabaseSeeder.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Supplier\database\seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SupplierDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// $this->call([]);
|
||||
}
|
||||
}
|
11
Modules/Supplier/module.json
Normal file
11
Modules/Supplier/module.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Supplier",
|
||||
"alias": "supplier",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\Supplier\\Providers\\SupplierServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
15
Modules/Supplier/package.json
Normal file
15
Modules/Supplier/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/Supplier/resources/assets/.gitkeep
Normal file
0
Modules/Supplier/resources/assets/.gitkeep
Normal file
0
Modules/Supplier/resources/assets/js/app.js
Normal file
0
Modules/Supplier/resources/assets/js/app.js
Normal file
0
Modules/Supplier/resources/assets/sass/app.scss
Normal file
0
Modules/Supplier/resources/assets/sass/app.scss
Normal file
0
Modules/Supplier/resources/views/.gitkeep
Normal file
0
Modules/Supplier/resources/views/.gitkeep
Normal file
7
Modules/Supplier/resources/views/index.blade.php
Normal file
7
Modules/Supplier/resources/views/index.blade.php
Normal file
@ -0,0 +1,7 @@
|
||||
@extends('supplier::layouts.master')
|
||||
|
||||
@section('content')
|
||||
<h1>Hello World</h1>
|
||||
|
||||
<p>Module: {!! config('supplier.name') !!}</p>
|
||||
@endsection
|
29
Modules/Supplier/resources/views/layouts/master.blade.php
Normal file
29
Modules/Supplier/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>Supplier 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-supplier', 'resources/assets/sass/app.scss') }} --}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@yield('content')
|
||||
|
||||
{{-- Vite JS --}}
|
||||
{{-- {{ module_vite('build-supplier', 'resources/assets/js/app.js') }} --}}
|
||||
</body>
|
18
Modules/Supplier/resources/views/supplier/create.blade.php
Normal file
18
Modules/Supplier/resources/views/supplier/create.blade.php
Normal file
@ -0,0 +1,18 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
{{ html()->form('POST')->route('supplier.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
@include('supplier::supplier.partials.action')
|
||||
{{ html()->form()->close() }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
22
Modules/Supplier/resources/views/supplier/edit.blade.php
Normal file
22
Modules/Supplier/resources/views/supplier/edit.blade.php
Normal file
@ -0,0 +1,22 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
<!-- end page title -->
|
||||
|
||||
{{ html()->modelForm($supplier, 'PUT')->route('supplier.update', $supplier->id)->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
@include('supplier::supplier.partials.action')
|
||||
{{ html()->closeModelForm() }}
|
||||
<!--end row-->
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
73
Modules/Supplier/resources/views/supplier/index.blade.php
Normal file
73
Modules/Supplier/resources/views/supplier/index.blade.php
Normal file
@ -0,0 +1,73 @@
|
||||
@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('supplier.create')
|
||||
<a href="{{ route('supplier.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>supplier Name</th>
|
||||
<th>Email</th>
|
||||
<th>Contact</th>
|
||||
<th>Photo</th>
|
||||
<th>Address</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($suppliers as $key => $supplier)
|
||||
<tr>
|
||||
<td>{{ $key + 1 }}</td>
|
||||
<td>{{ $supplier->supplier_name }}</td>
|
||||
<td>{{ $supplier->email }}</td>
|
||||
<td>{{ $supplier->contact }}</td>
|
||||
<td>{{ $supplier->profile_picture}}</td>
|
||||
<td>{{ $supplier->permanent_address }}</td>
|
||||
<td>
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
@can('supplier.show')
|
||||
<a href="{{ route('supplier.show', $supplier->id) }}" class="link-info fs-15">
|
||||
<i class="ri-eye-line"></i>
|
||||
</a>
|
||||
@endcan
|
||||
@can('supplier.edit')
|
||||
<a href="{{ route('supplier.edit', $supplier->id) }}"
|
||||
class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-line"></i></a>
|
||||
@endcan
|
||||
@can('supplier.destroy')
|
||||
<a href="javascript:void(0);" data-link="{{ route('supplier.destroy', $supplier->id) }}"
|
||||
data-id="{{ $supplier->id }}" class="link-danger fs-15 remove-item-btn"><i
|
||||
class="ri-delete-bin-line"></i></a>
|
||||
@endcan
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end row-->
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@ -0,0 +1,67 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
{{-- <div class="card-header card-primary">
|
||||
<h4 class="card-title mb-0">Personal Details</h4>
|
||||
</div> --}}
|
||||
|
||||
<div class="card-body">
|
||||
<div class="row gy-2">
|
||||
<p class="text-primary">Personal Details</p>
|
||||
<hr>
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Supplier name')->class('form-label') }}
|
||||
{{ html()->text('supplier_name')->class('form-control')->placeholder('Enter supplier Name')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Nationality')->class('form-label') }}
|
||||
{{ html()->select('nationalities_id', $nationalityList)->class('form-select select2')->placeholder('Select Nationality') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Email')->class('form-label') }}
|
||||
{{ html()->email('email')->class('form-control')->placeholder('Enter Email')->required() }}
|
||||
{{ html()->div('Please enter email')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Phone Number')->class('form-label') }}
|
||||
{{ html()->text('contact')->class('form-control')->placeholder('Enter Phone Number') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Upload Profile Picture')->class('form-label') }}
|
||||
{{ html()->file('profile_picture')->class('form-control') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row gy-1 mt-1">
|
||||
<p class="text-primary">Address Details</p>
|
||||
<hr>
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Permanent Address')->class('form-label') }}
|
||||
{{ html()->text('permanent_address')->class('form-control')->placeholder('Enter Permanent Address') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row gy-1 mt-1">
|
||||
<p class="text-primary">Organization Details</p>
|
||||
<hr>
|
||||
|
||||
<div class="col-md-12">
|
||||
{{ html()->label('Remarks')->class('form-label') }}
|
||||
{{ html()->textarea('remarks')->class('form-control')->placeholder('Enter Remarks') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<div class="mb-4 text-end">
|
||||
<button type="submit" class="btn btn-success w-sm">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
57
Modules/Supplier/resources/views/supplier/show.blade.php
Normal file
57
Modules/Supplier/resources/views/supplier/show.blade.php
Normal file
@ -0,0 +1,57 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="card card-body p-4">
|
||||
<div>
|
||||
<div class="table-responsive">
|
||||
<table class="table-borderless mb-0 table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Supplier Name</span></th>
|
||||
<td>{{ $supplier->supplier_name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Nationality</span></th>
|
||||
<td>{{ $supplier->nationalities_id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Email</span></th>
|
||||
<td>{{ $supplier->email }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Contact</span></th>
|
||||
<td>{{ $supplier->contact }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Address</span></th>
|
||||
<td>{{ $supplier->permanent_address }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><span class="fw-medium">Profile Picture</span></th>
|
||||
<td>{{ $supplier->profile_picture }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 text-end">
|
||||
<a href="{{ route('supplier.index') }}" class="btn btn-secondary w-sm">Back</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
0
Modules/Supplier/routes/.gitkeep
Normal file
0
Modules/Supplier/routes/.gitkeep
Normal file
19
Modules/Supplier/routes/api.php
Normal file
19
Modules/Supplier/routes/api.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Supplier\Http\Controllers\SupplierController;
|
||||
|
||||
/*
|
||||
*--------------------------------------------------------------------------
|
||||
* 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('supplier', SupplierController::class)->names('supplier');
|
||||
});
|
19
Modules/Supplier/routes/web.php
Normal file
19
Modules/Supplier/routes/web.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Supplier\Http\Controllers\SupplierController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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('supplier', SupplierController::class)->names('supplier');
|
||||
});
|
26
Modules/Supplier/vite.config.js
Normal file
26
Modules/Supplier/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-supplier',
|
||||
emptyOutDir: true,
|
||||
manifest: true,
|
||||
},
|
||||
plugins: [
|
||||
laravel({
|
||||
publicDirectory: '../../public',
|
||||
buildDirectory: 'build-supplier',
|
||||
input: [
|
||||
__dirname + '/resources/assets/sass/app.scss',
|
||||
__dirname + '/resources/assets/js/app.js'
|
||||
],
|
||||
refresh: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
//export const paths = [
|
||||
// 'Modules/Supplier/resources/assets/sass/app.scss',
|
||||
// 'Modules/Supplier/resources/assets/js/app.js',
|
||||
//];
|
Reference in New Issue
Block a user