feat: track document and health product preparation checks
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
export const HEALTH_CHECKS = [
|
||||
['uts', 'ÜTS / ürün kaydı'],
|
||||
['sample', 'Numune / demonstrasyon'],
|
||||
['service', 'Kurulum / bakım / servis'],
|
||||
['delivery', 'Teslimat ve süre'],
|
||||
];
|
||||
export const documentKey = d => JSON.stringify([d.document, d.mandatory !== false, d.note || '']);
|
||||
export function preparationBlockers(rows, documents, checks = {}) {
|
||||
const errors = [];
|
||||
if (!documents.length) errors.push('Belge gereksinimleri belirlenmedi. Resmi dokümana göre belge ekleyin.');
|
||||
for (const d of documents) {
|
||||
const c = checks.documents?.[documentKey(d)] || {};
|
||||
if (d.mandatory === false && c.status === 'notApplicable' && c.evidence?.trim()) continue;
|
||||
if (c.status !== 'verified' || !c.evidence?.trim()) errors.push(`${d.document}: belge ve kaynak kontrolü eksik.`);
|
||||
}
|
||||
for (const row of rows) {
|
||||
const c = checks.products?.[row.priceKey] || {};
|
||||
if (c.status !== 'suitable' || !c.product?.trim() || !c.source?.trim())
|
||||
errors.push(`${row.name}: ürün/hizmet uygunluğu ve teknik kaynak eksik veya uygun değil.`);
|
||||
for (const [key, label] of HEALTH_CHECKS) {
|
||||
const field = c[key] || {};
|
||||
if (!['verified','notApplicable'].includes(field.status) || !field.evidence?.trim())
|
||||
errors.push(`${row.name}: ${label} kontrolü eksik.`);
|
||||
}
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
Reference in New Issue
Block a user