Create a new sales registry app with identity verification features

Initial commit of the React application with UI components, form, camera, and indexedDB integration for sale data management.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 91318273-c764-4fd4-be04-bdc12c38af32
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/02867739-9ff7-4441-aca2-12e0153376c5.jpg
This commit is contained in:
michaelschal committed 2025-07-09 18:05:04 +00:00
1 parent 4969159ef9
commit 4fac1078a1
83 files changed
+16585

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
export function validateEAN13(code: string): boolean {
if (!code || code.length !== 13) return false;
if (!/^\d{13}$/.test(code)) return false;
// Calculate checksum
let sum = 0;
for (let i = 0; i < 12; i++) {
const digit = parseInt(code[i]);
sum += i % 2 === 0 ? digit : digit * 3;
}
const checksum = (10 - (sum % 10)) % 10;
return checksum === parseInt(code[12]);
}
export function validateRequiredFields(formData: any): string[] {
const requiredFields = [
{ key: 'vendeur', label: 'Vendeur' },
{ key: 'typeArticle', label: 'Type d\'article' },
{ key: 'categorie', label: 'Catégorie' },
{ key: 'quantite', label: 'Quantité' },
{ key: 'nom', label: 'Nom' },
{ key: 'prenom', label: 'Prénom' }
];
return requiredFields
.filter(field => !formData[field.key] || formData[field.key].toString().trim() === '')
.map(field => field.label);
}
export const ARTICLE_CATEGORY_MAPPING = {
"Pétard à mèche": ["F3"],
"Batterie": ["F3"],
"Batterie nécessitant un support externe": ["F3"],
"Combinaison": ["F3"],
"Combinaison nécessitant un support externe": ["F3"],
"Pétard aérien": ["F2", "F3"],
"Pétard à composition flash": ["F3"],
"Fusée": ["F2", "F3"],
"Chandelle romaine": ["F2", "F3"],
"Chandelle monocoup": ["F2", "F3"]
} as const;
export const IDENTITY_TYPES = [
{ value: "CNI", label: "Carte Nationale d'Identité" },
{ value: "Passeport", label: "Passeport" },
{ value: "Permis de conduire", label: "Permis de conduire" }
] as const;