made sending data
This commit is contained in:
@@ -23,7 +23,7 @@ const Profile = observer (() => {
|
||||
seed: Math.floor(Math.random() * 90000000000000000000)
|
||||
};
|
||||
|
||||
const initialPropertyValues = ['First name', 'Second name', 'Birthdate', 'Gender', 'Residence', 'Document type', 'Document ID', 'Issue date', 'Expiry date'];
|
||||
const initialPropertyValues = ['First name', 'Second name', 'Birthdate', 'Gender', 'National doctype', 'National doc id', 'National doc issue date', 'National doc expiry date'];
|
||||
const [propertyValues, setPropertyValues] = useState([]);
|
||||
const [updatedValues, setUpdatedValues] = useState([defaultValues]);
|
||||
const [addedValues, setAddedValues] = useState(defaultValues);
|
||||
@@ -43,7 +43,6 @@ const Profile = observer (() => {
|
||||
...prevState,
|
||||
[field]: +value,
|
||||
}))
|
||||
console.log(addedValues);
|
||||
};
|
||||
|
||||
const changeUpdatedValues = (value, field, key) => {
|
||||
@@ -59,7 +58,6 @@ const Profile = observer (() => {
|
||||
} : elem
|
||||
))
|
||||
)
|
||||
console.log(updatedValues);
|
||||
};
|
||||
|
||||
const closeHint = (element) => {
|
||||
@@ -113,7 +111,7 @@ const Profile = observer (() => {
|
||||
|
||||
const deleteDataParameters = () => {
|
||||
const changeData = userDataStore.decryptedData.filter(item=>!selectedItems.includes(item.key))
|
||||
registrationStore.pushAccountData(changeData)
|
||||
registrationStore.pushAccountData(changeData);
|
||||
}
|
||||
|
||||
const changeDataParameters = () => {
|
||||
@@ -135,12 +133,12 @@ const Profile = observer (() => {
|
||||
})
|
||||
return newArr
|
||||
})();
|
||||
console.log(updatedData);
|
||||
registrationStore.pushAccountData(updatedData);
|
||||
}
|
||||
|
||||
const addDataParameters = () => {
|
||||
addedValues.label = addedValues.label.toLowerCase().split(' ').join('_');
|
||||
console.log(registrationStore.userData.data.concat(addedValues));
|
||||
addedValues.key = addedValues.label.toLowerCase().split(' ').join('_');
|
||||
registrationStore.pushAccountData(userDataStore.decryptedData.concat(addedValues));
|
||||
}
|
||||
|
||||
const cancelAddPanel = () => {
|
||||
@@ -162,7 +160,6 @@ const Profile = observer (() => {
|
||||
const openUpdatePanel = () => {
|
||||
setUpdatePanelOpen(true);
|
||||
setChangePanelOpen(false);
|
||||
console.log(updatedValues);
|
||||
}
|
||||
|
||||
const applyDataDeletion = () => {
|
||||
@@ -312,51 +309,48 @@ const Profile = observer (() => {
|
||||
{/* Update panel */}
|
||||
<div className={`${!updatePanelOpen && 'hidden'} bg-white p-5 shadow-lg rounded-sm border border-slate-200 lg:w-72 xl:w-80 mb-11`}>
|
||||
{updatedValues.map((item, index) => (
|
||||
<div key={index} className="flex flex-col gap-y-3">
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-1" htmlFor="mandatory">Property <span className="text-rose-500">*</span></label>
|
||||
<input
|
||||
id={`${item.key}:label`}
|
||||
className="form-input w-full"
|
||||
type="text"
|
||||
required
|
||||
onChange={(e) => changeUpdatedValues(e.target.value, 'label', item.key)}
|
||||
value={item.label}
|
||||
disabled='disabled'
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-1" htmlFor="mandatory">Value <span className="text-rose-500">*</span></label>
|
||||
<input
|
||||
autoComplete='off'
|
||||
id={`${item.key}:value`}
|
||||
className="form-input w-full"
|
||||
type="text"
|
||||
required
|
||||
onChange={(e) => changeUpdatedValues(e.target.value, 'value', item.key)}
|
||||
value={item.value}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-1" htmlFor="mandatory">Seed <span className="text-rose-500">*</span></label>
|
||||
<input
|
||||
autoComplete='off'
|
||||
id={`${item.key}:seed`}
|
||||
className="form-input w-full"
|
||||
type="number"
|
||||
required
|
||||
onChange={(e) => changeUpdatedValues(e.target.value, 'seed', item.key)}
|
||||
value={item.seed}
|
||||
/>
|
||||
</div>
|
||||
{(updatedValues[index+1]) ? (
|
||||
<div className="mt-2 mb-3.5 items-center border-b border-slate-200"></div>
|
||||
) : null}
|
||||
<div key={index} className="flex flex-col gap-y-3">
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-1" htmlFor="mandatory">Property <span className="text-rose-500">*</span></label>
|
||||
<input
|
||||
id={`${item.key}:label`}
|
||||
className="form-input w-full"
|
||||
type="text"
|
||||
required
|
||||
onChange={(e) => changeUpdatedValues(e.target.value, 'label', item.key)}
|
||||
value={item.label}
|
||||
disabled='disabled'
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-1" htmlFor="mandatory">Value <span className="text-rose-500">*</span></label>
|
||||
<input
|
||||
autoComplete='off'
|
||||
id={`${item.key}:value`}
|
||||
className="form-input w-full"
|
||||
type="text"
|
||||
required
|
||||
onChange={(e) => changeUpdatedValues(e.target.value, 'value', item.key)}
|
||||
value={item.value}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-1" htmlFor="mandatory">Seed <span className="text-rose-500">*</span></label>
|
||||
<input
|
||||
autoComplete='off'
|
||||
id={`${item.key}:seed`}
|
||||
className="form-input w-full"
|
||||
type="number"
|
||||
required
|
||||
onChange={(e) => changeUpdatedValues(e.target.value, 'seed', item.key)}
|
||||
value={item.seed}
|
||||
/>
|
||||
</div>
|
||||
{(updatedValues[index+1]) ? (
|
||||
<div className="mt-2 mb-3.5 items-center border-b border-slate-200"></div>
|
||||
) : null}
|
||||
</div>
|
||||
))}
|
||||
|
||||
<div className="flex flex-row justify-between pt-[16px] pb-[23px] items-center border-b border-slate-200">
|
||||
<span className="block text-sm font-medium">Store data on blockchain</span>
|
||||
<div className="flex items-center">
|
||||
|
||||
@@ -31,13 +31,13 @@ function ProfileTable({
|
||||
|
||||
const data = {
|
||||
general:["First name","Second name", "Gender", "Birthdate", "Place of birth"],
|
||||
nationality:["Nationality", "National id", "National doctype", "National doc id", "National doc issue date", "National doc expiry date"],
|
||||
nationality:["Nationality", "National ID", "National doctype", "National doc ID", "National doc issue date", "National doc expiry date"],
|
||||
social:["Telephone", "Twitter", "Facebook", "Instagram", "Youtube", "Wechat", "Tiktok", "Linkedin", "Vk", "Github", "Telegram", "Qq", "Snapchat", "Reddit"]
|
||||
}
|
||||
|
||||
const generalData = userData.filter(elem => data.general.includes(elem.label)),
|
||||
nationalityData = userData.filter(elem => data.nationality.includes(elem.label)),
|
||||
sosialData = userData.filter(elem => data.nationality.includes(elem.label)),
|
||||
sosialData = userData.filter(elem => data.social.includes(elem.label)),
|
||||
otherData = userData.filter((elem) =>
|
||||
!data.general.includes(elem.label) && !data.nationality.includes(elem.label) && !data.social.includes(elem.label));
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ const labelMap = {
|
||||
birthdate: "Birthdate",
|
||||
place_of_birth: "Place of birth",
|
||||
nationality: "Nationality",
|
||||
national_id: "National id",
|
||||
national_id: "National ID",
|
||||
national_doctype: "National doctype",
|
||||
national_doc_id: "National doc id",
|
||||
national_doc_id: "National doc ID",
|
||||
national_doc_issue_date: "National doc issue date",
|
||||
national_doc_expiry_date: "National doc expiry date",
|
||||
telephone: "Telephone",
|
||||
|
||||
Reference in New Issue
Block a user