Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development 1.1 calender #294

Merged
merged 39 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
124cb74
calender
maayarosama Jan 15, 2024
d6f8383
calender
maayarosama Jan 16, 2024
4695b42
Adding events, meetings and vacations to calender
maayarosama Jan 18, 2024
0dfa711
vacation card
maayarosama Jan 18, 2024
8cb3056
vacation card with update, reject, approve and delete
maayarosama Jan 21, 2024
12db11e
adding filters
maayarosama Jan 21, 2024
aa543ea
refactor: Update calender code
MohamedElmdary Jan 21, 2024
67ee3e5
forms styling
maayarosama Jan 21, 2024
a39e4e9
adding dayscell
maayarosama Jan 22, 2024
b2bdf18
feat: Add background to events in calender
MohamedElmdary Jan 22, 2024
66758ff
feat: Remove watchEffect from loading users
MohamedElmdary Jan 22, 2024
34dee5b
removing getuser method and moving methods to helpers
maayarosama Jan 22, 2024
50aaf51
Merge branch 'development_1.1' into development_1.1_calender
maayarosama Jan 22, 2024
fe1311d
Fixing build errors
maayarosama Jan 22, 2024
d955b85
useAsync state in calender
maayarosama Jan 23, 2024
f7d423f
Merge branch 'development_1.1' into development_1.1_calender
maayarosama Jan 23, 2024
7ceba58
Merge branch 'development_1.1' into development_1.1_calender
maayarosama Jan 23, 2024
5681c08
resolving errors
maayarosama Jan 23, 2024
88a3258
adding emits to calender
maayarosama Jan 23, 2024
f71e4d8
Merge branch 'development_1.1' into development_1.1_calender
maayarosama Jan 24, 2024
124885f
resolving comments
maayarosama Jan 24, 2024
cf810c3
Merge branch 'development_1.1' into development_1.1_calender
maayarosama Jan 24, 2024
693385d
fixing build errors
maayarosama Jan 24, 2024
5f1538c
fixing build errors
maayarosama Jan 24, 2024
5c1d1c3
using homes api
maayarosama Jan 24, 2024
2612bd3
fixing build errors and calender emits
maayarosama Jan 26, 2024
d57007b
Merge branch 'development_1.1' into development_1.1_calender
maayarosama Jan 26, 2024
7f1ab92
Adding birthday and public holiday cards
maayarosama Jan 28, 2024
c94fc45
fixing state user error
maayarosama Jan 28, 2024
c0eb4ab
Remove loading
maayarosama Jan 28, 2024
58f3c3d
Adding vacation balance condition
maayarosama Jan 28, 2024
ec5b131
Merge branch 'development_1.1' into development_1.1_calender
maayarosama Jan 28, 2024
1f1fa83
WIP: Added the expired field, initialized a new refrance from the dat…
Mahmoud-Emad Jan 28, 2024
dc46318
Adding watch to currentDate to execute homes
maayarosama Jan 28, 2024
381441b
Linting.
Mahmoud-Emad Jan 28, 2024
5212de5
Adding v-alert on loading
maayarosama Jan 28, 2024
dd34c62
Enhance the birthday card.
Mahmoud-Emad Jan 28, 2024
ad8adee
Change warning alert to info alert
maayarosama Jan 28, 2024
083a40e
Fix: Fix conflicts.
Mahmoud-Emad Jan 28, 2024
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
2 changes: 1 addition & 1 deletion client/.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Client Related
VITE_TITLE="CSHR"
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"

