Skip to content

Commit

Permalink
Showing 9 changed files with 153 additions and 63 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -24,6 +24,8 @@
* Add feature "Charge notice and action notice options to manual fee/fine settings screen". Fix UIU-713.
* Add CRUD Fee/Fine Transfer Accounts Settings. Ref UIU-544.
* Support "Open - In transit" status. Fixes UIU-682.
* Display "Additional Information for Patron" on Fee/Fine Details. Ref UIU-901.
* Fix translate. Ref UIU-713, UIU-845.

## [2.20.0](https://github.com/folio-org/ui-users/tree/v2.20.0) (2019-01-25)
[Full Changelog](https://github.com/folio-org/ui-users/compare/v2.19.0...v2.20.0)
9 changes: 5 additions & 4 deletions src/AccountActionsHistory.js
Original file line number Diff line number Diff line change
@@ -23,12 +23,13 @@ import { getFullName } from './util';
import css from './AccountsHistory.css';

const columnWidths = {
action: 250,
date: 100,
action: 100,
amount: 100,
balance: 100,
transactioninfo: 200,
created: 100,
source: 200,
source: 150,
comments: 700
};

@@ -246,7 +247,7 @@ class AccountActionsHistory extends React.Component {
buttonClass={css.addCommentBtn}
onClick={this.comment}
>
<FormattedMessage id="ui-users.accounts.button.new" />
<FormattedMessage id="ui-users.details.button.new" />
</Button>
</span>
),
@@ -261,7 +262,7 @@ class AccountActionsHistory extends React.Component {
transactioninfo: action => action.transactionInformation || '-',
created: action => action.createdAt,
source: action => action.source,
comments: action => action.comments,
comments: action => (action.comments ? (<div>{ action.comments.split('\n').map(c => (<Row><Col>{c}</Col></Row>))}</div>) : ''),
};

const actions = this.state.data || [];
73 changes: 53 additions & 20 deletions src/components/Accounts/Actions/Actions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import React from 'react';
import _ from 'lodash';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
import {
FormattedMessage,
injectIntl,
intlShape,
} from 'react-intl';
import SafeHTMLMessage from '@folio/react-intl-safe-html';
// eslint-disable-next-line import/no-extraneous-dependencies
import moment from 'moment';
@@ -87,6 +91,7 @@ class Actions extends React.Component {
stripes: PropTypes.object,
handleEdit: PropTypes.func,
user: PropTypes.object,
intl: intlShape.isRequired,
};

constructor(props) {
@@ -207,11 +212,15 @@ class Actions extends React.Component {
}

onClickCancellation(values) {
const { intl: { formatMessage } } = this.props;
const canceled = formatMessage({ id: 'ui-users.accounts.cancelError' });
const tagStaff = formatMessage({ id: 'ui-users.accounts.actions.tag.staff' });
const type = this.props.accounts[0] || {};
delete type.rowIndex;
this.props.mutator.activeRecord.update({ id: type.id });
this.newAction({}, type.id, 'Cancelled as Error', type.amount, values.comment, 0, 0, type.feeFineOwner);
this.editAccount(type, 'Cancelled as Error', 'Closed', 0.00)
const comment = tagStaff + ': ' + values.comment;
this.newAction({}, type.id, canceled, type.amount, comment, 0, 0, type.feeFineOwner);
this.editAccount(type, canceled, 'Closed', 0.00)
.then(() => this.props.handleEdit(1))
.then(() => this.showCalloutMessage(type))
.then(() => this.onCloseCancellation());
@@ -259,18 +268,28 @@ class Actions extends React.Component {
}

pay = (type, payment, values) => {
const { intl: { formatMessage } } = this.props;
this.props.mutator.activeRecord.update({ id: type.id });
let paymentStatus = 'Paid ';
let paymentStatus = _.capitalize(formatMessage({ id: 'ui-users.accounts.actions.warning.payAction' }));
const tagStaff = formatMessage({ id: 'ui-users.accounts.actions.tag.staff' });
const tagPatron = formatMessage({ id: 'ui-users.accounts.actions.tag.patron' });
const action = { paymentMethod: values.method };
if (payment < type.remaining) {
paymentStatus += 'Partially';
paymentStatus = `${paymentStatus} ${_.capitalize(formatMessage({ id: 'ui-users.accounts.status.partially' }))}`;
} else {
paymentStatus += 'Fully';
paymentStatus = `${paymentStatus} ${_.capitalize(formatMessage({ id: 'ui-users.accounts.status.fully' }))}`;
type.status.name = 'Closed';
}
const balance = type.remaining - parseFloat(payment);
let c = '';
if (values.comment) {
c = tagStaff + ': ' + values.comment;
}
if (values.patronInfo && values.notify) {
c = c + '\n' + tagPatron + ': ' + values.patronInfo;
}
return this.editAccount(type, paymentStatus, type.status.name, balance)
.then(() => this.newAction(action, type.id, paymentStatus, payment, values.comment, balance, values.transaction, type.feeFineOwner));
.then(() => this.newAction(action, type.id, paymentStatus, payment, c, balance, values.transaction, type.feeFineOwner));
}

onClickWaive(values) {
@@ -315,27 +334,34 @@ class Actions extends React.Component {
}

waive = (type, waive, values) => {
const { intl: { formatMessage } } = this.props;
this.props.mutator.activeRecord.update({ id: type.id });
let paymentStatus = 'Waived ';
let paymentStatus = _.capitalize(formatMessage({ id: 'ui-users.accounts.actions.warning.waiveAction' }));
const tagStaff = formatMessage({ id: 'ui-users.accounts.actions.tag.staff' });
const action = { paymentMethod: values.method };
if (waive < type.remaining) {
paymentStatus += 'Partially';
paymentStatus = `${paymentStatus} ${_.capitalize(formatMessage({ id: 'ui-users.accounts.status.partially' }))}`;
} else {
paymentStatus += 'Fully';
paymentStatus = `${paymentStatus} ${_.capitalize(formatMessage({ id: 'ui-users.accounts.status.fully' }))}`;
type.status.name = 'Closed';
}
const balance = type.remaining - parseFloat(waive);
const comment = values.comment ? (tagStaff + ': ' + values.comment) : '';
return this.editAccount(type, paymentStatus, type.status.name, balance)
.then(() => this.newAction(action, type.id, paymentStatus, waive, values.comment, balance, 0, type.feeFineOwner));
.then(() => this.newAction(action, type.id, paymentStatus, waive, comment, balance, 0, type.feeFineOwner));
}

onClickComment(values) {
const { intl: { formatMessage } } = this.props;
const info = formatMessage({ id: 'ui-users.accounts.comment.staffInfo' });
const account = this.props.accounts[0] || '';
const id = this.props.accounts[0].id || '';
const createAt = this.props.accounts[0].feeFineOwner || '';
const balance = this.props.balance || 0;
const tagStaff = formatMessage({ id: 'ui-users.accounts.actions.tag.staff' });
const comment = tagStaff + ': ' + values.comment;
this.props.mutator.activeRecord.update({ id });
this.newAction({}, id, 'Comment', 0, values.comment, balance, 0, createAt);
this.newAction({}, id, info, 0, comment, balance, 0, createAt);
this.editAccount(account, account.paymentStatus.name, account.status.name, balance)
.then(() => this.props.handleEdit(1))
.then(() => this.onCloseComment());
@@ -400,25 +426,30 @@ class Actions extends React.Component {
}

renderConfirmHeading = () => {
const { actions: { pay, regular } } = this.props;
const { actions: { pay, regular }, intl: { formatMessage } } = this.props;
return (
<FormattedMessage
id="ui-users.accounts.confirmation.head"
values={{ action: (pay || regular) ? 'payment' : 'waive' }}
values={{ action: (pay || regular)
? formatMessage({ id: 'ui-users.accounts.actions.payment' })
: formatMessage({ id: 'ui-users.accounts.actions.waive' }) }}
/>
);
}

renderConfirmMessage = () => {
const { actions: { pay, regular, waiveModal, waiveMany } } = this.props;
const { actions: { pay, regular, waiveModal, waiveMany }, intl: { formatMessage } } = this.props;
const { values } = this.state;
const amount = (pay || regular) ? values.amount : values.waive;
let paymentStatus = (pay || regular) ? ' paid' : ' waived';

let paymentStatus = (pay || regular)
? formatMessage({ id: 'ui-users.accounts.actions.warning.payAction' })
: formatMessage({ id: 'ui-users.accounts.actions.warning.waiveAction' });
if (pay || waiveModal) {
const account = this.props.accounts[0] || {};
const total = account.remaining || 0;
paymentStatus = ((amount < total) ? 'partially' : 'fully') + paymentStatus;
paymentStatus = `${((amount < total)
? formatMessage({ id: 'ui-users.accounts.status.partially' })
: formatMessage({ id: 'ui-users.accounts.status.fully' }))} ${paymentStatus}`;
return (
<SafeHTMLMessage
id="ui-users.accounts.confirmation.message"
@@ -430,7 +461,9 @@ class Actions extends React.Component {
const total = accounts.reduce((selected, { remaining }) => {
return selected + parseFloat(remaining);
}, 0);
paymentStatus = ((amount < total) ? 'partially' : 'fully') + paymentStatus;
paymentStatus = `${((amount < total)
? formatMessage({ id: 'ui-users.accounts.status.partially' })
: formatMessage({ id: 'ui-users.accounts.status.fully' }))} ${paymentStatus}`;
return (
<SafeHTMLMessage
id="ui-users.accounts.confirmation.message"
@@ -541,4 +574,4 @@ class Actions extends React.Component {
}
}

export default Actions;
export default injectIntl(Actions);
16 changes: 13 additions & 3 deletions src/components/Accounts/Actions/PayManyModal.js
Original file line number Diff line number Diff line change
@@ -253,7 +253,7 @@ class PayModal extends React.Component {
<Col xs={7}>
<b>
<FormattedMessage id="ui-users.accounts.pay.field.paymentamount" />
:
*:
</b>
</Col>
<Col xs={4} className={css.customCol}>
@@ -282,7 +282,12 @@ class PayModal extends React.Component {
</Row>
</Col>
<Col xs={4}>
<Row><Col xs><FormattedMessage id="ui-users.accounts.pay.field.ownerDesk" /></Col></Row>
<Row>
<Col xs>
<FormattedMessage id="ui-users.accounts.pay.field.ownerDesk" />
*
</Col>
</Row>
<Row>
<Col xs>
<FormattedMessage id="ui-users.accounts.pay.owner.placeholder">
@@ -300,7 +305,12 @@ class PayModal extends React.Component {
</Row>
</Col>
<Col xs={3}>
<Row><Col xs><FormattedMessage id="ui-users.accounts.pay.field.paymentmethod" /></Col></Row>
<Row>
<Col xs>
<FormattedMessage id="ui-users.accounts.pay.field.paymentmethod" />
*
</Col>
</Row>
<Row>
<Col xs>
<FormattedMessage id="ui-users.accounts.pay.method.placeholder">
41 changes: 27 additions & 14 deletions src/components/Accounts/Actions/PayModal.js
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ const validate = (values, props) => {
errors.amount = <FormattedMessage id="ui-users.accounts.pay.error.amount" />;
}
if (!values.method) {
errors.method = 'Select one';
errors.method = <FormattedMessage id="ui-users.accounts.error.select" />;
}
if (props.commentRequired && !values.comment) {
errors.comment = <FormattedMessage id="ui-users.accounts.error.comment" />;
@@ -250,7 +250,7 @@ class PayModal extends React.Component {
<Col xs={7}>
<b>
<FormattedMessage id="ui-users.accounts.pay.field.paymentamount" />
:
*:
</b>
</Col>
<Col xs={4} className={css.customCol}>
@@ -279,27 +279,40 @@ class PayModal extends React.Component {
</Row>
</Col>
<Col xs={3}>
<Row><Col xs><FormattedMessage id="ui-users.accounts.pay.field.paymentmethod" /></Col></Row>
<Row>
<Col xs>
<Field
name="method"
component={Select}
dataOptions={dataOptions}
placeholder="Select type"
/>
<FormattedMessage id="ui-users.accounts.pay.field.paymentmethod" />
*
</Col>
</Row>
<Row>
<Col xs>
<FormattedMessage id="ui-users.accounts.pay.method.placeholder">
{placeholder => (
<Field
name="method"
component={Select}
dataOptions={dataOptions}
placeholder={placeholder}
/>
)}
</FormattedMessage>
</Col>
</Row>
</Col>
<Col xs={4}>
<Row><Col xs><FormattedMessage id="ui-users.accounts.pay.field.transactioninfo" /></Col></Row>
<Row>
<Col xs>
<Field
name="transaction"
component={TextField}
placeholder="Enter check #, etc."
/>
<FormattedMessage id="ui-users.accounts.pay.transaction.placeholder">
{placeholder => (
<Field
name="transaction"
component={TextField}
placeholder={placeholder}
/>
)}
</FormattedMessage>
</Col>
</Row>
</Col>
5 changes: 3 additions & 2 deletions src/components/Accounts/Actions/WaiveModal.js
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ const validate = (values, props) => {
errors.waive = <FormattedMessage id="ui-users.accounts.waive.error.amount" />;
}
if (!values.method) {
errors.method = 'Select one';
errors.method = <FormattedMessage id="ui-users.accounts.error.select" />;
}
if (props.commentRequired && !values.comment) {
errors.comment = <FormattedMessage id="ui-users.accounts.error.comment" />;
@@ -245,7 +245,7 @@ class WaiveModal extends React.Component {
<Col xs={6}>
<b>
<FormattedMessage id="ui-users.accounts.waive.field.waiveamount" />
:
*:
</b>
</Col>
<Col xs={4} className={css.customCol}>
@@ -275,6 +275,7 @@ class WaiveModal extends React.Component {
<Row>
<Col xs>
<FormattedMessage id="ui-users.accounts.waive.field.waivereason" />
*
</Col>
</Row>
<Row>
25 changes: 21 additions & 4 deletions src/components/Accounts/ChargeFeeFine/Charge.js
Original file line number Diff line number Diff line change
@@ -174,8 +174,6 @@ class Charge extends React.Component {
type.status = {
name: formatMessage({ id: 'ui-users.accounts.open' }),
};
delete type.notify;
delete type.patronInfo;
type.remaining = type.amount;
type.feeFineType = (feefines.find(f => f.id === type.feeFineId.substring(0, 36)) || {}).feeFineType || '';
type.feeFineOwner = (owners.find(o => o.id === type.ownerId) || {}).owner || '';
@@ -192,8 +190,18 @@ class Charge extends React.Component {
type.loanId = this.props.selectedLoan.id || '0';
type.userId = this.props.user.id;
type.itemId = this.item.id || '0';
const c = type.comments;
let c = '';
const tagStaff = formatMessage({ id: 'ui-users.accounts.actions.tag.staff' });
const tagPatron = formatMessage({ id: 'ui-users.accounts.actions.tag.patron' });
if (type.comments) {
c = tagStaff + ': ' + type.comments;
}
if (type.patronInfo && type.notify) {
c = c + '\n' + tagPatron + ': ' + type.patronInfo;
}
delete type.comments;
delete type.notify;
delete type.patronInfo;
this.type = type;
return this.props.mutator.accounts.POST(type)
.then(() => this.newAction({}, type.id, type.feeFineType, type.amount, c, type.remaining, 0, type.feeFineOwner));
@@ -318,6 +326,15 @@ class Charge extends React.Component {
onConfirm = () => {
const { values } = this.state;
const { intl: { formatMessage } } = this.props;
const tagStaff = formatMessage({ id: 'ui-users.accounts.actions.tag.staff' });
const tagPatron = formatMessage({ id: 'ui-users.accounts.actions.tag.patron' });
let comment = '';
if (values.comment) {
comment = tagStaff + ': ' + values.comment;
}
if (values.patronInfo && values.notify) {
comment = comment + '\n' + tagPatron + ': ' + values.patronInfo;
}
this.onClickCharge(this.type).then(() => {
this.type.remaining = parseFloat(this.type.amount - values.amount).toFixed(2);
if (this.type.remaining === '0.00') {
@@ -331,7 +348,7 @@ class Charge extends React.Component {
})
.then(() => this.newAction({ paymentMethod: values.method }, this.type.id,
this.type.paymentStatus.name, values.amount,
values.comment, this.type.remaining,
comment, this.type.remaining,
values.transaction, this.type.feeFineOwner))
.then(() => {
this.hideConfirmDialog();
2 changes: 1 addition & 1 deletion src/settings/FeeFinesTable/ChargeNotice.js
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ class ChargeNotice extends React.Component {
<FormattedMessage id="ui-users.feefines.defaultChargeNotice" />
</Col>
<Col xs={4}>
<FormattedMessage id="ui-users.feefines.defaultChargeNotice" />
<FormattedMessage id="ui-users.feefines.defaultActionNotice" />
</Col>
</Row>
<Row>
43 changes: 28 additions & 15 deletions translations/ui-users/en.json
Original file line number Diff line number Diff line change
@@ -557,6 +557,7 @@
"payments.singular": "Payment method",
"payments.columns.name": "Name*",
"payments.columns.refund": "Refund method allowed",
"payments.nodata": "There are no Fee/fine: Payment methods",

"refunds.label": "Fee/fine: Refund reasons",
"refunds.singular": "Refund reason",
@@ -617,14 +618,15 @@
"charge.itemLookup.confirm": "Confirm",
"charge.itemLookup.cancel": "Cancel",

"details.columns.comments": "Comments",
"details.columns.date": "Action Date",
"details.columns.comments": "Additional information",
"details.columns.date": "Action date",
"details.columns.action": "Action",
"details.columns.amount": "Amount",
"details.columns.balance": "Balance",
"details.columns.transactioninfo": "Transaction Information",
"details.columns.transactioninfo": "Transaction information",
"details.columns.created": "Created at",
"details.columns.source": "Source",
"details.button.new": "New staff info",

"details.field.loan": "View",
"details.field.feetype": "Fee/fine type",
@@ -690,12 +692,12 @@
"accounts.pay.error.exceeds":"Pay amount exceeds the selected amount",

"accounts.pay.payFeeFine": "Pay Fee/Fine",
"accounts.pay.field.totalamount":"Total owed amount:",
"accounts.pay.field.selectedamount":"Selected amount:",
"accounts.pay.field.paymentamount":"Payment amount*",
"accounts.pay.field.remainingamount":"Remaining amount:",
"accounts.pay.field.ownerDesk":"Fee/fine owner desk*",
"accounts.pay.field.paymentmethod":"Payment method*",
"accounts.pay.field.totalamount":"Total owed amount",
"accounts.pay.field.selectedamount":"Selected amount",
"accounts.pay.field.paymentamount":"Payment amount",
"accounts.pay.field.remainingamount":"Remaining amount",
"accounts.pay.field.ownerDesk":"Fee/fine owner desk",
"accounts.pay.field.paymentmethod":"Payment method",
"accounts.pay.field.transactioninfo":"Transaction information",
"accounts.pay.field.comment":"Additional information",
"accounts.pay.field.infoPatron":"Additional information for patron",
@@ -720,11 +722,11 @@

"accounts.waive.modalLabel": "Waive Fee/Fine",
"accounts.waive.field.totalamount":"fees/fines for a total amount of",
"accounts.waive.field.totalowed":"Total owed amount:",
"accounts.waive.field.selectedamount":"Selected amount:",
"accounts.waive.field.waiveamount":"Waive amount*",
"accounts.waive.field.remainingamount":"Remaining amount:",
"accounts.waive.field.waivereason":"Waive reason*",
"accounts.waive.field.totalowed":"Total owed amount",
"accounts.waive.field.selectedamount":"Selected amount",
"accounts.waive.field.waiveamount":"Waive amount",
"accounts.waive.field.remainingamount":"Remaining amount",
"accounts.waive.field.waivereason":"Waive reason",
"accounts.waive.field.comment":"Additional information",
"accounts.waive.field.cancel":"Cancel",
"accounts.waive.field.waive":"Waive",
@@ -740,6 +742,8 @@

"accounts.warning.itemSelected":"{total, number} items selected. {items, number} {items, plural, one {item} other {items}} cannot be {action} because they are already closed.",

"accounts.cancelError":"Cancelled as Error",

"accounts.cancellation.field.reason":"Reason for cancellation*",
"accounts.cancellation.field.cancellationInfo": "Enter information about the cancellation (required)",
"accounts.cancellation.field.feefinewill":"fee/fine will be",
@@ -754,6 +758,7 @@
"accounts.comment.field.comment":"Comment",
"accounts.comment.field.save":"Save",
"accounts.comment.field.cancel":"Cancel",
"accounts.comment.staffInfo": "New staff info",

"cddd.dateRequired": "Date*",
"cddd.timeRequired": "Time*",
@@ -766,10 +771,11 @@
"blocks.columns.renewals":"Renewals",
"blocks.buttons.add":"Add Block",
"blocks.label":"Patron Blocks",
"blocks.reason": "Reason for block:",
"blocks.reason": "Reason for block",
"blocks.modal.header": "Patron blocked from renewing",
"blocks.detailsButton": "Block details",
"blocks.closeButton": "Close",
"blocks.additionalReasons": "View block details to see additional reasons for block...",

"blocks.form.label.information":"Block information",
"blocks.form.label.display":"Display Description*",
@@ -829,6 +835,13 @@
"accounts.actions.warning.deselect": "Deselect to continue",
"accounts.actions.cancellation.success": "<b>{count}</b> {count, plural, one {fee/fine} other {fees/fines}} for <b>{amount}</b> has been successfully <b>{action}</b> for <b>{user}</b>",
"accounts.status.outstanding": "Outstanding",
"accounts.status.partially": "partially",
"accounts.status.fully": "fully",
"accounts.actions.payment": "payment",
"accounts.actions.waive": "waive",
"accounts.actions.tag.staff": "STAFF",
"accounts.actions.tag.patron": "PATRON",

"transfers.label":"Fee/fine: Transfer accounts",
"transfers.columns.name":"Name",
"transfers.columns.desc":"Description",

0 comments on commit 662c547

Please sign in to comment.