diff --git a/src/components/MPayBillButton.js b/src/components/MPayBillButton.js index efd508e..bcc24fd 100644 --- a/src/components/MPayBillButton.js +++ b/src/components/MPayBillButton.js @@ -22,13 +22,12 @@ function MPayBillButton({ bill }) { return ( ); diff --git a/src/components/VoucherAcquirementForm.js b/src/components/VoucherAcquirementForm.js index bce06a5..6f0253c 100644 --- a/src/components/VoucherAcquirementForm.js +++ b/src/components/VoucherAcquirementForm.js @@ -54,12 +54,11 @@ function VoucherAcquirementForm() { diff --git a/src/components/VoucherAcquirementGenericVoucher.js b/src/components/VoucherAcquirementGenericVoucher.js index 6eb4ae4..3f374a0 100644 --- a/src/components/VoucherAcquirementGenericVoucher.js +++ b/src/components/VoucherAcquirementGenericVoucher.js @@ -5,6 +5,7 @@ import { Button, Divider, Grid, Tooltip, Typography, } from '@material-ui/core'; import { makeStyles } from '@material-ui/styles'; +import ShoppingCartIcon from '@material-ui/icons/ShoppingCart'; import { coreAlert, @@ -148,12 +149,13 @@ function VoucherAcquirementGenericVoucher() { > diff --git a/src/components/VoucherAcquirementSpecificWorker.js b/src/components/VoucherAcquirementSpecificWorker.js index a3a554d..00ac740 100644 --- a/src/components/VoucherAcquirementSpecificWorker.js +++ b/src/components/VoucherAcquirementSpecificWorker.js @@ -5,6 +5,7 @@ import { Button, Divider, Grid, Tooltip, Typography, } from '@material-ui/core'; import { makeStyles } from '@material-ui/styles'; +import ShoppingCartIcon from '@material-ui/icons/ShoppingCart'; import { coreAlert, @@ -31,6 +32,12 @@ export const useStyles = makeStyles((theme) => ({ }, tableTitle: theme.table.title, item: theme.paper.item, + listItem: { + border: `1px solid ${theme.palette.divider}`, + borderRadius: theme.shape.borderRadius, + marginBottom: theme.spacing(0.5), + backgroundColor: theme.palette.background.paper, + }, })); function VoucherAcquirementSpecificWorker() { @@ -155,12 +162,13 @@ function VoucherAcquirementSpecificWorker() { > diff --git a/src/components/VoucherAssignmentForm.js b/src/components/VoucherAssignmentForm.js index 01e3ee1..50c3544 100644 --- a/src/components/VoucherAssignmentForm.js +++ b/src/components/VoucherAssignmentForm.js @@ -5,6 +5,7 @@ import { Divider, Grid, Paper, Typography, Button, Tooltip, } from '@material-ui/core'; import { makeStyles } from '@material-ui/styles'; +import AssignmentIndIcon from '@material-ui/icons/AssignmentInd'; import { coreAlert, useModulesManager, useTranslations, journalize, historyPush, useHistory, @@ -24,6 +25,12 @@ export const useStyles = makeStyles((theme) => ({ }, tableTitle: theme.table.title, item: theme.paper.item, + listItem: { + border: `1px solid ${theme.palette.divider}`, + borderRadius: theme.shape.borderRadius, + marginBottom: theme.spacing(0.5), + backgroundColor: theme.palette.background.paper, + }, })); function VoucherAssignmentForm() { @@ -122,12 +129,13 @@ function VoucherAssignmentForm() { > diff --git a/src/components/VoucherDetailsPanel.js b/src/components/VoucherDetailsPanel.js index ea5045a..70ef05a 100644 --- a/src/components/VoucherDetailsPanel.js +++ b/src/components/VoucherDetailsPanel.js @@ -72,7 +72,7 @@ function VoucherDetailsPanel({ handlePrint(null, () => voucherPrintTemplateRef.current); }} > - {formatMessage('workerVoucher.printVoucher')} + {formatMessage('workerVoucher.printVoucher')} )} )} diff --git a/src/components/VoucherSearcher.js b/src/components/VoucherSearcher.js index 9117006..8be2eb1 100644 --- a/src/components/VoucherSearcher.js +++ b/src/components/VoucherSearcher.js @@ -217,6 +217,7 @@ function VoucherSearcher({ downloadWorkerVoucher, fetchWorkerVouchers, clearWork exportFileFormats={EXPORT_FILE_FORMATS} exportFileFormat={exportFileFormat} setExportFileFormat={setExportFileFormat} + downloadWithIconButton /> {failedExport && ( diff --git a/src/components/WorkerSearcher.js b/src/components/WorkerSearcher.js index 18bf8d3..b9342fd 100644 --- a/src/components/WorkerSearcher.js +++ b/src/components/WorkerSearcher.js @@ -40,7 +40,9 @@ import { useUploadWorkerContext } from '../context/UploadWorkerContext'; const WORKER_SEARCHER_ACTION_CONTRIBUTION_KEY = 'workerVoucher.WorkerSearcherAction.select'; -function WorkerSearcher({ downloadWorkers, fetchWorkers: fetchWorkersAction, clearWorkersExport }) { +function WorkerSearcher({ + downloadWorkers, fetchWorkers: fetchWorkersAction, clearWorkersExport, searcherActions = [], enableActionButtons, +}) { const history = useHistory(); const modulesManager = useModulesManager(); const dispatch = useDispatch(); @@ -285,6 +287,9 @@ function WorkerSearcher({ downloadWorkers, fetchWorkers: fetchWorkersAction, cle exportFileFormats={EXPORT_FILE_FORMATS} exportFileFormat={exportFileFormat} setExportFileFormat={setExportFileFormat} + enableActionButtons={enableActionButtons} + searcherActions={searcherActions} + downloadWithIconButton /> {failedExport && ( diff --git a/src/components/WorkerSearcherSelectActions.js b/src/components/WorkerSearcherSelectActions.js index 1ebdb06..87d761d 100644 --- a/src/components/WorkerSearcherSelectActions.js +++ b/src/components/WorkerSearcherSelectActions.js @@ -1,17 +1,23 @@ import React, { useEffect, useRef, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import { MenuItem, Tooltip } from '@material-ui/core'; +import { + MenuItem, Tooltip, Typography, Button, +} from '@material-ui/core'; import { makeStyles } from '@material-ui/styles'; +import DeleteIcon from '@material-ui/icons/Delete'; import { SelectDialog, journalize, useTranslations } from '@openimis/fe-core'; import { deleteWorkersFromEconomicUnit } from '../actions'; import { MODULE_NAME } from '../constants'; -const useStyles = makeStyles(() => ({ +const useStyles = makeStyles((theme) => ({ uppercase: { textTransform: 'uppercase', }, + trigger: { + marginLeft: theme.spacing(1), + }, })); function WorkerSearcherSelectActions({ @@ -19,6 +25,7 @@ function WorkerSearcherSelectActions({ refetch: refetchWorkers, clearSelected, withSelection, + downloadWithIconButton = false, }) { const prevSubmittingMutationRef = useRef(); const prevEconomicUnitRef = useRef(); @@ -71,9 +78,24 @@ function WorkerSearcherSelectActions({ return ( <> - - {formatMessage('workerVoucher.WorkerSearcherSelectActions.delete')} - + {downloadWithIconButton ? ( + + ) : ( + + + {formatMessage('workerVoucher.WorkerSearcherSelectActions.delete')} + + + )} state.core?.user?.i_user?.rights ?? []); - const leftPlacement = 'left'; const onAddRedirect = () => { historyPush(modulesManager, history, 'workerVoucher.route.worker'); @@ -51,31 +45,28 @@ function WorkersPage() { setUploadOpen(false); }; + const SEARCHER_ACTIONS = [ + { + label: formatMessage('workerVoucher.WorkersPage.uploadAction'), + icon: , + authorized: rights.includes(RIGHT_WORKER_UPLOAD), + onClick: onUploadOpen, + }, + { + label: formatMessage('workerVoucher.WorkersPage.addAction'), + icon: , + authorized: rights.includes(RIGHT_WORKER_ADD), + onClick: onAddRedirect, + }, + ]; + return ( rights.includes(RIGHT_WORKER_SEARCH) && (
- -
- {rights.includes(RIGHT_WORKER_UPLOAD) - && withTooltip( - - - , - formatMessage('workerVoucher.WorkersPage.uploadTooltip'), - leftPlacement, - )} - {rights.includes(RIGHT_WORKER_ADD) - && withTooltip( - - - , - formatMessage('workerVoucher.WorkersPage.addTooltip'), - leftPlacement, - )} -
+
) diff --git a/src/pickers/WorkerDateRangePicker.js b/src/pickers/WorkerDateRangePicker.js index 161b9a9..b15c4f4 100644 --- a/src/pickers/WorkerDateRangePicker.js +++ b/src/pickers/WorkerDateRangePicker.js @@ -6,7 +6,6 @@ import { Button, List, ListItem, - IconButton, ListItemText, ListItemSecondaryAction, Avatar, @@ -50,7 +49,10 @@ function WorkerDateRangePicker({ return ( - + + + {formatMessage('workerVoucher.WorkerDateRangePicker.selectDate')} + - { - !startDate || !endDate ? ( - - - - - - ) : ( + {!startDate || !endDate ? ( + - ) - } + + ) : ( + + + + )} - + {formatMessage('workerVoucher.WorkerDateRangePicker.dateRanges')} @@ -123,14 +123,19 @@ function WorkerDateRangePicker({ /> - deleteDateRange(index)} edge="end" aria-label="delete" disabled={readOnly} + startIcon={} > - - + + {formatMessage('workerVoucher.WorkerDateRangePicker.deleteRange')} + + diff --git a/src/pickers/WorkerMultiplePicker.js b/src/pickers/WorkerMultiplePicker.js index dc894cb..c40b02e 100644 --- a/src/pickers/WorkerMultiplePicker.js +++ b/src/pickers/WorkerMultiplePicker.js @@ -204,7 +204,6 @@ function WorkerMultiplePicker({ variant="contained" color="primary" startIcon={isLoading ? : } - size="large" disabled={isDisabled} onClick={handleImportDialogOpen} > diff --git a/src/translations/en.json b/src/translations/en.json index e7deb5f..c372fbd 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -14,19 +14,19 @@ "workerVoucher.employer": "Employer", "workerVoucher.export.filename": "worker_voucher_export", "workerVoucher.export.workers.filename": "workers_export", - "workerVoucher.export.vouchers": "DOWNLOAD VOUCHERS", - "workerVoucher.export.workers": "DOWNLOAD WORKERS", - "workerVoucher.employer.tradename": "Employer Trade Name", - "workerVoucher.employer.code": "Employer Code", + "workerVoucher.export.vouchers": "DOWNLOAD", + "workerVoucher.export.workers": "DOWNLOAD", + "workerVoucher.employer.tradename": "Employer Name", + "workerVoucher.employer.code": "Employer IDNO", "workerVoucher.worker": "Worker", "workerVoucher.group.new": "New Group", "workerVoucher.group.edit": "Edit Group {name}", "workerVoucher.workers": "Workers", - "workerVoucher.worker.chfId": "National ID", + "workerVoucher.worker.chfId": "IDNP", "workerVoucher.worker.assignedVouchers": "Vouchers This Year", "workerVoucher.worker.warning.limit": "WARNING", "workerVoucher.worker.warning.limitReached": "The worker has reached the maximum number of vouchers assigned for this calendar year, which is {limit}.", - "workerVoucher.worker.code": "Worker National ID", + "workerVoucher.worker.code": "Worker IDNP", "workerVoucher.worker.lastName": "Worker Last Name", "workerVoucher.worker.otherNames": "Worker First Name", "workerVoucher.worker.dob": "Worker Date of Birth", @@ -46,8 +46,8 @@ "workerVoucher.status.EXPIRED": "EXPIRED", "workerVoucher.status.CANCELED": "CANCELED", "workerVoucher.status.CLOSED": "CLOSED", - "workerVoucher.WorkersPage.addTooltip": "Add Worker", - "workerVoucher.WorkersPage.uploadTooltip": "Upload Workers", + "workerVoucher.WorkersPage.addAction": "Add Worker", + "workerVoucher.WorkersPage.uploadAction": "Upload Workers", "workerVoucher.WorkerSearcher.exportClose": "Close", "workerVoucher.VoucherDetailsPage.title": "Worker Voucher - {code}", "workerVoucher.WorkerDetailsPage.title": "{chfId} Worker Details Page", @@ -57,10 +57,9 @@ "workerVoucher.VoucherAcquirementForm.specificVoucherConfirmation": "You have successfully acquired vouchers for your selected workers. The vouchers will be ready for assignment once the payment is confirmed. The payment gateway has opened in a new tab. If you accidentally closed it, please click „Pay with MPay” from the Bill view to reopen it.", "workerVoucher.VoucherAssignmentForm.assignmentConfirmation": "You have successfully assigned voucher(s) to the selected worker(s).", "workerVoucher.acquirement.method": "Acquirement Method", - "workerVoucher.acquirement.method.NONE": "None", - "workerVoucher.acquirement.method.GENERIC_VOUCHER": "Generic Voucher", - "workerVoucher.acquirement.method.SPECIFIC_WORKER": "Specific Workers", - "workerVoucher.acquire.voucher": "ACQUIRE VOUCHER", + "workerVoucher.acquirement.method.GENERIC_VOUCHER": "Non-Personal Voucher", + "workerVoucher.acquirement.method.SPECIFIC_WORKER": "Personal Voucher", + "workerVoucher.acquire.voucher": "Buy Voucher", "workerVoucher.assign.voucher": "ASSIGN VOUCHER", "workerVoucher.vouchersQuantity": "Quantity of Vouchers", "workerVoucher.pricePerVoucher": "Voucher Price", @@ -89,27 +88,28 @@ "workerVoucher.priceManagement.success": "The voucher price has been successfully set at {price}$ for the period from {dateFrom} to {dateTo}.", "workerVoucher.validFrom": "Valid From", "workerVoucher.validTo": "Valid To", - "workerVoucher.acquire.vouchers": "Acquire Vouchers", + "workerVoucher.acquire.vouchers": "Buy Vouchers", "workerVoucher.assign.vouchers": "Assign Vouchers", "workerVoucher.acquire.confirmation": "I confirm the voucher acquirement, acknowledging that I have read and agree to the terms and policies.", "workerVoucher.assign.confirmation": "I confirm the voucher assignment, acknowledging that I have read and agree to the terms and policies.", "workerVoucher.vouchers.required": "You need to fill out all required fields to continue", "workerVoucher.WorkerMultiplePicker.placeholder": "Search for Worker", - "workerVoucher.WorkerMultiplePicker.underThreshold": "Enter at least 3 characters of National ID, Worker First Name or Last Name", + "workerVoucher.WorkerMultiplePicker.underThreshold": "Enter at least 3 characters: IDNP, Worker First Name or Last Name", "workerVoucher.WorkerMultiplePicker.noOptions": "No results", + "workerVoucher.WorkerDateRangePicker.selectDate": "Select Date", "workerVoucher.WorkerDateRangePicker.startDate": "Start Date", "workerVoucher.WorkerDateRangePicker.endDate": "End Date", - "workerVoucher.WorkerDateRangePicker.addButton": "Add Date Range", + "workerVoucher.WorkerDateRangePicker.addButton": "Confirm Validity Period", "workerVoucher.WorkerDateRangePicker.noDates": "To add a Range you need to fill Start Date and End Date", - "workerVoucher.WorkerDateRangePicker.deleteRange": "Delete Date Range", - "workerVoucher.WorkerDateRangePicker.dateRange": "Date Range", - "workerVoucher.WorkerDateRangePicker.dateRanges": "Date Ranges: *", - "workerVoucher.WorkerDateRangePicker.noRanges": "No date ranges registered", + "workerVoucher.WorkerDateRangePicker.deleteRange": "Delete Period", + "workerVoucher.WorkerDateRangePicker.dateRange": "Validity Period", + "workerVoucher.WorkerDateRangePicker.dateRanges": "Voucher Validity Periods: *", + "workerVoucher.WorkerDateRangePicker.noRanges": "No validity periods registered", "workerVoucher.WorkerDateRangePicker.notAvailable": "NOT AVAILABLE", "workerVoucher.unassigned": "UNASSIGNED", "workerVoucher.VoucherAcquirementPaymentModal.title": "Voucher Acquirement Summary", "workerVoucher.VoucherAssignmentConfirmModal.title": "Voucher Assignment Summary", - "workerVoucher.VoucherAcquirementPaymentModal.confirm": "Acquire", + "workerVoucher.VoucherAcquirementPaymentModal.confirm": "Buy", "workerVoucher.VoucherAssignmentConfirmModal.confirm": "Assign", "workerVoucher.VoucherAcquirementPaymentModal.confirm.tooltip": "Please ensure that there are no errors and that you have checked the acquirement confirmation", "workerVoucher.VoucherAssignmentConfirmModal.confirm.tooltip": "Please ensure that there are no errors and that you have checked the assignment confirmation",