Skip to content

Commit

Permalink
Merge pull request #34 from openimis/develop
Browse files Browse the repository at this point in the history
MERGING RELEASE branches
  • Loading branch information
delcroip authored May 16, 2023
2 parents 4ce12ec + 5fb78cb commit 1ef418b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/components/PricelistForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const PricelistForm = (props) => {
isValid,
clearMedicalPricelists,
} = props;
const canSave = () => pricelist.name && pricelist.pricelistDate && isValid === true;

const canSave = () => pricelist.name && pricelist.pricelistDate && !pricelist.validityTo && isValid === true;

useEffect(() => {
return () => {
Expand Down
19 changes: 15 additions & 4 deletions src/components/PricelistsSearcher.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import React, { useCallback, useState } from "react";

import { Tooltip, IconButton } from "@material-ui/core";
import { withTheme, withStyles } from "@material-ui/core/styles";
import { Tab as TabIcon, Delete as DeleteIcon } from "@material-ui/icons";
import { useTranslations, ConfirmDialog, Searcher, withModulesManager } from "@openimis/fe-core";

import { combine, useTranslations, ConfirmDialog, Searcher, withModulesManager } from "@openimis/fe-core";
import PricelistsFilters from "./PricelistsFilters";

const isRowDisabled = (_, row) => Boolean(row.validityTo);
const isRowLocked = () => false;

Expand All @@ -24,10 +28,15 @@ const ALIGNS = HEADERS.map((_, i) => i === HEADERS.length - 1 && "right");
const getAligns = () => ALIGNS;
const getHeaders = () => HEADERS;

const styles = (theme) => ({
horizontalButtonContainer: theme.buttonContainer.horizontal,
});

const PricelistsSearcher = (props) => {
const {
pageInfo,
items,
classes,
isFetching,
isFetched,
cacheFiltersKey,
Expand Down Expand Up @@ -61,7 +70,7 @@ const PricelistsSearcher = (props) => {
(pricelist) => formatDateFromISO(pricelist.validityFrom),
(pricelist) => formatDateFromISO(pricelist.validityTo),
(pricelist) => (
<>
<div className={classes.horizontalButtonContainer}>
<Tooltip title={formatMessage("openNewTab")}>
<IconButton onClick={() => onDoubleClick(pricelist, true)}>
<TabIcon />
Expand All @@ -74,7 +83,7 @@ const PricelistsSearcher = (props) => {
</IconButton>
</Tooltip>
)}
</>
</div>
),
],
[]
Expand Down Expand Up @@ -134,4 +143,6 @@ const PricelistsSearcher = (props) => {
);
};

export default withModulesManager(PricelistsSearcher);
const enhance = combine(withTheme, withModulesManager, withStyles(styles))

export default enhance(PricelistsSearcher);
2 changes: 1 addition & 1 deletion src/pages/ItemsPricelistDetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const ItemsPriceListDetailsPage = (props) => {
};

return (
<div className={clsx(classes.page, { [classes.locked]: isLocked })}>
<div className={clsx(classes.page, pricelist.validityTo && classes.locked)}>
<ErrorBoundary>
<ProgressOrError progress={isFetching} error={error} />
{!isFetching && (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ServicesPricelistDetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const ServicesPriceListDetailsPage = (props) => {
};

return (
<div className={clsx(classes.page, { [classes.locked]: isLocked })}>
<div className={clsx(classes.page, pricelist.validityTo && classes.locked)}>
<ErrorBoundary>
<ProgressOrError progress={isFetching} error={error} />
{!isFetching && (
Expand Down

0 comments on commit 1ef418b

Please sign in to comment.