|
|
|
@ -56,7 +56,7 @@ const Header = ({ title, agency, refresh, ...props }) => {
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const PriceTable = ({ dataSource, refresh }) => {
|
|
|
|
|
const PriceTable = ({ productType, dataSource, refresh }) => {
|
|
|
|
|
const { t } = useTranslation('products');
|
|
|
|
|
const [loading, activeAgency] = useProductsStore((state) => [state.loading, state.activeAgency]);
|
|
|
|
|
const { message, notification } = App.useApp();
|
|
|
|
@ -84,8 +84,16 @@ const PriceTable = ({ dataSource, refresh }) => {
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const rowStyle = (r, tri) => {
|
|
|
|
|
const trCls = tri%2 !== 0 ? ' bg-stone-50' : '';
|
|
|
|
|
const [infoI, quoteI] = r.rowSpanI;
|
|
|
|
|
const bigTrCls = quoteI === 0 && tri !== 0 ? 'border-collapse border-double border-0 border-t-4 border-stone-300' : '';
|
|
|
|
|
return [trCls, bigTrCls].join(' ');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const columns = [
|
|
|
|
|
{ key: 'title', dataIndex: ['info', 'title'], width: '16rem', title: t('Title'), onCell: (r, index) => ({ rowSpan: r.rowSpan }), render: (text, r) => text || r.lgc_details?.['2']?.title || r.lgc_details?.['1']?.title || '' },
|
|
|
|
|
{ key: 'title', dataIndex: ['info', 'title'], width: '16rem', title: t('Title'), onCell: (r, index) => ({ rowSpan: r.rowSpan, }), className: 'bg-white', render: (text, r) => text || r.lgc_details?.['2']?.title || r.lgc_details?.['1']?.title || '' },
|
|
|
|
|
...(productType === 'B' ? [{ key: 'km', dataIndex: ['info', 'km'], title: t('KM')}] : []),
|
|
|
|
|
{ key: 'adult', title: t('AgeType.Adult'), render: (_, { adult_cost, currency, unit_id, unit_name }) => `${adult_cost} ${currency} / ${t(`PriceUnit.${unit_id}`)}` },
|
|
|
|
|
{ key: 'child', title: t('AgeType.Child'), render: (_, { child_cost, currency, unit_id, unit_name }) => `${child_cost} ${currency} / ${t(`PriceUnit.${unit_id}`)}` },
|
|
|
|
|
// {key: 'unit', title: t('Unit'), },
|
|
|
|
@ -121,7 +129,7 @@ const PriceTable = ({ dataSource, refresh }) => {
|
|
|
|
|
) : null,
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
return <Table size={'small'} pagination={false} {...{ columns, dataSource }} rowKey={(r) => r.id} />;
|
|
|
|
|
return <Table size={'small'} className='border-collapse' rowHoverable={false} rowClassName={rowStyle} pagination={false} {...{ columns, dataSource }} rowKey={(r) => r.id} />;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -145,8 +153,9 @@ const TypesPanels = (props) => {
|
|
|
|
|
children: (
|
|
|
|
|
<PriceTable
|
|
|
|
|
// loading={loading}
|
|
|
|
|
productType={ele.value}
|
|
|
|
|
dataSource={agencyProducts[ele.value].reduce(
|
|
|
|
|
(r, c) =>
|
|
|
|
|
(r, c, ri) =>
|
|
|
|
|
r.concat(
|
|
|
|
|
c.quotation.map((q, i) => ({
|
|
|
|
|
...q,
|
|
|
|
@ -158,6 +167,7 @@ const TypesPanels = (props) => {
|
|
|
|
|
info: c.info,
|
|
|
|
|
lgc_details: c.lgc_details.reduce((rlgc, clgc) => ({...r, [clgc.lgc]: clgc}), {}),
|
|
|
|
|
rowSpan: i === 0 ? c.quotation.length : 0,
|
|
|
|
|
rowSpanI: [ri, i],
|
|
|
|
|
}))
|
|
|
|
|
),
|
|
|
|
|
[]
|
|
|
|
|