update for digital certificates list errors

This commit is contained in:
merelendor 2023-12-25 11:09:44 +03:00
parent 93dd5688ae
commit f00b11149c

View File

@ -120,11 +120,22 @@ export default class DigitalCertificates extends React.Component
errors.push('name'); errors.push('name');
} }
if(!cert.IsValid) if(cert.ValidToDate !== null && cert.ValidToDate !== undefined && cert.ValidToDate !== "")
{
if(moment(cert.ValidToDate) < moment())
{
errors.push('date');
}
}
else
{ {
errors.push('date'); errors.push('date');
} }
if(!cert.IsValid)
{
errors.push('invalid');
}
if(apply) if(apply)
{ {
callback(null, [ { id: certificate.id, fields: cert.Subject, valid_to_date: moment(cert.ValidToDate).format("DD.MM.YYYY"), errors } ]); callback(null, [ { id: certificate.id, fields: cert.Subject, valid_to_date: moment(cert.ValidToDate).format("DD.MM.YYYY"), errors } ]);
@ -281,7 +292,7 @@ export default class DigitalCertificates extends React.Component
{ certificates.length > 0 && ( { certificates.length > 0 && (
<> <>
<div className="feed"> <div className="feed">
<p>Выберите подписанта</p> <p>Список сертификатов, доступных на Вашем компьютере:</p>
<div className="feed_list"> <div className="feed_list">
{ certificates.slice(0, show_all ? certificates.length : 2).map((certificate, index) => ( { certificates.slice(0, show_all ? certificates.length : 2).map((certificate, index) => (
@ -318,7 +329,7 @@ export default class DigitalCertificates extends React.Component
{ certificate.errors.indexOf("name") > -1 ? <p className="item_desc" style={{ color: "#A8026B" }}>Не соответствует ФИО</p> : <p className="item_desc">&nbsp;</p>} { certificate.errors.indexOf("name") > -1 ? <p className="item_desc" style={{ color: "#A8026B" }}>Не соответствует ФИО</p> : <p className="item_desc">&nbsp;</p>}
{ certificate.errors.indexOf("inn") > -1 ? <p className="item_desc" style={{ color: "#A8026B" }}>Не соответствует ИНН</p> : <p className="item_desc">&nbsp;</p>} { certificate.errors.indexOf("inn") > -1 ? <p className="item_desc" style={{ color: "#A8026B" }}>Не соответствует ИНН</p> : <p className="item_desc">&nbsp;</p>}
<p className="item_desc">&nbsp;</p> <p className="item_desc">&nbsp;</p>
{ certificate.errors.indexOf("date") > -1 ? <p className="item_desc" style={{ color: "#A8026B" }}>Срок действия закончился</p> : <p className="item_desc">&nbsp;</p>} { certificate.errors.indexOf("date") > -1 ? <p className="item_desc" style={{ color: "#A8026B" }}>{ certificate.error.invalid !== undefined && "Сертификат недействителен или нарушена цепочка сертификации" }{ certificate.error.date !== undefined && "Срок действия закончился" }</p> : <p className="item_desc">&nbsp;</p>}
</div> </div>
) } ) }
</div> </div>