|
|
|
@ -12,12 +12,12 @@ import ProductInfo from './Detail/ProductInfo';
|
|
|
|
|
import NewProductModal from './Detail/NewProductModal';
|
|
|
|
|
|
|
|
|
|
function Detail() {
|
|
|
|
|
const { notification, modal } = App.useApp()
|
|
|
|
|
const { notification, modal } = App.useApp();
|
|
|
|
|
const { travel_agency_id, audit_state, use_year } = useParams();
|
|
|
|
|
const [addProductVisible, setAddProductVisible] = useState(false);
|
|
|
|
|
const [agencyProducts, switchParams] = useProductsStore((state) => [state.agencyProducts, state.switchParams]);
|
|
|
|
|
const [getAgencyProducts, activeAgency] = useProductsStore((state) => [state.getAgencyProducts, state.activeAgency]);
|
|
|
|
|
const [loading, setLoading] = useProductsStore(state => [state.loading, state.setLoading]);
|
|
|
|
|
const [loading, setLoading] = useProductsStore((state) => [state.loading, state.setLoading]);
|
|
|
|
|
|
|
|
|
|
const { travelAgencyId } = usingStorage();
|
|
|
|
|
const handleGetAgencyProducts = ({ pick_year, pick_agency, pick_state } = {}) => {
|
|
|
|
@ -26,14 +26,14 @@ function Detail() {
|
|
|
|
|
const state = pick_state ?? audit_state;
|
|
|
|
|
const param = { travel_agency_id: agency, use_year: year, audit_state: state };
|
|
|
|
|
// setEditingProduct({});
|
|
|
|
|
getAgencyProducts(param).catch(ex => {
|
|
|
|
|
getAgencyProducts(param).catch((ex) => {
|
|
|
|
|
setLoading(false);
|
|
|
|
|
notification.error({
|
|
|
|
|
message: 'Notification',
|
|
|
|
|
description: ex.message,
|
|
|
|
|
placement: 'top',
|
|
|
|
|
duration: 4,
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -41,16 +41,7 @@ function Detail() {
|
|
|
|
|
<SecondHeaderWrapper
|
|
|
|
|
loading={loading}
|
|
|
|
|
backTo={false}
|
|
|
|
|
header={
|
|
|
|
|
<Header
|
|
|
|
|
title={activeAgency.travel_agency_name}
|
|
|
|
|
refresh={handleGetAgencyProducts}
|
|
|
|
|
handleNewProduct={() => setAddProductVisible(true)}
|
|
|
|
|
/>
|
|
|
|
|
}>
|
|
|
|
|
{isEmpty(agencyProducts) ? (
|
|
|
|
|
<Empty />
|
|
|
|
|
) : (
|
|
|
|
|
header={<Header title={activeAgency.travel_agency_name} refresh={handleGetAgencyProducts} handleNewProduct={() => setAddProductVisible(true)} />}>
|
|
|
|
|
<>
|
|
|
|
|
<Flex gap={10}>
|
|
|
|
|
{/* onNodeSelect={handleNodeSelect} */}
|
|
|
|
@ -61,7 +52,6 @@ function Detail() {
|
|
|
|
|
</div>
|
|
|
|
|
</Flex>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</SecondHeaderWrapper>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|