Compare commits
18 Commits
multipleau
...
mike
| Author | SHA1 | Date | |
|---|---|---|---|
| 9b8e3301cc | |||
| cca96b0203 | |||
|
|
add659eb2c | ||
|
|
4739ae33c7 | ||
|
|
23f8fd513d | ||
|
|
e227d59a39 | ||
|
|
2e5fc8fd87 | ||
|
|
1a3251163a | ||
|
|
ba6ac081e1 | ||
|
|
1b97c6c788 | ||
|
|
348c0c1252 | ||
|
|
8bf75e9ef1 | ||
|
|
4791aceaa5 | ||
|
|
b04e3e8e44 | ||
|
|
b14c89dc34 | ||
|
|
0053be36f7 | ||
|
|
af29e820d9 | ||
|
|
03d34b80e7 |
@@ -294,6 +294,56 @@ a.text-white:focus {
|
||||
-webkit-box-shadow: 0 0 0 0.2rem rgba(84, 168, 255, 0.5);
|
||||
box-shadow: 0 0 0 0.2rem rgba(84, 168, 255, 0.5);
|
||||
}
|
||||
|
||||
.btn-field {
|
||||
color: var(--text-black);
|
||||
background-color: var(--fieldbg) !important;
|
||||
border-color: var(--fieldbg) !important;
|
||||
}
|
||||
.btn-field.btn-lg {
|
||||
padding: 0.825rem 1.42rem !important;
|
||||
font-size: 1.08rem !important;
|
||||
line-height: 1.5 !important;
|
||||
border-radius: 0.42rem !important;
|
||||
}
|
||||
.btn-field.btn-lg.rounded-lg {
|
||||
padding: 0.825rem 1.42rem !important;
|
||||
font-size: 1.08rem !important;
|
||||
line-height: 1.5 !important;
|
||||
border-radius: 0.85rem !important;
|
||||
}
|
||||
.btn-field:hover {
|
||||
color: var(--text-black);
|
||||
background-color: var(--fieldbg) !important;
|
||||
border-color: var(--fieldbg) !important;
|
||||
}
|
||||
.btn-field:focus,
|
||||
.btn-field.focus {
|
||||
color: var(--text-black);
|
||||
background-color: var(--fieldbg) !important;
|
||||
border-color: var(--fieldbg) !important;
|
||||
-webkit-box-shadow: 0 0 0 0rem var(--fieldbg) !important;
|
||||
box-shadow: 0 0 0 0rem var(--fieldbg) !important;
|
||||
}
|
||||
.btn-field.disabled,
|
||||
.btn-field:disabled {
|
||||
color: var(--text-black);
|
||||
background-color: var(--fieldbg) !important;
|
||||
border-color: var(--fieldbg) !important;
|
||||
}
|
||||
.btn-field:not(:disabled):not(.disabled):active,
|
||||
.btn-field:not(:disabled):not(.disabled).active,
|
||||
.show > .btn-field.dropdown-toggle {
|
||||
color: var(--text-black);
|
||||
background-color: var(--fieldbg) !important;
|
||||
border-color: var(--fieldbg) !important;
|
||||
}
|
||||
.btn-field:not(:disabled):not(.disabled):active:focus,
|
||||
.btn-field:not(:disabled):not(.disabled).active:focus,
|
||||
.show > .btn-field.dropdown-toggle:focus {
|
||||
-webkit-box-shadow: 0 0 0 0rem var(--fieldbg) !important;
|
||||
box-shadow: 0 0 0 0rem var(--fieldbg) !important;
|
||||
}
|
||||
/* COBA CUSTOM BTN */
|
||||
.btn-tosca {
|
||||
color: #ffffff;
|
||||
@@ -5226,6 +5276,12 @@ a.text-hover-tosca:hover .svg-icon svg:hover g [fill],
|
||||
border-radius: 0.42rem;
|
||||
}
|
||||
|
||||
/* ### CUSTOM CSS SELECTPICKER */
|
||||
.btn-custom-selectpicker{
|
||||
height: 8vh;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* ### OVERLAY */
|
||||
.overlay-loading {
|
||||
position: relative !important;
|
||||
|
||||
BIN
assets/asset-corporate-portal/media/person/person.png
Normal file
BIN
assets/asset-corporate-portal/media/person/person.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
511
assets/mcu/doctor.html
Normal file
511
assets/mcu/doctor.html
Normal file
@@ -0,0 +1,511 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Template Name: Metronic - Bootstrap 4 HTML, React, Angular 9 & VueJS Admin Dashboard Theme
|
||||
Author: KeenThemes
|
||||
Website: http://www.keenthemes.com/
|
||||
Contact: support@keenthemes.com
|
||||
Follow: www.twitter.com/keenthemes
|
||||
Dribbble: www.dribbble.com/keenthemes
|
||||
Like: www.facebook.com/keenthemes
|
||||
Purchase: https://1.envato.market/EA4JP
|
||||
Renew Support: https://1.envato.market/EA4JP
|
||||
License: You must have a valid license purchased only from themeforest(the above link) in order to legally use the theme for your project.
|
||||
-->
|
||||
<html lang="en">
|
||||
<!--begin::Head-->
|
||||
<head>
|
||||
<base href="../" />
|
||||
<meta charset="utf-8" />
|
||||
<title>Company Portal | { title }</title>
|
||||
<meta name="description" content="Company Portal" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1, shrink-to-fit=no"
|
||||
/>
|
||||
<!--begin::Fonts-->
|
||||
<link rel="stylesheet" href="assets/css/googlefont/poppins.css" />
|
||||
<!--end::Fonts-->
|
||||
<!--begin::Page Custom Styles(used by this page)-->
|
||||
<link
|
||||
href="assets/css/pages/login/login-1.css"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
<!--end::Page Custom Styles-->
|
||||
<!--begin::Global Theme Styles(used by all pages)-->
|
||||
<link
|
||||
href="assets/plugins/global/plugins.bundle.css"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
<link
|
||||
href="assets/plugins/custom/prismjs/prismjs.bundle.css"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
<link href="assets/css/style.bundle.css" rel="stylesheet" type="text/css" />
|
||||
<!--end::Global Theme Styles-->
|
||||
<!--begin::Layout Themes(used by all pages)-->
|
||||
<link
|
||||
href="assets/css/themes/layout/header/base/light.css"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
<link
|
||||
href="assets/css/themes/layout/header/menu/light.css"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
<link
|
||||
href="assets/css/themes/layout/brand/dark.css"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
<link
|
||||
href="assets/css/themes/layout/aside/dark.css"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
<!--end::Layout Themes-->
|
||||
<link
|
||||
rel="shortcut icon"
|
||||
href="asset-corporate-portal/media/logo/logo-small.jpg"
|
||||
/>
|
||||
<!--end::Layout Themes SAS-->
|
||||
<link
|
||||
href="asset-corporate-portal/css/sas.bundle.css"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.18/css/bootstrap-select.min.css"
|
||||
/>
|
||||
|
||||
<style>
|
||||
.filter-option-inner-inner {
|
||||
margin-top: 1.2vh;
|
||||
color: var(--text-disabled);
|
||||
}
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn {
|
||||
color: var(--text-disabled);
|
||||
}
|
||||
|
||||
.bootstrap-select.btn-group .dropdown-menu {
|
||||
min-width: 100%;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
position: sticky;
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
transform: translate3d(0px, 0px, 0px) !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<!--end::Head-->
|
||||
<!--begin::Body-->
|
||||
<body
|
||||
id="kt_body"
|
||||
class="bg-white header-fixed header-mobile-fixed subheader-enabled subheader-fixed subheader-mobile-fixed aside-enabled aside-fixed aside-minimize-hoverable page-loading"
|
||||
>
|
||||
<!--begin::Main-->
|
||||
|
||||
<div class="wrapperx p-5 h-100">
|
||||
<!-- person.png start -->
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<img
|
||||
src="asset-corporate-portal/media/person/person.png"
|
||||
style="display: block; width: 13vw"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-5">
|
||||
<div class="col-4">
|
||||
<button
|
||||
class="btn bg-primary-transparent text-center text-primary"
|
||||
style="width: 13vw; font-weight: 600"
|
||||
>
|
||||
Update Foto
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- person.png end -->
|
||||
|
||||
<div class="row mt-5">
|
||||
<!-- col 1 start -->
|
||||
<div class="col-4">
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
>Sapaan</label
|
||||
>
|
||||
<select
|
||||
class="selectpicker form-control"
|
||||
id="select1"
|
||||
data-live-search="true"
|
||||
data-size="4"
|
||||
data-style="bg-field btn-lg rounded-lg btn-custom-selectpicker"
|
||||
>
|
||||
<option value="default">Pilih Sapaan</option>
|
||||
<option value="mr">Tuan</option>
|
||||
<option value="mrs">Nyonya</option>
|
||||
<option value="ms">Nona</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
>Imbuhan Awal 1</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
placeholder="Imbuhan Awal 1"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
>Imbuhan Awal 2</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
placeholder="Imbuhan Awal 2"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- jenis kelamin -->
|
||||
<div class="form-row mt-5">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
>Jenis Kelamin</label
|
||||
>
|
||||
<select
|
||||
class="selectpicker form-control"
|
||||
id="select1"
|
||||
data-live-search="true"
|
||||
data-size="4"
|
||||
data-style="bg-field btn-lg rounded-lg btn-custom-selectpicker"
|
||||
>
|
||||
<option value="default">Pilih Jenis Kelamin</option>
|
||||
<option value="mr">Tuan</option>
|
||||
<option value="mrs">Nyonya</option>
|
||||
<option value="ms">Nona</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- jenis kelamin -->
|
||||
<!-- gol darah -->
|
||||
<div class="form-row mt-5">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
>Golongan Darah</label
|
||||
>
|
||||
<select
|
||||
class="selectpicker form-control"
|
||||
id="select1"
|
||||
data-live-search="true"
|
||||
data-size="4"
|
||||
data-style="bg-field btn-lg rounded-lg btn-custom-selectpicker"
|
||||
>
|
||||
<option value="default">Pilih Golongan Darah</option>
|
||||
<option value="mr">Tuan</option>
|
||||
<option value="mrs">Nyonya</option>
|
||||
<option value="ms">Nona</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- gol darah -->
|
||||
<!-- kewarganegaraan -->
|
||||
<div class="form-row mt-5">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
>Kewarganegaraan</label
|
||||
>
|
||||
<div class="form-control border-0 h-auto p-0 mt-3">
|
||||
<div class="form-group">
|
||||
<div style="display: flex; gap: 20px">
|
||||
<label style="display: flex; align-items: center; gap: 5px">
|
||||
<input type="radio" name="nationality" value="wni" />
|
||||
<p style="margin: 0">WNI</p>
|
||||
</label>
|
||||
<label style="display: flex; align-items: center; gap: 5px">
|
||||
<input type="radio" name="nationality" value="wna" />
|
||||
<p style="margin: 0">WNA</p>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- kewarganegaraan -->
|
||||
|
||||
<!-- identitas -->
|
||||
<div class="form-row mt-5">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
>Imbuhan Awal 1</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
placeholder="Imbuhan Awal 1"
|
||||
/>
|
||||
</div>
|
||||
<!-- identitas -->
|
||||
</div>
|
||||
<!-- col 1 end -->
|
||||
<!-- col 2 start -->
|
||||
<div class="col-4">
|
||||
<!-- nama -->
|
||||
<div class="form-row">
|
||||
<label style="font-family: Poppins; font-weight: 600">Nama</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
placeholder="Input 3"
|
||||
/>
|
||||
</div>
|
||||
<!-- nama -->
|
||||
<!-- tanggal lahir -->
|
||||
<div class="form-row mt-5">
|
||||
<label style="font-family: Poppins; font-weight: 600"
|
||||
>Tanggal Lahir</label
|
||||
>
|
||||
<div class="input-group date bg-field border-0 rounded-lg">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
readonly
|
||||
placeholder="Pilih Tanggal"
|
||||
id="datepicker"
|
||||
/>
|
||||
<div class="input-group-prepend">
|
||||
<span
|
||||
class="input-group-text bg-field border-0 rounded-lg"
|
||||
id="calendar-icon"
|
||||
>
|
||||
<span
|
||||
class="iconify text-grey"
|
||||
data-icon="heroicons-solid:calendar"
|
||||
style="font-size: 20px"
|
||||
></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- tanggal lahir -->
|
||||
<!-- rhesus -->
|
||||
<div class="form-row mt-5">
|
||||
<label style="font-family: Poppins; font-weight: 600">Rhesus</label>
|
||||
<select
|
||||
class="selectpicker form-control"
|
||||
id="select1"
|
||||
data-live-search="true"
|
||||
data-size="5"
|
||||
data-style="bg-field btn-lg rounded-lg btn-custom-selectpicker"
|
||||
>
|
||||
<option value="default">Pilih Rhesus</option>
|
||||
<option value="mr">Tuan</option>
|
||||
<option value="mrs">Nyonya</option>
|
||||
<option value="ms">Nona</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- rhesus -->
|
||||
<!-- etnis -->
|
||||
<div class="form-row mt-5">
|
||||
<label style="font-family: Poppins; font-weight: 600">Etnis</label>
|
||||
<select
|
||||
class="selectpicker form-control"
|
||||
id="select1"
|
||||
data-live-search="true"
|
||||
data-size="4"
|
||||
data-style="bg-field btn-lg rounded-lg btn-custom-selectpicker"
|
||||
>
|
||||
<option value="default">Pilih Etnis</option>
|
||||
<option value="mr">Tuan</option>
|
||||
<option value="mrs">Nyonya</option>
|
||||
<option value="ms">Nona</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- etnis -->
|
||||
|
||||
<!-- no hp -->
|
||||
<div class="form-row mt-6">
|
||||
<div class="col">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
>Nomor HP</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
placeholder="Nomor HP"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- no hp -->
|
||||
</div>
|
||||
<!-- col 2 end -->
|
||||
<!-- col 3 start -->
|
||||
<div class="col-4">
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
>Imbuhan Akhir 1</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
placeholder="Imbuhan Akhir 1"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
>Imbuhan Akhir 2</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
placeholder="Imbuhan Akhir 2"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- umur -->
|
||||
<div class="form-row mt-5">
|
||||
<div class="col">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
>Umur</label
|
||||
>
|
||||
<input
|
||||
type="number"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
placeholder="Tahun"
|
||||
/>
|
||||
</div>
|
||||
<div class="col mt-8">
|
||||
<input
|
||||
type="number"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
placeholder="Bulan"
|
||||
/>
|
||||
</div>
|
||||
<div class="col mt-8">
|
||||
<input
|
||||
type="number"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
placeholder="Hari"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- umur -->
|
||||
|
||||
<!-- pendidikan terakhir -->
|
||||
<div class="form-row mt-5">
|
||||
<div class="col">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
>Pendidikan Terakhir</label
|
||||
>
|
||||
<select
|
||||
class="selectpicker form-control"
|
||||
id="select1"
|
||||
data-live-search="true"
|
||||
data-size="4"
|
||||
data-style="bg-field btn-lg rounded-lg btn-custom-selectpicker"
|
||||
>
|
||||
<option value="default">Pilih Pendidikan</option>
|
||||
<option value="mr">Tuan</option>
|
||||
<option value="mrs">Nyonya</option>
|
||||
<option value="ms">Nona</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<!-- pendidikan terakhir -->
|
||||
|
||||
<!-- identitas pilihan -->
|
||||
<div class="form-row mt-5">
|
||||
<div class="col">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
>Identitas</label
|
||||
>
|
||||
<select
|
||||
class="selectpicker form-control"
|
||||
id="select1"
|
||||
data-live-search="true"
|
||||
data-style="bg-field btn-lg rounded-lg btn-custom-selectpicker"
|
||||
data-size="4"
|
||||
>
|
||||
<option value="default">Pilih Identitas</option>
|
||||
<option value="mr">Tuan</option>
|
||||
<option value="mrs">Nyonya</option>
|
||||
<option value="ms">Nona</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<!-- identitas pilihan -->
|
||||
|
||||
<!-- email -->
|
||||
<div class="form-row mt-6">
|
||||
<div class="col">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
>Email</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
placeholder="Email"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- email -->
|
||||
</div>
|
||||
<!-- col 3 end -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--end::Main-->
|
||||
<script src="asset-corporate-portal/js/ktappsetting.js"></script>
|
||||
<!-- iconify -->
|
||||
<script src="assets/js/iconify/iconify.min.js"></script>
|
||||
<!--end::Global Config-->
|
||||
<!--begin::Global Theme Bundle(used by all pages)-->
|
||||
<script src="assets/plugins/global/plugins.bundle.js"></script>
|
||||
<script src="assets/plugins/custom/prismjs/prismjs.bundle.js"></script>
|
||||
<script src="assets/js/scripts.bundle.js"></script>
|
||||
<script src="assets/js/pages/crud/forms/widgets/bootstrap-datepicker.js"></script>
|
||||
|
||||
<script>
|
||||
function ShowLoading() {
|
||||
document
|
||||
.getElementById("demo")
|
||||
.setAttribute("style", "display:block !important;");
|
||||
document
|
||||
.getElementById("a")
|
||||
.setAttribute("style", "display:none !important;");
|
||||
}
|
||||
function ShowForm() {
|
||||
document
|
||||
.getElementById("demo")
|
||||
.setAttribute("style", "display:none !important;");
|
||||
document
|
||||
.getElementById("a")
|
||||
.setAttribute("style", "display:block !important;;");
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
// $(".selectpicker").selectpicker();
|
||||
$(".selectpicker").selectpicker({
|
||||
dropupAuto: false,
|
||||
});
|
||||
$("#datepicker").datepicker({
|
||||
format: "dd/mm/yyyy",
|
||||
});
|
||||
$("#calendar-icon").click(function () {
|
||||
$("#datepicker").datepicker("show");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--end::Global Theme Bundle-->
|
||||
|
||||
<!--end::Page Scripts-->
|
||||
</body>
|
||||
<!--end::Body-->
|
||||
</html>
|
||||
@@ -1,237 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Typeahead Example with HTMX</title>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/css/bootstrap.min.css"
|
||||
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
<script src="https://unpkg.com/htmx.org@1.9.12/dist/htmx.js"></script>
|
||||
<style>
|
||||
.dropdown-menu {
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
width: 100%; /* Ensure the dropdown menu width matches the input width */
|
||||
}
|
||||
.dropdown-menu.show {
|
||||
display: block; /* Ensure the dropdown menu is displayed */
|
||||
}
|
||||
.spinner-border {
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
}
|
||||
.badge-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.badge-container .badge {
|
||||
margin: 2px;
|
||||
}
|
||||
.badge-container input {
|
||||
border: none;
|
||||
outline: none;
|
||||
flex-grow: 1;
|
||||
}
|
||||
.dropdown-item.active {
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container mt-5">
|
||||
<h2>Typeahead Example with HTMX</h2>
|
||||
<input type="text" name="selectedvalue" />
|
||||
<div class="dropdown">
|
||||
<input
|
||||
type="text"
|
||||
id="search-inputx"
|
||||
name="query"
|
||||
placeholder="Search for a state..."
|
||||
hx-get="http://localhost:5000/mcu/proses_obj_search.php"
|
||||
hx-trigger="input changed delay:300ms, focus from:search-inputx"
|
||||
hx-target="#dropdown-menu"
|
||||
hx-indicator="#loading-indicator"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="false"
|
||||
autocomplete="off"
|
||||
hx-include="[name='selectedvalue']"
|
||||
class="form-control"
|
||||
/>
|
||||
<div id="loading-indicator" style="display: none">
|
||||
<div class="spinner-border text-primary" role="status">
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dropdown-menu" id="dropdown-menu"></div>
|
||||
</div>
|
||||
|
||||
<div class="badge-container form-control">
|
||||
<!-- Badge will be appended here -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let selectedItems = [];
|
||||
|
||||
function selectItem(element) {
|
||||
var container = document.querySelector(".badge-container");
|
||||
|
||||
// Get the selected item text and id
|
||||
var itemText = element.textContent;
|
||||
var itemId = element.getAttribute("data-id");
|
||||
|
||||
// Check if the item is already selected
|
||||
if (selectedItems.some((item) => item.id === itemId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add the item to the selected items list
|
||||
selectedItems.push({ id: itemId, name: itemText });
|
||||
|
||||
// Create a badge element
|
||||
var badge = document.createElement("span");
|
||||
badge.className = "badge badge-primary";
|
||||
badge.textContent = itemText;
|
||||
|
||||
// Create a close button
|
||||
var closeBtn = document.createElement("span");
|
||||
closeBtn.className = "badge badge-light ml-1";
|
||||
closeBtn.style.cursor = "pointer";
|
||||
closeBtn.textContent = "×";
|
||||
closeBtn.onclick = function () {
|
||||
container.removeChild(badge);
|
||||
selectedItems = selectedItems.filter((item) => item.id !== itemId);
|
||||
updateQueryParameter();
|
||||
};
|
||||
|
||||
// Append close button to badge
|
||||
badge.appendChild(closeBtn);
|
||||
|
||||
// Append the badge to the container
|
||||
container.appendChild(badge);
|
||||
|
||||
// Clear the input
|
||||
document.getElementById("search-inputx").value = "";
|
||||
|
||||
// Hide dropdown
|
||||
document.getElementById("dropdown-menu").classList.remove("show");
|
||||
|
||||
// Highlight the selected item in the dropdown
|
||||
element.classList.add("selected");
|
||||
|
||||
// Update query parameter
|
||||
updateQueryParameter();
|
||||
}
|
||||
|
||||
function updateQueryParameter() {
|
||||
var selectedValues = selectedItems.map((item) => item.id).join(",");
|
||||
document.querySelector('input[name="selectedvalue"]').value =
|
||||
selectedValues;
|
||||
}
|
||||
|
||||
// Display loading indicator when request is in progress
|
||||
document.body.addEventListener("htmx:configRequest", function (event) {
|
||||
document.getElementById("loading-indicator").style.display = "block";
|
||||
});
|
||||
|
||||
document.body.addEventListener("htmx:afterOnLoad", function (event) {
|
||||
document.getElementById("loading-indicator").style.display = "none";
|
||||
var dropdown = document.getElementById("dropdown-menu");
|
||||
if (dropdown.children.length > 0) {
|
||||
dropdown.classList.add("show");
|
||||
dropdown.focus();
|
||||
var activeItem = dropdown.querySelector(".active");
|
||||
if (activeItem) {
|
||||
dropdown.scrollTop = activeItem.offsetTop - dropdown.offsetTop;
|
||||
}
|
||||
} else {
|
||||
dropdown.classList.remove("show");
|
||||
}
|
||||
});
|
||||
|
||||
// Hide the dropdown when clicking outside
|
||||
document.addEventListener("click", function (event) {
|
||||
var isClickInside =
|
||||
event.target.classList.contains("search-input") ||
|
||||
event.target.classList.contains("badge-container") ||
|
||||
event.target.closest(".badge-container");
|
||||
if (!isClickInside) {
|
||||
document.getElementById("dropdown-menu").classList.remove("show");
|
||||
}
|
||||
});
|
||||
|
||||
// Handle keyboard navigation
|
||||
document
|
||||
.getElementById("search-inputx")
|
||||
.addEventListener("keydown", function (event) {
|
||||
var dropdownMenu = document.getElementById("dropdown-menu");
|
||||
var items = dropdownMenu.querySelectorAll(".dropdown-item");
|
||||
var activeItem = dropdownMenu.querySelector(".active");
|
||||
|
||||
if (event.key === "ArrowDown") {
|
||||
event.preventDefault(); // Prevent page scroll
|
||||
if (!activeItem) {
|
||||
items[0].classList.add("active");
|
||||
} else {
|
||||
activeItem.classList.remove("active");
|
||||
var next = activeItem.nextElementSibling;
|
||||
if (next) {
|
||||
next.classList.add("active");
|
||||
} else {
|
||||
items[0].classList.add("active");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.key === "ArrowUp") {
|
||||
event.preventDefault(); // Prevent page scroll
|
||||
if (!activeItem) {
|
||||
items[items.length - 1].classList.add("active");
|
||||
} else {
|
||||
activeItem.classList.remove("active");
|
||||
var prev = activeItem.previousElementSibling;
|
||||
if (prev) {
|
||||
prev.classList.add("active");
|
||||
} else {
|
||||
items[items.length - 1].classList.add("active");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.key === "Enter" && activeItem) {
|
||||
selectItem(activeItem);
|
||||
}
|
||||
|
||||
if (activeItem) {
|
||||
dropdownMenu.scrollTop =
|
||||
activeItem.offsetTop - dropdownMenu.offsetTop;
|
||||
}
|
||||
});
|
||||
|
||||
// Set the input value and hide the dropdown when an item is clicked
|
||||
document.body.addEventListener("click", function (event) {
|
||||
if (event.target.classList.contains("dropdown-item")) {
|
||||
selectItem(event.target);
|
||||
}
|
||||
});
|
||||
|
||||
// Show dropdown when input gets focus and has value
|
||||
document
|
||||
.getElementById("search-inputx")
|
||||
.addEventListener("focus", function (event) {
|
||||
var input = event.target;
|
||||
var dropdown = document.getElementById("dropdown-menu");
|
||||
if (input.value.length > 0) {
|
||||
dropdown.classList.add("show");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
631
assets/mcu/patient.html
Normal file
631
assets/mcu/patient.html
Normal file
@@ -0,0 +1,631 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Template Name: Metronic - Bootstrap 4 HTML, React, Angular 9 & VueJS Admin Dashboard Theme
|
||||
Author: KeenThemes
|
||||
Website: http://www.keenthemes.com/
|
||||
Contact: support@keenthemes.com
|
||||
Follow: www.twitter.com/keenthemes
|
||||
Dribbble: www.dribbble.com/keenthemes
|
||||
Like: www.facebook.com/keenthemes
|
||||
Purchase: https://1.envato.market/EA4JP
|
||||
Renew Support: https://1.envato.market/EA4JP
|
||||
License: You must have a valid license purchased only from themeforest(the above link) in order to legally use the theme for your project.
|
||||
-->
|
||||
<html lang="en">
|
||||
<!--begin::Head-->
|
||||
<head>
|
||||
<base href="../" />
|
||||
<meta charset="utf-8" />
|
||||
<title>Company Portal | { title }</title>
|
||||
<meta name="description" content="Company Portal" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1, shrink-to-fit=no"
|
||||
/>
|
||||
<!--begin::Fonts-->
|
||||
<link rel="stylesheet" href="assets/css/googlefont/poppins.css" />
|
||||
<!--end::Fonts-->
|
||||
<!--begin::Page Custom Styles(used by this page)-->
|
||||
<link
|
||||
href="assets/css/pages/login/login-1.css"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
<!--end::Page Custom Styles-->
|
||||
<!--begin::Global Theme Styles(used by all pages)-->
|
||||
<link
|
||||
href="assets/plugins/global/plugins.bundle.css"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
<link
|
||||
href="assets/plugins/custom/prismjs/prismjs.bundle.css"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
<link href="assets/css/style.bundle.css" rel="stylesheet" type="text/css" />
|
||||
<!--end::Global Theme Styles-->
|
||||
<!--begin::Layout Themes(used by all pages)-->
|
||||
<link
|
||||
href="assets/css/themes/layout/header/base/light.css"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
<link
|
||||
href="assets/css/themes/layout/header/menu/light.css"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
<link
|
||||
href="assets/css/themes/layout/brand/dark.css"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
<link
|
||||
href="assets/css/themes/layout/aside/dark.css"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
<!--end::Layout Themes-->
|
||||
<link
|
||||
rel="shortcut icon"
|
||||
href="asset-corporate-portal/media/logo/logo-small.jpg"
|
||||
/>
|
||||
<!--end::Layout Themes SAS-->
|
||||
<link
|
||||
href="asset-corporate-portal/css/sas.bundle.css"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.18/css/bootstrap-select.min.css"
|
||||
/>
|
||||
|
||||
<style>
|
||||
.filter-option-inner-inner {
|
||||
margin-top: 1.2vh;
|
||||
color: var(--text-disabled);
|
||||
}
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn {
|
||||
color: var(--text-disabled);
|
||||
}
|
||||
|
||||
.bootstrap-select.btn-group .dropdown-menu {
|
||||
min-width: 100%;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
position: sticky;
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
transform: translate3d(0px, 0px, 0px) !important;
|
||||
}
|
||||
|
||||
/* mik */
|
||||
.input-container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.input-label {
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
transform: translateY(-50%);
|
||||
pointer-events: none;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
.input-field:not(:placeholder-shown) + .input-label {
|
||||
top: 50%;
|
||||
font-size: 12px;
|
||||
color: var(--secondary-hover);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<!--end::Head-->
|
||||
<!--begin::Body-->
|
||||
<body
|
||||
id="kt_body"
|
||||
class="bg-white header-fixed header-mobile-fixed subheader-enabled subheader-fixed subheader-mobile-fixed aside-enabled aside-fixed aside-minimize-hoverable page-loading"
|
||||
>
|
||||
<style></style>
|
||||
<!--begin::Main-->
|
||||
|
||||
<div class="wrapperx p-5 h-100">
|
||||
<div class="row">
|
||||
<div class="col-lg-10">
|
||||
<!--begin::Row 1-->
|
||||
<div class="form-row">
|
||||
<div class="col-md-6 col-lg-2">
|
||||
<label
|
||||
for="input1"
|
||||
class="font-weight-bolder"
|
||||
style="font-family: Poppins"
|
||||
>Sapaan</label
|
||||
>
|
||||
<select
|
||||
class="selectpicker form-control"
|
||||
id="select1"
|
||||
data-live-search="true"
|
||||
data-size="4"
|
||||
data-style="bg-field btn-lg rounded-lg btn-custom-selectpicker"
|
||||
>
|
||||
<option value="mr">Tn</option>
|
||||
<option value="mrs">Ny</option>
|
||||
<option value="ms">Nn</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-3">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
>Imbuhan Awal</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
placeholder="Imbuhan Awal 1"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-5">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
>Nama
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
placeholder="Imbuhan Awal 2"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-2">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
>Imbuhan Akhir</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
placeholder="Imbuhan Awal 2"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Row 1-->
|
||||
<!--begin::Row 2-->
|
||||
<div class="row mt-5">
|
||||
<div class="col-md-6">
|
||||
<!-- begin::Jenis Kelamin -->
|
||||
<div class="form-row">
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600"
|
||||
>Jenis Kelamin</label
|
||||
>
|
||||
<select
|
||||
class="selectpicker form-control"
|
||||
id="select1"
|
||||
data-live-search="true"
|
||||
data-size="4"
|
||||
data-style="bg-field btn-lg rounded-lg btn-custom-selectpicker"
|
||||
>
|
||||
<option value="default">Pilih Jenis Kelamin</option>
|
||||
<option value="mr">Perempuan</option>
|
||||
<option value="mrs">Laki-Laki</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- end::Jenis Kelamin -->
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<!-- begin::Tanggal Lahir -->
|
||||
<div class="form-row">
|
||||
<label style="font-family: Poppins; font-weight: 600"
|
||||
>Tanggal Lahir</label
|
||||
>
|
||||
<div class="input-group date bg-field border-0 rounded-lg">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
readonly
|
||||
placeholder="Pilih Tanggal"
|
||||
id="datepicker"
|
||||
/>
|
||||
<div class="input-group-prepend">
|
||||
<span
|
||||
class="input-group-text bg-field border-0 rounded-lg"
|
||||
id="calendar-icon"
|
||||
>
|
||||
<span
|
||||
class="iconify text-grey"
|
||||
data-icon="heroicons-solid:calendar"
|
||||
style="font-size: 20px"
|
||||
></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end::Tanggal Lahir -->
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Row 2-->
|
||||
<!--begin::Row 3-->
|
||||
<div class="row mt-5">
|
||||
<div class="col-lg-6">
|
||||
<!-- begin::Umur -->
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600"
|
||||
>Umur</label
|
||||
>
|
||||
<div class="input-container">
|
||||
<input
|
||||
type="text"
|
||||
id="myInput"
|
||||
class="input-field form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
/>
|
||||
<label for="myInput" class="input-label">Tahun</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col mt-8">
|
||||
<div class="input-container">
|
||||
<input
|
||||
type="text"
|
||||
id="myInput"
|
||||
class="input-field form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
/>
|
||||
<label for="myInput" class="input-label">Bulan</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col mt-8">
|
||||
<div class="input-container">
|
||||
<input
|
||||
type="text"
|
||||
id="myInput"
|
||||
class="input-field form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
/>
|
||||
<label for="myInput" class="input-label">Hari</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end::Umur -->
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<!-- begin::Darah -->
|
||||
<div class="form-row">
|
||||
<!-- begin::Golongan Darah -->
|
||||
<div class="col">
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600"
|
||||
>Golongan Darah</label
|
||||
>
|
||||
<select
|
||||
class="selectpicker form-control"
|
||||
id="select1"
|
||||
data-live-search="true"
|
||||
data-size="4"
|
||||
data-style="bg-field btn-lg rounded-lg btn-custom-selectpicker"
|
||||
>
|
||||
<option value="default">Pilih Golongan Darah</option>
|
||||
<option value="">O</option>
|
||||
<option value="">A</option>
|
||||
<option value="">B</option>
|
||||
<option value="">AB</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- end::Golongan Darah -->
|
||||
<!-- begin::Rhesus -->
|
||||
<div class="col">
|
||||
<label style="font-family: Poppins; font-weight: 600"
|
||||
>Rhesus</label
|
||||
>
|
||||
<select
|
||||
class="selectpicker form-control"
|
||||
id="select1"
|
||||
data-live-search="true"
|
||||
data-size="5"
|
||||
data-style="bg-field btn-lg rounded-lg btn-custom-selectpicker"
|
||||
>
|
||||
<option value="default">Pilih Rhesus</option>
|
||||
<option value="">-</option>
|
||||
<option value="">+</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- end::Rhesus -->
|
||||
</div>
|
||||
<!-- end::Darah -->
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Row 3-->
|
||||
<!--begin::Row 4-->
|
||||
<div class="row mt-5">
|
||||
<!--begin::Pekerjaan-->
|
||||
<div class="col-md-6">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
>Pekerjaan</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
placeholder="Pekerjaan"
|
||||
/>
|
||||
</div>
|
||||
<!--end::Pekerjaan-->
|
||||
<!--begin::Departemen-->
|
||||
<div class="col-md-6">
|
||||
<div class="form-row">
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600"
|
||||
>Departemen</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
placeholder="Departemen"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Departemen-->
|
||||
</div>
|
||||
<!--end::Row 4-->
|
||||
<!--begin::Row 5-->
|
||||
<div class="row mt-5">
|
||||
<!--begin::Posisi-->
|
||||
<div class="col-md-6">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
>Posisi</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
placeholder="Posisi"
|
||||
/>
|
||||
</div>
|
||||
<!--end::Posisi-->
|
||||
<!--Begin::Pendidikan Terakhir-->
|
||||
<div class="col-md-6">
|
||||
<div class="form-row">
|
||||
<label style="font-family: Poppins; font-weight: 600"
|
||||
>Pendidikan Terakhir</label
|
||||
>
|
||||
<select
|
||||
class="selectpicker form-control"
|
||||
id="select1"
|
||||
data-live-search="true"
|
||||
data-size="5"
|
||||
data-style="bg-field btn-lg rounded-lg btn-custom-selectpicker"
|
||||
>
|
||||
<option value="default">Pilih Pendidikan Terakhir</option>
|
||||
<option value="mr">SMA/SLTA/Sederajat</option>
|
||||
<option value="mrs">D3</option>
|
||||
<option value="ms">Sarjana</option>
|
||||
<option value="ms">Magister</option>
|
||||
<option value="ms">Doktor</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Pendidikan Terakhir-->
|
||||
</div>
|
||||
<!--end::Row 5-->
|
||||
<!--begin::Row 6-->
|
||||
<div class="row mt-5">
|
||||
<!--begin::Kewarganegaraan-->
|
||||
<div class="col-md-6">
|
||||
<div class="form-row">
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600"
|
||||
>Kewarganegaraan</label
|
||||
>
|
||||
<div class="form-control border-0 h-auto p-0 mt-3">
|
||||
<div class="form-group">
|
||||
<div
|
||||
class="justify-content-between"
|
||||
style="display: flex; gap: 20px"
|
||||
>
|
||||
<label
|
||||
style="display: flex; align-items: center; gap: 5px"
|
||||
>
|
||||
<input type="radio" name="nationality" value="wni" />
|
||||
<p style="margin: 0">WNI</p>
|
||||
</label>
|
||||
<label
|
||||
style="display: flex; align-items: center; gap: 5px"
|
||||
>
|
||||
<input type="radio" name="nationality" value="wna" />
|
||||
<p style="margin: 0">WNA</p>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Kewarganegaraan-->
|
||||
<!--Begin::Etnis-->
|
||||
<div class="col-md-6">
|
||||
<div class="form-row">
|
||||
<label style="font-family: Poppins; font-weight: 600"
|
||||
>Etnis</label
|
||||
>
|
||||
<select
|
||||
class="selectpicker form-control"
|
||||
id="select1"
|
||||
data-live-search="true"
|
||||
data-size="4"
|
||||
data-style="bg-field btn-lg rounded-lg btn-custom-selectpicker"
|
||||
>
|
||||
<option value="default">Pilih Etnis</option>
|
||||
<option value="">Jawa</option>
|
||||
<option value="">Sunda</option>
|
||||
<option value="">Batak</option>
|
||||
<option value="">Betawi</option>
|
||||
<option value="">Dayak</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Etnis-->
|
||||
</div>
|
||||
<!--end::Row 6-->
|
||||
<!--begin::Row 7-->
|
||||
<div class="row mt-5">
|
||||
<!--begin::Identitas-->
|
||||
<div class="col-md-6">
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600"
|
||||
>Identitas</label
|
||||
>
|
||||
<select
|
||||
class="selectpicker form-control"
|
||||
id="select1"
|
||||
data-live-search="true"
|
||||
data-style="bg-field btn-lg rounded-lg btn-custom-selectpicker"
|
||||
data-size="4"
|
||||
>
|
||||
<option value="default">Pilih Identitas</option>
|
||||
<option value="">KTP</option>
|
||||
<option value="">SIM</option>
|
||||
<option value="">Paspor</option>
|
||||
<option value="">Kartu Pelajar</option>
|
||||
<option value="">Surat Keterangan</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Identitas-->
|
||||
<!--Begin::Nomor Identitas-->
|
||||
<div class="col-md-6">
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600"
|
||||
>Nomor Identitas</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
placeholder="Nomor Identitas"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Nomor Identitas-->
|
||||
</div>
|
||||
<!--end::Row 7-->
|
||||
<!--begin::Row 8-->
|
||||
<div class="row mt-5">
|
||||
<!--begin::Nomor Hp-->
|
||||
<div class="col-md-6">
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600"
|
||||
>Nomor HP</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
placeholder="Nomor HP"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Nomor Hp-->
|
||||
<!--Begin::Email-->
|
||||
<div class="col-md-6">
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600"
|
||||
>Email</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
placeholder="Email"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Email-->
|
||||
</div>
|
||||
<!--end::Row 8-->
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<!-- person.png start -->
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<img
|
||||
src="asset-corporate-portal/media/person/person.png"
|
||||
style="display: block; width: 13vw"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-5">
|
||||
<div class="col">
|
||||
<button
|
||||
class="btn bg-primary-transparent text-center text-primary"
|
||||
style="width: 13vw; font-weight: 600"
|
||||
>
|
||||
Update Foto
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- person.png end -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--end::Main-->
|
||||
<script src="asset-corporate-portal/js/ktappsetting.js"></script>
|
||||
<!-- iconify -->
|
||||
<script src="assets/js/iconify/iconify.min.js"></script>
|
||||
<!--end::Global Config-->
|
||||
<!--begin::Global Theme Bundle(used by all pages)-->
|
||||
<script src="assets/plugins/global/plugins.bundle.js"></script>
|
||||
<script src="assets/plugins/custom/prismjs/prismjs.bundle.js"></script>
|
||||
<script src="assets/js/scripts.bundle.js"></script>
|
||||
<script src="assets/js/pages/crud/forms/widgets/bootstrap-datepicker.js"></script>
|
||||
|
||||
<script>
|
||||
function ShowLoading() {
|
||||
document
|
||||
.getElementById("demo")
|
||||
.setAttribute("style", "display:block !important;");
|
||||
document
|
||||
.getElementById("a")
|
||||
.setAttribute("style", "display:none !important;");
|
||||
}
|
||||
function ShowForm() {
|
||||
document
|
||||
.getElementById("demo")
|
||||
.setAttribute("style", "display:none !important;");
|
||||
document
|
||||
.getElementById("a")
|
||||
.setAttribute("style", "display:block !important;;");
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
// $(".selectpicker").selectpicker();
|
||||
$(".selectpicker").selectpicker({
|
||||
dropupAuto: false,
|
||||
});
|
||||
$("#datepicker").datepicker({
|
||||
format: "dd/mm/yyyy",
|
||||
});
|
||||
$("#calendar-icon").click(function () {
|
||||
$("#datepicker").datepicker("show");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--end::Global Theme Bundle-->
|
||||
|
||||
<!--end::Page Scripts-->
|
||||
</body>
|
||||
<!--end::Body-->
|
||||
</html>
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
header('Content-Type: text/html'); // Set header to indicate HTML response
|
||||
|
||||
// Data dummy dengan id dan nama sebagai contoh
|
||||
$data = [
|
||||
["id" => 1, "name" => "Alabama"],
|
||||
["id" => 2, "name" => "Alaska"],
|
||||
// other data...
|
||||
["id" => 49, "name" => "Wisconsin"],
|
||||
["id" => 50, "name" => "Wyoming"],
|
||||
];
|
||||
|
||||
$query = isset($_GET['query']) ? $_GET['query'] : '';
|
||||
$selected = isset($_GET['selectedvalue']) ? explode(',', $_GET['selectedvalue']) : [];
|
||||
|
||||
if ($query) {
|
||||
$results = array_filter($data, function($item) use ($query, $selected) {
|
||||
// Filter out items that do not match the query and are already selected
|
||||
return stripos($item["name"], $query) !== false && !in_array($item["id"], $selected);
|
||||
});
|
||||
} else {
|
||||
$results = [];
|
||||
}
|
||||
|
||||
// Prepare HTML response
|
||||
$html = '';
|
||||
foreach ($results as $result) {
|
||||
$html .= '<a class="dropdown-item" href="#" data-id="' . htmlspecialchars($result["id"]) . '" onclick="selectItem(this)">' . htmlspecialchars($result["name"]) . '</a>';
|
||||
}
|
||||
|
||||
// Return HTML response
|
||||
echo $html;
|
||||
?>
|
||||
@@ -30,6 +30,7 @@ templ MainCustomDropdownInput(inp models.CustomDropdownv1Prm, listItem templ.Com
|
||||
name={ inp.Name }
|
||||
class="form-control bg-field selectpicker"
|
||||
data-live-search="true"
|
||||
data-style="bg-field btn-lg rounded-lg btn-custom-selectpicker"
|
||||
data-size="5"
|
||||
id={ inp.ID }
|
||||
>
|
||||
@@ -59,3 +60,60 @@ templ MainCustomDropdownV1(name string, id string, hxTarget string, hxGet string
|
||||
</select>
|
||||
</div>
|
||||
}
|
||||
|
||||
templ CustomDropdownFilter(
|
||||
idCmp string,
|
||||
hxName string,
|
||||
hxInclude string,
|
||||
hxGet string,
|
||||
hxSwap string,
|
||||
hxTarget string,
|
||||
hxTrigger string,
|
||||
hxBeforeRequest templ.ComponentScript,
|
||||
hxAfterRequest templ.ComponentScript,
|
||||
listItem templ.Component) {
|
||||
<select
|
||||
class="form-control form-control-lg bg-field btn-lg rounded-lg selectpicker"
|
||||
data-live-search="true"
|
||||
data-size="5"
|
||||
data-style="btn-field btn-lg rounded-lg"
|
||||
data-live-search-placeholder="cari ..."
|
||||
id={ idCmp }
|
||||
name={ hxName }
|
||||
hx-include={ hxInclude }
|
||||
hx-get={ hxGet }
|
||||
hx-swap={ hxSwap }
|
||||
hx-target={ hxTarget }
|
||||
hx-trigger={ hxTrigger }
|
||||
hx-on::before-request={ hxBeforeRequest }
|
||||
hx-on::after-request={ hxAfterRequest }
|
||||
>
|
||||
@listItem
|
||||
</select>
|
||||
}
|
||||
|
||||
templ CustomDropdownForm(
|
||||
inp models.CustomDropdownV2Prm) {
|
||||
<div class="form-group">
|
||||
<label class="text-black" style="font-family: Poppins; font-weight: 600;">{ inp.Label } </label>
|
||||
<select
|
||||
if inp.ErrorMsg =="" {
|
||||
class="form-control form-control-lg bg-field btn-lg rounded-lg selectpicker"
|
||||
} else {
|
||||
class="form-control form-control-lg bg-field btn-lg rounded-lg selectpicker is-invalid"
|
||||
}
|
||||
data-live-search="true"
|
||||
data-size="5"
|
||||
title={ inp.Placeholder }
|
||||
data-style="btn-field btn-lg rounded-lg"
|
||||
data-live-search-placeholder="cari ..."
|
||||
name={ inp.Name }
|
||||
id={ inp.ID }
|
||||
>
|
||||
@inp.ListItem
|
||||
</select>
|
||||
<div class="invalid-feedback text-danger mt-3 ml-2">
|
||||
{ inp.ErrorMsg }
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -174,14 +174,14 @@ func MainCustomDropdownInput(inp models.CustomDropdownv1Prm, listItem templ.Comp
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"form-control bg-field selectpicker\" data-live-search=\"true\" data-size=\"5\" id=\"")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"form-control bg-field selectpicker\" data-live-search=\"true\" data-style=\"bg-field btn-lg rounded-lg btn-custom-selectpicker\" data-size=\"5\" id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var12 string
|
||||
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(inp.ID)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 34, Col: 14}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 35, Col: 14}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -202,7 +202,7 @@ func MainCustomDropdownInput(inp models.CustomDropdownv1Prm, listItem templ.Comp
|
||||
var templ_7745c5c3_Var13 string
|
||||
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(inp.ErrorMsg)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 39, Col: 17}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 40, Col: 17}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -239,7 +239,7 @@ func MainCustomDropdownV1(name string, id string, hxTarget string, hxGet string,
|
||||
var templ_7745c5c3_Var15 string
|
||||
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 47, Col: 14}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 48, Col: 14}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -252,7 +252,7 @@ func MainCustomDropdownV1(name string, id string, hxTarget string, hxGet string,
|
||||
var templ_7745c5c3_Var16 string
|
||||
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(id)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 51, Col: 10}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 52, Col: 10}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -265,7 +265,7 @@ func MainCustomDropdownV1(name string, id string, hxTarget string, hxGet string,
|
||||
var templ_7745c5c3_Var17 string
|
||||
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(hxGet)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 52, Col: 17}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 53, Col: 17}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -278,7 +278,7 @@ func MainCustomDropdownV1(name string, id string, hxTarget string, hxGet string,
|
||||
var templ_7745c5c3_Var18 string
|
||||
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(hxTarget)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 53, Col: 23}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 54, Col: 23}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -291,7 +291,7 @@ func MainCustomDropdownV1(name string, id string, hxTarget string, hxGet string,
|
||||
var templ_7745c5c3_Var19 string
|
||||
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(hxIndicator)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 54, Col: 29}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 55, Col: 29}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -304,7 +304,7 @@ func MainCustomDropdownV1(name string, id string, hxTarget string, hxGet string,
|
||||
var templ_7745c5c3_Var20 string
|
||||
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(hxTrigger)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 55, Col: 25}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 56, Col: 25}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -317,7 +317,7 @@ func MainCustomDropdownV1(name string, id string, hxTarget string, hxGet string,
|
||||
var templ_7745c5c3_Var21 string
|
||||
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(hxInclude)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 56, Col: 25}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 57, Col: 25}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -341,3 +341,271 @@ func MainCustomDropdownV1(name string, id string, hxTarget string, hxGet string,
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func CustomDropdownFilter(
|
||||
idCmp string,
|
||||
hxName string,
|
||||
hxInclude string,
|
||||
hxGet string,
|
||||
hxSwap string,
|
||||
hxTarget string,
|
||||
hxTrigger string,
|
||||
hxBeforeRequest templ.ComponentScript,
|
||||
hxAfterRequest templ.ComponentScript,
|
||||
listItem templ.Component) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var22 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var22 == nil {
|
||||
templ_7745c5c3_Var22 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, hxBeforeRequest, hxAfterRequest)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<select class=\"form-control form-control-lg bg-field btn-lg rounded-lg selectpicker\" data-live-search=\"true\" data-size=\"5\" data-style=\"btn-field btn-lg rounded-lg\" data-live-search-placeholder=\"cari ...\" id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var23 string
|
||||
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(idCmp)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 80, Col: 12}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" name=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var24 string
|
||||
templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(hxName)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 81, Col: 15}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-include=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var25 string
|
||||
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(hxInclude)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 82, Col: 24}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-get=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var26 string
|
||||
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(hxGet)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 83, Col: 16}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var27 string
|
||||
templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwap)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 84, Col: 18}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var28 string
|
||||
templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(hxTarget)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 85, Col: 22}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var29 string
|
||||
templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(hxTrigger)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 86, Col: 24}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::before-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var30 templ.ComponentScript = hxBeforeRequest
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var30.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::after-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var31 templ.ComponentScript = hxAfterRequest
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var31.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = listItem.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</select>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func CustomDropdownForm(
|
||||
inp models.CustomDropdownV2Prm) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var32 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var32 == nil {
|
||||
templ_7745c5c3_Var32 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"form-group\"><label class=\"text-black\" style=\"font-family: Poppins; font-weight: 600;\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var33 string
|
||||
templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Label)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 97, Col: 87}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</label> <select")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if inp.ErrorMsg == "" {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" class=\"form-control form-control-lg bg-field btn-lg rounded-lg selectpicker\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" class=\"form-control form-control-lg bg-field btn-lg rounded-lg selectpicker is-invalid\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" data-live-search=\"true\" data-size=\"5\" title=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var34 string
|
||||
templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Placeholder)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 106, Col: 26}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" data-style=\"btn-field btn-lg rounded-lg\" data-live-search-placeholder=\"cari ...\" name=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var35 string
|
||||
templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 109, Col: 18}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var36 string
|
||||
templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(inp.ID)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 110, Col: 14}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = inp.ListItem.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</select><div class=\"invalid-feedback text-danger mt-3 ml-2\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var37 string
|
||||
templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(inp.ErrorMsg)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 115, Col: 17}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
22
component/customradiobutton/customradiobuttoninline.templ
Normal file
22
component/customradiobutton/customradiobuttoninline.templ
Normal file
@@ -0,0 +1,22 @@
|
||||
package customradiobuttoninline
|
||||
|
||||
import "cpone/models"
|
||||
|
||||
templ MainCustomRadioButtonInput(inp models.CustomRadioButtonv1Prm) {
|
||||
<div class="mt-5">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600">{ inp.Label }</label>
|
||||
<div class="form-control">
|
||||
<div class="form-group">
|
||||
<div style="display: flex; gap: 20px">
|
||||
<label style="display: flex; align-items: center; gap: 5px">
|
||||
<input type="radio" name="nationality" value={ inp.Value }/>
|
||||
<p style="margin: 0">{ inp.Text }</p>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="invalid-feedback text-danger mt-3 ml-2 mt-5">
|
||||
{ inp.ErrorMsg }
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
89
component/customradiobutton/customradiobuttoninline_templ.go
Normal file
89
component/customradiobutton/customradiobuttoninline_templ.go
Normal file
@@ -0,0 +1,89 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.663
|
||||
package customradiobuttoninline
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import "context"
|
||||
import "io"
|
||||
import "bytes"
|
||||
|
||||
import "cpone/models"
|
||||
|
||||
func MainCustomRadioButtonInput(inp models.CustomRadioButtonv1Prm) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"mt-5\"><label for=\"input1\" style=\"font-family: Poppins; font-weight: 600\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Label)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customradiobutton\customradiobuttoninline.templ`, Line: 7, Col: 80}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</label><div class=\"form-control\"><div class=\"form-group\"><div style=\"display: flex; gap: 20px\"><label style=\"display: flex; align-items: center; gap: 5px\"><input type=\"radio\" name=\"nationality\" value=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Value)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customradiobutton\customradiobuttoninline.templ`, Line: 12, Col: 62}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><p style=\"margin: 0\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Text)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customradiobutton\customradiobuttoninline.templ`, Line: 13, Col: 37}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</p></label></div></div></div><div class=\"invalid-feedback text-danger mt-3 ml-2 mt-5\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(inp.ErrorMsg)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customradiobutton\customradiobuttoninline.templ`, Line: 19, Col: 17}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
@@ -19,9 +19,9 @@ templ CustomTextFieldv2(inp models.CustomTextFieldv2Prm) {
|
||||
placeholder={ inp.Placeholder }
|
||||
value={ inp.Value }
|
||||
if inp.ErrorMsg =="" {
|
||||
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
|
||||
class="form-control bg-field border-0 form-control-lg bg-field rounded-lg"
|
||||
} else {
|
||||
class="form-control bg-field border-1 h-auto py-6 px-6 rounded-lg is-invalid"
|
||||
class="form-control bg-field border-1 form-control-lg bg-field rounded-lg is-invalid"
|
||||
}
|
||||
/>
|
||||
<div class="invalid-feedback text-danger mt-3 ml-2">
|
||||
|
||||
@@ -123,12 +123,12 @@ func CustomTextFieldv2(inp models.CustomTextFieldv2Prm) templ.Component {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if inp.ErrorMsg == "" {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" class=\"form-control bg-field border-0 h-auto py-6 px-6 rounded-lg\"")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" class=\"form-control bg-field border-0 form-control-lg bg-field rounded-lg\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" class=\"form-control bg-field border-1 h-auto py-6 px-6 rounded-lg is-invalid\"")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" class=\"form-control bg-field border-1 form-control-lg bg-field rounded-lg is-invalid\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
954
handlers/dev/md.bahan.handlers.go
Normal file
954
handlers/dev/md.bahan.handlers.go
Normal file
@@ -0,0 +1,954 @@
|
||||
package dev_handlers
|
||||
|
||||
import (
|
||||
breadcrumadmin "cpone/component/breadcrumbadmin"
|
||||
navbarmenu "cpone/component/navbar"
|
||||
"cpone/component/pagination"
|
||||
sidebaruserprofile "cpone/component/sidebar_user_profile"
|
||||
customtoastv2 "cpone/component/toastbootstrap"
|
||||
"cpone/models"
|
||||
"cpone/services"
|
||||
"cpone/utils"
|
||||
dev_mdbahanview "cpone/views/dev/mdbahan"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/a-h/templ"
|
||||
"github.com/labstack/echo/v4"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type MdBahanServices interface {
|
||||
GetListMdBahan(
|
||||
search string,
|
||||
stationID string,
|
||||
currentPage int,
|
||||
rowPerPage int) ([]models.Bahan, int, error)
|
||||
GetMdBahanBreadCrumb(title string) (models.BreadCrumbV1, error)
|
||||
GetListSampleStation(isFilter bool) ([]models.TmpSampleStation, error)
|
||||
AddMdBahan(code string, name string, stationid string) (bool, error)
|
||||
EditMdBahan(id string, code string, name string, stationid string) (bool, error)
|
||||
GetMdBahanByID(id string) (models.Bahan, error)
|
||||
DeleteMdBahan(id string) (bool, error)
|
||||
}
|
||||
|
||||
func NewMdBahanHandler(us MdBahanServices) *MdBahanHandler {
|
||||
return &MdBahanHandler{
|
||||
MdBahanServices: us,
|
||||
}
|
||||
}
|
||||
|
||||
type MdBahanHandler struct {
|
||||
MdBahanServices MdBahanServices
|
||||
}
|
||||
|
||||
func (lh *MdBahanHandler) HandleShowMdBahanScreen(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
|
||||
dataMenu, err := services.GetMenu()
|
||||
paginationID := utils.GenerateRandomID("paginationID")
|
||||
modalAddID := utils.GenerateRandomID("modalAdd")
|
||||
modalAddBodyID := utils.GenerateRandomID("modalAddbody")
|
||||
modalEditID := utils.GenerateRandomID("modalEdit")
|
||||
modalEditBodyID := utils.GenerateRandomID("modalEditbody")
|
||||
modalDeleteID := utils.GenerateRandomID("modalDelete")
|
||||
modalDeleteBodyID := utils.GenerateRandomID("modalDeletebody")
|
||||
tableBahanID := utils.GenerateRandomID("BahanID")
|
||||
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERROR BREADCRUMB DEV",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
//get user login
|
||||
dataUser, err := services.GetUserLogin()
|
||||
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERROR BREADCRUMB DEV",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return err
|
||||
}
|
||||
dataBreadCrumb, err := lh.MdBahanServices.GetMdBahanBreadCrumb("Bahan")
|
||||
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERROR BREADCRUMB DEV",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
//Breadcrumb component
|
||||
breadcrumbComponent := breadcrumadmin.MainBreadcrumbAdminV1(dataBreadCrumb)
|
||||
// navbar menu
|
||||
navbarmenuComponent := navbarmenu.NavbarMenu(dataMenu)
|
||||
|
||||
// navbar user
|
||||
navbaruserComponent := navbarmenu.Navbar(dataUser)
|
||||
|
||||
// sidebar
|
||||
sidebaruserprofileComponent := sidebaruserprofile.Navbaruserprofile(dataUser)
|
||||
bahanList, totalPage, err := lh.MdBahanServices.GetListMdBahan("", "0", 1, 5)
|
||||
defer logger.Sync()
|
||||
logger.Info("GET DATA BAHAN",
|
||||
zap.Any("data", bahanList),
|
||||
zap.Any("err", err),
|
||||
zap.Any("totalPage", totalPage),
|
||||
)
|
||||
stationListFilter, err := lh.MdBahanServices.GetListSampleStation(true)
|
||||
defer logger.Sync()
|
||||
logger.Info("GET STATION LIST Filter",
|
||||
zap.Any("err", err),
|
||||
)
|
||||
stationList, err := lh.MdBahanServices.GetListSampleStation(false)
|
||||
defer logger.Sync()
|
||||
logger.Info("GET STATION LIST ",
|
||||
zap.Any("err", err),
|
||||
)
|
||||
|
||||
//Bahan Table
|
||||
// #dialogDeleteBodyID, #dialogDeleteID
|
||||
mdBahanTable := dev_mdbahanview.TableBahan(
|
||||
bahanList,
|
||||
tableBahanID,
|
||||
"/dev/md/bahan/openedit",
|
||||
"#"+modalEditBodyID,
|
||||
"outerHTML",
|
||||
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
|
||||
"/dev/md/bahan/opendelete",
|
||||
"#"+modalDeleteBodyID,
|
||||
"outerHTML",
|
||||
"#dialogDeleteBodyID, #dialogDeleteID, #dialogEditBodyID, #dialogEditID")
|
||||
|
||||
//FIlter table
|
||||
mdBahanFilter := dev_mdbahanview.MdBahanFilter(
|
||||
"/dev/md/bahan/filter",
|
||||
"input changed delay:500ms",
|
||||
"#filter-name, #filter-station, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID,
|
||||
"outerHTML",
|
||||
"#"+paginationID,
|
||||
stationListFilter,
|
||||
stationListFilter[0].T_SampleStationID,
|
||||
dev_mdbahanview.BeforeRequestContent(),
|
||||
dev_mdbahanview.AfterRequestContent(),
|
||||
)
|
||||
|
||||
//Pagination
|
||||
|
||||
mdbahanPagination := pagination.PaginationV3(
|
||||
totalPage, 1,
|
||||
"/dev/md/bahan/pagination",
|
||||
paginationID,
|
||||
"#filter-name, #filter-station, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID,
|
||||
"#"+paginationID,
|
||||
"outerHTML",
|
||||
"",
|
||||
"",
|
||||
dev_mdbahanview.BeforeRequestContent(),
|
||||
dev_mdbahanview.AfterRequestContent(),
|
||||
)
|
||||
//Form Add
|
||||
modalAddBody := dev_mdbahanview.BodyFormBahan(
|
||||
"",
|
||||
models.CustomTextFieldv2Prm{Label: "Kode Bahan",
|
||||
Name: "kodebahan",
|
||||
Placeholder: "Kode Bahan",
|
||||
Type: "text"},
|
||||
models.CustomTextFieldv2Prm{Label: "Nama Bahan",
|
||||
Name: "namabahan",
|
||||
Placeholder: "Nama Bahan",
|
||||
Type: "text"},
|
||||
models.CustomDropdownV2Prm{
|
||||
Name: "stationid",
|
||||
Label: "Sample Station",
|
||||
ListItem: dev_mdbahanview.ListItemStation(stationList, 0),
|
||||
},
|
||||
modalAddBodyID,
|
||||
dev_mdbahanview.JsShowModal(""),
|
||||
)
|
||||
modalAddAction := dev_mdbahanview.ActionFormBahan("/dev/md/bahan/closeaddform", "#"+modalAddBodyID, "outerHTML", "#"+modalAddID)
|
||||
modalAddBtnCls := dev_mdbahanview.BtnCloseFormBahan("/dev/md/bahan/closeaddform", "#"+modalAddBodyID, "outerHTML", "#"+modalAddID)
|
||||
modalAddBahan := dev_mdbahanview.BahanForm(models.BahanFormComponent{
|
||||
IDComponent: "",
|
||||
Link: "/dev/md/bahan/add",
|
||||
HxTarget: "#" + modalAddBodyID,
|
||||
HxSwap: "outerHTML",
|
||||
HxInclude: "#filter-name, #filter-station, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage" + paginationID,
|
||||
ModalID: modalAddID,
|
||||
ModalTitle: "New-Bahan",
|
||||
DialogBody: modalAddBody,
|
||||
DialogAction: modalAddAction,
|
||||
ButtonCLose: modalAddBtnCls,
|
||||
})
|
||||
|
||||
//Form Edit
|
||||
modalEditBody := dev_mdbahanview.BodyFormBahan(
|
||||
"",
|
||||
models.CustomTextFieldv2Prm{Label: "Kode Bahan",
|
||||
Name: "kodebahan",
|
||||
Placeholder: "Kode Bahan",
|
||||
Type: "text"},
|
||||
models.CustomTextFieldv2Prm{Label: "Nama Bahan",
|
||||
Name: "namabahan",
|
||||
Placeholder: "Nama Bahan",
|
||||
Type: "text"},
|
||||
models.CustomDropdownV2Prm{
|
||||
Name: "stationid",
|
||||
Label: "Sample Station",
|
||||
ListItem: dev_mdbahanview.ListItemStation(stationList, 0),
|
||||
},
|
||||
modalEditBodyID,
|
||||
dev_mdbahanview.JsShowModal(""),
|
||||
)
|
||||
modalEditAction := dev_mdbahanview.ActionFormBahan("/dev/md/bahan/closeeditform", "#"+modalEditBodyID, "outerHTML", "#"+modalEditID)
|
||||
modalEditBtnCls := dev_mdbahanview.BtnCloseFormBahan("/dev/md/bahan/closeeditform", "#"+modalEditBodyID, "outerHTML", "#"+modalEditID)
|
||||
modalEditBahan := dev_mdbahanview.BahanForm(models.BahanFormComponent{
|
||||
IDComponent: "",
|
||||
Link: "/dev/md/bahan/edit",
|
||||
HxTarget: "#" + modalEditBodyID,
|
||||
HxSwap: "outerHTML",
|
||||
HxInclude: "#filter-name, #filter-station, #tableID, #paginationID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage" + paginationID,
|
||||
ModalID: modalEditID,
|
||||
ModalTitle: "Edit-Bahan",
|
||||
DialogBody: modalEditBody,
|
||||
DialogAction: modalEditAction,
|
||||
ButtonCLose: modalEditBtnCls,
|
||||
})
|
||||
|
||||
//Form Delete
|
||||
modalDeleteBody := dev_mdbahanview.DeleteConfirmationBody(
|
||||
"",
|
||||
modalDeleteBodyID,
|
||||
"Apakah anda yakin menghapus bahan berikut ?",
|
||||
[]string{"Kode", "Nama Bahan", "Sample Station"},
|
||||
[]string{"", "", ""}, dev_mdbahanview.JsShowModal(""))
|
||||
modalDeleteAction := dev_mdbahanview.ActionFormBahanDelete("/dev/md/bahan/closedeleteform", "#"+modalDeleteBodyID, "outerHTML", "#"+modalDeleteID)
|
||||
modalDeleteBtnCls := dev_mdbahanview.BtnCloseFormBahan("/dev/md/bahan/closedeleteform", "#"+modalDeleteBodyID, "outerHTML", "#"+modalDeleteID)
|
||||
modalDeleteBahan := dev_mdbahanview.BahanForm(models.BahanFormComponent{
|
||||
IDComponent: "",
|
||||
Link: "/dev/md/bahan/delete",
|
||||
HxTarget: "#" + modalDeleteBodyID,
|
||||
HxSwap: "outerHTML",
|
||||
HxInclude: "#filter-name, #filter-station, #tableID, #paginationID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage" + paginationID,
|
||||
ModalID: modalDeleteID,
|
||||
ModalTitle: "Delete-Bahan",
|
||||
DialogBody: modalDeleteBody,
|
||||
DialogAction: modalDeleteAction,
|
||||
ButtonCLose: modalDeleteBtnCls,
|
||||
})
|
||||
|
||||
mdBahanScreen := dev_mdbahanview.MdBahanScreen(
|
||||
tableBahanID,
|
||||
paginationID,
|
||||
modalAddID,
|
||||
modalAddBodyID,
|
||||
modalEditID,
|
||||
modalEditBodyID,
|
||||
modalDeleteID,
|
||||
modalDeleteBodyID,
|
||||
breadcrumbComponent,
|
||||
mdBahanTable,
|
||||
mdBahanFilter,
|
||||
mdbahanPagination,
|
||||
modalAddBahan,
|
||||
modalEditBahan,
|
||||
modalDeleteBahan)
|
||||
cssMdBahan := dev_mdbahanview.CssMdUserGroup()
|
||||
jsMdBahan := dev_mdbahanview.JsMdBahan()
|
||||
|
||||
view := dev_mdbahanview.ShowMdBahanScreen(
|
||||
"Md Bahan",
|
||||
mdBahanScreen,
|
||||
cssMdBahan,
|
||||
jsMdBahan,
|
||||
navbarmenuComponent,
|
||||
navbaruserComponent,
|
||||
sidebaruserprofileComponent)
|
||||
return utils.View(c, view)
|
||||
}
|
||||
|
||||
func (lh *MdBahanHandler) HandleFilterMdBahan(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
var retval []templ.Component
|
||||
filtername := c.QueryParam("filtername")
|
||||
filterstation := c.QueryParam("filterstation")
|
||||
dialogEditBodyID := c.QueryParam("dialogEditBodyID")
|
||||
dialogDeleteBodyID := c.QueryParam("dialogDeleteBodyID")
|
||||
tableID := c.QueryParam("tableID")
|
||||
paginationID := c.QueryParam("paginationID")
|
||||
bahanList, totalPage, err := lh.MdBahanServices.GetListMdBahan(filtername, filterstation, 1, 5)
|
||||
defer logger.Sync()
|
||||
logger.Info("GET DATA BAHAN",
|
||||
zap.Any("data", bahanList),
|
||||
zap.Any("err", err),
|
||||
zap.Any("totalPage", totalPage),
|
||||
)
|
||||
//Bahan Table
|
||||
|
||||
mdBahanTable := dev_mdbahanview.TableBahan(
|
||||
bahanList,
|
||||
tableID,
|
||||
"/dev/md/bahan/openedit",
|
||||
"#"+dialogEditBodyID,
|
||||
"outerHTML",
|
||||
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
|
||||
"/dev/md/bahan/opendelete",
|
||||
"#"+dialogDeleteBodyID,
|
||||
"outerHTML",
|
||||
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID")
|
||||
//Pagination
|
||||
|
||||
mdbahanPagination := pagination.PaginationV3(
|
||||
totalPage, 1,
|
||||
"/dev/md/bahan/pagination",
|
||||
paginationID,
|
||||
"#filter-name, #filter-station, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID,
|
||||
"#"+paginationID,
|
||||
"outerHTML",
|
||||
"",
|
||||
"",
|
||||
dev_mdbahanview.BeforeRequestContent(),
|
||||
dev_mdbahanview.AfterRequestContent(),
|
||||
)
|
||||
retval = append(retval, mdBahanTable)
|
||||
retval = append(retval, mdbahanPagination)
|
||||
return utils.ViewMulti(c, retval)
|
||||
}
|
||||
func (lh *MdBahanHandler) HandlePaginationMdBahan(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
var retval []templ.Component
|
||||
pageparam := c.QueryParam("page")
|
||||
|
||||
filtername := c.QueryParam("filtername")
|
||||
filterstation := c.QueryParam("filterstation")
|
||||
tableID := c.QueryParam("tableID")
|
||||
dialogEditBodyID := c.QueryParam("dialogEditBodyID")
|
||||
dialogDeleteBodyID := c.QueryParam("dialogDeleteBodyID")
|
||||
paginationID := c.QueryParam("paginationID")
|
||||
page, err := strconv.Atoi(pageparam)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERROR CONVERT PAGE PARAM",
|
||||
zap.Any("page", page),
|
||||
zap.Any("error ", err),
|
||||
)
|
||||
return err
|
||||
}
|
||||
bahanList, totalPage, err := lh.MdBahanServices.GetListMdBahan(filtername, filterstation, page, 5)
|
||||
defer logger.Sync()
|
||||
logger.Info("GET DATA BAHAN",
|
||||
zap.Any("data", bahanList),
|
||||
zap.Any("err", err),
|
||||
zap.Any("totalPage", totalPage),
|
||||
)
|
||||
//Bahan Table
|
||||
|
||||
mdBahanTable := dev_mdbahanview.TableBahan(
|
||||
bahanList,
|
||||
tableID,
|
||||
"/dev/md/bahan/openedit",
|
||||
"#"+dialogEditBodyID,
|
||||
"outerHTML",
|
||||
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
|
||||
"/dev/md/bahan/opendelete",
|
||||
"#"+dialogDeleteBodyID,
|
||||
"outerHTML",
|
||||
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID")
|
||||
//Pagination
|
||||
|
||||
mdbahanPagination := pagination.PaginationV3(
|
||||
totalPage, page,
|
||||
"/dev/md/bahan/pagination",
|
||||
paginationID,
|
||||
"#filter-name, #filter-station, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID,
|
||||
"#"+paginationID,
|
||||
"outerHTML",
|
||||
"",
|
||||
"",
|
||||
dev_mdbahanview.BeforeRequestContent(),
|
||||
dev_mdbahanview.AfterRequestContent(),
|
||||
)
|
||||
retval = append(retval, mdBahanTable)
|
||||
retval = append(retval, mdbahanPagination)
|
||||
return utils.ViewMulti(c, retval)
|
||||
}
|
||||
func (lh *MdBahanHandler) HandleCloseFormAddMdBahan(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
stationList, err := lh.MdBahanServices.GetListSampleStation(false)
|
||||
defer logger.Sync()
|
||||
logger.Info("GET DATA STATIOn",
|
||||
zap.Any("err", err),
|
||||
)
|
||||
dialogAddBodyID := c.FormValue("dialogAddBodyID")
|
||||
dialogAddID := c.FormValue("dialogAddID")
|
||||
|
||||
modalAddBody := dev_mdbahanview.BodyFormBahan(
|
||||
"",
|
||||
models.CustomTextFieldv2Prm{Label: "Kode Bahan",
|
||||
Name: "kodebahan",
|
||||
Placeholder: "Kode Bahan",
|
||||
Type: "text"},
|
||||
models.CustomTextFieldv2Prm{Label: "Nama Bahan",
|
||||
Name: "namabahan",
|
||||
Placeholder: "Nama Bahan",
|
||||
Type: "text"},
|
||||
models.CustomDropdownV2Prm{
|
||||
Name: "stationid",
|
||||
Label: "Sample Station",
|
||||
ListItem: dev_mdbahanview.ListItemStation(stationList, 0),
|
||||
},
|
||||
dialogAddBodyID,
|
||||
dev_mdbahanview.JsHideModal("#"+dialogAddID),
|
||||
)
|
||||
return utils.View(c, modalAddBody)
|
||||
}
|
||||
func (lh *MdBahanHandler) HandleAddMdBahan(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
|
||||
code := c.FormValue("kodebahan")
|
||||
name := c.FormValue("namabahan")
|
||||
stationIDPrm := c.FormValue("stationid")
|
||||
tableID := c.FormValue("tableID")
|
||||
paginationID := c.FormValue("paginationID")
|
||||
filtername := c.FormValue("filtername")
|
||||
filterstation := c.FormValue("filterstation")
|
||||
currPagePrm := c.FormValue("currpage" + paginationID)
|
||||
dialogAddBodyID := c.FormValue("dialogAddBodyID")
|
||||
// searchID := c.FormValue("searchID")
|
||||
dialogAddID := c.FormValue("dialogAddID")
|
||||
dialogEditBodyID := c.FormValue("dialogEditBodyID")
|
||||
dialogDeleteBodyID := c.FormValue("dialogDeleteBodyID")
|
||||
currPage, err := strconv.Atoi(currPagePrm)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
stationID, err := strconv.Atoi(stationIDPrm)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
formValidation := ""
|
||||
codeValidation := ""
|
||||
nameValidation := ""
|
||||
stationValidation := ""
|
||||
|
||||
if strings.TrimSpace(code) == "" {
|
||||
formValidation = "Code bahan tidak boleh kosong"
|
||||
codeValidation = "Code bahan tidak boleh kosong"
|
||||
nameValidation = ""
|
||||
stationValidation = ""
|
||||
}
|
||||
if strings.TrimSpace(name) == "" {
|
||||
formValidation = "Nama bahan tidak boleh kosong"
|
||||
codeValidation = ""
|
||||
stationValidation = ""
|
||||
nameValidation = "Nama bahan tidak boleh kosong"
|
||||
}
|
||||
if stationID == 0 {
|
||||
formValidation = "Pilih salah satu station"
|
||||
codeValidation = ""
|
||||
nameValidation = ""
|
||||
stationValidation = "Pilih salah satu station"
|
||||
}
|
||||
if strings.TrimSpace(code) == "" && strings.TrimSpace(name) == "" {
|
||||
formValidation = "Code,nama, dan station bahan tidak boleh kosong"
|
||||
codeValidation = "Code bahan tidak boleh kosong"
|
||||
stationValidation = "Pilih salah satu station"
|
||||
nameValidation = "Nama bahan tidak boleh kosong"
|
||||
|
||||
}
|
||||
stationList, err := lh.MdBahanServices.GetListSampleStation(false)
|
||||
defer logger.Sync()
|
||||
logger.Info("GET DATA STATIOn",
|
||||
zap.Any("err", err),
|
||||
)
|
||||
if formValidation != "" || codeValidation != "" || nameValidation != "" || stationValidation != "" {
|
||||
newForm := dev_mdbahanview.BodyFormBahan(
|
||||
"",
|
||||
models.CustomTextFieldv2Prm{Label: "Kode Bahan",
|
||||
Name: "kodebahan",
|
||||
Placeholder: "Kode Bahan",
|
||||
Value: code,
|
||||
ErrorMsg: codeValidation,
|
||||
Type: "text"},
|
||||
models.CustomTextFieldv2Prm{Label: "Nama Bahan",
|
||||
Name: "namabahan",
|
||||
Placeholder: "Nama Bahan",
|
||||
ErrorMsg: nameValidation,
|
||||
Value: name,
|
||||
Type: "text"},
|
||||
models.CustomDropdownV2Prm{
|
||||
Name: "stationid",
|
||||
Label: "Sample Station",
|
||||
ErrorMsg: stationValidation,
|
||||
ListItem: dev_mdbahanview.ListItemStation(stationList, stationID),
|
||||
},
|
||||
dialogAddBodyID,
|
||||
dev_mdbahanview.JsShowModal(""),
|
||||
)
|
||||
return utils.ViewMulti(c, []templ.Component{customtoastv2.CustomToastV2Show("Warning", formValidation, "warning"), newForm})
|
||||
}
|
||||
_, err = lh.MdBahanServices.AddMdBahan(code, name, stationIDPrm)
|
||||
if err != nil {
|
||||
newForm := dev_mdbahanview.BodyFormBahan(
|
||||
"",
|
||||
models.CustomTextFieldv2Prm{Label: "Kode Bahan",
|
||||
Name: "kodebahan",
|
||||
Placeholder: "Kode Bahan",
|
||||
Value: code,
|
||||
Type: "text"},
|
||||
models.CustomTextFieldv2Prm{Label: "Nama Bahan",
|
||||
Name: "namabahan",
|
||||
Placeholder: "Nama Bahan",
|
||||
Value: name,
|
||||
Type: "text"},
|
||||
models.CustomDropdownV2Prm{
|
||||
Name: "stationid",
|
||||
Label: "Sample Station",
|
||||
ListItem: dev_mdbahanview.ListItemStation(stationList, int(stationID)),
|
||||
},
|
||||
dialogAddBodyID,
|
||||
dev_mdbahanview.JsShowModal(""),
|
||||
)
|
||||
return utils.ViewMulti(c, []templ.Component{customtoastv2.CustomToastV2Show("Gagal", err.Error(), "danger"), newForm})
|
||||
}
|
||||
|
||||
bahanList, totalPage, err := lh.MdBahanServices.GetListMdBahan(filtername, filterstation, currPage, 5)
|
||||
defer logger.Sync()
|
||||
logger.Info("GET DATA BAHAN",
|
||||
zap.Any("data", bahanList),
|
||||
zap.Any("err", err),
|
||||
zap.Any("totalPage", totalPage),
|
||||
)
|
||||
//Bahan Table
|
||||
mdBahanTable := dev_mdbahanview.TableBahan(
|
||||
bahanList,
|
||||
tableID,
|
||||
"/dev/md/bahan/openedit",
|
||||
"#"+dialogEditBodyID,
|
||||
"outerHTML",
|
||||
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
|
||||
"/dev/md/bahan/opendelete",
|
||||
"#"+dialogDeleteBodyID,
|
||||
"outerHTML",
|
||||
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID")
|
||||
|
||||
//Pagination
|
||||
|
||||
mdbahanPagination := pagination.PaginationV3(
|
||||
totalPage, currPage,
|
||||
"/dev/md/bahan/pagination",
|
||||
paginationID,
|
||||
"#filter-name, #filter-station, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID,
|
||||
"#"+paginationID,
|
||||
"outerHTML",
|
||||
"",
|
||||
"true",
|
||||
dev_mdbahanview.BeforeRequestContent(),
|
||||
dev_mdbahanview.AfterRequestContent(),
|
||||
)
|
||||
//Form Add
|
||||
modalAddBody := dev_mdbahanview.BodyFormBahan(
|
||||
"",
|
||||
models.CustomTextFieldv2Prm{Label: "Kode Bahan",
|
||||
Name: "kodebahan",
|
||||
Placeholder: "Kode Bahan",
|
||||
Type: "text"},
|
||||
models.CustomTextFieldv2Prm{Label: "Nama Bahan",
|
||||
Name: "namabahan",
|
||||
Placeholder: "Nama Bahan",
|
||||
Type: "text"},
|
||||
models.CustomDropdownV2Prm{
|
||||
Name: "stationid",
|
||||
Label: "Sample Station",
|
||||
ListItem: dev_mdbahanview.ListItemStation(stationList, 0),
|
||||
},
|
||||
dialogAddBodyID,
|
||||
dev_mdbahanview.JsHideModal("#"+dialogAddID),
|
||||
)
|
||||
|
||||
toastSuccess := customtoastv2.CustomToastV2Show("Success", "Success add bahan ", "success")
|
||||
retval := []templ.Component{toastSuccess, mdBahanTable, mdbahanPagination, modalAddBody}
|
||||
// time.Sleep(20 * time.Second)
|
||||
return utils.ViewMulti(c, retval)
|
||||
}
|
||||
func (lh *MdBahanHandler) HandleOpenEditMdBahan(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
|
||||
id := c.QueryParam("id")
|
||||
dialogEditID := c.QueryParam("dialogEditID")
|
||||
dialogEditBodyID := c.QueryParam("dialogEditBodyID")
|
||||
stationList, err := lh.MdBahanServices.GetListSampleStation(false)
|
||||
defer logger.Sync()
|
||||
logger.Info("GET DATA STATION",
|
||||
zap.Any("err", err),
|
||||
)
|
||||
dataBahan, err := lh.MdBahanServices.GetMdBahanByID(id)
|
||||
if err != nil {
|
||||
newForm := dev_mdbahanview.BodyFormBahan(
|
||||
id,
|
||||
models.CustomTextFieldv2Prm{Label: "Kode Bahan",
|
||||
Name: "kodebahan",
|
||||
Placeholder: "Kode Bahan",
|
||||
Type: "text"},
|
||||
models.CustomTextFieldv2Prm{Label: "Nama Bahan",
|
||||
Name: "namabahan",
|
||||
Placeholder: "Nama Bahan",
|
||||
Type: "text"},
|
||||
models.CustomDropdownV2Prm{
|
||||
Name: "stationid",
|
||||
Label: "Sample Station",
|
||||
ListItem: dev_mdbahanview.ListItemStation(stationList, dataBahan.T_BahanT_SampleStationID),
|
||||
},
|
||||
dialogEditBodyID,
|
||||
dev_mdbahanview.JsHideModal(""),
|
||||
)
|
||||
return utils.ViewMulti(c, []templ.Component{customtoastv2.CustomToastV2Show("Error", "Get data bahan error", "danger"), newForm})
|
||||
}
|
||||
newForm := dev_mdbahanview.BodyFormBahan(
|
||||
id,
|
||||
models.CustomTextFieldv2Prm{Label: "Kode Bahan",
|
||||
Name: "kodebahan",
|
||||
Placeholder: "Kode Bahan",
|
||||
Value: dataBahan.T_BahanCode,
|
||||
Type: "text"},
|
||||
models.CustomTextFieldv2Prm{Label: "Nama Bahan",
|
||||
Name: "namabahan",
|
||||
Placeholder: "Nama Bahan",
|
||||
Value: dataBahan.T_BahanName,
|
||||
Type: "text"},
|
||||
models.CustomDropdownV2Prm{
|
||||
Name: "stationid",
|
||||
Label: "Sample Station",
|
||||
ListItem: dev_mdbahanview.ListItemStation(stationList, dataBahan.T_BahanT_SampleStationID),
|
||||
},
|
||||
dialogEditBodyID,
|
||||
dev_mdbahanview.JsShowModal("#"+dialogEditID),
|
||||
)
|
||||
return utils.View(c, newForm)
|
||||
}
|
||||
func (lh *MdBahanHandler) HandleCloseFormEditMdBahan(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
stationList, err := lh.MdBahanServices.GetListSampleStation(false)
|
||||
dialogEditID := c.FormValue("dialogEditID")
|
||||
dialogEditBodyID := c.FormValue("dialogEditBodyID")
|
||||
defer logger.Sync()
|
||||
logger.Info("GET DATA STATION",
|
||||
zap.Any("err", err),
|
||||
zap.Any("dialogeditbodyid", dialogEditBodyID),
|
||||
)
|
||||
|
||||
modalAddBody := dev_mdbahanview.BodyFormBahan(
|
||||
"",
|
||||
models.CustomTextFieldv2Prm{Label: "Kode Bahan",
|
||||
Name: "kodebahan",
|
||||
Placeholder: "Kode Bahan",
|
||||
Type: "text"},
|
||||
models.CustomTextFieldv2Prm{Label: "Nama Bahan",
|
||||
Name: "namabahan",
|
||||
Placeholder: "Nama Bahan",
|
||||
Type: "text"},
|
||||
models.CustomDropdownV2Prm{
|
||||
Name: "stationid",
|
||||
Label: "Sample Station",
|
||||
ListItem: dev_mdbahanview.ListItemStation(stationList, 0),
|
||||
},
|
||||
dialogEditBodyID,
|
||||
dev_mdbahanview.JsHideModal("#"+dialogEditID),
|
||||
)
|
||||
return utils.View(c, modalAddBody)
|
||||
}
|
||||
func (lh *MdBahanHandler) HandleEditMdBahan(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
|
||||
code := c.FormValue("kodebahan")
|
||||
name := c.FormValue("namabahan")
|
||||
id := c.FormValue("bahanid")
|
||||
stationIDPrm := c.FormValue("stationid")
|
||||
tableID := c.FormValue("tableID")
|
||||
paginationID := c.FormValue("paginationID")
|
||||
filtername := c.FormValue("filtername")
|
||||
filterstation := c.FormValue("filterstation")
|
||||
currPagePrm := c.FormValue("currpage" + paginationID)
|
||||
// dialogAddBodyID := c.FormValue("dialogAddBodyID")
|
||||
// searchID := c.FormValue("searchID")
|
||||
dialogEditID := c.FormValue("dialogEditID")
|
||||
dialogEditBodyID := c.FormValue("dialogEditBodyID")
|
||||
dialogDeleteBodyID := c.FormValue("dialogDeleteBodyID")
|
||||
currPage, err := strconv.Atoi(currPagePrm)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
stationID, err := strconv.Atoi(stationIDPrm)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
formValidation := ""
|
||||
codeValidation := ""
|
||||
nameValidation := ""
|
||||
stationValidation := ""
|
||||
|
||||
if strings.TrimSpace(code) == "" {
|
||||
formValidation = "Code bahan tidak boleh kosong"
|
||||
codeValidation = "Code bahan tidak boleh kosong"
|
||||
nameValidation = ""
|
||||
stationValidation = ""
|
||||
}
|
||||
if strings.TrimSpace(name) == "" {
|
||||
formValidation = "Nama bahan tidak boleh kosong"
|
||||
codeValidation = ""
|
||||
stationValidation = ""
|
||||
nameValidation = "Nama bahan tidak boleh kosong"
|
||||
}
|
||||
if stationID == 0 {
|
||||
formValidation = "Pilih salah satu station"
|
||||
codeValidation = ""
|
||||
nameValidation = ""
|
||||
stationValidation = "Pilih salah satu station"
|
||||
}
|
||||
if strings.TrimSpace(code) == "" && strings.TrimSpace(name) == "" {
|
||||
formValidation = "Code,nama, dan station bahan tidak boleh kosong"
|
||||
codeValidation = "Code bahan tidak boleh kosong"
|
||||
stationValidation = "Pilih salah satu station"
|
||||
nameValidation = "Nama bahan tidak boleh kosong"
|
||||
|
||||
}
|
||||
stationList, err := lh.MdBahanServices.GetListSampleStation(false)
|
||||
defer logger.Sync()
|
||||
logger.Info("GET DATA STATIOn",
|
||||
zap.Any("err", err),
|
||||
)
|
||||
if formValidation != "" || codeValidation != "" || nameValidation != "" || stationValidation != "" {
|
||||
newForm := dev_mdbahanview.BodyFormBahan(
|
||||
id,
|
||||
models.CustomTextFieldv2Prm{Label: "Kode Bahan",
|
||||
Name: "kodebahan",
|
||||
Placeholder: "Kode Bahan",
|
||||
Value: code,
|
||||
ErrorMsg: codeValidation,
|
||||
Type: "text"},
|
||||
models.CustomTextFieldv2Prm{Label: "Nama Bahan",
|
||||
Name: "namabahan",
|
||||
Placeholder: "Nama Bahan",
|
||||
ErrorMsg: nameValidation,
|
||||
Value: name,
|
||||
Type: "text"},
|
||||
models.CustomDropdownV2Prm{
|
||||
Name: "stationid",
|
||||
Label: "Sample Station",
|
||||
ErrorMsg: stationValidation,
|
||||
ListItem: dev_mdbahanview.ListItemStation(stationList, stationID),
|
||||
},
|
||||
dialogEditBodyID,
|
||||
dev_mdbahanview.JsShowModal(""),
|
||||
)
|
||||
return utils.ViewMulti(c, []templ.Component{customtoastv2.CustomToastV2Show("Warning", formValidation, "warning"), newForm})
|
||||
}
|
||||
_, err = lh.MdBahanServices.EditMdBahan(id, code, name, stationIDPrm)
|
||||
if err != nil {
|
||||
newForm := dev_mdbahanview.BodyFormBahan(
|
||||
id,
|
||||
models.CustomTextFieldv2Prm{Label: "Kode Bahan",
|
||||
Name: "kodebahan",
|
||||
Placeholder: "Kode Bahan",
|
||||
Value: code,
|
||||
Type: "text"},
|
||||
models.CustomTextFieldv2Prm{Label: "Nama Bahan",
|
||||
Name: "namabahan",
|
||||
Placeholder: "Nama Bahan",
|
||||
Value: name,
|
||||
Type: "text"},
|
||||
models.CustomDropdownV2Prm{
|
||||
Name: "stationid",
|
||||
Label: "Sample Station",
|
||||
ListItem: dev_mdbahanview.ListItemStation(stationList, int(stationID)),
|
||||
},
|
||||
dialogEditBodyID,
|
||||
dev_mdbahanview.JsShowModal(""),
|
||||
)
|
||||
return utils.ViewMulti(c, []templ.Component{customtoastv2.CustomToastV2Show("Gagal", err.Error(), "danger"), newForm})
|
||||
}
|
||||
|
||||
bahanList, totalPage, err := lh.MdBahanServices.GetListMdBahan(filtername, filterstation, currPage, 5)
|
||||
defer logger.Sync()
|
||||
logger.Info("GET DATA BAHAN",
|
||||
zap.Any("data", bahanList),
|
||||
zap.Any("err", err),
|
||||
zap.Any("totalPage", totalPage),
|
||||
)
|
||||
//Bahan Table
|
||||
mdBahanTable := dev_mdbahanview.TableBahan(
|
||||
bahanList,
|
||||
tableID,
|
||||
"/dev/md/bahan/openedit",
|
||||
"#"+dialogEditBodyID,
|
||||
"outerHTML",
|
||||
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
|
||||
"/dev/md/bahan/opendelete",
|
||||
"#"+dialogDeleteBodyID,
|
||||
"outerHTML",
|
||||
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID")
|
||||
|
||||
//Pagination
|
||||
|
||||
mdbahanPagination := pagination.PaginationV3(
|
||||
totalPage, currPage,
|
||||
"/dev/md/bahan/pagination",
|
||||
paginationID,
|
||||
"#filter-name, #filter-station, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID,
|
||||
"#"+paginationID,
|
||||
"outerHTML",
|
||||
"",
|
||||
"true",
|
||||
dev_mdbahanview.BeforeRequestContent(),
|
||||
dev_mdbahanview.AfterRequestContent(),
|
||||
)
|
||||
//Form Add
|
||||
modalAddBody := dev_mdbahanview.BodyFormBahan(
|
||||
"",
|
||||
models.CustomTextFieldv2Prm{Label: "Kode Bahan",
|
||||
Name: "kodebahan",
|
||||
Placeholder: "Kode Bahan",
|
||||
Type: "text"},
|
||||
models.CustomTextFieldv2Prm{Label: "Nama Bahan",
|
||||
Name: "namabahan",
|
||||
Placeholder: "Nama Bahan",
|
||||
Type: "text"},
|
||||
models.CustomDropdownV2Prm{
|
||||
Name: "stationid",
|
||||
Label: "Sample Station",
|
||||
ListItem: dev_mdbahanview.ListItemStation(stationList, 0),
|
||||
},
|
||||
dialogEditBodyID,
|
||||
dev_mdbahanview.JsHideModal("#"+dialogEditID),
|
||||
)
|
||||
|
||||
toastSuccess := customtoastv2.CustomToastV2Show("Success", "Success edit bahan ", "success")
|
||||
retval := []templ.Component{toastSuccess, mdBahanTable, mdbahanPagination, modalAddBody}
|
||||
// time.Sleep(20 * time.Second)
|
||||
return utils.ViewMulti(c, retval)
|
||||
}
|
||||
func (lh *MdBahanHandler) HandleOpenDeleteMdBahan(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
|
||||
id := c.QueryParam("id")
|
||||
dialogDeleteID := c.QueryParam("dialogDeleteID")
|
||||
dialogDeleteBodyID := c.QueryParam("dialogDeleteBodyID")
|
||||
|
||||
dataBahan, err := lh.MdBahanServices.GetMdBahanByID(id)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("GET DATA BAHAN",
|
||||
zap.Any("err", err),
|
||||
)
|
||||
newForm := dev_mdbahanview.DeleteConfirmationBody(
|
||||
"",
|
||||
dialogDeleteBodyID,
|
||||
"Apakah anda yakin menghapus bahan berikut ?",
|
||||
[]string{"Kode", "Nama Bahan", "Sample Station"},
|
||||
[]string{"", "", ""}, dev_mdbahanview.JsShowModal(""))
|
||||
return utils.ViewMulti(c, []templ.Component{customtoastv2.CustomToastV2Show("Error", "Get data bahan error", "danger"), newForm})
|
||||
}
|
||||
newForm := dev_mdbahanview.DeleteConfirmationBody(
|
||||
strconv.Itoa(dataBahan.T_BahanID),
|
||||
dialogDeleteBodyID,
|
||||
"Apakah anda yakin menghapus bahan berikut ?",
|
||||
[]string{"Kode", "Nama Bahan", "Sample Station"},
|
||||
[]string{dataBahan.T_BahanCode, dataBahan.T_BahanName, dataBahan.T_SampleStationName}, dev_mdbahanview.JsShowModal("#"+dialogDeleteID))
|
||||
return utils.View(c, newForm)
|
||||
}
|
||||
func (lh *MdBahanHandler) HandleCloseDeleteMdBahan(c echo.Context) error {
|
||||
|
||||
dialogDeleteID := c.FormValue("dialogDeleteID")
|
||||
dialogDeleteBodyID := c.FormValue("dialogDeleteBodyID")
|
||||
newForm := dev_mdbahanview.DeleteConfirmationBody(
|
||||
"",
|
||||
dialogDeleteBodyID,
|
||||
"Apakah anda yakin menghapus bahan berikut ?",
|
||||
[]string{"Kode", "Nama Bahan", "Sample Station"},
|
||||
[]string{"", "", ""}, dev_mdbahanview.JsHideModal("#"+dialogDeleteID))
|
||||
return utils.View(c, newForm)
|
||||
}
|
||||
|
||||
func (lh *MdBahanHandler) HandleDeleteMdBahan(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
|
||||
id := c.FormValue("bahanid")
|
||||
|
||||
tableID := c.FormValue("tableID")
|
||||
paginationID := c.FormValue("paginationID")
|
||||
filtername := c.FormValue("filtername")
|
||||
filterstation := c.FormValue("filterstation")
|
||||
currPagePrm := c.FormValue("currpage" + paginationID)
|
||||
// dialogAddBodyID := c.FormValue("dialogAddBodyID")
|
||||
// searchID := c.FormValue("searchID")
|
||||
dialogDeleteID := c.FormValue("dialogDeleteID")
|
||||
dialogEditBodyID := c.FormValue("dialogEditBodyID")
|
||||
dialogDeleteBodyID := c.FormValue("dialogDeleteBodyID")
|
||||
currPage, err := strconv.Atoi(currPagePrm)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = lh.MdBahanServices.DeleteMdBahan(id)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERR DELETE MD BAHAN",
|
||||
zap.Any("err", err),
|
||||
)
|
||||
newForm := dev_mdbahanview.DeleteConfirmationBody(
|
||||
"",
|
||||
dialogDeleteBodyID,
|
||||
"Apakah anda yakin menghapus bahan berikut ?",
|
||||
[]string{"Kode", "Nama Bahan", "Sample Station"},
|
||||
[]string{"", "", ""}, dev_mdbahanview.JsShowModal(""))
|
||||
return utils.ViewMulti(c, []templ.Component{customtoastv2.CustomToastV2Show("Error", "Get data bahan error", "danger"), newForm})
|
||||
}
|
||||
bahanList, totalPage, err := lh.MdBahanServices.GetListMdBahan(filtername, filterstation, currPage, 5)
|
||||
defer logger.Sync()
|
||||
logger.Info("GET DATA BAHAN",
|
||||
zap.Any("data", bahanList),
|
||||
zap.Any("err", err),
|
||||
zap.Any("totalPage", totalPage),
|
||||
)
|
||||
//Bahan Table
|
||||
mdBahanTable := dev_mdbahanview.TableBahan(
|
||||
bahanList,
|
||||
tableID,
|
||||
"/dev/md/bahan/openedit",
|
||||
"#"+dialogEditBodyID,
|
||||
"outerHTML",
|
||||
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
|
||||
"/dev/md/bahan/opendelete",
|
||||
"#"+dialogDeleteBodyID,
|
||||
"outerHTML",
|
||||
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID")
|
||||
|
||||
//Pagination
|
||||
|
||||
mdbahanPagination := pagination.PaginationV3(
|
||||
totalPage, currPage,
|
||||
"/dev/md/bahan/pagination",
|
||||
paginationID,
|
||||
"#filter-name, #filter-station, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID,
|
||||
"#"+paginationID,
|
||||
"outerHTML",
|
||||
"",
|
||||
"true",
|
||||
dev_mdbahanview.BeforeRequestContent(),
|
||||
dev_mdbahanview.AfterRequestContent(),
|
||||
)
|
||||
|
||||
toastSuccess := customtoastv2.CustomToastV2Show("Success", "Berhasil hapus bahan", "success")
|
||||
newForm := dev_mdbahanview.DeleteConfirmationBody(
|
||||
"",
|
||||
dialogDeleteBodyID,
|
||||
"Apakah anda yakin menghapus bahan berikut ?",
|
||||
[]string{"Kode", "Nama Bahan", "Sample Station"},
|
||||
[]string{"", "", ""}, dev_mdbahanview.JsHideModal("#"+dialogDeleteID))
|
||||
return utils.ViewMulti(c, []templ.Component{toastSuccess, mdBahanTable, mdbahanPagination, newForm})
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package dev_handlers
|
||||
|
||||
import (
|
||||
"cpone/models"
|
||||
"cpone/utils"
|
||||
dev_xsampleautocomplete "cpone/views/dev/xsampleautocomplete"
|
||||
"fmt"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type XSampleAutoCompleteServices interface {
|
||||
GetListT_Test(search string, selectedIdxArr string) ([]models.XsampleT_Test, []models.XsampleT_Test, error)
|
||||
}
|
||||
|
||||
func NewXSampleAutoCompleteHandler(us XSampleAutoCompleteServices) *XSampleAutoCompleteHandler {
|
||||
return &XSampleAutoCompleteHandler{
|
||||
XSampleAutoCompleteServices: us,
|
||||
}
|
||||
}
|
||||
|
||||
type XSampleAutoCompleteHandler struct {
|
||||
XSampleAutoCompleteServices XSampleAutoCompleteServices
|
||||
}
|
||||
|
||||
// INITIAL
|
||||
func (lh *XSampleAutoCompleteHandler) HandleShowXSampleAutoComplete(c echo.Context) error {
|
||||
// logger, _ := zap.NewProduction()
|
||||
// dataList, dataSelected, err := lh.XSampleAutoCompleteServices.GetListT_Test("", "")
|
||||
|
||||
// if err != nil {
|
||||
// defer logger.Sync()
|
||||
// logger.Info("ERROR GET GROUP RESULT",
|
||||
// zap.Any("error", err),
|
||||
// )
|
||||
// fmt.Println(dataList)
|
||||
// fmt.Println(dataSelected)
|
||||
// return err
|
||||
// }
|
||||
|
||||
view := dev_xsampleautocomplete.ShowXSampleScreen("AutoComplete",
|
||||
dev_xsampleautocomplete.MainAutoComplete(),
|
||||
dev_xsampleautocomplete.CssXsampleAutoComplete(),
|
||||
dev_xsampleautocomplete.TemplJsAutoComplete(),
|
||||
dev_xsampleautocomplete.EmptyDiv1(),
|
||||
dev_xsampleautocomplete.EmptyDiv1(),
|
||||
dev_xsampleautocomplete.EmptyDiv1())
|
||||
return utils.View(c, view)
|
||||
}
|
||||
|
||||
// PROSES SEARCH
|
||||
func (lh *XSampleAutoCompleteHandler) HandleSearchAutoComplete(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
|
||||
query := c.QueryParam("query")
|
||||
selectedValue := c.QueryParam("selectedvalue")
|
||||
|
||||
dataList, dataSelected, err := lh.XSampleAutoCompleteServices.GetListT_Test(query, selectedValue)
|
||||
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERROR GET GROUP RESULT",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
fmt.Println(dataList)
|
||||
fmt.Println(dataSelected)
|
||||
return err
|
||||
}
|
||||
|
||||
view := dev_xsampleautocomplete.ListData(dataList)
|
||||
|
||||
return utils.View(c, view)
|
||||
}
|
||||
@@ -291,10 +291,18 @@ func SetupRoutesDev(app *echo.Echo, appStore db.AppStore) {
|
||||
dev.GET("/md/groupresultv2/opendelete", devMdGRhandlers.HandleOpenDeleteForm)
|
||||
dev.POST("/md/groupresultv2/closedeleteform", devMdGRhandlers.HandleCloseFormDelete)
|
||||
dev.POST("/md/groupresultv2/delete", devMdGRhandlers.HandleDeleteUserGroup)
|
||||
|
||||
// autocomplete
|
||||
devAutoServices := dev_services.NewServicesXSampleAutoComplete(appStore)
|
||||
devAutohandlers := dev_handlers.NewXSampleAutoCompleteHandler(devAutoServices)
|
||||
dev.GET("/autocompletev1", devAutohandlers.HandleShowXSampleAutoComplete)
|
||||
dev.GET("/searchautocompletev1", devAutohandlers.HandleSearchAutoComplete)
|
||||
//MD BAHAN
|
||||
devMdBahanServices := dev_services.NewMdBahanServices(appStore)
|
||||
devMdBahanHandlers := dev_handlers.NewMdBahanHandler(devMdBahanServices)
|
||||
dev.GET("/md/bahan", devMdBahanHandlers.HandleShowMdBahanScreen)
|
||||
dev.GET("/md/bahan/filter", devMdBahanHandlers.HandleFilterMdBahan)
|
||||
dev.GET("/md/bahan/pagination", devMdBahanHandlers.HandlePaginationMdBahan)
|
||||
dev.POST("/md/bahan/add", devMdBahanHandlers.HandleAddMdBahan)
|
||||
dev.POST("/md/bahan/closeaddform", devMdBahanHandlers.HandleCloseFormAddMdBahan)
|
||||
dev.GET("/md/bahan/openedit", devMdBahanHandlers.HandleOpenEditMdBahan)
|
||||
dev.POST("/md/bahan/closeeditform", devMdBahanHandlers.HandleCloseFormEditMdBahan)
|
||||
dev.POST("/md/bahan/edit", devMdBahanHandlers.HandleEditMdBahan)
|
||||
dev.GET("/md/bahan/opendelete", devMdBahanHandlers.HandleOpenDeleteMdBahan)
|
||||
dev.POST("/md/bahan/closedeleteform", devMdBahanHandlers.HandleCloseDeleteMdBahan)
|
||||
dev.POST("/md/bahan/delete", devMdBahanHandlers.HandleDeleteMdBahan)
|
||||
}
|
||||
|
||||
@@ -266,6 +266,8 @@ templ CorporateLayout(title string, css templ.Component, js templ.Component, nav
|
||||
<script src="assets/js/scripts.bundle.js"></script>
|
||||
<!--end::Global Theme Bundle-->
|
||||
<script src="assets/js/iconify/iconify.min.js"></script>
|
||||
// bootstrap datepicker
|
||||
<script src="assets/js/pages/crud/forms/widgets/bootstrap-datepicker.js"></script>
|
||||
@js
|
||||
<!--end::Page Scripts-->
|
||||
</body>
|
||||
|
||||
@@ -78,7 +78,7 @@ func CorporateLayout(title string, css templ.Component, js templ.Component, navb
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!--begin::Global Config(global config for global JS scripts)--><script src=\"asset-corporate-portal/js/ktappsetting.js\"></script><!--end::Global Config--><!--begin::Global Theme Bundle(used by all pages)--><script src=\"assets/plugins/global/plugins.bundle.js\"></script><script src=\"assets/plugins/custom/prismjs/prismjs.bundle.js\"></script><script src=\"assets/js/scripts.bundle.js\"></script><!--end::Global Theme Bundle--><script src=\"assets/js/iconify/iconify.min.js\"></script>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!--begin::Global Config(global config for global JS scripts)--><script src=\"asset-corporate-portal/js/ktappsetting.js\"></script><!--end::Global Config--><!--begin::Global Theme Bundle(used by all pages)--><script src=\"assets/plugins/global/plugins.bundle.js\"></script><script src=\"assets/plugins/custom/prismjs/prismjs.bundle.js\"></script><script src=\"assets/js/scripts.bundle.js\"></script><!--end::Global Theme Bundle--><script src=\"assets/js/iconify/iconify.min.js\"></script><script src=\"assets/js/pages/crud/forms/widgets/bootstrap-datepicker.js\"></script>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
38
models/bahan.models.go
Normal file
38
models/bahan.models.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package models
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
|
||||
type Bahan struct {
|
||||
T_BahanID int `db:"T_BahanID"`
|
||||
T_BahanT_SampleStationID int `db:"T_BahanT_SampleStationID"`
|
||||
T_SampleStationID int `db:"T_SampleStationID"`
|
||||
T_SampleStationName string `db:"T_SampleStationName"`
|
||||
T_BahanCode string `db:"T_BahanCode"`
|
||||
T_BahanName string `db:"T_BahanName"`
|
||||
T_BahanLangName string `db:"T_BahanLangName"`
|
||||
T_BahanIsActive string `db:"T_BahanIsActive"`
|
||||
T_BahanCreated string `db:"T_BahanCreated"`
|
||||
T_BahanCreatedUserID string `db:"T_BahanCreatedUserID"`
|
||||
T_BahanLastUpdated string `db:"T_BahanLastUpdated"`
|
||||
T_BahanLastUpdatedUserID string `db:"T_BahanLastUpdatedUserID"`
|
||||
T_BahanDeleted string `db:"T_BahanDeleted"`
|
||||
T_BahanDeletedUserID string `db:"T_BahanDeletedUserID"`
|
||||
}
|
||||
|
||||
type TmpSampleStation struct {
|
||||
T_SampleStationID int `db:"T_SampleStationID"`
|
||||
T_SampleStationName string `db:"T_SampleStationName"`
|
||||
}
|
||||
|
||||
type BahanFormComponent struct {
|
||||
IDComponent string
|
||||
Link string
|
||||
HxTarget string
|
||||
HxSwap string
|
||||
HxInclude string
|
||||
ModalID string
|
||||
ModalTitle string
|
||||
DialogBody templ.Component
|
||||
DialogAction templ.Component
|
||||
ButtonCLose templ.Component
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package models
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
|
||||
// name string, id string, hxTarget string, hxGet string, hxIndicator string, hxTrigger string, hxInclude string,
|
||||
|
||||
type CustomDropdownv1Prm struct {
|
||||
@@ -16,3 +18,19 @@ type CustomDropdownv1Prm struct {
|
||||
ErrorMsg string `default:""`
|
||||
ID string
|
||||
}
|
||||
type CustomDropdownV2Prm struct {
|
||||
HxTarget string `default:"hxTarget"`
|
||||
HxGet string `default:"hxGet"`
|
||||
HxIndicator string `default:"hxIndicator"`
|
||||
HxInclude string `default:"hxInclude"`
|
||||
HxTrigger string `default:"hxTrigger"`
|
||||
HxSwap string `default:"HxSwap"`
|
||||
Label string `default:"Label"`
|
||||
Name string `default:"name"`
|
||||
Placeholder string `default:"Placeholder"`
|
||||
// Type string `default:"text"`
|
||||
// Value string `default:""`
|
||||
ErrorMsg string `default:""`
|
||||
ID string
|
||||
ListItem templ.Component
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
package models
|
||||
|
||||
type XsampleT_Test struct {
|
||||
T_TestID int `db:"T_TestID"`
|
||||
T_TestCode string `db:"T_TestCode"`
|
||||
T_TestName string `db:"T_TestName"`
|
||||
}
|
||||
@@ -514,3 +514,7 @@ func GetUserLogin() (models.User, error) {
|
||||
}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
func GetTerminology(attributePath string, codeSystem string) {
|
||||
|
||||
}
|
||||
|
||||
251
services/dev/md.bahan.services.go
Normal file
251
services/dev/md.bahan.services.go
Normal file
@@ -0,0 +1,251 @@
|
||||
package dev_services
|
||||
|
||||
import (
|
||||
"cpone/db"
|
||||
"cpone/models"
|
||||
dbx "cpone/package/database"
|
||||
"fmt"
|
||||
"math"
|
||||
"strings"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func NewMdBahanServices(uStore db.AppStore) *MdBahanServices {
|
||||
|
||||
return &MdBahanServices{
|
||||
|
||||
MdBahanStore: uStore,
|
||||
}
|
||||
}
|
||||
|
||||
type MdBahanServices struct {
|
||||
MdBahanStore db.AppStore
|
||||
}
|
||||
|
||||
func (su *MdBahanServices) GetListMdBahan(
|
||||
search string,
|
||||
stationID string,
|
||||
currentPage int,
|
||||
rowPerPage int) ([]models.Bahan, int, error) {
|
||||
var bahanList []models.Bahan
|
||||
var totalData int
|
||||
offset := (currentPage - 1) * rowPerPage
|
||||
prm := "%" + strings.TrimSpace(search) + "%"
|
||||
filterStation := ""
|
||||
if stationID != "0" {
|
||||
filterStation = "AND T_BahanT_SampleStationID = " + stationID
|
||||
|
||||
}
|
||||
querytotal := `
|
||||
SELECT COUNT(*) FROM
|
||||
t_bahan
|
||||
JOIN
|
||||
t_samplestation
|
||||
ON T_BahanT_SampleStationID = T_SampleStationID
|
||||
AND T_BahanIsActive = 'Y'
|
||||
AND T_SampleStationIsActive = 'Y'
|
||||
WHERE (T_BahanName LIKE ? OR T_BahanCode LIKE ? )
|
||||
|
||||
` + filterStation
|
||||
if err := dbx.Handlex.Get(&totalData, querytotal, prm, prm); err != nil {
|
||||
return nil, 0, fmt.Errorf("error querying database: %v", err)
|
||||
}
|
||||
query := `
|
||||
SELECT t_bahan.*,
|
||||
T_SampleStationName,
|
||||
T_SampleStationID FROM
|
||||
t_bahan
|
||||
JOIN
|
||||
t_samplestation
|
||||
ON T_BahanT_SampleStationID = T_SampleStationID
|
||||
AND T_BahanIsActive = 'Y'
|
||||
AND T_SampleStationIsActive = 'Y'
|
||||
WHERE (T_BahanName LIKE ? OR T_BahanCode LIKE ? )
|
||||
` + filterStation + `
|
||||
LIMIT ? OFFSET ?
|
||||
`
|
||||
|
||||
if err := dbx.Handlex.Select(&bahanList, query, prm, prm, rowPerPage, offset); err != nil {
|
||||
return nil, 0, fmt.Errorf("error querying database: %v", err)
|
||||
}
|
||||
totalPage := int(math.Ceil(float64(totalData) / float64(rowPerPage)))
|
||||
|
||||
return bahanList, totalPage, nil
|
||||
|
||||
}
|
||||
|
||||
func (su *MdBahanServices) GetMdBahanBreadCrumb(title string) (models.BreadCrumbV1, error) {
|
||||
|
||||
ret := models.BreadCrumbV1{
|
||||
Title: "Master Bahan",
|
||||
Item: []models.ItemBreadCrumbV1{
|
||||
{
|
||||
Item: "Dashboard",
|
||||
Url: "/dev/dashboard",
|
||||
},
|
||||
{
|
||||
Item: "Master",
|
||||
Url: "/dev/master",
|
||||
},
|
||||
{
|
||||
Item: "Bahan",
|
||||
Url: "",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
func (su *MdBahanServices) GetListSampleStation(isFilter bool) ([]models.TmpSampleStation, error) {
|
||||
var stationList []models.TmpSampleStation
|
||||
query := `
|
||||
SELECT
|
||||
T_SampleStationID,
|
||||
T_SampleStationName
|
||||
FROM
|
||||
t_samplestation
|
||||
WHERE T_SampleStationIsActive = 'Y'
|
||||
`
|
||||
|
||||
if err := dbx.Handlex.Select(&stationList, query); err != nil {
|
||||
return nil, fmt.Errorf("error querying database: %v", err)
|
||||
}
|
||||
if isFilter {
|
||||
stationList = append(
|
||||
[]models.TmpSampleStation{{T_SampleStationID: 0, T_SampleStationName: "Semua"}}, stationList...)
|
||||
}
|
||||
|
||||
return stationList, nil
|
||||
}
|
||||
func (su *MdBahanServices) AddMdBahan(code string, name string, stationid string) (bool, error) {
|
||||
logger, _ := zap.NewProduction()
|
||||
var datacek []models.Bahan
|
||||
qryCek := `SELECT T_BahanCode FROM t_bahan WHERE T_BahanCode = ? AND T_BahanIsActive = 'Y'`
|
||||
err := dbx.Handlex.Select(&datacek, qryCek, code)
|
||||
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("Error cek data by code",
|
||||
zap.String("code", code),
|
||||
zap.Any("datacek", datacek),
|
||||
)
|
||||
return false, fmt.Errorf("query cek failed")
|
||||
}
|
||||
if len(datacek) > 0 {
|
||||
defer logger.Sync()
|
||||
logger.Error("Code already taken by another data",
|
||||
zap.String("code", code),
|
||||
)
|
||||
return false, fmt.Errorf("code sudah dipakai")
|
||||
}
|
||||
query := `
|
||||
INSERT INTO t_bahan(
|
||||
T_BahanT_SampleStationID,
|
||||
T_BahanCode,
|
||||
T_BahanName,
|
||||
T_BahanCreated,
|
||||
T_BahanCreatedUserID)
|
||||
VALUES(?,?,?, NOW(), 1)
|
||||
|
||||
`
|
||||
rst := dbx.Handlex.MustExec(query, stationid, code, name)
|
||||
_, err = rst.LastInsertId()
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("Error Insert t bahan",
|
||||
zap.Any("code", err),
|
||||
)
|
||||
return false, fmt.Errorf("insert data failed")
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
func (ug *MdBahanServices) GetMdBahanByID(id string) (models.Bahan, error) {
|
||||
logger, _ := zap.NewProduction()
|
||||
|
||||
var data models.Bahan
|
||||
err := dbx.Handlex.Get(&data,
|
||||
`SELECT t_bahan.*,
|
||||
T_SampleStationID,
|
||||
T_SampleStationName
|
||||
FROM t_bahan
|
||||
JOIN
|
||||
t_samplestation
|
||||
ON T_BahanT_SampleStationID = T_SampleStationID
|
||||
AND T_BahanIsActive = 'Y'
|
||||
AND T_SampleStationIsActive = 'Y'
|
||||
WHERE T_BahanID = ? `, id)
|
||||
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("Error get data bahan by id vs",
|
||||
zap.String("ID", id),
|
||||
zap.Error(err),
|
||||
)
|
||||
return data, fmt.Errorf("get bahan failed")
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
func (su *MdBahanServices) EditMdBahan(id string, code string, name string, stationid string) (bool, error) {
|
||||
logger, _ := zap.NewProduction()
|
||||
var datacek []models.Bahan
|
||||
qryCek := `SELECT T_BahanCode FROM t_bahan WHERE T_BahanCode = ? AND T_BahanIsActive = 'Y' AND T_BahanID <> ?`
|
||||
err := dbx.Handlex.Select(&datacek, qryCek, code, id)
|
||||
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("Error cek data by code",
|
||||
zap.String("code", code),
|
||||
zap.Any("datacek", datacek),
|
||||
)
|
||||
return false, fmt.Errorf("query cek failed")
|
||||
}
|
||||
if len(datacek) > 0 {
|
||||
defer logger.Sync()
|
||||
logger.Error("Code already taken by another data",
|
||||
zap.String("code", code),
|
||||
)
|
||||
return false, fmt.Errorf("code sudah dipakai")
|
||||
}
|
||||
query := `
|
||||
UPDATE t_bahan SET
|
||||
T_BahanCode = ?,
|
||||
T_BahanName = ?,
|
||||
T_BahanT_SampleStationID = ?
|
||||
WHERE T_BahanID = ?
|
||||
`
|
||||
rst := dbx.Handlex.MustExec(query, code, name, stationid, id)
|
||||
_, err = rst.LastInsertId()
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("Error edit t bahan",
|
||||
zap.Any("code", err),
|
||||
)
|
||||
return false, fmt.Errorf("edit data failed")
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
func (su *MdBahanServices) DeleteMdBahan(id string) (bool, error) {
|
||||
logger, _ := zap.NewProduction()
|
||||
|
||||
query := `
|
||||
UPDATE t_bahan
|
||||
SET T_BahanIsActive = 'N',
|
||||
T_BahanDeleted = NOW(),
|
||||
T_BahanDeletedUserID = '1'
|
||||
WHERE T_BahanID = ?
|
||||
`
|
||||
rst := dbx.Handlex.MustExec(query, id)
|
||||
_, err := rst.LastInsertId()
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("Error edit t bahan",
|
||||
zap.Any("code", err),
|
||||
)
|
||||
return false, fmt.Errorf("edit data failed")
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
package dev_services
|
||||
|
||||
import (
|
||||
"cpone/db"
|
||||
"cpone/models"
|
||||
dbx "cpone/package/database"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func NewServicesXSampleAutoComplete(uStore db.AppStore) *ServicesXSampleAutoComplete {
|
||||
|
||||
return &ServicesXSampleAutoComplete{
|
||||
XSampleAutoCompleteStore: uStore,
|
||||
}
|
||||
}
|
||||
|
||||
type ServicesXSampleAutoComplete struct {
|
||||
XSampleAutoCompleteStore db.AppStore
|
||||
}
|
||||
|
||||
// LIST T_Test plus search
|
||||
func (su *ServicesXSampleAutoComplete) GetListT_Test(search string, selectedIdxArr string) ([]models.XsampleT_Test, []models.XsampleT_Test, error) {
|
||||
var dataList []models.XsampleT_Test
|
||||
var dataListSelected []models.XsampleT_Test
|
||||
// var dataListNew []models.XsampleT_Test
|
||||
|
||||
logger, _ := zap.NewProduction()
|
||||
defer logger.Sync()
|
||||
|
||||
prm := "%" + strings.TrimSpace(search) + "%"
|
||||
|
||||
// Check if selectedIdxArr is not empty
|
||||
if len(selectedIdxArr) > 0 {
|
||||
qrySelected := fmt.Sprintf(`
|
||||
SELECT T_TestID, T_TestCode, T_TestName
|
||||
FROM t_test
|
||||
WHERE T_TestIsActive = 'Y'
|
||||
AND T_TestID IN (%s)
|
||||
LIMIT 0, 50
|
||||
`, selectedIdxArr)
|
||||
|
||||
err := dbx.Handlex.Select(&dataListSelected, qrySelected)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("error querying database: %v", err)
|
||||
}
|
||||
|
||||
qryListX := fmt.Sprintf(`SELECT T_TestID, T_TestCode, T_TestName
|
||||
FROM t_test
|
||||
WHERE T_TestIsActive = 'Y'
|
||||
AND (T_TestCode LIKE ? OR T_TestName LIKE ?)
|
||||
AND T_TestID NOT IN (%s)
|
||||
LIMIT 0, 50
|
||||
`, selectedIdxArr)
|
||||
|
||||
logger.Info("QUERY SEARCH INITIAL TOTAL COUNT",
|
||||
zap.String("query search", qryListX),
|
||||
)
|
||||
|
||||
errx := dbx.Handlex.Select(&dataList, qryListX, prm, prm)
|
||||
if errx != nil {
|
||||
return nil, nil, fmt.Errorf("error querying database: %v", err)
|
||||
}
|
||||
} else {
|
||||
qryList := `
|
||||
SELECT T_TestID, T_TestCode, T_TestName
|
||||
FROM t_test
|
||||
WHERE T_TestIsActive = 'Y'
|
||||
AND (T_TestCode LIKE ? OR T_TestName LIKE ?)
|
||||
LIMIT 0, 50
|
||||
`
|
||||
|
||||
logger.Info("QUERY SEARCH INITIAL TOTAL COUNT",
|
||||
zap.String("query search", qryList),
|
||||
)
|
||||
|
||||
err := dbx.Handlex.Select(&dataList, qryList, prm, prm)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("error querying database: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
return dataList, dataListSelected, nil
|
||||
}
|
||||
265
views/dev/mdbahan/mdbahan.templ
Normal file
265
views/dev/mdbahan/mdbahan.templ
Normal file
@@ -0,0 +1,265 @@
|
||||
package dev_mdbahanview
|
||||
|
||||
import "cpone/layout"
|
||||
import "cpone/models"
|
||||
import "cpone/component/customtextfield"
|
||||
import "cpone/component/customdropdown"
|
||||
import "strconv"
|
||||
|
||||
templ MdBahanScreen(
|
||||
tableID string,
|
||||
paginationID string,
|
||||
dialogAddID string,
|
||||
dialogAddBodyID string,
|
||||
dialogEditID string,
|
||||
dialogEditBodyID string,
|
||||
dialogDeleteID string,
|
||||
dialogDeleteBodyID string,
|
||||
breadcrumb templ.Component,
|
||||
tablecontent templ.Component,
|
||||
filterComponent templ.Component,
|
||||
pagination templ.Component,
|
||||
dialogAddCmp templ.Component,
|
||||
dialogEditCmp templ.Component,
|
||||
dialogDeleteCmp templ.Component,
|
||||
) {
|
||||
<div class="container-fluid">
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogAddID",
|
||||
Name: "dialogAddID",
|
||||
Type: "hidden",
|
||||
Value: dialogAddID})
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogAddBodyID",
|
||||
Name: "dialogAddBodyID",
|
||||
Type: "hidden",
|
||||
Value: dialogAddBodyID})
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogEditID",
|
||||
Name: "dialogEditID",
|
||||
Type: "hidden",
|
||||
Value: dialogEditID})
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogEditBodyID",
|
||||
Name: "dialogEditBodyID",
|
||||
Type: "hidden",
|
||||
Value: dialogEditBodyID})
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogDeleteID",
|
||||
Name: "dialogDeleteID",
|
||||
Type: "hidden",
|
||||
Value: dialogDeleteID})
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogDeleteBodyID",
|
||||
Name: "dialogDeleteBodyID",
|
||||
Type: "hidden",
|
||||
Value: dialogDeleteBodyID})
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "tableID",
|
||||
Name: "tableID",
|
||||
Type: "hidden",
|
||||
Value: tableID})
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "paginationID",
|
||||
Name: "paginationID",
|
||||
Type: "hidden",
|
||||
Value: paginationID})
|
||||
<div class="row align-items-center mb-10">
|
||||
<div class="col-md-10 col-sm-12 p-0 ">
|
||||
@breadcrumb
|
||||
</div>
|
||||
<div class="col-md-2 d-none d-lg-block d-xl-block d-md-block d-sm-none">
|
||||
// <div class="d-block align-items-center">
|
||||
<div class="d-flex justify-content-end">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-primary"
|
||||
data-toggle="modal"
|
||||
data-target={ "#" + dialogAddID }
|
||||
>Add New</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2 d-block d-lg-none d-xl-none d-md-none d-sm-block justify-content-center px-5">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-primary btn-block"
|
||||
data-toggle="modal"
|
||||
data-target={ "#" + dialogAddID }
|
||||
>Add New</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="loading-parent" class=" rounded">
|
||||
@filterComponent
|
||||
@tablecontent
|
||||
@pagination
|
||||
<div id="loading-child" class=" rounded bg-transparent">
|
||||
// <div class="spinner spinner-lg spinner-primary"></div>
|
||||
<div id="loading-spinner" class="spinner-border text-primary d-none" style="width: 3rem; height: 3rem;" role="status">
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="loadingcontent"></div>
|
||||
@dialogAddCmp
|
||||
@dialogEditCmp
|
||||
@dialogDeleteCmp
|
||||
</div>
|
||||
}
|
||||
|
||||
templ CssMdUserGroup() {
|
||||
}
|
||||
|
||||
templ JsMdBahan() {
|
||||
<script>
|
||||
document.addEventListener('htmx:afterSwap', function(event) {
|
||||
// Reinitialize selectpicker after HTMX content swap
|
||||
$('.selectpicker').selectpicker('refresh');
|
||||
});
|
||||
|
||||
document.addEventListener('htmx:beforeRequest', function(event) {
|
||||
console.log("Before Request")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.target)
|
||||
|
||||
});
|
||||
|
||||
document.addEventListener('htmx:afterRequest', function(event) {
|
||||
console.log("After Request")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.target)
|
||||
});
|
||||
document.addEventListener('htmx:historyCacheError', function(event) {
|
||||
console.log("Error History Cache Error")
|
||||
console.log(event.detail.cause)
|
||||
|
||||
});
|
||||
document.addEventListener('htmx:historyCacheMissError', function(event) {
|
||||
console.log("Error History Cache Miss Error")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.path)
|
||||
|
||||
});
|
||||
document.addEventListener('htmx:oobErrorNoTarget', function(event) {
|
||||
console.log("Error OOB No Target")
|
||||
console.log(event.detail.content)
|
||||
});
|
||||
document.addEventListener('htmx:onLoadError', function(event) {
|
||||
console.log("Error On Load")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.elt)
|
||||
console.log(event.detail.target)
|
||||
console.log(event.detail.exception)
|
||||
console.log(event.detail.requestConfig)
|
||||
});
|
||||
document.addEventListener('htmx:responseError', function(event) {
|
||||
console.log("Error Response")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.elt)
|
||||
console.log(event.detail.requestConfig)
|
||||
});
|
||||
document.addEventListener('htmx:sendError', function(event) {
|
||||
console.log("Error Send Error")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.elt)
|
||||
console.log(event.detail.requestConfig)
|
||||
});
|
||||
document.addEventListener('htmx:sseError', function(event) {
|
||||
console.log("Error Sse ")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.error)
|
||||
console.log(event.detail.source)
|
||||
});
|
||||
document.addEventListener('htmx:swapError', function(event) {
|
||||
console.log("Error Swap Error")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.elt)
|
||||
console.log("Target Swap: "+event.detail.target)
|
||||
console.log(event.detail.requestConfig)
|
||||
});
|
||||
document.addEventListener('htmx:targetError', function(event) {
|
||||
console.log("Error target")
|
||||
console.log(event.detail.elt)
|
||||
console.log("Target ID: "+event.detail.target)
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
script BeforeRequestContent() {
|
||||
const loadingParent = document.getElementById("loading-parent");
|
||||
const loadingChild = document.getElementById("loading-child");
|
||||
const loadingSpinner = document.getElementById("loading-spinner");
|
||||
|
||||
loadingParent.classList.add("overlay");
|
||||
loadingParent.classList.add("overlay-block");
|
||||
loadingChild.classList.add("overlay-layer");
|
||||
loadingSpinner.classList.remove("d-none");
|
||||
}
|
||||
|
||||
script AfterRequestContent() {
|
||||
const loadingParent = document.getElementById("loading-parent");
|
||||
const loadingChild = document.getElementById("loading-child");
|
||||
const loadingSpinner = document.getElementById("loading-spinner");
|
||||
|
||||
loadingParent.classList.remove("overlay");
|
||||
loadingParent.classList.remove("overlay-block");
|
||||
loadingChild.classList.remove("overlay-layer");
|
||||
loadingSpinner.classList.add("d-none");
|
||||
}
|
||||
|
||||
templ MdBahanFilter(
|
||||
hxGet string,
|
||||
hxTrigger string,
|
||||
hxInclude string,
|
||||
hxSwap string,
|
||||
hxTarget string,
|
||||
dataStation []models.TmpSampleStation,
|
||||
selectedIdStation int,
|
||||
hxBeforeRequest templ.ComponentScript,
|
||||
hxAfterRequest templ.ComponentScript,
|
||||
) {
|
||||
<div class="container p-0">
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6 mb-2">
|
||||
<input
|
||||
id="filter-name"
|
||||
class="form-control form-control-lg bg-field border-0 rounded-lg"
|
||||
type="text"
|
||||
name="filtername"
|
||||
placeholder="Name/Kode"
|
||||
autocomplete="off"
|
||||
hx-target={ hxTarget }
|
||||
hx-trigger={ hxTrigger }
|
||||
hx-include={ hxInclude }
|
||||
hx-get={ hxGet }
|
||||
hx-swap={ hxSwap }
|
||||
hx-on::before-request={ hxBeforeRequest }
|
||||
hx-on::after-request={ hxAfterRequest }
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6 mb-2">
|
||||
@customdropdown.CustomDropdownFilter("filter-station",
|
||||
"filterstation",
|
||||
hxInclude,
|
||||
hxGet,
|
||||
hxSwap,
|
||||
hxTarget,
|
||||
"change",
|
||||
hxBeforeRequest,
|
||||
hxAfterRequest, ListItemStation(dataStation, selectedIdStation))
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
templ ListItemStation(
|
||||
dataStation []models.TmpSampleStation,
|
||||
selectedIdStation int) {
|
||||
for _, v := range dataStation {
|
||||
if v.T_SampleStationID == selectedIdStation {
|
||||
<option value={ strconv.Itoa(v.T_SampleStationID) } selected="selected">{ v.T_SampleStationName }</option>
|
||||
} else {
|
||||
<option value={ strconv.Itoa(v.T_SampleStationID) }>{ v.T_SampleStationName }</option>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
templ ShowMdBahanScreen(title string, cmp templ.Component, css templ.Component, js templ.Component,
|
||||
navbarmenu templ.Component,
|
||||
navbaruser templ.Component,
|
||||
userprofile templ.Component) {
|
||||
@layout.CorporateLayout(title, css, js, navbarmenu, navbaruser, userprofile) {
|
||||
@cmp
|
||||
}
|
||||
}
|
||||
531
views/dev/mdbahan/mdbahan_templ.go
Normal file
531
views/dev/mdbahan/mdbahan_templ.go
Normal file
@@ -0,0 +1,531 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.663
|
||||
package dev_mdbahanview
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import "context"
|
||||
import "io"
|
||||
import "bytes"
|
||||
|
||||
import "cpone/layout"
|
||||
import "cpone/models"
|
||||
import "cpone/component/customtextfield"
|
||||
import "cpone/component/customdropdown"
|
||||
import "strconv"
|
||||
|
||||
func MdBahanScreen(
|
||||
tableID string,
|
||||
paginationID string,
|
||||
dialogAddID string,
|
||||
dialogAddBodyID string,
|
||||
dialogEditID string,
|
||||
dialogEditBodyID string,
|
||||
dialogDeleteID string,
|
||||
dialogDeleteBodyID string,
|
||||
breadcrumb templ.Component,
|
||||
tablecontent templ.Component,
|
||||
filterComponent templ.Component,
|
||||
pagination templ.Component,
|
||||
dialogAddCmp templ.Component,
|
||||
dialogEditCmp templ.Component,
|
||||
dialogDeleteCmp templ.Component,
|
||||
) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"container-fluid\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogAddID",
|
||||
Name: "dialogAddID",
|
||||
Type: "hidden",
|
||||
Value: dialogAddID}).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogAddBodyID",
|
||||
Name: "dialogAddBodyID",
|
||||
Type: "hidden",
|
||||
Value: dialogAddBodyID}).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogEditID",
|
||||
Name: "dialogEditID",
|
||||
Type: "hidden",
|
||||
Value: dialogEditID}).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogEditBodyID",
|
||||
Name: "dialogEditBodyID",
|
||||
Type: "hidden",
|
||||
Value: dialogEditBodyID}).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogDeleteID",
|
||||
Name: "dialogDeleteID",
|
||||
Type: "hidden",
|
||||
Value: dialogDeleteID}).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "dialogDeleteBodyID",
|
||||
Name: "dialogDeleteBodyID",
|
||||
Type: "hidden",
|
||||
Value: dialogDeleteBodyID}).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "tableID",
|
||||
Name: "tableID",
|
||||
Type: "hidden",
|
||||
Value: tableID}).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "paginationID",
|
||||
Name: "paginationID",
|
||||
Type: "hidden",
|
||||
Value: paginationID}).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"row align-items-center mb-10\"><div class=\"col-md-10 col-sm-12 p-0 \">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = breadcrumb.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div><div class=\"col-md-2 d-none d-lg-block d-xl-block d-md-block d-sm-none\"><div class=\"d-flex justify-content-end\"><button type=\"button\" class=\"btn btn-primary\" data-toggle=\"modal\" data-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs("#" + dialogAddID)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahan.templ`, Line: 70, Col: 37}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">Add New</button></div></div><div class=\"col-md-2 d-block d-lg-none d-xl-none d-md-none d-sm-block justify-content-center px-5\"><button type=\"button\" class=\"btn btn-primary btn-block\" data-toggle=\"modal\" data-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs("#" + dialogAddID)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahan.templ`, Line: 79, Col: 36}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">Add New</button></div></div><div id=\"loading-parent\" class=\" rounded\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = filterComponent.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = tablecontent.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = pagination.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div id=\"loading-child\" class=\" rounded bg-transparent\"><div id=\"loading-spinner\" class=\"spinner-border text-primary d-none\" style=\"width: 3rem; height: 3rem;\" role=\"status\"><span class=\"sr-only\">Loading...</span></div></div></div><div id=\"loadingcontent\"></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = dialogAddCmp.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = dialogEditCmp.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = dialogDeleteCmp.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func CssMdUserGroup() templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var4 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var4 == nil {
|
||||
templ_7745c5c3_Var4 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func JsMdBahan() templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var5 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var5 == nil {
|
||||
templ_7745c5c3_Var5 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<script>\r\n\t\tdocument.addEventListener('htmx:afterSwap', function(event) {\r\n\t\t\t// Reinitialize selectpicker after HTMX content swap\r\n\t\t\t$('.selectpicker').selectpicker('refresh');\r\n\t\t});\r\n \r\n document.addEventListener('htmx:beforeRequest', function(event) {\r\n console.log(\"Before Request\")\r\n\t\t\tconsole.log(event.detail.xhr)\r\n\t\t\tconsole.log(event.detail.target)\r\n \r\n });\r\n\r\n document.addEventListener('htmx:afterRequest', function(event) {\r\n console.log(\"After Request\")\r\n console.log(event.detail.xhr)\r\n\t\t\tconsole.log(event.detail.target)\r\n });\r\n document.addEventListener('htmx:historyCacheError', function(event) {\r\n console.log(\"Error History Cache Error\")\r\n console.log(event.detail.cause)\r\n\t\t\t\r\n });\r\n document.addEventListener('htmx:historyCacheMissError', function(event) {\r\n console.log(\"Error History Cache Miss Error\")\r\n console.log(event.detail.xhr)\r\n console.log(event.detail.path)\r\n\t\t\t\r\n });\r\n document.addEventListener('htmx:oobErrorNoTarget', function(event) {\r\n console.log(\"Error OOB No Target\")\r\n console.log(event.detail.content)\r\n });\r\n document.addEventListener('htmx:onLoadError', function(event) {\r\n console.log(\"Error On Load\")\r\n console.log(event.detail.xhr)\r\n console.log(event.detail.elt)\r\n console.log(event.detail.target)\r\n console.log(event.detail.exception)\r\n console.log(event.detail.requestConfig)\r\n });\r\n document.addEventListener('htmx:responseError', function(event) {\r\n console.log(\"Error Response\")\r\n console.log(event.detail.xhr)\r\n console.log(event.detail.elt)\r\n console.log(event.detail.requestConfig)\r\n });\r\n document.addEventListener('htmx:sendError', function(event) {\r\n console.log(\"Error Send Error\")\r\n console.log(event.detail.xhr)\r\n console.log(event.detail.elt)\r\n console.log(event.detail.requestConfig)\r\n });\r\n document.addEventListener('htmx:sseError', function(event) {\r\n console.log(\"Error Sse \")\r\n console.log(event.detail.xhr)\r\n console.log(event.detail.error)\r\n console.log(event.detail.source)\r\n });\r\n\t\tdocument.addEventListener('htmx:swapError', function(event) {\r\n console.log(\"Error Swap Error\")\r\n console.log(event.detail.xhr)\r\n console.log(event.detail.elt)\r\n console.log(\"Target Swap: \"+event.detail.target)\r\n console.log(event.detail.requestConfig)\r\n });\r\n\t\tdocument.addEventListener('htmx:targetError', function(event) {\r\n console.log(\"Error target\")\r\n console.log(event.detail.elt)\r\n console.log(\"Target ID: \"+event.detail.target)\r\n });\r\n </script>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func BeforeRequestContent() templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_BeforeRequestContent_911f`,
|
||||
Function: `function __templ_BeforeRequestContent_911f(){const loadingParent = document.getElementById("loading-parent");
|
||||
const loadingChild = document.getElementById("loading-child");
|
||||
const loadingSpinner = document.getElementById("loading-spinner");
|
||||
|
||||
loadingParent.classList.add("overlay");
|
||||
loadingParent.classList.add("overlay-block");
|
||||
loadingChild.classList.add("overlay-layer");
|
||||
loadingSpinner.classList.remove("d-none");
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_BeforeRequestContent_911f`),
|
||||
CallInline: templ.SafeScriptInline(`__templ_BeforeRequestContent_911f`),
|
||||
}
|
||||
}
|
||||
|
||||
func AfterRequestContent() templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_AfterRequestContent_6cc0`,
|
||||
Function: `function __templ_AfterRequestContent_6cc0(){const loadingParent = document.getElementById("loading-parent");
|
||||
const loadingChild = document.getElementById("loading-child");
|
||||
const loadingSpinner = document.getElementById("loading-spinner");
|
||||
|
||||
loadingParent.classList.remove("overlay");
|
||||
loadingParent.classList.remove("overlay-block");
|
||||
loadingChild.classList.remove("overlay-layer");
|
||||
loadingSpinner.classList.add("d-none");
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_AfterRequestContent_6cc0`),
|
||||
CallInline: templ.SafeScriptInline(`__templ_AfterRequestContent_6cc0`),
|
||||
}
|
||||
}
|
||||
|
||||
func MdBahanFilter(
|
||||
hxGet string,
|
||||
hxTrigger string,
|
||||
hxInclude string,
|
||||
hxSwap string,
|
||||
hxTarget string,
|
||||
dataStation []models.TmpSampleStation,
|
||||
selectedIdStation int,
|
||||
hxBeforeRequest templ.ComponentScript,
|
||||
hxAfterRequest templ.ComponentScript,
|
||||
) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var6 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var6 == nil {
|
||||
templ_7745c5c3_Var6 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"container p-0\"><div class=\"row\"><div class=\"col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6 mb-2\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, hxBeforeRequest, hxAfterRequest)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<input id=\"filter-name\" class=\"form-control form-control-lg bg-field border-0 rounded-lg\" type=\"text\" name=\"filtername\" placeholder=\"Name/Kode\" autocomplete=\"off\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var7 string
|
||||
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(hxTarget)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahan.templ`, Line: 222, Col: 25}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var8 string
|
||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(hxTrigger)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahan.templ`, Line: 223, Col: 27}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-include=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var9 string
|
||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(hxInclude)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahan.templ`, Line: 224, Col: 27}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-get=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var10 string
|
||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(hxGet)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahan.templ`, Line: 225, Col: 19}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var11 string
|
||||
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwap)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahan.templ`, Line: 226, Col: 21}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::before-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var12 templ.ComponentScript = hxBeforeRequest
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var12.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::after-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var13 templ.ComponentScript = hxAfterRequest
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var13.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"></div><div class=\"col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6 mb-2\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customdropdown.CustomDropdownFilter("filter-station",
|
||||
"filterstation",
|
||||
hxInclude,
|
||||
hxGet,
|
||||
hxSwap,
|
||||
hxTarget,
|
||||
"change",
|
||||
hxBeforeRequest,
|
||||
hxAfterRequest, ListItemStation(dataStation, selectedIdStation)).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func ListItemStation(
|
||||
dataStation []models.TmpSampleStation,
|
||||
selectedIdStation int) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var14 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var14 == nil {
|
||||
templ_7745c5c3_Var14 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
for _, v := range dataStation {
|
||||
if v.T_SampleStationID == selectedIdStation {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<option value=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var15 string
|
||||
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(v.T_SampleStationID))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahan.templ`, Line: 251, Col: 52}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" selected=\"selected\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var16 string
|
||||
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(v.T_SampleStationName)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahan.templ`, Line: 251, Col: 98}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</option>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<option value=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var17 string
|
||||
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(v.T_SampleStationID))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahan.templ`, Line: 253, Col: 52}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var18 string
|
||||
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(v.T_SampleStationName)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahan.templ`, Line: 253, Col: 78}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</option>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func ShowMdBahanScreen(title string, cmp templ.Component, css templ.Component, js templ.Component,
|
||||
navbarmenu templ.Component,
|
||||
navbaruser templ.Component,
|
||||
userprofile templ.Component) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var19 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var19 == nil {
|
||||
templ_7745c5c3_Var19 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Var20 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
templ_7745c5c3_Err = cmp.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, navbarmenu, navbaruser, userprofile).Render(templ.WithChildren(ctx, templ_7745c5c3_Var20), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
189
views/dev/mdbahan/mdbahanformmodal.templ
Normal file
189
views/dev/mdbahan/mdbahanformmodal.templ
Normal file
@@ -0,0 +1,189 @@
|
||||
package dev_mdbahanview
|
||||
|
||||
import "cpone/models"
|
||||
import "cpone/component/modal"
|
||||
import "cpone/component/customtextfield"
|
||||
import "cpone/component/customdropdown"
|
||||
|
||||
templ BahanForm(data models.BahanFormComponent) {
|
||||
<div class="">
|
||||
<form
|
||||
id={ data.IDComponent }
|
||||
hx-post={ data.Link }
|
||||
class="form"
|
||||
hx-target={ data.HxTarget }
|
||||
hx-swap={ data.HxSwap }
|
||||
hx-include={ data.HxInclude }
|
||||
hx-indicator=".formloading"
|
||||
hx-on::before-request={ HandleFormBeforeRequest() }
|
||||
hx-on::after-request={ HandleFormAfterRequest() }
|
||||
>
|
||||
@modalcomponent.Modal(data.ModalID,
|
||||
data.ModalTitle,
|
||||
data.DialogBody,
|
||||
data.DialogAction,
|
||||
data.ButtonCLose)
|
||||
</form>
|
||||
</div>
|
||||
}
|
||||
|
||||
script HandleFormBeforeRequest() {
|
||||
console.log("handle disable btn add");
|
||||
const btnActCancel = document.querySelectorAll('.btnactcancel');
|
||||
const btnactsavedata = document.querySelectorAll('.btnactsavedata');
|
||||
|
||||
for (let i = 0; i < btnActCancel.length; i++) {
|
||||
btnActCancel[i].setAttribute('disabled', 'true');
|
||||
|
||||
}
|
||||
for (let i = 0; i < btnactsavedata.length; i++) {
|
||||
btnactsavedata[i].setAttribute('disabled', 'true');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
script HandleFormAfterRequest() {
|
||||
console.log("handle enable btn add");
|
||||
|
||||
const btnactcancel = document.querySelectorAll('.btnactcancel');
|
||||
const btnactsavedata = document.querySelectorAll('.btnactsavedata');
|
||||
|
||||
|
||||
for (let i = 0; i < btnactcancel.length; i++) {
|
||||
btnactcancel[i].removeAttribute('disabled');
|
||||
|
||||
}
|
||||
for (let i = 0; i < btnactsavedata.length; i++) {
|
||||
btnactsavedata[i].removeAttribute('disabled');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
templ BodyFormBahan(inputId string,
|
||||
inputCode models.CustomTextFieldv2Prm,
|
||||
inputName models.CustomTextFieldv2Prm,
|
||||
inputStation models.CustomDropdownV2Prm,
|
||||
componentID string,
|
||||
hxOnLoad templ.ComponentScript) {
|
||||
<div id={ componentID } hx-on::load={ hxOnLoad }>
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{Name: "bahanid", ID: "bahanID", Type: "hidden", Value: inputId})
|
||||
@customtextfield.CustomTextFieldv2(
|
||||
inputCode)
|
||||
@customtextfield.CustomTextFieldv2(
|
||||
inputName)
|
||||
@customdropdown.CustomDropdownForm(inputStation)
|
||||
</div>
|
||||
}
|
||||
|
||||
script JsHideModal(modalID string) {
|
||||
$(modalID).modal('hide')
|
||||
}
|
||||
|
||||
script JsShowModal(modalID string) {
|
||||
$(modalID).modal('show')
|
||||
const btnactcancel = document.querySelectorAll('.btnactcancel');
|
||||
const btnactsavedata = document.querySelectorAll('.btnactsavedata');
|
||||
|
||||
|
||||
for (let i = 0; i < btnactcancel.length; i++) {
|
||||
btnactcancel[i].removeAttribute('disabled');
|
||||
|
||||
}
|
||||
for (let i = 0; i < btnactsavedata.length; i++) {
|
||||
btnactsavedata[i].removeAttribute('disabled');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
templ ActionFormBahan(LinkClose string, targetClose string, hxSwapClose string, modalID string) {
|
||||
<div>
|
||||
<button
|
||||
hx-on::after-request={ JsHideModal(modalID) }
|
||||
hx-post={ LinkClose }
|
||||
hx-target={ targetClose }
|
||||
hx-swap={ hxSwapClose }
|
||||
hx-indicator=".cancelloading"
|
||||
type="button"
|
||||
class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnactcancel "
|
||||
data-dismiss="modal"
|
||||
>
|
||||
<span class="htmx-indicator spinner-border spinner-border-sm cancelloading" role="status" aria-hidden="true"></span>
|
||||
Batal
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-primary btn-shadow font-weight-bold rounded-lg btnactsavedata"
|
||||
>
|
||||
<span class="htmx-indicator spinner-border spinner-border-sm formloading" role="status" aria-hidden="true"></span>
|
||||
Simpan
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
|
||||
templ BtnCloseFormBahan(LinkClose string, targetClose string, hxSwapClose string, modalID string) {
|
||||
<button
|
||||
hx-post={ LinkClose }
|
||||
hx-target={ targetClose }
|
||||
hx-swap={ hxSwapClose }
|
||||
type="button"
|
||||
hx-on::after-request={ JsHideModal(modalID) }
|
||||
class="close btnactcancel"
|
||||
data-dismiss="modal"
|
||||
aria-label="Close"
|
||||
>
|
||||
<i aria-hidden="true" class="ki ki-close"></i>
|
||||
</button>
|
||||
}
|
||||
|
||||
templ DeleteConfirmationBody(inputId string,
|
||||
componentID string,
|
||||
message string,
|
||||
datHeader []string,
|
||||
dataText []string,
|
||||
hxOnLoad templ.ComponentScript) {
|
||||
<div id={ componentID } hx-on::load={ hxOnLoad }>
|
||||
<p>{ message }</p>
|
||||
<div class="card rounded-lg">
|
||||
<div class="card-body d-flex flex-row">
|
||||
<div class="d-flex flex-column">
|
||||
for _, v := range datHeader {
|
||||
<div class="mb-1 mt-1 text-disabled font-weight-bold mr-5">{ v }</div>
|
||||
}
|
||||
</div>
|
||||
<div class="d-flex flex-column ">
|
||||
for _, v := range dataText {
|
||||
<div class="mb-1 mt-1 font-weight-bold">
|
||||
{ v }
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{Name: "bahanid", ID: "bahanID", Type: "hidden", Value: inputId})
|
||||
</div>
|
||||
}
|
||||
|
||||
templ ActionFormBahanDelete(LinkClose string, targetClose string, hxSwapClose string, modalID string) {
|
||||
<div>
|
||||
<button
|
||||
hx-on::after-request={ JsHideModal(modalID) }
|
||||
hx-post={ LinkClose }
|
||||
hx-target={ targetClose }
|
||||
hx-swap={ hxSwapClose }
|
||||
hx-indicator=".cancelloading"
|
||||
type="button"
|
||||
class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnactcancel"
|
||||
data-dismiss="modal"
|
||||
>
|
||||
<span class="htmx-indicator spinner-border spinner-border-sm cancelloading" role="status" aria-hidden="true"></span>
|
||||
Batal
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-primary btn-shadow font-weight-bold rounded-lg btnactsavedata"
|
||||
>
|
||||
<span class="htmx-indicator spinner-border spinner-border-sm formloading" role="status" aria-hidden="true"></span>
|
||||
Yakin
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
654
views/dev/mdbahan/mdbahanformmodal_templ.go
Normal file
654
views/dev/mdbahan/mdbahanformmodal_templ.go
Normal file
@@ -0,0 +1,654 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.663
|
||||
package dev_mdbahanview
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import "context"
|
||||
import "io"
|
||||
import "bytes"
|
||||
|
||||
import "cpone/models"
|
||||
import "cpone/component/modal"
|
||||
import "cpone/component/customtextfield"
|
||||
import "cpone/component/customdropdown"
|
||||
|
||||
func BahanForm(data models.BahanFormComponent) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, HandleFormBeforeRequest(), HandleFormAfterRequest())
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<form id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(data.IDComponent)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahanformmodal.templ`, Line: 11, Col: 24}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-post=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(data.Link)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahanformmodal.templ`, Line: 12, Col: 22}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"form\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(data.HxTarget)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahanformmodal.templ`, Line: 14, Col: 28}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(data.HxSwap)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahanformmodal.templ`, Line: 15, Col: 24}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-include=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var6 string
|
||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(data.HxInclude)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahanformmodal.templ`, Line: 16, Col: 30}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-indicator=\".formloading\" hx-on::before-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var7 templ.ComponentScript = HandleFormBeforeRequest()
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var7.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::after-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var8 templ.ComponentScript = HandleFormAfterRequest()
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var8.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = modalcomponent.Modal(data.ModalID,
|
||||
data.ModalTitle,
|
||||
data.DialogBody,
|
||||
data.DialogAction,
|
||||
data.ButtonCLose).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</form></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func HandleFormBeforeRequest() templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_HandleFormBeforeRequest_2922`,
|
||||
Function: `function __templ_HandleFormBeforeRequest_2922(){console.log("handle disable btn add");
|
||||
const btnActCancel = document.querySelectorAll('.btnactcancel');
|
||||
const btnactsavedata = document.querySelectorAll('.btnactsavedata');
|
||||
|
||||
for (let i = 0; i < btnActCancel.length; i++) {
|
||||
btnActCancel[i].setAttribute('disabled', 'true');
|
||||
|
||||
}
|
||||
for (let i = 0; i < btnactsavedata.length; i++) {
|
||||
btnactsavedata[i].setAttribute('disabled', 'true');
|
||||
|
||||
}
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_HandleFormBeforeRequest_2922`),
|
||||
CallInline: templ.SafeScriptInline(`__templ_HandleFormBeforeRequest_2922`),
|
||||
}
|
||||
}
|
||||
|
||||
func HandleFormAfterRequest() templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_HandleFormAfterRequest_956b`,
|
||||
Function: `function __templ_HandleFormAfterRequest_956b(){console.log("handle enable btn add");
|
||||
|
||||
const btnactcancel = document.querySelectorAll('.btnactcancel');
|
||||
const btnactsavedata = document.querySelectorAll('.btnactsavedata');
|
||||
|
||||
|
||||
for (let i = 0; i < btnactcancel.length; i++) {
|
||||
btnactcancel[i].removeAttribute('disabled');
|
||||
|
||||
}
|
||||
for (let i = 0; i < btnactsavedata.length; i++) {
|
||||
btnactsavedata[i].removeAttribute('disabled');
|
||||
|
||||
}
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_HandleFormAfterRequest_956b`),
|
||||
CallInline: templ.SafeScriptInline(`__templ_HandleFormAfterRequest_956b`),
|
||||
}
|
||||
}
|
||||
|
||||
func BodyFormBahan(inputId string,
|
||||
inputCode models.CustomTextFieldv2Prm,
|
||||
inputName models.CustomTextFieldv2Prm,
|
||||
inputStation models.CustomDropdownV2Prm,
|
||||
componentID string,
|
||||
hxOnLoad templ.ComponentScript) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var9 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var9 == nil {
|
||||
templ_7745c5c3_Var9 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, hxOnLoad)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var10 string
|
||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(componentID)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahanformmodal.templ`, Line: 68, Col: 22}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::load=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var11 templ.ComponentScript = hxOnLoad
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var11.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{Name: "bahanid", ID: "bahanID", Type: "hidden", Value: inputId}).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(
|
||||
inputCode).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(
|
||||
inputName).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customdropdown.CustomDropdownForm(inputStation).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func JsHideModal(modalID string) templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_JsHideModal_da6c`,
|
||||
Function: `function __templ_JsHideModal_da6c(modalID){$(modalID).modal('hide')
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_JsHideModal_da6c`, modalID),
|
||||
CallInline: templ.SafeScriptInline(`__templ_JsHideModal_da6c`, modalID),
|
||||
}
|
||||
}
|
||||
|
||||
func JsShowModal(modalID string) templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_JsShowModal_b74d`,
|
||||
Function: `function __templ_JsShowModal_b74d(modalID){$(modalID).modal('show')
|
||||
const btnactcancel = document.querySelectorAll('.btnactcancel');
|
||||
const btnactsavedata = document.querySelectorAll('.btnactsavedata');
|
||||
|
||||
|
||||
for (let i = 0; i < btnactcancel.length; i++) {
|
||||
btnactcancel[i].removeAttribute('disabled');
|
||||
|
||||
}
|
||||
for (let i = 0; i < btnactsavedata.length; i++) {
|
||||
btnactsavedata[i].removeAttribute('disabled');
|
||||
|
||||
}
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_JsShowModal_b74d`, modalID),
|
||||
CallInline: templ.SafeScriptInline(`__templ_JsShowModal_b74d`, modalID),
|
||||
}
|
||||
}
|
||||
|
||||
func ActionFormBahan(LinkClose string, targetClose string, hxSwapClose string, modalID string) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var12 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var12 == nil {
|
||||
templ_7745c5c3_Var12 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, JsHideModal(modalID))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button hx-on::after-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var13 templ.ComponentScript = JsHideModal(modalID)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var13.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-post=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var14 string
|
||||
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(LinkClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahanformmodal.templ`, Line: 102, Col: 22}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var15 string
|
||||
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(targetClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahanformmodal.templ`, Line: 103, Col: 26}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var16 string
|
||||
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahanformmodal.templ`, Line: 104, Col: 24}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-indicator=\".cancelloading\" type=\"button\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnactcancel \" data-dismiss=\"modal\"><span class=\"htmx-indicator spinner-border spinner-border-sm cancelloading\" role=\"status\" aria-hidden=\"true\"></span> Batal\r</button> <button type=\"submit\" class=\"btn btn-primary btn-shadow font-weight-bold rounded-lg btnactsavedata\"><span class=\"htmx-indicator spinner-border spinner-border-sm formloading\" role=\"status\" aria-hidden=\"true\"></span> Simpan\r</button></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func BtnCloseFormBahan(LinkClose string, targetClose string, hxSwapClose string, modalID string) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var17 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var17 == nil {
|
||||
templ_7745c5c3_Var17 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, JsHideModal(modalID))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button hx-post=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var18 string
|
||||
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(LinkClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahanformmodal.templ`, Line: 125, Col: 21}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var19 string
|
||||
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(targetClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahanformmodal.templ`, Line: 126, Col: 25}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var20 string
|
||||
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahanformmodal.templ`, Line: 127, Col: 23}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" type=\"button\" hx-on::after-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var21 templ.ComponentScript = JsHideModal(modalID)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var21.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"close btnactcancel\" data-dismiss=\"modal\" aria-label=\"Close\"><i aria-hidden=\"true\" class=\"ki ki-close\"></i></button>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func DeleteConfirmationBody(inputId string,
|
||||
componentID string,
|
||||
message string,
|
||||
datHeader []string,
|
||||
dataText []string,
|
||||
hxOnLoad templ.ComponentScript) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var22 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var22 == nil {
|
||||
templ_7745c5c3_Var22 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, hxOnLoad)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var23 string
|
||||
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(componentID)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahanformmodal.templ`, Line: 144, Col: 22}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::load=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var24 templ.ComponentScript = hxOnLoad
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var24.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><p>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var25 string
|
||||
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(message)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahanformmodal.templ`, Line: 145, Col: 14}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</p><div class=\"card rounded-lg\"><div class=\"card-body d-flex flex-row\"><div class=\"d-flex flex-column\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, v := range datHeader {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"mb-1 mt-1 text-disabled font-weight-bold mr-5\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var26 string
|
||||
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(v)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahanformmodal.templ`, Line: 150, Col: 68}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div><div class=\"d-flex flex-column \">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, v := range dataText {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"mb-1 mt-1 font-weight-bold\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var27 string
|
||||
templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(v)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahanformmodal.templ`, Line: 156, Col: 10}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{Name: "bahanid", ID: "bahanID", Type: "hidden", Value: inputId}).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func ActionFormBahanDelete(LinkClose string, targetClose string, hxSwapClose string, modalID string) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var28 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var28 == nil {
|
||||
templ_7745c5c3_Var28 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, JsHideModal(modalID))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button hx-on::after-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var29 templ.ComponentScript = JsHideModal(modalID)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var29.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-post=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var30 string
|
||||
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(LinkClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahanformmodal.templ`, Line: 170, Col: 22}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var31 string
|
||||
templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(targetClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahanformmodal.templ`, Line: 171, Col: 26}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var32 string
|
||||
templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahanformmodal.templ`, Line: 172, Col: 24}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-indicator=\".cancelloading\" type=\"button\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnactcancel\" data-dismiss=\"modal\"><span class=\"htmx-indicator spinner-border spinner-border-sm cancelloading\" role=\"status\" aria-hidden=\"true\"></span> Batal\r</button> <button type=\"submit\" class=\"btn btn-primary btn-shadow font-weight-bold rounded-lg btnactsavedata\"><span class=\"htmx-indicator spinner-border spinner-border-sm formloading\" role=\"status\" aria-hidden=\"true\"></span> Yakin\r</button></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
130
views/dev/mdbahan/mdbahantable.templ
Normal file
130
views/dev/mdbahan/mdbahantable.templ
Normal file
@@ -0,0 +1,130 @@
|
||||
package dev_mdbahanview
|
||||
|
||||
import "cpone/component/table"
|
||||
import "cpone/models"
|
||||
import "strconv"
|
||||
|
||||
templ TableBahan(data []models.Bahan,
|
||||
tableID string,
|
||||
hxGetEdit string,
|
||||
hxTargetEdit string,
|
||||
hxSwapEdit string,
|
||||
hxIncludeEdit string,
|
||||
hxGetDelete string,
|
||||
hxTargetDelete string,
|
||||
hxSwapDelete string,
|
||||
hxIncludeDelete string,
|
||||
) {
|
||||
<div id={ tableID } hx-swap-oob="true">
|
||||
@tablecomponent.TableV3([]string{"KODE", "NAMA BAHAN", "SAMPLE STATION", "AKSI"},
|
||||
[]string{"20%", "30%", "30%", "20%"},
|
||||
RowBahan(data,
|
||||
hxGetEdit,
|
||||
hxTargetEdit,
|
||||
hxSwapEdit,
|
||||
hxIncludeEdit,
|
||||
hxGetDelete,
|
||||
hxTargetDelete,
|
||||
hxSwapDelete,
|
||||
hxIncludeDelete,
|
||||
))
|
||||
</div>
|
||||
}
|
||||
|
||||
templ RowBahan(data []models.Bahan,
|
||||
hxGetEdit string,
|
||||
hxTargetEdit string,
|
||||
hxSwapEdit string,
|
||||
hxIncludeEdit string,
|
||||
hxGetDelete string,
|
||||
hxTargetDelete string,
|
||||
hxSwapDelete string,
|
||||
hxIncludeDelete string,
|
||||
) {
|
||||
if len(data) == 0 {
|
||||
<tr>
|
||||
<td colspan="4" class="text-center">Data Tidak Ditemukan</td>
|
||||
</tr>
|
||||
}
|
||||
for _, v := range data {
|
||||
<tr>
|
||||
<td>{ v.T_BahanCode }</td>
|
||||
<td>{ v.T_BahanName }</td>
|
||||
<td>{ v.T_SampleStationName }</td>
|
||||
<td>
|
||||
@TableAction(v.T_BahanID,
|
||||
hxGetEdit,
|
||||
hxTargetEdit,
|
||||
hxSwapEdit,
|
||||
hxIncludeEdit,
|
||||
hxGetDelete,
|
||||
hxTargetDelete,
|
||||
hxSwapDelete,
|
||||
hxIncludeDelete,
|
||||
)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
|
||||
templ TableAction(
|
||||
id int,
|
||||
hxGetEdit string,
|
||||
hxTargetEdit string,
|
||||
hxSwapEdit string,
|
||||
hxIncludeEdit string,
|
||||
hxGetDelete string,
|
||||
hxTargetDelete string,
|
||||
hxSwapDelete string,
|
||||
hxIncludeDelete string,
|
||||
|
||||
) {
|
||||
<div class="row px-5 d-flex justify-content-around">
|
||||
<a
|
||||
type="button"
|
||||
class="btnactbhn col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-tosca mb-2 btn-sm"
|
||||
hx-get={ hxGetEdit + "?id=" + strconv.Itoa(id) }
|
||||
hx-target={ hxTargetEdit }
|
||||
hx-swap={ hxSwapEdit }
|
||||
hx-include={ hxIncludeEdit }
|
||||
hx-indicator={ "#spnredt" + strconv.Itoa(id) }
|
||||
hx-on::before-request={ HandleBeforeRequestRow(strconv.Itoa(id)) }
|
||||
hx-on::after-request={ HandleAfterRequestRow(strconv.Itoa(id)) }
|
||||
>
|
||||
<span id={ "spnredt" + strconv.Itoa(id) } class="htmx-indicator spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
Edit
|
||||
</a>
|
||||
<a
|
||||
type="button"
|
||||
class=" btnactbhn col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-danger mb-2 btn-sm"
|
||||
hx-get={ hxGetDelete + "?id=" + strconv.Itoa(id) }
|
||||
hx-target={ hxTargetDelete }
|
||||
hx-swap={ hxSwapDelete }
|
||||
hx-include={ hxIncludeDelete }
|
||||
hx-indicator={ "#spnrdel" + strconv.Itoa(id) }
|
||||
hx-on::before-request={ HandleBeforeRequestRow(strconv.Itoa(id)) }
|
||||
hx-on::after-request={ HandleAfterRequestRow(strconv.Itoa(id)) }
|
||||
>
|
||||
<span id={ "spnrdel" + strconv.Itoa(id) } class="htmx-indicator spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||
Hapus
|
||||
</a>
|
||||
</div>
|
||||
}
|
||||
|
||||
script HandleBeforeRequestRow(id string) {
|
||||
var cusid_ele = document.getElementsByClassName('btnactbhn');
|
||||
for (var i = 0; i < cusid_ele.length; ++i) {
|
||||
var item = cusid_ele[i];
|
||||
item.classList.add('disabled');
|
||||
}
|
||||
console.log(id)
|
||||
}
|
||||
|
||||
script HandleAfterRequestRow(id string) {
|
||||
var cusid_ele = document.getElementsByClassName('btnactbhn');
|
||||
for (var i = 0; i < cusid_ele.length; ++i) {
|
||||
var item = cusid_ele[i];
|
||||
item.classList.remove('disabled');
|
||||
}
|
||||
console.log(id)
|
||||
}
|
||||
451
views/dev/mdbahan/mdbahantable_templ.go
Normal file
451
views/dev/mdbahan/mdbahantable_templ.go
Normal file
@@ -0,0 +1,451 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.663
|
||||
package dev_mdbahanview
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import "context"
|
||||
import "io"
|
||||
import "bytes"
|
||||
|
||||
import "cpone/component/table"
|
||||
import "cpone/models"
|
||||
import "strconv"
|
||||
|
||||
func TableBahan(data []models.Bahan,
|
||||
tableID string,
|
||||
hxGetEdit string,
|
||||
hxTargetEdit string,
|
||||
hxSwapEdit string,
|
||||
hxIncludeEdit string,
|
||||
hxGetDelete string,
|
||||
hxTargetDelete string,
|
||||
hxSwapDelete string,
|
||||
hxIncludeDelete string,
|
||||
) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(tableID)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahantable.templ`, Line: 18, Col: 18}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap-oob=\"true\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = tablecomponent.TableV3([]string{"KODE", "NAMA BAHAN", "SAMPLE STATION", "AKSI"},
|
||||
[]string{"20%", "30%", "30%", "20%"},
|
||||
RowBahan(data,
|
||||
hxGetEdit,
|
||||
hxTargetEdit,
|
||||
hxSwapEdit,
|
||||
hxIncludeEdit,
|
||||
hxGetDelete,
|
||||
hxTargetDelete,
|
||||
hxSwapDelete,
|
||||
hxIncludeDelete,
|
||||
)).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func RowBahan(data []models.Bahan,
|
||||
hxGetEdit string,
|
||||
hxTargetEdit string,
|
||||
hxSwapEdit string,
|
||||
hxIncludeEdit string,
|
||||
hxGetDelete string,
|
||||
hxTargetDelete string,
|
||||
hxSwapDelete string,
|
||||
hxIncludeDelete string,
|
||||
) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var3 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var3 == nil {
|
||||
templ_7745c5c3_Var3 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
if len(data) == 0 {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<tr><td colspan=\"4\" class=\"text-center\">Data Tidak Ditemukan</td></tr>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
for _, v := range data {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<tr><td>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(v.T_BahanCode)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahantable.templ`, Line: 51, Col: 22}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</td><td>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(v.T_BahanName)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahantable.templ`, Line: 52, Col: 22}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</td><td>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var6 string
|
||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(v.T_SampleStationName)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahantable.templ`, Line: 53, Col: 30}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</td><td>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = TableAction(v.T_BahanID,
|
||||
hxGetEdit,
|
||||
hxTargetEdit,
|
||||
hxSwapEdit,
|
||||
hxIncludeEdit,
|
||||
hxGetDelete,
|
||||
hxTargetDelete,
|
||||
hxSwapDelete,
|
||||
hxIncludeDelete,
|
||||
).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</td></tr>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func TableAction(
|
||||
id int,
|
||||
hxGetEdit string,
|
||||
hxTargetEdit string,
|
||||
hxSwapEdit string,
|
||||
hxIncludeEdit string,
|
||||
hxGetDelete string,
|
||||
hxTargetDelete string,
|
||||
hxSwapDelete string,
|
||||
hxIncludeDelete string,
|
||||
|
||||
) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var7 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var7 == nil {
|
||||
templ_7745c5c3_Var7 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"row px-5 d-flex justify-content-around\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, HandleBeforeRequestRow(strconv.Itoa(id)), HandleAfterRequestRow(strconv.Itoa(id)))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a type=\"button\" class=\"btnactbhn col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-tosca mb-2 btn-sm\" hx-get=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var8 string
|
||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(hxGetEdit + "?id=" + strconv.Itoa(id))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahantable.templ`, Line: 86, Col: 49}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var9 string
|
||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetEdit)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahantable.templ`, Line: 87, Col: 27}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var10 string
|
||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapEdit)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahantable.templ`, Line: 88, Col: 23}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-include=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var11 string
|
||||
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(hxIncludeEdit)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahantable.templ`, Line: 89, Col: 29}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-indicator=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var12 string
|
||||
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs("#spnredt" + strconv.Itoa(id))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahantable.templ`, Line: 90, Col: 47}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::before-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var13 templ.ComponentScript = HandleBeforeRequestRow(strconv.Itoa(id))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var13.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::after-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var14 templ.ComponentScript = HandleAfterRequestRow(strconv.Itoa(id))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var14.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><span id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var15 string
|
||||
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs("spnredt" + strconv.Itoa(id))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahantable.templ`, Line: 94, Col: 42}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"htmx-indicator spinner-border spinner-border-sm\" role=\"status\" aria-hidden=\"true\"></span> Edit\r</a> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, HandleBeforeRequestRow(strconv.Itoa(id)), HandleAfterRequestRow(strconv.Itoa(id)))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a type=\"button\" class=\" btnactbhn col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-danger mb-2 btn-sm\" hx-get=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var16 string
|
||||
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(hxGetDelete + "?id=" + strconv.Itoa(id))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahantable.templ`, Line: 100, Col: 51}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var17 string
|
||||
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetDelete)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahantable.templ`, Line: 101, Col: 29}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var18 string
|
||||
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapDelete)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahantable.templ`, Line: 102, Col: 25}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-include=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var19 string
|
||||
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(hxIncludeDelete)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahantable.templ`, Line: 103, Col: 31}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-indicator=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var20 string
|
||||
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs("#spnrdel" + strconv.Itoa(id))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahantable.templ`, Line: 104, Col: 47}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::before-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var21 templ.ComponentScript = HandleBeforeRequestRow(strconv.Itoa(id))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var21.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-on::after-request=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var22 templ.ComponentScript = HandleAfterRequestRow(strconv.Itoa(id))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var22.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><span id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var23 string
|
||||
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs("spnrdel" + strconv.Itoa(id))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdbahan\mdbahantable.templ`, Line: 108, Col: 42}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"htmx-indicator spinner-border spinner-border-sm\" role=\"status\" aria-hidden=\"true\"></span> Hapus\r</a></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func HandleBeforeRequestRow(id string) templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_HandleBeforeRequestRow_7d4f`,
|
||||
Function: `function __templ_HandleBeforeRequestRow_7d4f(id){var cusid_ele = document.getElementsByClassName('btnactbhn');
|
||||
for (var i = 0; i < cusid_ele.length; ++i) {
|
||||
var item = cusid_ele[i];
|
||||
item.classList.add('disabled');
|
||||
}
|
||||
console.log(id)
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_HandleBeforeRequestRow_7d4f`, id),
|
||||
CallInline: templ.SafeScriptInline(`__templ_HandleBeforeRequestRow_7d4f`, id),
|
||||
}
|
||||
}
|
||||
|
||||
func HandleAfterRequestRow(id string) templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_HandleAfterRequestRow_ce9e`,
|
||||
Function: `function __templ_HandleAfterRequestRow_ce9e(id){var cusid_ele = document.getElementsByClassName('btnactbhn');
|
||||
for (var i = 0; i < cusid_ele.length; ++i) {
|
||||
var item = cusid_ele[i];
|
||||
item.classList.remove('disabled');
|
||||
}
|
||||
console.log(id)
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_HandleAfterRequestRow_ce9e`, id),
|
||||
CallInline: templ.SafeScriptInline(`__templ_HandleAfterRequestRow_ce9e`, id),
|
||||
}
|
||||
}
|
||||
@@ -153,8 +153,26 @@ templ CssMdGroupResult() {
|
||||
#title {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.dropdown-menu{
|
||||
transform: translate3d(0px, 35px, 0px)!important;
|
||||
transform: translate3d(0px, 0px, 0px)!important;
|
||||
}
|
||||
|
||||
.filter-option-inner-inner {
|
||||
margin-top: 1.2vh;
|
||||
color: var(--text-disabled);
|
||||
}
|
||||
|
||||
.bootstrap-select > .dropdown-toggle.bs-placeholder.btn {
|
||||
color: var(--text-disabled);
|
||||
}
|
||||
|
||||
.bootstrap-select.btn-group .dropdown-menu {
|
||||
min-width: 100%;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
position: sticky;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -321,7 +321,7 @@ func CssMdGroupResult() templ.Component {
|
||||
templ_7745c5c3_Var10 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<link rel=\"stylesheet\" href=\"assets/css/googlefont/poppins.css\"><link rel=\"stylesheet\" href=\"assets/css/googlefont/publicsans.css\"><link rel=\"stylesheet\" href=\"assets/css/googlefont/roboto.css\"><style>\r\n body {\r\n background-color: white;\r\n /* padding-right: 100px;\r\n padding-left: 100px; */\r\n }\r\n #div-chart {\r\n /* overflow-x: scroll; */\r\n margin: 40px 10vw 40px 10vw;\r\n }\r\n .title {\r\n font-size:20px;\r\n font-weight: bold;\r\n }\r\n #title {\r\n font-weight: 600;\r\n }\r\n .dropdown-menu{\r\n\t\ttransform: translate3d(0px, 35px, 0px)!important;\r\n\t}\r\n \r\n</style>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<link rel=\"stylesheet\" href=\"assets/css/googlefont/poppins.css\"><link rel=\"stylesheet\" href=\"assets/css/googlefont/publicsans.css\"><link rel=\"stylesheet\" href=\"assets/css/googlefont/roboto.css\"><style>\r\n body {\r\n background-color: white;\r\n /* padding-right: 100px;\r\n padding-left: 100px; */\r\n }\r\n #div-chart {\r\n /* overflow-x: scroll; */\r\n margin: 40px 10vw 40px 10vw;\r\n }\r\n .title {\r\n font-size:20px;\r\n font-weight: bold;\r\n }\r\n #title {\r\n font-weight: 600;\r\n }\r\n\t\r\n .dropdown-menu{\r\n\t\ttransform: translate3d(0px, 0px, 0px)!important;\r\n\t}\r\n\r\n\t.filter-option-inner-inner {\r\n\t\tmargin-top: 1.2vh;\r\n\t\tcolor: var(--text-disabled);\r\n\t}\r\n\r\n\t.bootstrap-select > .dropdown-toggle.bs-placeholder.btn {\r\n\t\tcolor: var(--text-disabled);\r\n\t}\r\n\r\n\t.bootstrap-select.btn-group .dropdown-menu {\r\n\tmin-width: 100%;\r\n\t-webkit-box-sizing: border-box;\r\n\t-moz-box-sizing: border-box;\r\n\tbox-sizing: border-box;\r\n\tposition: sticky;\r\n\t}\r\n \r\n</style>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
@@ -75,8 +75,10 @@ templ BodyFormGroupResult(inputId models.CustomTextFieldv2Prm,
|
||||
inputGrName)
|
||||
@customcheckbox.MainCustomCheckboxInput(
|
||||
checkboxGrFlagPerTest)
|
||||
<div class="mt-5"></div>
|
||||
@customcheckbox.MainCustomCheckboxInput(
|
||||
checkboxGrFlagNonLab)
|
||||
<div class="mt-5"></div>
|
||||
@customdropdown.MainCustomDropdownInput(
|
||||
dropdownGrResumeMcu,
|
||||
listItem)
|
||||
|
||||
@@ -252,11 +252,19 @@ func BodyFormGroupResult(inputId models.CustomTextFieldv2Prm,
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"mt-5\"></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customcheckbox.MainCustomCheckboxInput(
|
||||
checkboxGrFlagNonLab).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"mt-5\"></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customdropdown.MainCustomDropdownInput(
|
||||
dropdownGrResumeMcu,
|
||||
listItem).Render(ctx, templ_7745c5c3_Buffer)
|
||||
@@ -343,7 +351,7 @@ func ActionFormGroupResult(LinkClose string, targetClose string, hxSwapClose str
|
||||
var templ_7745c5c3_Var14 string
|
||||
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(LinkClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 116, Col: 22}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 118, Col: 22}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -356,7 +364,7 @@ func ActionFormGroupResult(LinkClose string, targetClose string, hxSwapClose str
|
||||
var templ_7745c5c3_Var15 string
|
||||
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(targetClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 117, Col: 26}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 119, Col: 26}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -369,7 +377,7 @@ func ActionFormGroupResult(LinkClose string, targetClose string, hxSwapClose str
|
||||
var templ_7745c5c3_Var16 string
|
||||
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 118, Col: 24}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 120, Col: 24}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -410,7 +418,7 @@ func BtnCloseFormGroupResult(LinkClose string, targetClose string, hxSwapClose s
|
||||
var templ_7745c5c3_Var18 string
|
||||
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(LinkClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 139, Col: 21}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 141, Col: 21}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -423,7 +431,7 @@ func BtnCloseFormGroupResult(LinkClose string, targetClose string, hxSwapClose s
|
||||
var templ_7745c5c3_Var19 string
|
||||
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(targetClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 140, Col: 25}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 142, Col: 25}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -436,7 +444,7 @@ func BtnCloseFormGroupResult(LinkClose string, targetClose string, hxSwapClose s
|
||||
var templ_7745c5c3_Var20 string
|
||||
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 141, Col: 23}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 143, Col: 23}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -491,7 +499,7 @@ func DeleteConfirmationBodyGroupResult(inputId models.CustomTextFieldv2Prm,
|
||||
var templ_7745c5c3_Var23 string
|
||||
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(componentID)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 158, Col: 22}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 160, Col: 22}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -513,7 +521,7 @@ func DeleteConfirmationBodyGroupResult(inputId models.CustomTextFieldv2Prm,
|
||||
var templ_7745c5c3_Var25 string
|
||||
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(message)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 159, Col: 14}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 161, Col: 14}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -531,7 +539,7 @@ func DeleteConfirmationBodyGroupResult(inputId models.CustomTextFieldv2Prm,
|
||||
var templ_7745c5c3_Var26 string
|
||||
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(v)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 164, Col: 68}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 166, Col: 68}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -554,7 +562,7 @@ func DeleteConfirmationBodyGroupResult(inputId models.CustomTextFieldv2Prm,
|
||||
var templ_7745c5c3_Var27 string
|
||||
templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(v)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 170, Col: 10}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 172, Col: 10}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -621,7 +629,7 @@ func ActionFormGroupResultDelete(LinkClose string, targetClose string, hxSwapClo
|
||||
var templ_7745c5c3_Var30 string
|
||||
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(LinkClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 184, Col: 22}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 186, Col: 22}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -634,7 +642,7 @@ func ActionFormGroupResultDelete(LinkClose string, targetClose string, hxSwapClo
|
||||
var templ_7745c5c3_Var31 string
|
||||
templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(targetClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 185, Col: 26}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 187, Col: 26}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -647,7 +655,7 @@ func ActionFormGroupResultDelete(LinkClose string, targetClose string, hxSwapClo
|
||||
var templ_7745c5c3_Var32 string
|
||||
templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapClose)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 186, Col: 24}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresultformmodal.templ`, Line: 188, Col: 24}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
|
||||
@@ -1,280 +0,0 @@
|
||||
package dev_xsampleautocomplete
|
||||
|
||||
import (
|
||||
"cpone/layout"
|
||||
"cpone/models"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
templ EmptyDiv1() {
|
||||
<div></div>
|
||||
}
|
||||
|
||||
templ Selected(data []models.XsampleT_Test) {
|
||||
if len(data) > 0 {
|
||||
for _, v := range data {
|
||||
<span class="badge badge-primary">
|
||||
{ v.T_TestCode } - { v.T_TestName }
|
||||
<span class="badge badge-light ml-1" style="cursor: pointer;">×</span>
|
||||
</span>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
templ ListData(dataList []models.XsampleT_Test) {
|
||||
if len(dataList) > 0 {
|
||||
<div class="dropdown-menu show" id="dropdown-menu" hx-swap-oob="true">
|
||||
for _, v := range dataList {
|
||||
<a class="dropdown-item" data-id={ strconv.Itoa(v.T_TestID) } onclick="selectItem(this)">{ v.T_TestCode } - { v.T_TestName }</a>
|
||||
}
|
||||
</div>
|
||||
} else {
|
||||
<div class="dropdown-menu" id="dropdown-menu" hx-swap-oob="true">
|
||||
<a class="dropdown-item" data-id="" onclick="">Tidak Ada Data</a>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
templ MainAutoComplete() {
|
||||
<div class="container mt-5">
|
||||
<h2>Typeahead Example with HTMX</h2>
|
||||
<input type="text" name="selectedvalue"/>
|
||||
<div class="dropdown">
|
||||
<input
|
||||
type="text"
|
||||
id="search-inputx"
|
||||
name="query"
|
||||
placeholder="Search for a state..."
|
||||
hx-get="/dev/searchautocompletev1"
|
||||
hx-trigger="input changed delay:300ms, focus from:search-inputx"
|
||||
hx-target="#dropdown-menu"
|
||||
hx-indicator="#loading-indicator"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="false"
|
||||
autocomplete="off"
|
||||
hx-include="[name='selectedvalue']"
|
||||
class="form-control"
|
||||
/>
|
||||
<div id="loading-indicator" style="display:none;">
|
||||
<div class="spinner-border text-primary" role="status">
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dropdown-menu" id="dropdown-menu"></div>
|
||||
</div>
|
||||
<div class="badge-container form-control"></div>
|
||||
</div>
|
||||
@JsCustomAutoComplete()
|
||||
}
|
||||
|
||||
templ TemplJsAutoComplete() {
|
||||
}
|
||||
|
||||
script JsCustomAutoComplete() {
|
||||
let selectedItems = [];
|
||||
|
||||
function selectItem(element) {
|
||||
var container = document.querySelector('.badge-container');
|
||||
|
||||
// Get the selected item text and id
|
||||
var itemText = element.textContent;
|
||||
var itemId = element.getAttribute('data-id');
|
||||
|
||||
// Check if the item is already selected
|
||||
if (selectedItems.some(item => item.id === itemId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add the item to the selected items list
|
||||
selectedItems.push({ id: itemId, name: itemText });
|
||||
|
||||
// Create a badge element
|
||||
var badge = document.createElement('span');
|
||||
badge.className = 'badge badge-primary';
|
||||
badge.textContent = itemText;
|
||||
|
||||
// Create a close button
|
||||
var closeBtn = document.createElement('span');
|
||||
closeBtn.className = 'badge badge-light ml-1';
|
||||
closeBtn.style.cursor = 'pointer';
|
||||
closeBtn.textContent = '×';
|
||||
closeBtn.onclick = function() {
|
||||
container.removeChild(badge);
|
||||
selectedItems = selectedItems.filter(item => item.id !== itemId);
|
||||
updateQueryParameter();
|
||||
};
|
||||
|
||||
// Append close button to badge
|
||||
badge.appendChild(closeBtn);
|
||||
|
||||
// Append the badge to the container
|
||||
container.appendChild(badge);
|
||||
|
||||
// Clear the input
|
||||
document.getElementById('search-inputx').value = '';
|
||||
|
||||
// Hide dropdown
|
||||
document.getElementById('dropdown-menu').classList.remove('show');
|
||||
|
||||
// Highlight the selected item in the dropdown
|
||||
element.classList.add('selected');
|
||||
|
||||
// Update query parameter
|
||||
updateQueryParameter();
|
||||
}
|
||||
|
||||
function updateQueryParameter() {
|
||||
var selectedValues = selectedItems.map(item => item.id).join(',');
|
||||
document.querySelector('input[name="selectedvalue"]').value = selectedValues;
|
||||
}
|
||||
|
||||
// Display loading indicator when request is in progress
|
||||
document.body.addEventListener('htmx:configRequest', function(event) {
|
||||
document.getElementById('loading-indicator').style.display = 'block';
|
||||
});
|
||||
|
||||
document.body.addEventListener('htmx:afterOnLoad', function(event) {
|
||||
document.getElementById('loading-indicator').style.display = 'none';
|
||||
var dropdown = document.getElementById('dropdown-menu');
|
||||
if (dropdown.children.length > 0) {
|
||||
dropdown.classList.add('show');
|
||||
dropdown.focus();
|
||||
var activeItem = dropdown.querySelector('.active');
|
||||
if (activeItem) {
|
||||
dropdown.scrollTop = activeItem.offsetTop - dropdown.offsetTop;
|
||||
}
|
||||
} else {
|
||||
dropdown.classList.remove('show');
|
||||
}
|
||||
});
|
||||
|
||||
// Hide the dropdown when clicking outside
|
||||
document.addEventListener('click', function(event) {
|
||||
var isClickInside = event.target.classList.contains('search-input') || event.target.classList.contains('badge-container') || event.target.closest('.badge-container');
|
||||
if (!isClickInside) {
|
||||
document.getElementById('dropdown-menu').classList.remove('show');
|
||||
}
|
||||
});
|
||||
|
||||
// Handle keyboard navigation
|
||||
document.getElementById('search-inputx').addEventListener('keydown', function(event) {
|
||||
var dropdownMenu = document.getElementById('dropdown-menu');
|
||||
var items = dropdownMenu.querySelectorAll('.dropdown-item');
|
||||
var activeItem = dropdownMenu.querySelector('.active');
|
||||
|
||||
if (event.key === 'ArrowDown') {
|
||||
event.preventDefault(); // Prevent page scroll
|
||||
if (!activeItem) {
|
||||
items[0].classList.add('active');
|
||||
} else {
|
||||
activeItem.classList.remove('active');
|
||||
var next = activeItem.nextElementSibling;
|
||||
if (next) {
|
||||
next.classList.add('active');
|
||||
} else {
|
||||
items[0].classList.add('active');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.key === 'ArrowUp') {
|
||||
event.preventDefault(); // Prevent page scroll
|
||||
if (!activeItem) {
|
||||
items[items.length - 1].classList.add('active');
|
||||
} else {
|
||||
activeItem.classList.remove('active');
|
||||
var prev = activeItem.previousElementSibling;
|
||||
if (prev) {
|
||||
prev.classList.add('active');
|
||||
} else {
|
||||
items[items.length - 1].classList.add('active');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.key === 'Enter' && activeItem) {
|
||||
selectItem(activeItem);
|
||||
}
|
||||
|
||||
if (activeItem) {
|
||||
dropdownMenu.scrollTop = activeItem.offsetTop - dropdownMenu.offsetTop;
|
||||
}
|
||||
});
|
||||
|
||||
// Set the input value and hide the dropdown when an item is clicked
|
||||
document.body.addEventListener('click', function(event) {
|
||||
if (event.target.classList.contains('dropdown-item')) {
|
||||
selectItem(event.target);
|
||||
}
|
||||
});
|
||||
|
||||
// Show dropdown when input gets focus and has value
|
||||
document.getElementById('search-inputx').addEventListener('focus', function(event) {
|
||||
var input = event.target;
|
||||
var dropdown = document.getElementById('dropdown-menu');
|
||||
if (input.value.length > 0) {
|
||||
dropdown.classList.add('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
templ CssXsampleAutoComplete() {
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="assets/css/googlefont/poppins.css"
|
||||
/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="assets/css/googlefont/publicsans.css"
|
||||
/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="assets/css/googlefont/roboto.css"
|
||||
/>
|
||||
<style>
|
||||
body {
|
||||
background-color: white;
|
||||
/* padding-right: 100px;
|
||||
padding-left: 100px; */
|
||||
}
|
||||
.dropdown-menu {
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
width: 100%; /* Ensure the dropdown menu width matches the input width */
|
||||
}
|
||||
.dropdown-menu.show {
|
||||
display: block; /* Ensure the dropdown menu is displayed */
|
||||
}
|
||||
.spinner-border {
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
}
|
||||
.badge-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.badge-container .badge {
|
||||
margin: 2px;
|
||||
}
|
||||
.badge-container input {
|
||||
border: none;
|
||||
outline: none;
|
||||
flex-grow: 1;
|
||||
}
|
||||
.dropdown-item.active {
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
}
|
||||
|
||||
templ ShowXSampleScreen(title string, cmp templ.Component, css templ.Component, js templ.Component,
|
||||
navbarmenu templ.Component,
|
||||
navbaruser templ.Component,
|
||||
userprofile templ.Component) {
|
||||
@layout.CorporateLayout(title, css, js, navbarmenu, navbaruser, userprofile) {
|
||||
@cmp
|
||||
}
|
||||
}
|
||||
@@ -1,443 +0,0 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.663
|
||||
package dev_xsampleautocomplete
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import "context"
|
||||
import "io"
|
||||
import "bytes"
|
||||
|
||||
import (
|
||||
"cpone/layout"
|
||||
"cpone/models"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func EmptyDiv1() templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func Selected(data []models.XsampleT_Test) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var2 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var2 == nil {
|
||||
templ_7745c5c3_Var2 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
if len(data) > 0 {
|
||||
for _, v := range data {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<span class=\"badge badge-primary\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(v.T_TestCode)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\xsampleautocomplete\xsampleautocomplete.templ`, Line: 17, Col: 18}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" - ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(v.T_TestName)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\xsampleautocomplete\xsampleautocomplete.templ`, Line: 17, Col: 37}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" <span class=\"badge badge-light ml-1\" style=\"cursor: pointer;\">×</span></span>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func ListData(dataList []models.XsampleT_Test) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var5 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var5 == nil {
|
||||
templ_7745c5c3_Var5 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
if len(dataList) > 0 {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"dropdown-menu show\" id=\"dropdown-menu\" hx-swap-oob=\"true\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, v := range dataList {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a class=\"dropdown-item\" data-id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var6 string
|
||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(v.T_TestID))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\xsampleautocomplete\xsampleautocomplete.templ`, Line: 28, Col: 63}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" onclick=\"selectItem(this)\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var7 string
|
||||
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(v.T_TestCode)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\xsampleautocomplete\xsampleautocomplete.templ`, Line: 28, Col: 107}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" - ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var8 string
|
||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(v.T_TestName)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\xsampleautocomplete\xsampleautocomplete.templ`, Line: 28, Col: 126}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</a>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"dropdown-menu\" id=\"dropdown-menu\" hx-swap-oob=\"true\"><a class=\"dropdown-item\" data-id=\"\" onclick=\"\">Tidak Ada Data</a></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func MainAutoComplete() templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var9 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var9 == nil {
|
||||
templ_7745c5c3_Var9 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"container mt-5\"><h2>Typeahead Example with HTMX</h2><input type=\"text\" name=\"selectedvalue\"><div class=\"dropdown\"><input type=\"text\" id=\"search-inputx\" name=\"query\" placeholder=\"Search for a state...\" hx-get=\"/dev/searchautocompletev1\" hx-trigger=\"input changed delay:300ms, focus from:search-inputx\" hx-target=\"#dropdown-menu\" hx-indicator=\"#loading-indicator\" aria-haspopup=\"true\" aria-expanded=\"false\" autocomplete=\"off\" hx-include=\"[name='selectedvalue']\" class=\"form-control\"><div id=\"loading-indicator\" style=\"display:none;\"><div class=\"spinner-border text-primary\" role=\"status\"><span class=\"sr-only\">Loading...</span></div></div><div class=\"dropdown-menu\" id=\"dropdown-menu\"></div></div><div class=\"badge-container form-control\"></div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = JsCustomAutoComplete().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func TemplJsAutoComplete() templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var10 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var10 == nil {
|
||||
templ_7745c5c3_Var10 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func JsCustomAutoComplete() templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_JsCustomAutoComplete_4b2e`,
|
||||
Function: `function __templ_JsCustomAutoComplete_4b2e(){let selectedItems = [];
|
||||
|
||||
function selectItem(element) {
|
||||
var container = document.querySelector('.badge-container');
|
||||
|
||||
// Get the selected item text and id
|
||||
var itemText = element.textContent;
|
||||
var itemId = element.getAttribute('data-id');
|
||||
|
||||
// Check if the item is already selected
|
||||
if (selectedItems.some(item => item.id === itemId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add the item to the selected items list
|
||||
selectedItems.push({ id: itemId, name: itemText });
|
||||
|
||||
// Create a badge element
|
||||
var badge = document.createElement('span');
|
||||
badge.className = 'badge badge-primary';
|
||||
badge.textContent = itemText;
|
||||
|
||||
// Create a close button
|
||||
var closeBtn = document.createElement('span');
|
||||
closeBtn.className = 'badge badge-light ml-1';
|
||||
closeBtn.style.cursor = 'pointer';
|
||||
closeBtn.textContent = '×';
|
||||
closeBtn.onclick = function() {
|
||||
container.removeChild(badge);
|
||||
selectedItems = selectedItems.filter(item => item.id !== itemId);
|
||||
updateQueryParameter();
|
||||
};
|
||||
|
||||
// Append close button to badge
|
||||
badge.appendChild(closeBtn);
|
||||
|
||||
// Append the badge to the container
|
||||
container.appendChild(badge);
|
||||
|
||||
// Clear the input
|
||||
document.getElementById('search-inputx').value = '';
|
||||
|
||||
// Hide dropdown
|
||||
document.getElementById('dropdown-menu').classList.remove('show');
|
||||
|
||||
// Highlight the selected item in the dropdown
|
||||
element.classList.add('selected');
|
||||
|
||||
// Update query parameter
|
||||
updateQueryParameter();
|
||||
}
|
||||
|
||||
function updateQueryParameter() {
|
||||
var selectedValues = selectedItems.map(item => item.id).join(',');
|
||||
document.querySelector('input[name="selectedvalue"]').value = selectedValues;
|
||||
}
|
||||
|
||||
// Display loading indicator when request is in progress
|
||||
document.body.addEventListener('htmx:configRequest', function(event) {
|
||||
document.getElementById('loading-indicator').style.display = 'block';
|
||||
});
|
||||
|
||||
document.body.addEventListener('htmx:afterOnLoad', function(event) {
|
||||
document.getElementById('loading-indicator').style.display = 'none';
|
||||
var dropdown = document.getElementById('dropdown-menu');
|
||||
if (dropdown.children.length > 0) {
|
||||
dropdown.classList.add('show');
|
||||
dropdown.focus();
|
||||
var activeItem = dropdown.querySelector('.active');
|
||||
if (activeItem) {
|
||||
dropdown.scrollTop = activeItem.offsetTop - dropdown.offsetTop;
|
||||
}
|
||||
} else {
|
||||
dropdown.classList.remove('show');
|
||||
}
|
||||
});
|
||||
|
||||
// Hide the dropdown when clicking outside
|
||||
document.addEventListener('click', function(event) {
|
||||
var isClickInside = event.target.classList.contains('search-input') || event.target.classList.contains('badge-container') || event.target.closest('.badge-container');
|
||||
if (!isClickInside) {
|
||||
document.getElementById('dropdown-menu').classList.remove('show');
|
||||
}
|
||||
});
|
||||
|
||||
// Handle keyboard navigation
|
||||
document.getElementById('search-inputx').addEventListener('keydown', function(event) {
|
||||
var dropdownMenu = document.getElementById('dropdown-menu');
|
||||
var items = dropdownMenu.querySelectorAll('.dropdown-item');
|
||||
var activeItem = dropdownMenu.querySelector('.active');
|
||||
|
||||
if (event.key === 'ArrowDown') {
|
||||
event.preventDefault(); // Prevent page scroll
|
||||
if (!activeItem) {
|
||||
items[0].classList.add('active');
|
||||
} else {
|
||||
activeItem.classList.remove('active');
|
||||
var next = activeItem.nextElementSibling;
|
||||
if (next) {
|
||||
next.classList.add('active');
|
||||
} else {
|
||||
items[0].classList.add('active');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.key === 'ArrowUp') {
|
||||
event.preventDefault(); // Prevent page scroll
|
||||
if (!activeItem) {
|
||||
items[items.length - 1].classList.add('active');
|
||||
} else {
|
||||
activeItem.classList.remove('active');
|
||||
var prev = activeItem.previousElementSibling;
|
||||
if (prev) {
|
||||
prev.classList.add('active');
|
||||
} else {
|
||||
items[items.length - 1].classList.add('active');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.key === 'Enter' && activeItem) {
|
||||
selectItem(activeItem);
|
||||
}
|
||||
|
||||
if (activeItem) {
|
||||
dropdownMenu.scrollTop = activeItem.offsetTop - dropdownMenu.offsetTop;
|
||||
}
|
||||
});
|
||||
|
||||
// Set the input value and hide the dropdown when an item is clicked
|
||||
document.body.addEventListener('click', function(event) {
|
||||
if (event.target.classList.contains('dropdown-item')) {
|
||||
selectItem(event.target);
|
||||
}
|
||||
});
|
||||
|
||||
// Show dropdown when input gets focus and has value
|
||||
document.getElementById('search-inputx').addEventListener('focus', function(event) {
|
||||
var input = event.target;
|
||||
var dropdown = document.getElementById('dropdown-menu');
|
||||
if (input.value.length > 0) {
|
||||
dropdown.classList.add('show');
|
||||
}
|
||||
});
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_JsCustomAutoComplete_4b2e`),
|
||||
CallInline: templ.SafeScriptInline(`__templ_JsCustomAutoComplete_4b2e`),
|
||||
}
|
||||
}
|
||||
|
||||
func CssXsampleAutoComplete() templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var11 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var11 == nil {
|
||||
templ_7745c5c3_Var11 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<link rel=\"stylesheet\" href=\"assets/css/googlefont/poppins.css\"><link rel=\"stylesheet\" href=\"assets/css/googlefont/publicsans.css\"><link rel=\"stylesheet\" href=\"assets/css/googlefont/roboto.css\"><style>\r\n body {\r\n background-color: white;\r\n /* padding-right: 100px;\r\n padding-left: 100px; */\r\n }\r\n .dropdown-menu {\r\n max-height: 200px;\r\n overflow-y: auto;\r\n width: 100%; /* Ensure the dropdown menu width matches the input width */\r\n }\r\n .dropdown-menu.show {\r\n display: block; /* Ensure the dropdown menu is displayed */\r\n }\r\n .spinner-border {\r\n width: 2rem;\r\n height: 2rem;\r\n }\r\n .badge-container {\r\n display: flex;\r\n flex-wrap: wrap;\r\n align-items: center;\r\n margin-top: 10px;\r\n }\r\n .badge-container .badge {\r\n margin: 2px;\r\n }\r\n .badge-container input {\r\n border: none;\r\n outline: none;\r\n flex-grow: 1;\r\n }\r\n .dropdown-item.active {\r\n background-color: #007bff;\r\n color: white;\r\n }\r\n</style>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func ShowXSampleScreen(title string, cmp templ.Component, css templ.Component, js templ.Component,
|
||||
navbarmenu templ.Component,
|
||||
navbaruser templ.Component,
|
||||
userprofile templ.Component) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var12 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var12 == nil {
|
||||
templ_7745c5c3_Var12 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Var13 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
templ_7745c5c3_Err = cmp.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, navbarmenu, navbaruser, userprofile).Render(templ.WithChildren(ctx, templ_7745c5c3_Var13), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user