Merge branch 'main' of http://bibgit.com/dharmaraj/New-OMIS into omis_dharma
This commit is contained in:
commit
c7c79e69a5
@ -33,8 +33,7 @@ class LeaveController extends Controller
|
||||
{
|
||||
$data['leaves'] = $this->leaveRepository->findAll();
|
||||
$data['employeeList'] = $this->employeeRepository->pluck();
|
||||
|
||||
return view('leave::index', $data);
|
||||
return view('leave::leave.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -44,7 +43,7 @@ class LeaveController extends Controller
|
||||
{
|
||||
$data['title'] = 'Create Leave';
|
||||
$data['employeeList'] = $this->employeeRepository->pluck();
|
||||
return view('leave::create', $data);
|
||||
return view('leave::leave.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,7 +66,7 @@ class LeaveController extends Controller
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('leave::show');
|
||||
return view('leave::leave.show');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,7 +78,7 @@ class LeaveController extends Controller
|
||||
|
||||
$data['leave'] = $this->leaveRepository->getLeaveById($id);
|
||||
|
||||
return view('leave::edit', $data);
|
||||
return view('leave::leave.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
80
Modules/Leave/app/Http/Controllers/LeaveTypeController.php
Normal file
80
Modules/Leave/app/Http/Controllers/LeaveTypeController.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Leave\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Leave\Repositories\LeaveInterface;
|
||||
use Modules\Leave\Repositories\LeaveTypeInterface;
|
||||
|
||||
class LeaveTypeController extends Controller
|
||||
{
|
||||
|
||||
private $leaveRepository;
|
||||
private $leaveTypeRepository;
|
||||
|
||||
public function __construct(LeaveInterface $leaveRepository, LeaveTypeInterface $leaveTypeRepository)
|
||||
{
|
||||
$this->leaveRepository = $leaveRepository;
|
||||
$this->leaveTypeRepository = $leaveTypeRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['leaveTypes'] = $this->leaveTypeRepository->findAll();
|
||||
return view('leave::leave-type.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Leave Type';
|
||||
|
||||
return view('leave::leave-type.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('leave::leave-type.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('leave::leave-type.edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
26
Modules/Leave/app/Http/Requests/LeaveTypeRequest.php
Normal file
26
Modules/Leave/app/Http/Requests/LeaveTypeRequest.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Leave\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class LeaveTypeRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Leave extends Model
|
||||
{
|
||||
protected $table = 'leaves';
|
||||
protected $table = 'tbl_leaves';
|
||||
protected $primaryKey = 'leave_id';
|
||||
protected $guarded = [];
|
||||
|
||||
|
22
Modules/Leave/app/Models/LeaveType.php
Normal file
22
Modules/Leave/app/Models/LeaveType.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Leave\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Leave\Database\factories\LeaveTypeFactory;
|
||||
|
||||
class LeaveType extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [];
|
||||
|
||||
protected static function newFactory(): LeaveTypeFactory
|
||||
{
|
||||
//return LeaveTypeFactory::new();
|
||||
}
|
||||
}
|
@ -6,7 +6,8 @@ use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Leave\Repositories\LeaveInterface;
|
||||
use Modules\Leave\Repositories\LeaveRepository;
|
||||
|
||||
use Modules\Leave\Repositories\LeaveTypeInterface;
|
||||
use Modules\Leave\Repositories\LeaveTypeRepository;
|
||||
|
||||
class LeaveServiceProvider extends ServiceProvider
|
||||
{
|
||||
@ -33,6 +34,8 @@ class LeaveServiceProvider extends ServiceProvider
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->bind(LeaveInterface::class, LeaveRepository::class);
|
||||
$this->app->bind(LeaveTypeInterface::class, LeaveTypeRepository::class);
|
||||
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
|
12
Modules/Leave/app/Repositories/LeaveTypeInterface.php
Normal file
12
Modules/Leave/app/Repositories/LeaveTypeInterface.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Leave\Repositories;
|
||||
|
||||
interface LeaveTypeInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getLeaveById($leaveId);
|
||||
public function delete($leaveId);
|
||||
public function create(array $LeaveDetails);
|
||||
public function update($leaveId, array $newDetails);
|
||||
}
|
34
Modules/Leave/app/Repositories/LeaveTypeRepository.php
Normal file
34
Modules/Leave/app/Repositories/LeaveTypeRepository.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Leave\Repositories;
|
||||
|
||||
use Modules\Leave\Models\LeaveType;
|
||||
|
||||
class LeaveTypeRepository implements LeaveTypeInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return LeaveType::get();
|
||||
}
|
||||
|
||||
public function getLeaveById($leaveId)
|
||||
{
|
||||
return LeaveType::findOrFail($leaveId);
|
||||
}
|
||||
|
||||
public function delete($leaveId)
|
||||
{
|
||||
LeaveType::destroy($leaveId);
|
||||
}
|
||||
|
||||
public function create(array $leaveDetails)
|
||||
{
|
||||
return LeaveType::create($leaveDetails);
|
||||
}
|
||||
|
||||
public function update($leaveId, array $newDetails)
|
||||
{
|
||||
return LeaveType::where('leave_id', $leaveId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
@ -11,11 +11,12 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('leaves', function (Blueprint $table) {
|
||||
Schema::create('tbl_leaves', function (Blueprint $table) {
|
||||
$table->tinyInteger('leave_id')->unsigned()->autoIncrement();
|
||||
$table->integer('employee_id');
|
||||
$table->date('start_date');
|
||||
$table->date('end_date');
|
||||
$table->unsignedBigInteger('employee_id');
|
||||
$table->unsignedBigInteger('leave_type_id');
|
||||
$table->date('start_date')->nullable();
|
||||
$table->date('end_date')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
@ -25,6 +26,6 @@ return new class extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('leaves');
|
||||
Schema::dropIfExists('tbl_leaves');
|
||||
}
|
||||
};
|
||||
|
@ -0,0 +1,31 @@
|
||||
<?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_leave_types', function (Blueprint $table) {
|
||||
$table->tinyInteger('leave_type_id')->unsigned()->autoIncrement();
|
||||
$table->string('title');
|
||||
$table->integer('status')->default(11);
|
||||
$table->integer('createdBy')->nullable();
|
||||
$table->integer('updatedBy')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tbl_leave_types');
|
||||
}
|
||||
};
|
30
Modules/Leave/resources/views/leave-type/create.blade.php
Normal file
30
Modules/Leave/resources/views/leave-type/create.blade.php
Normal file
@ -0,0 +1,30 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
<!-- end page title -->
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form action="{{ route('leaveType.store') }}" class="needs-validation" novalidate method="post">
|
||||
@csrf
|
||||
@include('leave::leave.partials.action')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end row-->
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
@ -27,7 +27,7 @@
|
||||
|
||||
{{ html()->modelForm($leave, 'PUT')->route('leave.update', $leave->id)->class(['needs-validation'])->attributes(['novalidate'])->open() }}
|
||||
|
||||
@include('leave::partials.action')
|
||||
@include('leave::leave.partials.action')
|
||||
|
||||
{{ html()->closeModelForm() }}
|
||||
|
68
Modules/Leave/resources/views/leave-type/index.blade.php
Normal file
68
Modules/Leave/resources/views/leave-type/index.blade.php
Normal file
@ -0,0 +1,68 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header align-items-center d-flex">
|
||||
<h5 class="card-title flex-grow-1 mb-0">Leave Lists</h5>
|
||||
<div class="flex-shrink-0">
|
||||
<a href="{{ route('leaveType.create') }}" class="btn btn-success waves-effect waves-light"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Add</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="buttons-datatables" class="display table-sm table-bordered table" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>S.N</th>
|
||||
<th>Leave Type</th>
|
||||
<th>Created By</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($leaveTypes as $key => $leaveType)
|
||||
<tr>
|
||||
<td>{{ $key + 1 }}</td>
|
||||
<td>{{ $leaveType->employee_id }}</td>
|
||||
<td>{{ $leaveType->start_date }}</td>
|
||||
<td>{{ $leaveType->end_date }}</td>
|
||||
<td>{{ $leaveType->created_at }}</td>
|
||||
<td>
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
<a href="javascript:void(0);" class="link-info fs-15 view-item-btn" data-bs-toggle="modal"
|
||||
data-bs-target="#viewModal">
|
||||
<i class="ri-eye-line"></i>
|
||||
</a>
|
||||
<a href="{{ route('leaveType.edit', $leaveType->leaveType_id) }}"
|
||||
class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-line"></i></a>
|
||||
|
||||
<a href="javascript:void(0);"
|
||||
data-link="{{ route('leaveType.destroy', $leaveType->leaveType_id) }}"
|
||||
data-id="{{ $leaveType->leave_id }}" class="link-danger fs-15 remove-item-btn"><i
|
||||
class="ri-delete-bin-line"></i></a>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end row-->
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@ -8,7 +8,7 @@
|
||||
<div class="modal-body">
|
||||
<form action="{{ route('leave.store') }}" class="needs-validation" novalidate method="post">
|
||||
@csrf
|
||||
@include('leave::partials.action')
|
||||
@include('leave::leave.partials.action')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
@ -12,7 +12,7 @@
|
||||
<div class="card-body">
|
||||
<form action="{{ route('leave.store') }}" class="needs-validation" novalidate method="post">
|
||||
@csrf
|
||||
@include('leave::partials.action')
|
||||
@include('leave::leave.partials.action')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
47
Modules/Leave/resources/views/leave/edit.blade.php
Normal file
47
Modules/Leave/resources/views/leave/edit.blade.php
Normal file
@ -0,0 +1,47 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
|
||||
<h4 class="mb-sm-0">{{ $title }}</h4>
|
||||
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
|
||||
<li class="breadcrumb-item active">{{ $title }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
{{ html()->modelForm($leave, 'PUT')->route('leave.update', $leave->id)->class(['needs-validation'])->attributes(['novalidate'])->open() }}
|
||||
|
||||
@include('leave::leave.partials.action')
|
||||
|
||||
{{ html()->closeModelForm() }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end row-->
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
@ -104,5 +104,5 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
@include('leave::partials.view')
|
||||
@include('leave::leave.partials.view')
|
||||
@endsection
|
@ -0,0 +1,24 @@
|
||||
<div class="mb-3">
|
||||
|
||||
<label for="employee_id" class="form-label">Title</label>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="start_date" class="form-label">Start Leave Date</label>
|
||||
<input type="date" class="form-control" id="start_date" name="start_date"
|
||||
value="{{ old('start_date', $leave->start_date ?? '') }}">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="end_date" class="form-label">End Leave Date</label>
|
||||
<input type="date" class="form-control" id="end_date" name="end_date"
|
||||
value="{{ old('end_date', $leave->end_date ?? '') }}">
|
||||
</div>
|
||||
|
||||
<div class="text-end">
|
||||
<button type="submit" class="btn btn-primary">{{ isset($leave) ? 'Update' : 'Add Leave' }}</button>
|
||||
</div>
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
16
Modules/Leave/resources/views/leave/partials/view.blade.php
Normal file
16
Modules/Leave/resources/views/leave/partials/view.blade.php
Normal file
@ -0,0 +1,16 @@
|
||||
<div class="modal fade" id="viewModal" tabindex="-1" aria-labelledby="viewModalLabel" aria-modal="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalgridLabel">View Leave</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="{{ route('leave.store') }}" class="needs-validation" novalidate method="post">
|
||||
@csrf
|
||||
@include('leave::leave.partials.action')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
0
Modules/Leave/resources/views/leave/show.blade.php
Normal file
0
Modules/Leave/resources/views/leave/show.blade.php
Normal file
@ -2,6 +2,7 @@
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Leave\Http\Controllers\LeaveController;
|
||||
use Modules\Leave\Http\Controllers\LeaveTypeController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@ -16,4 +17,6 @@ use Modules\Leave\Http\Controllers\LeaveController;
|
||||
|
||||
Route::group([], function () {
|
||||
Route::resource('leave', LeaveController::class)->names('leave');
|
||||
Route::resource('leave-type', LeaveTypeController::class)->names('leaveType');
|
||||
|
||||
});
|
||||
|
@ -86,9 +86,24 @@
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link @if (\Request::is('leave') || \Request::is('leave/*')) active @endif" href="{{ route('leave.index') }}">
|
||||
<i class="ri-honour-line"></i> <span data-key="t-widgets">Leave</span>
|
||||
<a class="nav-link menu-link" href="#leave" data-bs-toggle="collapse" role="button" aria-expanded="false"
|
||||
aria-controls="leave">
|
||||
<i class="ri-shopping-cart-2-line"></i> <span data-key="t-vendors">Leave</span>
|
||||
</a>
|
||||
<div class="menu-dropdown collapse" id="leave">
|
||||
<ul class="nav nav-sm flex-column">
|
||||
|
||||
<li class="nav-item">
|
||||
<a href="{{ route('leave.index') }}"
|
||||
class="nav-link @if (\Request::is('leave') || \Request::is('leave/*')) active @endif">Apply</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a href="{{ route('leaveType.index') }}"
|
||||
class="nav-link @if (\Request::is('leave-type') || \Request::is('leave-type/*')) active @endif">Leave Type</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
|
Loading…
Reference in New Issue
Block a user