Skip to content

Commit

Permalink
Merge pull request #1429 from bhanuprakash-egov/main
Browse files Browse the repository at this point in the history
UI-Fixes
  • Loading branch information
prasanna-egov authored Jan 10, 2023
2 parents 2e2d331 + 3fd35cb commit 2d57442
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 16 deletions.
5 changes: 3 additions & 2 deletions tenant-portal/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"Enter ‘Name of the Schema’ (Eg. Modern medicine permanent registration) and ‘Description’. Then click ‘Save’",
"The form builder will open with which you can drag and drop different types of fields to create custom attributes. For eg: If you wish to add an attribute of type ‘number’, drag the card ‘Number’ from the left panel to the blank space on the right side. You can also add the attributes as a JSON file by clicking on the ‘Upload JSON’ card",
"Enter the ‘Label Name, Placeholder, Description, Data, Validation wherever applicable and click Save",
"The attribute that you created is populated in the table. If you wish to add acother field, click ‘Add field’. Once all the attributes are added, you can choose to upload the template for the certificate.",
"The attribute that you created is populated in the table. If you wish to add another field, click ‘Add field’. Once all the attributes are added, you can choose to upload the template for the certificate.",
"Click on ‘Save & Next’ which will take you to the ‘Test & Publish’ screen.",
"Next, you can add sample data for the attributes that you created and check the QR code sizing and configuration. Click on ‘Publish’ to create the schema. Once you publish the schema, it cannot be edited"
]
Expand All @@ -122,7 +122,8 @@
"To search for any particular schema, enter the schema name in the search bar",
"Clicking on the schema name will open the attributes created for that schema",
"You can differentiate between ‘Published Schemas’ and ‘Saved as Draft Schemas’ by the icons next to them.",
"‘Published Schemas’ are indicated by —- and ‘Saved as Draft Schemas’ are indicated by — "
"‘Published Schemas’ are indicated by ",
" and ‘Saved as Draft Schemas’ are indicated by ", ""
]
}
},
Expand Down
2 changes: 1 addition & 1 deletion tenant-portal/public/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"किसी विशेष स्कीमा को खोजने के लिए, खोज बार में स्कीमा का नाम दर्ज करें",
"स्कीमा नाम पर क्लिक करने से उस स्कीमा के लिए बनाई गई विशेषताएँ खुल जाएँगी",
"आप 'प्रकाशित स्कीमा' और 'ड्राफ्ट स्कीम के रूप में सहेजे गए' के ​​बीच उनके आगे के आइकन द्वारा अंतर कर सकते हैं।",
"'प्रकाशित स्कीमा' को --- द्वारा दर्शाया जाता है और 'ड्राफ्ट के रूप में सहेजे गए स्कीमा' को - द्वारा दर्शाया जाता है -"
"'प्रकाशित स्कीमा' को "," द्वारा दर्शाया जाता है और 'ड्राफ्ट के रूप में सहेजे गए स्कीमा' को ", " द्वारा दर्शाया जाता है -"
]
}
},
Expand Down
6 changes: 6 additions & 0 deletions tenant-portal/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ text-align: center;
color: rgba(137, 131, 131, 1);
content: "✔";
}
.editable-cb[type="checkbox"]:after {
border-color: #6493E0 !important;
}
.editable-cb[type="checkbox"]:checked:after {
color: #6493E0 !important;
}
.toast-header {
border-bottom:none;
}
Expand Down
8 changes: 4 additions & 4 deletions tenant-portal/src/components/Attribute/Attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ function Attribute(props) {
}
</td>
<td className="text-center table-check-boxes">
<input className="custom-cb" type="checkbox" id="mandatoryAttribute" name="mandatoryAttribute"
<input className={props.schemaAttribute.editMode ? "custom-cb editable-cb": "custom-cb"} type="checkbox" id="mandatoryAttribute" name="mandatoryAttribute"
checked={isMandatory} onChange={(e) => {props.schemaAttribute.editMode ? setIsMandatory(!isMandatory) : e.preventDefault()}}/>
</td>
<td className="text-center table-check-boxes">
<input className="custom-cb" type="checkbox" id="indexedAttribute" name="indexedAttribute"
<input className={props.schemaAttribute.editMode ? "custom-cb editable-cb": "custom-cb"} type="checkbox" id="indexedAttribute" name="indexedAttribute"
checked={isIndexField} onChange={(e) => {props.schemaAttribute.editMode ? setIsIndexField(!isIndexField) : e.preventDefault()}}/>
</td>
<td className="text-center table-check-boxes">
<input className="custom-cb" type="checkbox" id="uniqueAttribute" name="uniqueAttribute"
<input className={props.schemaAttribute.editMode ? "custom-cb editable-cb": "custom-cb"} type="checkbox" id="uniqueAttribute" name="uniqueAttribute"
checked={isUniqueIndex} onChange={(e) => {props.schemaAttribute.editMode ? setIsUniqueIndex(!isUniqueIndex) : e.preventDefault()}}/>
</td>
<td className="text-center table-check-boxes">
<input className="custom-cb" type="checkbox" id="identityInformation" name="identityInformation"
<input className={props.schemaAttribute.editMode ? "custom-cb editable-cb": "custom-cb"} type="checkbox" id="identityInformation" name="identityInformation"
checked={isIdentityInformation}
onChange={(e) => {props.schemaAttribute.editMode ? setIsIdentityInformation(!isIdentityInformation) : e.preventDefault()}}/>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const ManageSchemaHome = () => {
<li className="pb-2">{t('schemasHomePage.manageSchema.info.1')}</li>
<li className="pb-2">{t('schemasHomePage.manageSchema.info.2')}</li>
<li className="pb-2">{t('schemasHomePage.manageSchema.info.3')}</li>
<li className="pb-2">{t('schemasHomePage.manageSchema.info.4')}</li>
<li className="pb-2">{t('schemasHomePage.manageSchema.info.4')}<img src={PublishedIcon}/> {t('schemasHomePage.manageSchema.info.5')}<img src={DraftIcon}/> {t('schemasHomePage.manageSchema.info.6')}</li>
</ol>

</div>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function SchemaAttributes({schemaDetails, setschemaPreview, attributes, setUpdat
<div onClick={() => setShow(true)}>
<GenericButton img={uploadIcon} text={t('schemaAttributesPage.uploadTemplate')} variant="outline-primary"/>
</div>
<UploadTemplate {...{show, setShow, osid, setTemplateUploaded,showToast}}/>
<UploadTemplate {...{show, setShow, osid, setTemplateUploaded,showToast, updateSchema}}/>
</Col>
</Row> }
</Row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const axios = require('axios');
const isoDatestringValidator = require('iso-datestring-validator')

const TestAndPublish = ({schema, setSchemaPreview}) => {
const date = new Date();
const rfcFormat = date.toISOString();
const { t } = useTranslation();
const navigate = useNavigate();
const publish = async () => {
Expand Down Expand Up @@ -120,7 +122,7 @@ const TestAndPublish = ({schema, setSchemaPreview}) => {
<div className='m-3'>
<FormGroup>
<FormLabel>{standardizeString(index)}</FormLabel>
<FormControl type='text' name={index} onChange={formInputHandler}/>
<FormControl type='text' name={index} onChange={formInputHandler} placeholder={index==="issuanceDate" ? rfcFormat: ""} />
{formErrors[index] && (
<p className="text-danger">{formErrors[index]}</p>
)}
Expand Down
17 changes: 11 additions & 6 deletions tenant-portal/src/components/UploadTemplate/UploadTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,16 @@ function UploadTemplate(props){
};
reader.readAsArrayBuffer(e.target.files[0]);
}


const getUpdatedSchema = async (osid) => {
const userToken = await getToken();
return axios.get(`/vc-management/v1/schema/${osid}`, {headers:{"Authorization" :`Bearer ${userToken}`}}).then(res => {
props.updateSchema(res?.data?.schemas[0]);
}
).catch(error => {
console.error(error);
throw error;
});
}
const saveTemplate = async () => {
if(!template){
props.showToast("FAILED");
Expand All @@ -48,7 +56,7 @@ function UploadTemplate(props){
props.setTemplateUploaded(true);
props.showToast("SUCCESS");
console.log("Upload template response: ", res.data.templateUpdateResponse);

getUpdatedSchema(schemaId);
}
}).catch((error) => {
props.setTemplateUploaded(false);
Expand All @@ -57,9 +65,6 @@ function UploadTemplate(props){
});

props.setShow(false);
setTimeout(() => {
window.location.reload();
}, 1500);
}
return (
<>
Expand Down

0 comments on commit 2d57442

Please sign in to comment.