package groupresult

import (
	"cpone/models"
	"cpone/component/customtextfield"
	"cpone/component/customcheckbox"
	"cpone/component/customdropdown"
)

templ DialogEditForm(groupresultname string, groupresultflagpertest string, groupresultflagnonlab string, listItem templ.Component) {
	@customtextfield.CustomTextFieldv2(
		models.CustomTextFieldv2Prm{
			Label:       "Group Result name",
			Name:        "groupresultid",
			Placeholder: "Group Result name",
			Type:        "hidden",
			ID:          "groupresultid",
		})
	@customtextfield.CustomTextFieldv2(
		models.CustomTextFieldv2Prm{
			Label:       "Group Result Name",
			Name:        "groupresultname",
			Placeholder: "Group Result Name",
			Value:       groupresultname,
			Type:        "text", ID: "groupresultname"})
	@customcheckbox.MainCustomCheckboxInput(
		models.CustomCheckboxv1Prm{
			Label: "Group Result Flag Per Test (Dicentang Maka Ya)",
			Name:  "groupresultflagpertest",
			ID:    "groupresultflagpertest",
			Value: groupresultflagpertest,
		})
	@customcheckbox.MainCustomCheckboxInput(
		models.CustomCheckboxv1Prm{
			Label: "Group Result Flag Non Lab (Dicentang Maka Ya)",
			Name:  "groupresultflagnonlab",
			ID:    "groupresultflagnonlab",
			Value: groupresultflagnonlab,
		})
	@customdropdown.MainCustomDropdownInput(
		models.CustomDropdownv1Prm{
			Label: "Group Result Resume MCU",
			Name:  "groupresultresumemcu",
			ID:    "groupresultresumemcu",
		},
		listItem)
}

templ DialogEditBody(groupresultname string, groupresultflagpertest string, groupresultflagnonlab string, listItem templ.Component) {
	<div id="modalbdyEdit">
		@DialogEditForm(groupresultname, groupresultflagpertest, groupresultflagnonlab, listItem)
	</div>
	<div>
		// <div class="text-center text-primary" id="modalLoadEdit" style="">
		// 	<div class="spinner-border" role="status"></div>
		// </div>
	</div>
}

templ LoadingSpinner() {
	<div id="modalbdyEdit">
		<div class="text-center text-primary">
			<div class="spinner-border" role="status"></div>
		</div>
	</div>
}

templ DialogEditAction() {
	<div>
		<button
			id="btledit"
			type="button"
			hx-swap="delete"
			hx-target="#modalbdyEdit"
			onclick="htmx.trigger('.btneditusgp', 'htmx:abort')"
			class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4"
			data-dismiss="modal"
		>
			Batal
		</button>
		<button
			type="button"
			class="btn btn-primary btn-shadow font-weight-bold rounded-lg"
		>
			Save changes
		</button>
	</div>
}

templ BtnCloseEdit() {
	<button
		type="button"
		class="close"
		data-dismiss="modal"
		aria-label="Close"
		hx-target="#modalbdyEdit"
		onclick="htmx.trigger('.btneditusgp', 'htmx:abort')"
	>
		<i aria-hidden="true" class="ki ki-close"></i>
	</button>
}
