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

Projects page #985

Merged
merged 29 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
78acd79
fix: show vuestic-ui types
m0ksem Nov 3, 2023
a60bb3d
raw: init users page
m0ksem Nov 3, 2023
b0246f8
chore: update vuestic-ui and remove hotfixes
m0ksem Nov 6, 2023
e41bece
fix: satiesfies eslint error
m0ksem Nov 13, 2023
9ece03e
fix: statiesfies prettier warning
m0ksem Nov 13, 2023
21f957f
chore: apply prettier fixes
m0ksem Nov 13, 2023
ea02e30
feat(users): finish users page
m0ksem Nov 13, 2023
0c2215c
chore: small refactoring
m0ksem Nov 14, 2023
4252010
chore: fix vue warning
m0ksem Nov 14, 2023
7f88a9c
Merge branch 'develop' into fix#968/users-page
asvae Nov 15, 2023
a30b78a
chore(users): remove extra stores and components
m0ksem Nov 22, 2023
92e61f9
feat(users): add confirmation window and toasts.
m0ksem Nov 22, 2023
5fa8386
fix(users): add active checkbox to edit form
m0ksem Nov 22, 2023
f92b1b2
fix(users): blob avatar rendering
m0ksem Nov 22, 2023
e794493
chore: remove todo
m0ksem Nov 22, 2023
1d48b8e
Merge branch 'develop' into fix#968/users-page
m0ksem Nov 22, 2023
2a93bac
chore: eslint fixes
m0ksem Nov 22, 2023
18e92a0
chore: improve users page
m0ksem Nov 28, 2023
02cf7b5
init projects page
m0ksem Nov 28, 2023
c58f1ae
feat(projects): finish projects page
m0ksem Nov 29, 2023
8b9ae88
fix: typo
m0ksem Nov 29, 2023
1881f29
chore(users): more meaningful projects column
m0ksem Dec 1, 2023
268e9dd
chore: fix ts issues
m0ksem Dec 4, 2023
1bc8c9a
fix: date format in project creation
m0ksem Dec 4, 2023
93d3d34
chore: add ProjectStatusBadge component and update
m0ksem Dec 4, 2023
8cdb370
chore: refactor projects. allow to select project in user edit form.
m0ksem Dec 5, 2023
a59532e
fix: correct track-by for selects
m0ksem Dec 5, 2023
c3f98dd
Merge branch 'develop' into fix#984/projects-page
m0ksem Dec 5, 2023
39b0aa5
chore: eslint fix
m0ksem Dec 5, 2023
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@fortawesome/fontawesome-free": "^6.1.1",
"@gtm-support/vue-gtm": "^2.0.0",
"@vuestic/tailwind": "^0.1.3",
"@vueuse/core": "^10.6.1",
"axios": "^1.6.1",
"chart.js": "^3.8.0",
"epic-spinners": "^2.0.0",
Expand Down
8 changes: 8 additions & 0 deletions src/components/sidebar/NavigationRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,14 @@ export default {
name: 'pricing-plans',
displayName: 'menu.pricing-plans',
},
{
name: 'users',
displayName: 'menu.users',
},
{
name: 'projects',
displayName: 'menu.projects',
},
{
name: 'settings',
displayName: 'menu.settings',
Expand Down
82 changes: 82 additions & 0 deletions src/data/pages/projects-db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[
{
"id": 0,
"project_name": "A Vuestic",
"project_owner": 13,
"team": [13, 5, 28, 14, 17, 28, 23, 11, 16, 19, 12, 28, 11],
"status": "in progress",
"creation_date": "20 Nov 2023"
},
{
"id": 1,
"project_name": "Mood board",
"project_owner": 28,
"team": [28, 10, 12, 28, 14, 27, 5, 4, 8, 23, 19, 18, 24, 11, 18, 12, 28],
"status": "important",
"creation_date": "16 Oct 2023"
},
{
"id": 2,
"project_name": "J Jenkins",
"project_owner": 3,
"team": [3, 21, 7, 19, 4, 4, 7, 24],
"status": "important",
"creation_date": "1 Oct 2023"
},
{
"id": 3,
"project_name": "S Springfield media",
"project_owner": 17,
"team": [17, 25, 21, 9, 18, 12, 15, 0, 7, 2, 7],
"status": "important",
"creation_date": "19 Sept 2023"
},
{
"id": 4,
"project_name": "G Galileo",
"project_owner": 7,
"team": [7, 1, 28, 19, 3],
"status": "completed",
"creation_date": "23 Sept 2023"
},
{
"id": 5,
"project_name": "O Website Redesign",
"project_owner": 24,
"team": [24, 19, 1, 8, 9],
"status": "completed",
"creation_date": "9 Sept 2023"
},
{
"id": 6,
"project_name": "U Website Redesign",
"project_owner": 15,
"team": [15, 16, 8, 6, 11, 21, 3, 20],
"status": "archived",
"creation_date": "17 Aug 2023"
},
{
"id": 7,
"project_name": "L Complete Product Redesign",
"project_owner": 25,
"team": [25, 18, 24, 13, 5, 3, 4, 16, 25, 12, 18, 9, 22],
"status": "completed",
"creation_date": "11 Aug 2023"
},
{
"id": 8,
"project_name": "Design Team Project",
"project_owner": 17,
"team": [17, 6, 21, 17, 7, 6, 14, 13, 27, 7, 20],
"status": "archived",
"creation_date": "9 Aug 2023"
},
{
"id": 9,
"project_name": "R Regular logistics",
"project_owner": 3,
"team": [3, 26, 8, 15, 21, 23, 18, 11, 22, 6, 20, 9],
"status": "archived",
"creation_date": "2 Aug 2023"
}
]
82 changes: 82 additions & 0 deletions src/data/pages/projects.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { sleep } from '../../services/utils'
import projectsDb from './projects-db.json'
import usersDb from './users-db.json'

// Simulate API calls
export type Pagination = {
page: number
perPage: number
total: number
}

export type Sorting = {
sortBy: keyof (typeof projectsDb)[number] | undefined
sortingOrder: 'asc' | 'desc' | null
}

export const getProjects = async (options: Sorting & Pagination) => {
await sleep(1000)

const projects = projectsDb.map((project) => ({
...project,
project_owner: usersDb.find((user) => user.id === project.project_owner)! as (typeof usersDb)[number],
team: usersDb.filter((user) => project.team.includes(user.id)) as (typeof usersDb)[number][],
}))

if (options.sortBy && options.sortingOrder) {
projects.sort((a, b) => {
if (a[options.sortBy!] < b[options.sortBy!]) {
return options.sortingOrder === 'asc' ? -1 : 1
}
if (a[options.sortBy!] > b[options.sortBy!]) {
return options.sortingOrder === 'asc' ? 1 : -1
}
return 0
})
}

return {
data: projects,
pagination: {
page: options.page,
perPage: options.perPage,
total: projectsDb.length,
},
}
}

export const addProject = async (project: Omit<(typeof projectsDb)[number], 'id' | 'creation_date'>) => {
await sleep(1000)

const newProject = {
...project,
id: projectsDb.length + 1,
creation_date: new Date().toLocaleDateString('gb', { day: 'numeric', month: 'short', year: 'numeric' }),
}

projectsDb.push(newProject)

return {
...newProject,
project_owner: usersDb.find((user) => user.id === project.project_owner)! as (typeof usersDb)[number],
team: usersDb.filter((user) => project.team.includes(user.id)) as (typeof usersDb)[number][],
}
}

export const updateProject = async (project: (typeof projectsDb)[number]) => {
await sleep(1000)

const index = projectsDb.findIndex((p) => p.id === project.id)
projectsDb[index] = project

return project
}

export const removeProject = async (project: (typeof projectsDb)[number]) => {
await sleep(1000)

const index = projectsDb.findIndex((p) => p.id === project.id)
projectsDb.splice(index, 1)

return project
}
Loading