diff --git a/src/views/products/Detail.jsx b/src/views/products/Detail.jsx
index 9b05614..a1cdda6 100644
--- a/src/views/products/Detail.jsx
+++ b/src/views/products/Detail.jsx
@@ -1068,9 +1068,9 @@ function Detail() {
{/* onNodeSelect={handleNodeSelect} */}
-
+
-
+
{/*
*/}
{/* */}
@@ -1165,8 +1165,8 @@ function Detail() {
{/* */}
{/* */}
- {t('products:supplierQuotation')}
-
+ {/* {t('products:supplierQuotation')}
*/}
+ {/*
{
- !isCanEditable &&
+ // !isCanEditable &&
@@ -1184,7 +1184,7 @@ function Detail() {
{
}
-
+ */}
{/*
-
-
+ */}
setAddProductName(e.target.value)}
/>
-
+{/*
))}
-
+ */}
}
);
diff --git a/src/views/products/Detail/Header.jsx b/src/views/products/Detail/Header.jsx
index 0288215..80e236b 100644
--- a/src/views/products/Detail/Header.jsx
+++ b/src/views/products/Detail/Header.jsx
@@ -141,7 +141,7 @@ const Header = ({ refresh, ...props }) => {
diff --git a/src/views/products/Detail/ProductInfoForm.jsx b/src/views/products/Detail/ProductInfoForm.jsx
index 635e3e5..c53afe4 100644
--- a/src/views/products/Detail/ProductInfoForm.jsx
+++ b/src/views/products/Detail/ProductInfoForm.jsx
@@ -16,6 +16,7 @@ import { HT_HOST } from '@/config';
import { useProductsTypesMapVal, useProductsTypesFieldsets } from '@/hooks/useProductsSets';
import useProductsStore from '@/stores/Products/Index';
import ProductInfoLgc from './ProductInfoLgc';
+import ProductInfoQuotation from './ProductInfoQuotation';
const { RangePicker } = DatePicker;
@@ -23,8 +24,6 @@ const InfoForm = ({ formInstance, onSubmit, onReset, onValuesChange, editable, s
const { t } = useTranslation('products');
const [agencyProducts, editingProduct, setEditingProduct] = useProductsStore((state) => [state.agencyProducts, state.editingProduct, state.setEditingProduct]);
const weekdays = useWeekdays();
- // const [formValues, setFormValues] = useFormStore((state) => [state.formValues, state.setFormValues]);
- // const [formValuesToSub, setFormValuesToSub] = useFormStore((state) => [state.formValuesToSub, state.setFormValuesToSub]);
const [form] = Form.useForm();
const { sort, hides, fieldProps, fieldComProps } = {
sort: '',
@@ -37,45 +36,12 @@ const InfoForm = ({ formInstance, onSubmit, onReset, onValuesChange, editable, s
const filedsets = useProductsTypesFieldsets(editingProduct?.info?.product_type_id);
const shows = filedsets[0];
// console.log('filedsets', filedsets, shows);
- const formValuesMapper = (values) => {
- const destinationObject = {
- 'keyword': { key: 'keyword', transform: (value) => value || '' },
- 'referenceNo': { key: 'referenceNo', transform: (value) => value || '' },
- 'dates': [
- { key: 'startdate', transform: (arrVal) => (arrVal ? arrVal[0].format(DATE_FORMAT) : '') },
- { key: 'enddate', transform: (arrVal) => (arrVal ? arrVal[1].format(DATE_FORMAT) : '') },
- { key: 'starttime', transform: (arrVal) => (arrVal ? arrVal[0].format(DATE_FORMAT) : '') },
- { key: 'endtime', transform: (arrVal) => (arrVal ? arrVal[1].format(SMALL_DATETIME_FORMAT) : '') },
- ],
- 'invoiceStatus': { key: 'invoiceStatus', transform: (value) => value?.value || value?.key || '', default: '' },
- 'audit_state': { key: 'audit_state', transform: (value) => value?.value || value?.key || '', default: '' },
- 'agency': {
- key: 'agency',
- transform: (value) => {
- return Array.isArray(value) ? value.map((ele) => ele.key).join(',') : value ? value.value : '';
- },
- },
- 'year': [{ key: 'year', transform: (arrVal) => (arrVal ? arrVal.format('YYYY') : '') }],
- };
- let dest = {};
- const { dates, ...omittedValue } = values;
- dest = { ...omittedValue, ...objectMapper(values, destinationObject) };
- for (const key in dest) {
- if (Object.prototype.hasOwnProperty.call(dest, key)) {
- dest[key] = typeof dest[key] === 'string' ? (dest[key] || '').trim() : dest[key];
- }
- }
- // omit empty
- // Object.keys(dest).forEach((key) => (dest[key] == null || dest[key] === '' || dest[key].length === 0) && delete dest[key]);
- return dest;
- };
-
useEffect(() => {
// const dest = formValuesMapper(formValues);
- // setFormValuesToSub(dest);
form.resetFields();
- form.setFieldsValue(editingProduct?.info);
+ // form.setFieldsValue(editingProduct?.info);
form.setFieldValue('city', { value: editingProduct?.info?.city_id, label: editingProduct?.info?.city_name });
+ form.setFieldValue('dept', { value: editingProduct?.info?.dept_id, label: editingProduct?.info?.dept_name });
// form.setFieldValue('open_weekdays', ['1', '2', '3', '4', '5', '6', '7']);
return () => {};
}, [editingProduct?.info?.id]);
@@ -85,8 +51,6 @@ const InfoForm = ({ formInstance, onSubmit, onReset, onValuesChange, editable, s
const dest = formValuesMapper(values);
console.log('form value send to onSubmit:\n', dest);
const str = new URLSearchParams(dest).toString();
- // setFormValues(values);
- // setFormValuesToSub(dest);
if (typeof onSubmit === 'function') {
onSubmit(null, dest, values, str);
}
@@ -102,8 +66,6 @@ const InfoForm = ({ formInstance, onSubmit, onReset, onValuesChange, editable, s
};
const onIValuesChange = (changedValues, allValues) => {
const dest = formValuesMapper(allValues);
- // setFormValues(allValues);
- // setFormValuesToSub(dest);
// console.log('form onValuesChange', Object.keys(changedValues), args);
if (typeof onValuesChange === 'function') {
onValuesChange(dest);
@@ -111,7 +73,7 @@ const InfoForm = ({ formInstance, onSubmit, onReset, onValuesChange, editable, s
};
return (
<>
-