Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3fba62ad32 | ||
|
|
5a85e1a828 |
11
SECURITY.md
11
SECURITY.md
@ -1,11 +0,0 @@
|
|||||||
# Security Policy
|
|
||||||
|
|
||||||
## Supported Versions
|
|
||||||
|
|
||||||
| Version | Supported |
|
|
||||||
| ------- | ------------------ |
|
|
||||||
| MVP.1.x | :white_check_mark: |
|
|
||||||
|
|
||||||
## Reporting a Vulnerability
|
|
||||||
|
|
||||||
Report any issues with the "Issues" section here in the GitHub repository, and be sure to mark it with a "Security" label in addition to any other labels that may help categorieze (bug, enhancement etc.)
|
|
||||||
File diff suppressed because one or more lines are too long
@ -14,7 +14,7 @@ export const localStorageStyleKey = 'style';
|
|||||||
|
|
||||||
export const containerMaxW = 'xl:max-w-full xl:mx-auto 2xl:mx-20';
|
export const containerMaxW = 'xl:max-w-full xl:mx-auto 2xl:mx-20';
|
||||||
|
|
||||||
export const appTitle = '';
|
export const appTitle = 'created by Flatlogic generator!';
|
||||||
|
|
||||||
export const getPageTitle = (currentPageTitle: string) =>
|
export const getPageTitle = (currentPageTitle: string) =>
|
||||||
`${currentPageTitle} — ${appTitle}`;
|
`${currentPageTitle} — ${appTitle}`;
|
||||||
|
|||||||
@ -8,18 +8,6 @@ const menuAside: MenuAsideItem[] = [
|
|||||||
label: 'Dashboard',
|
label: 'Dashboard',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
href: '/scanned_documents/scanned_documents-list',
|
|
||||||
label: 'Claims',
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-ignore
|
|
||||||
icon:
|
|
||||||
'mdiFileDocument' in icon
|
|
||||||
? icon['mdiFileDocument' as keyof typeof icon]
|
|
||||||
: icon.mdiTable ?? icon.mdiTable,
|
|
||||||
permissions: 'READ_SCANNED_DOCUMENTS',
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
href: '/batches/batches-list',
|
href: '/batches/batches-list',
|
||||||
label: 'Batches',
|
label: 'Batches',
|
||||||
@ -31,7 +19,6 @@ const menuAside: MenuAsideItem[] = [
|
|||||||
: icon.mdiTable ?? icon.mdiTable,
|
: icon.mdiTable ?? icon.mdiTable,
|
||||||
permissions: 'READ_BATCHES',
|
permissions: 'READ_BATCHES',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
href: '/logs/logs-list',
|
href: '/logs/logs-list',
|
||||||
label: 'Logs',
|
label: 'Logs',
|
||||||
@ -43,6 +30,22 @@ const menuAside: MenuAsideItem[] = [
|
|||||||
: icon.mdiTable ?? icon.mdiTable,
|
: icon.mdiTable ?? icon.mdiTable,
|
||||||
permissions: 'READ_LOGS',
|
permissions: 'READ_LOGS',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
href: '/scanned_documents/scanned_documents-list',
|
||||||
|
label: 'Scanned documents',
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
|
icon:
|
||||||
|
'mdiFileDocument' in icon
|
||||||
|
? icon['mdiFileDocument' as keyof typeof icon]
|
||||||
|
: icon.mdiTable ?? icon.mdiTable,
|
||||||
|
permissions: 'READ_SCANNED_DOCUMENTS',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: '/profile',
|
||||||
|
label: 'Profile',
|
||||||
|
icon: icon.mdiAccountCircle,
|
||||||
|
},
|
||||||
|
|
||||||
{ withDivider: true, permissions: 'READ_USERS' },
|
{ withDivider: true, permissions: 'READ_USERS' },
|
||||||
{ label: 'System Settings', isSectionHeader: true, permissions: 'READ_USERS' },
|
{ label: 'System Settings', isSectionHeader: true, permissions: 'READ_USERS' },
|
||||||
|
|||||||
@ -12,13 +12,21 @@ import BaseButton from '../../components/BaseButton';
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { useAppDispatch, useAppSelector } from '../../stores/hooks';
|
import { useAppDispatch, useAppSelector } from '../../stores/hooks';
|
||||||
|
import CardBoxModal from '../../components/CardBoxModal';
|
||||||
|
import DragDropFilePicker from '../../components/DragDropFilePicker';
|
||||||
|
import { setRefetch, uploadCsv } from '../../stores/batches/batchesSlice';
|
||||||
|
|
||||||
import { hasPermission } from '../../helpers/userPermissions';
|
import { hasPermission } from '../../helpers/userPermissions';
|
||||||
|
|
||||||
const BatchesTablesPage = () => {
|
const BatchesTablesPage = () => {
|
||||||
const [filterItems, setFilterItems] = useState([]);
|
const [filterItems, setFilterItems] = useState([]);
|
||||||
|
const [csvFile, setCsvFile] = useState<File | null>(null);
|
||||||
|
const [isModalActive, setIsModalActive] = useState(false);
|
||||||
const [showTableView, setShowTableView] = useState(false);
|
const [showTableView, setShowTableView] = useState(false);
|
||||||
|
|
||||||
|
const { currentUser } = useAppSelector((state) => state.auth);
|
||||||
|
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const currentUser = useAppSelector((state) => state.auth.currentUser);
|
|
||||||
|
|
||||||
const [filters] = useState([
|
const [filters] = useState([
|
||||||
{ label: 'BatchNumber', title: 'batch_number' },
|
{ label: 'BatchNumber', title: 'batch_number' },
|
||||||
@ -67,6 +75,18 @@ const BatchesTablesPage = () => {
|
|||||||
link.click();
|
link.click();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onModalConfirm = async () => {
|
||||||
|
if (!csvFile) return;
|
||||||
|
await dispatch(uploadCsv(csvFile));
|
||||||
|
dispatch(setRefetch(true));
|
||||||
|
setCsvFile(null);
|
||||||
|
setIsModalActive(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onModalCancel = () => {
|
||||||
|
setCsvFile(null);
|
||||||
|
setIsModalActive(false);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -104,6 +124,13 @@ const BatchesTablesPage = () => {
|
|||||||
onClick={getBatchesCSV}
|
onClick={getBatchesCSV}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{hasCreatePermission && (
|
||||||
|
<BaseButton
|
||||||
|
color='info'
|
||||||
|
label='Upload CSV'
|
||||||
|
onClick={() => setIsModalActive(true)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
<div className='md:inline-flex items-center ms-auto'>
|
<div className='md:inline-flex items-center ms-auto'>
|
||||||
<div id='delete-rows-button'></div>
|
<div id='delete-rows-button'></div>
|
||||||
@ -121,6 +148,21 @@ const BatchesTablesPage = () => {
|
|||||||
showGrid={false}
|
showGrid={false}
|
||||||
/>
|
/>
|
||||||
</SectionMain>
|
</SectionMain>
|
||||||
|
<CardBoxModal
|
||||||
|
title='Upload CSV'
|
||||||
|
buttonColor='info'
|
||||||
|
buttonLabel={'Confirm'}
|
||||||
|
// buttonLabel={false ? 'Deleting...' : 'Confirm'}
|
||||||
|
isActive={isModalActive}
|
||||||
|
onConfirm={onModalConfirm}
|
||||||
|
onCancel={onModalCancel}
|
||||||
|
>
|
||||||
|
<DragDropFilePicker
|
||||||
|
file={csvFile}
|
||||||
|
setFile={setCsvFile}
|
||||||
|
formats={'.csv'}
|
||||||
|
/>
|
||||||
|
</CardBoxModal>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,185 +0,0 @@
|
|||||||
import { mdiChartTimelineVariant, mdiUpload } from '@mdi/js';
|
|
||||||
import Head from 'next/head';
|
|
||||||
import React, { ReactElement, useEffect, useState } from 'react';
|
|
||||||
import DatePicker from 'react-datepicker';
|
|
||||||
import 'react-datepicker/dist/react-datepicker.css';
|
|
||||||
import dayjs from 'dayjs';
|
|
||||||
|
|
||||||
import CardBox from '../../components/CardBox';
|
|
||||||
import LayoutAuthenticated from '../../layouts/Authenticated';
|
|
||||||
import SectionMain from '../../components/SectionMain';
|
|
||||||
import SectionTitleLineWithButton from '../../components/SectionTitleLineWithButton';
|
|
||||||
import { getPageTitle } from '../../config';
|
|
||||||
|
|
||||||
import { Field, Form, Formik } from 'formik';
|
|
||||||
import FormField from '../../components/FormField';
|
|
||||||
import BaseDivider from '../../components/BaseDivider';
|
|
||||||
import BaseButtons from '../../components/BaseButtons';
|
|
||||||
import BaseButton from '../../components/BaseButton';
|
|
||||||
import FormCheckRadio from '../../components/FormCheckRadio';
|
|
||||||
import FormCheckRadioGroup from '../../components/FormCheckRadioGroup';
|
|
||||||
import FormFilePicker from '../../components/FormFilePicker';
|
|
||||||
import FormImagePicker from '../../components/FormImagePicker';
|
|
||||||
import { SelectField } from '../../components/SelectField';
|
|
||||||
import { SelectFieldMany } from '../../components/SelectFieldMany';
|
|
||||||
import { SwitchField } from '../../components/SwitchField';
|
|
||||||
import { RichTextField } from '../../components/RichTextField';
|
|
||||||
|
|
||||||
import {
|
|
||||||
update,
|
|
||||||
fetch,
|
|
||||||
} from '../../stores/scanned_documents/scanned_documentsSlice';
|
|
||||||
import { useAppDispatch, useAppSelector } from '../../stores/hooks';
|
|
||||||
import { useRouter } from 'next/router';
|
|
||||||
import { saveFile } from '../../helpers/fileSaver';
|
|
||||||
import dataFormatter from '../../helpers/dataFormatter';
|
|
||||||
import ImageField from '../../components/ImageField';
|
|
||||||
|
|
||||||
const EditScanned_documents = () => {
|
|
||||||
const router = useRouter();
|
|
||||||
const dispatch = useAppDispatch();
|
|
||||||
const initVals = {
|
|
||||||
file_name: '',
|
|
||||||
|
|
||||||
file: [],
|
|
||||||
|
|
||||||
uploaded_at: new Date(),
|
|
||||||
|
|
||||||
uploaded_by: null,
|
|
||||||
};
|
|
||||||
const [initialValues, setInitialValues] = useState(initVals);
|
|
||||||
|
|
||||||
const { scanned_documents } = useAppSelector(
|
|
||||||
(state) => state.scanned_documents,
|
|
||||||
);
|
|
||||||
|
|
||||||
const { scanned_documentsId } = router.query;
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
dispatch(fetch({ id: scanned_documentsId }));
|
|
||||||
}, [scanned_documentsId]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (typeof scanned_documents === 'object') {
|
|
||||||
setInitialValues(scanned_documents);
|
|
||||||
}
|
|
||||||
}, [scanned_documents]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (typeof scanned_documents === 'object') {
|
|
||||||
const newInitialVal = { ...initVals };
|
|
||||||
|
|
||||||
Object.keys(initVals).forEach(
|
|
||||||
(el) => (newInitialVal[el] = scanned_documents[el]),
|
|
||||||
);
|
|
||||||
|
|
||||||
setInitialValues(newInitialVal);
|
|
||||||
}
|
|
||||||
}, [scanned_documents]);
|
|
||||||
|
|
||||||
const handleSubmit = async (data) => {
|
|
||||||
await dispatch(update({ id: scanned_documentsId, data }));
|
|
||||||
await router.push('/scanned_documents/scanned_documents-list');
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Head>
|
|
||||||
<title>{getPageTitle('Edit scanned_documents')}</title>
|
|
||||||
</Head>
|
|
||||||
<SectionMain>
|
|
||||||
<SectionTitleLineWithButton
|
|
||||||
icon={mdiChartTimelineVariant}
|
|
||||||
title={'Edit scanned_documents'}
|
|
||||||
main
|
|
||||||
>
|
|
||||||
{''}
|
|
||||||
</SectionTitleLineWithButton>
|
|
||||||
<CardBox>
|
|
||||||
<Formik
|
|
||||||
enableReinitialize
|
|
||||||
initialValues={initialValues}
|
|
||||||
onSubmit={(values) => handleSubmit(values)}
|
|
||||||
>
|
|
||||||
<Form>
|
|
||||||
<FormField label='FileName'>
|
|
||||||
<Field name='file_name' placeholder='FileName' />
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<FormField>
|
|
||||||
<Field
|
|
||||||
label='File'
|
|
||||||
color='info'
|
|
||||||
icon={mdiUpload}
|
|
||||||
path={'scanned_documents/file'}
|
|
||||||
name='file'
|
|
||||||
id='file'
|
|
||||||
schema={{
|
|
||||||
size: undefined,
|
|
||||||
formats: undefined,
|
|
||||||
}}
|
|
||||||
component={FormFilePicker}
|
|
||||||
></Field>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<FormField label='UploadedAt'>
|
|
||||||
<DatePicker
|
|
||||||
dateFormat='yyyy-MM-dd hh:mm'
|
|
||||||
showTimeSelect
|
|
||||||
selected={
|
|
||||||
initialValues.uploaded_at
|
|
||||||
? new Date(
|
|
||||||
dayjs(initialValues.uploaded_at).format(
|
|
||||||
'YYYY-MM-DD hh:mm',
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: null
|
|
||||||
}
|
|
||||||
onChange={(date) =>
|
|
||||||
setInitialValues({ ...initialValues, uploaded_at: date })
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<FormField label='UploadedBy' labelFor='uploaded_by'>
|
|
||||||
<Field
|
|
||||||
name='uploaded_by'
|
|
||||||
id='uploaded_by'
|
|
||||||
component={SelectField}
|
|
||||||
options={initialValues.uploaded_by}
|
|
||||||
itemRef={'users'}
|
|
||||||
showField={'firstName'}
|
|
||||||
></Field>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<BaseDivider />
|
|
||||||
<BaseButtons>
|
|
||||||
<BaseButton type='submit' color='info' label='Submit' />
|
|
||||||
<BaseButton type='reset' color='info' outline label='Reset' />
|
|
||||||
<BaseButton
|
|
||||||
type='reset'
|
|
||||||
color='danger'
|
|
||||||
outline
|
|
||||||
label='Cancel'
|
|
||||||
onClick={() =>
|
|
||||||
router.push('/scanned_documents/scanned_documents-list')
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</BaseButtons>
|
|
||||||
</Form>
|
|
||||||
</Formik>
|
|
||||||
</CardBox>
|
|
||||||
</SectionMain>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
EditScanned_documents.getLayout = function getLayout(page: ReactElement) {
|
|
||||||
return (
|
|
||||||
<LayoutAuthenticated permission={'UPDATE_SCANNED_DOCUMENTS'}>
|
|
||||||
{page}
|
|
||||||
</LayoutAuthenticated>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default EditScanned_documents;
|
|
||||||
@ -1,183 +0,0 @@
|
|||||||
import { mdiChartTimelineVariant, mdiUpload } from '@mdi/js';
|
|
||||||
import Head from 'next/head';
|
|
||||||
import React, { ReactElement, useEffect, useState } from 'react';
|
|
||||||
import DatePicker from 'react-datepicker';
|
|
||||||
import 'react-datepicker/dist/react-datepicker.css';
|
|
||||||
import dayjs from 'dayjs';
|
|
||||||
|
|
||||||
import CardBox from '../../components/CardBox';
|
|
||||||
import LayoutAuthenticated from '../../layouts/Authenticated';
|
|
||||||
import SectionMain from '../../components/SectionMain';
|
|
||||||
import SectionTitleLineWithButton from '../../components/SectionTitleLineWithButton';
|
|
||||||
import { getPageTitle } from '../../config';
|
|
||||||
|
|
||||||
import { Field, Form, Formik } from 'formik';
|
|
||||||
import FormField from '../../components/FormField';
|
|
||||||
import BaseDivider from '../../components/BaseDivider';
|
|
||||||
import BaseButtons from '../../components/BaseButtons';
|
|
||||||
import BaseButton from '../../components/BaseButton';
|
|
||||||
import FormCheckRadio from '../../components/FormCheckRadio';
|
|
||||||
import FormCheckRadioGroup from '../../components/FormCheckRadioGroup';
|
|
||||||
import FormFilePicker from '../../components/FormFilePicker';
|
|
||||||
import FormImagePicker from '../../components/FormImagePicker';
|
|
||||||
import { SelectField } from '../../components/SelectField';
|
|
||||||
import { SelectFieldMany } from '../../components/SelectFieldMany';
|
|
||||||
import { SwitchField } from '../../components/SwitchField';
|
|
||||||
import { RichTextField } from '../../components/RichTextField';
|
|
||||||
|
|
||||||
import {
|
|
||||||
update,
|
|
||||||
fetch,
|
|
||||||
} from '../../stores/scanned_documents/scanned_documentsSlice';
|
|
||||||
import { useAppDispatch, useAppSelector } from '../../stores/hooks';
|
|
||||||
import { useRouter } from 'next/router';
|
|
||||||
import { saveFile } from '../../helpers/fileSaver';
|
|
||||||
import dataFormatter from '../../helpers/dataFormatter';
|
|
||||||
import ImageField from '../../components/ImageField';
|
|
||||||
|
|
||||||
const EditScanned_documentsPage = () => {
|
|
||||||
const router = useRouter();
|
|
||||||
const dispatch = useAppDispatch();
|
|
||||||
const initVals = {
|
|
||||||
file_name: '',
|
|
||||||
|
|
||||||
file: [],
|
|
||||||
|
|
||||||
uploaded_at: new Date(),
|
|
||||||
|
|
||||||
uploaded_by: null,
|
|
||||||
};
|
|
||||||
const [initialValues, setInitialValues] = useState(initVals);
|
|
||||||
|
|
||||||
const { scanned_documents } = useAppSelector(
|
|
||||||
(state) => state.scanned_documents,
|
|
||||||
);
|
|
||||||
|
|
||||||
const { id } = router.query;
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
dispatch(fetch({ id: id }));
|
|
||||||
}, [id]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (typeof scanned_documents === 'object') {
|
|
||||||
setInitialValues(scanned_documents);
|
|
||||||
}
|
|
||||||
}, [scanned_documents]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (typeof scanned_documents === 'object') {
|
|
||||||
const newInitialVal = { ...initVals };
|
|
||||||
Object.keys(initVals).forEach(
|
|
||||||
(el) => (newInitialVal[el] = scanned_documents[el]),
|
|
||||||
);
|
|
||||||
setInitialValues(newInitialVal);
|
|
||||||
}
|
|
||||||
}, [scanned_documents]);
|
|
||||||
|
|
||||||
const handleSubmit = async (data) => {
|
|
||||||
await dispatch(update({ id: id, data }));
|
|
||||||
await router.push('/scanned_documents/scanned_documents-list');
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Head>
|
|
||||||
<title>{getPageTitle('Edit scanned_documents')}</title>
|
|
||||||
</Head>
|
|
||||||
<SectionMain>
|
|
||||||
<SectionTitleLineWithButton
|
|
||||||
icon={mdiChartTimelineVariant}
|
|
||||||
title={'Edit scanned_documents'}
|
|
||||||
main
|
|
||||||
>
|
|
||||||
{''}
|
|
||||||
</SectionTitleLineWithButton>
|
|
||||||
<CardBox>
|
|
||||||
<Formik
|
|
||||||
enableReinitialize
|
|
||||||
initialValues={initialValues}
|
|
||||||
onSubmit={(values) => handleSubmit(values)}
|
|
||||||
>
|
|
||||||
<Form>
|
|
||||||
<FormField label='FileName'>
|
|
||||||
<Field name='file_name' placeholder='FileName' />
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<FormField>
|
|
||||||
<Field
|
|
||||||
label='File'
|
|
||||||
color='info'
|
|
||||||
icon={mdiUpload}
|
|
||||||
path={'scanned_documents/file'}
|
|
||||||
name='file'
|
|
||||||
id='file'
|
|
||||||
schema={{
|
|
||||||
size: undefined,
|
|
||||||
formats: undefined,
|
|
||||||
}}
|
|
||||||
component={FormFilePicker}
|
|
||||||
></Field>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<FormField label='UploadedAt'>
|
|
||||||
<DatePicker
|
|
||||||
dateFormat='yyyy-MM-dd hh:mm'
|
|
||||||
showTimeSelect
|
|
||||||
selected={
|
|
||||||
initialValues.uploaded_at
|
|
||||||
? new Date(
|
|
||||||
dayjs(initialValues.uploaded_at).format(
|
|
||||||
'YYYY-MM-DD hh:mm',
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: null
|
|
||||||
}
|
|
||||||
onChange={(date) =>
|
|
||||||
setInitialValues({ ...initialValues, uploaded_at: date })
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<FormField label='UploadedBy' labelFor='uploaded_by'>
|
|
||||||
<Field
|
|
||||||
name='uploaded_by'
|
|
||||||
id='uploaded_by'
|
|
||||||
component={SelectField}
|
|
||||||
options={initialValues.uploaded_by}
|
|
||||||
itemRef={'users'}
|
|
||||||
showField={'firstName'}
|
|
||||||
></Field>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<BaseDivider />
|
|
||||||
<BaseButtons>
|
|
||||||
<BaseButton type='submit' color='info' label='Submit' />
|
|
||||||
<BaseButton type='reset' color='info' outline label='Reset' />
|
|
||||||
<BaseButton
|
|
||||||
type='reset'
|
|
||||||
color='danger'
|
|
||||||
outline
|
|
||||||
label='Cancel'
|
|
||||||
onClick={() =>
|
|
||||||
router.push('/scanned_documents/scanned_documents-list')
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</BaseButtons>
|
|
||||||
</Form>
|
|
||||||
</Formik>
|
|
||||||
</CardBox>
|
|
||||||
</SectionMain>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
EditScanned_documentsPage.getLayout = function getLayout(page: ReactElement) {
|
|
||||||
return (
|
|
||||||
<LayoutAuthenticated permission={'UPDATE_SCANNED_DOCUMENTS'}>
|
|
||||||
{page}
|
|
||||||
</LayoutAuthenticated>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default EditScanned_documentsPage;
|
|
||||||
@ -1,158 +0,0 @@
|
|||||||
import { mdiChartTimelineVariant } from '@mdi/js';
|
|
||||||
import Head from 'next/head';
|
|
||||||
import { uniqueId } from 'lodash';
|
|
||||||
import React, { ReactElement, useState } from 'react';
|
|
||||||
import CardBox from '../../components/CardBox';
|
|
||||||
import LayoutAuthenticated from '../../layouts/Authenticated';
|
|
||||||
import SectionMain from '../../components/SectionMain';
|
|
||||||
import SectionTitleLineWithButton from '../../components/SectionTitleLineWithButton';
|
|
||||||
import { getPageTitle } from '../../config';
|
|
||||||
import TableScanned_documents from '../../components/Scanned_documents/TableScanned_documents';
|
|
||||||
import BaseButton from '../../components/BaseButton';
|
|
||||||
import axios from 'axios';
|
|
||||||
import Link from 'next/link';
|
|
||||||
import { useAppDispatch, useAppSelector } from '../../stores/hooks';
|
|
||||||
import CardBoxModal from '../../components/CardBoxModal';
|
|
||||||
import DragDropFilePicker from '../../components/DragDropFilePicker';
|
|
||||||
import {
|
|
||||||
setRefetch,
|
|
||||||
uploadCsv,
|
|
||||||
} from '../../stores/scanned_documents/scanned_documentsSlice';
|
|
||||||
|
|
||||||
import { hasPermission } from '../../helpers/userPermissions';
|
|
||||||
|
|
||||||
const Scanned_documentsTablesPage = () => {
|
|
||||||
const [filterItems, setFilterItems] = useState([]);
|
|
||||||
const [csvFile, setCsvFile] = useState<File | null>(null);
|
|
||||||
const [isModalActive, setIsModalActive] = useState(false);
|
|
||||||
const [showTableView, setShowTableView] = useState(false);
|
|
||||||
|
|
||||||
const { currentUser } = useAppSelector((state) => state.auth);
|
|
||||||
|
|
||||||
const dispatch = useAppDispatch();
|
|
||||||
|
|
||||||
const [filters] = useState([
|
|
||||||
{ label: 'FileName', title: 'file_name' },
|
|
||||||
|
|
||||||
{ label: 'UploadedAt', title: 'uploaded_at', date: 'true' },
|
|
||||||
|
|
||||||
{ label: 'UploadedBy', title: 'uploaded_by' },
|
|
||||||
]);
|
|
||||||
|
|
||||||
const hasCreatePermission =
|
|
||||||
currentUser && hasPermission(currentUser, 'CREATE_SCANNED_DOCUMENTS');
|
|
||||||
|
|
||||||
const addFilter = () => {
|
|
||||||
const newItem = {
|
|
||||||
id: uniqueId(),
|
|
||||||
fields: {
|
|
||||||
filterValue: '',
|
|
||||||
filterValueFrom: '',
|
|
||||||
filterValueTo: '',
|
|
||||||
selectedField: '',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
newItem.fields.selectedField = filters[0].title;
|
|
||||||
setFilterItems([...filterItems, newItem]);
|
|
||||||
};
|
|
||||||
|
|
||||||
const getScanned_documentsCSV = async () => {
|
|
||||||
const response = await axios({
|
|
||||||
url: '/scanned_documents?filetype=csv',
|
|
||||||
method: 'GET',
|
|
||||||
responseType: 'blob',
|
|
||||||
});
|
|
||||||
const type = response.headers['content-type'];
|
|
||||||
const blob = new Blob([response.data], { type: type });
|
|
||||||
const link = document.createElement('a');
|
|
||||||
link.href = window.URL.createObjectURL(blob);
|
|
||||||
link.download = 'scanned_documentsCSV.csv';
|
|
||||||
link.click();
|
|
||||||
};
|
|
||||||
|
|
||||||
const onModalConfirm = async () => {
|
|
||||||
if (!csvFile) return;
|
|
||||||
await dispatch(uploadCsv(csvFile));
|
|
||||||
dispatch(setRefetch(true));
|
|
||||||
setCsvFile(null);
|
|
||||||
setIsModalActive(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
const onModalCancel = () => {
|
|
||||||
setCsvFile(null);
|
|
||||||
setIsModalActive(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Head>
|
|
||||||
<title>{getPageTitle('Scanned_documents')}</title>
|
|
||||||
</Head>
|
|
||||||
<SectionMain>
|
|
||||||
<SectionTitleLineWithButton
|
|
||||||
icon={mdiChartTimelineVariant}
|
|
||||||
title='Scanned_documents'
|
|
||||||
main
|
|
||||||
>
|
|
||||||
{''}
|
|
||||||
</SectionTitleLineWithButton>
|
|
||||||
<CardBox className='mb-6' cardBoxClassName='flex flex-wrap'>
|
|
||||||
{hasCreatePermission && (
|
|
||||||
<BaseButton
|
|
||||||
className={'mr-3'}
|
|
||||||
href={'/scanned_documents/scanned_documents-new'}
|
|
||||||
color='info'
|
|
||||||
label='Upload New Claim(s)'
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<BaseButton
|
|
||||||
className={'mr-3'}
|
|
||||||
color='info'
|
|
||||||
label='Filter'
|
|
||||||
onClick={addFilter}
|
|
||||||
/>
|
|
||||||
|
|
||||||
|
|
||||||
<div className='md:inline-flex items-center ms-auto'>
|
|
||||||
<div id='delete-rows-button'></div>
|
|
||||||
</div>
|
|
||||||
</CardBox>
|
|
||||||
|
|
||||||
<CardBox className='mb-6' hasTable>
|
|
||||||
<TableScanned_documents
|
|
||||||
filterItems={filterItems}
|
|
||||||
setFilterItems={setFilterItems}
|
|
||||||
filters={filters}
|
|
||||||
showGrid={false}
|
|
||||||
/>
|
|
||||||
</CardBox>
|
|
||||||
</SectionMain>
|
|
||||||
<CardBoxModal
|
|
||||||
title='Upload CSV'
|
|
||||||
buttonColor='info'
|
|
||||||
buttonLabel={'Confirm'}
|
|
||||||
// buttonLabel={false ? 'Deleting...' : 'Confirm'}
|
|
||||||
isActive={isModalActive}
|
|
||||||
onConfirm={onModalConfirm}
|
|
||||||
onCancel={onModalCancel}
|
|
||||||
>
|
|
||||||
<DragDropFilePicker
|
|
||||||
file={csvFile}
|
|
||||||
setFile={setCsvFile}
|
|
||||||
formats={'.csv'}
|
|
||||||
/>
|
|
||||||
</CardBoxModal>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
Scanned_documentsTablesPage.getLayout = function getLayout(page: ReactElement) {
|
|
||||||
return (
|
|
||||||
<LayoutAuthenticated permission={'READ_SCANNED_DOCUMENTS'}>
|
|
||||||
{page}
|
|
||||||
</LayoutAuthenticated>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Scanned_documentsTablesPage;
|
|
||||||
@ -1,140 +0,0 @@
|
|||||||
import {
|
|
||||||
mdiAccount,
|
|
||||||
mdiChartTimelineVariant,
|
|
||||||
mdiMail,
|
|
||||||
mdiUpload,
|
|
||||||
} from '@mdi/js';
|
|
||||||
import Head from 'next/head';
|
|
||||||
import React, { ReactElement } from 'react';
|
|
||||||
import CardBox from '../../components/CardBox';
|
|
||||||
import LayoutAuthenticated from '../../layouts/Authenticated';
|
|
||||||
import SectionMain from '../../components/SectionMain';
|
|
||||||
import SectionTitleLineWithButton from '../../components/SectionTitleLineWithButton';
|
|
||||||
import { getPageTitle } from '../../config';
|
|
||||||
|
|
||||||
import { Field, Form, Formik } from 'formik';
|
|
||||||
import FormField from '../../components/FormField';
|
|
||||||
import BaseDivider from '../../components/BaseDivider';
|
|
||||||
import BaseButtons from '../../components/BaseButtons';
|
|
||||||
import BaseButton from '../../components/BaseButton';
|
|
||||||
import FormCheckRadio from '../../components/FormCheckRadio';
|
|
||||||
import FormCheckRadioGroup from '../../components/FormCheckRadioGroup';
|
|
||||||
import FormFilePicker from '../../components/FormFilePicker';
|
|
||||||
import FormImagePicker from '../../components/FormImagePicker';
|
|
||||||
import { SwitchField } from '../../components/SwitchField';
|
|
||||||
|
|
||||||
import { SelectField } from '../../components/SelectField';
|
|
||||||
import { SelectFieldMany } from '../../components/SelectFieldMany';
|
|
||||||
import { RichTextField } from '../../components/RichTextField';
|
|
||||||
|
|
||||||
import { create } from '../../stores/scanned_documents/scanned_documentsSlice';
|
|
||||||
import { useAppDispatch } from '../../stores/hooks';
|
|
||||||
import { useRouter } from 'next/router';
|
|
||||||
import moment from 'moment';
|
|
||||||
|
|
||||||
const initialValues = {
|
|
||||||
file_name: '',
|
|
||||||
|
|
||||||
file: [],
|
|
||||||
|
|
||||||
uploaded_at: '',
|
|
||||||
|
|
||||||
uploaded_by: '',
|
|
||||||
};
|
|
||||||
|
|
||||||
const Scanned_documentsNew = () => {
|
|
||||||
const router = useRouter();
|
|
||||||
const dispatch = useAppDispatch();
|
|
||||||
|
|
||||||
const handleSubmit = async (data) => {
|
|
||||||
await dispatch(create(data));
|
|
||||||
await router.push('/scanned_documents/scanned_documents-list');
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Head>
|
|
||||||
<title>{getPageTitle('New Item')}</title>
|
|
||||||
</Head>
|
|
||||||
<SectionMain>
|
|
||||||
<SectionTitleLineWithButton
|
|
||||||
icon={mdiChartTimelineVariant}
|
|
||||||
title='New Item'
|
|
||||||
main
|
|
||||||
>
|
|
||||||
{''}
|
|
||||||
</SectionTitleLineWithButton>
|
|
||||||
<CardBox>
|
|
||||||
<Formik
|
|
||||||
initialValues={initialValues}
|
|
||||||
onSubmit={(values) => handleSubmit(values)}
|
|
||||||
>
|
|
||||||
<Form>
|
|
||||||
<FormField label='FileName'>
|
|
||||||
<Field name='file_name' placeholder='FileName' />
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<FormField>
|
|
||||||
<Field
|
|
||||||
label='File'
|
|
||||||
color='info'
|
|
||||||
icon={mdiUpload}
|
|
||||||
path={'scanned_documents/file'}
|
|
||||||
name='file'
|
|
||||||
id='file'
|
|
||||||
schema={{
|
|
||||||
size: undefined,
|
|
||||||
formats: undefined,
|
|
||||||
}}
|
|
||||||
component={FormFilePicker}
|
|
||||||
></Field>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<FormField label='UploadedAt'>
|
|
||||||
<Field
|
|
||||||
type='datetime-local'
|
|
||||||
name='uploaded_at'
|
|
||||||
placeholder='UploadedAt'
|
|
||||||
/>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<FormField label='UploadedBy' labelFor='uploaded_by'>
|
|
||||||
<Field
|
|
||||||
name='uploaded_by'
|
|
||||||
id='uploaded_by'
|
|
||||||
component={SelectField}
|
|
||||||
options={[]}
|
|
||||||
itemRef={'users'}
|
|
||||||
></Field>
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<BaseDivider />
|
|
||||||
<BaseButtons>
|
|
||||||
<BaseButton type='submit' color='info' label='Submit' />
|
|
||||||
<BaseButton type='reset' color='info' outline label='Reset' />
|
|
||||||
<BaseButton
|
|
||||||
type='reset'
|
|
||||||
color='danger'
|
|
||||||
outline
|
|
||||||
label='Cancel'
|
|
||||||
onClick={() =>
|
|
||||||
router.push('/scanned_documents/scanned_documents-list')
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</BaseButtons>
|
|
||||||
</Form>
|
|
||||||
</Formik>
|
|
||||||
</CardBox>
|
|
||||||
</SectionMain>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
Scanned_documentsNew.getLayout = function getLayout(page: ReactElement) {
|
|
||||||
return (
|
|
||||||
<LayoutAuthenticated permission={'CREATE_SCANNED_DOCUMENTS'}>
|
|
||||||
{page}
|
|
||||||
</LayoutAuthenticated>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Scanned_documentsNew;
|
|
||||||
@ -1,174 +0,0 @@
|
|||||||
import { mdiChartTimelineVariant } from '@mdi/js';
|
|
||||||
import Head from 'next/head';
|
|
||||||
import { uniqueId } from 'lodash';
|
|
||||||
import React, { ReactElement, useState } from 'react';
|
|
||||||
import CardBox from '../../components/CardBox';
|
|
||||||
import LayoutAuthenticated from '../../layouts/Authenticated';
|
|
||||||
import SectionMain from '../../components/SectionMain';
|
|
||||||
import SectionTitleLineWithButton from '../../components/SectionTitleLineWithButton';
|
|
||||||
import { getPageTitle } from '../../config';
|
|
||||||
import TableScanned_documents from '../../components/Scanned_documents/TableScanned_documents';
|
|
||||||
import BaseButton from '../../components/BaseButton';
|
|
||||||
import axios from 'axios';
|
|
||||||
import Link from 'next/link';
|
|
||||||
import { useAppDispatch, useAppSelector } from '../../stores/hooks';
|
|
||||||
import CardBoxModal from '../../components/CardBoxModal';
|
|
||||||
import DragDropFilePicker from '../../components/DragDropFilePicker';
|
|
||||||
import {
|
|
||||||
setRefetch,
|
|
||||||
uploadCsv,
|
|
||||||
} from '../../stores/scanned_documents/scanned_documentsSlice';
|
|
||||||
|
|
||||||
import { hasPermission } from '../../helpers/userPermissions';
|
|
||||||
|
|
||||||
const Scanned_documentsTablesPage = () => {
|
|
||||||
const [filterItems, setFilterItems] = useState([]);
|
|
||||||
const [csvFile, setCsvFile] = useState<File | null>(null);
|
|
||||||
const [isModalActive, setIsModalActive] = useState(false);
|
|
||||||
const [showTableView, setShowTableView] = useState(false);
|
|
||||||
|
|
||||||
const { currentUser } = useAppSelector((state) => state.auth);
|
|
||||||
|
|
||||||
const dispatch = useAppDispatch();
|
|
||||||
|
|
||||||
const [filters] = useState([
|
|
||||||
{ label: 'FileName', title: 'file_name' },
|
|
||||||
|
|
||||||
{ label: 'UploadedAt', title: 'uploaded_at', date: 'true' },
|
|
||||||
|
|
||||||
{ label: 'UploadedBy', title: 'uploaded_by' },
|
|
||||||
]);
|
|
||||||
|
|
||||||
const hasCreatePermission =
|
|
||||||
currentUser && hasPermission(currentUser, 'CREATE_SCANNED_DOCUMENTS');
|
|
||||||
|
|
||||||
const addFilter = () => {
|
|
||||||
const newItem = {
|
|
||||||
id: uniqueId(),
|
|
||||||
fields: {
|
|
||||||
filterValue: '',
|
|
||||||
filterValueFrom: '',
|
|
||||||
filterValueTo: '',
|
|
||||||
selectedField: '',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
newItem.fields.selectedField = filters[0].title;
|
|
||||||
setFilterItems([...filterItems, newItem]);
|
|
||||||
};
|
|
||||||
|
|
||||||
const getScanned_documentsCSV = async () => {
|
|
||||||
const response = await axios({
|
|
||||||
url: '/scanned_documents?filetype=csv',
|
|
||||||
method: 'GET',
|
|
||||||
responseType: 'blob',
|
|
||||||
});
|
|
||||||
const type = response.headers['content-type'];
|
|
||||||
const blob = new Blob([response.data], { type: type });
|
|
||||||
const link = document.createElement('a');
|
|
||||||
link.href = window.URL.createObjectURL(blob);
|
|
||||||
link.download = 'scanned_documentsCSV.csv';
|
|
||||||
link.click();
|
|
||||||
};
|
|
||||||
|
|
||||||
const onModalConfirm = async () => {
|
|
||||||
if (!csvFile) return;
|
|
||||||
await dispatch(uploadCsv(csvFile));
|
|
||||||
dispatch(setRefetch(true));
|
|
||||||
setCsvFile(null);
|
|
||||||
setIsModalActive(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
const onModalCancel = () => {
|
|
||||||
setCsvFile(null);
|
|
||||||
setIsModalActive(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Head>
|
|
||||||
<title>{getPageTitle('Scanned_documents')}</title>
|
|
||||||
</Head>
|
|
||||||
<SectionMain>
|
|
||||||
<SectionTitleLineWithButton
|
|
||||||
icon={mdiChartTimelineVariant}
|
|
||||||
title='Scanned_documents'
|
|
||||||
main
|
|
||||||
>
|
|
||||||
{''}
|
|
||||||
</SectionTitleLineWithButton>
|
|
||||||
<CardBox className='mb-6' cardBoxClassName='flex flex-wrap'>
|
|
||||||
{hasCreatePermission && (
|
|
||||||
<BaseButton
|
|
||||||
className={'mr-3'}
|
|
||||||
href={'/scanned_documents/scanned_documents-new'}
|
|
||||||
color='info'
|
|
||||||
label='New Item'
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<BaseButton
|
|
||||||
className={'mr-3'}
|
|
||||||
color='info'
|
|
||||||
label='Filter'
|
|
||||||
onClick={addFilter}
|
|
||||||
/>
|
|
||||||
<BaseButton
|
|
||||||
className={'mr-3'}
|
|
||||||
color='info'
|
|
||||||
label='Download CSV'
|
|
||||||
onClick={getScanned_documentsCSV}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{hasCreatePermission && (
|
|
||||||
<BaseButton
|
|
||||||
color='info'
|
|
||||||
label='Upload CSV'
|
|
||||||
onClick={() => setIsModalActive(true)}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div className='md:inline-flex items-center ms-auto'>
|
|
||||||
<div id='delete-rows-button'></div>
|
|
||||||
|
|
||||||
<Link href={'/scanned_documents/scanned_documents-list'}>
|
|
||||||
Back to <span className='capitalize'>table</span>
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
</CardBox>
|
|
||||||
<CardBox className='mb-6' hasTable>
|
|
||||||
<TableScanned_documents
|
|
||||||
filterItems={filterItems}
|
|
||||||
setFilterItems={setFilterItems}
|
|
||||||
filters={filters}
|
|
||||||
showGrid={true}
|
|
||||||
/>
|
|
||||||
</CardBox>
|
|
||||||
</SectionMain>
|
|
||||||
<CardBoxModal
|
|
||||||
title='Upload CSV'
|
|
||||||
buttonColor='info'
|
|
||||||
buttonLabel={'Confirm'}
|
|
||||||
// buttonLabel={false ? 'Deleting...' : 'Confirm'}
|
|
||||||
isActive={isModalActive}
|
|
||||||
onConfirm={onModalConfirm}
|
|
||||||
onCancel={onModalCancel}
|
|
||||||
>
|
|
||||||
<DragDropFilePicker
|
|
||||||
file={csvFile}
|
|
||||||
setFile={setCsvFile}
|
|
||||||
formats={'.csv'}
|
|
||||||
/>
|
|
||||||
</CardBoxModal>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
Scanned_documentsTablesPage.getLayout = function getLayout(page: ReactElement) {
|
|
||||||
return (
|
|
||||||
<LayoutAuthenticated permission={'READ_SCANNED_DOCUMENTS'}>
|
|
||||||
{page}
|
|
||||||
</LayoutAuthenticated>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Scanned_documentsTablesPage;
|
|
||||||
@ -1,132 +0,0 @@
|
|||||||
import React, { ReactElement, useEffect } from 'react';
|
|
||||||
import Head from 'next/head';
|
|
||||||
import DatePicker from 'react-datepicker';
|
|
||||||
import 'react-datepicker/dist/react-datepicker.css';
|
|
||||||
import dayjs from 'dayjs';
|
|
||||||
import { useAppDispatch, useAppSelector } from '../../stores/hooks';
|
|
||||||
import { useRouter } from 'next/router';
|
|
||||||
import { fetch } from '../../stores/scanned_documents/scanned_documentsSlice';
|
|
||||||
import { saveFile } from '../../helpers/fileSaver';
|
|
||||||
import dataFormatter from '../../helpers/dataFormatter';
|
|
||||||
import ImageField from '../../components/ImageField';
|
|
||||||
import LayoutAuthenticated from '../../layouts/Authenticated';
|
|
||||||
import { getPageTitle } from '../../config';
|
|
||||||
import SectionTitleLineWithButton from '../../components/SectionTitleLineWithButton';
|
|
||||||
import SectionMain from '../../components/SectionMain';
|
|
||||||
import CardBox from '../../components/CardBox';
|
|
||||||
import BaseButton from '../../components/BaseButton';
|
|
||||||
import BaseDivider from '../../components/BaseDivider';
|
|
||||||
import { mdiChartTimelineVariant } from '@mdi/js';
|
|
||||||
import { SwitchField } from '../../components/SwitchField';
|
|
||||||
import FormField from '../../components/FormField';
|
|
||||||
|
|
||||||
const Scanned_documentsView = () => {
|
|
||||||
const router = useRouter();
|
|
||||||
const dispatch = useAppDispatch();
|
|
||||||
const { scanned_documents } = useAppSelector(
|
|
||||||
(state) => state.scanned_documents,
|
|
||||||
);
|
|
||||||
|
|
||||||
const { id } = router.query;
|
|
||||||
|
|
||||||
function removeLastCharacter(str) {
|
|
||||||
console.log(str, `str`);
|
|
||||||
return str.slice(0, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
dispatch(fetch({ id }));
|
|
||||||
}, [dispatch, id]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Head>
|
|
||||||
<title>{getPageTitle('View scanned_documents')}</title>
|
|
||||||
</Head>
|
|
||||||
<SectionMain>
|
|
||||||
<SectionTitleLineWithButton
|
|
||||||
icon={mdiChartTimelineVariant}
|
|
||||||
title={removeLastCharacter('View scanned_documents')}
|
|
||||||
main
|
|
||||||
>
|
|
||||||
<BaseButton
|
|
||||||
color='info'
|
|
||||||
label='Edit'
|
|
||||||
href={`/scanned_documents/scanned_documents-edit/?id=${id}`}
|
|
||||||
/>
|
|
||||||
</SectionTitleLineWithButton>
|
|
||||||
<CardBox>
|
|
||||||
<div className={'mb-4'}>
|
|
||||||
<p className={'block font-bold mb-2'}>FileName</p>
|
|
||||||
<p>{scanned_documents?.file_name}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className={'mb-4'}>
|
|
||||||
<p className={'block font-bold mb-2'}>File</p>
|
|
||||||
{scanned_documents?.file?.length ? (
|
|
||||||
dataFormatter
|
|
||||||
.filesFormatter(scanned_documents.file)
|
|
||||||
.map((link) => (
|
|
||||||
<button
|
|
||||||
key={link.publicUrl}
|
|
||||||
onClick={(e) => saveFile(e, link.publicUrl, link.name)}
|
|
||||||
>
|
|
||||||
{link.name}
|
|
||||||
</button>
|
|
||||||
))
|
|
||||||
) : (
|
|
||||||
<p>No File</p>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<FormField label='UploadedAt'>
|
|
||||||
{scanned_documents.uploaded_at ? (
|
|
||||||
<DatePicker
|
|
||||||
dateFormat='yyyy-MM-dd hh:mm'
|
|
||||||
showTimeSelect
|
|
||||||
selected={
|
|
||||||
scanned_documents.uploaded_at
|
|
||||||
? new Date(
|
|
||||||
dayjs(scanned_documents.uploaded_at).format(
|
|
||||||
'YYYY-MM-DD hh:mm',
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: null
|
|
||||||
}
|
|
||||||
disabled
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<p>No UploadedAt</p>
|
|
||||||
)}
|
|
||||||
</FormField>
|
|
||||||
|
|
||||||
<div className={'mb-4'}>
|
|
||||||
<p className={'block font-bold mb-2'}>UploadedBy</p>
|
|
||||||
|
|
||||||
<p>{scanned_documents?.uploaded_by?.firstName ?? 'No data'}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<BaseDivider />
|
|
||||||
|
|
||||||
<BaseButton
|
|
||||||
color='info'
|
|
||||||
label='Back'
|
|
||||||
onClick={() =>
|
|
||||||
router.push('/scanned_documents/scanned_documents-list')
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</CardBox>
|
|
||||||
</SectionMain>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
Scanned_documentsView.getLayout = function getLayout(page: ReactElement) {
|
|
||||||
return (
|
|
||||||
<LayoutAuthenticated permission={'READ_SCANNED_DOCUMENTS'}>
|
|
||||||
{page}
|
|
||||||
</LayoutAuthenticated>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Scanned_documentsView;
|
|
||||||
@ -288,7 +288,7 @@ const Dashboard = () => {
|
|||||||
<div className='flex justify-between align-center'>
|
<div className='flex justify-between align-center'>
|
||||||
<div>
|
<div>
|
||||||
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
<div className='text-lg leading-tight text-gray-500 dark:text-gray-400'>
|
||||||
Claims
|
Scanned documents
|
||||||
</div>
|
</div>
|
||||||
<div className='text-3xl leading-tight font-semibold'>
|
<div className='text-3xl leading-tight font-semibold'>
|
||||||
{scanned_documents}
|
{scanned_documents}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ export default function Starter() {
|
|||||||
const [contentPosition, setContentPosition] = useState('right');
|
const [contentPosition, setContentPosition] = useState('right');
|
||||||
const textColor = useAppSelector((state) => state.style.linkColor);
|
const textColor = useAppSelector((state) => state.style.linkColor);
|
||||||
|
|
||||||
const title = 'PaperClaims.ai';
|
const title = 'PaperClaimsai';
|
||||||
|
|
||||||
// Fetch Pexels image/video
|
// Fetch Pexels image/video
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -129,20 +129,27 @@ export default function Starter() {
|
|||||||
: null}
|
: null}
|
||||||
<div className='flex items-center justify-center flex-col space-y-4 w-full lg:w-full'>
|
<div className='flex items-center justify-center flex-col space-y-4 w-full lg:w-full'>
|
||||||
<CardBox className='w-full md:w-3/5 lg:w-2/3'>
|
<CardBox className='w-full md:w-3/5 lg:w-2/3'>
|
||||||
<CardBoxComponentTitle title='PaperClaims.ai | Turn paper into payments' />
|
<CardBoxComponentTitle title='Welcome to your PaperClaimsai app!' />
|
||||||
|
|
||||||
<div className='space-y-3'>
|
<div className='space-y-3'>
|
||||||
<p className='text-center text-gray-500'>
|
<p className='text-center text-gray-500'>
|
||||||
This is a temporary landing page for the main app portal.
|
This is a React.js/Node.js app generated by the{' '}
|
||||||
</p>
|
|
||||||
<p className='text-center text-gray-500'>
|
|
||||||
Use the Login button below to access the portal, or visit the {' '}
|
|
||||||
<a
|
<a
|
||||||
className={`${textColor}`}
|
className={`${textColor}`}
|
||||||
href='https://www.paperclaims.ai'
|
href='https://flatlogic.com/generator'
|
||||||
>
|
>
|
||||||
PaperClaims.ai public website
|
Flatlogic Web App Generator
|
||||||
</a>.
|
</a>
|
||||||
|
</p>
|
||||||
|
<p className='text-center text-gray-500'>
|
||||||
|
For guides and documentation please check your local README.md
|
||||||
|
and the{' '}
|
||||||
|
<a
|
||||||
|
className={`${textColor}`}
|
||||||
|
href='https://flatlogic.com/documentation'
|
||||||
|
>
|
||||||
|
Flatlogic documentation
|
||||||
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -154,7 +161,6 @@ export default function Starter() {
|
|||||||
className='w-full'
|
className='w-full'
|
||||||
/>
|
/>
|
||||||
</BaseButtons>
|
</BaseButtons>
|
||||||
{/*
|
|
||||||
<div className='grid grid-cols-1 gap-2 lg:grid-cols-4 mt-2'>
|
<div className='grid grid-cols-1 gap-2 lg:grid-cols-4 mt-2'>
|
||||||
<div className='text-center'>
|
<div className='text-center'>
|
||||||
<a className={`${textColor}`} href='https://react.dev/'>
|
<a className={`${textColor}`} href='https://react.dev/'>
|
||||||
@ -181,14 +187,13 @@ export default function Starter() {
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
*/}
|
|
||||||
</CardBox>
|
</CardBox>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</SectionFullScreen>
|
</SectionFullScreen>
|
||||||
<div className='bg-black text-white flex flex-col text-center justify-center md:flex-row'>
|
<div className='bg-black text-white flex flex-col text-center justify-center md:flex-row'>
|
||||||
<p className='py-6 text-sm'>
|
<p className='py-6 text-sm'>
|
||||||
© 2025 <span>{title}</span>. All rights reserved
|
© 2024 <span>{title}</span>. All rights reserved
|
||||||
</p>
|
</p>
|
||||||
<Link className='py-6 ml-4 text-sm' href='/privacy-policy/'>
|
<Link className='py-6 ml-4 text-sm' href='/privacy-policy/'>
|
||||||
Privacy Policy
|
Privacy Policy
|
||||||
|
|||||||
@ -52,7 +52,7 @@ export default function Login() {
|
|||||||
remember: true,
|
remember: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const title = 'PaperClaims.ai | Login ';
|
const title = 'PaperClaimsai';
|
||||||
|
|
||||||
// Fetch Pexels image/video
|
// Fetch Pexels image/video
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -204,7 +204,32 @@ export default function Login() {
|
|||||||
<div className='flex flex-row text-gray-500 justify-between'>
|
<div className='flex flex-row text-gray-500 justify-between'>
|
||||||
<div>
|
<div>
|
||||||
<p className='mb-2'>
|
<p className='mb-2'>
|
||||||
Login below to access your account.
|
Use{' '}
|
||||||
|
<code
|
||||||
|
className={`cursor-pointer ${textColor} `}
|
||||||
|
data-password='c8f96137'
|
||||||
|
onClick={(e) => setLogin(e.target)}
|
||||||
|
>
|
||||||
|
admin@flatlogic.com
|
||||||
|
</code>
|
||||||
|
{' / '}
|
||||||
|
<code className={`${textColor}`}>c8f96137</code>
|
||||||
|
{' / '}
|
||||||
|
to login as Admin
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Use{' '}
|
||||||
|
<code
|
||||||
|
className={`cursor-pointer ${textColor} `}
|
||||||
|
data-password='57fd86e330a1'
|
||||||
|
onClick={(e) => setLogin(e.target)}
|
||||||
|
>
|
||||||
|
client@hello.com
|
||||||
|
</code>
|
||||||
|
{' / '}
|
||||||
|
<code className={`${textColor}`}>57fd86e330a1</code>
|
||||||
|
{' / '}
|
||||||
|
to login as User
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@ -83,12 +83,12 @@ const EditScanned_documentsPage = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Head>
|
<Head>
|
||||||
<title>{getPageTitle('Edit Claim')}</title>
|
<title>{getPageTitle('Edit scanned_documents')}</title>
|
||||||
</Head>
|
</Head>
|
||||||
<SectionMain>
|
<SectionMain>
|
||||||
<SectionTitleLineWithButton
|
<SectionTitleLineWithButton
|
||||||
icon={mdiChartTimelineVariant}
|
icon={mdiChartTimelineVariant}
|
||||||
title='Edit Claim'
|
title={'Edit scanned_documents'}
|
||||||
main
|
main
|
||||||
>
|
>
|
||||||
{''}
|
{''}
|
||||||
|
|||||||
@ -86,12 +86,12 @@ const Scanned_documentsTablesPage = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Head>
|
<Head>
|
||||||
<title>{getPageTitle('Claims')}</title>
|
<title>{getPageTitle('Scanned_documents')}</title>
|
||||||
</Head>
|
</Head>
|
||||||
<SectionMain>
|
<SectionMain>
|
||||||
<SectionTitleLineWithButton
|
<SectionTitleLineWithButton
|
||||||
icon={mdiChartTimelineVariant}
|
icon={mdiChartTimelineVariant}
|
||||||
title='Claims'
|
title='Scanned_documents'
|
||||||
main
|
main
|
||||||
>
|
>
|
||||||
{''}
|
{''}
|
||||||
|
|||||||
@ -53,12 +53,12 @@ const Scanned_documentsNew = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Head>
|
<Head>
|
||||||
<title>{getPageTitle('New Claim')}</title>
|
<title>{getPageTitle('New Item')}</title>
|
||||||
</Head>
|
</Head>
|
||||||
<SectionMain>
|
<SectionMain>
|
||||||
<SectionTitleLineWithButton
|
<SectionTitleLineWithButton
|
||||||
icon={mdiChartTimelineVariant}
|
icon={mdiChartTimelineVariant}
|
||||||
title='New Claim'
|
title='New Item'
|
||||||
main
|
main
|
||||||
>
|
>
|
||||||
{''}
|
{''}
|
||||||
|
|||||||
@ -86,12 +86,12 @@ const Scanned_documentsTablesPage = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Head>
|
<Head>
|
||||||
<title>{getPageTitle('Claims')}</title>
|
<title>{getPageTitle('Scanned_documents')}</title>
|
||||||
</Head>
|
</Head>
|
||||||
<SectionMain>
|
<SectionMain>
|
||||||
<SectionTitleLineWithButton
|
<SectionTitleLineWithButton
|
||||||
icon={mdiChartTimelineVariant}
|
icon={mdiChartTimelineVariant}
|
||||||
title='Claims'
|
title='Scanned_documents'
|
||||||
main
|
main
|
||||||
>
|
>
|
||||||
{''}
|
{''}
|
||||||
@ -102,7 +102,7 @@ const Scanned_documentsTablesPage = () => {
|
|||||||
className={'mr-3'}
|
className={'mr-3'}
|
||||||
href={'/scanned_documents/scanned_documents-new'}
|
href={'/scanned_documents/scanned_documents-new'}
|
||||||
color='info'
|
color='info'
|
||||||
label='New Claim'
|
label='New Item'
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@ -29,6 +29,10 @@ const Scanned_documentsView = () => {
|
|||||||
|
|
||||||
const { id } = router.query;
|
const { id } = router.query;
|
||||||
|
|
||||||
|
function removeLastCharacter(str) {
|
||||||
|
console.log(str, `str`);
|
||||||
|
return str.slice(0, -1);
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(fetch({ id }));
|
dispatch(fetch({ id }));
|
||||||
@ -37,7 +41,7 @@ const Scanned_documentsView = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Head>
|
<Head>
|
||||||
<title>{getPageTitle('Claim Details')}</title>
|
<title>{getPageTitle('View scanned_documents')}</title>
|
||||||
</Head>
|
</Head>
|
||||||
<SectionMain>
|
<SectionMain>
|
||||||
<SectionTitleLineWithButton
|
<SectionTitleLineWithButton
|
||||||
@ -46,7 +50,7 @@ const Scanned_documentsView = () => {
|
|||||||
main
|
main
|
||||||
>
|
>
|
||||||
<BaseButton
|
<BaseButton
|
||||||
title='Claim Details'
|
color='info'
|
||||||
label='Edit'
|
label='Edit'
|
||||||
href={`/scanned_documents/scanned_documents-edit/?id=${id}`}
|
href={`/scanned_documents/scanned_documents-edit/?id=${id}`}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
temp file to save folder
|
|
||||||
Loading…
x
Reference in New Issue
Block a user