Skip to content
Open
Show file tree
Hide file tree
Changes from 61 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
bc6f35e
initial breakpoint commit
GoranStefanovski Jan 30, 2025
1a6d4dc
initial layouting changes commit
GoranStefanovski Jan 30, 2025
1e8749e
adding permissions and roles
GoranStefanovski Jan 30, 2025
1efaafe
add new tables for leave types and user days count, add to seeder
GoranStefanovski Jan 30, 2025
2d6517e
add leave_requests migration, add leave type php
GoranStefanovski Jan 30, 2025
137ff9c
mave view for leave types available
GoranStefanovski Jan 31, 2025
191a348
add PHP for leave requests
GoranStefanovski Jan 31, 2025
49368fa
enable listing of leave types
GoranStefanovski Jan 31, 2025
4b22c6c
fix create and update for leaveTypes
GoranStefanovski Jan 31, 2025
9ee9dde
update leave types search, create leave request page core, starting d…
GoranStefanovski Jan 31, 2025
8f36eb6
fix save on request, update migration and types
GoranStefanovski Jan 31, 2025
9cf1b27
minor update to view and change in draw search
GoranStefanovski Jan 31, 2025
8545c91
frontend work with dropdowns and design
GoranStefanovski Jan 31, 2025
ac70986
fix migration, fix typo and fix request edit
GoranStefanovski Jan 31, 2025
3dc375f
fix branding, fix my profile page
GoranStefanovski Jan 31, 2025
c5e38dc
fix issues with minimize
GoranStefanovski Jan 31, 2025
7c4c6d6
add confirmation page, add permissions, add proper save to all values…
GoranStefanovski Feb 1, 2025
58b4824
add email sending to admins and assigned manager, remove faker accounts
GoranStefanovski Feb 1, 2025
9673084
email hadndling on create/update, approve and decline request day api…
GoranStefanovski Feb 1, 2025
70d8858
show status on requests
GoranStefanovski Feb 1, 2025
ec6c97b
add status badge to requests
GoranStefanovski Feb 2, 2025
f67a8df
add colors on btns
GoranStefanovski Feb 2, 2025
b9d0b95
create Calendar user tab, tab active classes fix
GoranStefanovski Feb 2, 2025
be924e0
get approved days by user in edit, show request depending on role
GoranStefanovski Feb 2, 2025
82086a5
draw leave types for colors in the calendar
GoranStefanovski Feb 2, 2025
e843ba0
add max leave and leave felt in user
GoranStefanovski Feb 4, 2025
c792412
add if leave type paid vacation, to substract days left, add better d…
GoranStefanovski Feb 4, 2025
424f24d
disable paid if no paid days left
GoranStefanovski Feb 4, 2025
0fa2849
add singe calendar view for user
GoranStefanovski Feb 4, 2025
037ef82
add calendar view for all people
GoranStefanovski Feb 4, 2025
540b342
add national holiday db, add country dropdown for user, add command f…
GoranStefanovski Feb 4, 2025
8b20ab3
remove sensitive from .env
GoranStefanovski Feb 4, 2025
0fbd2da
add deduct vacation paid days function, removing holidays and weekend…
GoranStefanovski Feb 4, 2025
f716ccf
add national holidays in main calendar
GoranStefanovski Feb 5, 2025
4dcb644
add national holiday on user calendar
GoranStefanovski Feb 5, 2025
93a3194
change command to not save holiday if weekend
GoranStefanovski Feb 5, 2025
b4d5cc2
disable national holiday
GoranStefanovski Feb 5, 2025
8b5dd9f
show days left on user row
GoranStefanovski Feb 5, 2025
d87a3c9
add main dashboard views and tables
GoranStefanovski Feb 5, 2025
ac246cb
change command
GoranStefanovski Feb 6, 2025
bb229f1
Refactor leave days and add relation to leavedays to user and leave t…
StefanUgrenovikj Feb 6, 2025
fc4fd18
fix deleting and editing requests, fix email sendings
GoranStefanovski Feb 6, 2025
d6ef2ce
fix email templates
GoranStefanovski Feb 6, 2025
6ef7a01
add work from home
GoranStefanovski Feb 6, 2025
a4eb6b4
fix apis, improve work from home functionality
GoranStefanovski Feb 6, 2025
1648650
add is_office_based in DB and in User view
GoranStefanovski Feb 6, 2025
4d993a1
make sortabkle
GoranStefanovski Feb 6, 2025
b2298e0
fix setback routes, add filtering to headers
GoranStefanovski Feb 6, 2025
01d3530
add loading to save button
GoranStefanovski Feb 6, 2025
3351eb2
approve loading
GoranStefanovski Feb 6, 2025
f49e319
fix my profile page
GoranStefanovski Feb 7, 2025
f129dcf
fix back button on my profile
GoranStefanovski Feb 7, 2025
5678ba6
add reason to email template, fix approve/decline buttons to show to …
GoranStefanovski Feb 7, 2025
be4d84d
changes in hompeage public, request validation for leave requets, cha…
GoranStefanovski Feb 7, 2025
f197bbb
Add delete crud for users and leave request and add modal for confirm
StefanUgrenovikj Feb 7, 2025
8e8cbc6
add document table, send pdf to email, download pdf in users, fix my …
GoranStefanovski Feb 9, 2025
04be158
fix approve decline stylie
GoranStefanovski Feb 9, 2025
c84e1fd
fix pdf file with layouting data, need to update cyrilic data in DB
GoranStefanovski Feb 9, 2025
7ae04d8
fix layouting with leave types row in leave calendar tab and page
GoranStefanovski Feb 9, 2025
4e7075b
small layouting changes
GoranStefanovski Feb 9, 2025
d023067
Merge pull request #1 from GoranStefanovski/breakpoint-to-dev
GoranStefanovski Feb 9, 2025
2070a1e
add pdf mail to administration, add cancelation email
GoranStefanovski Feb 10, 2025
dec80d4
ad MK templates
GoranStefanovski Feb 11, 2025
038832b
Merge branch 'breakpoint-master' into dev
GoranStefanovski Feb 11, 2025
c14d51a
change email subjects, change approve bg color btn
GoranStefanovski Feb 11, 2025
9d5b51b
add validation for leave types and leave requests
GoranStefanovski Feb 12, 2025
d7bae06
delete leave type, refactor not needed code
GoranStefanovski Feb 12, 2025
d2be3f9
rename in leavetypes
GoranStefanovski Feb 12, 2025
c9048a5
update user id confirmed by
GoranStefanovski Feb 12, 2025
a373bd0
add error messages
GoranStefanovski Feb 12, 2025
b92e1ae
Merge branch 'breakpoint-master' into dev
GoranStefanovski Feb 12, 2025
9c1fda3
test deploy
GoranStefanovski Feb 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .vscode/settings.json
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add this file to gitignore

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#7c83e9",
"activityBar.background": "#7c83e9",
"activityBar.foreground": "#15202b",
"activityBar.inactiveForeground": "#15202b99",
"activityBarBadge.background": "#f6c8cb",
"activityBarBadge.foreground": "#15202b",
"commandCenter.border": "#e7e7e799",
"sash.hoverBorder": "#7c83e9",
"statusBar.background": "#505ae2",
"statusBar.foreground": "#e7e7e7",
"statusBarItem.hoverBackground": "#7c83e9",
"statusBarItem.remoteBackground": "#505ae2",
"statusBarItem.remoteForeground": "#e7e7e7",
"titleBar.activeBackground": "#505ae2",
"titleBar.activeForeground": "#e7e7e7",
"titleBar.inactiveBackground": "#505ae299",
"titleBar.inactiveForeground": "#e7e7e799"
},
"peacock.color": "#505ae2"
}
19 changes: 11 additions & 8 deletions app/api/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ DB_USERNAME=root
DB_PASSWORD=password

