Skip to content

Commit

Permalink
Merge branch 'refs/heads/refactor/refactor-base' into refactor/transfers
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/renderer/translations/tokens/en-US.json
  • Loading branch information
wwills2 committed Jul 31, 2024
2 parents 3670a71 + 814e107 commit 77198c1
Show file tree
Hide file tree
Showing 19 changed files with 262 additions and 130 deletions.
4 changes: 3 additions & 1 deletion src/renderer/components/blocks/forms/CoBenifetsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as yup from 'yup';
import { CoBenefit } from '@/schemas/CoBenefit.schema';
import { PickList } from '@/schemas/PickList.schema';
import { deepOmit, validateAndSubmitFieldArrayForm } from '@/utils/formik-utils';
import { useIntl } from 'react-intl';

const validationSchema = yup.object({
cobenefits: yup.array().of(
Expand All @@ -26,6 +27,7 @@ export interface CoBenefitsFormRef {

const CoBenefitsForm = forwardRef<CoBenefitsFormRef, CoBenefitsFormProps>(
({ readonly = false, data, picklistOptions }, ref) => {
const intl = useIntl();
const formikRef = useRef<FormikProps<any>>(null);

useImperativeHandle(ref, () => ({
Expand Down Expand Up @@ -58,7 +60,7 @@ const CoBenefitsForm = forwardRef<CoBenefitsFormRef, CoBenefitsFormProps>(
<div className="grid grid-cols-1 md:grid-cols-2 gap-x-4">
<Field
name={`${name}[${index}].cobenefit`}
label="Co-Benefit"
label={intl.formatMessage({ id: 'co-benefit' })}
type="picklist"
freeform={true}
options={picklistOptions?.coBenefits}
Expand Down
8 changes: 5 additions & 3 deletions src/renderer/components/blocks/forms/EstimationsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Field, Repeater } from '@/components';
import { Estimation } from '@/schemas/Estimation.schema';
import * as yup from 'yup';
import { deepOmit, validateAndSubmitFieldArrayForm } from '@/utils/formik-utils';
import { useIntl } from 'react-intl';

const validationSchema = yup.object({
estimations: yup.array().of(
Expand All @@ -28,6 +29,7 @@ export interface EstimationsFormRef {
}

const EstimationsForm = forwardRef<EstimationsFormRef, EstimationsFormProps>(({ readonly = false, data }, ref) => {
const intl = useIntl();
const formikRef = useRef<FormikProps<any>>(null);

useImperativeHandle(ref, () => ({
Expand Down Expand Up @@ -65,23 +67,23 @@ const EstimationsForm = forwardRef<EstimationsFormRef, EstimationsFormProps>(({
<div className="grid grid-cols-1 md:grid-cols-2 gap-x-4">
<Field
name={`${name}[${index}].creditingPeriodStart`}
label="Crediting Period Start"
label={intl.formatMessage({ id: 'crediting-period-start' })}
type="date"
readonly={readonly}
required={true}
initialValue={estimation.creditingPeriodStart}
/>
<Field
name={`${name}[${index}].creditingPeriodEnd`}
label="Crediting Period End"
label={intl.formatMessage({ id: 'crediting-period-end' })}
type="date"
readonly={readonly}
required={true}
initialValue={estimation.creditingPeriodEnd}
/>
<Field
name={`${name}[${index}].unitCount`}
label="Unit Count"
label={intl.formatMessage({ id: 'unit-count' })}
type="number"
readonly={readonly}
required={true}
Expand Down
12 changes: 7 additions & 5 deletions src/renderer/components/blocks/forms/IssuancesForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Field, Repeater, UnitSummary } from '@/components';
import { Issuance } from '@/schemas/Issuance.schema';
import { PickList } from '@/schemas/PickList.schema';
import { deepOmit, validateAndSubmitFieldArrayForm } from '@/utils/formik-utils';
import { useIntl } from 'react-intl';

const validationSchema = yup.object({
issuances: yup.array().of(
Expand Down Expand Up @@ -36,6 +37,7 @@ const defaultIssuanceData: Issuance[] = [];

const IssuancesForm = forwardRef<IssuancesFormRef, IssuancesFormProps>(
({ readonly = false, data = defaultIssuanceData, showUnits = false, picklistOptions }, ref) => {
const intl = useIntl();
const formikRef = useRef<FormikProps<any>>(null);

useImperativeHandle(ref, () => ({
Expand Down Expand Up @@ -75,31 +77,31 @@ const IssuancesForm = forwardRef<IssuancesFormRef, IssuancesFormProps>(
<div className="grid grid-cols-1 md:grid-cols-2 gap-x-4">
<Field
name={`${name}[${index}].startDate`}
label="Start Date"
label={intl.formatMessage({ id: 'start-date' })}
type="date"
readonly={readonly}
required={true}
initialValue={issuance.startDate}
/>
<Field
name={`${name}[${index}].endDate`}
label="End Date"
label={intl.formatMessage({ id: 'end-date' })}
type="date"
readonly={readonly}
required={true}
initialValue={issuance.endDate}
/>
<Field
name={`${name}[${index}].verificationApproach`}
label="Verification Approach"
label={intl.formatMessage({ id: 'verification-approach' })}
type="text"
readonly={readonly}
required={true}
initialValue={issuance.verificationApproach}
/>
<Field
name={`${name}[${index}].verificationBody`}
label="Verification Body"
label={intl.formatMessage({ id: 'verification-body' })}
type="picklist"
freeform={true}
options={picklistOptions?.verificationBody}
Expand All @@ -109,7 +111,7 @@ const IssuancesForm = forwardRef<IssuancesFormRef, IssuancesFormProps>(
/>
<Field
name={`${name}[${index}].verificationReportDate`}
label="Verification Report Date"
label={intl.formatMessage({ id: 'verification-report-date' })}
type="date"
readonly={readonly}
required={true}
Expand Down
18 changes: 10 additions & 8 deletions src/renderer/components/blocks/forms/LabelsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as yup from 'yup';
import { Label } from '@/schemas/Label.schema';
import { PickList } from '@/schemas/PickList.schema';
import { deepOmit, validateAndSubmitFieldArrayForm } from '@/utils/formik-utils';
import { useIntl } from 'react-intl';

const validationSchema = yup.object({
labels: yup.array().of(
Expand Down Expand Up @@ -50,6 +51,7 @@ export interface LabelsFormRef {
}

const LabelsForm = forwardRef<LabelsFormRef, LabelsFormProps>(({ readonly = false, data, picklistOptions }, ref) => {
const intl = useIntl();
const formikRef = useRef<FormikProps<any>>(null);

useImperativeHandle(ref, () => ({
Expand Down Expand Up @@ -93,15 +95,15 @@ const LabelsForm = forwardRef<LabelsFormRef, LabelsFormProps>(({ readonly = fals
<div className="grid grid-cols-1 md:grid-cols-2 gap-x-4">
<Field
name={`${name}[${index}].label`}
label="Label"
label={intl.formatMessage({ id: 'label' })}
type="text"
readonly={readonly}
required={true}
initialValue={label.label}
/>
<Field
name={`${name}[${index}].labelType`}
label="Label Type"
label={intl.formatMessage({ id: 'label-type' })}
type="picklist"
options={picklistOptions?.labelType}
readonly={readonly}
Expand All @@ -110,47 +112,47 @@ const LabelsForm = forwardRef<LabelsFormRef, LabelsFormProps>(({ readonly = fals
/>
<Field
name={`${name}[${index}].labelLink`}
label="Label Link"
label={intl.formatMessage({ id: 'label-link' })}
type="link"
readonly={readonly}
required={true}
initialValue={label.labelLink}
/>
<Field
name={`${name}[${index}].validityPeriodStartDate`}
label="Validity Period Start Date"
label={intl.formatMessage({ id: 'validity-period-start-date' })}
type="date"
readonly={readonly}
required={true}
initialValue={label.validityPeriodStartDate}
/>
<Field
name={`${name}[${index}].validityPeriodEndDate`}
label="Validity Period End Date"
label={intl.formatMessage({ id: 'validity-period-end-date' })}
type="date"
readonly={readonly}
required={true}
initialValue={label.validityPeriodEndDate}
/>
<Field
name={`${name}[${index}].creditingPeriodStartDate`}
label="Crediting Period Start Date"
label={intl.formatMessage({ id: 'crediting-period-start-date' })}
type="date"
readonly={readonly}
required={true}
initialValue={label.creditingPeriodStartDate}
/>
<Field
name={`${name}[${index}].creditingPeriodEndDate`}
label="Crediting Period End Date"
label={intl.formatMessage({ id: 'crediting-period-end-date' })}
type="date"
readonly={readonly}
required={true}
initialValue={label.creditingPeriodEndDate}
/>
<Field
name={`${name}[${index}].unitQuantity`}
label="Unit Quantity"
label={intl.formatMessage({ id: 'unit-quantity' })}
type="number"
readonly={readonly}
required={true}
Expand Down
Loading

0 comments on commit 77198c1

Please sign in to comment.