Expand Down
7 changes: 7 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@
"format": "prettier --write src/"
},
"dependencies": {
"@fullcalendar/core": "^6.1.9",
"@fullcalendar/daygrid": "^6.1.9",
"@fullcalendar/interaction": "^6.1.9",
"@fullcalendar/list": "^6.1.9",
"@fullcalendar/timegrid": "^6.1.9",
"@fullcalendar/vue3": "^6.1.9",
"@mdi/font": "^7.4.47",
"@vueuse/core": "^10.7.1",
"@vueuse/router": "^10.7.1",
"axios": "^1.6.3",
"calendar_options": "link:@fullcalendar/core/calendar_options",
"moment": "^2.30.1",
"pinia": "^2.1.7",
"vue": "^3.3.11",
Expand Down
74 changes: 74 additions & 0 deletions client/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion client/src/clients/api/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
const errorMessage = responseData?.message ?? err.message;

const errorDetails = Object.entries(responseData?.error || {})
.map(([_, value]) => `${value}`)

Check warning on line 75 in client/src/clients/api/base.ts

View workflow job for this annotation

GitHub Actions / Run linters (18.x)

'_' is defined but never used
.join('. ');

return `${errorMessage}${errorDetails ? `. ${capitalize(errorDetails)}` : ''}`;
Expand All @@ -90,11 +90,25 @@
if (access_token && refresh_token && !isValidToken(access_token) && isValidToken(refresh_token)) {
await ApiClientBase.$api.auth.refresh({ refresh: refresh_token })
}
if (err && !ApiClientBase.USER && access_token !== null && refresh_token !== null) {
const user = await ApiClientBase.$api.myprofile.getUser();
ApiClientBase.USER = {...user, access_token, refresh_token}
}

if (err) {

options.disableNotify !== true && ApiClientBase.$notifier?.notify({
type: 'error',
description: options.normalizeError?.(err, res) ?? ApiClientBase.normalizeError(err) ?? err
})

panic(err)
}

if (
(res.config.method === 'post' || res.config.method === 'put') &&
typeof res.data === 'object' &&
'message' in (res.data || {})
'message' in (res.data || {}) && options.disableNotify !== true
) {
ApiClientBase.$notifier?.notify({
type: 'success',
Expand Down
17 changes: 15 additions & 2 deletions client/src/clients/api/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,22 @@ export class EventApi extends ApiClientBase {
this.exact = new EventExactApi(options, this.path)
}

async list() {}
async list(query?: any) {
return this.unwrap(this.$http.get<Api.Returns.List<Api.Inputs.Event>>(this.getUrl('', query)), {
transform: (d) => d.results
})
}

async create(input: Api.Inputs.Event) {
ApiClientBase.assertUser()
const event = await this.unwrap(
this.$http.post<Api.Returns.Event>(this.getUrl(''), input),
{ transform: (d) => d.results }
)

return event
}

async create() {}

async read(id: number) {}

Expand Down
9 changes: 8 additions & 1 deletion client/src/clients/api/home.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import type { Api } from '@/types'
import { ApiClientBase } from './base'

export class HomeApi extends ApiClientBase {
protected readonly path = '/home'

async list() {}
async list(query?: any) {
return this.unwrap(this.$http.get<Api.Returns.List<Api.Home>>(this.getUrl('', query)), {
transform: (d) => d.results
})
}


}
17 changes: 14 additions & 3 deletions client/src/clients/api/meeting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,20 @@ export class MeetingApi extends ApiClientBase {
this.exact = new MeetingExactApi(options)
}

async list() {}

async create() {}
list(query?: any) {
return this.unwrap(this.$http.get<Api.Returns.List<Api.Meetings>>(this.getUrl('', query)), {
transform: (d) => d.results
})
}
async create(input: Api.Inputs.Meeting) {
ApiClientBase.assertUser()
const event = await this.unwrap(
this.$http.post<Api.Returns.Meeting>(this.getUrl(''),input),
{ transform: (d) => d.results }
)

return event
}

async read(id: number) {}

Expand Down
1 change: 0 additions & 1 deletion client/src/clients/api/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export class UsersApi extends ApiClientBase {
...options
})
}

read(id: number) {
return this.unwrap(this.$http.get<Api.Returns.MsgRes<Api.User>>(this.getUrl(`/${id}`)), {
transform: (d) => d.results
Expand Down
66 changes: 57 additions & 9 deletions client/src/clients/api/vacations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,52 @@ export class VacationsApi extends ApiClientBase {
)
return userBalance
}
async list() {}
async list(query?: any) {
return this.unwrap(this.$http.get<Api.Returns.List<Api.Vacation>>(this.getUrl('', query)), {
transform: (d) => d.results
})
}
// async list() {}

async create() {}
async create(input: Api.Inputs.Leave) {
ApiClientBase.assertUser()
const vacation = await this.unwrap(
this.$http.post<Api.Returns.LeaveRequest>(this.getUrl(''), input),
{ transform: (d) => d.results }
)

return vacation
}
async read(id: number) {}

async delete(id: number) {}

async delete(id: number) {
return this.unwrap(this.$http.delete<any>(this.getUrl(`/${id}`)), {
transform: (d) => d.results
})
}
}

class VacationsApproveApi extends ApiClientBase {
protected readonly path = '/approve'

async update(id: number) {}
}
async update(id: any) {
return this.unwrap(this.$http.put<any>(this.getUrl(`/${id}`)), {
transform: (d) => d.results
})
}}

class VacationsRejectApi extends ApiClientBase {
protected readonly path = '/reject'

async read(id: number) {}


async update(id: number) {}
async update(id: number) {
return this.unwrap(this.$http.put<any>(this.getUrl(`/${id}`)), {
transform: (d) => d.results
})
}
}

class VacationsBalanceApi extends ApiClientBase {
Expand Down Expand Up @@ -95,7 +120,16 @@ class VacationsBalanceAdjustmentApi extends ApiClientBase {
class VacationsCalculateApi extends ApiClientBase {
protected readonly path = '/calculate'

async list() {}


async list(query: Api.Inputs.ActualDays) {
ApiClientBase.assertUser()
const calculation = await this.unwrap(
this.$http.get<any>(this.getUrl('', query)),
{ transform: (d) => d.results }
)
return calculation
}
}

class VacationsCommentApi extends ApiClientBase {
Expand All @@ -109,7 +143,16 @@ class VacationsEditApi extends ApiClientBase {

async read(id: number) {}

async update(id: number) {}
async update(id: number, input: Api.Inputs.Leave) {
ApiClientBase.assertUser()
const vacation = await this.unwrap(
this.$http.put<Api.Returns.LeaveRequest>(this.getUrl(`/${id}`), input),
{ transform: (d) => d.results }
)

return vacation
}
// async update(id: number) {}
}

class VacationsGetAdminBalanceApi extends ApiClientBase {
Expand Down Expand Up @@ -140,5 +183,10 @@ class VacationsPostAdminBalanceApi extends ApiClientBase {
class VacationsUserApi extends ApiClientBase {
protected readonly path = '/user'

async list() {}
async list(query?: any) {
return this.unwrap(this.$http.get<Api.Returns.List<Api.Vacation>>(this.getUrl('', query)), {
transform: (d) => d.results
})
}

}
14 changes: 3 additions & 11 deletions client/src/components/CshrToolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,7 @@
<template #activator="{ props }">
<div class="d-flex justify-center align-center mx-2">
<VProgressCircular indeterminate v-if="user.isLoading.value" />
<VAvatar
v-else-if="user.state.value"
v-ripple
v-bind="props"
color="primary"
class="border"
:style="{ cursor: 'pointer' }"
>
<span class="text-h5 text-uppercase" v-text="user.state.value?.full_name[0] ?? '?'" />
</VAvatar>
<profileImage v-else-if="user.state.value" :with-link="true" :user="user.state.value" v-bind="props" />
</div>
</template>

Expand All @@ -79,10 +70,11 @@ import { useApi } from '@/hooks'
import { getStatusColor } from '@/utils'
import type { Api } from '@/types'
import NotificationDetailsDialog from './NotificationDetailsDialog.vue'
import profileImage from './profileImage.vue'

export default {
name: 'CshrToolbar',
components: { NotificationDetailsDialog },
components: { NotificationDetailsDialog, profileImage },
setup() {
const $api = useApi()
const user = useAsyncState(() => $api.myprofile.getUser(), null)
Expand Down
Loading
Loading