|
|
|
@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
|
|
import { useProductsTypesMapVal, useNewProductRecord } from '@/hooks/useProductsSets';
|
|
|
|
|
import useProductsStore, { postProductsSaveAction } from '@/stores/Products/Index';
|
|
|
|
|
import useAuthStore from '@/stores/Auth';
|
|
|
|
|
import { PERM_PRODUCTS_MANAGEMENT, PERM_PRODUCTS_OFFER_PUT } from '@/config';
|
|
|
|
|
import { PERM_PRODUCTS_MANAGEMENT, PERM_PRODUCTS_OFFER_PUT, PERM_PRODUCTS_INFO_PUT, PERM_PRODUCTS_NEW } from '@/config';
|
|
|
|
|
import { isEmpty, pick } from '@/utils/commons';
|
|
|
|
|
import ProductInfoForm from './ProductInfoForm';
|
|
|
|
|
import { usingStorage } from '@/hooks/usingStorage';
|
|
|
|
@ -31,7 +31,7 @@ const ProductInfo = ({ ...props }) => {
|
|
|
|
|
|
|
|
|
|
const hasHT = (editingProduct?.info?.htid || 0) > 0;
|
|
|
|
|
// const hasAuditPer = isPermitted(PERM_PRODUCTS_OFFER_AUDIT);
|
|
|
|
|
const hasEditPer = isPermitted(PERM_PRODUCTS_OFFER_PUT);
|
|
|
|
|
const hasEditPer = isPermitted(PERM_PRODUCTS_INFO_PUT) || isPermitted(PERM_PRODUCTS_NEW); // || isPermitted(PERM_PRODUCTS_OFFER_PUT);
|
|
|
|
|
|
|
|
|
|
setEditablePerm(topPerm || hasEditPer);
|
|
|
|
|
// setEditable(topPerm || (hasAuditPer ? true : (!hasHT && hasEditPer)));
|
|
|
|
@ -40,8 +40,10 @@ const ProductInfo = ({ ...props }) => {
|
|
|
|
|
setInfoEditable(topPerm || (!hasHT && hasEditPer));
|
|
|
|
|
|
|
|
|
|
const _priceEditable = [-1, 3].includes(activeAgency?.audit_state_id) || isEmpty(editingProduct?.info?.id);
|
|
|
|
|
// setPriceEditable(topPerm || (_priceEditable && hasEditPer));
|
|
|
|
|
setPriceEditable(true); // debug: 0
|
|
|
|
|
const hasPricePer = isPermitted(PERM_PRODUCTS_OFFER_PUT);
|
|
|
|
|
// setPriceEditable(topPerm || (_priceEditable && hasPricePer));
|
|
|
|
|
setPriceEditable(topPerm || (hasPricePer));
|
|
|
|
|
// setPriceEditable(true); // debug: 0
|
|
|
|
|
|
|
|
|
|
const showExtras = topPerm && hasHT; // !isEmpty(editingProduct) &&
|
|
|
|
|
setExtrasVisible(showExtras);
|
|
|
|
|