<?php require __DIR__ . '/../../layouts/header.php'; ?>
<?php $item = $row ?? []; $checks = !empty($item['checklist_json']) ? (json_decode((string) $item['checklist_json'], true) ?: []) : []; ?>
<div class="d-flex justify-content-between align-items-center mb-4"><h1 class="fw-bold mb-0"><?= e(trans('submission_checks')) ?> — <?= e((string) $submission['submission_no']) ?></h1><a href="<?= e(base_path('admin/submission-checks')) ?>" class="btn ec-btn btn-outline-secondary rounded-3"><?= e(trans('back')) ?></a></div>
<div class="ec-card  "><div class="ec-card-body p-4">
<form method="post" action="<?= e(base_path('admin/submission-checks/edit?submission_id=' . (int) $submission['id'])) ?>">
<input type="hidden" name="_csrf" value="<?= e(csrf_token()) ?>">
<input type="hidden" name="submission_id" value="<?= e((string) $submission['id']) ?>">
<div class="row g-3">
<div class="col-md-4"><label class="form-label"><?= e(trans('plagiarism_score')) ?></label><input type="number" step="0.01" name="plagiarism_score" class="form-control rounded-3" value="<?= e((string) ($item['plagiarism_score'] ?? '')) ?>"></div>
<div class="col-md-4"><label class="form-label"><?= e(trans('format_check_status')) ?></label><select name="format_check_status" class="form-select rounded-3"><?php foreach (['pending','passed','failed'] as $st): ?><option value="<?= e($st) ?>" <?= (($item['format_check_status'] ?? 'pending') === $st) ? 'selected' : '' ?>><?= e($st) ?></option><?php endforeach; ?></select></div>
<div class="col-md-12"><label class="form-label">Plagiarism Notes</label><textarea name="plagiarism_notes" class="form-control rounded-3 richtext" rows="5"><?= e((string) ($item['plagiarism_notes'] ?? '')) ?></textarea></div>
<div class="col-md-12"><label class="form-label">Format Notes</label><textarea name="format_notes" class="form-control rounded-3 richtext" rows="5"><?= e((string) ($item['format_notes'] ?? '')) ?></textarea></div>

<div class="col-md-12"><h3 class="h5 fw-bold"><?= e(trans('checklist')) ?></h3></div>
<div class="col-md-4"><div class="form-check"><input class="form-check-input" type="checkbox" name="check_title" <?= !empty($checks['title_ok']) ? 'checked' : '' ?>><label class="form-check-label">Title OK</label></div></div>
<div class="col-md-4"><div class="form-check"><input class="form-check-input" type="checkbox" name="check_abstract" <?= !empty($checks['abstract_ok']) ? 'checked' : '' ?>><label class="form-check-label">Abstract OK</label></div></div>
<div class="col-md-4"><div class="form-check"><input class="form-check-input" type="checkbox" name="check_keywords" <?= !empty($checks['keywords_ok']) ? 'checked' : '' ?>><label class="form-check-label">Keywords OK</label></div></div>
<div class="col-md-4"><div class="form-check"><input class="form-check-input" type="checkbox" name="check_format" <?= !empty($checks['format_ok']) ? 'checked' : '' ?>><label class="form-check-label">Format OK</label></div></div>
<div class="col-md-4"><div class="form-check"><input class="form-check-input" type="checkbox" name="check_references" <?= !empty($checks['references_ok']) ? 'checked' : '' ?>><label class="form-check-label">References OK</label></div></div>
</div>
<div class="mt-4"><button type="submit" class="btn ec-btn btn-success rounded-3"><?= e(trans('save')) ?></button></div>
</form></div></div>
<?php require __DIR__ . '/../../layouts/footer.php'; ?>
