Merge branch 'main' of github.com:hainatravel/GHHub

perf/export-docx
Jimmy Liow 11 months ago
commit 247caad4f5

@ -56,7 +56,7 @@
"productProject": "Product project", "productProject": "Product project",
"Code": "Code", "Code": "Code",
"City": "City", "City": "City",
"Remarks": "Remarks", "Remarks": "Memo",
"tourTime": "Tour time", "tourTime": "Tour time",
"recommendationRate": "Recommends rate", "recommendationRate": "Recommends rate",
"Name": "Name", "Name": "Name",
@ -129,7 +129,7 @@
"DisplayToC": "Display Type", "DisplayToC": "Display Type",
"KM": "KM", "KM": "KM",
"Description": "Description", "Description": "Description",
"Remarks": "Remarks" "Remarks": "Memo"
}, },
"LgcModal": { "LgcModal": {

@ -101,7 +101,7 @@ export const useProductsAuditStatesMapVal = (value) => {
export const useProductsTypesFieldsets = (type) => { export const useProductsTypesFieldsets = (type) => {
const [isPermitted] = useAuthStore((state) => [state.isPermitted]); const [isPermitted] = useAuthStore((state) => [state.isPermitted]);
const infoDefault = [['city'], ['title']]; const infoDefault = [['city'], ['title']];
const infoAdmin = ['title', 'code', 'remarks', 'dept']; // 'display_to_c' const infoAdmin = ['title', 'product_title', 'code', 'remarks', 'dept']; // 'display_to_c'
const infoDisplay = isPermitted(PERM_PRODUCTS_MANAGEMENT) ? ['display_to_c'] : []; const infoDisplay = isPermitted(PERM_PRODUCTS_MANAGEMENT) ? ['display_to_c'] : [];
const infoRecDisplay = isPermitted(PERM_PRODUCTS_MANAGEMENT) ? ['recommends_rate'] : []; const infoRecDisplay = isPermitted(PERM_PRODUCTS_MANAGEMENT) ? ['recommends_rate'] : [];
const infoTypesMap = { const infoTypesMap = {

@ -64,7 +64,7 @@ const ProductInfo = ({ ...props }) => {
travel_agency_id: activeAgency.travel_agency_id, travel_agency_id: activeAgency.travel_agency_id,
info: readyToSubInfo, info: readyToSubInfo,
lgc_details: Object.values(mergedLgc), lgc_details: Object.values(mergedLgc),
quotation: values.quotation, quotation: values.quotation, // || editingProduct.quotation, // ,
}).catch(ex => { }).catch(ex => {
setLoading(false); setLoading(false);
notification.error({ notification.error({
@ -77,6 +77,7 @@ const ProductInfo = ({ ...props }) => {
setLoading(false); setLoading(false);
success ? message.success(t('Success')) : message.error(t('Failed')); success ? message.success(t('Success')) : message.error(t('Failed'));
// //
// result.quotation = isEmpty(result.quotation) ? editingProduct.quotation : result.quotation;
appendNewProduct(result); appendNewProduct(result);
setEditingProduct(result); setEditingProduct(result);
}; };

@ -35,6 +35,7 @@ const InfoForm = ({ onSubmit, onReset, onValuesChange, editable: _editable, show
form.setFieldValue('dept', { value: editingProduct?.info?.dept_id, label: editingProduct?.info?.dept_name }); form.setFieldValue('dept', { value: editingProduct?.info?.dept_id, label: editingProduct?.info?.dept_name });
const lgc_details_mapped = (editingProduct?.lgc_details || []).reduce((r, c) => ({ ...r, [c.lgc]: c }), {}); const lgc_details_mapped = (editingProduct?.lgc_details || []).reduce((r, c) => ({ ...r, [c.lgc]: c }), {});
form.setFieldValue('lgc_details_mapped', lgc_details_mapped); form.setFieldValue('lgc_details_mapped', lgc_details_mapped);
form.setFieldValue('quotation', editingProduct?.quotation);
const editable0 = isEmpty(editingProduct) ? false : _editable; // const editable0 = isEmpty(editingProduct) ? false : _editable; //
setEditable(editable0); setEditable(editable0);
@ -135,7 +136,7 @@ const InfoForm = ({ onSubmit, onReset, onValuesChange, editable: _editable, show
</div> </div>
</Form.Item> </Form.Item>
)} )}
<Form.Item name='quotation_mapped'> <Form.Item name='quotation'>
<ProductInfoQuotation editable={editable} /> <ProductInfoQuotation editable={editable} />
</Form.Item> </Form.Item>
</Form> </Form>
@ -176,12 +177,12 @@ function getFields(props) {
let baseChildren = []; let baseChildren = [];
baseChildren = [ baseChildren = [
item( item(
'title', 'product_title',
99, 99,
<Form.Item name='title' label={t('Title')} {...fieldProps.title} rules={[{ required: true }]} tooltip={t('FormTooltip.Title')}> <Form.Item name='product_title' label={t('Title')} {...fieldProps.product_title} rules={[{ required: true }]} tooltip={t('FormTooltip.Title')}>
<Input allowClear {...fieldComProps.title} {...styleProps} {...editableProps('title')} /> <Input allowClear {...fieldComProps.product_title} {...styleProps} {...editableProps('product_title')} />
</Form.Item>, </Form.Item>,
fieldProps?.title?.col || midCol fieldProps?.product_title?.col || midCol
), ),
item( item(
'code', 'code',
@ -392,13 +393,10 @@ const formValuesMapper = (values) => {
}, },
}, },
], ],
'quotation_mapped': { 'product_title': { key: 'title' },
key: 'quotation',
transform: value => value
},
}; };
let dest = {}; let dest = {};
const { city, ...omittedValue } = values; const { city, product_title, ...omittedValue } = values;
dest = { ...omittedValue, ...objectMapper(values, destinationObject) }; dest = { ...omittedValue, ...objectMapper(values, destinationObject) };
for (const key in dest) { for (const key in dest) {
if (Object.prototype.hasOwnProperty.call(dest, key)) { if (Object.prototype.hasOwnProperty.call(dest, key)) {

Loading…
Cancel
Save