package dev_kesimpulan

import (
	"cpone/component/table"
	"cpone/models"
)

templ CardTableKesimpulan(title string, data []models.ModelKesimpulanLab, tableID string) {
	<div class="card card-custom gutter-b" style="border-radius: 20px">
		<div style="padding-top: 12px">
			<h3 class="card-label dot-text text-black">
				{ title }
			</h3>
		</div>
		<div class="card-body">
			<div>
				@TableKesimpulan(data, tableID)
			</div>
		</div>
	</div>
}

templ TableKesimpulan(data []models.ModelKesimpulanLab,
	tableID string) {
	<div id={ tableID }>
		@tablecomponent.TableV3([]string{"NO", "PEMERIKSAAN", "PERSENTASE"},
			[]string{"5%", "70%", "25%"},
			RowKesimpulan(data),
		)
	</div>
}

templ RowKesimpulan(data []models.ModelKesimpulanLab) {
	if len(data) == 0 {
		<tr>
			<td colspan="3" class="text-center">Data Tidak Ditemukan</td>
		</tr>
	}
	for _, v := range data {
		<tr>
			<td>{ v.Nomor }</td>
			<td>{ v.Test }</td>
			<td>{ v.Total }</td>
		</tr>
	}
}
