Skip to content

Commit

Permalink
Merge branch 'feature/contracts' of github.com:code4romania/teo into …
Browse files Browse the repository at this point in the history
…feature/contracts
  • Loading branch information
radulescuandrew committed Sep 9, 2024
2 parents 7bbbf77 + 864e834 commit 06e6c59
Show file tree
Hide file tree
Showing 22 changed files with 1,622 additions and 95 deletions.
23 changes: 23 additions & 0 deletions frontend/src/assets/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,29 @@
"confirm": "Confirm and sign"
}
},
"volunteering_contracts": {
"title": "Volunteering contracts",
"templates": "Contract templates",
"description": "View the list of all your volunteer contracts in VIC. The volunteer contract has a predefined structure. You can create multiple contract templates (e.g. contract for volunteers >16 years old, contract for volunteers <16 years old).",
"tabs": {
"contracts": "Contract list",
"templates": "Templates"
},
"statistics": {
"active_contracts": "Active contracts",
"in_signing_contracts": "Contracts in signing process",
"saved_contracts": "Saved contracts (unsent)",
"to_expire_soon": "Contracts expiring soon"
},
"table_header": {
"title": "Contract templates",
"download_all": "Download all",
"create_template": "Create template"
},
"generate": {
"title": "Generate contract"
}
},
"doc_templates": {
"title": "Create template",
"subheading": {
Expand Down
25 changes: 24 additions & 1 deletion frontend/src/assets/locales/ro/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,29 @@
"confirm": "Confirmă și semnează"
}
},
"volunteering_contracts": {
"title": "Contracte de voluntariat",
"templates": "Template-uri de contracte",
"description": "Vizualizează lista tuturor contractelor voluntarilor tăi din VIC. Contractul de voluntar are o structura prestabilită. Poți crea mai multe template-uri de contracte (ex. contract pentru voluntari >16 ani, contract pentru voluntari <16 ani).",
"tabs": {
"contracts": "Listă contracte",
"templates": "Template-uri"
},
"statistics": {
"active_contracts": "Contracte active",
"in_signing_contracts": "Contracte în curs de semnare",
"saved_contracts": "Contracte salvate (netrimise)",
"to_expire_soon": "Contracte care expiră curând"
},
"table_header": {
"title": "Template-uri de contracte",
"download_all": "Descarcă toate",
"create_template": "Creează template"
},
"generate": {
"title": "Generează contract"
}
},
"doc_templates": {
"title": "Creează template",
"subheading": {
Expand Down Expand Up @@ -1009,7 +1032,7 @@
},
"legal_representative_data": {
"title": "Datele reprezentantului legal",
"description": " Voluntarii sub 16 ani vor trebui sa completeze sectiunea ce conține datele reprezentantului, din aplicația mobilă, în momentul semnării contractului."
"description": " Voluntarii sub 16 ani vor trebui completeze sectiunea ce conține datele reprezentantului, din aplicația mobilă, în momentul semnării contractului."
},
"organization_data_form": {
"loading_error": "Am întâmpinat o problemă la încărcarea datelor despre organizație",
Expand Down
12 changes: 11 additions & 1 deletion frontend/src/common/constants/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,21 @@ export const ROUTES: IRoute[] = [
},
{
id: 62,
name: i18n.t('general:templates'),
name: 'Contracte * NEW *',
href: 'documents/templates',
},
{
id: 63,
name: 'Creează template * NEW *',
href: 'documents/templates/create',
},
{
id: 64,
name: 'Generează contract * NEW *',
href: 'documents/templates/contracts/generate',
},
{
id: 65,
name: 'stepper',
href: 'documents/templates/stepper_example',
},
Expand Down
52 changes: 52 additions & 0 deletions frontend/src/components/ContractsStatistics.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React from 'react';
import StatisticsCard from './StatisticsCard';
import { useTranslation } from 'react-i18next';

export const ContractsStatistics = () => {
const { t } = useTranslation('volunteering_contracts');

return (
<div className="flex flex-col sm:flex-row gap-2">
<StatisticsCard
label={t('statistics.active_contracts')}
// todo: get active contracts count
value={'13'}
action={{
label: 'Vezi lista',
// todo: add functionality to view list of active contracts
onClick: () => {},
}}
/>
<StatisticsCard
label={t('statistics.in_signing_contracts')}
// todo: get in signing contracts count
value={'1'}
action={{
label: 'Vezi lista',
// todo: add functionality to view list of in signing contracts
onClick: () => {},
}}
/>
<StatisticsCard
label={t('statistics.saved_contracts')}
// todo: get saved contracts count
value={'5'}
action={{
label: 'Vezi lista',
// todo: add functionality to view list of saved contracts
onClick: () => {},
}}
/>
<StatisticsCard
label={t('statistics.to_expire_soon')}
// todo: get to expire soon contracts count
value={'12'}
action={{
label: 'Vezi lista',
// todo: add functionality to view list of to expire soon contracts
onClick: () => {},
}}
/>
</div>
);
};
11 changes: 11 additions & 0 deletions frontend/src/components/DataTableComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ interface DataTableProps<T> {
paginationDefaultPage?: number;
onChangePage?: (page: number) => void;
onChangeRowsPerPage?: (rowsPerPage: number) => void;
selectableRows?: boolean;
selectableRowsSingle?: boolean;
onSelectedRowsChange?: (selectedRows: T[]) => void;
onSort?: (selectedColumn: TableColumn<T>, sortDirection: SortOrder, sortedRows: T[]) => void;
defaultSortFieldId?: string | number;
defaultSortAsc?: boolean;
Expand All @@ -35,6 +38,9 @@ const DataTableComponent = <T extends object>({
onSort,
onChangePage,
onChangeRowsPerPage,
selectableRows,
selectableRowsSingle,
onSelectedRowsChange,
defaultSortFieldId,
defaultSortAsc,
}: DataTableProps<T>) => {
Expand Down Expand Up @@ -68,6 +74,11 @@ const DataTableComponent = <T extends object>({
progressComponent={<LoadingContent />}
defaultSortFieldId={defaultSortFieldId}
defaultSortAsc={defaultSortAsc}
selectableRows={selectableRows}
selectableRowsSingle={selectableRowsSingle}
onSelectedRowsChange={(selected) =>
onSelectedRowsChange && onSelectedRowsChange(selected.selectedRows)
}
/>
);
};
Expand Down
Loading

0 comments on commit 06e6c59

Please sign in to comment.