Skip to content

Commit

Permalink
Merge pull request #1416 from beehyv/test-default-template
Browse files Browse the repository at this point in the history
default template selected for test and publish screen
  • Loading branch information
prasanna-egov authored Jan 5, 2023
2 parents bb21d2d + 323476c commit f089738
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tenant-portal/src/components/TestAndPublish/TestAndPublish.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,19 @@ const TestAndPublish = ({schema}) => {
};
const certificateTemplates = JSON.parse(schema.schema)?._osConfig?.certificateTemplates;
const [template,setTemplate] = useState(SAMPLE_TEMPLATE_WITH_QR);
const [templateKey,setTemplateKey] = useState("default");
const [samplefile, setSamplefile] = useState(null);
const [toast, setToast] = useState("");
const requiredFeilds = (JSON.parse(schema.schema).definitions[schema.name].required).toString().split(",");
var formObj = {}; requiredFeilds.forEach(key => formObj[key] = "");
const [data, setData] = useState(formObj);
const [formErrors, setFormErrors] = useState({});
const previewReqBody = ({
const previewSchemaFunc = async () => {
const previewReqBody = {
credentialTemplate:JSON.parse(schema.schema)?._osConfig?.credentialTemplate,
template: template,
data: data
});
const previewSchemaFunc = async () => {
};
if(!previewReqBody?.template) {
showToastFunc("Template is not available to test & preview", "danger");
return
Expand Down Expand Up @@ -106,9 +107,9 @@ const TestAndPublish = ({schema}) => {
<small>{t('testAndPublish.text')}</small>
<div className='ms-1 px-2 my-2'>
<label>Select Template</label>
<select className='bg-white border-1 d-block p-2 rounded-1 w-100'
onChange={(e) => {setTemplate(certificateTemplates[e.target.value])}}>
{Object.keys(certificateTemplates).map((objKey) =>
<select className='bg-white border-1 d-block p-2 rounded-1 w-100' value={templateKey}
onChange={(e) => {setTemplateKey(e.target.value);setTemplate(certificateTemplates[e.target.value])}}>
{Object.keys(certificateTemplates).map((objKey) =>
<option value={objKey}>
{objKey}
</option>)}
Expand Down

0 comments on commit f089738

Please sign in to comment.