package mastermenuusergroup

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

templ DialogEditForm(code string, name string) {
	@customtextfield.CustomTextFieldv2(
		models.CustomTextFieldv2Prm{
			Label:       "Kode user group",
			Name:        "usergroupcode",
			Placeholder: "Kode user Group",
			Type:        "text",
			Value:       code,
		})
	@customtextfield.CustomTextFieldv2(
		models.CustomTextFieldv2Prm{
			Label:       "Nama User Group",
			Name:        "usergroupname",
			Placeholder: "Nama User Group",
			Type:        "text",
			Value:       name,
		})
}

templ DialogEditBody(code string, name string) {
	<div id="modalbdyEdit">
		@DialogEditForm(code, name)
	</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>
}
