Compare commits

..

1 Commits

Author SHA1 Message Date
Allan Carr
817c41afb9 IO-2552 PVRT Button Spacing and Alignment
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
2024-04-01 14:27:25 -07:00
8 changed files with 32 additions and 67 deletions

View File

@@ -1,8 +1,8 @@
import React, { useState } from "react";
import { Button, Form, InputNumber, Popover } from "antd";
import { logImEXEvent } from "../../firebase/firebase.utils";
import { useTranslation } from "react-i18next";
import { CalculatorFilled } from "@ant-design/icons";
import { Button, Form, InputNumber, Popover, Space } from "antd";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { logImEXEvent } from "../../firebase/firebase.utils";
export default function CABCpvrtCalculator({ disabled, form }) {
const [visibility, setVisibility] = useState(false);
@@ -26,10 +26,14 @@ export default function CABCpvrtCalculator({ disabled, form }) {
<Form.Item name="days" label={t("jobs.labels.ca_bc_pvrt.days")}>
<InputNumber precision={0} min={0} />
</Form.Item>
<Button type="primary" htmlType="submit">
{t("general.actions.calculate")}
</Button>
<Button onClick={() => setVisibility(false)}>Close</Button>
<div style={{ display: "flex", justifyContent: "flex-end" }}>
<Space>
<Button type="primary" htmlType="submit">
{t("general.actions.calculate")}
</Button>
<Button onClick={() => setVisibility(false)}>Close</Button>
</Space>
</div>
</Form>
</div>
);

View File

@@ -7,12 +7,10 @@ import { createStructuredSelector } from "reselect";
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
import { UPDATE_PAYMENT } from "../../graphql/payments.queries";
import { setModalContext } from "../../redux/modals/modals.actions";
import { selectPayment } from "../../redux/modals/modals.selectors";
import { selectCurrentUser } from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({
currentUser: selectCurrentUser,
paymentModal: selectPayment,
});
const mapDispatchToProps = (dispatch) => ({
@@ -26,7 +24,6 @@ const PaymentMarkForExportButton = ({
refetch,
setPaymentContext,
currentUser,
paymentModal,
}) => {
const { t } = useTranslation();
const [insertExportLog, { loading: exportLogLoading }] =
@@ -68,22 +65,16 @@ const PaymentMarkForExportButton = ({
refetch,
},
context: {
...paymentModal.context,
...payment,
exportedat: today,
},
});
if (refetch) {
if (paymentModal.context.refetchRequiresContext) {
refetch(
paymentUpdateResponse &&
paymentUpdateResponse.data.update_payments.returning[0]
);
} else {
refetch();
}
}
if (refetch)
refetch(
paymentUpdateResponse &&
paymentUpdateResponse.data.update_payments.returning[0]
);
} else {
notification["error"]({
message: t("payments.errors.exporting", {

View File

@@ -97,21 +97,16 @@ function PaymentModalContainer({
});
if (!!!updatedPayment.errors) {
notification["success"]({ message: t("payments.successes.paymentupdate") });
notification["success"]({ message: t("payments.successes.payment") });
} else {
notification["error"]({ message: t("payments.errors.paymentupdate") });
notification["error"]({ message: t("payments.errors.payment") });
}
}
if (actions.refetch) {
if (context.refetchRequiresContext) {
actions.refetch(
updatedPayment && updatedPayment.data.update_payments.returning[0]
);
} else {
actions.refetch();
}
}
if (actions.refetch)
actions.refetch(
updatedPayment && updatedPayment.data.update_payments.returning[0]
);
if (enterAgain) {
const prev = form.getFieldsValue(["date"]);

View File

@@ -3,25 +3,15 @@ import { Button, notification } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { UPDATE_PAYMENT } from "../../graphql/payments.queries";
import { setModalContext } from "../../redux/modals/modals.actions";
import { selectPayment } from "../../redux/modals/modals.selectors";
const mapStateToProps = createStructuredSelector({
paymentModal: selectPayment,
});
const mapDispatchToProps = (dispatch) => ({
setPaymentContext: (context) =>
dispatch(setModalContext({ context: context, modal: "payment" })),
});
const PaymentReexportButton = ({
paymentModal,
payment,
refetch,
setPaymentContext,
}) => {
const PaymentReexportButton = ({ payment, refetch, setPaymentContext }) => {
const { t } = useTranslation();
const [updatePayment, { loading }] = useMutation(UPDATE_PAYMENT);
@@ -45,21 +35,15 @@ const PaymentReexportButton = ({
refetch,
},
context: {
...paymentModal.context,
...payment,
exportedat: null,
},
});
if (refetch) {
if (paymentModal.context.refetchRequiresContext) {
refetch(
paymentUpdateResponse &&
paymentUpdateResponse.data.update_payments.returning[0]
);
} else {
refetch();
}
}
if (refetch)
refetch(
paymentUpdateResponse &&
paymentUpdateResponse.data.update_payments.returning[0]
);
} else {
notification["error"]({
message: t("payments.errors.exporting", {
@@ -80,7 +64,4 @@ const PaymentReexportButton = ({
);
};
export default connect(
mapStateToProps,
mapDispatchToProps
)(PaymentReexportButton);
export default connect(null, mapDispatchToProps)(PaymentReexportButton);

View File

@@ -14,11 +14,11 @@ import { selectBodyshop } from "../../redux/user/user.selectors";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter";
import { TemplateList } from "../../utils/TemplateConstants";
import { pageLimit } from "../../utils/config";
import { alphaSort } from "../../utils/sorters";
import CaBcEtfTableModalContainer from "../ca-bc-etf-table-modal/ca-bc-etf-table-modal.container";
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
import PrintWrapperComponent from "../print-wrapper/print-wrapper.component";
import {pageLimit} from "../../utils/config";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
@@ -184,10 +184,7 @@ export function PaymentsListPaginated({
}
: refetch,
},
context: {
...(apolloResults ? apolloResults : record),
refetchRequiresContext: true,
},
context: apolloResults ? apolloResults : record,
});
}}
>

View File

@@ -2332,7 +2332,6 @@
"markexported": "Payment(s) marked exported.",
"markreexported": "Payment marked for re-export successfully",
"payment": "Payment created successfully. ",
"paymentupdate": "Payment updated successfully. ",
"stripe": "Credit card transaction charged successfully."
}
},

View File

@@ -2331,7 +2331,6 @@
"markexported": "",
"markreexported": "",
"payment": "",
"paymentupdate": "",
"stripe": ""
}
},

View File

@@ -2331,7 +2331,6 @@
"markexported": "",
"markreexported": "",
"payment": "",
"paymentupdate": "",
"stripe": ""
}
},