Skip to content

Commit

Permalink
Merge pull request #33 from openimis/develop
Browse files Browse the repository at this point in the history
MERGING RELEASE branches
  • Loading branch information
delcroip authored Nov 10, 2022
2 parents 5c35d4e + 3fbfbfa commit ed49eed
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export function fetchFamilySummaries(mm, filters) {
"confirmationNo",
"validityFrom",
"validityTo",
"headInsuree{id,uuid,chfId,lastName,otherNames,email,phone}",
"headInsuree{id,uuid,chfId,lastName,otherNames,email,phone, dob}",
"location" + mm.getProjection("location.Location.FlatProjection"),
];
const payload = formatPageQueryWithCount("families", filters, projections);
Expand Down
2 changes: 1 addition & 1 deletion src/components/FamilyForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class FamilyForm extends Component {
reset: 0,
family: this._newFamily(),
newFamily: true,
consirmedAction: null,
confirmedAction: null,
};

_newFamily() {
Expand Down
1 change: 1 addition & 0 deletions src/components/InsureeForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class InsureeForm extends Component {
if (!this.state.insuree.lastName) return false;
if (!this.state.insuree.otherNames) return false;
if (!this.state.insuree.dob) return false;
if (!this.state.insuree.gender) return false;
if (!!this.state.insuree.photo && (!this.state.insuree.photo.date || !this.state.insuree.photo.officerId))
return false;
return true;
Expand Down
2 changes: 2 additions & 0 deletions src/components/InsureeMasterPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class InsureeMasterPanel extends FormPanel {
required={true}
readOnly={readOnly}
value={edited?.chfId}
new_insuree={!edited?.id}
onChange={(v) => this.updateAttribute("chfId", v)}
/>
</Grid>
Expand Down Expand Up @@ -126,6 +127,7 @@ class InsureeMasterPanel extends FormPanel {
module="insuree"
readOnly={readOnly}
withNull={true}
required={true}
onChange={(v) => this.updateAttribute("gender", { code: v })}
/>
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion src/components/InsureeSearcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class InsureeSearcher extends Component {
if (prevProps.submittingMutation && !this.props.submittingMutation) {
this.props.journalize(this.props.mutation);
this.setState({ reset: this.state.reset + 1 });
} else if (!prevProps.confirmed && this.props.confirmed) {
} else if (!prevProps.confirmed && this.props.confirmed && !!this.state.confirmedAction) {
this.state.confirmedAction();
}
}
Expand Down
9 changes: 5 additions & 4 deletions src/pickers/InsureeNumberInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ const useStyles = makeStyles((theme) => ({
}));

const operation = `
query ($number: String!) {
isValid: insureeNumberValidity(insureeNumber: $number)
query ($number: String!, $newInsuree: Boolean) {
isValid: insureeNumberValidity(insureeNumber: $number, newInsuree: $newInsuree)
}
`;

const InsureeNumberInput = (props) => {
const { value, onChange, className, label = "Insuree.chfId", placeholder, readOnly, required } = props;
const { value, new_insuree, onChange, className, label = "Insuree.chfId", placeholder, readOnly, required } = props;
const [internalValue, setInternalValue] = useState(value);
const modulesManager = useModulesManager();
const { formatMessage } = useTranslations("insuree", modulesManager);
Expand All @@ -31,7 +31,7 @@ const InsureeNumberInput = (props) => {
isLoading,
data,
error: graphqlError,
} = useGraphqlQuery(operation, { number: internalValue }, { skip: !internalValue });
} = useGraphqlQuery(operation, { number: internalValue, newInsuree: new_insuree }, { skip: !internalValue });

const handleValueChange = useDebounceCb((val) => {
if (val) {
Expand Down Expand Up @@ -60,6 +60,7 @@ const InsureeNumberInput = (props) => {
placeholder={placeholder}
error={graphqlError || isInvalid ? formatMessage("InsureeNumberInput.error") : null}
value={value}
new_insuree={new_insuree}
inputProps={{ maxLength: modulesManager.getConf("fe-insuree", "insureeForm.chfIdMaxLength", 12) }}
endAdornment={
<InputAdornment position="end" className={clsx(isValid && classes.validIcon, isInvalid && classes.invalidIcon)}>
Expand Down

0 comments on commit ed49eed

Please sign in to comment.