diff --git a/apps/ats/web/src/i18n/en/security/coupons.ts b/apps/ats/web/src/i18n/en/security/coupons.ts index 653d42bc7..c9a36204e 100644 --- a/apps/ats/web/src/i18n/en/security/coupons.ts +++ b/apps/ats/web/src/i18n/en/security/coupons.ts @@ -36,17 +36,20 @@ export default { placeholder: "0,123%", tooltip: "Interest rate for the coupon.", }, - period: { - label: "Coupon period", - placeholder: "Select coupon period", - tooltip: "The period between coupon payments. This field is required for all coupon operations.", - options: { - day: "1 Day", - week: "1 Week", - month: "1 Month", - quarter: "3 Months", - year: "1 Year", - }, + startDate: { + label: "Start date", + placeholder: "Select start date", + tooltip: "Coupon’s start date, must occur before the end date.", + }, + endDate: { + label: "End date", + placeholder: "Select end date", + tooltip: "Coupon’s end date, Accrual period correspond to the period between start and end date.", + }, + fixingDate: { + label: "Fixing date", + placeholder: "Select fixing date", + tooltip: "Coupon’s fixing date, floating rate coupons only.", }, }, }, @@ -69,6 +72,9 @@ export default { details: { title: "Detail", paymentDay: "Payment day", + startDay: "start day", + endDay: "end day", + fixingDay: "fixing day", balance: "Balance", amount: "Amount", recordDateReached: "Record Date Reached", diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/Coupons/CouponsList.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/Coupons/CouponsList.tsx index 4c1c5ad34..b8df749b0 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/Coupons/CouponsList.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/Coupons/CouponsList.tsx @@ -8,11 +8,7 @@ import { createColumnHelper } from '@tanstack/table-core'; import { Table, Text } from 'io-bricks-ui'; import { useTranslation } from 'react-i18next'; import { DATE_TIME_FORMAT } from '../../../../utils/constants'; -import { - formatDate, - formatCouponPeriod, - formatNumberLocale, -} from '../../../../utils/format'; +import { formatDate, formatNumberLocale } from '../../../../utils/format'; export const CouponsList = () => { const { id } = useParams(); @@ -54,9 +50,19 @@ export const CouponsList = () => { `${formatNumberLocale(row.getValue(), row.row.original.rateDecimals ?? 0)}%`, enableSorting: false, }), - columnHelper.accessor('period', { - header: t('columns.period'), - cell: (row) => formatCouponPeriod(row.getValue()), + columnHelper.accessor('startDate', { + header: t('columns.startDate'), + cell: (row) => formatDate(row.getValue(), DATE_TIME_FORMAT), + enableSorting: false, + }), + columnHelper.accessor('endDate', { + header: t('columns.endDate'), + cell: (row) => formatDate(row.getValue(), DATE_TIME_FORMAT), + enableSorting: false, + }), + columnHelper.accessor('fixingDate', { + header: t('columns.fixingDate'), + cell: (row) => formatDate(row.getValue(), DATE_TIME_FORMAT), enableSorting: false, }), columnHelper.accessor('snapshotId', { diff --git a/apps/ats/web/src/views/DigitalSecurityDetails/Components/Coupons/ProgramCoupon.tsx b/apps/ats/web/src/views/DigitalSecurityDetails/Components/Coupons/ProgramCoupon.tsx index 6c8bb46a5..60831b2d1 100644 --- a/apps/ats/web/src/views/DigitalSecurityDetails/Components/Coupons/ProgramCoupon.tsx +++ b/apps/ats/web/src/views/DigitalSecurityDetails/Components/Coupons/ProgramCoupon.tsx @@ -208,7 +208,6 @@ import { CalendarInputController, InputNumberController, PhosphorIcon, - SelectController, Text, Tooltip, } from 'io-bricks-ui'; @@ -223,18 +222,17 @@ import { import { useParams } from 'react-router-dom'; import { useCoupons } from '../../../../hooks/queries/useCoupons'; import { useGetBondDetails } from '../../../../hooks/queries/useGetSecurityDetails'; -import { - dateToUnixTimestamp, - validateCouponPeriod, -} from '../../../../utils/format'; -import { DATE_TIME_FORMAT, TIME_PERIODS_S } from '../../../../utils/constants'; +import { dateToUnixTimestamp } from '../../../../utils/format'; +import { DATE_TIME_FORMAT } from '../../../../utils/constants'; import { isBeforeDate } from '../../../../utils/helpers'; interface ProgramCouponFormValues { rate: number; recordTimestamp: string; executionTimestamp: string; - period: string; + startTimestamp: string; + endTimestamp: string; + fixingTimestamp: string; } export const ProgramCoupon = () => { @@ -249,6 +247,8 @@ export const ProgramCoupon = () => { const { t: tGlobal } = useTranslation('globals'); const { id = '' } = useParams(); const recordTimestamp = watch('recordTimestamp'); + const startTimestamp = watch('startTimestamp'); + const fixingTimestamp = watch('fixingTimestamp'); const { data: bondDetails } = useGetBondDetails( new GetBondDetailsRequest({ @@ -262,7 +262,10 @@ export const ProgramCoupon = () => { rate: params.rate.toString(), recordTimestamp: dateToUnixTimestamp(params.recordTimestamp), executionTimestamp: dateToUnixTimestamp(params.executionTimestamp), - period: params.period, + startTimestamp: dateToUnixTimestamp(params.startTimestamp), + endTimestamp: dateToUnixTimestamp(params.endTimestamp), + fixingTimestamp: dateToUnixTimestamp(params.fixingTimestamp), + rateStatus: 1 }); createCoupon(request, { @@ -321,7 +324,9 @@ export const ProgramCoupon = () => { id="executionTimestamp" rules={{ required, - validate: isAfterDate(new Date(recordTimestamp)), + validate: + isAfterDate(new Date(recordTimestamp)) && + isAfterDate(new Date(fixingTimestamp)), }} fromDate={new Date()} toDate={new Date(bondDetails.maturityDate)} @@ -331,6 +336,77 @@ export const ProgramCoupon = () => { /> )} + + + + {tForm('startDate.label')}* + + + + + + {bondDetails && ( + + )} + + + + + {tForm('endDate.label')}* + + + + + + {bondDetails && ( + + )} + + + + + {tForm('fixingDate.label')}* + + + + + + {bondDetails && ( + + )} + {tForm('rate.label')}* @@ -351,50 +427,6 @@ export const ProgramCoupon = () => { decimalSeparator="." /> - - - - {tForm('period.label')}* - - - - - - { - const validation = validateCouponPeriod(parseInt(value)); - return validation === true || validation; - }, - }} - placeholder={tForm('period.placeholder')} - options={[ - { - label: tForm('period.options.day'), - value: TIME_PERIODS_S.DAY.toString(), - }, - { - label: tForm('period.options.week'), - value: TIME_PERIODS_S.WEEK.toString(), - }, - { - label: tForm('period.options.month'), - value: TIME_PERIODS_S.MONTH.toString(), - }, - { - label: tForm('period.options.quarter'), - value: TIME_PERIODS_S.QUARTER.toString(), - }, - { - label: tForm('period.options.year'), - value: TIME_PERIODS_S.YEAR.toString(), - }, - ]} - /> -