|
|
@ -6,7 +6,10 @@ import SecondHeaderWrapper from '@/components/SecondHeaderWrapper';
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import useProductsStore, { postProductsQuoteAuditAction, } from '@/stores/Products/Index';
|
|
|
|
import useProductsStore, { postProductsQuoteAuditAction, } from '@/stores/Products/Index';
|
|
|
|
import { isEmpty } from '@/utils/commons';
|
|
|
|
import { isEmpty } from '@/utils/commons';
|
|
|
|
|
|
|
|
import useAuthStore from '@/stores/Auth';
|
|
|
|
|
|
|
|
import RequireAuth from '@/components/RequireAuth';
|
|
|
|
// import PrintContractPDF from './PrintContractPDF';
|
|
|
|
// import PrintContractPDF from './PrintContractPDF';
|
|
|
|
|
|
|
|
import { PERM_PRODUCTS_OFFER_AUDIT, PERM_PRODUCTS_OFFER_PUT } from '@/config';
|
|
|
|
|
|
|
|
|
|
|
|
const Header = ({ title, agency, refresh, ...props }) => {
|
|
|
|
const Header = ({ title, agency, refresh, ...props }) => {
|
|
|
|
const { travel_agency_id, use_year, audit_state } = useParams();
|
|
|
|
const { travel_agency_id, use_year, audit_state } = useParams();
|
|
|
@ -35,20 +38,32 @@ const Header = ({ title, agency, refresh, ...props }) => {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className='flex justify-end items-center gap-4 h-full'>
|
|
|
|
<div className='flex justify-end items-center gap-4 h-full'>
|
|
|
|
<div className='grow'>
|
|
|
|
<div className='grow'>
|
|
|
|
<h2 className='m-0 leading-tight'>{title}<Divider type={'vertical'} />{(use_year || '').replace('all', '')}</h2>
|
|
|
|
<h2 className='m-0 leading-tight'>
|
|
|
|
|
|
|
|
{title}
|
|
|
|
|
|
|
|
<Divider type={'vertical'} />
|
|
|
|
|
|
|
|
{(use_year || '').replace('all', '')}
|
|
|
|
|
|
|
|
</h2>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{/* <Button size='small'>{t('Copy')}</Button> */}
|
|
|
|
{/* <Button size='small'>{t('Copy')}</Button> */}
|
|
|
|
{/* <Button size='small'>{t('Import')}</Button> */}
|
|
|
|
{/* <Button size='small'>{t('Import')}</Button> */}
|
|
|
|
<Link className='px-2' to={`/products/${travel_agency_id}/${use_year}/${audit_state}/edit`}>{t('Edit')}</Link>
|
|
|
|
<RequireAuth subject={PERM_PRODUCTS_OFFER_PUT}>
|
|
|
|
<Button size='small' type={'primary'} onClick={() => handleAuditItem('2', agency)}>
|
|
|
|
<Link className='px-2' to={`/products/${travel_agency_id}/${use_year}/${audit_state}/edit`}>
|
|
|
|
{t('products:auditStateAction.Published')}
|
|
|
|
{t('Edit')}
|
|
|
|
</Button>
|
|
|
|
</Link>
|
|
|
|
|
|
|
|
</RequireAuth>
|
|
|
|
|
|
|
|
<RequireAuth subject={PERM_PRODUCTS_OFFER_AUDIT}>
|
|
|
|
|
|
|
|
<Button size='small' type={'primary'} onClick={() => handleAuditItem('2', agency)}>
|
|
|
|
|
|
|
|
{t('products:auditStateAction.Published')}
|
|
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
</RequireAuth>
|
|
|
|
{/* <Button size='small' type={'primary'} ghost onClick={() => handleAuditItem('2', agency)}>
|
|
|
|
{/* <Button size='small' type={'primary'} ghost onClick={() => handleAuditItem('2', agency)}>
|
|
|
|
{t('products:auditStateAction.Approved')}
|
|
|
|
{t('products:auditStateAction.Approved')}
|
|
|
|
</Button> */}
|
|
|
|
</Button> */}
|
|
|
|
<Button size='small' type={'primary'} danger ghost onClick={() => handleAuditItem('3', agency)}>
|
|
|
|
<RequireAuth subject={PERM_PRODUCTS_OFFER_AUDIT}>
|
|
|
|
{t('products:auditStateAction.Rejected')}
|
|
|
|
<Button size='small' type={'primary'} danger ghost onClick={() => handleAuditItem('3', agency)}>
|
|
|
|
</Button>
|
|
|
|
{t('products:auditStateAction.Rejected')}
|
|
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
</RequireAuth>
|
|
|
|
{/* todo: export, 审核完成之后才能导出 */}
|
|
|
|
{/* todo: export, 审核完成之后才能导出 */}
|
|
|
|
<Button size='small'>{t('Print')} PDF</Button>
|
|
|
|
<Button size='small'>{t('Print')} PDF</Button>
|
|
|
|
{/* <PrintContractPDF /> */}
|
|
|
|
{/* <PrintContractPDF /> */}
|
|
|
@ -59,6 +74,7 @@ const Header = ({ title, agency, refresh, ...props }) => {
|
|
|
|
const PriceTable = ({ productType, dataSource, refresh }) => {
|
|
|
|
const PriceTable = ({ productType, dataSource, refresh }) => {
|
|
|
|
const { t } = useTranslation('products');
|
|
|
|
const { t } = useTranslation('products');
|
|
|
|
const { travel_agency_id, use_year, audit_state } = useParams();
|
|
|
|
const { travel_agency_id, use_year, audit_state } = useParams();
|
|
|
|
|
|
|
|
const isPermitted = useAuthStore(state => state.isPermitted);
|
|
|
|
const [loading, activeAgency] = useProductsStore((state) => [state.loading, state.activeAgency]);
|
|
|
|
const [loading, activeAgency] = useProductsStore((state) => [state.loading, state.activeAgency]);
|
|
|
|
const [setEditingProduct] = useProductsStore((state) => [state.setEditingProduct]);
|
|
|
|
const [setEditingProduct] = useProductsStore((state) => [state.setEditingProduct]);
|
|
|
|
const { message, notification } = App.useApp();
|
|
|
|
const { message, notification } = App.useApp();
|
|
|
@ -96,7 +112,7 @@ const PriceTable = ({ productType, dataSource, refresh }) => {
|
|
|
|
const columns = [
|
|
|
|
const columns = [
|
|
|
|
{ key: 'title', dataIndex: ['info', 'title'], width: '16rem', title: t('Title'), onCell: (r, index) => ({ rowSpan: r.rowSpan, }), className: 'bg-white', render: (text, r) => {
|
|
|
|
{ key: 'title', dataIndex: ['info', 'title'], width: '16rem', title: t('Title'), onCell: (r, index) => ({ rowSpan: r.rowSpan, }), className: 'bg-white', render: (text, r) => {
|
|
|
|
const title = text || r.lgc_details?.['2']?.title || r.lgc_details?.['1']?.title || '';
|
|
|
|
const title = text || r.lgc_details?.['2']?.title || r.lgc_details?.['1']?.title || '';
|
|
|
|
return <Link to={`/products/${travel_agency_id}/${use_year}/${audit_state}/edit`} onClick={() => setEditingProduct(r.info)}>{title}</Link>;
|
|
|
|
return isPermitted(PERM_PRODUCTS_OFFER_PUT) ? <Link to={`/products/${travel_agency_id}/${use_year}/${audit_state}/edit`} onClick={() => setEditingProduct(r.info)}>{title}</Link> : title;
|
|
|
|
} },
|
|
|
|
} },
|
|
|
|
// ...(productType === 'B' ? [{ key: 'km', dataIndex: ['info', 'km'], title: t('KM')}] : []),
|
|
|
|
// ...(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: 'adult', title: t('AgeType.Adult'), render: (_, { adult_cost, currency, unit_id, unit_name }) => `${adult_cost} ${currency} / ${t(`PriceUnit.${unit_id}`)}` },
|
|
|
@ -119,7 +135,7 @@ const PriceTable = ({ productType, dataSource, refresh }) => {
|
|
|
|
key: 'state',
|
|
|
|
key: 'state',
|
|
|
|
title: t('State'),
|
|
|
|
title: t('State'),
|
|
|
|
render: (_, r) => {
|
|
|
|
render: (_, r) => {
|
|
|
|
const stateCls = `text-${stateMapVal[`${r.audit_state_id}`]?.color} `;
|
|
|
|
const stateCls = ` text-${stateMapVal[`${r.audit_state_id}`]?.color} `;
|
|
|
|
return <span className={stateCls}>{stateMapVal[`${r.audit_state_id}`]?.label}</span>;
|
|
|
|
return <span className={stateCls}>{stateMapVal[`${r.audit_state_id}`]?.label}</span>;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -128,10 +144,12 @@ const PriceTable = ({ productType, dataSource, refresh }) => {
|
|
|
|
key: 'action',
|
|
|
|
key: 'action',
|
|
|
|
render: (_, r) =>
|
|
|
|
render: (_, r) =>
|
|
|
|
r.audit_state_id <= 0 ? (
|
|
|
|
r.audit_state_id <= 0 ? (
|
|
|
|
<Space>
|
|
|
|
<RequireAuth subject={PERM_PRODUCTS_OFFER_AUDIT}>
|
|
|
|
<Button onClick={() => handleAuditPriceItem('2', r)}>✔</Button>
|
|
|
|
<Space>
|
|
|
|
<Button onClick={() => handleAuditPriceItem('3', r)}>✖</Button>
|
|
|
|
<Button onClick={() => handleAuditPriceItem('2', r)}>✔</Button>
|
|
|
|
</Space>
|
|
|
|
<Button onClick={() => handleAuditPriceItem('3', r)}>✖</Button>
|
|
|
|
|
|
|
|
</Space>
|
|
|
|
|
|
|
|
</RequireAuth>
|
|
|
|
) : null,
|
|
|
|
) : null,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
];
|
|
|
|