Skip to content

Commit 826729f

Browse files
committed
feat(resources): Added resources listing and edit add form
1 parent e017696 commit 826729f

27 files changed

Lines changed: 588 additions & 31 deletions

File tree

app/root/config/routes.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,27 @@ const users: RouteConfig = {
251251
visibility: 'is-authenticated',
252252
};
253253

254+
const resources: RouteConfig = {
255+
index: true,
256+
path: 'resources',
257+
load: () => import('#views/Resources/ResourcesList'),
258+
visibility: 'is-authenticated',
259+
};
260+
261+
const editResources: RouteConfig = {
262+
index: true,
263+
path: 'resources/:id/edit',
264+
load: () => import('#views/Resources/ResourcesForm'),
265+
visibility: 'is-authenticated',
266+
};
267+
268+
const addResources: RouteConfig = {
269+
index: true,
270+
path: 'resources/add',
271+
load: () => import('#views/Resources/ResourcesForm'),
272+
visibility: 'is-authenticated',
273+
};
274+
254275
const routes = {
255276
login,
256277
home,
@@ -288,6 +309,9 @@ const routes = {
288309
editStrategicDirectives,
289310
strategicDirectives,
290311
users,
312+
resources,
313+
addResources,
314+
editResources,
291315
};
292316

293317
export type RouteKeys = keyof typeof routes;

app/root/index.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,28 @@ const cookies = new Cookies();
2525
const gqlClient = new Client({
2626
url: GRAPHQL_ENDPOINT,
2727
exchanges: [
28-
cacheExchange({}),
28+
cacheExchange({
29+
keys: {
30+
OffsetPaginationInfo: () => null,
31+
BlogTypeOffsetPaginated: () => null,
32+
DepartmentTypeOffsetPaginated: () => null,
33+
FaqTypeOffsetPaginated: () => null,
34+
StrategicDirectivesTypeOffsetPaginated: () => null,
35+
HighlightTypeOffsetPaginated: () => null,
36+
ProcurementTypeOffsetPaginated: () => null,
37+
NewsTypeOffsetPaginated: () => null,
38+
ProjectTypeOffsetPaginated: () => null,
39+
PartnerTypeOffsetPaginated: () => null,
40+
RadioProgramTypeOffsetPaginated: () => null,
41+
VacancyTypeOffsetPaginated: () => null,
42+
DjangoFileType: () => null,
43+
ResourceTypeOffsetPaginated: () => null,
44+
UserTypeOffsetPaginated: () => null,
45+
JobVacancyTypeOffsetPaginated: () => null,
46+
MajorResponsibilitiesTypeOffsetPaginated: () => null,
47+
48+
},
49+
}),
2950
fetchExchange,
3051
],
3152
fetchOptions: () => ({

app/views/Blog/query.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,11 @@ const BLOG_QUERY = gql`
1717
directiveId
1818
featured
1919
id
20-
modifiedAt
2120
coverImage {
2221
name
2322
size
2423
url
2524
}
26-
createdBy {
27-
firstName
28-
lastName
29-
}
3025
publishedDate
3126
slug
3227
status
@@ -51,6 +46,7 @@ const BLOG_DETAIL_QUERY = gql`
5146
featured
5247
id
5348
modifiedBy {
49+
id
5450
firstName
5551
lastName
5652
}
@@ -59,6 +55,7 @@ const BLOG_DETAIL_QUERY = gql`
5955
status
6056
title
6157
createdBy {
58+
id
6259
firstName
6360
lastName
6461
}

app/views/Department/query.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const DEPARTMENT_QUERY = gql`
1515
title
1616
id
1717
strategicDirective {
18+
id
1819
title
1920
}
2021
}
@@ -35,8 +36,10 @@ const DEPARTMENT_DETAIL = gql`
3536
createdBy {
3637
firstName
3738
lastName
39+
id
3840
}
3941
modifiedBy {
42+
id
4043
firstName
4144
lastName
4245
}

app/views/FAQs/FAQsForm/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ function FAQsForm() {
139139
return (
140140
<Page>
141141
<ContainerWrapper>
142-
<FormSection headingLevel={3} label="FAQs DETAIL" />
142+
<FormSection headingLevel={3} label={id ? 'FAQs DETAIL' : 'CREATE FAQ'} />
143143
<Activity mode={value.createdBy && value.modifiedBy ? 'visible' : 'hidden'}>
144144
<FormSection>
145145
<Heading level={6}>

app/views/Highlight/HighlightForm/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ function HighlightForm() {
306306
return (
307307
<Page>
308308
<ContainerWrapper>
309-
<FormSection headingLevel={3} label="FAQS DETAIL" />
309+
<FormSection headingLevel={3} label={id ? 'HIGHLIGHT DETAILS' : 'CREATE HIGHLIGHT'} />
310310
<Activity mode={value.createdBy && value.modifiedBy ? 'visible' : 'hidden'}>
311311
<FormSection>
312312
<Heading level={6}>

app/views/Highlight/query.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const HIGHLIGHT_QUERY = gql`
1616
url
1717
}
1818
createdBy {
19+
id
1920
firstName
2021
lastName
2122
}
@@ -42,6 +43,7 @@ const HIGHLIGHT_DETAIL = gql`
4243
url
4344
}
4445
createdBy {
46+
id
4547
firstName
4648
lastName
4749
}
@@ -55,6 +57,7 @@ const HIGHLIGHT_DETAIL = gql`
5557
}
5658
isActive
5759
modifiedBy {
60+
id
5861
firstName
5962
lastName
6063
}

app/views/News/NewsForm/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ function NewsForm() {
195195
return (
196196
<Page>
197197
<ContainerWrapper>
198-
<FormSection headingLevel={3} label="NEWS DETAILS" />
198+
<FormSection headingLevel={3} label={id ? 'NEWS DETAILS' : 'CREATE NEWS'} />
199199
<Activity mode={value.createdBy && value.modifiedBy ? 'visible' : 'hidden'}>
200200
<FormSection>
201201
<Heading level={6}>

app/views/Partner/PartnerForm/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ function PartnerForm() {
153153
return (
154154
<Page>
155155
<ContainerWrapper>
156-
<FormSection headingLevel={3} label="PARTNER DETAILS" />
156+
<FormSection headingLevel={3} label={id ? 'PARTNER DETAILS' : 'CREATE PARTNER'} />
157157
<Activity mode={value.createdBy && value.modifiedBy ? 'visible' : 'hidden'}>
158158
<FormSection>
159159
<Heading level={6}>
@@ -178,7 +178,7 @@ function PartnerForm() {
178178
autoFocus
179179
/>
180180
</FormSection>
181-
<FormSection label="Status" description="Add status to either global or local" withAsteriskOnTitle>
181+
<FormSection label="Scope" description="Add scope to either global or local" withAsteriskOnTitle>
182182
<SelectInput
183183
name="scope"
184184
options={scopeOptions}

app/views/Partner/PartnerList/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function PartnerList() {
6262

6363
const columns = useMemo(() => [
6464
createNumberColumn<PartnerListItem & { sn: number }, string | number>('sn', 'S.N.', (item) => item.sn, { columnWidth: 60 }),
65-
createStringColumn<PartnerListItem, string | number>('title', 'Tile', (dept) => dept.title),
65+
createStringColumn<PartnerListItem, string | number>('title', 'Title', (dept) => dept.title),
6666
createStringColumn<PartnerListItem, string | number>('scope', 'Scope', (dept) => dept?.scope),
6767
createElementColumn<PartnerListItem, string | number, TableActionsProps>(
6868
'actions',

0 commit comments

Comments
 (0)