-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
127 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
.imageview { | ||
max-width: 720px; | ||
max-height: 720px; | ||
width: 720px; | ||
height: 720px; | ||
background-color: #eaeaea; | ||
position: relative; | ||
} | ||
|
||
.imageview img { | ||
display: block; | ||
width: 100%; | ||
height: 100%; | ||
object-fit: contain | ||
} | ||
|
||
.overlay { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
object-fit: contain | ||
} | ||
|
||
textarea { | ||
width: 720px; | ||
height: 200px; | ||
margin: 10px auto; | ||
padding: 20px; | ||
border: 1px solid #ddd; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
|
||
.container { | ||
margin: 0 auto; | ||
border: 1px solid #ddd; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
.row { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
} | ||
|
||
.loading-indicator { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background-color: rgba(0, 0, 0, 0.5); | ||
z-index: 1000; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.spinner { | ||
width: 50px; | ||
height: 50px; | ||
border: 5px solid #fff; | ||
border-radius: 50%; | ||
animation: spin 1s linear infinite; | ||
background: linear-gradient(to right, #FF0000 0%, #FF8000 17%, #FFFF00 33%, #00FF00 50%, #00FFFF 67%, #0080FF 83%, #0000FF 100%); | ||
} | ||
|
||
@keyframes spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
|
||
to { | ||
transform: rotate(360deg); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* This function is used to handle the result of the MRZ parsing. | ||
* @param result The result of the MRZ parsing. | ||
* @returns A JSON object that contains the parsed information. | ||
*/ | ||
|
||
import { ParsedResultItem } from "dynamsoft-code-parser"; | ||
|
||
export function handleMrzParseResult(result: ParsedResultItem): any { | ||
const parseResultInfo: any = {}; | ||
let type = result.getFieldValue("documentCode"); | ||
parseResultInfo['Document Type'] = JSON.parse(result.jsonString).CodeType; | ||
let nation = result.getFieldValue("issuingState"); | ||
parseResultInfo['Issuing State'] = nation; | ||
let surName = result.getFieldValue("primaryIdentifier"); | ||
parseResultInfo['Surname'] = surName; | ||
let givenName = result.getFieldValue("secondaryIdentifier"); | ||
parseResultInfo['Given Name'] = givenName; | ||
let passportNumber = type === "P" ? result.getFieldValue("passportNumber") : result.getFieldValue("documentNumber"); | ||
parseResultInfo['Passport Number'] = passportNumber; | ||
let nationality = result.getFieldValue("nationality"); | ||
parseResultInfo['Nationality'] = nationality; | ||
let gender = result.getFieldValue("sex"); | ||
parseResultInfo["Gender"] = gender; | ||
let birthYear = result.getFieldValue("birthYear"); | ||
let birthMonth = result.getFieldValue("birthMonth"); | ||
let birthDay = result.getFieldValue("birthDay"); | ||
if (parseInt(birthYear) > (new Date().getFullYear() % 100)) { | ||
birthYear = "19" + birthYear; | ||
} else { | ||
birthYear = "20" + birthYear; | ||
} | ||
parseResultInfo['Date of Birth (YYYY-MM-DD)'] = birthYear + "-" + birthMonth + "-" + birthDay | ||
let expiryYear = result.getFieldValue("expiryYear"); | ||
let expiryMonth = result.getFieldValue("expiryMonth"); | ||
let expiryDay = result.getFieldValue("expiryDay"); | ||
if (parseInt(expiryYear) >= 60) { | ||
expiryYear = "19" + expiryYear; | ||
} else { | ||
expiryYear = "20" + expiryYear; | ||
} | ||
parseResultInfo["Date of Expiry (YYYY-MM-DD)"] = expiryYear + "-" + expiryMonth + "-" + expiryDay; | ||
return parseResultInfo; | ||
} |