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

feat: campaign application admin init #1867

Merged
merged 4 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 7 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ module.exports = {
endOfLine: 'auto',
},
],
'no-restricted-imports': ["error", {
"name": "react-i18next",
"message": "Please use next-i18next"
}]
'no-restricted-imports': [
'error',
{
name: 'react-i18next',
message: 'Please use next-i18next',
},
],
},
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ Watch releases of this repository to be notified about future updates:
## Contributors ✨

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

[![All Contributors](https://img.shields.io/badge/all_contributors-82-orange.svg?style=flat-square)](#contributors-)

<!-- ALL-CONTRIBUTORS-BADGE:END -->

Please check [contributors guide](https://github.com/podkrepi-bg/frontend/blob/master/CONTRIBUTING.md) for:
Expand Down
4 changes: 4 additions & 0 deletions src/common/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ export const routes = {
viewCampaignBySlug: (slug: string) => `/admin/campaigns/${slug}`,
edit: (id: string) => `/admin/campaigns/edit/${id}`,
},
campaignApplications: {
index: '/admin/campaign-applications',
edit: (id: string) => `/admin/campaign-applications/edit/${id}`,
},
news: {
index: '/admin/campaign-news',
create: '/admin/campaign-news/create',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { useTranslation } from 'next-i18next'

import EditOutlinedIcon from '@mui/icons-material/EditOutlined'
import { IconButton } from '@mui/material'
import { routes } from 'common/routes'
import AdminContainer from 'components/common/navigation/AdminContainer'
import AdminLayout from 'components/common/navigation/AdminLayout'
import Link from 'next/link'

export default function CampaignApplicationsPage() {
const { t } = useTranslation('campaigns')

return (
<AdminLayout>
<AdminContainer title={t('Кандидат Кампании')}>
<div>Campaigns will appear here</div>
<Link href={routes.admin.campaignApplications.edit('mock-id')} passHref>
<IconButton size="small" color="primary">
<EditOutlinedIcon />
takes you to edit page
</IconButton>
</Link>
</AdminContainer>
</AdminLayout>
)
}
36 changes: 36 additions & 0 deletions src/components/admin/campaign-applications/EditPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { CampaignApplicationFormData } from 'components/client/campaign-application/helpers/campaignApplication.types'
import CampaignApplication from 'components/client/campaign-application/steps/CampaignApplication'
import CampaignApplicationDetails from 'components/client/campaign-application/steps/CampaignApplicationDetails'
import CampaignApplicationOrganizer from 'components/client/campaign-application/steps/CampaignApplicationOrganizer'
import GenericForm from 'components/common/form/GenericForm'
import AdminContainer from 'components/common/navigation/AdminContainer'
import AdminLayout from 'components/common/navigation/AdminLayout'

export default function EditPage() {
const initialValues = {
organizer: {
name: '',
phone: '',
email: '',
},
} as CampaignApplicationFormData

return (
<AdminLayout>
<AdminContainer title={'Кандидат Кампании'}>
Will layout all the steps from the stepper plus the admin step
<GenericForm<CampaignApplicationFormData>
onSubmit={(v) => console.log(v)}
initialValues={initialValues}>
<CampaignApplicationOrganizer />
</GenericForm>
<div>.</div>
<CampaignApplication />
<div>.</div>
<CampaignApplicationDetails />
<div>.</div>
Edit the status and ticket URL here
</AdminContainer>
</AdminLayout>
)
}
10 changes: 10 additions & 0 deletions src/components/common/navigation/adminMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ export const menuPeople = [
]
export const menuCampaings = [
{ label: 'Кампании', icon: AssignmentInd, href: routes.admin.campaigns.index },
{
label: 'Кандидат Кампании',
icon: AssignmentInd,
href: routes.admin.campaignApplications.index,
},
{ label: 'Новини', icon: ArticleOutlined, href: routes.admin.news.index },
{ label: 'Документи', icon: FolderShared, href: routes.admin.documents.index },
{ label: 'Злоупотреби', icon: ReportGmailerrorredIcon, href: routes.admin.irregularity.index },
Expand Down Expand Up @@ -73,6 +78,11 @@ export const items = [

export const adminCards = [
{ label: 'Кампании', icon: AssignmentInd, href: routes.admin.campaigns.index },
{
label: 'Кандидат Кампании',
icon: AssignmentInd,
href: routes.admin.campaignApplications.index,
},
{ label: 'Новини', icon: ArticleOutlined, href: routes.admin.news.index },
{ label: 'Плащания', icon: PaymentsIcon, href: routes.admin.payments.index },
{ label: 'Дарения', icon: VolunteerActivismOutlinedIcon, href: routes.admin.donations.index },
Expand Down
7 changes: 7 additions & 0 deletions src/pages/admin/campaign-applications/edit/[id].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import EditPage from 'components/admin/campaign-applications/EditPage'

import { securedPropsWithTranslation } from 'middleware/auth/securedProps'

export const getServerSideProps = securedPropsWithTranslation()

export default EditPage
6 changes: 6 additions & 0 deletions src/pages/admin/campaign-applications/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import CampaignApplications from 'components/admin/campaign-applications/CampaignApplications'
import { securedPropsWithTranslation } from 'middleware/auth/securedProps'

export const getServerSideProps = securedPropsWithTranslation()

export default CampaignApplications
Loading