From 7eabb2c7c89583887655218b62d1b60137085a0a Mon Sep 17 00:00:00 2001 From: Rafiafrzl Date: Fri, 24 Oct 2025 14:53:02 +0700 Subject: [PATCH] fix description field --- src/pages/master/tag/component/DetailTag.jsx | 35 ++++++++++++-------- src/pages/master/tag/component/ListTag.jsx | 15 ++++++--- 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/src/pages/master/tag/component/DetailTag.jsx b/src/pages/master/tag/component/DetailTag.jsx index 96f86f0..63322e3 100644 --- a/src/pages/master/tag/component/DetailTag.jsx +++ b/src/pages/master/tag/component/DetailTag.jsx @@ -34,9 +34,9 @@ const DetailTag = (props) => { lim_high: '', lim_high_crash: '', device_id: null, - description: '', + tag_description: '', - sub_section_id: null, + plant_sub_section_id: null, }; const [formData, setformData] = useState(defaultData); @@ -148,8 +148,15 @@ const DetailTag = (props) => { payload.unit = formData.unit.trim(); } - // Add device_id - backend requires this field even if null - payload.device_id = formData.device_id ? parseInt(formData.device_id) : null; + // Add tag_description only if it has a value + if (formData.tag_description && formData.tag_description.trim() !== '') { + payload.tag_description = formData.tag_description.trim(); + } + + // Add device_id only if it has a value + if (formData.device_id) { + payload.device_id = parseInt(formData.device_id); + } // Add limit fields only if they have values if (formData.lim_low_crash !== '' && formData.lim_low_crash !== null) { @@ -165,8 +172,10 @@ const DetailTag = (props) => { payload.lim_high_crash = parseFloat(formData.lim_high_crash); } - // Add sub_section_id - backend requires this field even if null - payload.sub_section_id = formData.sub_section_id ? parseInt(formData.sub_section_id) : null; + // Add plant_sub_section_id only if it has a value + if (formData.plant_sub_section_id) { + payload.plant_sub_section_id = parseInt(formData.plant_sub_section_id); + } try { const response = @@ -510,9 +519,9 @@ const DetailTag = (props) => { @@ -688,8 +697,8 @@ const DetailTag = (props) => {
Description [ title: 'Data Type', dataIndex: 'data_type', key: 'data_type', - width: '10%', + width: '8%', render: (text) => text || '-', }, { @@ -55,9 +55,9 @@ const columns = (showPreviewModal, showEditModal, showDeleteDialog) => [ }, { title: 'Sub Section', - dataIndex: 'sub_section_name', - key: 'sub_section_name', - width: '12%', + dataIndex: 'plant_sub_section_name', + key: 'plant_sub_section_name', + width: '10%', render: (text) => text || '-', }, { @@ -67,6 +67,13 @@ const columns = (showPreviewModal, showEditModal, showDeleteDialog) => [ width: '12%', render: (text) => text || '-', }, + { + title: 'Description', + dataIndex: 'tag_description', + key: 'tag_description', + width: '12%', + render: (text) => text || '-', + }, { title: 'Status', dataIndex: 'is_active',