Skip to content

Commit

Permalink
Fix the rejict vacation issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmoud-Emad committed Oct 29, 2023
1 parent d61da06 commit d7d0c90
Show file tree
Hide file tree
Showing 8 changed files with 1,189 additions and 1,118 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,6 @@ dmypy.json
.pyre/

profile_image/
.vscode
.vscode
./terraform/state.json
terraform/.terraform.lock.hcl
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ terraform:=cd terraform
docker-up:
docker-compose up --build -d
install:
pip3 install poetry
poetry install
poetry check
cd client && yarn && cd ..
runserver:
$(CMD) python3 manage.py runserver
runclient:
Expand All @@ -22,7 +24,7 @@ migrate:
user:
$(CMD) python3 manage.py createsuperuser
$(CMD) python3 manage.py runserver
terraform-up:
deploy:
$(terraform) && terraform init && terraform apply -auto-approve
terraform-down:
destroy:
$(terraform) && terraform destroy -auto-approve
5 changes: 5 additions & 0 deletions client/src/componants/calendar/Calender.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
showModal = true
}
const removeItem = () => {
items = items.filter((item) => item !== clickedItemOnModal);
}
function next() {
month++;
if (month == 12) {
Expand Down Expand Up @@ -109,6 +113,7 @@
bind:showModal
currentVacationActive={clickedItemOnModal.vacation[0]}
currentVacationID={+clickedItemOnModal.vacation[0].id}
on:reject={removeItem}
/>
{:else if clickedItemOnModal && clickedItemOnModal.title == CalenderEventTyoe.event}
<CalendarEventDataModal
Expand Down
10 changes: 8 additions & 2 deletions client/src/componants/ui/modals/CalendarVacationDataModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import Loading from '../Loading.svelte';
import Requests from '../../../apis/requests/Requests';
import { Link } from 'svelte-navigator';
import { createEventDispatcher } from 'svelte'
export let showModal: boolean = false;
export let clickedItemOnModal: calendarItemsType;
Expand All @@ -22,6 +23,8 @@
let responseClass: string;
let responseTitle: string;
const dispatch = createEventDispatcher()
async function approveVacation(){
approveLoading = true;
isDisable = true
Expand Down Expand Up @@ -58,9 +61,12 @@
responseTitle = "Success!";
responseClass = "success";
showAlert = true;
dispatch('reject', true);
setTimeout((
() => {showAlert = false;}
), 5000);
() => {
showAlert = false;
}
), 3000);
} catch (error){
responseMessage = error.message;
responseTitle = "Error!";
Expand Down
2,222 changes: 1,111 additions & 1,111 deletions client/yarn.lock

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"svelte-navigator": "^3.2.2"
}
}
4 changes: 2 additions & 2 deletions server/cshr/services/vacations.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ def filter_vacations_by_month_and_year(month: str, year: str) -> Vacation:
This function will filter all of vacations based on its yesr, month.
"""
vacations: List[Vacation] = Vacation.objects.filter(
Q(from_date__month=month, from_date__year=year)
| Q(end_date__month=month, end_date__year=year)
Q(from_date__month=month, from_date__year=year, status__in = [STATUS_CHOICES.PENDING, STATUS_CHOICES.APPROVED])

Check failure on line 16 in server/cshr/services/vacations.py

View workflow job for this annotation

GitHub Actions / Flake8

server/cshr/services/vacations.py#L16

Unexpected spaces around keyword / parameter equals (E251)

Check failure on line 16 in server/cshr/services/vacations.py

View workflow job for this annotation

GitHub Actions / Flake8

server/cshr/services/vacations.py#L16

Unexpected spaces around keyword / parameter equals (E251)
| Q(end_date__month=month, end_date__year=year, status__in = [STATUS_CHOICES.PENDING, STATUS_CHOICES.APPROVED])

Check failure on line 17 in server/cshr/services/vacations.py

View workflow job for this annotation

GitHub Actions / Flake8

server/cshr/services/vacations.py#L17

Unexpected spaces around keyword / parameter equals (E251)

Check failure on line 17 in server/cshr/services/vacations.py

View workflow job for this annotation

GitHub Actions / Flake8

server/cshr/services/vacations.py#L17

Unexpected spaces around keyword / parameter equals (E251)
)
return vacations

Expand Down
51 changes: 51 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


dedent-js@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/dedent-js/-/dedent-js-1.0.1.tgz#bee5fb7c9e727d85dffa24590d10ec1ab1255305"
integrity sha512-OUepMozQULMLUmhxS95Vudo0jb0UchLimi3+pQ2plj61Fcy8axbP9hbiD4Sz6DPqn6XG3kfmziVfQ1rSys5AJQ==

lower-case@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-2.0.2.tgz#6fa237c63dbdc4a82ca0fd882e4722dc5e634e28"
integrity sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==
dependencies:
tslib "^2.0.3"

no-case@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/no-case/-/no-case-3.0.4.tgz#d361fd5c9800f558551a8369fc0dcd4662b6124d"
integrity sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==
dependencies:
lower-case "^2.0.2"
tslib "^2.0.3"

pascal-case@^3.1.1:
version "3.1.2"
resolved "https://registry.yarnpkg.com/pascal-case/-/pascal-case-3.1.2.tgz#b48e0ef2b98e205e7c1dae747d0b1508237660eb"
integrity sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==
dependencies:
no-case "^3.0.4"
tslib "^2.0.3"

svelte-navigator@^3.2.2:
version "3.2.2"
resolved "https://registry.yarnpkg.com/svelte-navigator/-/svelte-navigator-3.2.2.tgz#4156c2388226e7c42b766ca4def63444ec58a8d2"
integrity sha512-Xio4ohLUG1nQJ+ENNbLphXXu9L189fnI1WGg+2Q3CIMPe8Jm2ipytKQthdBs8t0mN7p3Eb03SE9hq0xZAqwQNQ==
dependencies:
svelte2tsx "^0.1.151"

svelte2tsx@^0.1.151:
version "0.1.193"
resolved "https://registry.yarnpkg.com/svelte2tsx/-/svelte2tsx-0.1.193.tgz#16fe594898ef455e4f715ac317d219c9c757656b"
integrity sha512-vzy4YQNYDnoqp2iZPnJy7kpPAY6y121L0HKrSBjU/IWW7DQ6T7RMJed2VVHFmVYm0zAGYMDl9urPc6R4DDUyhg==
dependencies:
dedent-js "^1.0.1"
pascal-case "^3.1.1"

tslib@^2.0.3:
version "2.6.2"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"
integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==

0 comments on commit d7d0c90

Please sign in to comment.