BROADCAST_DRIVER=log
CACHE_DRIVER=memcached
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_CONNECTION=sync
Expand All @@ -27,13 +27,14 @@ REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=587
MAIL_USERNAME=14b3bc30ce304d
MAIL_PASSWORD=22b08660b859f6
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"
MAIL_MAILER=smtp
MAIL_HOST=sandbox.smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=USERNAME
MAIL_PASSWORD=PASSWORD
MAIL_ENCRYPTION=tls
[email protected]
MAIL_FROM_NAME="Leave Management System"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${APP_NAME} is more appropriate for this and not sure for the rest of the values


AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
Expand All @@ -55,3 +56,5 @@ VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

HOLIDAYS_YEAR="2025"
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php

namespace App\Applications\Document\Controllers;

use App\Applications\Document\DTO\DocumentDTO;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Applications\Document\Services\DocumentServiceInterface;
use Illuminate\Support\Facades\Route;
use Illuminate\Validation\ValidationException;
use Symfony\Component\HttpFoundation\JsonResponse;

/**
* @property DocumentServiceInterface $documentService
*/
class DocumentController extends Controller
{
public function __construct(
DocumentServiceInterface $documentService
) {
$this->documentService = $documentService;
}

/**
* Get a JSON with all the users
*
* @return JsonResponse
*/
public function getAll(): JsonResponse
{
$leaveTypeDTOs = $this->documentService->getAll();
return response()->json($leaveTypeDTOs);
}

/**
* Get a JSON with a user by ID
*
* @param integer $id
* @return JsonResponse
*/
public function get(int $id): JsonResponse
{
$leaveTypeDTO = $this->documentService->get($id);
return response()->json($leaveTypeDTO);
}

/**
* Get a paginated, filtered and sorted array of Users.
* This endpoint requires some data in the request.
*
* @param Request $request
* @return JsonResponse
*/
public function draw(Request $request): JsonResponse
{
try {
$data = $request->all();
$leaveTypesDTO = $this->documentService->draw($data);

return response()->json($leaveTypesDTO);
} catch (\InvalidArgumentException $e) {
// Handle specific exceptions like InvalidArgumentException
return response()->json([
'error' => 'Invalid Argument',
'message' => $e->getMessage(),
], 400); // Bad Request status code
} catch (\ValidationException $e) {
// Handle validation exceptions
return response()->json([
'error' => 'Validation Error',
'message' => $e->getMessage(),
'errors' => $e->errors(),
], 422); // Unprocessable Entity status code
} catch (\Exception $e) {
// Handle any other general exceptions
return response()->json([
'error' => 'Server Error',
'message' => $e->getMessage(),
], 500); // Internal Server Error status code
}
}
}
86 changes: 86 additions & 0 deletions app/api/app/Applications/Document/DTO/DocumentDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php

