From b845b381d40bb331f3dd364c893010feea54cb12 Mon Sep 17 00:00:00 2001 From: Dhanuxeptagon Date: Mon, 4 Sep 2023 12:52:17 +0530 Subject: [PATCH 001/135] remove unwanted files --- web/src/Pages/AddUser/addUser.scss | 0 web/src/Pages/AddUser/addUserLayout.tsx | 15 --- web/src/Pages/Common/colors.addCompany.scss | 5 - web/src/Pages/Common/colors.addUser.scss | 3 - web/src/Pages/Common/colors.dashboard.scss | 5 - web/src/Pages/Common/colors.role.scss | 20 ---- web/src/Pages/Common/common.form.colors.scss | 3 - web/src/Pages/Common/common.form.scss | 68 -------------- web/src/Pages/Common/common.table.scss | 92 ------------------- web/src/Pages/Common/configs.tsx | 3 - web/src/Pages/Common/role.color.constants.tsx | 22 ----- .../Pages/Company/addNewCompany.layout.tsx | 17 ---- web/src/Pages/Company/addNewCompany.scss | 0 .../CompanyManagement/companyManagement.scss | 0 .../Pages/CompanyProfile/companyProfile.scss | 0 .../programmeManagement.scss | 64 ------------- 16 files changed, 317 deletions(-) delete mode 100644 web/src/Pages/AddUser/addUser.scss delete mode 100644 web/src/Pages/AddUser/addUserLayout.tsx delete mode 100644 web/src/Pages/Common/colors.addCompany.scss delete mode 100644 web/src/Pages/Common/colors.addUser.scss delete mode 100644 web/src/Pages/Common/colors.dashboard.scss delete mode 100644 web/src/Pages/Common/colors.role.scss delete mode 100644 web/src/Pages/Common/common.form.colors.scss delete mode 100644 web/src/Pages/Common/common.form.scss delete mode 100644 web/src/Pages/Common/common.table.scss delete mode 100644 web/src/Pages/Common/configs.tsx delete mode 100644 web/src/Pages/Common/role.color.constants.tsx delete mode 100644 web/src/Pages/Company/addNewCompany.layout.tsx delete mode 100644 web/src/Pages/Company/addNewCompany.scss delete mode 100644 web/src/Pages/CompanyManagement/companyManagement.scss delete mode 100644 web/src/Pages/CompanyProfile/companyProfile.scss delete mode 100644 web/src/Pages/ProgrammeManagement/programmeManagement.scss diff --git a/web/src/Pages/AddUser/addUser.scss b/web/src/Pages/AddUser/addUser.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/web/src/Pages/AddUser/addUserLayout.tsx b/web/src/Pages/AddUser/addUserLayout.tsx deleted file mode 100644 index 267534dd1..000000000 --- a/web/src/Pages/AddUser/addUserLayout.tsx +++ /dev/null @@ -1,15 +0,0 @@ -// import React from 'react'; -// import CustomLayout from '../../Components/Layout/layout'; -// import AddUser from './addUser'; - -// const AddUserLayout = () => { -// return ( -//
-// -// -// -//
-// ); -// }; - -export default 'AddUserLayout'; diff --git a/web/src/Pages/Common/colors.addCompany.scss b/web/src/Pages/Common/colors.addCompany.scss deleted file mode 100644 index 1aa6547b1..000000000 --- a/web/src/Pages/Common/colors.addCompany.scss +++ /dev/null @@ -1,5 +0,0 @@ -$title-main: #16b1ff; -$title-sub: #555657; -$common-form-white: #ffffff; -$steps-title: #3a3541; -$steps-count: rgba(58, 53, 65, 0.8); diff --git a/web/src/Pages/Common/colors.addUser.scss b/web/src/Pages/Common/colors.addUser.scss deleted file mode 100644 index ac63844c6..000000000 --- a/web/src/Pages/Common/colors.addUser.scss +++ /dev/null @@ -1,3 +0,0 @@ -$common-form-red: #d12800; -$common-form-white: #ffffff; -$common-form-input-border: #d9d9d9 diff --git a/web/src/Pages/Common/colors.dashboard.scss b/web/src/Pages/Common/colors.dashboard.scss deleted file mode 100644 index 29afc19df..000000000 --- a/web/src/Pages/Common/colors.dashboard.scss +++ /dev/null @@ -1,5 +0,0 @@ -$card-value: #dad9d9; -$white: #ffffff; -$primary-blue: #16b1ff; -$card-title: rgba(58, 53, 65, 0.8); -$card-labels: rgba(58, 53, 65, 0.5); diff --git a/web/src/Pages/Common/colors.role.scss b/web/src/Pages/Common/colors.role.scss deleted file mode 100644 index 58ea74129..000000000 --- a/web/src/Pages/Common/colors.role.scss +++ /dev/null @@ -1,20 +0,0 @@ -$admin-bg-color: rgba(255, 166, 166, 0.42); -$admin-color: #D12800; - -$root-bg-color: rgba(255, 0, 229, 0.15); -$root-color: #DB00FF; - -$manager-bg-color: rgba(96, 27, 209, 0.13); -$manager-color: #75009E; - -$view-bg-color: rgba(176, 190, 197, 0.23); -$view-color: #707070; - -$gov-bg-color: rgba(185, 226, 244, 0.56); -$gov-color: #16B1FF; - -$dev-bg-color:rgba(254, 241, 173, 0.55); -$dev-color: #FFA070; - -$cert-bg-color:rgba(128, 255, 0, 0.12); -$cert-color: #519E4F; \ No newline at end of file diff --git a/web/src/Pages/Common/common.form.colors.scss b/web/src/Pages/Common/common.form.colors.scss deleted file mode 100644 index 96e1787ac..000000000 --- a/web/src/Pages/Common/common.form.colors.scss +++ /dev/null @@ -1,3 +0,0 @@ -$common-form-label: #000000; -$common-form-placeholder: #aaaaaa; - diff --git a/web/src/Pages/Common/common.form.scss b/web/src/Pages/Common/common.form.scss deleted file mode 100644 index 34b4f97a0..000000000 --- a/web/src/Pages/Common/common.form.scss +++ /dev/null @@ -1,68 +0,0 @@ -@import './common.form.colors.scss'; - -.create-user-container { - .common-form-class { - .ant-form-item-label > label { - color: $common-form-label; - font-family: 'Inter-Regular'; - font-size: 1rem; - } - .ant-input { - height: 3.2rem; - background: #ffffff; - box-shadow: 4px 6px 15px rgba(0, 0, 0, 0.06); - border-radius: 0.3rem; - border: none; - padding-left: 1.5rem; - } - .ant-input::placeholder { - color: $common-form-placeholder !important; - font-family: 'Inter-Regular'; - font-size: 1rem; - } - .ant-select-selector { - height: 3.5rem; - background: #ffffff; - box-shadow: 4px 6px 15px rgba(0, 0, 0, 0.06); - border-radius: 0.3rem; - border: none; - padding-left: 1.5rem; - flex-direction: row; - align-items: center; - } - .ant-select-selection-search { - flex-direction: row !important; - align-items: center !important; - text-align: center; - display: flex; - flex-direction: column; - padding-left: 0.8vw; - } - .ant-form-item-explain-error { - padding-left: 1.5rem; - margin-top: 0.6rem; - } - .PhoneInputInput { - height: 3.5rem; - background: #ffffff; - box-shadow: 4px 6px 15px rgba(0, 0, 0, 0.06); - border-radius: 0.3rem; - border: none; - padding-left: 1.5rem; - flex-direction: row; - align-items: center; - color: $common-form-label; - font-family: 'Inter-Regular'; - font-size: 1rem; - } - input:-webkit-autofill, - input:-webkit-autofill:hover, - input:-webkit-autofill:focus { - -webkit-text-fill-color: $common-form-label; - -webkit-box-shadow: 0 0 0 30px white inset !important; - } - .PhoneInputInput:focus { - outline: none !important; - } - } -} diff --git a/web/src/Pages/Common/common.table.scss b/web/src/Pages/Common/common.table.scss deleted file mode 100644 index 8702fae81..000000000 --- a/web/src/Pages/Common/common.table.scss +++ /dev/null @@ -1,92 +0,0 @@ -@import '../../Styles/variables.scss'; - -.common-table-class { - .ant-table { - border-radius: 1rem; - .ant-table-thead { - justify-content: center; - .ant-table-cell { - color: $title-text-color; - font-weight: 600; - font-size: 0.8rem; - text-align: center; - } - } - .ant-table-tbody { - font-size: 0.8rem; - text-align: center; - color: $title-text-color; - } - - .ant-table-cell { - padding: 14px 12px; - } - - .ant-table-thead { - .ant-table-cell { - text-transform: uppercase; - } - } - } -} - - -.ant-table-pagination.ant-pagination { - margin: 16px 24px; -} - -.ant-select-item-option-content { - font-family: $primary-font-family; - color: $title-text-color; -} - -.ant-pagination-prev, .ant-pagination-next, .ant-pagination-jump-prev, .ant-pagination-jump-next, .ant-pagination-item { - height: 28px; - border-radius: 4px; - line-height: 26px; - font-size: 0.8rem; - font-family: $primary-font-family; -} - - -.ant-pagination-item-active:focus-visible { - border-color: $primary-color; -} - -.ant-pagination-options-quick-jumper { - font-size: 0.8rem; - font-family: $primary-font-family; - color: $title-text-color; - - height: 30px; - line-height: 30px; - - input { - height: 28px; - border-radius: 4px; - line-height: 26px; - color: $title-text-color; - } -} - -.ant-pagination-options { - .ant-select-single:not(.ant-select-customize-input) .ant-select-selector { - height: 28px; - border-radius: 4px; - line-height: 26px; - font-size: 0.8rem; - font-family: $primary-font-family; - color: $title-text-color; - } - - .ant-select-selection-item { - height: 28px; - color: $title-text-color; - line-height: 26px !important; - } - .ant-select-dropdown { - font-family: $primary-font-family; - color: $title-text-color; - font-size: 0.8rem; - } -} diff --git a/web/src/Pages/Common/configs.tsx b/web/src/Pages/Common/configs.tsx deleted file mode 100644 index 781015372..000000000 --- a/web/src/Pages/Common/configs.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export const dateTimeFormat = 'dd LLLL yyyy @ HH:mm'; -export const dateFormat = 'dd LLLL yyyy'; -export const creditUnit = 'ITMO'; diff --git a/web/src/Pages/Common/role.color.constants.tsx b/web/src/Pages/Common/role.color.constants.tsx deleted file mode 100644 index f0c696b6f..000000000 --- a/web/src/Pages/Common/role.color.constants.tsx +++ /dev/null @@ -1,22 +0,0 @@ -export const AdminBGColor = 'rgba(255, 166, 166, 0.42)'; -export const AdminColor = '#D12800'; - -export const RootBGColor = 'rgba(255, 0, 229, 0.15)'; -export const RootColor = '#DB00FF'; - -export const ManagerBGColor = 'rgba(96, 27, 209, 0.13)'; -export const ManagerColor = '#75009E'; - -export const ViewBGColor = 'rgba(176, 190, 197, 0.23)'; -export const ViewColor = '#707070'; - -export const GovBGColor = 'rgba(185, 226, 244, 0.56)'; -export const GovColor = '#16B1FF'; - -export const DevBGColor = 'rgba(254, 241, 173, 0.55)'; -export const DevColor = '#FFA070'; - -export const CertBGColor = 'rgba(128, 255, 0, 0.12)'; -export const CertColor = '#519E4F'; - -export const TooltipColor = '#6ACDFF'; diff --git a/web/src/Pages/Company/addNewCompany.layout.tsx b/web/src/Pages/Company/addNewCompany.layout.tsx deleted file mode 100644 index 835130e7f..000000000 --- a/web/src/Pages/Company/addNewCompany.layout.tsx +++ /dev/null @@ -1,17 +0,0 @@ -// import React from 'react'; -// import CustomLayout from '../../Components/Layout/layout'; -// import Dashboard from './dashboard'; -// import './dashboard.layout.scss'; - -// const DashboardLayout = () => { -// return ( -//
-// -// -// -//
-// ); -// }; - -// export default DashboardLayout; -export default 'AddUserLayout'; diff --git a/web/src/Pages/Company/addNewCompany.scss b/web/src/Pages/Company/addNewCompany.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/web/src/Pages/CompanyManagement/companyManagement.scss b/web/src/Pages/CompanyManagement/companyManagement.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/web/src/Pages/CompanyProfile/companyProfile.scss b/web/src/Pages/CompanyProfile/companyProfile.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/web/src/Pages/ProgrammeManagement/programmeManagement.scss b/web/src/Pages/ProgrammeManagement/programmeManagement.scss deleted file mode 100644 index 33e37c7f5..000000000 --- a/web/src/Pages/ProgrammeManagement/programmeManagement.scss +++ /dev/null @@ -1,64 +0,0 @@ -@import '../../Styles/variables.scss'; - -.programme-management { - .certify-list { - width: 110px; - display: flex; - align-items: center; - flex-wrap: wrap; - - .profile-icon { - margin-bottom: 4px; - } - } - .table-actions-section { - margin-bottom: 0px; - - input { - font-family: $primary-font-family; - font-size: 0.8rem; - } - } - - .all-check { - .ant-checkbox-inner::after { - background-color: rgba(#3a3541, 0.5); - } - - .ant-checkbox-checked .ant-checkbox-inner::after { - background-color: transparent; - } - .ant-checkbox-checked .ant-checkbox-inner { - background-color: rgba(#3a3541, 0.5); - border: none; - } - margin-right: 10px; - } - - .ant-checkbox-checked { - .ant-checkbox-input[value='Retired'] + .ant-checkbox-inner { - background-color: rgba(#3a3541, 0.4); - border: none; - } - - .ant-checkbox-input[value='AwaitingAuthorization'] + .ant-checkbox-inner { - background-color: rgba(#ed4d47, 0.6); - border: none; - } - - .ant-checkbox-input[value='Rejected'] + .ant-checkbox-inner { - background-color: rgba(#3a3541, 0.4); - border: none; - } - - .ant-checkbox-input[value='Issued'] + .ant-checkbox-inner { - background-color: rgba(#16b1ff, 1); - border: none; - } - - .ant-checkbox-input[value='New'] + .ant-checkbox-inner { - background-color: rgba(#76c327, 0.6); - border: none; - } - } -} From 54774bd7ffb1977bbac018efa7f3d611b5527d09 Mon Sep 17 00:00:00 2001 From: Dhanuxeptagon Date: Mon, 4 Sep 2023 12:53:06 +0530 Subject: [PATCH 002/135] update programme view and list view --- .../programmeManagement.tsx | 508 +----------------- web/src/Pages/ProgrammeView/programmeView.tsx | 105 ++-- 2 files changed, 77 insertions(+), 536 deletions(-) diff --git a/web/src/Pages/ProgrammeManagement/programmeManagement.tsx b/web/src/Pages/ProgrammeManagement/programmeManagement.tsx index 32a687b14..09abd048a 100644 --- a/web/src/Pages/ProgrammeManagement/programmeManagement.tsx +++ b/web/src/Pages/ProgrammeManagement/programmeManagement.tsx @@ -1,500 +1,40 @@ -import { - Checkbox, - Col, - Empty, - Input, - message, - PaginationProps, - Row, - Table, - Tag, - Tooltip, -} from 'antd'; -import { useEffect, useState } from 'react'; -import './programmeManagement.scss'; -import '../Common/common.table.scss'; import { useNavigate } from 'react-router-dom'; -import { TableDataType } from '../../Definitions/InterfacesAndType/userManagement.definitions'; import { useConnection } from '../../Context/ConnectionContext/connectionContext'; -import { CertBGColor, DevBGColor, GovBGColor, TooltipColor } from '../Common/role.color.constants'; -import ProfileIcon from '../../Components/ProfileIcon/profile.icon'; -import { CheckboxValueType } from 'antd/lib/checkbox/Group'; import { useTranslation } from 'react-i18next'; -import { - addCommSep, - CompanyRole, - getCompanyBgColor, - getStageEnumVal, - getStageTagType, - ProgrammeStage, - sumArray, -} from '../../Definitions/InterfacesAndType/programme.definitions'; -import { CheckboxChangeEvent } from 'antd/lib/checkbox'; import { useUserContext } from '../../Context/UserInformationContext/userInformationContext'; - -const { Search } = Input; +import { ProgrammeManagementColumns, ProgrammeManagementComponent } from '@undp/carbon-library'; +import { useAbilityContext } from '../../Casl/Can'; const ProgrammeManagement = () => { - const navigate = useNavigate(); - const { userInfoState } = useUserContext(); - const { get, delete: del, post } = useConnection(); - const [totalProgramme, setTotalProgramme] = useState(); - const [loading, setLoading] = useState(false); - const [tableData, setTableData] = useState([]); - const [currentPage, setCurrentPage] = useState(1); - const [pageSize, setPageSize] = useState(10); - // const [filter, setFilter] = useState([]); - const [search, setSearch] = useState(); - const [searchText, setSearchText] = useState(); - const [statusFilter, setStatusFilter] = useState(); - const [dataFilter, setDataFilter] = useState(); const { i18n, t } = useTranslation(['common', 'programme']); - const [sortOrder, setSortOrder] = useState(); - const [sortField, setSortField] = useState(); - const [ministrySectoralScope, setMinistrySectoralScope] = useState([]); - const [ministryLevelFilter, setMinistryLevelFilter] = useState(false); - - const statusOptions = Object.keys(ProgrammeStage).map((k, index) => ({ - label: Object.values(ProgrammeStage)[index], - value: k, - })); - - const [selectedStatus, setSelectedStatus] = useState(statusOptions.map((e) => e.value)); - - const [indeterminate, setIndeterminate] = useState(false); - const [checkAll, setCheckAll] = useState(true); - - const onStatusQuery = async (checkedValues: CheckboxValueType[]) => { - console.log(checkedValues); - - if (checkedValues !== selectedStatus) { - setSelectedStatus(checkedValues); - - setIndeterminate( - !!checkedValues.length && checkedValues.length < Object.keys(statusOptions).length - ); - setCheckAll(checkedValues.length === Object.keys(statusOptions).length); - } - - if (checkedValues.length === 0) { - setTableData([]); - setTotalProgramme(0); - return; - } - // setFilter([ - // { - // key: 'currentStage', - // operation: 'in', - // value: checkedValues, - // }, - // ]); - - setStatusFilter({ - key: 'currentStage', - operation: 'in', - value: checkedValues, - }); - }; - - const onCheckAllChange = (e: CheckboxChangeEvent) => { - const nw = e.target.checked ? statusOptions.map((el) => el.value) : []; - setSelectedStatus(nw); - setIndeterminate(false); - setCheckAll(e.target.checked); - onStatusQuery(nw); - }; - - const columns = [ - { - title: t('programme:title'), - dataIndex: 'title', - key: 'title', - sorter: true, - align: 'left' as const, - render: (item: any) => { - return {item}; - }, - onCell: (record: any, rowIndex: any) => { - return { - onClick: (ev: any) => { - navigate('/programmeManagement/view', { state: { record } }); - }, - }; - }, - }, - { - title: t('common:company'), - dataIndex: 'company', - key: 'company', - align: 'left' as const, - render: (item: any, itemObj: any) => { - const elements = item.map((obj: any) => { - return ( - -
- -
-
- ); - }); - return
{elements}
; - }, - }, - { - title: t('programme:sector'), - dataIndex: 'sector', - sorter: true, - key: 'sector', - align: 'left' as const, - }, - { - title: t('programme:status'), - dataIndex: 'currentStage', - key: 'currentStage', - sorter: true, - align: 'center' as const, - render: (item: any) => { - return ( - - {getStageEnumVal(item)} - - ); - }, - onCell: (record: any, rowIndex: any) => { - return { - onClick: (ev: any) => { - setSelectedStatus([record.currentStage]); - onStatusQuery([record.currentStage]); - }, - }; - }, - }, - { - title: t('programme:issued'), - dataIndex: 'creditIssued', - key: 'creditIssued', - sorter: true, - align: 'right' as const, - render: (item: any) => { - return item ? addCommSep(Number(item)) : '-'; - }, - }, - { - title: t('programme:balance'), - dataIndex: 'creditBalance', - key: 'creditBalance', - sorter: true, - align: 'right' as const, - render: (item: any) => { - return item ? addCommSep(Number(item)) : '-'; - }, - }, - { - title: t('programme:transferred'), - dataIndex: 'creditTransferred', - key: 'creditTransferred', - sorter: true, - align: 'right' as const, - render: (item: any) => { - return item ? addCommSep(sumArray(item)) : '-'; - }, - }, - { - title: t('programme:certifiers'), - dataIndex: 'certifierId', - key: 'certifierId', - align: 'left' as const, - sorter: true, - render: (item: any, itemObj: any) => { - if (item === null) { - return; - } - const cMap: any = {}; - for (const c of itemObj.certifier) { - cMap[c.companyId] = c; - } + const navigate = useNavigate(); - const elements = item.map((id: any) => { - const obj = cMap[id]; - if (!obj) { - return; - } - return ( - -
- -
-
- ); - }); - return
{elements}
; - }, - }, - { - title: t('programme:serialNoh'), - dataIndex: 'serialNo', - key: 'serialNo', - align: 'left' as const, - }, + const visibleColumns = [ + ProgrammeManagementColumns.title, + ProgrammeManagementColumns.company, + ProgrammeManagementColumns.sector, + ProgrammeManagementColumns.currentStage, + ProgrammeManagementColumns.creditIssued, + ProgrammeManagementColumns.creditBalance, + ProgrammeManagementColumns.creditTransferred, + ProgrammeManagementColumns.certifierId, + ProgrammeManagementColumns.serialNo ]; - // } - - const getAllProgramme = async () => { - setLoading(true); - - const filter: any[] = []; - const filterOr: any[] = []; - - if (dataFilter) { - filter.push(dataFilter); - } - if (statusFilter) { - filter.push(statusFilter); - } - if (search && search !== '') { - filter.push({ - key: 'title', - operation: 'like', - value: `${search}%`, - }); - } - - if (ministryLevelFilter) { - ministrySectoralScope?.map((secScope: any) => { - filterOr.push({ - key: 'sectoralScope', - operation: '=', - value: secScope, - }); - }); - } - - let sort: any; - if (sortOrder && sortField) { - sort = { - key: sortField === 'certifierId' ? 'certifierId[1]' : sortField, - order: sortOrder, - nullFirst: false, - }; - } else { - sort = { - key: 'createdTime', - order: 'DESC', - }; - } - - try { - const response: any = await post('national/programme/query', { - page: currentPage, - size: pageSize, - filterAnd: filter, - filterOr: filterOr?.length > 0 ? filterOr : undefined, - sort: sort, - }); - setTableData(response.data); - setTotalProgramme(response.response.data.total); - setLoading(false); - } catch (error: any) { - console.log('Error in getting programme', error); - message.open({ - type: 'error', - content: error.message, - duration: 3, - style: { textAlign: 'right', marginRight: 15, marginTop: 10 }, - }); - setLoading(false); - } - }; - - const getUserDetails = async () => { - setLoading(true); - try { - const response: any = await post('national/user/query', { - page: 1, - size: 10, - filterAnd: [ - { - key: 'id', - operation: '=', - value: userInfoState?.id, - }, - ], - }); - if (response && response.data) { - if ( - response?.data[0]?.companyRole === CompanyRole.MINISTRY && - response?.data[0]?.company && - response?.data[0]?.company?.sectoralScope - ) { - setMinistrySectoralScope(response?.data[0]?.company?.sectoralScope); - } - } - setLoading(false); - } catch (error: any) { - console.log('Error in getting users', error); - setLoading(false); - } - }; - - const onSearch = async () => { - setSearch(searchText); - }; - - useEffect(() => { - if (currentPage !== 1) { - setCurrentPage(1); - } else { - getAllProgramme(); - } - }, [statusFilter, dataFilter]); - - useEffect(() => { - getAllProgramme(); - }, [currentPage, pageSize, sortField, sortOrder, search, ministryLevelFilter]); - - useEffect(() => { - if (userInfoState?.companyRole === CompanyRole.MINISTRY) { - getUserDetails(); - } - }, []); - - // useEffect(() => { - // setCurrentPage(0); - // }, [statusFilter, dataFilter]); - - const onChange: PaginationProps['onChange'] = (page, size) => { - setCurrentPage(page); - setPageSize(size); - }; - const handleTableChange = (pag: any, sorter: any) => { - console.log(pag, sorter); - setSortOrder( - sorter.order === 'ascend' ? 'ASC' : sorter.order === 'descend' ? 'DESC' : undefined - ); - setSortField(sorter.columnKey); - // setCurrentPage(1); + const onNavigateToProgrammeView = (record: any) => { + navigate('/programmeManagement/view', { state: { record } }); }; return ( -
-
-
{t('programme:viewProgrammes')}
-
{t('programme:desc')}
-
-
- - -
- - {t('programme:all')} - - e.value)} - value={selectedStatus} - onChange={onStatusQuery} - /> -
- - -
-
- { - if (userInfoState) { - if (userInfoState.companyRole === CompanyRole.MINISTRY) { - if (v.target.checked) { - setMinistryLevelFilter(true); - } else { - setMinistryLevelFilter(false); - } - } else { - setDataFilter( - v.target.checked - ? { - key: 'companyId', - operation: 'ANY', - value: userInfoState?.companyId, - } - : undefined - ); - } - } - }} - > - {userInfoState && userInfoState.companyRole === CompanyRole.MINISTRY - ? t('view:ministryLevel') - : t('view:seeMine')} - -
-
- setSearchText(e.target.value)} - onChange={(e) => - e.target.value === '' - ? setSearch(e.target.value) - : setSearchText(e.target.value) - } - onSearch={setSearch} - style={{ width: 265 }} - /> -
-
- -
- - -
- handleTableChange(val, sorter)} - // scroll={{ x: 1500 }} - locale={{ - emptyText: ( - - ), - }} - /> - - - - - + ); }; diff --git a/web/src/Pages/ProgrammeView/programmeView.tsx b/web/src/Pages/ProgrammeView/programmeView.tsx index f3fa6beec..efca239fe 100644 --- a/web/src/Pages/ProgrammeView/programmeView.tsx +++ b/web/src/Pages/ProgrammeView/programmeView.tsx @@ -18,10 +18,8 @@ import { import { useConnection } from '../../Context/ConnectionContext/connectionContext'; import { useLocation, useNavigate } from 'react-router-dom'; import './programmeView.scss'; -import { isBase64 } from '../../Components/ProfileIcon/profile.icon'; import Chart from 'react-apexcharts'; import { useTranslation } from 'react-i18next'; -import InfoView from '../../Components/InfoView/info.view'; import * as Icon from 'react-bootstrap-icons'; import { BlockOutlined, @@ -40,55 +38,49 @@ import { SafetyOutlined, TransactionOutlined, } from '@ant-design/icons'; +import { DateTime } from 'luxon'; +import Geocoding from '@mapbox/mapbox-sdk/services/geocoding'; +import TextArea from 'antd/lib/input/TextArea'; +import { useUserContext } from '../../Context/UserInformationContext/userInformationContext'; +import { ShieldCheck } from 'react-bootstrap-icons'; import { - addCommSep, - addCommSepRound, - addSpaces, - CompanyRole, CreditTransferStage, - getFinancialFields, - getGeneralFields, - getRetirementTypeString, - getStageEnumVal, - getStageTagType, - Programme, - ProgrammeStage, - RetireType, + MapTypes, + MarkerData, + ProgrammeR, + ProgrammeTransfer, + addCommSep, + mitigationTypeList, sumArray, + dateTimeFormat, + isBase64, + creditUnit, + RetireType, TxType, + getRetirementTypeString, TypeOfMitigation, UnitField, -} from '../../Definitions/InterfacesAndType/programme.definitions'; -import RoleIcon from '../../Components/RoleIcon/role.icon'; -import { - CertBGColor, - CertColor, + addSpaces, + CompanyRole, + CompanyState, + Loading, + OrganisationStatus, + ProgrammeIssueForm, + ProgrammeStageR, + addCommSepRound, DevBGColor, DevColor, - GovBGColor, - GovColor, - RootBGColor, - RootColor, - ViewBGColor, - ViewColor, -} from '../Common/role.color.constants'; -import { DateTime } from 'luxon'; -import Geocoding from '@mapbox/mapbox-sdk/services/geocoding'; -import TextArea from 'antd/lib/input/TextArea'; -import { useUserContext } from '../../Context/UserInformationContext/userInformationContext'; -import { ShieldCheck } from 'react-bootstrap-icons'; -import { creditUnit, dateFormat, dateTimeFormat } from '../Common/configs'; -import ProgrammeIssueForm from '../../Components/Models/ProgrammeIssueForm'; -import ProgrammeTransferForm from '../../Components/Models/ProgrammeTransferForm'; -import ProgrammeRetireForm from '../../Components/Models/ProgrammeRetireForm'; -import ProgrammeRevokeForm from '../../Components/Models/ProgrammeRevokeForm'; -import OrganisationStatus from '../../Components/Organisation/OrganisationStatus'; -import Loading from '../../Components/Loading/Loading'; -import { CompanyState } from '../../Definitions/InterfacesAndType/companyManagement.definitions'; -import { ProgrammeTransfer, mitigationTypeList } from '@undp/carbon-library'; -import TimelineBody from '../../Components/TimelineBody/TimelineBody'; -import MapComponent from '../../Components/Maps/MapComponent'; -import { MapTypes, MarkerData } from '../../Definitions/InterfacesAndType/mapComponent.definitions'; + getStageEnumVal, + getGeneralFields, + getStageTagType, + RoleIcon, + InfoView, + ProgrammeRevokeForm, + ProgrammeRetireForm, + ProgrammeTransferForm, + MapComponent, + getFinancialFields, +} from '@undp/carbon-library'; import { useSettingsContext } from '../../Context/SettingsContext/settingsContext'; const ProgrammeView = () => { @@ -97,7 +89,7 @@ const ProgrammeView = () => { const { userInfoState } = useUserContext(); const { state } = useLocation(); const navigate = useNavigate(); - const [data, setData] = useState(); + const [data, setData] = useState(); const [historyData, setHistoryData] = useState([]); const { i18n, t } = useTranslation(['view']); const [loadingHistory, setLoadingHistory] = useState(false); @@ -176,7 +168,7 @@ const ProgrammeView = () => { return n ? Number(n) : 0; }; - const getPieChartData = (d: Programme) => { + const getPieChartData = (d: ProgrammeR) => { const frozen = d.creditFrozen ? d.creditFrozen.reduce((a, b) => numIsExist(a) + numIsExist(b), 0) : 0; @@ -268,7 +260,7 @@ const ProgrammeView = () => { }, 1000); }; - const genPieData = (d: Programme) => { + const genPieData = (d: ProgrammeR) => { // ['Authorised', 'Issued', 'Transferred', 'Retired', 'Frozen'] const dt = getPieChartData(d); @@ -977,7 +969,7 @@ const ProgrammeView = () => { genCerts(response.data, certTimes); genPieData(response.data); } else if (action === 'Reject') { - data!.currentStage = ProgrammeStage.Rejected; + data!.currentStage = ProgrammeStageR.Rejected; setData(data); } @@ -1160,7 +1152,7 @@ const ProgrammeView = () => { - + ); @@ -1223,6 +1215,7 @@ const ProgrammeView = () => { updateProgrammeData ) } + translator={i18n} /> ), }); @@ -1234,7 +1227,7 @@ const ProgrammeView = () => { ); } } else if ( - data.currentStage.toString() === ProgrammeStage.Authorised && + data.currentStage.toString() === ProgrammeStageR.Authorised && Number(data.creditEst) > Number(data.creditIssued) ) { if ( @@ -1273,6 +1266,7 @@ const ProgrammeView = () => { updateProgrammeData ) } + translator={i18n} /> ), }); @@ -1391,6 +1385,7 @@ const ProgrammeView = () => { userInfoState.companyRole === CompanyRole.GOVERNMENT || userInfoState.companyRole === CompanyRole.MINISTRY } + translator={i18n} /> ), }); @@ -1409,7 +1404,7 @@ const ProgrammeView = () => { const text = t('view:' + k); if (k === 'currentStatus') { generalInfo[text] = ( - {getStageEnumVal(v as string)} + {getStageEnumVal(v as string)} ); } else if (k === 'sector') { generalInfo[text] = ( @@ -1498,7 +1493,7 @@ const ProgrammeView = () => {
{elements}
- {getStageEnumVal(data.currentStage) === ProgrammeStage.Authorised ? ( + {getStageEnumVal(data.currentStage) === ProgrammeStageR.Authorised ? (
@@ -1588,7 +1583,7 @@ const ProgrammeView = () => { {userInfoState?.userRole !== 'ViewOnly' && userInfoState?.companyRole !== 'Certifier' && (
- {data.currentStage.toString() === ProgrammeStage.Authorised && + {data.currentStage.toString() === ProgrammeStageR.Authorised && data.creditBalance - (data.creditFrozen ? data.creditFrozen.reduce( @@ -1644,6 +1639,8 @@ const ProgrammeView = () => { updateCreditInfo ) } + translator={i18n} + useConnection={useConnection} /> ), }); @@ -1688,6 +1685,8 @@ const ProgrammeView = () => { updateCreditInfo ) } + translator={i18n} + useConnection={useConnection} /> ), }); @@ -1735,6 +1734,8 @@ const ProgrammeView = () => { updateCreditInfo ) } + useConnection={useConnection} + translator={i18n} /> ), }); From b04977409b5257d4722617fe7f845e01071c72a6 Mon Sep 17 00:00:00 2001 From: Dhanuxeptagon Date: Mon, 4 Sep 2023 12:53:20 +0530 Subject: [PATCH 003/135] update lib --- web/package.json | 2 +- web/yarn.lock | 177 +++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 174 insertions(+), 5 deletions(-) diff --git a/web/package.json b/web/package.json index ebdff47be..786e072a5 100644 --- a/web/package.json +++ b/web/package.json @@ -14,7 +14,7 @@ "@types/react-dom": "^18.0.8", "@types/styled-components": "^5.1.26", "@types/validator": "^13.7.13", - "@undp/carbon-library": "^1.0.61", + "@undp/carbon-library": "^1.0.88", "antd": "^4.24.1", "apexcharts": "^3.36.3", "axios": "^1.1.3", diff --git a/web/yarn.lock b/web/yarn.lock index 9b147391c..2f36534c1 100644 --- a/web/yarn.lock +++ b/web/yarn.lock @@ -2366,6 +2366,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.40.tgz#968d64746d20cac747a18ca982c0f1fe518c031c" integrity sha512-+yno3ItTEwGxXiS/75Q/aHaa5srkpnJaH+kdkTVJ3DtJEwv92itpKbxU+FjPoh2m/5G9zmUQfrL4A4C13c+iGA== +"@types/node@^18.11.9": + version "18.17.14" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.17.14.tgz#a621ad26e7eb076d6846dd3d39557ddf9d89f04b" + integrity sha512-ZE/5aB73CyGqgQULkLG87N9GnyGe5TcQjv34pwS8tfBs1IkCh0ASM69mydb2znqd6v0eX+9Ytvk6oQRqu8T1Vw== + "@types/normalize-package-data@^2.4.0": version "2.4.1" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz#d3357479a0fdfdd5907fe67e17e0a85c906e1301" @@ -2665,16 +2670,26 @@ dependencies: "@ucast/core" "^1.4.1" -"@undp/carbon-library@^1.0.61": - version "1.0.61" - resolved "https://registry.yarnpkg.com/@undp/carbon-library/-/carbon-library-1.0.61.tgz#8cf3f3c1e13dba186a35df7ed882f102de46d0d6" - integrity sha512-gBkjMuxRzLLECZ/4AEIUXYsRSXXlauDcZ+SEMkbFgAqsBw7B1rHjN9CLtwMGCSORoly2kJUhj8v6VJELDjxtXw== +"@undp/carbon-credit-calculator@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@undp/carbon-credit-calculator/-/carbon-credit-calculator-1.0.0.tgz#fbdfbb606cb7bd402ed74887dfc1f0861cfca892" + integrity sha512-7wbGm7uEYdRBWlKzATKIhFLd9Zip8yxLCi3cfAcufb5kACw8ZKqtbn+08EyZQiJbDoPB3ouM6Dx8Dl+FnqqPVg== + dependencies: + "@types/node" "^18.11.9" + convert-units "^2.3.4" + +"@undp/carbon-library@^1.0.88": + version "1.0.88" + resolved "https://registry.yarnpkg.com/@undp/carbon-library/-/carbon-library-1.0.88.tgz#3ce81a0977594acb207b21a094b1f099e2b72d22" + integrity sha512-CiSC4+VkHcRc9L0hpmfQP2KPvFj9tRPpBRHtGhKnftLXKHDboPe7Fh5fOlyG0btkcf6whkSLGMy46WtYJAMneA== dependencies: "@rollup/plugin-commonjs" "^25.0.0" "@rollup/plugin-node-resolve" "^15.0.2" "@rollup/plugin-typescript" "^11.1.1" + "@undp/carbon-credit-calculator" "^1.0.0" node-sass "^7.0.3" postcss "^8.4.23" + react-circle-flags "^0.0.19" rollup "^3.22.0" rollup-plugin-dts "^5.3.0" rollup-plugin-peer-deps-external "^2.2.4" @@ -4072,6 +4087,14 @@ convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0: resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f" integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A== +convert-units@^2.3.4: + version "2.3.4" + resolved "https://registry.yarnpkg.com/convert-units/-/convert-units-2.3.4.tgz#a279f4b3cb9b5d5094beba61abc742dcb46a180d" + integrity sha512-ERHfdA0UhHJp1IpwE6PnFJx8LqG7B1ZjJ20UvVCmopEnVCfER68Tbe3kvN63dLbYXDA2xFWRE6zd4Wsf0w7POg== + dependencies: + lodash.foreach "2.3.x" + lodash.keys "2.3.x" + cookie-signature@1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" @@ -7604,6 +7627,92 @@ locate-path@^6.0.0: dependencies: p-locate "^5.0.0" +lodash._basebind@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/lodash._basebind/-/lodash._basebind-2.3.0.tgz#2b5bc452a0e106143b21869f233bdb587417d248" + integrity sha512-SHqM7YCuJ+BeGTs7lqpWnmdHEeF4MWxS3dksJctHFNxR81FXPOzA4bS5Vs5CpcGTkBpM8FCl+YEbQEblRw8ABg== + dependencies: + lodash._basecreate "~2.3.0" + lodash._setbinddata "~2.3.0" + lodash.isobject "~2.3.0" + +lodash._basecreate@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/lodash._basecreate/-/lodash._basecreate-2.3.0.tgz#9b88a86a4dcff7b7f3c61d83a2fcfc0671ec9de0" + integrity sha512-vwZaWldZwS2y9b99D8i9+WtgiZXbHKsBsMrpxJEqTsNW20NhJo5W8PBQkeQO9CmxuqEYn8UkMnfEM2MMT4cVrw== + dependencies: + lodash._renative "~2.3.0" + lodash.isobject "~2.3.0" + lodash.noop "~2.3.0" + +lodash._basecreatecallback@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/lodash._basecreatecallback/-/lodash._basecreatecallback-2.3.0.tgz#37b2ab17591a339e988db3259fcd46019d7ac362" + integrity sha512-Ev+pDzzfVfgbiucpXijconLGRBar7/+KNCf05kSnk4CmdDVhAy1RdbU9efCJ/o9GXI08JdUGwZ+5QJ3QX3kj0g== + dependencies: + lodash._setbinddata "~2.3.0" + lodash.bind "~2.3.0" + lodash.identity "~2.3.0" + lodash.support "~2.3.0" + +lodash._basecreatewrapper@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/lodash._basecreatewrapper/-/lodash._basecreatewrapper-2.3.0.tgz#aa0c61ad96044c3933376131483a9759c3651247" + integrity sha512-YLycQ7k8AB9Wc1EOvLNxuRWcqipDkMXq2GCgnLWQR6qtgTb3gY3LELzEpnFshrEO4LOLs+R2EpcY+uCOZaLQ8Q== + dependencies: + lodash._basecreate "~2.3.0" + lodash._setbinddata "~2.3.0" + lodash._slice "~2.3.0" + lodash.isobject "~2.3.0" + +lodash._createwrapper@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/lodash._createwrapper/-/lodash._createwrapper-2.3.0.tgz#d1aae1102dadf440e8e06fc133a6edd7fe146075" + integrity sha512-XjaI/rzg9W+WO4WJDQ+PRlHD5sAMJ1RhJLuT65cBxLCb1kIYs4U20jqvTDGAWyVT3c34GYiLd9AreHYuB/8yJA== + dependencies: + lodash._basebind "~2.3.0" + lodash._basecreatewrapper "~2.3.0" + lodash.isfunction "~2.3.0" + +lodash._objecttypes@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/lodash._objecttypes/-/lodash._objecttypes-2.3.0.tgz#6a3ea3987dd6eeb8021b2d5c9c303549cc2bae1e" + integrity sha512-jbA6QyHt9cw3BzvbWzIcnU3Z12jSneT6xBgz3Y782CJsN1tV5aTBKrFo2B4AkeHBNaxSrbPYZZpi1Lwj3xjdtg== + +lodash._renative@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/lodash._renative/-/lodash._renative-2.3.0.tgz#77d8edd4ced26dd5971f9e15a5f772e4e317fbd3" + integrity sha512-v44MRirqYqZGK/h5UKoVqXWF2L+LUiLTU+Ogu5rHRVWJUA1uWIlHaMpG8f/OA8j++BzPMQij9+erXHtgFcbuwg== + +lodash._setbinddata@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/lodash._setbinddata/-/lodash._setbinddata-2.3.0.tgz#e5610490acd13277d59858d95b5f2727f1508f04" + integrity sha512-xMFfbF7dL+sFtrdE49uHFmfpBAEwlFtfgMp86nQRlAF6aizYL+3MTbnYMKJSkP1W501PhsgiBED5kBbZd8kR2g== + dependencies: + lodash._renative "~2.3.0" + lodash.noop "~2.3.0" + +lodash._shimkeys@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/lodash._shimkeys/-/lodash._shimkeys-2.3.0.tgz#611f93149e3e6c721096b48769ef29537ada8ba9" + integrity sha512-9Iuyi7TiWMGa/9+2rqEE+Zwye4b/U2w7Saw6UX1h6Xs88mEER+uz9FZcEBPKMVKsad9Pw5GNAcIBRnW2jNpneQ== + dependencies: + lodash._objecttypes "~2.3.0" + +lodash._slice@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/lodash._slice/-/lodash._slice-2.3.0.tgz#147198132859972e4680ca29a5992c855669aa5c" + integrity sha512-7C61GhzRUv36gTafr+RIb+AomCAYsSATEoK4OP0VkNBcwvsM022Z22AVgqjjzikeNO1U29LzsJZDvLbiNPUYvA== + +lodash.bind@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/lodash.bind/-/lodash.bind-2.3.0.tgz#c2a8e18b68e5ecc152e2b168266116fea5b016cc" + integrity sha512-goakyOo+FMN8lttMPnZ0UNlr5RlzX4IrUXyTJPT2A0tGCMXySupond9wzvDqTvVmYTcQjIKGrj8naJDS2xWAlQ== + dependencies: + lodash._createwrapper "~2.3.0" + lodash._renative "~2.3.0" + lodash._slice "~2.3.0" + lodash.camelcase@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" @@ -7614,6 +7723,49 @@ lodash.debounce@^4.0.8: resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow== +lodash.foreach@2.3.x: + version "2.3.0" + resolved "https://registry.yarnpkg.com/lodash.foreach/-/lodash.foreach-2.3.0.tgz#083404c91e846ee77245fdf9d76519c68b2af168" + integrity sha512-yLnyptVRJd0//AbGp480grgQG9iaDIV5uOgSbpurRy1dYybPbjNTLQ3FyLEQ84buVLPG7jyaiyvpzgfOutRB3Q== + dependencies: + lodash._basecreatecallback "~2.3.0" + lodash.forown "~2.3.0" + +lodash.forown@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/lodash.forown/-/lodash.forown-2.3.0.tgz#24fb4aaf800d45fc2dc60bfec3ce04c836a3ad7f" + integrity sha512-dUnCsuQTtq3Y7bxPNoEEqjJjPL2ftLtcz2PTeRKvhbpdM514AvnqCjewHGsm/W+dwspIwa14KoWEZeizJ7smxA== + dependencies: + lodash._basecreatecallback "~2.3.0" + lodash._objecttypes "~2.3.0" + lodash.keys "~2.3.0" + +lodash.identity@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/lodash.identity/-/lodash.identity-2.3.0.tgz#6b01a210c9485355c2a913b48b6711219a173ded" + integrity sha512-NYJ2r2cwy3tkx/saqbIZEX6oQUzjWTnGRu7d/zmBjMCZos3eHBxCpbvWFWSetv8jFVrptsp6EbWjzNgBKhUoOA== + +lodash.isfunction@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/lodash.isfunction/-/lodash.isfunction-2.3.0.tgz#6b2973e47a647cf12e70d676aea13643706e5267" + integrity sha512-X5lteBYlCrVO7Qc00fxP8W90fzRp6Ax9XcHANmU3OsZHdSyIVZ9ZlX5QTTpRq8aGY+9I5Rmd0UTzTIIyWPugEQ== + +lodash.isobject@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/lodash.isobject/-/lodash.isobject-2.3.0.tgz#2e16d3fc583da9831968953f2d8e6d73434f6799" + integrity sha512-jo1pfV61C4TE8BfEzqaHj6EIKiSkFANJrB6yscwuCJMSRw5tbqjk4Gv7nJzk4Z6nFKobZjGZ8Qd41vmnwgeQqQ== + dependencies: + lodash._objecttypes "~2.3.0" + +lodash.keys@2.3.x, lodash.keys@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-2.3.0.tgz#b350f4f92caa9f45a4a2ecf018454cf2f28ae253" + integrity sha512-c0UW0ffqMxSCtoVbmVt2lERJLkEqgoOn2ejPsWXzr0ZrqRbl3uruGgwHzhtqXxi6K/ei3Ey7zimOqSwXgzazPg== + dependencies: + lodash._renative "~2.3.0" + lodash._shimkeys "~2.3.0" + lodash.isobject "~2.3.0" + lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" @@ -7624,11 +7776,23 @@ lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== +lodash.noop@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/lodash.noop/-/lodash.noop-2.3.0.tgz#3059d628d51bbf937cd2a0b6fc3a7f212a669c2c" + integrity sha512-NpSm8HRm1WkBBWHUveDukLF4Kfb5P5E3fjHc9Qre9A11nNubozLWD2wH3UBTZbu+KSuX8aSUvy9b+PUyEceJ8g== + lodash.sortby@^4.7.0: version "4.7.0" resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" integrity sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA== +lodash.support@~2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/lodash.support/-/lodash.support-2.3.0.tgz#7eaf038af4f0d6aab776b44aa6dcfc80334c9bfd" + integrity sha512-etc7VWbB0U3Iya8ixj2xy4sDBN3jvPX7ODi8iXtn4KkkjNpdngrdc7Vlt5jub/Vgqx6/dWtp7Ml9awhCQPYKGQ== + dependencies: + lodash._renative "~2.3.0" + lodash.uniq@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" @@ -9866,6 +10030,11 @@ react-circle-flags@^0.0.18: resolved "https://registry.yarnpkg.com/react-circle-flags/-/react-circle-flags-0.0.18.tgz#ab48b410435dd2bb4419cda6f59b4378019fbbec" integrity sha512-3taT04bifZ2oSARDfoO4bMDfdIDfAxW6MeOaJ6fR17OcEn+/dGivE/nrtUYwfGKFp9/Sq92yo4FTT2I+DqAIqA== +react-circle-flags@^0.0.19: + version "0.0.19" + resolved "https://registry.yarnpkg.com/react-circle-flags/-/react-circle-flags-0.0.19.tgz#365451ce666cd9cd85e3055c411b6f1eb91ddb92" + integrity sha512-QJ96+CIEpHZ/QmgB7tXaaHFvaCNGS06kJHQJ7q7a60bXjcImQTrPxcO//b/d4hFrVmHeL61viJtUYYHKcLZszQ== + react-dev-utils@^12.0.1: version "12.0.1" resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-12.0.1.tgz#ba92edb4a1f379bd46ccd6bcd4e7bc398df33e73" From 221963981589226dd995312a37fa93b8e3d8f8b1 Mon Sep 17 00:00:00 2001 From: Dhanuxeptagon Date: Mon, 4 Sep 2023 18:14:43 +0530 Subject: [PATCH 004/135] removed unnecessary files --- .../CompanyRoleIcon/CompanyRoleIcon.tsx | 33 - .../ImgwithFallback/ImgWithFallback.tsx | 25 - web/src/Components/InfoView/info.view.scss | 34 - web/src/Components/InfoView/info.view.tsx | 53 -- web/src/Components/LegendItem/legendItem.scss | 13 - web/src/Components/LegendItem/legendItem.tsx | 21 - web/src/Components/Loading/Loading.tsx | 7 - web/src/Components/MapCards.tsx/MapCard.tsx | 20 - web/src/Components/MapCards.tsx/mapCard.scss | 26 - web/src/Components/Maps/MapComponent.tsx | 13 - web/src/Components/Maps/MapboxComponent.scss | 17 - web/src/Components/Maps/MapboxComponent.tsx | 123 --- .../Components/Models/ChangePasswordModel.tsx | 111 --- .../Components/Models/ProgrammeIssueForm.tsx | 155 ---- .../Components/Models/ProgrammeRetireForm.tsx | 461 ----------- .../Components/Models/ProgrammeRevokeForm.tsx | 104 --- .../Models/ProgrammeTransferForm.tsx | 338 -------- .../Components/Models/TransferActionModel.tsx | 252 ------ .../Models/UserActionConfirmationModel.tsx | 82 -- .../Organisation/OrganisationStatus.scss | 23 - .../Organisation/OrganisationStatus.tsx | 22 - .../Components/ProfileIcon/profile.icon.scss | 14 - .../Components/ProfileIcon/profile.icon.tsx | 39 - web/src/Components/RoleIcon/role.icon.scss | 9 - web/src/Components/RoleIcon/role.icon.tsx | 20 - .../Components/StasticCard/StasticCard.tsx | 65 -- .../Components/StasticCard/stasticCard.scss | 117 --- .../Components/TimelineBody/TimelineBody.scss | 16 - .../Components/TimelineBody/TimelineBody.tsx | 30 - .../Components/UserRoleIcon/UserRoleIcon.tsx | 37 - .../InterfacesAndType/addUser.definitions.tsx | 22 - .../companyManagement.definitions.tsx | 20 - .../mapComponent.definitions.tsx | 35 - .../programme.definitions.tsx | 319 ------- .../userManagement.definitions.tsx | 22 - web/src/Pages/Dashboard/CHART_OPTIONS.ts | 782 ------------------ .../Dashboard/ProgrammeRejectAndTransfer.tsx | 140 ---- web/src/Pages/Dashboard/barChartStats.tsx | 55 -- web/src/Pages/Dashboard/config.json | 7 - web/src/Pages/Dashboard/dashboard.layout.scss | 1 - web/src/Pages/Dashboard/dashboard.layout.tsx | 17 - web/src/Pages/Dashboard/dashboard.scss | 571 ------------- .../Dashboard/dashboardTypesInitialValues.ts | 80 -- web/src/Pages/Dashboard/pieChartStat.tsx | 61 -- web/src/Pages/Dashboard/toolTipTextGen.ts | 151 ---- web/src/Pages/Transfers/creditTransfer.scss | 60 -- .../programmeTransferManagement.scss | 147 ---- .../Pages/UserManagement/userManagement.scss | 0 web/src/Pages/UserProfile/UserProfile.scss | 0 49 files changed, 4770 deletions(-) delete mode 100644 web/src/Components/CompanyRoleIcon/CompanyRoleIcon.tsx delete mode 100644 web/src/Components/ImgwithFallback/ImgWithFallback.tsx delete mode 100644 web/src/Components/InfoView/info.view.scss delete mode 100644 web/src/Components/InfoView/info.view.tsx delete mode 100644 web/src/Components/LegendItem/legendItem.scss delete mode 100644 web/src/Components/LegendItem/legendItem.tsx delete mode 100644 web/src/Components/Loading/Loading.tsx delete mode 100644 web/src/Components/MapCards.tsx/MapCard.tsx delete mode 100644 web/src/Components/MapCards.tsx/mapCard.scss delete mode 100644 web/src/Components/Maps/MapComponent.tsx delete mode 100644 web/src/Components/Maps/MapboxComponent.scss delete mode 100644 web/src/Components/Maps/MapboxComponent.tsx delete mode 100644 web/src/Components/Models/ChangePasswordModel.tsx delete mode 100644 web/src/Components/Models/ProgrammeIssueForm.tsx delete mode 100644 web/src/Components/Models/ProgrammeRetireForm.tsx delete mode 100644 web/src/Components/Models/ProgrammeRevokeForm.tsx delete mode 100644 web/src/Components/Models/ProgrammeTransferForm.tsx delete mode 100644 web/src/Components/Models/TransferActionModel.tsx delete mode 100644 web/src/Components/Models/UserActionConfirmationModel.tsx delete mode 100644 web/src/Components/Organisation/OrganisationStatus.scss delete mode 100644 web/src/Components/Organisation/OrganisationStatus.tsx delete mode 100644 web/src/Components/ProfileIcon/profile.icon.scss delete mode 100644 web/src/Components/ProfileIcon/profile.icon.tsx delete mode 100644 web/src/Components/RoleIcon/role.icon.scss delete mode 100644 web/src/Components/RoleIcon/role.icon.tsx delete mode 100644 web/src/Components/StasticCard/StasticCard.tsx delete mode 100644 web/src/Components/StasticCard/stasticCard.scss delete mode 100644 web/src/Components/TimelineBody/TimelineBody.scss delete mode 100644 web/src/Components/TimelineBody/TimelineBody.tsx delete mode 100644 web/src/Components/UserRoleIcon/UserRoleIcon.tsx delete mode 100644 web/src/Definitions/InterfacesAndType/addUser.definitions.tsx delete mode 100644 web/src/Definitions/InterfacesAndType/companyManagement.definitions.tsx delete mode 100644 web/src/Definitions/InterfacesAndType/mapComponent.definitions.tsx delete mode 100644 web/src/Definitions/InterfacesAndType/programme.definitions.tsx delete mode 100644 web/src/Definitions/InterfacesAndType/userManagement.definitions.tsx delete mode 100644 web/src/Pages/Dashboard/CHART_OPTIONS.ts delete mode 100644 web/src/Pages/Dashboard/ProgrammeRejectAndTransfer.tsx delete mode 100644 web/src/Pages/Dashboard/barChartStats.tsx delete mode 100644 web/src/Pages/Dashboard/config.json delete mode 100644 web/src/Pages/Dashboard/dashboard.layout.scss delete mode 100644 web/src/Pages/Dashboard/dashboard.layout.tsx delete mode 100644 web/src/Pages/Dashboard/dashboard.scss delete mode 100644 web/src/Pages/Dashboard/dashboardTypesInitialValues.ts delete mode 100644 web/src/Pages/Dashboard/pieChartStat.tsx delete mode 100644 web/src/Pages/Dashboard/toolTipTextGen.ts delete mode 100644 web/src/Pages/Transfers/creditTransfer.scss delete mode 100644 web/src/Pages/Transfers/programmeTransferManagement.scss delete mode 100644 web/src/Pages/UserManagement/userManagement.scss delete mode 100644 web/src/Pages/UserProfile/UserProfile.scss diff --git a/web/src/Components/CompanyRoleIcon/CompanyRoleIcon.tsx b/web/src/Components/CompanyRoleIcon/CompanyRoleIcon.tsx deleted file mode 100644 index 31efdbc9e..000000000 --- a/web/src/Components/CompanyRoleIcon/CompanyRoleIcon.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { BankOutlined, ExperimentOutlined, SafetyOutlined } from '@ant-design/icons'; -import { FC } from 'react'; -import { - CertBGColor, - CertColor, - DevBGColor, - DevColor, - GovBGColor, - GovColor, -} from '../../Pages/Common/role.color.constants'; -import RoleIcon from '../RoleIcon/role.icon'; - -export interface CompanyRoleIconProps { - role: string; -} - -const CompanyRoleIcon: FC = (props: CompanyRoleIconProps) => { - const { role } = props; - return ( -
- {role === 'Government' ? ( - } bg={GovBGColor} color={GovColor} /> - ) : role === 'Certifier' ? ( - } bg={CertBGColor} color={CertColor} /> - ) : ( - } bg={DevBGColor} color={DevColor} /> - )} - {role === 'ProgrammeDeveloper' ?
{'Developer'}
:
{role}
} -
- ); -}; - -export default CompanyRoleIcon; diff --git a/web/src/Components/ImgwithFallback/ImgWithFallback.tsx b/web/src/Components/ImgwithFallback/ImgWithFallback.tsx deleted file mode 100644 index 6735fe5cb..000000000 --- a/web/src/Components/ImgwithFallback/ImgWithFallback.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; - -const ImgWithFallback = ({ - src, - alt, - fallbackSrc, - mediaType, - className, - ...delegated -}: { - src: string; - alt: string; - fallbackSrc: string; - mediaType: string; - className: string; -}) => { - return ( - - - {alt} - - ); -}; - -export default ImgWithFallback; diff --git a/web/src/Components/InfoView/info.view.scss b/web/src/Components/InfoView/info.view.scss deleted file mode 100644 index 85b011f63..000000000 --- a/web/src/Components/InfoView/info.view.scss +++ /dev/null @@ -1,34 +0,0 @@ -@import '../../Styles/variables.scss'; - -.info-view { - .title-icon { - padding-right: 10px; - } - - .title-text { - color: $title-text-color; - font-weight: 600; - } - - .title { - margin-bottom: 5px; - } - - .field-key { - color: $body-text-color; - font-weight: 500; - text-overflow: ellipsis; - overflow: hidden; - } - - .field-value { - color: $body-text-color; - text-overflow: ellipsis; - overflow: hidden; - } - - .field { - margin: 15px 25px; - font-size: 0.8rem; - } -} diff --git a/web/src/Components/InfoView/info.view.tsx b/web/src/Components/InfoView/info.view.tsx deleted file mode 100644 index ba3470787..000000000 --- a/web/src/Components/InfoView/info.view.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import { Col, Row } from 'antd'; -import { DateTime } from 'luxon'; -import React, { FC } from 'react'; -import { useTranslation } from 'react-i18next'; -import { dateFormat } from '../../Pages/Common/configs'; -import './info.view.scss'; - -export interface InfoViewProps { - data: any; - title: any; - icon: any; - hiddenColumns?: any; -} - -const InfoView: FC = (props: InfoViewProps) => { - const { title, data, icon, hiddenColumns } = props; - return ( -
-
- {icon} - {title} -
-
- {Object.keys(data).map((k: any) => { - if (hiddenColumns.indexOf(k) < 0) { - return ( - -
- {k} - - - {data[k] instanceof DateTime - ? data[k].toFormat(dateFormat) - : data[k] === '' || !data[k] || data[k] === 'NaN' - ? '-' - : data[k]} - - - ); - } else { - return null; - } - })} - - - ); -}; - -InfoView.defaultProps = { - hiddenColumns: [], -}; - -export default InfoView; diff --git a/web/src/Components/LegendItem/legendItem.scss b/web/src/Components/LegendItem/legendItem.scss deleted file mode 100644 index da5380489..000000000 --- a/web/src/Components/LegendItem/legendItem.scss +++ /dev/null @@ -1,13 +0,0 @@ -.legend-item-container { - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - font-size: 14px; - font-weight: 400; - margin-left: 0.75rem; - - .text { - margin-left: 0.2rem; - } -} diff --git a/web/src/Components/LegendItem/legendItem.tsx b/web/src/Components/LegendItem/legendItem.tsx deleted file mode 100644 index 926c4669f..000000000 --- a/web/src/Components/LegendItem/legendItem.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React, { FC } from 'react'; -import { CircleFill } from 'react-bootstrap-icons'; -import './legendItem.scss'; - -export interface LegendItemItemProps { - text: string; - color: string; -} - -const LegendItem: FC = (props: LegendItemItemProps) => { - const { text, color } = props; - - return ( -
- -
{text}
-
- ); -}; - -export default LegendItem; diff --git a/web/src/Components/Loading/Loading.tsx b/web/src/Components/Loading/Loading.tsx deleted file mode 100644 index f3066dd6d..000000000 --- a/web/src/Components/Loading/Loading.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { Spin } from 'antd'; - -const Loading = () => { - return ; -}; - -export default Loading; diff --git a/web/src/Components/MapCards.tsx/MapCard.tsx b/web/src/Components/MapCards.tsx/MapCard.tsx deleted file mode 100644 index 45e109d36..000000000 --- a/web/src/Components/MapCards.tsx/MapCard.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import React, { FC } from 'react'; -import moment from 'moment'; -import './mapCard.scss'; - -export interface MapCardProps { - title: string; - children: any; -} - -const MapCard: FC = (props: MapCardProps) => { - const { title, children } = props; - - return ( -
-
{title}
-
{children}
-
- ); -}; -export default MapCard; diff --git a/web/src/Components/MapCards.tsx/mapCard.scss b/web/src/Components/MapCards.tsx/mapCard.scss deleted file mode 100644 index 01a17d74f..000000000 --- a/web/src/Components/MapCards.tsx/mapCard.scss +++ /dev/null @@ -1,26 +0,0 @@ -.map-card { - display: flex; - flex-direction: column; - width: 100%; - height: 400px; - background: #f6f6f6; - box-shadow: rgba(106, 106, 106, 0.2) 0px 8px 24px; - border-radius: 10px; - padding: 10px 10px 10px 10px; - - .map-container { - display: flex; - flex-direction: row; - width: 100%; - } -} - -.map-card:hover { - display: flex; - flex-direction: column; - width: 100%; - background: #f1f1f1; - box-shadow: rgba(124, 124, 124, 0.2) 0px 8px 24px; - border-radius: 10px; - padding: 10px 10px 10px 10px; -} diff --git a/web/src/Components/Maps/MapComponent.tsx b/web/src/Components/Maps/MapComponent.tsx deleted file mode 100644 index 4b4825c6f..000000000 --- a/web/src/Components/Maps/MapComponent.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { - MapComponentProps, - MapTypes, -} from '../../Definitions/InterfacesAndType/mapComponent.definitions'; -import MapboxComponent from './MapboxComponent'; - -const MapComponent = (props: MapComponentProps) => { - const { mapType } = props; - - return
{mapType === MapTypes.Mapbox ? MapboxComponent(props) : ''}
; -}; - -export default MapComponent; diff --git a/web/src/Components/Maps/MapboxComponent.scss b/web/src/Components/Maps/MapboxComponent.scss deleted file mode 100644 index f8fe77480..000000000 --- a/web/src/Components/Maps/MapboxComponent.scss +++ /dev/null @@ -1,17 +0,0 @@ -@import '../../Pages/Common/colors.dashboard.scss'; - -.map-box-container { - .mapboxgl-popup-content { - background-color: $white !important; - color: $card-title !important; - } - - .mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip { - border-top-color: $white !important; - } - - .mapboxgl-popup-close-button, - .mapboxgl-popup-close-button:hover { - display: none; - } -} diff --git a/web/src/Components/Maps/MapboxComponent.tsx b/web/src/Components/Maps/MapboxComponent.tsx deleted file mode 100644 index cd36605b9..000000000 --- a/web/src/Components/Maps/MapboxComponent.tsx +++ /dev/null @@ -1,123 +0,0 @@ -import { useEffect, useRef } from 'react'; -import mapboxgl from 'mapbox-gl'; -import 'mapbox-gl/dist/mapbox-gl.css'; -import { - MapComponentProps, - MarkerData, -} from '../../Definitions/InterfacesAndType/mapComponent.definitions'; -import './MapboxComponent.scss'; - -mapboxgl.accessToken = process.env.REACT_APP_MAPBOXGL_ACCESS_TOKEN - ? process.env.REACT_APP_MAPBOXGL_ACCESS_TOKEN - : ''; - -const MapboxComponent = (props: MapComponentProps) => { - const mapContainerRef = useRef(null); - const { - center, - markers, - mapSource, - onClick, - showPopupOnClick, - onMouseMove, - layer, - height, - style, - zoom, - onRender, - } = props; - - useEffect(() => { - if (!mapContainerRef || !mapContainerRef.current || center.length !== 2) { - return; - } - - const map = new mapboxgl.Map({ - container: mapContainerRef.current || '', - style: style, - center: - !Number.isNaN(center[0]) && !Number.isNaN(center[1]) - ? [center[0], center[1]] - : [9.082, 8.6753], - zoom: zoom, - maxZoom: 17, - }); - - map.on('load', () => { - const currentMarkes: any = {}; - - if (mapSource) { - map.addSource(mapSource.key, mapSource.data); - } - - if (onClick) { - map.on('click', function (e) { - const popupContent = onClick(map, e); - if (showPopupOnClick && popupContent) { - const popup = new mapboxgl.Popup() - .setLngLat(map.unproject(e.point)) - .setHTML(popupContent) - .addTo(map); - } - }); - } - - if (onMouseMove) { - map.on('mousemove', function (e) { - onMouseMove(map, e); - }); - } - - if (layer) { - map.addLayer(layer); - } - - if (onRender) { - map.on('render', () => { - const markersList: MarkerData[] = onRender(map); - if (markersList) { - markersList.forEach((marker: MarkerData) => { - if (!currentMarkes[marker.id as number]) { - const createdMarker = new mapboxgl.Marker({ - color: marker.color, - element: marker.element ? marker.element : undefined, - }) - .setLngLat([marker.location[0], marker.location[1]]) - .addTo(map); - currentMarkes[marker.id as number] = createdMarker; - } - }); - - for (const id in currentMarkes) { - if (!markersList?.some((marker: MarkerData) => marker.id?.toString() === id)) { - currentMarkes[id].remove(); - delete currentMarkes[id]; - } - } - } - }); - } - }); - - if (markers) { - markers.forEach((marker: MarkerData) => { - new mapboxgl.Marker({ - color: marker.color, - element: marker.element ? marker.element : undefined, - }) - .setLngLat([marker.location[0], marker.location[1]]) - .addTo(map); - }); - } - }); - - return ( -
- ); -}; - -export default MapboxComponent; diff --git a/web/src/Components/Models/ChangePasswordModel.tsx b/web/src/Components/Models/ChangePasswordModel.tsx deleted file mode 100644 index ef78b4318..000000000 --- a/web/src/Components/Models/ChangePasswordModel.tsx +++ /dev/null @@ -1,111 +0,0 @@ -import { ExclamationCircleOutlined, LockOutlined } from '@ant-design/icons'; -import { Alert, Button, Form, Input, Modal } from 'antd'; -import { FC } from 'react'; -import { useTranslation } from 'react-i18next'; -import lockIcon from '../../Assets/Images/lock.svg'; - -export interface ChangePasswordProps { - onPasswordChanged: any; - onFieldsChanged: any; - onCanceled: any; - openModal: any; - errorMsg: any; - loadingBtn: boolean; -} - -const ChangePasswordModel: FC = (props: ChangePasswordProps) => { - const { onPasswordChanged, onFieldsChanged, onCanceled, openModal, errorMsg, loadingBtn } = props; - const { i18n, t } = useTranslation(['passwordReset']); - - return ( - -
- icon -
-
{t('passwordReset:changePassword')}
-
- } - open={openModal} - className={'popup-success password-reset-model'} - centered={true} - destroyOnClose={true} - footer={null} - onCancel={onCanceled} - > -
- - - - - - - - - ({ - validator(_, value) { - if (!value || getFieldValue('newPassword') === value) { - return Promise.resolve(); - } - return Promise.reject( - new Error(t('passwordReset:passwordsNotMatchedErr').toString()) - ); - }, - }), - ]} - > - - - - {errorMsg && } - -
- - -
- - - ); -}; - -export default ChangePasswordModel; diff --git a/web/src/Components/Models/ProgrammeIssueForm.tsx b/web/src/Components/Models/ProgrammeIssueForm.tsx deleted file mode 100644 index b49db1f12..000000000 --- a/web/src/Components/Models/ProgrammeIssueForm.tsx +++ /dev/null @@ -1,155 +0,0 @@ -import { LockOutlined } from '@ant-design/icons'; -import { Alert, Button, Col, Form, Input, InputNumber, Modal, Row } from 'antd'; -import { FC, useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { addCommSep, Programme } from '../../Definitions/InterfacesAndType/programme.definitions'; -import { creditUnit } from '../../Pages/Common/configs'; - -export interface ProgrammeIssueFormProps { - programme: Programme; - onCancel: any; - actionBtnText: string; - onFinish: any; - subText: string; - enableIssue: boolean; -} - -const ProgrammeIssueForm: FC = (props: ProgrammeIssueFormProps) => { - const { programme, onFinish, onCancel, actionBtnText, subText, enableIssue } = props; - const { i18n, t } = useTranslation(['view']); - const [popupError, setPopupError] = useState(undefined); - const [loading, setLoading] = useState(false); - - return ( -
- -
- {subText} - - - setPopupError(undefined)} - onFinish={async (d) => { - if (d.issueAmount === 0) { - setPopupError('Issue amount should be greater than 0'); - setLoading(false); - return; - } - setLoading(true); - const res = await onFinish(d); - setPopupError(res); - setLoading(false); - }} - > - {enableIssue ? ( - - -
{`${t('view:issueCreditText')} (${creditUnit})`}
- - - - ({ - validator(rule, value) { - if ( - getFieldValue('issueAmount') && - parseFloat(getFieldValue('issueAmount')) > - programme.creditEst - programme.creditIssued - ) { - // eslint-disable-next-line prefer-promise-reject-errors - return Promise.reject('Amount > Authorised'); - } - return Promise.resolve(); - }, - }), - ]} - > - { - if (!/[0-9\.]/.test(event.key)) { - event.preventDefault(); - } - }} - /> - - - - {'/'} - - - - - - - - ) : ( - - -
{`${t('view:authCreditText')} (${creditUnit})`}
- - - - - - - - )} - - - - - - - - - - {popupError ? : ''} - - - - - - - - ); -}; - -export default ProgrammeIssueForm; diff --git a/web/src/Components/Models/ProgrammeRetireForm.tsx b/web/src/Components/Models/ProgrammeRetireForm.tsx deleted file mode 100644 index faf0531c3..000000000 --- a/web/src/Components/Models/ProgrammeRetireForm.tsx +++ /dev/null @@ -1,461 +0,0 @@ -import { LockOutlined } from '@ant-design/icons'; -import { - Alert, - Button, - Checkbox, - Col, - Form, - Input, - InputNumber, - Modal, - Radio, - Row, - Select, - SelectProps, - Space, -} from 'antd'; -import { FC, useEffect, useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { useConnection } from '../../Context/ConnectionContext/connectionContext'; -import { CompanyState } from '../../Definitions/InterfacesAndType/companyManagement.definitions'; -import { addCommSep, Programme } from '../../Definitions/InterfacesAndType/programme.definitions'; -import { creditUnit } from '../../Pages/Common/configs'; - -export interface ProgrammeRetireFormProps { - programme: Programme; - onCancel: any; - actionBtnText: string; - onFinish: any; - subText?: string; - hideType: boolean; - myCompanyId?: number; -} - -const ProgrammeRetireForm: FC = (props: ProgrammeRetireFormProps) => { - const { programme, onFinish, onCancel, actionBtnText, subText, hideType, myCompanyId } = props; - const { i18n, t } = useTranslation(['view']); - const [popupError, setPopupError] = useState(undefined); - const [loading, setLoading] = useState(false); - const [type, setType] = useState(''); - const [form] = Form.useForm(); - - const [currentSum, setCurrentSum] = useState(0); - const [countryList, setCountryList] = useState([]); - const [value, setValue] = useState(); - const [checked, setChecked] = useState(false); - - const { get, delete: del, post } = useConnection(); - - const handleSearch = async (newValue: string) => { - if (newValue !== undefined) { - const resp = await post('national/organisation/countries', { - page: 1, - size: 250, - filterAnd: [ - { - key: 'name', - operation: 'like', - value: newValue.charAt(0).toUpperCase() + newValue.slice(1) + '%', - }, - ], - sort: { - key: 'name', - order: 'ASC', - }, - }); - setCountryList(resp.data.map((d: any) => ({ label: d.name, value: d.alpha2 }))); - } - }; - - const handleChange = (newValue: string) => { - setValue(newValue); - }; - - // if (!toCompanyDefault) { - // const myIndex = programme.companyId.map(e => Number(e)).indexOf(userCompanyId!); - // if (myIndex >= 0) { - // programme.companyId.splice(myIndex, 1); - // programme.creditOwnerPercentage.splice(myIndex, 1); - // } - // } - - if (!programme.creditOwnerPercentage && programme.companyId.length === 1) { - programme.creditOwnerPercentage = [100]; - } - - const companies: any = {}; - for (const c of programme.company) { - companies[c.companyId] = c; - } - const validCompanies: { percentage: number; name: any; available: number; companyId: any }[] = []; - const companyCredit = []; - let totalCredits = 0; - let companyName = undefined; - for (const index in programme.creditOwnerPercentage) { - if ( - (hideType && Number(programme.companyId[index]) !== myCompanyId) || - parseInt(companies[Number(programme.companyId[index])].state) === - CompanyState.SUSPENDED.valueOf() - ) { - continue; - } else { - companyName = companies[Number(programme.companyId[index])].name; - } - const companyAvailableTotal = - ((programme.creditBalance - (programme.creditFrozen ? programme.creditFrozen[index] : 0)) * - programme.creditOwnerPercentage[index]) / - 100; - validCompanies.push({ - percentage: programme.creditOwnerPercentage[index], - name: companies[Number(programme.companyId[index])].name, - available: companyAvailableTotal, - companyId: Number(programme.companyId[index]), - }); - companyCredit.push(0); - - totalCredits += companyAvailableTotal; - } - - useEffect(() => { - handleSearch(''); - if (hideType) { - setType('0'); - } - }, []); - - return ( -
- {subText && ( - -
- {subText} - - - )} - - setPopupError(undefined)} - onValuesChange={(v, allVal) => { - if (allVal.companyCredit) { - setCurrentSum( - allVal.companyCredit.reduce((a: any, b: any) => (a ? a : 0) + (b ? b : 0), 0) - ); - } - }} - onFinish={async (d) => { - setLoading(true); - if (d.comment) { - d.comment = d.comment.trim(); - } - if (hideType) { - d.type = '0'; - } - if (d.type === '0') { - if (currentSum === 0) { - setPopupError('Total Amount should be greater than 0'); - setLoading(false); - return; - } - d.fromCompanyIds = validCompanies.map((e) => Number(e.companyId)); - // programme.companyId.map((n) => Number(n)); - // d.companyCredit = d.companyCredit.map((n: any) => (n === undefined ? 0 : n)); - d.toCompanyMeta = { - name: d.company, - country: d.country, - }; - } - const res = await onFinish(d); - setPopupError(res); - setLoading(false); - }} - > - {hideType && ( - <> - - - - - - - - - - - - - - - - )} - {!hideType && ( - - - - { - setType(v.target.value); - form.setFieldsValue({ type: v.target.value }); - }} - > - - Cross-border transfer - Legal Action - Other - - - - - - )} - {type === '0' && ( -
- -
- - - (option?.label ?? '').toLowerCase().includes(input.toLowerCase()) - } - options={companyList} - /> */} - - - - - - - - - - - {validCompanies.map((pert, index) => { - return ( - - - {hideType ? ( -
{`${t( - 'view:totalRetireCredit' - )} (${creditUnit})`}
- ) : ( -
{pert.name}
- )} - - - ({ - validator(rule, v) { - if ( - getFieldValue(['companyCredit', index]) && - parseFloat(getFieldValue(['companyCredit', index])) > pert.available - ) { - // eslint-disable-next-line prefer-promise-reject-errors - return Promise.reject('Retire Amount > Credit Balance'); - } - return Promise.resolve(); - }, - }), - ]} - > - { - if (!/[0-9\.]/.test(event.key)) { - event.preventDefault(); - } - }} - /> - - - - {'/'} - - - - - - - - ); - })} - {!hideType && validCompanies.length > 1 && ( - - -
{`${t('view:totalTransferCredit')} (${creditUnit})`}
- - - - - - - - {'/'} - - - - - - - - )} - {/* {hideType && ( - - -
{`${t('view:totalRetireCredit')} (${creditUnit})`}
- - - - { - if (!/[0-9\.]/.test(event.key)) { - event.preventDefault(); - } - }} - /> - - - - {'/'} - - - - - - - - )} */} - - )} - - - - ({ - validator(rule, v) { - if (v !== undefined && v !== '' && v.trim() === '') { - // eslint-disable-next-line prefer-promise-reject-errors - return Promise.reject('Required field'); - } - return Promise.resolve(); - }, - }), - ]} - > - - - - - - - ({ - // validator(rule, v) { - // if (v === false) { - // // eslint-disable-next-line prefer-promise-reject-errors - // return Promise.reject('Required field'); - // } - // return Promise.resolve(); - // }, - // }), - // ]} - > - setChecked(v.target.checked)}> - {hideType ? t('view:confirmRetire') : t('view:confirmClosure')} - - - - - - {popupError ? : ''} - - - - - - - - ); -}; - -export default ProgrammeRetireForm; diff --git a/web/src/Components/Models/ProgrammeRevokeForm.tsx b/web/src/Components/Models/ProgrammeRevokeForm.tsx deleted file mode 100644 index 4dbcf91b4..000000000 --- a/web/src/Components/Models/ProgrammeRevokeForm.tsx +++ /dev/null @@ -1,104 +0,0 @@ -import { LockOutlined } from '@ant-design/icons'; -import { Alert, Button, Col, Form, Input, InputNumber, Modal, Row, Select } from 'antd'; -import { FC, useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { Programme } from '../../Definitions/InterfacesAndType/programme.definitions'; - -export interface ProgrammeRevokeFormProps { - programme: Programme; - onCancel: any; - actionBtnText: string; - onFinish: any; - subText: string; - showCertifiers: boolean; -} - -const ProgrammeRevokeForm: FC = (props: ProgrammeRevokeFormProps) => { - const { programme, onFinish, onCancel, actionBtnText, subText, showCertifiers } = props; - const { i18n, t } = useTranslation(['view']); - const [popupError, setPopupError] = useState(undefined); - const [loading, setLoading] = useState(false); - - return ( -
- -
- {subText} - - - setPopupError(undefined)} - onFinish={async (d) => { - setLoading(true); - const res = await onFinish(d); - setPopupError(res); - setLoading(false); - }} - > - {showCertifiers && ( - - - - - {/* - - - - {validCompanies.map((pert, index) => { - return ( - - -
{pert.name}
- - - ({ - validator(rule, v) { - if ( - getFieldValue(['companyCredit', index]) && - parseFloat(getFieldValue(['companyCredit', index])) > pert.available - ) { - // eslint-disable-next-line prefer-promise-reject-errors - return Promise.reject('Amount > Available'); - } - return Promise.resolve(); - }, - }), - ]} - > - { - if (!/[0-9\.]/.test(event.key)) { - event.preventDefault(); - } - }} - /> - - - - {'/'} - - - - - - - - ); - })} - {validCompanies.length > 1 && ( - - -
{`${t('view:totalTransferCredit')} (${creditUnit})`}
- - - - - - - - {'/'} - - - - - - - - )} - - - - - - - - - {popupError ? : ''} - - - - - - - - ); -}; - -export default ProgrammeTransferForm; diff --git a/web/src/Components/Models/TransferActionModel.tsx b/web/src/Components/Models/TransferActionModel.tsx deleted file mode 100644 index dff131959..000000000 --- a/web/src/Components/Models/TransferActionModel.tsx +++ /dev/null @@ -1,252 +0,0 @@ -import { Alert, Button, Checkbox, Col, Form, Input, InputNumber, Modal, Row, Select } from 'antd'; -import { FC, useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { ProgrammeTransfer } from '@undp/carbon-library'; -import { addCommSep } from '../../Definitions/InterfacesAndType/programme.definitions'; -import { creditUnit } from '../../Pages/Common/configs'; - -export interface TransferActionModelProps { - icon: any; - title: string; - transfer: ProgrammeTransfer; - onCancel: any; - actionBtnText: string; - onFinish: any; - subText: string; - disableToCompany?: boolean; - toCompanyDefault?: any; - openModal: boolean; - type: string; - remarkRequired: boolean; -} - -const TransferActionModel: FC = (props: TransferActionModelProps) => { - const { - transfer, - onFinish, - onCancel, - actionBtnText, - subText, - openModal, - title, - icon, - type, - remarkRequired, - } = props; - const { i18n, t } = useTranslation(['view', 'creditTransfer']); - const [popupError, setPopupError] = useState(undefined); - const [loading, setLoading] = useState(false); - const [checked, setChecked] = useState(false); - - const companyList = !transfer.isRetirement - ? [ - { - value: transfer.toCompanyId, - label: transfer.receiver[0].name, - }, - ] - : [ - { - value: transfer.fromCompanyId, - label: transfer.sender[0].name, - }, - ]; - return ( - -
{icon}
-
{title}
- - } - className={'popup-' + type} - open={openModal} - width={Math.min(430, window.innerWidth)} - centered={true} - footer={null} - onCancel={onCancel} - destroyOnClose={true} - > -
-
setPopupError(undefined)} - onFinish={async (d) => { - setLoading(true); - if (d.comment) { - d.comment = d.comment.trim(); - } - const res = await onFinish(transfer.requestId, d.comment); - setPopupError(res); - setLoading(false); - }} - > - -
- - - (option?.label ?? '').toLowerCase().includes(input.toLowerCase()) - } - options={companyList} - /> */} - - - - - - - - - - - {!transfer.isRetirement && ( - - - - - - - - )} - {transfer.toCompanyMeta && transfer.toCompanyMeta.country && ( - - - - - - - - )} - {transfer.toCompanyMeta && transfer.toCompanyMeta.name && ( - - - - - - - - )} - - -
{`${t('view:transferApproveTotal')} (${creditUnit})`}
- - - - - - - - - - ({ - validator(rule, v) { - if (remarkRequired && v !== undefined && v !== '' && v.trim() === '') { - // eslint-disable-next-line prefer-promise-reject-errors - return Promise.reject('Required field'); - } - return Promise.resolve(); - }, - }), - ]} - > - - - - - - - ({ - // validator(rule, v) { - // if (v === false) { - // // eslint-disable-next-line prefer-promise-reject-errors - // return Promise.reject('Required field'); - // } - // return Promise.resolve(); - // }, - // }), - // ]} - > - setChecked(v.target.checked)}> - {t('view:confirmClosure')} - - - - - - {popupError ? : ''} - - - - - - - - - ); -}; - -export default TransferActionModel; diff --git a/web/src/Components/Models/UserActionConfirmationModel.tsx b/web/src/Components/Models/UserActionConfirmationModel.tsx deleted file mode 100644 index 094feb568..000000000 --- a/web/src/Components/Models/UserActionConfirmationModel.tsx +++ /dev/null @@ -1,82 +0,0 @@ -import { Alert, Form, Modal, Button } from 'antd'; -import { FC, useEffect, useState } from 'react'; -import TextArea from 'antd/lib/input/TextArea'; -import { useTranslation } from 'react-i18next'; - -export interface UserActionProps { - actionInfo: any; - onActionConfirmed: any; - onActionCanceled: any; - openModal: any; - errorMsg: any; - loading: any; -} - -const UserActionConfirmationModel: FC = (props: UserActionProps) => { - const { actionInfo, onActionConfirmed, onActionCanceled, openModal, errorMsg, loading } = props; - const [comment, setComment] = useState(''); - const { i18n, t } = useTranslation(['userProfile']); - - useEffect(() => { - setComment(''); - }, [openModal]); - - return ( - -
{actionInfo.icon}
-
{actionInfo.headerText}
- - } - className={'popup-' + actionInfo.type} - open={openModal} - width={Math.min(400, window.innerWidth)} - centered={true} - onCancel={onActionCanceled} - destroyOnClose={true} - footer={null} - > -

{actionInfo.text}

-
{ - onActionConfirmed(comment); - }} - > - -