pms module status dynamic

This commit is contained in:
Ranjan 2024-04-16 16:59:18 +05:45
parent 3f0d9a420b
commit de082f8bca
39 changed files with 19827 additions and 30 deletions

View File

@ -110,8 +110,14 @@ class LeaveController extends Controller
*/
public function destroy($id)
{
$this->leaveRepository->delete($id);
try {
$this->leaveRepository->delete($id);
toastr()->success('Leave Deleted Succesfully');
} catch (\Throwable $th) {
//throw $th;
toastr()->error($th->getMessage());
}
toastr()->success('Leave Deleted Succesfully');
}
}

View File

@ -0,0 +1,110 @@
<?php
namespace Modules\PMS\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Modules\PMS\Models\Client;
use Modules\PMS\Repositories\ClientInterface;
class ClientController extends Controller
{
private $clientRepository;
public function __construct(ClientInterface $clientRepository)
{
$this->clientRepository = $clientRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Client List';
$data['clients'] = $this->clientRepository->findAll();
return view('pms::client.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Client';
$data['status'] = Client::STATUS;
$data['countryList'] = [1 => 'Nepal'];
return view('pms::client.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$inputData = $request->all();
try {
$this->clientRepository->create($inputData);
toastr()->success('Client Created Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('client.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
$data['title'] = 'View Client';
$data['client'] = $this->clientRepository->getClientById($id);
$data['status'] = Client::STATUS;
$data['countryList'] = [1 => 'Nepal'];
return view('pms::client.show', $data);
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Client';
$data['client'] = $this->clientRepository->getClientById($id);
$data['status'] = Client::STATUS;
$data['countryList'] = [1 => 'Nepal'];
return view('pms::client.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$inputData = $request->except(['_method', '_token']);
try {
$this->clientRepository->update($id, $inputData);
toastr()->success('Client Update Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('client.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->clientRepository->delete($id);
toastr()->success('Client Deleted Succesfully');
} catch (\Throwable $th) {
//throw $th;
toastr()->error($th->getMessage());
}
}
}

View File

@ -0,0 +1,123 @@
<?php
namespace Modules\PMS\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Modules\Employee\Repositories\EmployeeInterface;
use Modules\PMS\Models\Project;
use Modules\PMS\Repositories\ClientInterface;
use Modules\PMS\Repositories\ProjectInterface;
class ProjectController extends Controller
{
private $projectRepository;
private $clientRepository;
private $employeeRepository;
public function __construct(
ProjectInterface $projectRepository,
ClientInterface $clientRepository,
EmployeeInterface $employeeRepository) {
$this->projectRepository = $projectRepository;
$this->clientRepository = $clientRepository;
$this->employeeRepository = $employeeRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Project List';
$data['projects'] = $this->projectRepository->findAll();
return view('pms::project.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Project';
$data['status'] = Project::STATUS;
$data['categoryList'] = Project::CATEGORY;
$data['clientList'] = $this->clientRepository->pluck();
$data['memberList'] = $this->employeeRepository->pluck();
return view('pms::project.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$inputData = $request->all();
try {
$this->projectRepository->create($inputData);
toastr()->success('Project Created Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('project.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
$data['title'] = 'View Project';
$data['project'] = $this->projectRepository->getProjectById($id);
$data['status'] = Project::STATUS;
$data['countryList'] = [1 => 'Nepal'];
return view('pms::project.show', $data);
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Project';
$data['project'] = $this->projectRepository->getProjectById($id);
$data['status'] = Project::STATUS;
$data['categoryList'] = Project::CATEGORY;
$data['clientList'] = $this->clientRepository->pluck();
$data['memberList'] = $this->employeeRepository->pluck();
return view('pms::project.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$inputData = $request->except(['_method', '_token']);
try {
$this->projectRepository->update($id, $inputData);
toastr()->success('Project Update Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('project.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->projectRepository->delete($id);
toastr()->success('Project Deleted Succesfully');
} catch (\Throwable $th) {
//throw $th;
toastr()->error($th->getMessage());
}
}
}

View File

@ -0,0 +1,122 @@
<?php
namespace Modules\PMS\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Modules\Employee\Repositories\EmployeeInterface;
use Modules\PMS\Models\Task;
use Modules\PMS\Repositories\ProjectInterface;
use Modules\PMS\Repositories\TaskInterface;
class TaskController extends Controller
{
private $taskRepository;
private $projectRepository;
private $employeeRepository;
public function __construct(
TaskInterface $taskRepository,
ProjectInterface $projectRepository,
EmployeeInterface $employeeRepository) {
$this->taskRepository = $taskRepository;
$this->projectRepository = $projectRepository;
$this->employeeRepository = $employeeRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Task List';
$data['tasks'] = $this->taskRepository->findAll();
return view('pms::task.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Task';
$data['status'] = Task::STATUS;
$data['categoryList'] = Task::CATEGORY;
$data['projectList'] = $this->projectRepository->pluck();
$data['memberList'] = $this->employeeRepository->pluck();
return view('pms::task.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$inputData = $request->all();
try {
$this->taskRepository->create($inputData);
toastr()->success('Task Created Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('task.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
$data['title'] = 'View Task';
$data['task'] = $this->taskRepository->getTaskById($id);
$data['status'] = Task::STATUS;
return view('pms::task.show', $data);
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Task';
$data['task'] = $this->taskRepository->getTaskById($id);
$data['status'] = Task::STATUS;
$data['categoryList'] = Task::CATEGORY;
$data['projectList'] = $this->projectRepository->pluck();
$data['memberList'] = $this->employeeRepository->pluck();
return view('pms::task.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$inputData = $request->except(['_method', '_token']);
try {
$this->taskRepository->update($id, $inputData);
toastr()->success('Task Update Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('task.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->taskRepository->delete($id);
toastr()->success('Task Deleted Succesfully');
} catch (\Throwable $th) {
//throw $th;
toastr()->error($th->getMessage());
}
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Modules\PMS\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ClientRequest 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;
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace Modules\PMS\Models;
use App\Traits\CreatedUpdatedBy;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
class Client extends Model
{
use StatusTrait, CreatedUpdatedBy;
/**
* The attributes that are mass assignable.
*/
protected $table = 'tbl_clients';
protected $guarded = [];
protected $appends = ['status_name'];
}

View File

@ -0,0 +1,22 @@
<?php
namespace Modules\PMS\Models;
use App\Traits\CreatedUpdatedBy;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
class Project extends Model
{
use StatusTrait, CreatedUpdatedBy;
protected $table = 'tbl_projects';
protected $guarded = [];
protected $appends = ['status_name'];
const CATEGORY = [
10 => 'Vue',
11 => 'Laravel',
];
}

View File

@ -0,0 +1,22 @@
<?php
namespace Modules\PMS\Models;
use App\Traits\CreatedUpdatedBy;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
class Task extends Model
{
use StatusTrait, CreatedUpdatedBy;
protected $table = 'tbl_tasks';
protected $guarded = [];
protected $appends = ['status_name'];
const CATEGORY = [
10 => 'Vue',
11 => 'Laravel',
];
}

View File

@ -4,6 +4,12 @@ namespace Modules\PMS\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use Modules\PMS\Repositories\ClientInterface;
use Modules\PMS\Repositories\ClientRepository;
use Modules\PMS\Repositories\ProjectInterface;
use Modules\PMS\Repositories\ProjectRepository;
use Modules\PMS\Repositories\TaskInterface;
use Modules\PMS\Repositories\TaskRepository;
class PMSServiceProvider extends ServiceProvider
{
@ -29,6 +35,9 @@ class PMSServiceProvider extends ServiceProvider
*/
public function register(): void
{
$this->app->bind(ClientInterface::class, ClientRepository::class);
$this->app->bind(ProjectInterface::class, ProjectRepository::class);
$this->app->bind(TaskInterface::class, TaskRepository::class);
$this->app->register(RouteServiceProvider::class);
}
@ -56,7 +65,7 @@ class PMSServiceProvider extends ServiceProvider
*/
public function registerTranslations(): void
{
$langPath = resource_path('lang/modules/'.$this->moduleNameLower);
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
if (is_dir($langPath)) {
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
@ -72,7 +81,7 @@ class PMSServiceProvider extends ServiceProvider
*/
protected function registerConfig(): void
{
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config');
$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);
}
@ -81,14 +90,14 @@ class PMSServiceProvider extends ServiceProvider
*/
public function registerViews(): void
{
$viewPath = resource_path('views/modules/'.$this->moduleNameLower);
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
$sourcePath = module_path($this->moduleName, 'resources/views');
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-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','')));
$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);
}
@ -104,8 +113,8 @@ class PMSServiceProvider extends ServiceProvider
{
$paths = [];
foreach (config('view.paths') as $path) {
if (is_dir($path.'/modules/'.$this->moduleNameLower)) {
$paths[] = $path.'/modules/'.$this->moduleNameLower;
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
$paths[] = $path . '/modules/' . $this->moduleNameLower;
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace Modules\PMS\Repositories;
interface ClientInterface
{
public function findAll();
public function getClientById($clientId);
public function delete($clientId);
public function create($clientDetails);
public function update($clientId, array $newDetails);
public function pluck();
}

View File

@ -0,0 +1,39 @@
<?php
namespace Modules\PMS\Repositories;
use Modules\PMS\Models\Client;
class ClientRepository implements ClientInterface
{
public function findAll()
{
return Client::paginate(20);
}
public function getClientById($ClientId)
{
return Client::findOrFail($ClientId);
}
public function delete($ClientId)
{
Client::destroy($ClientId);
}
public function create($ClientDetails)
{
return Client::create($ClientDetails);
}
public function update($ClientId, array $newDetails)
{
return Client::whereId($ClientId)->update($newDetails);
}
public function pluck()
{
return Client::pluck('client_name', 'id');
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace Modules\PMS\Repositories;
interface ProjectInterface
{
public function findAll();
public function getProjectById($clientId);
public function delete($clientId);
public function create($clientDetails);
public function update($clientId, array $newDetails);
public function pluck();
}

View File

@ -0,0 +1,39 @@
<?php
namespace Modules\PMS\Repositories;
use Modules\PMS\Models\Project;
class ProjectRepository implements ProjectInterface
{
public function findAll()
{
return Project::paginate(20);
}
public function getProjectById($ProjectId)
{
return Project::findOrFail($ProjectId);
}
public function delete($ProjectId)
{
Project::destroy($ProjectId);
}
public function create($ProjectDetails)
{
return Project::create($ProjectDetails);
}
public function update($ProjectId, array $newDetails)
{
return Project::whereId($ProjectId)->update($newDetails);
}
public function pluck()
{
return Project::pluck('project_name', 'id');
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace Modules\PMS\Repositories;
interface TaskInterface
{
public function findAll();
public function getTaskById($clientId);
public function delete($clientId);
public function create($clientDetails);
public function update($clientId, array $newDetails);
public function pluck();
}

View File

@ -0,0 +1,40 @@
<?php
namespace Modules\PMS\Repositories;
use Illuminate\Support\Facades\DB;
use Modules\PMS\Models\Task;
class TaskRepository implements TaskInterface
{
public function findAll()
{
return Task::paginate(20);
}
public function getTaskById($TaskId)
{
return Task::findOrFail($TaskId);
}
public function delete($TaskId)
{
Task::destroy($TaskId);
}
public function create($TaskDetails)
{
return Task::create($TaskDetails);
}
public function update($TaskId, array $newDetails)
{
return Task::whereId($TaskId)->update($newDetails);
}
public function pluck()
{
return Task::pluck(DB::raw('CONCAT(first_name," ", middle_name , " ",last_name) AS full_name'), 'id');
}
}

View File

@ -0,0 +1,36 @@
<?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_clients', function (Blueprint $table) {
$table->id();
$table->string('client_name')->nullable();
$table->unsignedBigInteger('country_id')->nullable();
$table->string('email_address')->nullable();
$table->string('company')->nullable();
$table->string('address')->nullable();
$table->longText('desc')->nullable();
$table->integer('status')->nullable();
$table->unsignedBigInteger('createdBy')->nullable();
$table->unsignedBigInteger('updatedBy')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tbl_clients');
}
};

View File

@ -0,0 +1,38 @@
<?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_projects', function (Blueprint $table) {
$table->id();
$table->string('project_code')->nullable();
$table->string('project_name')->nullable();
$table->unsignedBigInteger('client_id')->nullable();
$table->unsignedBigInteger('project_category_id')->nullable();
$table->json('members_id')->nullable();
$table->date('start_date')->nullable();
$table->date('end_date')->nullable();
$table->longText('summary')->nullable();
$table->integer('status')->nullable();
$table->unsignedBigInteger('createdBy')->nullable();
$table->unsignedBigInteger('updatedBy')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tbl_projects');
}
};

View File

@ -0,0 +1,38 @@
<?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_tasks', function (Blueprint $table) {
$table->id();
$table->string('title')->nullable();
$table->unsignedBigInteger('task_category_id')->nullable();
$table->unsignedBigInteger('project_id')->nullable();
$table->date('start_date')->nullable();
$table->date('due_date')->nullable();
$table->json('assigned_id')->nullable();
$table->longText('desc')->nullable();
$table->integer('status')->nullable();
$table->integer('priority')->nullable();
$table->unsignedBigInteger('createdBy')->nullable();
$table->unsignedBigInteger('updatedBy')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tbl_tasks');
}
};

View 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('client.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
@include('pms::client.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,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($client, 'PUT')->route('client.update', $client->id)->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
@include('pms::client.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

View File

@ -0,0 +1,65 @@
@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">
<a href="{{ route('client.create') }}" class="btn btn-success btn-md waves-effect waves-light"><i
class="ri-add-fill me-1 align-bottom"></i> Add</a>
</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>Client Name</th>
<th>Email</th>
<th>Company</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@forelse ($clients as $key => $client)
<tr>
<td>{{ $key + 1 }}</td>
<td>{{ $client->client_name }}</td>
<td>{{ $client->email_address }}</td>
<td>{{ $client->company }}</td>
<td>{!! $client->status_name !!}</td>
<td>
<div class="hstack flex-wrap gap-3">
<a href="{{ route('client.show', $client->id) }}" class="link-info fs-15">
<i class="ri-eye-line"></i>
</a>
<a href="{{ route('client.edit', $client->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('client.destroy', $client->id) }}"
data-id="{{ $client->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

View File

@ -0,0 +1,65 @@
<div class="row">
<div class="col-lg-8">
<div class="card">
<div class="card-body">
<div class="row gy-1">
<div class="col-md-6">
{{ html()->label('Client Name')->class('form-label') }}
{{ html()->text('client_name')->class('form-control')->placeholder('Enter Client Name')->required() }}
</div>
<div class="col-md-6">
{{ html()->label('Email')->class('form-label') }}
{{ html()->email('email_address')->class('form-control')->placeholder('Enter Email')->required() }}
</div>
{{-- <div class="col-md-12">
{{ html()->label('Description')->class('form-label') }}
{{ html()->textarea('desc')->class('form-control')->placeholder('Enter Description...') }}
</div> --}}
<div class="col-md-6">
{{ html()->label('Country')->class('form-label') }}
{{ html()->select('country_id', $countryList)->class('form-control')->placeholder('Select Country')->required() }}
</div>
<div class="col-md-6">
{{ html()->label('Adress')->class('form-label') }}
{{ html()->text('address')->class('form-control')->placeholder('Enter Address') }}
</div>
<div class="col-md-6">
{{ html()->label('Company')->class('form-label') }}
{{ html()->text('company')->class('form-control')->placeholder('Enter Company')->attributes(['id' => 'cleave-prefixq']) }}
</div>
</div>
</div>
</div>
<!-- end card -->
<div class="mb-3 text-end">
<a href="{{ route('client.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', $status)->class('form-control')->placeholder('Select Status') }}
</div>
</div>
</div>
<!-- end card body -->
</div>
<!-- end card -->
</div>
<!-- end col -->
</div>

View File

@ -0,0 +1,49 @@
@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">Client Name</span></th>
<td>{{ $client->client_name }}</td>
</tr>
<tr>
<th><span class="fw-medium">Company</span></th>
<td>{{ $client->company }}</td>
</tr>
<tr>
<th><span class="fw-medium">Email</span></th>
<td>{{ $client->email_address }}</td>
</tr>
<tr>
<th><span class="fw-medium">Address</span></th>
<td>{{ $client->address }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="mb-3 text-end">
<a href="{{ route('client.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,18 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
@include('layouts.partials.breadcrumb', ['title' => $title])
{{ html()->form('POST')->route('project.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
@include('pms::project.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,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($project, 'PUT')->route('project.update', $project->id)->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
@include('pms::project.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

View File

@ -0,0 +1,71 @@
@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">
<a href="{{ route('project.create') }}" class="btn btn-success btn-md waves-effect waves-light"><i
class="ri-add-fill me-1 align-bottom"></i> Add</a>
</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>Code</th>
<th>Project Name</th>
<th>Members</th>
<th>Start Date</th>
<th>Deadline</th>
<th>Client</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@forelse ($projects as $key => $project)
<tr>
<td>{{ $key + 1 }}</td>
<td>{{ $project->project_code }}</td>
<td>{{ $project->project_name }}</td>
<td>{{ $project->members_id }}</td>
<td>{{ $project->start_date }}</td>
<td class="text-danger">{{ $project->end_date }}</td>
<td>{{ $project->client_id }}</td>
<td>{!! $project->status_name !!}</td>
<td>
<div class="hstack flex-wrap gap-3">
<a href="{{ route('project.show', $project->id) }}" class="link-info fs-15">
<i class="ri-eye-line"></i>
</a>
<a href="{{ route('project.edit', $project->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('project.destroy', $project->id) }}"
data-id="{{ $project->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

View File

@ -0,0 +1,95 @@
<div class="row">
<div class="col-lg-8">
<div class="card">
<div class="card-body">
<div class="row gy-1">
<div class="col-md-6">
{{ html()->label('Project Code')->class('form-label') }}
{{ html()->text('project_code')->class('form-control')->placeholder('Enter Project Code')->required() }}
</div>
<div class="col-md-6">
{{ html()->label('Project Name')->class('form-label') }}
{{ html()->text('project_name')->class('form-control')->placeholder('Enter Project Name')->required() }}
</div>
<div class="col-md-6">
{{ html()->label('Project Category')->class('form-label') }}
{{ html()->select('project_category_id', $categoryList)->class('form-control')->placeholder('Select Project Category')->required() }}
</div>
<div class="col-md-6">
{{ html()->label('Client')->class('form-label') }}
{{ html()->select('client_id', $clientList)->class('form-control')->placeholder('Select Client')->required() }}
</div>
<div class="col-md-12">
{{ html()->label('Team Members')->class('form-label') }}
{{ html()->select('members_id', $memberList)->class('form-control')->placeholder('Select Member')->required() }}
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-md-12">
{{ html()->label('Summary')->class('form-label') }}
{{ html()->textarea('summary')->class('form-control')->placeholder('Enter Summary...') }}
</div>
</div>
</div>
<!-- end card body -->
</div>
<!-- end card -->
<div class="mb-3 text-end">
<a href="{{ route('project.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', $status)->class('form-control')->required() }}
</div>
</div>
</div>
<!-- end card body -->
</div>
<!-- end card -->
<div class="card">
<div class="card-header">
<h5 class="card-title mb-0">Date</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-12">
{{ html()->label('Start Date')->class('form-label') }}
{{ html()->date('start_date')->class('form-control')->placeholder('Choose Start Date') }}
</div>
<div class="col-md-12">
{{ html()->label('End Date')->class('form-label') }}
{{ html()->date('end_date')->class('form-control')->placeholder('Choose End Date') }}
</div>
</div>
</div>
<!-- end card body -->
</div>
<!-- end card -->
</div>
<!-- end col -->
</div>

View File

@ -0,0 +1,49 @@
@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">Project Name</span></th>
<td>{{ $project->project_name }}</td>
</tr>
<tr>
<th><span class="fw-medium">Code</span></th>
<td>{{ $project->project_code }}</td>
</tr>
<tr>
<th><span class="fw-medium">Members</span></th>
<td>{{ $project->members_id }}</td>
</tr>
<tr>
<th><span class="fw-medium">Summary</span></th>
<td>{{ $project->summary }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="mb-3 text-end">
<a href="{{ route('project.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,18 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
@include('layouts.partials.breadcrumb', ['title' => $title])
{{ html()->form('POST')->route('task.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
@include('pms::task.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,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($task, 'PUT')->route('task.update', $task->id)->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
@include('pms::task.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

View 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">
<a href="{{ route('task.create') }}" class="btn btn-success btn-md waves-effect waves-light"><i
class="ri-add-fill me-1 align-bottom"></i> Add</a>
</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>Category</th>
<th>Project</th>
<th>Start Date</th>
<th>Deadline</th>
<th>Assigned</th>
<th>Priority</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@forelse ($tasks as $key => $task)
<tr>
<td>{{ $key + 1 }}</td>
<td>{{ $task->title }}</td>
<td>{{ $task->task_category_id }}</td>
<td>{{ $task->project_id }}</td>
<td>{{ $task->start_date }}</td>
<td class="text-danger">{{ $task->due_date }}</td>
<td>{{ $task->assigned_id }}</td>
<td>{{ $task->priority }}</td>
<td>{!! $task->status_name !!}</td>
<td>
<div class="hstack flex-wrap gap-3">
<a href="{{ route('task.show', $task->id) }}" class="link-info fs-15">
<i class="ri-eye-line"></i>
</a>
<a href="{{ route('task.edit', $task->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('task.destroy', $task->id) }}"
data-id="{{ $task->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

View File

@ -0,0 +1,96 @@
<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-6">
{{ html()->label('Task Category')->class('form-label') }}
{{ html()->select('task_category_id', $categoryList)->class('form-control')->placeholder('Select Task Category')->required() }}
</div>
<div class="col-md-6">
{{ html()->label('Project')->class('form-label') }}
{{ html()->select('project_id', $projectList)->class('form-control')->placeholder('Select Project')->required() }}
</div>
<div class="col-md-12">
{{ html()->label('Assigned User')->class('form-label') }}
{{ html()->select('assigned_id', $memberList)->class('form-control')->placeholder('Select Assigned User')->required() }}
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-md-12">
{{ html()->label('Description')->class('form-label') }}
{{ html()->textarea('desc')->class('form-control')->placeholder('Enter Description...') }}
</div>
</div>
</div>
<!-- end card body -->
</div>
<!-- end card -->
<div class="mb-3 text-end">
<a href="{{ route('task.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', $status)->class('form-control')->required() }}
</div>
</div>
</div>
<!-- end card body -->
</div>
<!-- end card -->
<div class="card">
<div class="card-header">
<h5 class="card-title mb-0">Date</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-12">
{{ html()->label('Priority')->class('form-label') }}
{{ html()->select('priority', $status)->class('form-control')->required() }}
</div>
<div class="col-md-12">
{{ html()->label('Start Date')->class('form-label') }}
{{ html()->date('start_date')->class('form-control')->placeholder('Choose Start Date') }}
</div>
<div class="col-md-12">
{{ html()->label('Due Date')->class('form-label') }}
{{ html()->date('due_date')->class('form-control')->placeholder('Choose Due Date') }}
</div>
</div>
</div>
<!-- end card body -->
</div>
<!-- end card -->
</div>
<!-- end col -->
</div>

View File

@ -0,0 +1,49 @@
@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>{{ $task->title }}</td>
</tr>
<tr>
<th><span class="fw-medium">Task Category</span></th>
<td>{{ $task->task_category_id }}</td>
</tr>
<tr>
<th><span class="fw-medium">Project</span></th>
<td>{{ $task->project_id }}</td>
</tr>
<tr>
<th><span class="fw-medium">Description</span></th>
<td>{{ $task->desc }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="mb-3 text-end">
<a href="{{ route('task.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

@ -1,7 +1,10 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\PMS\Http\Controllers\ClientController;
use Modules\PMS\Http\Controllers\PMSController;
use Modules\PMS\Http\Controllers\ProjectController;
use Modules\PMS\Http\Controllers\TaskController;
/*
|--------------------------------------------------------------------------
@ -12,8 +15,12 @@ use Modules\PMS\Http\Controllers\PMSController;
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
*/
Route::group([], function () {
Route::resource('pms', PMSController::class)->names('pms');
Route::resource('client', ClientController::class)->names('client');
Route::resource('project', ProjectController::class)->names('project');
Route::resource('task', TaskController::class)->names('task');
});

View File

@ -17,9 +17,9 @@ trait CreatedUpdatedBy
if ($model->isDirty('createdOn') && !$model->isDirty('createdOn')) {
$model->createdOn = now();
}
if (!$model->isDirty('status')) {
$model->status = 1;
}
// if (!$model->isDirty('status')) {
// $model->status = 11;
// }
});
// updating updated_by when model is updated

View File

@ -0,0 +1,34 @@
<?php
namespace App\Traits;
use Illuminate\Database\Eloquent\Casts\Attribute;
trait StatusTrait
{
const STATUS = [
11 => 'Active',
10 => 'In-Active',
];
protected function statusName(): Attribute
{
return Attribute::make(
get: function (mixed $value, array $attributes) {
// dd($value, $attributes);
switch ($attributes['status']) {
case '10':
return '<span class="badge bg-danger">' . self::STATUS[$attributes['status']] . '</span>';
break;
case '11':
return '<span class="badge bg-success">' . self::STATUS[$attributes['status']] . '</span>';
break;
default:
# code...
break;
}
},
set: fn($value) => $value,
);
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
<div id="preloader">
<div id="status">
<div class="spinner-border text-primary avatar-sm" role="status">
<span class="visually-hidden">Loading...</span>
</div>
<div id="pre-status">
<div class="spinner-border text-primary avatar-sm" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
</div>
</div>

View File

@ -36,25 +36,27 @@
<!--- PMS Start-->
<li class="nav-item">
<a class="nav-link menu-link" href="#PMS" data-bs-toggle="collapse" role="button" aria-expanded="false"
aria-controls="PMS">
<a class="nav-link menu-link {{ \Request::is('client') || \Request::is('project') || \Request::is('task') ? 'active' : '' }}"
href="#PMS" data-bs-toggle="collapse" role="button" aria-expanded="false" aria-controls="PMS">
<i class="ri-shopping-cart-2-line"></i> <span data-key="t-vendors">PMS</span>
</a>
<div class="menu-dropdown collapse" id="PMS">
<div
class="menu-dropdown {{ \Request::is('client') || \Request::is('project') || \Request::is('task') ? 'show' : '' }} collapse"
id="PMS">
<ul class="nav nav-sm flex-column">
<li class="nav-item">
<a href="{{ route('vendortypes.index') }}"
class="nav-link @if (\Request::is('vendortype') || \Request::is('vendortype/*')) active @endif">Client</a>
<a href="{{ route('client.index') }}"
class="nav-link @if (\Request::is('client') || \Request::is('client/*')) active @endif">Client</a>
</li>
<li class="nav-item">
<a href="{{ route('vendortypes.index') }}"
class="nav-link @if (\Request::is('vendortype') || \Request::is('vendortype/*')) active @endif">Projects</a>
<a href="{{ route('project.index') }}"
class="nav-link @if (\Request::is('project') || \Request::is('project/*')) active @endif">Projects</a>
</li>
<li class="nav-item">
<a href="{{ route('vendors.index') }}"
class="nav-link @if (\Request::is('vendors') || \Request::is('vendors/*')) active @endif">Tasks</a>
<a href="{{ route('task.index') }}"
class="nav-link @if (\Request::is('task') || \Request::is('task/*')) active @endif">Tasks</a>
</li>
</ul>
</div>