@campxdev/campx-web-utils 0.2.13 → 0.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/selectors/FeeTypeSelector.tsx +14 -2
- package/src/selectors/HostelFloorSelector.tsx +18 -0
- package/src/selectors/HostelRoomSelector.tsx +19 -0
- package/src/selectors/YearRangeSelector.tsx +26 -0
- package/src/selectors/export.ts +5 -0
- package/src/selectors/utils.tsx +34 -0
package/package.json
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { SingleSelect, SingleSelectProps } from '@campxdev/react-blueprint';
|
|
2
|
+
import { FeeTypes } from './utils';
|
|
3
|
+
|
|
4
|
+
export const FeeTypeSelector = (props: SingleSelectProps) => {
|
|
5
|
+
return (
|
|
6
|
+
<SingleSelect
|
|
7
|
+
label="Fee Type"
|
|
8
|
+
options={FeeTypes?.map((item: { label: string; value: string }) => ({
|
|
9
|
+
label: item.label,
|
|
10
|
+
value: item.value,
|
|
11
|
+
}))}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
3
15
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SingleSelect, SingleSelectProps } from '@campxdev/react-blueprint';
|
|
2
|
+
import { years } from './utils';
|
|
3
|
+
|
|
4
|
+
export const HostelFloorSelector = (props: SingleSelectProps) => {
|
|
5
|
+
return (
|
|
6
|
+
<SingleSelect
|
|
7
|
+
label="Hostel Room No."
|
|
8
|
+
dbValueProps={{
|
|
9
|
+
valueKey: 'floor',
|
|
10
|
+
}}
|
|
11
|
+
dbLabelProps={{
|
|
12
|
+
labelKey: 'floor',
|
|
13
|
+
}}
|
|
14
|
+
optionsApiEndPoint="dropdowns/floors"
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SingleSelect, SingleSelectProps } from '@campxdev/react-blueprint';
|
|
2
|
+
import { years } from './utils';
|
|
3
|
+
|
|
4
|
+
export const HostelRoomSelector = (props: SingleSelectProps) => {
|
|
5
|
+
return (
|
|
6
|
+
<SingleSelect
|
|
7
|
+
label="Hostel Room No."
|
|
8
|
+
dbValueProps={{
|
|
9
|
+
valueKey: 'id',
|
|
10
|
+
}}
|
|
11
|
+
dbLabelProps={{
|
|
12
|
+
labelKey: 'room_number',
|
|
13
|
+
subLabelKey: 'floor',
|
|
14
|
+
}}
|
|
15
|
+
optionsApiEndPoint="dropdowns/hostel-rooms"
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SingleSelect, SingleSelectProps } from '@campxdev/react-blueprint';
|
|
2
|
+
import { years } from './utils';
|
|
3
|
+
|
|
4
|
+
interface YearRangeSelectorProps extends SingleSelectProps {
|
|
5
|
+
suffix?: string | null;
|
|
6
|
+
valueKey?: 'yearRange' | 'year';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const YearRangeSelector = ({
|
|
10
|
+
suffix = null,
|
|
11
|
+
valueKey = 'yearRange',
|
|
12
|
+
...props
|
|
13
|
+
}: YearRangeSelectorProps) => {
|
|
14
|
+
return (
|
|
15
|
+
<SingleSelect
|
|
16
|
+
label="Year Range"
|
|
17
|
+
options={years?.map((year: number) => ({
|
|
18
|
+
label: suffix
|
|
19
|
+
? `${suffix} ${year} - ${year + 1}`
|
|
20
|
+
: `${year} - ${year + 1}`,
|
|
21
|
+
value: valueKey === 'yearRange' ? `${year} - ${year + 1}` : year,
|
|
22
|
+
}))}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
};
|
package/src/selectors/export.ts
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const FeeTypes: {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
}[] = [
|
|
5
|
+
{
|
|
6
|
+
label: 'Tuition Fee',
|
|
7
|
+
value: 'tuition_fee',
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
{
|
|
11
|
+
label: 'Admission Fee',
|
|
12
|
+
value: 'admission_fee',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: 'Hostel Fee',
|
|
16
|
+
value: 'hostel_fee',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: 'Transport Fee',
|
|
20
|
+
value: 'transport_fee',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: 'Exam Fee',
|
|
24
|
+
value: 'exam_fee',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: 'Other Fee',
|
|
28
|
+
value: 'other_fee',
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
export const years = Array.from({ length: 6 }, (_, i) => {
|
|
33
|
+
return new Date().getFullYear() - i;
|
|
34
|
+
});
|