namespace App\Applications\Document\DTO;

use App\Applications\Document\Model\Document;
use Illuminate\Http\Request;

class DocumentDTO
{
public string $file_name;
public string $file_path;
public int $id;
public int $leave_request_id;
public int $user_id;

public function __construct(
string $file_name,
string $file_path,
int $id = 0,
int $leave_request_id = 0,
int $user_id = 0,
) {
$this->file_name = $file_name;
$this->file_path = $file_path;
$this->id = $id;
$this->leave_request_id = $leave_request_id;
$this->user_id = $user_id;
}

public static function fromRequest(Request $request): self
{
return new self(
$request->input('file_name'),
$request->input('file_path'),
$request->input('id', 0),
$request->input('leave_request_id', 0),
$request->input('user_id', 0),
);
}

public static function fromRequestForCreate(Request $request): self
{
return new self(
$request->input('file_name'),
$request->input('file_path'),
id: 0,
leave_request_id: 0,
user_id: 0,
);
}

public static function fromModel(Document $document): self
{
return new self(
$document->file_name,
$document->file_path,
$document->id,
$document->leave_request_id,
$document->user_id,

);
}

public function jsonSerialize(): array
{
return $this->toArray();
}

public function toArray(): array
{
return [
'name' => $this->file_name,
'slug' => $this->file_path,
'id' => $this->id,
'leave_request_id' => $this->leave_request_id,
'user_id' => $this->user_id,
];
}

public static function fromCollection(iterable $leaveTypes): array
{
return array_map(function (Document $leaveType) {
return self::fromModel($leaveType);
}, $leaveTypes->all());
}
}
11 changes: 11 additions & 0 deletions app/api/app/Applications/Document/Model/Document.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace App\Applications\Document\Model;

use Illuminate\Database\Eloquent\Model;

class Document extends Model
{
protected $fillable = ['user_id', 'leave_request_id', 'file_name', 'file_path'];
public $timestamps = true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace App\Applications\Document\Providers;

use App\Applications\Document\Repositories\DocumentRepository;
use App\Applications\Document\Repositories\DocumentRepositoryInterface;
use App\Applications\Document\Services\DocumentService;
use App\Applications\Document\Services\DocumentServiceInterface;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;

class DocumentServiceProvider extends ServiceProvider
{
/**
* Set the service provider namespace
*
*/
protected $namespace = 'App\Applications\Document';
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
if ($this->app->routesAreCached()) {
// This is already done in the main RouteServiceProvider so not needed here
} else {

$this->app->call([$this, 'map']);

$this->app->booted(function () {
$this->app['router']->getRoutes()->refreshNameLookups();
$this->app['router']->getRoutes()->refreshActionLookups();
});
}
}

/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->app->bind(DocumentRepositoryInterface::class, DocumentRepository::class);
$this->app->bind(DocumentServiceInterface::class, DocumentService::class);
}

public function map()
{
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/Document/api.php'));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

namespace App\Applications\Document\Repositories;

use App\Applications\Document\DTO\DocumentDTO;
use App\Applications\Pagination\StarterPaginator;
use App\Applications\Document\Model\Document;


/**
* @property Document $document
*/
class DocumentRepository implements DocumentRepositoryInterface
{
public function __construct(
Document $document,
) {
$this->document = $document;
}

private const COLUMNS_MAP = [
'file_name' => 'documents.file_name',
'file_path' => 'documents.file_path',
];

public function getAll(): array
{
$documents = $this->document::all();
return DocumentDTO::fromCollection($documents);
}

public function get($id): Document
{
return $this->document::findOrFail($id);
}

public function draw($data): StarterPaginator
{
// $paginatedUsers = $this->prepareDatatableQuery($data, [User::ADMIN, User::EDITOR, User::COLLABORATOR]);
$query = $this->document->query();

// $query->whereIn('roles.name', $roles);

if (array_key_exists($data['column'], self::COLUMNS_MAP)) {
$query->orderBy(self::COLUMNS_MAP[$data['column']], $data['dir']);
}

$userId = $data['userId'];
if ($userId ) {
$query->where('documents.user_id', '=', $userId);
}

return $query->paginate($data['length']);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace App\Applications\Document\Repositories;

use App\Applications\Pagination\StarterPaginator;
use App\Applications\Document\DTO\DocumentDTO;
use App\Applications\Document\Model\Document;

/**
* Interface DocumentRepositoryInterface
* @package App\Applications\Document
*/

interface DocumentRepositoryInterface
{
/**
* @return array
*/
public function getAll(): array;

/**
* @param integer $id
* @return Document
*/
public function get($id);

/**
* @param array $data
* @return StarterPaginator
*/
public function draw(array $data): StarterPaginator;

}
Loading