Skip to content

Commit

Permalink
Development 1.1 (#303)
Browse files Browse the repository at this point in the history
* Add forms validation

* Enahnce forms styling

* Edit form card styling, implement update user profile page

* Fix image in update user form

* Fix location & date picker format

* Update login page (#296)

* update login page UI

* format text

* Add countries drop down, comment update office vacations, fix list users, replace supervisor w team lead, fix vacation validation,

* add vacation validation

* feat: Add toolbar with profile and notifications

* Replace supercisor w tead lead in update user, fix image display, remove id in add user

* Fix update user

* Fix update user styling

* chore: save work

* Uncomment route guard and hide dashboard if not admin

* fix: menu width

* lint & format

* Fix build

* Fix build

* Fix date picker in set vacations, refactor formatDate

* Edit notification styling, remove unused import

* Refactor preventDefault in setVacations

* chore: save work

* fixing typos

* feat: Outsource notificationdetailsdialog

* feat: Fix dialog details

* feat: use notificationDetailsDialog in view

* chore: remove updates in .env

* fix: install [email protected]

* Dockerize the frontend (#309)

* Fixing users profile

* Adding useAsync in comments

* Using useAsyncState in UsersView

* use useAsyncState in profileview

* Development 1.1 staging enhancements (#312)

* Dockerize the frontend

* Change the frontend port to 8080 instead of 80, added a default value for the backend server ip in the config.js

* Staging version

* Staging version: Changing the front end ports in the docker-compose.

* Show success notification if post & put only, Use useAsyncState to handle error & isLoading in all forms

* Update the docker compose, fix the postgres linking issue.

* Update the docker compose, fix the postgres linking issue.

* Handle error in every API call, replace supervisors w Team Lead in my team

* fixing build issues

* removing issues

* fix: replace 'computedAsync' with 'useAsyncState' to avoid multiple computing

* Fix: Update the default value for the backend server with /api to call the /api directly.

* adding users image

* Fix user in state

* Update the config.js

* Fix expected to login err

* Edit error message

* Edit normalizeErr function, store refresh token on mount

* Development 1.1 staging (#314)

* Dockerize the frontend

* Change the frontend port to 8080 instead of 80, added a default value for the backend server ip in the config.js

* Update the docker images, created a isolated folder and moved all images onside it, created an network between the containers and let them talks on localhost.

* Moved the docker document inside the docs dir.

* Refactor the code structure

* Fix: Fix typo, updated the Makefile with the new changes.

* Updated the docker file.

* Removed the server dir from zinit scripts.

* Added container name in the docker-compose.

* Update the diraction of the scripts.

* Removed the flist behavior.

* Reset the terraform script to the defualt till we change it to be ready to initialize a machine with docker compose ready instead of flist

* Update the docs.

* Removed unused flag.

* Removed unused files.

* Update missing values.

* Mobe one step back to access the config.

* Change the dir to the server dir.

* Change the dir to the server dir.

* Added missing import.

* Removed the log

* Make the build env file executable.

* Update imports, fix issue in frontend container.

* Linting

* Updated the installation proccess.

* resolving comments

* removing comments

* fixing build error

* Added the -d flag to docker up.

* Added database scripts dir.

* Fix office form & refresh token in base

* Fix build

* Update the frontend ports

* Run the migrations only on development mode.

* Update the makefile.

* Added a help command.

* Update the backend.

* Saving the user image as its name.

* COPY with docker but with node_modules exclusion

* Fix: Fix the loading user image issue by replacing the 'api/' with an empty string, fixed the logging out issue.

* WIP: Added functions to validate the token

* Fix constant loading (#316)

* Check token validity before any request

* refactor unwrap conditions

* Development 1.1 calender (#294)

* calender

* calender

* Adding events, meetings and vacations to calender

* vacation card

* vacation card with update, reject, approve and delete

* adding filters

* refactor: Update calender code

* forms styling

* adding dayscell

* feat: Add background to events in calender

* feat: Remove watchEffect from loading users

* removing getuser method and moving methods to helpers

* Fixing build errors

* useAsync state in calender

* resolving errors

* adding emits to calender

* resolving comments

* fixing build errors

* fixing build errors

* using homes api

* fixing build errors and calender emits

* Adding birthday and public holiday cards

* fixing state user error

* Remove loading

* Adding vacation balance condition

* WIP: Added the expired field, initialized a new refrance from the date object to bind it on changing the month from the calendar.

* Adding watch to currentDate to execute homes

* Linting.

* Adding v-alert on loading

* Enhance the birthday card.

* Change warning alert to info alert

---------

Co-authored-by: MohamedElmdary <[email protected]>
Co-authored-by: Mahmoud Emad <[email protected]>

* Removed the -d flag from the docker compose down command in the makefile

* enhance calender

* enhance calender2

* update pop up color

* Adding themes to vuetify.ts

* popup calendar updated

* Fix: Updated the users page, ordered by the first_name, reduced the page size to 10

* Fix: Updated the users page, ordered by the first_name, reduced the page size to 10

* calender color

* Fix login issue.

* calender color

* Change the server dir name in the backend docker file.

* Adding pagination (#318)

* Adding pagination

* Adding Inactive chip

* Enhance the user card

---------

Co-authored-by: Mahmoud Emad <[email protected]>

* Development 1.1 user activation (#319)

* WIP: Working on the activation part.

* Adding set_active and inactive functionality

---------

Co-authored-by: Mahmoud Emad <[email protected]>

* Removed unused text in the set as active/inactive button

* Enhance the user card

* Enhance the user card

* update public holiday

* update birthday and event card

* update birthday and event card

* vacation card enhancments

* update event card

* fix: prevent any view from appear before router isReady

* fix: login/refresh

* Leave request enhancmantes

* meeting update

* remove comment

* feat: Add refresh token

* refactor: Remove commented code related to auth

* chore: Return config to it's original value

* fix meeting card

* Fixing v-select offices bug in usersView

* fix: assert user wasn't accessing ref's value

* fixing pagination bug

* update style of team

* Fixing reload bug

* Development 1.1 Redis connection (#328)

* Fix: Fix redis connection issue, returned an error in case the redis server isn'r running.

* Fix: Fix redirect user to profile when clicking on the image in the navbar.

* Enhancement: Moved the connection error code to an isolated function.

* Fix: Added missed return.

* log test

* revert log test

* Fixing end dates

* feat: Reduce requests (#330)

* Fix: Added cursor pointer class to the user avatar.

* Fixing refresh bug

* Removing public holiday and adding vacation balance

* Enhancement: Added a link to the CSHR logo.

* adding padding

* count fix

* update all pages

* update all pages

* update team view

* update team view

* fixing count bug

* remove console logs

* fix: unwrap was access config in AxiosRes which might be undefined

* adding setCount method

* removing console logs

* fix: normalize error

* UI vacation card

* UI vacation card

* Add confirm password

* fix img profile

* Added -f flag to the docker compose log command to follow up the logs.

* Edit error msg in change pass API

* revert last commit, Update msg in change password

* fix avatar size

* Edit msg

* Fix: push the profile link the router on clicking on the 'Your Profile' link.

* Add vacation rules

* Edit vacation rules

* Update: update the server volume

* Making date fields in calender editable

* Removing console logs

* Add load more users btn

* Show alert only if the form is valid

* Adding count

* Fix: Display telegram, user role and phone number. (#352)

* Redirect the user to login page if the token is not valid

* Fixing update user form

* Development 1.1 fix vacation balance (#355)

* Fix: Fix the vacation balance issue

* Fix; Replacing the json field with foreignKey with the office balance.

* Revert the config.

* Added condation.

* Fixing team lead v-select

* Added active class to the sidebar.

* fixing invalid page error and adding load more button to team leads, comments will be removed after testing

* Enhancements: Implement an endpoint to get all supervisors users on an exact office.

* Moved the supervisors endpoint under the user

* removing comment and updating endpoint

* Adding a relodMore button value

* Enhanced User Selection in Set User Balance Form (#365)

* Update: - Implemented the  attribute in the  to facilitate the selection of multiple users from the UI.
- Revised the props to transmit user IDs instead of a single user ID.
- Enhanced the selected users card by incorporating their avatars/logos for better visual identification.
- Implemented a feature to display the user balance when hovering over their respective profiles.
- Added a hint message to inform the admin that when selecting more than one user the balance values will be 0

* Refactored code for improved readability, added the 'Select All' button feature, and conducted thorough testing to ensure proper functionality.

* Feature: Added a compensation reson in the set user balance form, enhanced the code.

* Enhancement: Formatted the code.

* Update: Added the compensation balance in the user profile

* Improvements: Added a validation rules to validate the actual value of each reson and compare it with the entred value.

* Improvements: Refactored the code and remove unneeded duplicated code.

* Improvements: Refactored the code and remove unneeded duplicated code.

* Development admin accessibility (#367)

* Adding access to admin to request vacations for other users

* Adding admin endpoit

* fixing vacation card error

* Development admin accessibility backend (#368)

* Implementation: Implemented an endpoint for admins to post vacations behalf of the user.

* Enhancement: rename the route of the admin vacations request

* Typo: replaced the pinding by pending.

* Using enum in selectionOption and exporting ListUsers in helpers

---------

Co-authored-by: Thunder <[email protected]>

* Development admin accessibility (#369)

* Adding access to admin to request vacations for other users

* Adding admin endpoit

* fixing vacation card error

* Development admin accessibility backend (#368)

* Implementation: Implemented an endpoint for admins to post vacations behalf of the user.

* Enhancement: rename the route of the admin vacations request

* Typo: replaced the pinding by pending.

* Using enum in selectionOption and exporting ListUsers in helpers

* Update: update the request status of the user request.

---------

Co-authored-by: mayar osama <[email protected]>

* 1.1 Enhancements (#373)

* Fix: make the social_insurance_number field optional.

* Update: Replaced the Email in the birthday card with the telegram-handle

* Enhancement: Fix typo in public holiday card

* Enhancement: The login page description has been updated.

* Fix: An issue in the get_office_by_id helper fixed.

* Update: The vacation balance calculation is now calculated based on the user joining date, not the user created date.

* Fix: make the social_insurance_number field optional.

* Fix the filter issue.

* Update the id of each event.

* Adding Birthday Date to birthday card

* Update backend: Implemented wrappers to wrap the event request, working on the dialogs in the frontend.

* Fix: Updated all home page component.

* team view

* fixing create event submit button

* attempting fixing update vacation

* Fixing update vacation

* Fixing team view table

* adding leave excuse and fraction of a day request

* Update: Enhanced the vacation request, Changed the start, end dates to be datetime fields.

* Fix: Fixed an issue with loading vacation events in homepage, changed the DateTimeField to DateField

* Fixing the birthdate bug (#391)

* Adding calculate times method

* sending correct end and start date

* Development 1.1 telegram rule (#390)

* Removing telegram field validation

* Removing telegram rules comment

* Fixing user image on update

* Adding margins to image

* Adding leave excuse value

* Changing AdminApplyVacationForUserSerializer

* Adding days value condition

* Handling admin delete

* Enhance the vacation record name.

* Fixing user's select in set user vacation

* Fixing delete and update bugs

* fixing balance condition

* Removed unused zinit script.

* Downgrade the poetry version.

* Update: Added the country name on the public holiday label.

* Adding a condition to retrieve office user only if admin (#399)

* Adding validation to update user (#400)

* Adding validation to update user

* Removing logs

* Adjusting role validation rules

* Development 1.1 fix update user issue (#401)

* Fix: Fixed the issue in update user form.

* Added user name in the birthday event.

* Fix the approve issue. (#402)

* Fixing removing public holidays

* fix remove holiday bug incase adding and removing 1 holiday with a 1 exisiting holiday

---------

Co-authored-by: zaelgohary <[email protected]>
Co-authored-by: Samar Adel <[email protected]>
Co-authored-by: MohamedElmdary <[email protected]>
Co-authored-by: mayar osama <[email protected]>
Co-authored-by: Mohamed Rabie <[email protected]>
Co-authored-by: Zainab Elgohary <[email protected]>
Co-authored-by: maayarosama <[email protected]>
Co-authored-by: ehab-hassan <[email protected]>
Co-authored-by: ehab-hassan <[email protected]>
Co-authored-by: Ehab-hassan <[email protected]>
Co-authored-by: xmonader <[email protected]>
  • Loading branch information
12 people authored May 8, 2024
1 parent d82ec8a commit cd7f5b4
Show file tree
Hide file tree
Showing 405 changed files with 12,415 additions and 18,348 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/node_modules
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Bug report
about: Create a report to help us improve
title: ""
labels: ""
assignees: ""
---

### Search first

Search for similar issues first, if not complete the following template

### Description

A clear description of the bug

### Steps to reproduce

List of steps to reproduce the problem if it's a bug

### Logs/Alerts

Logs/Alerts if available
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/FEATURE_REQUEST.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: ""
assignees: ""
---

### Search first

Search for similar issues first, if you got no results, complete the following template

### Description

A clear description of the new feature

### Implementation

If you've a specific approach to discuss, describe it here clearly.

### More

Write more details here if needed about the feature
19 changes: 19 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Description

Describe the changes introduced by this PR and what does it affect

### Changes

List of changes this PR includes

### Related Issues

List of related issues

### Checklist

- [ ] Tests included
- [ ] Build pass
- [ ] Documentation
- [ ] Code format and docstrings
- [ ] Screenshots/Video attached (needed for UI changes)
49 changes: 22 additions & 27 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,35 @@
# Test if working.
name: Build and push a docker image and a flist.
name: Build

on:
push:
branches: [main, development]
branches:
[development_1.1, development_1.1_*]

jobs:
build:
run-linters:
name: Run linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push server image
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/cshr_server:latest
file: "./Dockerfile"
strategy:
matrix:
node-version: [18.x]

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Build and push client image
uses: docker/build-push-action@v3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/cshr_client:latest
file: "./client/Dockerfile"
context: ./client
node-version: ${{ matrix.node-version }}

- name: build and push server flist
- name: Install Dependencies
run: |
curl -f -X POST -H "Authorization: bearer ${{ secrets.FLIST_TOKEN }}" https://hub.grid.tf/api/flist/me/docker -F 'image=${{ secrets.DOCKER_USERNAME }}/cshr_server:latest'
cd client
npm install -g pnpm
pnpm install
- name: build and push client flist
- name: Build
run: |
curl -f -X POST -H "Authorization: bearer ${{ secrets.FLIST_TOKEN }}" https://hub.grid.tf/api/flist/me/docker -F 'image=${{ secrets.DOCKER_USERNAME }}/cshr_client:latest'
cd client
pnpm build
34 changes: 21 additions & 13 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
name: Lint
name: Lint and Build

on:
push:
branches:
- '**'
branches:
[development_1.1, development_1.1_*]

jobs:
run-linters:
name: Run linters
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

steps:
- name: Check out Git repository
- name: Checkout Repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
- name: Setup Node.js
uses: actions/setup-node@v4
with:
python-version: 3.8
node-version: ${{ matrix.node-version }}

- name: Install Python dependencies
run: pip install flake8
- name: Install Dependencies
run: |
cd client
npm install -g pnpm
pnpm install
- name: Run linters
uses: wearerequired/lint-action@v2
with:
flake8: true
- name: Lint and Format
run: |
cd client
pnpm lint
pnpm format
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: Test

on:
push:
branches:
- '**'
branches: [main, development]
jobs:
test:
runs-on: ubuntu-latest
Expand Down
66 changes: 51 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,68 @@

CMD:=poetry run
client:=cd client
server:=cd server
terraform:=cd terraform

help:
@echo "\n- Docker: To build and run a specific service, you can do that by executing 'make docker-up service=<service_name>'."
@echo "\n- To run a the backend project, you can do that by executing 'make runserver'."
@echo "\n- To run a the backend client, you can do that by executing 'make runclient'."

docker-up:
docker-compose up --build -d
ifeq ($(service), frontend)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env up frontend --build -d
else ifeq ($(service), backend)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env up backend --build -d
else ifeq ($(service), postgres)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env up postgres --build -d
else
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env up --build -d
endif

docker-down:
ifeq ($(service), frontend)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env down frontend
else ifeq ($(service), backend)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env down backend
else ifeq ($(service), postgres)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env down postgres
else
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env down
endif

docker-logs:
ifeq ($(service), frontend)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env logs -f frontend
else ifeq ($(service), backend)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env logs -f backend
else ifeq ($(service), postgres)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env logs -f postgres
else
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env logs -f
endif

install:
curl -sSL https://install.python-poetry.org | python3 -
poetry install
poetry check
cd client && npm i && cd ..
$(server) && poetry install
$(server) && poetry check
$(client) && pnpm i
runserver:
$(CMD) python3 manage.py runserver
$(server) && $(CMD) python3 manage.py runserver
runclient:
$(client) && npm i && npm run dev
$(client) && pnpm i && pnpm dev
test:
$(CMD) python3 manage.py test
$(server) && $(CMD) python3 manage.py test
lint:
$(CMD) black server/ --exclude=__init__.py
$(CMD) flake8 server/ --exclude=__init__.py
$(client) && npm run lint
$(server) && $(CMD) black . --exclude=__init__.py
$(server) && $(CMD) flake8 . --exclude=__init__.py
$(client) && pnpm lint
migrate:
$(CMD) python3 manage.py makemigrations
$(CMD) python3 manage.py migrate
$(server) && $(CMD) python3 manage.py makemigrations
$(server) && $(CMD) python3 manage.py migrate
user:
$(CMD) python3 manage.py createsuperuser
$(server) && $(CMD) python3 manage.py createsuperuser
data:
$(CMD) python3 manage.py create locations users
$(server) && $(CMD) python3 manage.py create locations users
deploy:
$(terraform) && terraform init && terraform apply -auto-approve
destroy:
Expand Down
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,33 @@ When in development mode, use the following Makefile commands:
- **Server:** Implemented using Django.
- **Notification Service:** Requires a running Redis server for notification functionality.

## Installation Process

To facilitate the installation process, this project utilizes the `poetry` package manager for `Python` and `pnpm` for `Node.js`. Follow the steps outlined below for a seamless installation:

1. Install Poetry:
Execute the following command to install Poetry for Python:

```sh
curl -sSL https://install.python-poetry.org | python3 -
```

2. Install Pnpm:
To install `pnpm` globally for Node.js, run the following command:

```sh
npm i -g pnpm
```

After installing these packages you can now install the required packages by executing:
3. Install project Packages

```sh
make install
```

By following these steps, you ensure the proper setup of the required package managers for this project.

## Project Configuration

After executing
Expand All @@ -62,3 +89,40 @@ make install && make migrate
```

Please refer to [.env.template](./config/.env.template) for all required values. Ensure all values are populated in the `.env` file within the [config](./config/) directory.

## Runing the project using Docker and Docker Compose

To run the full project with all instances, follow these steps:

1. Set Environment Variables

Create a `.env` file beside the [config](./config/) directory and set the necessary environment variables. Refer to the previous section for sample environment variable configurations.

2. Execute Docker Compose

Run the following command to start the Docker containers and please make sure that you are on the root of the project:

```sh
# --> To run all services

└─(✹)──> docker compose -f ./docker/docker-compose.yml --env-file=./config/.env up --build -d

# --> To stop all services
└─(✹)──> docker compose -f ./docker/docker-compose.yml --env-file=./config/.env down

```

Also, you can excute the command using Make:

- make docker-up **To run all services**
- make docker-down **To stop all services**

After executing the command, you should see a confirmation similar to the following:

3. Verify Successful Deployment

This indicates that the Docker containers are being created and the services are starting up.

- ![docker-compose-deployments](docs/images/docker-compose-deployments.png)

You can also take a look at [configuration.md](docs/configuration.md)
10 changes: 10 additions & 0 deletions client/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Client Related
VITE_TITLE="Codescalers HR management system"
VITE_FAVICON="https://placehold.co/32/steelblue/white?text=CS"
VITE_LOGO="https://placehold.co/128/steelblue/white?text=CS"

# Server Related
SERVER_DOMAIN_NAME_API="http://127.0.0.1:8000/api"

# Development Related
VITE_DEBUG=false
15 changes: 15 additions & 0 deletions client/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
root: true,
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
'@vue/eslint-config-prettier/skip-formatting'
],
parserOptions: {
ecmaVersion: 'latest'
}
}
Loading

0 comments on commit cd7f5b4

Please sign in to comment.