diff --git a/src/components/doc/L1/L1Info.jsx b/src/components/doc/L1/L1Info.jsx
index 78e3981..4d9355d 100644
--- a/src/components/doc/L1/L1Info.jsx
+++ b/src/components/doc/L1/L1Info.jsx
@@ -1,3 +1,4 @@
+import moment from 'moment';
import React from 'react';
import styled from 'styled-components';
@@ -48,13 +49,13 @@ const L1Info = () => {
- Ship's Name :
+ Ship's Name : { JSON.parse(localStorage.getItem('shipNm')) }
- Certificate No :
+ Certificate No : { JSON.parse(localStorage.getItem('certNo')) }
- Inspection Date :
+ Inspection Date : { moment().format('YYYY-MM-DD') }
diff --git a/src/components/doc/L1/L1Top.jsx b/src/components/doc/L1/L1Top.jsx
index 0f0b4cc..28c6e47 100644
--- a/src/components/doc/L1/L1Top.jsx
+++ b/src/components/doc/L1/L1Top.jsx
@@ -57,7 +57,8 @@ const TableBox = styled.div`
`;
const L1Top = ({ onWorkingSystem, state, onchangeDatePicker }) => {
- console.log(state.D2[2].Value1);
+ const { D2 } = state;
+
return (
* FOAM LIQUID FOR PORTABLE FOAM APPLICATOR *
@@ -89,16 +90,16 @@ const L1Top = ({ onWorkingSystem, state, onchangeDatePicker }) => {
@@ -106,19 +107,19 @@ const L1Top = ({ onWorkingSystem, state, onchangeDatePicker }) => {
• Capacity / Quantity
@@ -126,44 +127,44 @@ const L1Top = ({ onWorkingSystem, state, onchangeDatePicker }) => {
• Expiry Date
onchangeDatePicker({ target: { form:"D2", name: "2",key:"Value1", value } })}
+ selected={new Date(D2[2].Value1)}
+ dateFormat="yyyy-MM"
+ onChange={value => onchangeDatePicker({ target: { form:"D2", name: "2", key:"Value1", value } })}
showMonthYearPicker
/>
onchangeDatePicker({ target: { form:"D2", name: "2",key:"Value2", value } })}
showMonthYearPicker
/>
onchangeDatePicker({ target: { form:"D2", name: "2",key:"Value3", value } })}
showMonthYearPicker
/>
onchangeDatePicker({ target: { form:"D2", name: "2",key:"Value4", value } })}
showMonthYearPicker
/>
diff --git a/src/containers/doc/L1Container.js b/src/containers/doc/L1Container.js
index b1c74fb..1706079 100644
--- a/src/containers/doc/L1Container.js
+++ b/src/containers/doc/L1Container.js
@@ -1,45 +1,75 @@
+import { useEffect } from 'react';
+import moment from 'moment';
import L1Form from '../../components/doc/L1/L1Form';
-import useStorage from "../../hooks/useStorage";
+import useStorage from '../../hooks/useStorage';
import SaveModal from '../../components/common/SaveModal';
import CompleteModal from '../../components/common/CompleteModal';
+import getItemData from '../../components/common/getItemData';
const L1Container = () => {
- const { onWorkingSystem, state, onStorage, onchangeDatePicker, visible, showModal, commVisible, showCommModal, hideModal } = useStorage({
+ const {
+ onWorkingSystem,
+ state,
+ setState,
+ onStorage,
+ onchangeDatePicker,
+ visible,
+ showModal,
+ commVisible,
+ showCommModal,
+ hideModal,
+ } = useStorage({
H: {
- RCVNO: "",
- VESSELNM: "",
+ RCVNO: JSON.parse(localStorage.getItem('rcvNo')),
+ VESSELNM: JSON.parse(localStorage.getItem('shipNm')),
+ CERTNO: JSON.parse(localStorage.getItem('certNo')),
},
D2: {
0: {
- DESCT: "Location",
- Value1: "",
- Value2: "",
- Value3: "",
- Value4: "",
+ DESCT: 'Location',
+ Value1: '',
+ Value2: '',
+ Value3: '',
+ Value4: '',
},
1: {
- DESCT: "Capacity / Quantity",
- Value1: "",
- Value2: "",
- Value3: "",
- Value4: "",
+ DESCT: 'Capacity / Quantity',
+ Value1: '',
+ Value2: '',
+ Value3: '',
+ Value4: '',
},
2: {
- DESCT: "Expiry Date",
- Value1: new Date(),
- Value2: new Date(),
- Value3: new Date(),
- Value4: new Date(),
+ DESCT: 'Expiry Date',
+ Value1: moment().format('yyyy-MM'),
+ Value2: moment().format('yyyy-MM'),
+ Value3: moment().format('yyyy-MM'),
+ Value4: moment().format('yyyy-MM'),
},
- }
- })
+ },
+ });
+
+ useEffect(() => {
+ getItemData(setState);
+ }, [setState]);
+
return (
<>
{visible && (
-
+
)}
{commVisible && (
-
+
)}
{
showCommModal={showCommModal}
/>
>
- )
-}
+ );
+};
-export default L1Container;
\ No newline at end of file
+export default L1Container;
diff --git a/src/hooks/useStorage.js b/src/hooks/useStorage.js
index 5e9231d..49d6a14 100644
--- a/src/hooks/useStorage.js
+++ b/src/hooks/useStorage.js
@@ -1,4 +1,5 @@
import axios from 'axios';
+import moment from 'moment';
import { useState } from 'react';
import { useHistory } from 'react-router-dom';
@@ -51,7 +52,7 @@ const useStorage = initialState => {
...state[form],
[name]: {
...state[form][name],
- [key]: value,
+ [key]: moment(value).format('yyyy-MM'),
},
},
});