Compare commits

..

1 Commits

Author SHA1 Message Date
sindhu
7a93a4994a toast handle error dan toast show in input search 2024-05-16 17:20:23 +07:00
106 changed files with 1328 additions and 24417 deletions

View File

@@ -94,48 +94,6 @@ License: You must have a valid license purchased only from themeforest(the above
>
<!--begin::Main-->
<div class="d-flex flex-column flex-root bg-white">
<div
id="notification-001"
class="toast toast-top-right toas fade show"
role="alert"
aria-live="assertive"
aria-atomic="true"
hx-swap-oob="true"
style="margin-top: 2vh; margin-right: 2vw;"
>
<div class="toast-header bg-success text-white">
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
aria-hidden="true"
role="img"
class="iconify iconify--ep mr-2 icon-xl"
width="1em"
height="1em"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 1024 1024"
data-icon="ep:success-filled"
>
<path
fill="currentColor"
d="M512 64a448 448 0 1 1 0 896a448 448 0 0 1 0-896m-55.808 536.384l-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
></path>
</svg>
<strong class="mr-auto">Success</strong>
<small class="text-muted text-white">just now</small>
<button
type="button"
class="ml-2 mb-1 close"
data-dismiss="toast"
aria-label="Close"
>
<span aria-hidden="true">×</span>
</button>
</div>
<div class="toast-body bg-success-transparent">
This is a success toast.
</div>
</div>
<!-- begin::Navbar -->
<div
class="d-flex flex-lg-row justify-content-between py-5"

View File

@@ -92,7 +92,6 @@
hx-on::reponse-error="cobaerror()"
hx-on::send-error="cobaerror()"
id="kt_form_1"
hx-include="#cobaid, #test"
>
<div id="change">
<div class="form-group">
@@ -132,23 +131,7 @@
submit
</button>
</form>
<input
id="cobaid"
name="cobaid"
type="hidden"
placeholder="coba"
value="1"
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
/>
</div>
<input
id="test"
name="paginat"
type="hidden"
placeholder="coba"
value="2"
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
/>
<div id="testttt" class="p-6" hx-swap-oob="#testttt">
;adkj;djf;
@@ -161,21 +144,6 @@
>
Show live toast
</button>
<input
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
type="text"
name="search"
id="searchsas5b2f51246d4698262a5b7c241dd59884"
placeholder="Cari Kode/Nama"
hx-get="http://google.com"
hx-trigger="input changed delay:500ms, search"
hx-target="#cobakeyup"
hx-indicator=""
value=""
hx-include="#cobaid"
hx-swap="outerHTML"
autocomplete="off"
/>
<div
class="position-fixed bottom-0 right-0 p-3"
@@ -207,43 +175,6 @@
</div>
</div>
</div>
<div id="cobakeyup"></div>
<div class="card card-custom">
<div class="card-header">
<div class="card-title">
<h3 class="card-label">Card Blocking</h3>
</div>
</div>
<div class="card-body">
<div class="overlay-wrapper">
<div class="form-group">
<label>Address Line 1</label>
<input
type="text"
class="form-control form-control-solid form-control-lg"
name="address1"
placeholder="Address Line 1"
/>
<span class="form-text text-muted">Please enter your Address.</span>
</div>
<div class="form-group">
<label>Address Line 2</label>
<input
type="text"
class="form-control form-control-solid form-control-lg"
name="address1"
placeholder="Address Line 1"
/>
<span class="form-text text-muted"
>Please enter your Address 2.</span
>
</div>
</div>
</div>
<div class="overlay-layer bg-dark-o-10">
<div class="spinner spinner-primary"></div>
</div>
</div>
<!--begin::Global Config(global config for global JS scripts)-->
<script src="asset-corporate-portal/js/ktappsetting.js"></script>

View File

@@ -59,8 +59,6 @@ SEARCH GROUP CSS KEYWORD "###"
--dangerbg: #f7c9c9;
--toscabg: #c9f7f5;
--fieldbg: #f5f8fa;
--labelkartukontrolSudahbg: #e8fff3;
--labelkartukontrolBelumbg: #fff8dd;
/* END BACKGROUND */
/* TEXT COLOR */
--text-black: #0e1e28;
@@ -69,8 +67,6 @@ SEARCH GROUP CSS KEYWORD "###"
--text-header-table: #b5b5c3;
--header-table-bg: #f3f6f9;
--active-state: #637381;
--textcolorlabelkartukontrolSudah: #50cd89;
--textcolorlabelkartukontrolBelum: #f1bc00;
/* END TEXT COLOR */
--light: #f3f6f9;
--dark: #181c32;
@@ -620,7 +616,7 @@ a.text-white:focus {
}
.btn-outline-secondary.disabled,
.btn-outline-secondary:disabled {
color: var(--text-black) !important;
color: var(--secondary) !important;
background-color: transparent;
}
.btn-outline-secondary:not(:disabled):not(.disabled):active,
@@ -5199,11 +5195,9 @@ a.text-hover-tosca:hover .svg-icon svg:hover g [fill],
position: fixed;
top: 0vh;
right: 0vh;
z-index: 99999999999 !important;
z-index: 9998;
width: 350px;
height: auto;
margin-top: 2vh;
margin-right: 2vw;
}
/* ### TOAST FONT SIZE */
@@ -5211,100 +5205,6 @@ a.text-hover-tosca:hover .svg-icon svg:hover g [fill],
font-size: 1.1rem;
}
/* ### KARTU KONTROL CSS */
.kartukontrol-sudah-label {
background-color: var(--labelkartukontrolSudahbg); /*figma*/
color: var(--textcolorlabelkartukontrolSudah); /*figma*/
padding: 0.15rem 0.75rem;
border-radius: 0.42rem;
}
.kartukontrol-pending-label {
background-color: var(--labelkartukontrolBelumbg); /*figma*/
color: var(--textcolorlabelkartukontrolBelum); /*figma*/
padding: 0.15rem 0.75rem;
border-radius: 0.42rem;
}
/* ### OVERLAY */
.overlay-loading {
position: relative !important;
}
.overlay-loading .overlay-layer {
position: absolute !important ;
top: 0 !important;
bottom: 0 !important;
left: 0 !important;
right: 0 !important;
display: -webkit-box !important;
display: -ms-flexbox !important;
display: flex !important;
-webkit-box-pack: center !important;
-ms-flex-pack: center !important;
justify-content: center !important;
-webkit-box-align: center !important;
-ms-flex-align: center !important;
align-items: center !important;
background-color: rgba(0, 0, 0, 0.05) !important;
-webkit-transition: all 0.3s ease !important;
transition: all 0.3s ease !important;
opacity: 0 !important;
}
.overlay-loading.overlay-block .overlay-layer,
.overlay-layer {
-webkit-transition: all 0.3s ease !important;
transition: all 0.3s ease !important;
opacity: 1 !important;
}
.overlay-loading.overlay-block {
cursor: wait !important;
}
/* ### PROGRESS BAR HOVER TEXT */
/* ## PRIMARY */
.progress-bar {
height: 4px !important;
background-color: var(--primary) !important;
width: 100% !important;
overflow: hidden !important;
}
.progress-bar-value {
width: 100% !important;
height: 100% !important;
background-color: var(--primarybg) !important;
animation: indeterminateAnimation 1s infinite linear !important;
transform-origin: 0% 50% !important;
}
@keyframes indeterminateAnimation {
0% {
transform: translateX(0) scaleX(0);
}
40% {
transform: translateX(0) scaleX(0.4);
}
100% {
transform: translateX(100%) scaleX(0.5);
}
}
/* ## SECONDARY */
/* ## SUCCESS */
/* ## INFO */
/* ## WARNING */
/* ## DANGER */
/* ### HTMX INDICATOR */
.htmx-indicator {
display: none !important;
}
.htmx-request .htmx-indicator {
display: inline-block !important;
}
.htmx-request.htmx-indicator {
display: inline-block !important;
}
/* ### BUTTON HOVER TEXT */
/* ### */
/* ## PRIMARY */

View File

@@ -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>

View File

@@ -2109,40 +2109,7 @@ License: You must have a valid license purchased only from themeforest(the above
<!--end:: Footer-->
</div>
<!--end:: Wrapper-->
<button type="button" class="btn btn-primary" id="liveToastBtn">
Show live toast
</button>
<div
class="position-fixed bottom-0 right-0 p-3"
style="z-index: 5; right: 0; bottom: 0;"
>
<div
id="liveToast"
class="toast hide"
role="alert"
aria-live="assertive"
aria-atomic="true"
data-delay="2000"
>
<div class="toast-header">
<img src="..." class="rounded mr-2" alt="..." />
<strong class="mr-auto">Bootstrap</strong>
<small>11 mins ago</small>
<button
type="button"
class="ml-2 mb-1 close"
data-dismiss="toast"
aria-label="Close"
>
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="toast-body">
Hello, world! This is a toast message.
</div>
</div>
</div>
<script>
var HOST_URL =
"https://preview.keenthemes.com/metronic/theme/html/tools/preview";

View File

@@ -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;
?>

View File

@@ -1,25 +0,0 @@
package customcheckbox
import "cpone/models"
templ MainCustomCheckboxInput(inp models.CustomCheckboxv1Prm) {
<div class="form-control bg-field border-0 h-auto">
<div class="form-group">
<label>{ inp.Label }</label>
<div class="checkbox-list">
<label class="checkbox">
if (inp.Value == "on") {
<input type="checkbox" name={ inp.Name } id={ inp.ID } checked/>
} else {
<input type="checkbox" name={ inp.Name } id={ inp.ID }/>
}
<span></span>
{ inp.Text }
</label>
</div>
</div>
<div class="invalid-feedback text-danger mt-3 ml-2 mt-5">
{ inp.ErrorMsg }
</div>
</div>
}

View File

@@ -1,143 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package customcheckbox
//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 MainCustomCheckboxInput(inp models.CustomCheckboxv1Prm) 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=\"form-control bg-field border-0 h-auto\"><div class=\"form-group\"><label>")
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\customcheckbox\customcheckboxv1.templ`, Line: 8, Col: 21}
}
_, 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=\"checkbox-list\"><label class=\"checkbox\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if inp.Value == "on" {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<input type=\"checkbox\" name=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customcheckbox\customcheckboxv1.templ`, Line: 12, Col: 44}
}
_, 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("\" id=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(inp.ID)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customcheckbox\customcheckboxv1.templ`, Line: 12, Col: 58}
}
_, 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("\" checked> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<input type=\"checkbox\" name=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customcheckbox\customcheckboxv1.templ`, Line: 14, Col: 44}
}
_, 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("\" id=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(inp.ID)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customcheckbox\customcheckboxv1.templ`, Line: 14, Col: 58}
}
_, 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("\"> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<span></span> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customcheckbox\customcheckboxv1.templ`, Line: 17, Col: 15}
}
_, 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("</label></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_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(inp.ErrorMsg)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customcheckbox\customcheckboxv1.templ`, Line: 22, Col: 17}
}
_, 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("</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
})
}

View File

@@ -1,61 +0,0 @@
package customdropdown;
import "cpone/models"
templ MainCustomDropdown(inp models.CustomDropdownv1Prm, listItem templ.Component) {
<div class="form-control bg-field border-0 h-auto">
<select
name={ inp.Name }
class="form-control bg-field selectpicker"
data-live-search="true"
data-size="5"
id={ inp.ID }
hx-get={ inp.HxGet }
hx-target={ inp.HxTarget }
hx-indicator={ inp.HxIndicator }
hx-trigger={ inp.HxTrigger }
hx-include={ inp.HxInclude }
>
@listItem
</select>
<div class="invalid-feedback text-danger mt-3 ml-2 mt-5">
{ inp.ErrorMsg }
</div>
</div>
}
templ MainCustomDropdownInput(inp models.CustomDropdownv1Prm, listItem templ.Component) {
<div class="form-control bg-field border-0 h-auto">
<select
name={ inp.Name }
class="form-control bg-field selectpicker"
data-live-search="true"
data-size="5"
id={ inp.ID }
>
@listItem
</select>
<div class="invalid-feedback text-danger mt-3 ml-2 mt-5">
{ inp.ErrorMsg }
</div>
</div>
}
templ MainCustomDropdownV1(name string, id string, hxTarget string, hxGet string, hxIndicator string, hxTrigger string, hxInclude string, listItem templ.Component) {
<div class="form-control bg-field border-0 h-auto">
<select
name={ name }
class="form-control bg-field selectpicker"
data-live-search="true"
data-size="5"
id={ id }
hx-get={ hxGet }
hx-target={ hxTarget }
hx-indicator={ hxIndicator }
hx-trigger={ hxTrigger }
hx-include={ hxInclude }
>
@listItem
</select>
</div>
}

View File

@@ -1,343 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package customdropdown
//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 MainCustomDropdown(inp models.CustomDropdownv1Prm, 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_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=\"form-control bg-field border-0 h-auto\"><select name=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, 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: 8, 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("\" class=\"form-control bg-field selectpicker\" data-live-search=\"true\" data-size=\"5\" id=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, 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: 12, Col: 14}
}
_, 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("\" hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(inp.HxGet)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 13, Col: 21}
}
_, 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-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(inp.HxTarget)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 14, Col: 27}
}
_, 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-indicator=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(inp.HxIndicator)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 15, Col: 33}
}
_, 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-trigger=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(inp.HxTrigger)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 16, Col: 29}
}
_, 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-include=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(inp.HxInclude)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdropdown\customdropdown.templ`, Line: 17, Col: 29}
}
_, 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("\">")
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><div class=\"invalid-feedback text-danger mt-3 ml-2 mt-5\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, 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: 22, Col: 17}
}
_, 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("</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 MainCustomDropdownInput(inp models.CustomDropdownv1Prm, 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_Var10 := templ.GetChildren(ctx)
if templ_7745c5c3_Var10 == nil {
templ_7745c5c3_Var10 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"form-control bg-field border-0 h-auto\"><select name=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, 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: 30, Col: 18}
}
_, 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("\" class=\"form-control bg-field selectpicker\" data-live-search=\"true\" 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}
}
_, 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("\">")
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><div class=\"invalid-feedback text-danger mt-3 ml-2 mt-5\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
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
})
}
func MainCustomDropdownV1(name string, id string, hxTarget string, hxGet string, hxIndicator string, hxTrigger string, hxInclude string, 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_Var14 := templ.GetChildren(ctx)
if templ_7745c5c3_Var14 == nil {
templ_7745c5c3_Var14 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"form-control bg-field border-0 h-auto\"><select name=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, 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=\"form-control bg-field selectpicker\" data-live-search=\"true\" data-size=\"5\" id=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, 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-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, 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-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, 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-indicator=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, 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-trigger=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, 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-include=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
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></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
})
}

View File

@@ -4,14 +4,7 @@ import "cpone/models"
templ CustomTextFieldv2(inp models.CustomTextFieldv2Prm) {
<div class="form-group">
<label
if inp.Type == "hidden" {
class="text-black d-none"
} else {
class="text-black"
}
style="font-family: Poppins; font-weight: 600;"
>{ inp.Label } </label>
<label class="text-black" style="font-family: Poppins; font-weight: 600;">{ inp.Label } </label>
<input
id={ inp.Name }
name={ inp.Name }
@@ -21,7 +14,7 @@ templ CustomTextFieldv2(inp models.CustomTextFieldv2Prm) {
if inp.ErrorMsg =="" {
class="form-control bg-field border-0 h-auto py-6 px-6 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-0 h-auto py-6 px-6 rounded-lg is-invalid"
}
/>
<div class="invalid-feedback text-danger mt-3 ml-2">

View File

@@ -25,29 +25,14 @@ func CustomTextFieldv2(inp models.CustomTextFieldv2Prm) templ.Component {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"form-group\"><label")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if inp.Type == "hidden" {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" class=\"text-black d-none\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" class=\"text-black\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" style=\"font-family: Poppins; font-weight: 600;\">")
_, 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_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\customtextfield\customtextfieldv2.templ`, Line: 14, Col: 14}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfield\customtextfieldv2.templ`, Line: 7, Col: 87}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
@@ -60,7 +45,7 @@ func CustomTextFieldv2(inp models.CustomTextFieldv2Prm) templ.Component {
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfield\customtextfieldv2.templ`, Line: 16, Col: 16}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfield\customtextfieldv2.templ`, Line: 9, Col: 16}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
@@ -73,7 +58,7 @@ func CustomTextFieldv2(inp models.CustomTextFieldv2Prm) templ.Component {
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfield\customtextfieldv2.templ`, Line: 17, Col: 18}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfield\customtextfieldv2.templ`, Line: 10, Col: 18}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
@@ -86,7 +71,7 @@ func CustomTextFieldv2(inp models.CustomTextFieldv2Prm) templ.Component {
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Type)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfield\customtextfieldv2.templ`, Line: 18, Col: 18}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfield\customtextfieldv2.templ`, Line: 11, Col: 18}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
@@ -99,7 +84,7 @@ func CustomTextFieldv2(inp models.CustomTextFieldv2Prm) templ.Component {
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Placeholder)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfield\customtextfieldv2.templ`, Line: 19, Col: 32}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfield\customtextfieldv2.templ`, Line: 12, Col: 32}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
@@ -112,7 +97,7 @@ func CustomTextFieldv2(inp models.CustomTextFieldv2Prm) templ.Component {
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Value)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfield\customtextfieldv2.templ`, Line: 20, Col: 20}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfield\customtextfieldv2.templ`, Line: 13, Col: 20}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
@@ -128,7 +113,7 @@ func CustomTextFieldv2(inp models.CustomTextFieldv2Prm) templ.Component {
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-0 h-auto py-6 px-6 rounded-lg is-invalid\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -140,7 +125,7 @@ func CustomTextFieldv2(inp models.CustomTextFieldv2Prm) templ.Component {
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(inp.ErrorMsg)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfield\customtextfieldv2.templ`, Line: 28, Col: 17}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfield\customtextfieldv2.templ`, Line: 21, Col: 17}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil {

View File

@@ -45,80 +45,6 @@ templ MainCustomTextFieldSearchV1(
hx-indicator={ hxIndicator }
value={ value }
hx-ext={ hxExt }
autocomplete="off"
autocomplete="off"
/>
}
templ MainCustomTextFieldSearchV2(
inpId,
inpName,
inpPlaceHolder,
inpType,
hxGet,
hxTrigger,
hxTarget,
hxIndicator,
value,
hxSwap string,
hxInclude string) {
<input
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
type={ inpType }
name={ inpName }
id={ inpId }
placeholder={ inpPlaceHolder }
hx-get={ hxGet }
hx-trigger={ hxTrigger }
hx-target={ hxTarget }
hx-indicator={ hxIndicator }
value={ value }
hx-include={ hxInclude }
hx-swap={ hxSwap }
autocomplete="off"
/>
<script>
document.body.addEventListener('htmx:targetError', function(event) {
console.error('Error updating target element:', event.detail);
alert('There was an error updating the target element.');
});
</script>
}
templ MainCustomTextFieldSearchV3(
inpId,
inpName,
inpPlaceHolder,
inpType,
hxGet,
hxTrigger,
hxTarget,
hxIndicator,
value,
hxSwap string,
hxInclude string,
hxBeforeRequest templ.ComponentScript,
hxAfterRequest templ.ComponentScript) {
<input
class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg"
type={ inpType }
name={ inpName }
id={ inpId }
placeholder={ inpPlaceHolder }
hx-get={ hxGet }
hx-trigger={ hxTrigger }
hx-target={ hxTarget }
hx-indicator={ hxIndicator }
value={ value }
hx-include={ hxInclude }
hx-swap={ hxSwap }
hx-on::before-request={ hxBeforeRequest }
hx-on::after-request={ hxAfterRequest }
autocomplete="off"
/>
<script>
document.body.addEventListener('htmx:targetError', function(event) {
console.error('Error updating target element:', event.detail);
alert('There was an error updating the target element.');
});
</script>
}

View File

@@ -308,383 +308,3 @@ func MainCustomTextFieldSearchV1(
return templ_7745c5c3_Err
})
}
func MainCustomTextFieldSearchV2(
inpId,
inpName,
inpPlaceHolder,
inpType,
hxGet,
hxTrigger,
hxTarget,
hxIndicator,
value,
hxSwap string,
hxInclude 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_Var21 := templ.GetChildren(ctx)
if templ_7745c5c3_Var21 == nil {
templ_7745c5c3_Var21 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<input class=\"form-control bg-field border-0 h-auto py-6 px-6 rounded-lg\" type=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var22 string
templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(inpType)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 66, Col: 16}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
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_Var23 string
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(inpName)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 67, Col: 16}
}
_, 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("\" id=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var24 string
templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(inpId)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 68, Col: 12}
}
_, 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("\" placeholder=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var25 string
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(inpPlaceHolder)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 69, Col: 30}
}
_, 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\customtextfieldsearch\customtextfieldsearch.templ`, Line: 70, 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-trigger=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var27 string
templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(hxTrigger)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 71, Col: 24}
}
_, 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\customtextfieldsearch\customtextfieldsearch.templ`, Line: 72, 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-indicator=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var29 string
templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(hxIndicator)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 73, Col: 28}
}
_, 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("\" value=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var30 string
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(value)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 74, Col: 15}
}
_, 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-include=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var31 string
templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(hxInclude)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 75, Col: 24}
}
_, 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(hxSwap)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 76, Col: 18}
}
_, 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("\" autocomplete=\"off\"><script>\r\n document.body.addEventListener('htmx:targetError', function(event) {\r\n console.error('Error updating target element:', event.detail);\r\n alert('There was an error updating the target element.');\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 MainCustomTextFieldSearchV3(
inpId,
inpName,
inpPlaceHolder,
inpType,
hxGet,
hxTrigger,
hxTarget,
hxIndicator,
value,
hxSwap string,
hxInclude string,
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_Var33 := templ.GetChildren(ctx)
if templ_7745c5c3_Var33 == nil {
templ_7745c5c3_Var33 = 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("<input class=\"form-control bg-field border-0 h-auto py-6 px-6 rounded-lg\" type=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var34 string
templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(inpType)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 103, Col: 16}
}
_, 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("\" name=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var35 string
templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(inpName)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 104, Col: 16}
}
_, 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(inpId)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 105, Col: 12}
}
_, 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("\" placeholder=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var37 string
templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(inpPlaceHolder)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 106, Col: 30}
}
_, 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("\" hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var38 string
templ_7745c5c3_Var38, templ_7745c5c3_Err = templ.JoinStringErrs(hxGet)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 107, Col: 16}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var38))
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_Var39 string
templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(hxTrigger)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 108, Col: 24}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39))
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_Var40 string
templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.JoinStringErrs(hxTarget)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 109, Col: 22}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40))
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_Var41 string
templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(hxIndicator)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 110, Col: 28}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" value=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var42 string
templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinStringErrs(value)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 111, Col: 15}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var42))
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_Var43 string
templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(hxInclude)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 112, Col: 24}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43))
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_Var44 string
templ_7745c5c3_Var44, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwap)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfieldsearch\customtextfieldsearch.templ`, Line: 113, Col: 18}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var44))
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_Var45 templ.ComponentScript = hxBeforeRequest
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var45.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_Var46 templ.ComponentScript = hxAfterRequest
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var46.Call)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" autocomplete=\"off\"><script>\r\n document.body.addEventListener('htmx:targetError', function(event) {\r\n console.error('Error updating target element:', event.detail);\r\n alert('There was an error updating the target element.');\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
})
}

View File

@@ -28,14 +28,14 @@ templ ModalConfirmation(
<p>{ message }</p>
<div class="card rounded-lg">
<div class="card-body d-flex flex-row">
<div class="d-flex flex-column">
<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 class="mb-3 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">
<div class="mb-3 font-weight-bold">
{ v }
</div>
}

View File

@@ -77,19 +77,19 @@ func ModalConfirmation(
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\">")
_, 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\">")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"mb-3 text-disabled font-weight-bold mr-5\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(v)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\modal\modal_confirmation.templ`, Line: 33, Col: 71}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\modal\modal_confirmation.templ`, Line: 33, Col: 66}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
@@ -105,7 +105,7 @@ func ModalConfirmation(
return templ_7745c5c3_Err
}
for _, v := range dataText {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"mb-1 mt-1 font-weight-bold\">")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"mb-3 font-weight-bold\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}

View File

@@ -2,7 +2,7 @@ package navbar
import (
"cpone/component/sidebarmaster"
services "cpone/services/dev"
"cpone/models"
)
@@ -40,7 +40,7 @@ templ Navbar(dataUser models.User) {
</div>
}
templ NavbarMenu(datamenu []models.Menu) {
templ NavbarMenu(datamenu []services.MasterMenu) {
<div class="aside-menu-wrapper flex-column-fluid" id="kt_aside_menu_wrapper">
<!--begin::Menu Container-->
<div

View File

@@ -12,8 +12,8 @@ import "bytes"
import (
"cpone/component/sidebarmaster"
"cpone/models"
services "cpone/services/dev"
)
func Navbar(dataUser models.User) templ.Component {
@@ -53,7 +53,7 @@ func Navbar(dataUser models.User) templ.Component {
})
}
func NavbarMenu(datamenu []models.Menu) templ.Component {
func NavbarMenu(datamenu []services.MasterMenu) 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 {

View File

@@ -1,50 +0,0 @@
package pagination
import "strconv"
import "cpone/component/customtextfield"
import "cpone/models"
templ PaginationV2(length int,
currentPage int,
link string,
paginationID string,
hxInclude string,
hxTarget string,
hxSwap string,
hxIndicator string,
hxSwapOob string) {
// hx-on::before-request={ HideContent(contentID) }
// hx-on::after-request="alert('Done making a request!')"
<div class="d-flex justify-content-between align-items-center flex-wrap" id={ paginationID } hx-swap-oob={ hxSwapOob }>
<div class="d-flex flex-wrap py-2 mr-3">
for i:=0; i<length; i++ {
if (i+1) == currentPage {
<a
hx-get={ link + "?" + "page=" + strconv.Itoa(i+1) }
class="btn btn-icon btn-sm border-0 btn-light btn-hover-primary active mr-2 my-1"
hx-swap={ hxSwap }
hx-indicator={ hxIndicator }
hx-trigger="click"
hx-target={ hxTarget }
hx-include={ hxInclude }
>{ strconv.Itoa(i+1) }</a>
} else {
<a
hx-get={ link + "?" + "page=" + strconv.Itoa(i+1) }
class="btn btn-icon btn-sm border-0 btn-light mr-2 my-1 btneditug"
hx-swap={ hxSwap }
hx-indicator={ hxIndicator }
hx-trigger="click"
hx-target={ hxTarget }
hx-include={ hxInclude }
>{ strconv.Itoa(i+1) }</a>
}
}
</div>
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{
ID: "currpage" + paginationID,
Name: "currpage" + paginationID,
Type: "hidden",
Value: strconv.Itoa(currentPage)})
</div>
}

View File

@@ -1,258 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package pagination
//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 "strconv"
import "cpone/component/customtextfield"
import "cpone/models"
func PaginationV2(length int,
currentPage int,
link string,
paginationID string,
hxInclude string,
hxTarget string,
hxSwap string,
hxIndicator string,
hxSwapOob 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 class=\"d-flex justify-content-between align-items-center flex-wrap\" id=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(paginationID)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 18, Col: 91}
}
_, 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=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapOob)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 18, Col: 117}
}
_, 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("\"><div class=\"d-flex flex-wrap py-2 mr-3\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for i := 0; i < length; i++ {
if (i + 1) == currentPage {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(link + "?" + "page=" + strconv.Itoa(i+1))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 23, Col: 55}
}
_, 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("\" class=\"btn btn-icon btn-sm border-0 btn-light btn-hover-primary active mr-2 my-1\" hx-swap=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwap)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 25, 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("\" hx-indicator=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(hxIndicator)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 26, Col: 32}
}
_, 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-trigger=\"click\" 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: `component\pagination\paginationv2.templ`, Line: 28, Col: 26}
}
_, 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-include=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(hxInclude)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 29, Col: 28}
}
_, 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("\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(i + 1))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 30, Col: 25}
}
_, 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("</a>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(link + "?" + "page=" + strconv.Itoa(i+1))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 33, Col: 55}
}
_, 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("\" class=\"btn btn-icon btn-sm border-0 btn-light mr-2 my-1 btneditug\" 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: `component\pagination\paginationv2.templ`, Line: 35, Col: 22}
}
_, 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(hxIndicator)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 36, Col: 32}
}
_, 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-trigger=\"click\" hx-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(hxTarget)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 38, Col: 26}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
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_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(hxInclude)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 39, Col: 28}
}
_, 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("\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(i + 1))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv2.templ`, Line: 40, Col: 25}
}
_, 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("</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
}
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{
ID: "currpage" + paginationID,
Name: "currpage" + paginationID,
Type: "hidden",
Value: strconv.Itoa(currentPage)}).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
})
}

View File

@@ -1,60 +0,0 @@
package pagination
import "strconv"
import "cpone/component/customtextfield"
import "cpone/models"
templ PaginationV3(length int,
currentPage int,
link string,
paginationID string,
hxInclude string,
hxTarget string,
hxSwap string,
hxIndicator string,
hxSwapOob string,
hxBeforeRequest templ.ComponentScript,
hxAfterRequest templ.ComponentScript,
) {
// hx-on::before-request={ HideContent(contentID) }
// hx-on::after-request="alert('Done making a request!')"
<div
class="d-flex justify-content-between align-items-center flex-wrap"
hx-on::load={ hxAfterRequest }
id={ paginationID }
hx-swap-oob={ hxSwapOob }
>
<div class="d-flex flex-wrap py-2 mr-3">
for i:=0; i<length; i++ {
if (i+1) == currentPage {
<a
hx-get={ link + "?" + "page=" + strconv.Itoa(i+1) }
class="btn btn-icon btn-sm border-0 btn-light btn-hover-primary active mr-2 my-1"
hx-swap={ hxSwap }
hx-indicator={ hxIndicator }
hx-trigger="click"
hx-on::before-request={ hxBeforeRequest }
hx-target={ hxTarget }
hx-include={ hxInclude }
>{ strconv.Itoa(i+1) }</a>
} else {
<a
hx-get={ link + "?" + "page=" + strconv.Itoa(i+1) }
class="btn btn-icon btn-sm border-0 btn-light mr-2 my-1 btneditug"
hx-swap={ hxSwap }
hx-on::before-request={ hxBeforeRequest }
hx-indicator={ hxIndicator }
hx-trigger="click"
hx-target={ hxTarget }
hx-include={ hxInclude }
>{ strconv.Itoa(i+1) }</a>
}
}
</div>
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{
ID: "currpage" + paginationID,
Name: "currpage" + paginationID,
Type: "hidden",
Value: strconv.Itoa(currentPage)})
</div>
}

View File

@@ -1,300 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package pagination
//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 "strconv"
import "cpone/component/customtextfield"
import "cpone/models"
func PaginationV3(length int,
currentPage int,
link string,
paginationID string,
hxInclude string,
hxTarget string,
hxSwap string,
hxIndicator string,
hxSwapOob string,
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_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, hxAfterRequest)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"d-flex justify-content-between align-items-center flex-wrap\" hx-on::load=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 templ.ComponentScript = hxAfterRequest
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var2.Call)
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_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(paginationID)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv3.templ`, Line: 24, Col: 19}
}
_, 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("\" hx-swap-oob=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapOob)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv3.templ`, Line: 25, Col: 25}
}
_, 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("\"><div class=\"d-flex flex-wrap py-2 mr-3\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for i := 0; i < length; i++ {
if (i + 1) == currentPage {
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, hxBeforeRequest)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(link + "?" + "page=" + strconv.Itoa(i+1))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv3.templ`, Line: 31, Col: 55}
}
_, 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("\" class=\"btn btn-icon btn-sm border-0 btn-light btn-hover-primary active mr-2 my-1\" hx-swap=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwap)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv3.templ`, Line: 33, Col: 22}
}
_, 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=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(hxIndicator)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv3.templ`, Line: 34, Col: 32}
}
_, 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=\"click\" hx-on::before-request=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 templ.ComponentScript = hxBeforeRequest
_, 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("\" hx-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(hxTarget)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv3.templ`, Line: 37, Col: 26}
}
_, 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-include=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(hxInclude)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv3.templ`, Line: 38, Col: 28}
}
_, 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("\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(i + 1))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv3.templ`, Line: 39, Col: 25}
}
_, 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("</a>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, hxBeforeRequest)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(link + "?" + "page=" + strconv.Itoa(i+1))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv3.templ`, Line: 42, Col: 55}
}
_, 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("\" class=\"btn btn-icon btn-sm border-0 btn-light mr-2 my-1 btneditug\" hx-swap=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwap)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv3.templ`, Line: 44, Col: 22}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
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_Var14 templ.ComponentScript = hxBeforeRequest
_, 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("\" hx-indicator=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(hxIndicator)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv3.templ`, Line: 46, Col: 32}
}
_, 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-trigger=\"click\" hx-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(hxTarget)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv3.templ`, Line: 48, Col: 26}
}
_, 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-include=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(hxInclude)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv3.templ`, Line: 49, Col: 28}
}
_, 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(strconv.Itoa(i + 1))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\pagination\paginationv3.templ`, Line: 50, 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("</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
}
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{
ID: "currpage" + paginationID,
Name: "currpage" + paginationID,
Type: "hidden",
Value: strconv.Itoa(currentPage)}).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
})
}

View File

@@ -1,7 +1,7 @@
package sidebarmaster
import (
"cpone/models"
services "cpone/services/dev"
)
templ MenuDashboard(ParentMenuName string, ParentMenuUrl string) {
@@ -50,7 +50,7 @@ templ ListMenuChildren(ChildrenMenuURL string, ChildrenMenuName string) {
</li>
}
templ ListMenuNavbar(ParentMenuName string, datamenuchildren []models.ChildrenMenu) {
templ ListMenuNavbar(ParentMenuName string, datamenuchildren []services.ChildrenMenu) {
<li class="menu-item menu-item-submenu" aria-haspopup="true" data-menu-toggle="hover">
<a
href="javascript:;"

View File

@@ -11,7 +11,7 @@ import "io"
import "bytes"
import (
"cpone/models"
services "cpone/services/dev"
)
func MenuDashboard(ParentMenuName string, ParentMenuUrl string) templ.Component {
@@ -106,7 +106,7 @@ func ListMenuChildren(ChildrenMenuURL string, ChildrenMenuName string) templ.Com
})
}
func ListMenuNavbar(ParentMenuName string, datamenuchildren []models.ChildrenMenu) templ.Component {
func ListMenuNavbar(ParentMenuName string, datamenuchildren []services.ChildrenMenu) 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 {

View File

@@ -1,6 +1,6 @@
package tablecomponent
templ TableV2(thName []string, thWidth []string, trComponent templ.Component, pagination templ.Component, idunique string, inputanSearch templ.Component) {
templ TableV2(thName []string, thWidth []string, trComponent templ.Component, pagination templ.Component, idunique string, inputanSearch templ.Component, toastX templ.Component) {
if len(thName) != len(thWidth) {
<div>length array thname berbeda dengan array thwidth</div>
} else {
@@ -23,6 +23,7 @@ templ TableV2(thName []string, thWidth []string, trComponent templ.Component, pa
@pagination
</div>
</div>
@toastX
}
}

View File

@@ -10,7 +10,7 @@ import "context"
import "io"
import "bytes"
func TableV2(thName []string, thWidth []string, trComponent templ.Component, pagination templ.Component, idunique string, inputanSearch templ.Component) templ.Component {
func TableV2(thName []string, thWidth []string, trComponent templ.Component, pagination templ.Component, idunique string, inputanSearch templ.Component, toastX 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 {
@@ -102,6 +102,10 @@ func TableV2(thName []string, thWidth []string, trComponent templ.Component, pag
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = toastX.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)

View File

@@ -1,27 +0,0 @@
package tablecomponent
templ TableV3(thName []string, thWidth []string, trComponent templ.Component) {
<div>
if len(thName) != len(thWidth) {
<div>length array thname berbeda dengan array thwidth</div>
} else {
<div class="mt-7"></div>
<table class="table table-hover table-borderless">
<thead>
<tr class="rounded-lg bg-header-table">
for i, item := range thName {
<th scope="col" width={ thWidth[i] }>{ item }</th>
}
</tr>
</thead>
<tbody>
@trComponent
</tbody>
</table>
}
</div>
}
templ DivEmptyV3() {
<div></div>
}

View File

@@ -1,118 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package tablecomponent
//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"
func TableV3(thName []string, thWidth []string, trComponent 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>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if len(thName) != len(thWidth) {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div>length array thname berbeda dengan array thwidth</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"mt-7\"></div><table class=\"table table-hover table-borderless\"><thead><tr class=\"rounded-lg bg-header-table\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for i, item := range thName {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<th scope=\"col\" width=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(thWidth[i])
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\table\tablev3.templ`, Line: 13, Col: 41}
}
_, 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("\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(item)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\table\tablev3.templ`, Line: 13, Col: 50}
}
_, 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("</th>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</tr></thead> <tbody>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = trComponent.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</tbody></table>")
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 DivEmptyV3() 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)
_, 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
})
}

View File

@@ -13,7 +13,7 @@ func toastBody(typeToastBody string) string {
}
func toastIcon(typeToast string) string {
var stringx string
var stringx string
if typeToast == "success" {
stringx = "solar:check-circle-broken"
} else {
@@ -30,12 +30,12 @@ func toastIcon(typeToast string) string {
}
}
return stringx
return stringx
}
templ CustomToastV2Show(title string, message string, typeToast string) {
<div
class="toast toast-top-right fade show"
class="toast fade show"
role="alert"
aria-live="assertive"
aria-atomic="true"
@@ -63,15 +63,14 @@ templ CustomToastV2Show(title string, message string, typeToast string) {
}
templ CustomToastV2Hide() {
<div
id="notification-001"
class="toast fade hide"
role="alert"
aria-live="assertive"
aria-atomic="true"
style="opacity: 0"
hx-swap-oob="true"
>
<div id="notification-001"
class="toast fade hide"
role="alert"
aria-live="assertive"
aria-atomic="true"
style="opacity: 0"
hx-swap-oob="true"
>
<div class="toast-header bg-success text-white">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--ep mr-2 icon-xl" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 1024 1024" data-icon="ep:success-filled"><path fill="currentColor" d="M512 64a448 448 0 1 1 0 896a448 448 0 0 1 0-896m-55.808 536.384l-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"></path></svg>
<strong class="mr-auto">Success</strong>

View File

@@ -56,7 +56,7 @@ func CustomToastV2Show(title string, message string, typeToast string) templ.Com
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"toast toast-top-right fade show\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\" id=\"notification-001\" hx-swap-oob=\"true\" hx-get=\"/dev/hidetoast\" hx-trigger=\"load delay:3s\" hx-target=\"this\" style=\"border-radius: 8px 8px 8px 8px;\">")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"toast fade show\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\" id=\"notification-001\" hx-swap-oob=\"true\" hx-get=\"/dev/hidetoast\" hx-trigger=\"load delay:3s\" hx-target=\"this\" style=\"border-radius: 8px 8px 8px 8px;\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,994 +0,0 @@
package dev_handlers
import (
breadcrumadmin "cpone/component/breadcrumbadmin"
customtextfieldsearch "cpone/component/customtextfieldsearch"
navbarmenu "cpone/component/navbar"
"cpone/component/pagination"
sidebaruserprofile "cpone/component/sidebar_user_profile"
customtoastv2 "cpone/component/toastbootstrap"
"cpone/models"
"cpone/services"
"cpone/utils"
dev_mdusergroupview "cpone/views/dev/mdusergroup"
"strconv"
"strings"
"fmt"
"github.com/a-h/templ"
"github.com/labstack/echo/v4"
"go.uber.org/zap"
)
type MdUserGroupServices interface {
GetListMdUserGroup(search string, currentPage int, rowPerPage int) ([]models.UserGroupV1, int, error)
GetMdUserGroupByID(id string) (models.UserGroupV1, error)
AddMdUserGroup(code string, name string) (models.UserGroupV1, error)
EditMdUsergroup(id string, code string, name string) (models.UserGroupV1, error)
DeleteMdUserGroup(id string) (models.UserGroupV1, error)
GetMdUserGroupBreadCrumb(title string) (models.BreadCrumbV1, error)
}
func NewMdUserGroupHandler(us MdUserGroupServices) *MdUserGroupHandler {
return &MdUserGroupHandler{
MdUserGroupServices: us,
}
}
type MdUserGroupHandler struct {
MdUserGroupServices MdUserGroupServices
}
func (lh *MdUserGroupHandler) HandleShowMdUserGroupScreen(c echo.Context) error {
logger, _ := zap.NewProduction()
//get sidebarmenu
tableID := utils.GenerateRandomID("tablebody")
paginationID := utils.GenerateRandomID("paginationid")
searchID := utils.GenerateRandomID("searchid")
dialogAddID := utils.GenerateRandomID("dialogaddID")
dialogAddBodyID := utils.GenerateRandomID("dialogaddbodyID")
dialogEditID := utils.GenerateRandomID("dialogEditID")
dialogEditBodyID := utils.GenerateRandomID("dialogEditbodyID")
dialogDeleteID := utils.GenerateRandomID("dialogDeleteID")
dialogDeleteBodyID := utils.GenerateRandomID("dialogDeletebodyID")
dataMenu, err := services.GetMenu()
fmt.Println(dataMenu)
fmt.Println(err)
if err != nil {
fmt.Println(dataMenu)
return err
}
//get user login
dataUser, err := services.GetUserLogin()
fmt.Println(dataUser)
fmt.Println(err)
if err != nil {
fmt.Println(dataUser)
return err
}
defer logger.Sync()
logger.Info("LOAD USER DEV",
zap.Any("data", dataUser),
)
title := "Master User Group"
dataBreadCrumb, err := lh.MdUserGroupServices.GetMdUserGroupBreadCrumb(title)
fmt.Println(dataBreadCrumb)
fmt.Println(err)
if err != nil {
defer logger.Sync()
logger.Info("ERROR BREADCRUMB DEV",
zap.Any("error", err),
)
fmt.Println(dataBreadCrumb)
return err
}
defer logger.Sync()
logger.Info("LOAD BREADCRUMB DEV",
zap.Any("data", dataBreadCrumb),
)
//Breadcrumb component
breadcrumbComponent := breadcrumadmin.MainBreadcrumbAdminV1(dataBreadCrumb)
// navbar menu
navbarmenuComponent := navbarmenu.NavbarMenu(dataMenu)
// navbar user
navbaruserComponent := navbarmenu.Navbar(dataUser)
// sidebar
sidebaruserprofileComponent := sidebaruserprofile.Navbaruserprofile(dataUser)
//Table component
dataUserGroup, totalPage, err := lh.MdUserGroupServices.GetListMdUserGroup("", 1, 5)
if err != nil {
defer logger.Sync()
logger.Info("ERROR GET USER GROUP",
zap.Any("error", err),
)
fmt.Println(dataUserGroup)
return err
}
tableComponent := dev_mdusergroupview.TableUserGroup(dataUserGroup,
tableID,
"/dev/md/usergroupv2/openedit",
"#"+dialogEditBodyID,
"outerHTML",
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
"/dev/md/usergroupv2/opendelete",
"#"+dialogDeleteBodyID,
"outerHTML",
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
)
//filter user group component
usergroupFilterComponent := customtextfieldsearch.MainCustomTextFieldSearchV3(searchID,
"search",
"Cari Kode/Nama",
"text",
"/dev/md/usergroupv2/filter",
"input changed delay:500ms, search",
"#"+paginationID, "#loadingcontent", "", "outerHTML", "#tableID, #paginationID, #searchID,#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
dev_mdusergroupview.BeforeRequestContent(),
dev_mdusergroupview.AfterRequestContent())
//Pagination
userGroupPaginationComponent := pagination.PaginationV3(
totalPage,
1,
"/dev/md/usergroupv2/changepage",
paginationID,
"#tableID, #searchID, #"+searchID+", #paginationID, #dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
"#"+paginationID,
"outerHTML", "", "",
dev_mdusergroupview.BeforeRequestContent(),
dev_mdusergroupview.AfterRequestContent(),
)
//modal add form
dialogAddBodyCmp := dev_mdusergroupview.BodyFormUserGroup(
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupcode",
Placeholder: "Kode user group",
Type: "text", ID: "usergroupinputname"},
models.CustomTextFieldv2Prm{
Label: "Nama User Group",
Name: "usergroupname",
Placeholder: "Nama user group",
Type: "text", ID: "usergroupinputname"},
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupid",
Placeholder: "Kode user group",
Type: "hidden", ID: "usergroupinputid"},
dialogAddBodyID, dev_mdusergroupview.JsHideModal(""))
modalActioAddCmp := dev_mdusergroupview.ActionFormUserGroup(
"/dev/md/usergroupv2/closeaddform",
"#"+dialogAddBodyID,
"outerHTML",
"#"+dialogAddID)
btnCloaseModalAdd := dev_mdusergroupview.BtnCloseFormUserGroup(
"/dev/md/usergroupv2/closeaddform",
"#"+dialogAddBodyID,
"outerHTML",
"#"+dialogAddID)
modalAddFormComponent := dev_mdusergroupview.UserGroupForm(
models.UserGroupFormComponent{
IDComponent: "formusergroup",
Link: "/dev/md/usergroupv2/add",
HxTarget: "#" + dialogAddBodyID,
HxSwap: "outerHTML",
HxInclude: "#tableID, #paginationID, #searchID, #dialogAddBodyID, #dialogAddID, #dialogDeleteBodyID, #dialogEditBodyID, #" + searchID + ", #currpage" + paginationID,
ModalID: dialogAddID,
ModalTitle: "New-User Group",
DialogBody: dialogAddBodyCmp,
DialogAction: modalActioAddCmp,
ButtonCLose: btnCloaseModalAdd,
},
)
//modal edit form
dialogEditBodyCmp := dev_mdusergroupview.BodyFormUserGroup(
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupcode",
Placeholder: "Kode user group",
Type: "text", ID: "usergroupinputname"},
models.CustomTextFieldv2Prm{
Label: "Nama User Group",
Name: "usergroupname",
Placeholder: "Nama user group",
Type: "text", ID: "usergroupinputname"},
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupid",
Placeholder: "Kode user group",
Type: "hidden", ID: "usergroupinputid"},
dialogEditBodyID, dev_mdusergroupview.JsHideModal(""))
modalActioEditCmp := dev_mdusergroupview.ActionFormUserGroup(
"/dev/md/usergroupv2/closeeditform",
"#"+dialogEditBodyID,
"outerHTML",
"#"+dialogEditID)
btnCloaseModalEdit := dev_mdusergroupview.BtnCloseFormUserGroup(
"/dev/md/usergroupv2/closeeditform",
"#"+dialogEditBodyID,
"outerHTML",
"#"+dialogEditID)
modalEditFormComponent := dev_mdusergroupview.UserGroupForm(
models.UserGroupFormComponent{
IDComponent: "formusergroup",
Link: "/dev/md/usergroupv2/edit",
HxTarget: "#" + dialogEditBodyID,
HxSwap: "outerHTML",
HxInclude: "#tableID, #paginationID, #searchID, #dialogDeleteBodyID, #dialogEditBodyID, #dialogEditID, #" + searchID + ", #currpage" + paginationID,
ModalID: dialogEditID,
ModalTitle: "New-User Group",
DialogBody: dialogEditBodyCmp,
DialogAction: modalActioEditCmp,
ButtonCLose: btnCloaseModalEdit,
},
)
//modal delete form
dialogDeleteBodyCmp := dev_mdusergroupview.BodyFormUserGroup(
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupcode",
Placeholder: "Kode user group",
Type: "text", ID: "usergroupinputname"},
models.CustomTextFieldv2Prm{
Label: "Nama User Group",
Name: "usergroupname",
Placeholder: "Nama user group",
Type: "text", ID: "usergroupinputname"},
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupid",
Placeholder: "Kode user group",
Type: "hidden", ID: "usergroupinputid"},
dialogDeleteBodyID, dev_mdusergroupview.JsHideModal(""))
modalActioDeleteCmp := dev_mdusergroupview.ActionFormUserGroupDelete(
"/dev/md/usergroupv2/closedeleteform",
"#"+dialogDeleteBodyID,
"outerHTML",
"#"+dialogDeleteID)
btnCloaseModalDelete := dev_mdusergroupview.BtnCloseFormUserGroup(
"/dev/md/usergroupv2/closedeleteform",
"#"+dialogDeleteBodyID,
"outerHTML",
"#"+dialogDeleteID)
modalDeleteFormComponent := dev_mdusergroupview.UserGroupForm(
models.UserGroupFormComponent{
IDComponent: "formusergroup",
Link: "/dev/md/usergroupv2/delete",
HxTarget: "#" + dialogDeleteBodyID,
HxSwap: "outerHTML",
HxInclude: "#tableID, #paginationID, #searchID, #dialogDeleteBodyID, #dialogDeleteID, #dialogEditBodyID, #" + searchID + ", #currpage" + paginationID,
ModalID: dialogDeleteID,
ModalTitle: "New-User Group",
DialogBody: dialogDeleteBodyCmp,
DialogAction: modalActioDeleteCmp,
ButtonCLose: btnCloaseModalDelete,
},
)
//content js & css
content := dev_mdusergroupview.MdUserGroupScreen(
tableID,
paginationID,
searchID,
dialogAddID,
dialogAddBodyID,
dialogEditID,
dialogEditBodyID,
dialogDeleteID,
dialogDeleteBodyID,
breadcrumbComponent,
tableComponent,
usergroupFilterComponent,
userGroupPaginationComponent,
modalAddFormComponent,
modalEditFormComponent,
modalDeleteFormComponent)
css := dev_mdusergroupview.CssMdUserGroup()
js := dev_mdusergroupview.JsMdUserGroup()
view := dev_mdusergroupview.ShowMdUserGroupScreen(title,
content,
css,
js,
navbarmenuComponent,
navbaruserComponent,
sidebaruserprofileComponent)
return utils.View(c, view)
}
func (lh *MdUserGroupHandler) HandleFilterMdUserGroup(c echo.Context) error {
search := c.QueryParam("search")
searchID := c.QueryParam("searchID")
tableID := c.QueryParam("tableID")
paginationID := c.QueryParam("paginationID")
dialogEditBodyID := c.QueryParam("dialogEditBodyID")
dialogDeleteBodyID := c.QueryParam("dialogDeleteBodyID")
var retval []templ.Component
logger, _ := zap.NewProduction()
dataUserGroup, totalpage, err := lh.MdUserGroupServices.GetListMdUserGroup(search, 1, 5)
if err != nil {
defer logger.Sync()
logger.Info("ERROR GET USER GROUP",
zap.Any("error", err),
)
fmt.Println(dataUserGroup)
return err
}
tableComponent := dev_mdusergroupview.TableUserGroup(dataUserGroup,
tableID,
"/dev/md/usergroupv2/openedit",
"#"+dialogEditBodyID,
"outerHTML",
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
"/dev/md/usergroupv2/opendelete",
"#"+dialogDeleteBodyID,
"outerHTML",
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID")
userGroupPaginationComponent := pagination.PaginationV3(
totalpage,
1,
"/dev/md/usergroupv2/changepage",
paginationID,
"#tableID, #searchID, #"+searchID+", #paginationID, #dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
"#"+paginationID,
"outerHTML", "", "",
dev_mdusergroupview.BeforeRequestContent(),
dev_mdusergroupview.AfterRequestContent(),
)
retval = append(retval, tableComponent)
retval = append(retval, userGroupPaginationComponent)
return utils.ViewMulti(c, retval)
}
func (lh *MdUserGroupHandler) HandleChangePageMdUserGroup(c echo.Context) error {
search := c.QueryParam("search")
pageparam := c.QueryParam("page")
tableID := c.QueryParam("tableID")
searchID := c.QueryParam("searchID")
paginationID := c.QueryParam("paginationID")
dialogEditBodyID := c.QueryParam("dialogEditBodyID")
dialogDeleteBodyID := c.QueryParam("dialogDeleteBodyID")
var retval []templ.Component
logger, _ := zap.NewProduction()
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
}
dataUserGroup, totalpage, err := lh.MdUserGroupServices.GetListMdUserGroup(search, page, 5)
if err != nil {
defer logger.Sync()
logger.Info("ERROR GET USER GROUP",
zap.Any("error", err),
)
fmt.Println(dataUserGroup)
return err
}
tableComponent := dev_mdusergroupview.TableUserGroup(dataUserGroup,
tableID,
"/dev/md/usergroupv2/openedit",
"#"+dialogEditBodyID,
"outerHTML",
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
"/dev/md/usergroupv2/opendelete",
"#"+dialogDeleteBodyID,
"outerHTML",
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
)
userGroupPaginationComponent := pagination.PaginationV3(
totalpage,
page,
"/dev/md/usergroupv2/changepage",
paginationID,
"#tableID, #searchID, #"+searchID+", #paginationID, #dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
"#"+paginationID,
"outerHTML", "", "",
dev_mdusergroupview.BeforeRequestContent(),
dev_mdusergroupview.AfterRequestContent(),
)
retval = append(retval, tableComponent)
retval = append(retval, userGroupPaginationComponent)
return utils.ViewMulti(c, retval)
}
func (lh *MdUserGroupHandler) HandleCloseFormAdd(c echo.Context) error {
dialogAddBodyID := c.FormValue("dialogAddBodyID")
newForm := dev_mdusergroupview.BodyFormUserGroup(
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupcode",
Placeholder: "Kode user group",
Type: "text", ID: "usergroupinputname"},
models.CustomTextFieldv2Prm{
Label: "Nama User Group",
Name: "usergroupname",
Placeholder: "Nama user group",
Type: "text", ID: "usergroupinputname"},
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupid",
Placeholder: "Kode user group",
Type: "hidden", ID: "usergroupinputid"},
dialogAddBodyID, dev_mdusergroupview.JsHideModal(""))
return utils.View(c, newForm)
}
func (lh *MdUserGroupHandler) HandleAddUserGroup(c echo.Context) error {
logger, _ := zap.NewProduction()
defer logger.Sync()
//prm form addusergroup
code := c.FormValue("usergroupcode")
name := c.FormValue("usergroupname")
tableID := c.FormValue("tableID")
paginationID := c.FormValue("paginationID")
searchID := c.FormValue("searchID")
search := c.FormValue("search")
currPagePrm := c.FormValue("currpage" + paginationID)
dialogAddBodyID := c.FormValue("dialogAddBodyID")
dialogAddID := c.FormValue("dialogAddID")
dialogEditBodyID := c.FormValue("dialogEditBodyID")
dialogDeleteBodyID := c.FormValue("dialogDeleteBodyID")
currPage, err := strconv.Atoi(currPagePrm)
if err != nil {
return err
}
logger.Info("ADD USER GROUP PARAM",
zap.Any("code", code),
zap.Any("nama", name),
zap.Any("tableid", tableID),
zap.Any("search", search),
zap.Any("currpage", currPage),
)
formValidation := ""
codeValidation := ""
nameValidation := ""
if strings.TrimSpace(code) == "" {
formValidation = "Code user group tidak boleh kosong"
codeValidation = "Code user group tidak boleh kosong"
nameValidation = ""
}
if strings.TrimSpace(name) == "" {
formValidation = "Nama user group tidak boleh kosong"
codeValidation = ""
nameValidation = "Nama user group tidak boleh kosong"
}
if strings.TrimSpace(code) == "" && strings.TrimSpace(name) == "" {
formValidation = "Code dan nama user group tidak boleh kosong"
codeValidation = "Code user group tidak boleh kosong"
nameValidation = "Nama user group tidak boleh kosong"
}
if formValidation != "" || codeValidation != "" || nameValidation != "" {
newForm := dev_mdusergroupview.BodyFormUserGroup(
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupcode",
Placeholder: "Kode user group",
ErrorMsg: codeValidation,
Value: code,
Type: "text"},
models.CustomTextFieldv2Prm{
Label: "Nama User Group",
Name: "usergroupname",
Placeholder: "Nama user group",
ErrorMsg: nameValidation,
Value: name,
Type: "text"},
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupid",
Placeholder: "Kode user group",
Type: "hidden", ID: "usergroupinputid"},
dialogAddBodyID, dev_mdusergroupview.JsHideModal(""))
return utils.ViewMulti(c, []templ.Component{customtoastv2.CustomToastV2Show("Warning", formValidation, "warning"), newForm})
}
//Add user group service
dataUserGroup, err := lh.MdUserGroupServices.AddMdUserGroup(code, name)
if err != nil {
logger.Info("Error",
zap.Any("Error", err),
zap.Any("code", code),
zap.Any("name", name),
)
newForm := dev_mdusergroupview.BodyFormUserGroup(
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupcode",
Placeholder: "Kode user group",
ErrorMsg: codeValidation,
Value: code,
Type: "text"},
models.CustomTextFieldv2Prm{
Label: "Nama User Group",
Name: "usergroupname",
Placeholder: "Nama user group",
ErrorMsg: nameValidation,
Value: name,
Type: "text"},
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupid",
Placeholder: "Kode user group",
Type: "hidden", ID: "usergroupinputid"},
dialogAddBodyID, dev_mdusergroupview.JsHideModal(""))
return utils.ViewMulti(c, []templ.Component{
customtoastv2.CustomToastV2Show("Error", err.Error(), "danger"),
newForm})
}
logger.Info("ADD USER GROUP",
zap.Any("return", dataUserGroup),
zap.Any("code", code),
zap.Any("name", name),
)
//get list user group for table
dataUserGroupList, totalPage, err := lh.MdUserGroupServices.GetListMdUserGroup(search, currPage, 5)
if err != nil {
defer logger.Sync()
logger.Info("ERROR GET USER GROUP",
zap.Any("error", err),
)
fmt.Println(dataUserGroup)
return err
}
//table component
tableComponent := dev_mdusergroupview.TableUserGroup(dataUserGroupList,
tableID,
"/dev/md/usergroupv2/openedit",
"#"+dialogEditBodyID,
"outerHTML",
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
"/dev/md/usergroupv2/opendelete",
"#"+dialogDeleteBodyID,
"outerHTML",
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID")
//pagination component
//Pagination
userGroupPaginationComponent := pagination.PaginationV3(
totalPage,
currPage,
"/dev/md/usergroupv2/changepage",
paginationID,
"#tableID, #searchID, #"+searchID+", #paginationID, #dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
"#"+paginationID,
"outerHTML", "", "true",
dev_mdusergroupview.BeforeRequestContent(),
dev_mdusergroupview.AfterRequestContent(),
)
newForm := dev_mdusergroupview.BodyFormUserGroup(
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupcode",
Placeholder: "Kode user group",
ErrorMsg: codeValidation,
Type: "text"},
models.CustomTextFieldv2Prm{
Label: "Nama User Group",
Name: "usergroupname",
Placeholder: "Nama user group",
ErrorMsg: nameValidation,
Type: "text"},
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupid",
Placeholder: "Kode user group",
Type: "hidden", ID: "usergroupinputid"},
dialogAddBodyID, dev_mdusergroupview.JsHideModal("#"+dialogAddID))
toastSuccess := customtoastv2.CustomToastV2Show("Success", "Berhasil insert User group "+name, "success")
return utils.ViewMulti(c, []templ.Component{
toastSuccess,
tableComponent,
userGroupPaginationComponent,
newForm})
}
func (lh *MdUserGroupHandler) HandleOpenEditForm(c echo.Context) error {
id := c.QueryParam("id")
dialogEditID := c.QueryParam("dialogEditID")
dialogEditBodyID := c.QueryParam("dialogEditBodyID")
dataUserGroup, err := lh.MdUserGroupServices.GetMdUserGroupByID(id)
if err != nil {
newForm := dev_mdusergroupview.BodyFormUserGroup(
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupcode",
Placeholder: "Kode user group",
Type: "text", ID: "usergroupinputname"},
models.CustomTextFieldv2Prm{
Label: "Nama User Group",
Name: "usergroupname",
Placeholder: "Nama user group",
Type: "text", ID: "usergroupinputname"},
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupid",
Placeholder: "Kode user group",
Type: "hidden", ID: "usergroupinputid"},
dialogEditBodyID, dev_mdusergroupview.JsHideModal(""))
return utils.ViewMulti(c, []templ.Component{customtoastv2.CustomToastV2Show("Error", "Get user group error", "danger"), newForm})
}
newForm := dev_mdusergroupview.BodyFormUserGroup(
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupcode",
Placeholder: "Kode user group",
Value: dataUserGroup.M_UserGroupCode,
Type: "text", ID: "usergroupinputname"},
models.CustomTextFieldv2Prm{
Label: "Nama User Group",
Name: "usergroupname",
Placeholder: "Nama user group",
Value: dataUserGroup.M_UserGroupName,
Type: "text", ID: "usergroupinputname"},
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupid",
Placeholder: "Kode user group",
Value: strconv.Itoa(dataUserGroup.M_UserGroupID),
Type: "hidden", ID: "usergroupinputid"},
dialogEditBodyID, dev_mdusergroupview.JsShowModal("#"+dialogEditID))
return utils.View(c, newForm)
}
func (lh *MdUserGroupHandler) HandleCloseFormEdit(c echo.Context) error {
dialogEditBodyID := c.FormValue("dialogEditBodyID")
newForm := dev_mdusergroupview.BodyFormUserGroup(
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupcode",
Placeholder: "Kode user group",
Type: "text", ID: "usergroupinputname"},
models.CustomTextFieldv2Prm{
Label: "Nama User Group",
Name: "usergroupname",
Placeholder: "Nama user group",
Type: "text", ID: "usergroupinputname"},
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupid",
Placeholder: "Kode user group",
Type: "hidden", ID: "usergroupinputid"},
dialogEditBodyID, dev_mdusergroupview.JsHideModal(""))
return utils.View(c, newForm)
}
func (lh *MdUserGroupHandler) HandleEditUserGroup(c echo.Context) error {
logger, _ := zap.NewProduction()
defer logger.Sync()
//prm form addusergroup
code := c.FormValue("usergroupcode")
name := c.FormValue("usergroupname")
id := c.FormValue("usergroupid")
tableID := c.FormValue("tableID")
paginationID := c.FormValue("paginationID")
searchID := c.FormValue("searchID")
search := c.FormValue("search")
currPagePrm := c.FormValue("currpage" + paginationID)
// dialogAddBodyID := c.FormValue("dialogAddBodyID")
dialogEditID := c.FormValue("dialogEditID")
dialogEditBodyID := c.FormValue("dialogEditBodyID")
dialogDeleteBodyID := c.FormValue("dialogDeleteBodyID")
currPage, err := strconv.Atoi(currPagePrm)
if err != nil {
return err
}
logger.Info("ADD USER GROUP PARAM",
zap.Any("code", code),
zap.Any("nama", name),
zap.Any("tableid", tableID),
zap.Any("search", search),
zap.Any("currpage", currPage),
)
formValidation := ""
codeValidation := ""
nameValidation := ""
if strings.TrimSpace(code) == "" {
formValidation = "Code user group tidak boleh kosong"
codeValidation = "Code user group tidak boleh kosong"
nameValidation = ""
}
if strings.TrimSpace(name) == "" {
formValidation = "Nama user group tidak boleh kosong"
codeValidation = ""
nameValidation = "Nama user group tidak boleh kosong"
}
if strings.TrimSpace(code) == "" && strings.TrimSpace(name) == "" {
formValidation = "Code dan nama user group tidak boleh kosong"
codeValidation = "Code user group tidak boleh kosong"
nameValidation = "Nama user group tidak boleh kosong"
}
if formValidation != "" || codeValidation != "" || nameValidation != "" {
newForm := dev_mdusergroupview.BodyFormUserGroup(
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupcode",
Placeholder: "Kode user group",
ErrorMsg: codeValidation,
Value: code,
Type: "text"},
models.CustomTextFieldv2Prm{
Label: "Nama User Group",
Name: "usergroupname",
Placeholder: "Nama user group",
ErrorMsg: nameValidation,
Value: name,
Type: "text"},
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupid",
Placeholder: "Kode user group",
Type: "hidden", ID: "usergroupinputid"},
dialogEditBodyID, dev_mdusergroupview.JsHideModal(""))
return utils.ViewMulti(c, []templ.Component{customtoastv2.CustomToastV2Show("Warning", formValidation, "warning"), newForm})
}
//edit user group service
dataUserGroup, err := lh.MdUserGroupServices.EditMdUsergroup(id, code, name)
if err != nil {
logger.Info("Error",
zap.Any("Error", err),
zap.Any("code", code),
zap.Any("name", name),
)
newForm := dev_mdusergroupview.BodyFormUserGroup(
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupcode",
Placeholder: "Kode user group",
ErrorMsg: codeValidation,
Value: code,
Type: "text"},
models.CustomTextFieldv2Prm{
Label: "Nama User Group",
Name: "usergroupname",
Placeholder: "Nama user group",
ErrorMsg: nameValidation,
Value: name,
Type: "text"},
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupid",
Placeholder: "Kode user group",
Type: "hidden", ID: "usergroupinputid"},
dialogEditBodyID, dev_mdusergroupview.JsHideModal(""))
return utils.ViewMulti(c, []templ.Component{
customtoastv2.CustomToastV2Show("Error", err.Error(), "danger"),
newForm})
}
logger.Info("ADD USER GROUP",
zap.Any("return", dataUserGroup),
zap.Any("code", code),
zap.Any("name", name),
)
//get list user group for table
dataUserGroupList, totalPage, err := lh.MdUserGroupServices.GetListMdUserGroup(search, currPage, 5)
if err != nil {
defer logger.Sync()
logger.Info("ERROR GET USER GROUP",
zap.Any("error", err),
)
fmt.Println(dataUserGroup)
return err
}
//table component
tableComponent := dev_mdusergroupview.TableUserGroup(dataUserGroupList,
tableID,
"/dev/md/usergroupv2/openedit",
"#"+dialogEditBodyID,
"outerHTML",
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
"/dev/md/usergroupv2/opendelete",
"#"+dialogDeleteBodyID,
"outerHTML",
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID")
//pagination component
//Pagination
userGroupPaginationComponent := pagination.PaginationV3(
totalPage,
currPage,
"/dev/md/usergroupv2/changepage",
paginationID,
"#tableID, #searchID, #"+searchID+", #paginationID, #dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
"#"+paginationID,
"outerHTML", "", "true",
dev_mdusergroupview.BeforeRequestContent(),
dev_mdusergroupview.AfterRequestContent(),
)
var retVal []templ.Component
newForm := dev_mdusergroupview.BodyFormUserGroup(
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupcode",
Placeholder: "Kode user group",
ErrorMsg: codeValidation,
Type: "text"},
models.CustomTextFieldv2Prm{
Label: "Nama User Group",
Name: "usergroupname",
Placeholder: "Nama user group",
ErrorMsg: nameValidation,
Type: "text"},
models.CustomTextFieldv2Prm{
Label: "Kode User Group",
Name: "usergroupid",
Placeholder: "Kode user group",
Type: "hidden", ID: "usergroupinputid"},
dialogEditBodyID, dev_mdusergroupview.JsHideModal("#"+dialogEditID))
toastSuccess := customtoastv2.CustomToastV2Show("Success", "Berhasil edit User group "+name, "success")
retVal = append(retVal, toastSuccess)
retVal = append(retVal, tableComponent)
retVal = append(retVal, userGroupPaginationComponent)
retVal = append(retVal, newForm)
return utils.ViewMulti(c, retVal)
}
func (lh *MdUserGroupHandler) HandleOpenDeleteForm(c echo.Context) error {
id := c.QueryParam("id")
dialogDeleteID := c.QueryParam("dialogDeleteID")
dialogDeleteBodyID := c.QueryParam("dialogDeleteBodyID")
dataUserGroup, err := lh.MdUserGroupServices.GetMdUserGroupByID(id)
if err != nil {
newForm := dev_mdusergroupview.DeleteConfirmationBody(
models.CustomTextFieldv2Prm{Name: "usergroupid", Type: "hidden", Value: strconv.Itoa(dataUserGroup.M_UserGroupID)},
dialogDeleteBodyID,
"Apakah anda yakin menghapus user group berikut ?",
[]string{"Kode", "User Group"},
[]string{"", ""},
dev_mdusergroupview.JsShowModal(""))
return utils.ViewMulti(c, []templ.Component{customtoastv2.CustomToastV2Show("Error", "Get user group error", "danger"), newForm})
}
newForm := dev_mdusergroupview.DeleteConfirmationBody(
models.CustomTextFieldv2Prm{Name: "usergroupid", Type: "hidden", Value: strconv.Itoa(dataUserGroup.M_UserGroupID)},
dialogDeleteBodyID,
"Apakah anda yakin menghapus user group berikut ?",
[]string{"Kode", "User Group"},
[]string{dataUserGroup.M_UserGroupCode, dataUserGroup.M_UserGroupName},
dev_mdusergroupview.JsShowModal("#"+dialogDeleteID))
return utils.View(c, newForm)
}
func (lh *MdUserGroupHandler) HandleCloseFormDelete(c echo.Context) error {
dialogDeleteBodyID := c.FormValue("dialogDeleteBodyID")
newForm := dev_mdusergroupview.DeleteConfirmationBody(
models.CustomTextFieldv2Prm{Name: "usergroupid", Type: "hidden", Value: ""},
dialogDeleteBodyID,
"Apakah anda yakin menghapus user group berikut ?",
[]string{"Kode", "User Group"},
[]string{"", ""},
dev_mdusergroupview.JsShowModal(""))
return utils.View(c, newForm)
}
func (lh *MdUserGroupHandler) HandleDeleteUserGroup(c echo.Context) error {
logger, _ := zap.NewProduction()
defer logger.Sync()
//prm form addusergroup
id := c.FormValue("usergroupid")
tableID := c.FormValue("tableID")
paginationID := c.FormValue("paginationID")
searchID := c.FormValue("searchID")
search := c.FormValue("search")
currPagePrm := c.FormValue("currpage" + paginationID)
// dialogAddBodyID := c.FormValue("dialogAddBodyID")
dialogDeleteID := c.FormValue("dialogDeleteID")
dialogEditBodyID := c.FormValue("dialogEditBodyID")
dialogDeleteBodyID := c.FormValue("dialogDeleteBodyID")
currPage, err := strconv.Atoi(currPagePrm)
if err != nil {
return err
}
logger.Info("ADD USER GROUP PARAM",
zap.Any("tableid", tableID),
zap.Any("search", search),
zap.Any("currpage", currPage),
)
//edit user group service
dataUserGroup, err := lh.MdUserGroupServices.DeleteMdUserGroup(id)
if err != nil {
logger.Info("Error",
zap.Any("Error", err),
)
newForm := dev_mdusergroupview.DeleteConfirmationBody(
models.CustomTextFieldv2Prm{Name: "usergroupid", Type: "hidden", Value: ""},
dialogDeleteBodyID,
"Apakah anda yakin menghapus user group berikut ?",
[]string{"Kode", "User Group"},
[]string{"", ""},
dev_mdusergroupview.JsShowModal(""))
return utils.ViewMulti(c, []templ.Component{
customtoastv2.CustomToastV2Show("Error", err.Error(), "danger"),
newForm})
}
logger.Info("ADD USER GROUP",
zap.Any("return", dataUserGroup),
)
//get list user group for table
dataUserGroupList, totalPage, err := lh.MdUserGroupServices.GetListMdUserGroup(search, currPage, 5)
if err != nil {
defer logger.Sync()
logger.Info("ERROR GET USER GROUP",
zap.Any("error", err),
)
fmt.Println(dataUserGroup)
return err
}
if len(dataUserGroupList) == 0 && totalPage > 1 {
currPage = currPage - 1
dataUserGroupList, _, err = lh.MdUserGroupServices.GetListMdUserGroup(search, currPage, 5)
if err != nil {
defer logger.Sync()
logger.Info("ERROR GET USER GROUP",
zap.Any("error", err),
)
return err
}
}
//table component
tableComponent := dev_mdusergroupview.TableUserGroup(dataUserGroupList,
tableID,
"/dev/md/usergroupv2/openedit",
"#"+dialogEditBodyID,
"outerHTML",
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
"/dev/md/usergroupv2/opendelete",
"#"+dialogDeleteBodyID,
"outerHTML",
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID")
//pagination component
//Pagination
userGroupPaginationComponent := pagination.PaginationV3(
totalPage,
currPage,
"/dev/md/usergroupv2/changepage",
paginationID,
"#tableID, #searchID, #"+searchID+", #paginationID, #dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
"#"+paginationID,
"outerHTML", "", "true",
dev_mdusergroupview.BeforeRequestContent(),
dev_mdusergroupview.AfterRequestContent(),
)
var retVal []templ.Component
newForm := dev_mdusergroupview.DeleteConfirmationBody(
models.CustomTextFieldv2Prm{Name: "usergroupid", Type: "hidden", Value: ""},
dialogDeleteBodyID,
"Apakah anda yakin menghapus user group berikut ?",
[]string{"Kode", "User Group"},
[]string{"", ""},
dev_mdusergroupview.JsHideModal("#"+dialogDeleteID))
toastSuccess := customtoastv2.CustomToastV2Show("Success", "Berhasil delete User group ", "success")
retVal = append(retVal, toastSuccess)
retVal = append(retVal, tableComponent)
retVal = append(retVal, userGroupPaginationComponent)
retVal = append(retVal, newForm)
return utils.ViewMulti(c, retVal)
}

View File

@@ -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)
}

View File

@@ -1,69 +0,0 @@
package dev_handlers
import (
"cpone/models"
"cpone/utils"
"html/template"
"strings"
xtemplmulti "cpone/views/dev/xtemplmulti"
"github.com/a-h/templ"
"github.com/labstack/echo/v4"
)
type XTemplMultiService interface {
}
func NewXTemplMultiHandler(us XTemplMultiService) *XTemplMultiHandler {
return &XTemplMultiHandler{
XTemplMultiService: us,
}
}
type XTemplMultiHandler struct {
XTemplMultiService XTemplMultiService
}
func (lh *MasterMenuUserGroupHandler) HandlerXTemplMulti(c echo.Context) error {
var arrTempl []models.XtemplModel
// toastComponent := customtoastv2.CustomToastV2Show("sukses", "halo", "warning")
newItem := models.XtemplModel{
NameTempl: "Komponen 1",
HtmlString: "<div style='background-color:red;'>Komponen 1<div>"}
newItem2 := models.XtemplModel{
NameTempl: "Komponen 2",
HtmlString: "<div style='background-color:purple;'>Komponen 2<div>"}
arrTempl = append(arrTempl, newItem, newItem2)
var stringx string
for _, item := range arrTempl {
stringx += item.HtmlString
}
tpl := template.Must(template.New("index").Parse(stringx))
var stringBuilder strings.Builder
if err := tpl.Execute(&stringBuilder, arrTempl); err != nil {
panic(err)
}
newItemFix := models.XtemplModel{
NameTempl: "Template Gabungan",
HtmlString: stringBuilder.String(),
}
arrTemplFix := []models.XtemplModel{newItemFix}
var templx []templ.Component
si := xtemplmulti.MainXTemplMulti(arrTemplFix)
templx = append(templx, si)
templx = append(templx, si)
// return utils.View(c, si)
return utils.ViewMulti(c, templx)
}

View File

@@ -1,118 +0,0 @@
package public_handlers
import (
"cpone/models"
"cpone/utils"
kartukontrol "cpone/views/public/kartukontrol"
public_toast "cpone/views/public/toast"
"github.com/a-h/templ"
"github.com/labstack/echo/v4"
"go.uber.org/zap"
)
type KartuKontrolService interface {
GetkartuKontrolById(nomorRegistrasi string) ([]models.KartuKontrolModel, error)
}
func NewKartuKontrolHandler(us KartuKontrolService) *KartuKontrolHandler {
return &KartuKontrolHandler{
KartuKontrolService: us,
}
}
type KartuKontrolHandler struct {
KartuKontrolService KartuKontrolService
}
func (lh *KartuKontrolHandler) HandlerHideToast(c echo.Context) error {
toastComponent := public_toast.PublicToastV1KartuKontrolHide()
si := toastComponent
return utils.View(c, si)
}
func (lh *KartuKontrolHandler) HandlerShowKartuKontrol(c echo.Context) error {
var flagxError bool = true
var msgx string = ""
nomorRegistrasi := c.Param("nomorRegistrasi")
urlSurveyMcu := "redirectsurveymcu"
// urlSurveyMcu := "redirectsurveymcu"
// nomorRegistrasi := "1"
logger, _ := zap.NewProduction()
defer logger.Sync()
dataKartuKontrol, err := lh.KartuKontrolService.GetkartuKontrolById(nomorRegistrasi)
if err != nil {
logger.Info("Error",
zap.Any("Error", err),
zap.Any("prm", nomorRegistrasi),
)
// return err
if flagxError {
msgx = "Error Get Kartu Kontrol"
si := public_toast.PublicToastV1KartuKontrolShow("Error", msgx, "danger")
return utils.View(c, si)
}
}
logger.Info("SHOW DATA KARTU KONTROL handler",
zap.Any("return", dataKartuKontrol),
zap.Any("prm", nomorRegistrasi),
)
flagxError = false
var si templ.Component
var isShowSurveyMcu bool = true
if isShowSurveyMcu {
si = kartukontrol.ShowKartuKontrol("Kartu Kontrol", kartukontrol.MainContentKartuKontrolLayout(dataKartuKontrol, "/modalsurveykartukontrol", "load delay:3s", "modalWordingSurveyMcu", urlSurveyMcu, nomorRegistrasi), kartukontrol.CssKartuKontrol(), kartukontrol.JsKartuKontrol())
} else {
si = kartukontrol.ShowKartuKontrol("Kartu Kontrol",
kartukontrol.MainContentKartuKontrolLayout(dataKartuKontrol, "", "", "modalWordingSurveyMcu", urlSurveyMcu, nomorRegistrasi), kartukontrol.CssKartuKontrol(), kartukontrol.JsKartuKontrol())
}
return utils.View(c, si)
}
func (lh *KartuKontrolHandler) HandlerShowWordingModalSurveyMcu(c echo.Context) error {
stringUrlToSurveyMcu := c.QueryParam("urlSurveyMcu")
// var dataKartuKontrol []models.KartuKontrolModel
si := kartukontrol.ShowKartuKontrol(
"Kartu Kontrol",
kartukontrol.ModalMcuWordingShow("modalWordingSurveyMcu", "Silahkan isi questioner untuk membantu peningkatan layanan kami. Terima kasih.", stringUrlToSurveyMcu), kartukontrol.CssKartuKontrol(), kartukontrol.JsKartuKontrol())
return utils.View(c, si)
}
func (lh *KartuKontrolHandler) HandlerRedirectToSurveyMcu(c echo.Context) error {
nomorRegistrasi := c.QueryParam("nomorRegistrasi")
stringUrlToSurveyMcu := "/surveymcu/" + nomorRegistrasi
logger, _ := zap.NewProduction()
defer logger.Sync()
if len(stringUrlToSurveyMcu) > 0 {
// redirect ke kartu kontrol
logger.Info("redirect SURVEY MCU",
zap.Any("redirect SURVEY MCU", stringUrlToSurveyMcu),
)
c.Response().Header().Set("HX-Redirect", stringUrlToSurveyMcu)
// return c.NoContent(http.StatusOK)
}
si := kartukontrol.ShowKartuKontrol(
"Kartu Kontrol",
kartukontrol.ModalMcuWordingShow("modalWordingSurveyMcu", "Silahkan isi questioner untuk membantu peningkatan layanan kami. Terima kasih.", ""), kartukontrol.CssKartuKontrol(), kartukontrol.JsKartuKontrol())
return utils.View(c, si)
}

View File

@@ -1,194 +0,0 @@
package public_handlers
import (
"cpone/models"
"cpone/utils"
surveymcu "cpone/views/public/surveymcu"
public_toast "cpone/views/public/toast"
"github.com/a-h/templ"
"github.com/labstack/echo/v4"
"go.uber.org/zap"
)
type SurveyMcuService interface {
GetSurveyMcuByNoreg(nomorRegistrasi string) ([]models.SurveyMcu, error)
}
func NewSurveyMcuHandler(us SurveyMcuService) *SurveyMcuHandler {
return &SurveyMcuHandler{
SurveyMcuService: us,
}
}
type SurveyMcuHandler struct {
SurveyMcuService SurveyMcuService
}
func (lh *SurveyMcuHandler) HandlerShowSurveyMcu(c echo.Context) error {
var flagxError bool = true
var msgx string = ""
nomorRegistrasi := c.Param("nomorRegistrasi")
// nomorRegistrasi := "1"
logger, _ := zap.NewProduction()
defer logger.Sync()
dataSurveyMcu, err := lh.SurveyMcuService.GetSurveyMcuByNoreg(nomorRegistrasi)
if err != nil {
logger.Info("Error",
zap.Any("Error", err),
zap.Any("prm", nomorRegistrasi),
)
// return err
if flagxError {
msgx = "Error Get Survey MCU By No Reg"
si := public_toast.PublicToastV1KartuKontrolShow("Error", msgx, "danger")
return utils.View(c, si)
}
}
flagxError = false
logger.Info("SHOW DATA SURVEY MCU handler",
zap.Any("return", dataSurveyMcu),
zap.Any("prm", nomorRegistrasi),
)
stringUrl := "surveymcuproses/" + nomorRegistrasi
var hxInclude string = ""
var idClearMsg []models.IdClearErrorMessage
if len(dataSurveyMcu) > 0 {
hxInclude = utils.ConcatHxIncludeSurveyMcu(dataSurveyMcu)
}
si := surveymcu.ShowSurveyMcu("Survey Mcu",
surveymcu.MainContentSurveyMcuLayout(dataSurveyMcu, stringUrl, surveymcu.ErrorMessageSurveyMcu("", "", idClearMsg, "alertSaranMcu", public_toast.PublicToastV1KartuKontrolHide()), hxInclude), surveymcu.CssSurveyMcu(), surveymcu.JsSurveyMcu())
return utils.View(c, si)
}
func (lh *SurveyMcuHandler) HandlerProcessSurveyMcu(c echo.Context) error {
var flagxError bool = true
var msgx string = ""
nomorRegistrasi := c.Param("nomorRegistrasi")
stringUrlBackToKartuKontrol := "/kartukontrol/" + nomorRegistrasi
// nomorRegistrasi := "1"
logger, _ := zap.NewProduction()
defer logger.Sync()
dataSurveyMcu, err := lh.SurveyMcuService.GetSurveyMcuByNoreg(nomorRegistrasi)
if err != nil {
logger.Info("Error",
zap.Any("Error", err),
zap.Any("prm", nomorRegistrasi),
)
// return err
if flagxError {
msgx = "Error Get Survey MCU By No Reg"
si := public_toast.PublicToastV1KartuKontrolShow("Error", msgx, "danger")
return utils.View(c, si)
}
}
logger.Info("SHOW DATA SURVEY MCU handler",
zap.Any("return", dataSurveyMcu),
zap.Any("prm", nomorRegistrasi),
)
// form := c.Request().PostForm
// stringUrl := "surveymcuproses/" + nomorRegistrasi
logger.Info("CEK POST handler",
zap.Any("c.FormValue Saran", c.FormValue("saranmcu-11")),
)
// proses validasi
var si templ.Component
var idFormKosong string = ""
var stringMessage string = ""
var isFormEmpty bool = false
var idClearMsg []models.IdClearErrorMessage
var idSaranMcuAlert string = ""
// var idSaranMcuClear string = ""
hasError := false
if len(dataSurveyMcu) > 0 {
for _, v := range dataSurveyMcu {
// radio button
if len(v.DataListItemSurveyMcu) > 0 {
for _, x := range v.DataListItemSurveyMcu {
if len(c.FormValue("radio-"+x.IDItemSurvey)) > 0 {
idClearMsg = append(idClearMsg, models.IdClearErrorMessage{IdItem: x.IDItemSurvey})
}
if "default-"+x.NameRadioButton == c.FormValue("default-"+x.NameRadioButton) && len(c.FormValue("radio-"+x.IDItemSurvey)) == 0 {
stringMessage = "Pertanyaan ke-" + x.IDItemSurvey + " wajib diisi"
idFormKosong = utils.GetIdSurveyMcu(x.IDItemSurvey)
isFormEmpty = true
hasError = true
flagxError = true
break
}
}
}
if hasError {
break
}
}
}
// saran mcu
if !hasError && len(dataSurveyMcu) > 0 {
for _, v := range dataSurveyMcu {
if len(v.DataListItemSurveyMcuSaran) > 0 {
for _, x := range v.DataListItemSurveyMcuSaran {
if len(c.FormValue("saranmcu-"+x.IDItemSurveyMcuSaran)) > 0 {
idClearMsg = append(idClearMsg, models.IdClearErrorMessage{IdItem: x.IDItemSurveyMcuSaran})
}
if "default-"+x.NameSurveyMcuSaran == c.FormValue("default-"+x.NameSurveyMcuSaran) && len(c.FormValue("saranmcu-"+x.IDItemSurveyMcuSaran)) == 0 {
stringMessage = "Saran Wajib Diisi"
idFormKosong = utils.GetIdSurveyMcu(x.IDItemSurveyMcuSaran)
isFormEmpty = true
hasError = true
break
}
}
}
if hasError {
break
}
}
}
if isFormEmpty {
// if flagxError {
// msgx = "Error Get Survey MCU By No Reg"
// si := public_toast.PublicToastV1KartuKontrolShow("Error", msgx, "danger")
// return utils.View(c, si)
// }
si = surveymcu.ErrorMessageSurveyMcu(stringMessage, idFormKosong, idClearMsg, idSaranMcuAlert, public_toast.PublicToastV1KartuKontrolShow("Warning", stringMessage, "warning"))
} else {
flagxError = false
si = surveymcu.ErrorMessageSurveyMcu("", "", idClearMsg, "", public_toast.PublicToastV1KartuKontrolHide())
logger.Info("redirect",
zap.Any("redirect", stringUrlBackToKartuKontrol),
)
// redirect ke kartu kontrol
c.Response().Header().Set("HX-Redirect", stringUrlBackToKartuKontrol)
}
return utils.View(c, si)
}

View File

@@ -36,7 +36,7 @@ func (lh *ToolsHandler) HandlerHideToast(c echo.Context) error {
func (lh *ToolsHandler) HandlerShowToast(c echo.Context) error {
inputansearchComponent := tablecomponent.DivEmpty()
// toastComponent := public_toast.PublicToastV1Show("Success", "Success Loaded", "success")
toastComponent := public_toast.PublicToastV1Show("Success", "Success Loaded", "success")
pagination := tablecomponent.DivEmpty()
dummyData := []models.UserGroupV1{
@@ -54,10 +54,11 @@ func (lh *ToolsHandler) HandlerShowToast(c echo.Context) error {
tabelusergroupComponent := tablecomponent.TableV2(
[]string{"KODE", "USERGROUP", "AKSI"},
[]string{"40%", "40%", "20%"},
mastermenuusergroup.TableRowV1(dummyData, "", "", "", "", "", "", "", ""),
mastermenuusergroup.TableRowV1(dummyData),
pagination,
"",
inputansearchComponent,
toastComponent,
)
si := public_toast.ShowToast("",

View File

@@ -46,6 +46,8 @@ func SetupRoutesLandingPage(app *echo.Echo, h *dev_handlers.LandingPageHandler,
// autocomplete.GET("/autocomplete", mastermenuusergroupHandler.HandlerListAutoComplete)
// autocomplete.GET("/autoCompleteLoadMore/:pageOf/:searchParam/:limit", mastermenuusergroupHandler.HandlerListAutoCompleteLoadMore)
// autocomplete.GET("/autoCompleteSetValue/:setvalue", mastermenuusergroupHandler.HandlerListAutoCompleteAfterSelected)
clientgroup.GET("/usergroup/edit", mastermenuusergroupHandler.ChangeFormEdit)
clientgroup.GET("/usergroup/pagination", mastermenuusergroupHandler.HandleChangePage)
}
func SetupRoutesPieChart(app *echo.Echo, h *dev_handlers.PiechartHandler) {
@@ -69,25 +71,10 @@ func SetupRoutesPublic(app *echo.Echo, appStore db.AppStore) {
loginHdr := public_handlers.NewLoginHandler(l)
public.GET("login", loginHdr.HandlerShowLogin)
// kartu kontrol
publicKartuKontrolServices := public_services.NewServicesKartuKontrol(appStore)
publicKartuKontrolhandlers := public_handlers.NewKartuKontrolHandler(publicKartuKontrolServices)
public.GET("kartukontrol/:nomorRegistrasi", publicKartuKontrolhandlers.HandlerShowKartuKontrol)
public.GET("modalsurveykartukontrol", publicKartuKontrolhandlers.HandlerShowWordingModalSurveyMcu)
// survey mcu page (pertanyaan dan jawaban)
publicSurveyMcuServices := public_services.NewServicesSurveyMcu(appStore)
publicSurveyMcuhandlers := public_handlers.NewSurveyMcuHandler(publicSurveyMcuServices)
public.GET("surveymcu/:nomorRegistrasi", publicSurveyMcuhandlers.HandlerShowSurveyMcu)
// hide toast
public.GET("hidetoastkartukontrol", publicKartuKontrolhandlers.HandlerHideToast)
// surveymcuproses
public.POST("surveymcuproses/:nomorRegistrasi", publicSurveyMcuhandlers.HandlerProcessSurveyMcu)
// redirect to survey mcu page
public.GET("redirectsurveymcu", publicKartuKontrolhandlers.HandlerRedirectToSurveyMcu)
// FOR TOAST
toastHdr := public_handlers.NewToolsHandler(l)
public.GET("toastpublic", toastHdr.HandlerShowToast)
public.GET("hidetoastpublic", toastHdr.HandlerHideToast)
}
func SetupRoutesCorporate(app *echo.Echo, appStore db.AppStore) {
public := app.Group("/corp")
@@ -205,96 +192,22 @@ func SetupRoutesDev(app *echo.Echo, appStore db.AppStore) {
//DEV USERGROUP
devUGServices := dev_services.NewServicesMasterMenuUserGroup(appStore)
devUGhandlers := dev_handlers.NewMasterMenuUserGroupHandler(devUGServices)
// dev.GET("/usergroup", devUGhandlers.HandlerShowMasterMenuUserGroup)
// dev.GET("/usergroup/pagination", devUGhandlers.HandleChangePage)
dev.GET("/usergroup", devUGhandlers.HandlerShowMasterMenuUserGroup)
dev.GET("/usergroup/pagination", devUGhandlers.HandleChangePage)
dev.POST("/usergroup/add", devUGhandlers.AddUserGroup)
dev.POST("/usergroup/edit", devUGhandlers.EditUserGroup)
dev.POST("/usergroup/delete", devUGhandlers.DeleteUserGroup)
dev.GET("/usergroup/delete/:id", devUGhandlers.DeleteUserGroup)
dev.GET("/hidetoast", devUGhandlers.HandlerHideToast)
// try
dev.GET("/usergroupv1", devUGhandlers.HandlerShowMasterMenuUserGroupV1)
dev.GET("/breadcrumbv1", devUGhandlers.HandlerShowBreadCrumbV1)
dev.GET("/searchusergroupv1", devUGhandlers.HandlerShowMasterMenuUserGroupSearchV1)
dev.GET("/usergroupv1pagination", devUGhandlers.HandlerShowMasterMenuUserGroupPaginationV1)
dev.POST("/usergrouphandlecloseform", devUGhandlers.HandleCloseForm)
dev.POST("/usergrouphandlecloseformedit", devUGhandlers.HandleCloseFormEdit)
dev.POST("/usergrouphandlecloseformdelete", devUGhandlers.HandleCloseFormDelete)
dev.GET("/usergroupshoweditform", devUGhandlers.HandleEditForm)
dev.GET("/usergroupshowdeleteform", devUGhandlers.HandleDeleteForm)
//ugcobanady
dev.GET("/usergrouptryandy", devUGhandlers.HandlerShowMasterMenuUserGroupTryAndy)
dev.GET("/hidetoast", devUGhandlers.HandlerHideToast)
dev.GET("/xtemplmulti", devUGhandlers.HandlerXTemplMulti)
// clientgroup.GET("/usergroup/edit", mastermenuusergroupHandler.ChangeFormEdit)
// clientgroup.GET("/usergroup/pagination", mastermenuusergroupHandler.HandleChangePage)
//New User Group
devMdUserGroupServices := dev_services.NewMdUserGroupServices(appStore)
devMdUserGroupHandlers := dev_handlers.NewMdUserGroupHandler(devMdUserGroupServices)
dev.GET("/md/usergroupv2", devMdUserGroupHandlers.HandleShowMdUserGroupScreen)
dev.GET("/md/usergroupv2/filter", devMdUserGroupHandlers.HandleFilterMdUserGroup)
dev.GET("/md/usergroupv2/changepage", devMdUserGroupHandlers.HandleChangePageMdUserGroup)
dev.POST("/md/usergroupv2/closeaddform", devMdUserGroupHandlers.HandleCloseFormAdd)
dev.POST("/md/usergroupv2/add", devMdUserGroupHandlers.HandleAddUserGroup)
dev.GET("/md/usergroupv2/openedit", devMdUserGroupHandlers.HandleOpenEditForm)
dev.POST("/md/usergroupv2/closeeditform", devMdUserGroupHandlers.HandleCloseFormEdit)
dev.POST("/md/usergroupv2/edit", devMdUserGroupHandlers.HandleEditUserGroup)
dev.GET("/md/usergroupv2/opendelete", devMdUserGroupHandlers.HandleOpenDeleteForm)
dev.POST("/md/usergroupv2/closedeleteform", devMdUserGroupHandlers.HandleCloseFormDelete)
dev.POST("/md/usergroupv2/delete", devMdUserGroupHandlers.HandleDeleteUserGroup)
// group result
devGRServices := dev_services.NewServicesGroupResult(appStore)
devGRhandlers := dev_handlers.NewGroupResultHandler(devGRServices)
dev.GET("/groupresult", devGRhandlers.HandlerShowGroupResultV1)
dev.GET("/searchgroupresultv1", devGRhandlers.HandlerShowGroupResultSearchV1)
dev.GET("/groupresultv1pagination", devGRhandlers.HandlerShowGroupResultPaginationV1)
dev.POST("/groupresulthandlecloseform", devGRhandlers.HandleCloseForm)
dev.POST("/groupresulthandlecloseformedit", devGRhandlers.HandleCloseFormEdit)
dev.GET("/groupresultshoweditform", devGRhandlers.HandleEditForm)
dev.GET("/groupresultshowdeleteform", devGRhandlers.HandleDeleteForm)
// dev.GET("/groupresultshowdeleteform", devGRhandlers.HandleDeleteForm)
// form add
dev.POST("/groupresult/add", devGRhandlers.AddGroupResult)
dev.POST("/groupresult/edit", devGRhandlers.EditGroupResult)
dev.POST("/groupresult/delete", devGRhandlers.DeleteGroupResult)
// masterdata nat unit
devMdNatUnitServices := dev_services.NewMdNatUnitServices(appStore)
devMdNatUnitHandlers := dev_handlers.NeWMdNatUnitHandler(devMdNatUnitServices)
dev.GET("/md/natunit", devMdNatUnitHandlers.HandleShowMdNatUnitScreen)
dev.GET("/md/natunit/filter", devMdNatUnitHandlers.HandleFilterMdNatUnit)
dev.GET("/md/natunit/changepage", devMdNatUnitHandlers.HandlerChangePageMdNatUnit)
dev.POST("/md/natunit/closeaddform", devMdNatUnitHandlers.HandlerCloseFormAdd)
dev.POST("/md/natunit/add", devMdNatUnitHandlers.HandlerAddNatUnit)
dev.GET("/md/natunit/openedit", devMdNatUnitHandlers.HandlerOpenEditForm)
dev.POST("/md/natunit/closeeditform", devMdNatUnitHandlers.HandlerCloseFormEdit)
dev.POST("/md/natunit/edit", devMdNatUnitHandlers.HandlerEditNatUnit)
dev.GET("/md/natunit/opendelete", devMdNatUnitHandlers.HandlerOpenDeleteForm)
dev.POST("/md/natunit/closedeleteform", devMdNatUnitHandlers.HandlerCloseFormDelete)
dev.POST("/md/natunit/delete", devMdNatUnitHandlers.HandlerDeleteNatUnit)
// group result v2
devMdGRServices := dev_services.NewServicesMdGroupResult(appStore)
devMdGRhandlers := dev_handlers.NewMdGroupResultHandler(devMdGRServices)
dev.GET("/md/groupresultv2", devMdGRhandlers.HandleShowMdGroupResultScreen)
dev.GET("/md/groupresultv2/filter", devMdGRhandlers.HandleFilterMdGroupResult)
dev.GET("/md/groupresultv2/changepage", devMdGRhandlers.HandleChangePageMdGroupResult)
dev.POST("/md/groupresultv2/closeaddform", devMdGRhandlers.HandleCloseFormAdd)
dev.POST("/md/groupresultv2/add", devMdGRhandlers.HandleAddGroupResult)
dev.GET("/md/groupresultv2/openedit", devMdGRhandlers.HandleOpenEditForm)
dev.POST("/md/groupresultv2/closeeditform", devMdGRhandlers.HandleCloseFormEdit)
dev.POST("/md/groupresultv2/edit", devMdGRhandlers.HandleEditGroupResult)
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)
}

View File

@@ -226,13 +226,8 @@ templ CorporateLayout(title string, css templ.Component, js templ.Component, nav
// toast
<div class="toast-top-right" id="container-system-notification" style="position: absolute; top: 1vh; right: 0vw; z-index: 999;">
<!-- toast success -->
<div
id="notification-001"
class="toast fade hide"
role="alert"
aria-live="assertive"
aria-atomic="true"
>
<div id="notification-001"
class="toast fade hide" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header bg-success text-white">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--ep mr-2 icon-xl" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 1024 1024" data-icon="ep:success-filled"><path fill="currentColor" d="M512 64a448 448 0 1 1 0 896a448 448 0 0 1 0-896m-55.808 536.384l-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"></path></svg>
<strong class="mr-auto">Success</strong>
@@ -247,6 +242,7 @@ templ CorporateLayout(title string, css templ.Component, js templ.Component, nav
</div>
</div>
// end toast
{ children... }
</div>
<!--end::Content-->

View File

@@ -12,5 +12,4 @@ type CustomTextFieldv2Prm struct {
Type string `default:"text"`
Value string `default:""`
ErrorMsg string `default:""`
ID string
}

View File

@@ -1,18 +0,0 @@
package models
// name string, id string, hxTarget string, hxGet string, hxIndicator string, hxTrigger string, hxInclude string,
type CustomCheckboxv1Prm struct {
HxTarget string `default:"hxTarget"`
HxGet string `default:"hxGet"`
HxIndicator string `default:"hxIndicator"`
HxInclude string `default:"hxInclude"`
HxTrigger string `default:"hxTrigger"`
Label string `default:"Label"`
Name string `default:"name"`
Text string `default:"text"`
// Type string `default:"text"`
Value string `default:""`
ErrorMsg string `default:""`
ID string
}

View File

@@ -1,18 +0,0 @@
package models
// name string, id string, hxTarget string, hxGet string, hxIndicator string, hxTrigger string, hxInclude string,
type CustomDropdownv1Prm struct {
HxTarget string `default:"hxTarget"`
HxGet string `default:"hxGet"`
HxIndicator string `default:"hxIndicator"`
HxInclude string `default:"hxInclude"`
HxTrigger string `default:"hxTrigger"`
Label string `default:"Label"`
Name string `default:"name"`
// Placeholder string `default:"Placeholder"`
// Type string `default:"text"`
// Value string `default:""`
ErrorMsg string `default:""`
ID string
}

View File

@@ -1,38 +0,0 @@
package models
import "github.com/a-h/templ"
type GroupResultResumeMcu struct {
Text string `default:"text"`
ID int `default:"id"`
}
type GroupResult struct {
Nomor string `db:"nomor"`
Group_ResultID int `db:"Group_ResultID"`
Group_ResultName string `db:"Group_ResultName"`
Group_ResultFlagPerTest string `db:"Group_ResultFlagPerTest"`
Group_ResultFlagNonLab string `db:"Group_ResultFlagNonLab"`
Group_ResultResumeMcu string `db:"Group_ResultResumeMcu"`
Group_ResultIsActive string `db:"Group_ResultIsActive"`
}
// form component
type GroupResultFormComponent struct {
IDComponent string
Link string
HxTarget string
HxSwap string
HxInclude string
ModalID string
ModalTitle string
InputGroupResultName CustomTextFieldv2Prm
InputGroupResult CustomTextFieldv2Prm
CheckboxGroupResultFlagPerTest CustomCheckboxv1Prm
CheckboxGroupResultFlagNonLab CustomCheckboxv1Prm
InputID CustomTextFieldv2Prm
DropdownGroupResultResumeMcu CustomDropdownv1Prm
DialogBody templ.Component
DialogAction templ.Component
ButtonCLose templ.Component
}

View File

@@ -1,33 +0,0 @@
package models
type KartuKontrolModel struct {
KartuKontrolDataPasienList []DataPasien `json:"kartuKontrolDataPasien"`
KartuKontrolDataPemeriksaanList []DataPemeriksaanList `json:"kartuKontrolDataPemeriksaanList"`
KartuKontrolDataPemeriksaanPengambilanSample []DataPemeriksaanPengambilanSample `json:"kartuKontrolDataPemeriksaanPengambilanSample"`
}
type DataPasien struct {
NomorRegistrasi string `json:"nomorRegistrasi"`
NomorLab string `json:"nomorLab"`
NamaPasien string `json:"namaPasien"`
TanggalLahir string `json:"tanggalLahir"`
Umur string `json:"umur"`
JenisKelamin string `json:"jenisKelamin"`
NamaDivisi string `json:"namaDivisi"`
NamaCompany string `json:"namaCompany"`
}
type DataPemeriksaanList struct {
NamaPemeriksaanList string `json:"namaPemeriksaanList"`
}
type SampleTypeList struct {
SampleTypeName string `json:"sampleTypeName"`
SampleTypeDateTime string `json:"sampleTypeDateTime"`
SampleTypeStatus string `json:"sampleTypeStatus"`
}
type DataPemeriksaanPengambilanSample struct {
NamaPemeriksaanPengambilanSample string `json:"namaPemeriksaanPengambilanSample"`
SampleTypeListData []SampleTypeList `json:"sampleTypeListData"`
}

View File

@@ -1,17 +0,0 @@
package models
type Menu struct {
ID string `json:"id"`
ParentMenuID string `json:"parent_menu_id"`
ParentMenuName string `json:"parent_menu_name"`
ParentUrl string `json:"parent_url"`
ParentIcon string `json:"parent_icon"`
Children []ChildrenMenu `json:"children"`
}
type ChildrenMenu struct {
ChildrenParentID string `json:"children_parent_id"`
ChildrenMenuID string `json:"children_menu_id"`
ChildrenMenuName string `json:"children_menu_name"`
ChildrenMenuURL string `json:"children_menu_url"`
// Breadcrumb []Breadcrumb `json:"breadcrumb"`
}

View File

@@ -1,29 +0,0 @@
package models
import "github.com/a-h/templ"
type NatUnit struct {
Nomor string `db:"nomor"`
Nat_UnitID int `db:"Nat_UnitID"`
Nat_UnitCode string `db:"Nat_UnitCode"`
Nat_UnitName string `db:"Nat_UnitName"`
Nat_UnitCreated string `db:"Nat_UnitCreated"`
Nat_UnitLastUpdated string `db:"Nat_UnitLastUpdated"`
Nat_UnitIsActive string `db:"Nat_UnitIsActive"`
}
type NatUnitFormComponent struct {
IDComponent string
Link string
HxTarget string
HxSwap string
HxInclude string
ModalID string
ModalTitle string
InputName CustomTextFieldv2Prm
InputCode CustomTextFieldv2Prm
InputID CustomTextFieldv2Prm
DialogBody templ.Component
DialogAction templ.Component
ButtonCLose templ.Component
}

View File

@@ -1,24 +0,0 @@
package models
type SurveyMcu struct {
DataListItemSurveyMcu []ItemSurveyMcu `json:"dataListItemSurveyMcu"`
DataListItemSurveyMcuSaran []ItemSurveyMcuSaran `json:"datalistitemsurveymcusaran"`
}
type ItemSurveyMcu struct {
IDItemSurvey string `json:"iditemsurvey"`
Nomor string `json:"nomor"`
Pertanyaan string `json:"pertanyaan"`
NameRadioButton string `json:"nameradiobutton"`
ErrorMessage string `json:"errorMessage"`
}
type ItemSurveyMcuSaran struct {
IDItemSurveyMcuSaran string `json:"iditemsurveymcusaran"`
NameSurveyMcuSaran string `json:"namesurveymcusaran"`
ErrorMessageSurveyMcuSaran string `json:"errormessagesurveymcusaran"`
}
type IdClearErrorMessage struct {
IdItem string `json:"iditem"`
}

View File

@@ -1,7 +1,5 @@
package models
import "github.com/a-h/templ"
type UserGroup struct {
UserGroupID int `json:"user_group_id"`
UserGroupKode string `json:"user_group_kode"`
@@ -9,43 +7,11 @@ type UserGroup struct {
}
type UserGroupV1 struct {
Nomor string `db:"nomor"`
M_UserGroupID int `db:"M_UserGroupID"`
M_UserGroupCode string `db:"M_UserGroupCode"`
M_UserGroupName string `db:"M_UserGroupName"`
M_UserGroupCreated string `db:"M_UserGroupCreated"`
M_UserGroupLastUpdated string `db:"M_UserGroupLastUpdated"`
M_UserGroupIsActive string `db:"M_UserGroupIsActive"`
M_UserGroupCreatedUserID string `db:"M_UserGroupCreatedUserID"`
M_UserGroupLastUpdatedUserID string `db:"M_UserGroupLastUpdatedUserID"`
M_UserGroupDeleted string `db:"M_UserGroupDeleted"`
M_UserGroupDeletedUserID string `db:"M_UserGroupDeletedUserID"`
}
type UserGroupFormComponent struct {
IDComponent string
Link string
HxTarget string
HxSwap string
HxInclude string
ModalID string
ModalTitle string
InputName CustomTextFieldv2Prm
InputCode CustomTextFieldv2Prm
InputID CustomTextFieldv2Prm
DialogBody templ.Component
DialogAction templ.Component
ButtonCLose templ.Component
}
type UserGroupFormConfirmation struct {
IDComponent string
Link string
HxTarget string
HxSwap string
HxInclude string
ModalID string
ModalTitle string
DialogBody templ.Component
DialogAction templ.Component
ButtonCLose templ.Component
Nomor string `db:"nomor"`
M_UserGroupID int `db:"M_UserGroupID"`
M_UserGroupCode string `db:"M_UserGroupCode"`
M_UserGroupName string `db:"M_UserGroupName"`
M_UserGroupCreated string `db:"M_UserGroupCreated"`
M_UserGroupLastUpdated string `db:"M_UserGroupLastUpdated"`
M_UserGroupIsActive string `db:"M_UserGroupIsActive"`
}

View File

@@ -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"`
}

View File

@@ -1,6 +0,0 @@
package models
type XtemplModel struct {
NameTempl string `json:"nametempl"`
HtmlString string `json:"htmlString"`
}

View File

@@ -1,516 +0,0 @@
package services
import "cpone/models"
//Func get menu sidebar
func GetMenu() ([]models.Menu, error) {
// dummyBreadcrumb := []Breadcrumb{
// {
// Name: "Dashboard",
// Url: "/client/dashboard",
// },
// {
// Name: "Front Office",
// Url: "/client/usermanagement",
// },
// }
dummyMenu := []models.Menu{
// 1. Dashboard
{
ID: "1",
ParentMenuID: "0",
ParentMenuName: "Dashboard",
ParentUrl: "/client/md/dashboard",
ParentIcon: "",
Children: []models.ChildrenMenu{
{
ChildrenParentID: "1",
ChildrenMenuID: "1",
ChildrenMenuName: "Master User",
ChildrenMenuURL: "/client/md/user",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "Y",
// },
// },
},
},
},
// 2. Front Office
{
ID: "2",
ParentMenuID: "1",
ParentMenuName: "Front Office",
ParentUrl: "#",
ParentIcon: "",
Children: []models.ChildrenMenu{
{
ChildrenParentID: "1",
ChildrenMenuID: "1",
ChildrenMenuName: "Registrasi",
ChildrenMenuURL: "/fo/registrasi",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User",
// IsActive: "Y",
// },
// },
},
},
},
// 3. Station
{
ID: "3",
ParentMenuID: "2",
ParentMenuName: "Station",
ParentUrl: "#",
ParentIcon: "",
Children: []models.ChildrenMenu{
{
ChildrenParentID: "2",
ChildrenMenuID: "1",
ChildrenMenuName: "Sample Station",
ChildrenMenuURL: "/station/sample",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User",
// IsActive: "Y",
// },
// },
},
},
},
// 4. Management MCU
{
ID: "4",
ParentMenuID: "3",
ParentMenuName: "Management MCU",
ParentUrl: "#",
ParentIcon: "",
Children: []models.ChildrenMenu{
{
ChildrenParentID: "3",
ChildrenMenuID: "1",
ChildrenMenuName: "Setup MCU",
ChildrenMenuURL: "/mcu/setup",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User",
// IsActive: "Y",
// },
// },
},
{
ChildrenParentID: "3",
ChildrenMenuID: "2",
ChildrenMenuName: "Pre-Registrasi",
ChildrenMenuURL: "/mcu/preregister",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User",
// IsActive: "Y",
// },
// },
},
},
},
// 5. Master Data
{
ID: "5",
ParentMenuID: "4",
ParentMenuName: "Master Data",
ParentUrl: "#",
ParentIcon: "",
Children: []models.ChildrenMenu{
// * Master User
{
ChildrenParentID: "4",
ChildrenMenuID: "1",
ChildrenMenuName: "Master User",
ChildrenMenuURL: "/client/md/user",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User",
// IsActive: "Y",
// },
// },
},
// * Master User Group
{
ChildrenParentID: "4",
ChildrenMenuID: "2",
ChildrenMenuName: "Master User Group",
ChildrenMenuURL: "/client/md/usergroup",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Master Corporate
{
ChildrenParentID: "4",
ChildrenMenuID: "3",
ChildrenMenuName: "Corporate",
ChildrenMenuURL: "/client/md/corp",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Test
{
ChildrenParentID: "4",
ChildrenMenuID: "4",
ChildrenMenuName: "Test",
ChildrenMenuURL: "/client/md/test",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Bahan
{
ChildrenParentID: "4",
ChildrenMenuID: "5",
ChildrenMenuName: "Bahan",
ChildrenMenuURL: "/client/md/bahan",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Sample Type
{
ChildrenParentID: "4",
ChildrenMenuID: "6",
ChildrenMenuName: "Sample Type",
ChildrenMenuURL: "/client/sample/type",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Sample Station
{
ChildrenParentID: "4",
ChildrenMenuID: "7",
ChildrenMenuName: "Sample Station",
ChildrenMenuURL: "/station/sample",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Result Non Lab
{
ChildrenParentID: "4",
ChildrenMenuID: "8",
ChildrenMenuName: "Result Non Lab",
ChildrenMenuURL: "/client/md/resultnonlab",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Template Fisik
{
ChildrenParentID: "4",
ChildrenMenuID: "9",
ChildrenMenuName: "Template Fisik",
ChildrenMenuURL: "/client/md/template-fisik",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Pasien
{
ChildrenParentID: "4",
ChildrenMenuID: "10",
ChildrenMenuName: "Pasien",
ChildrenMenuURL: "/client/md/pasien",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Dokter
{
ChildrenParentID: "4",
ChildrenMenuID: "11",
ChildrenMenuName: "Dokter",
ChildrenMenuURL: "/client/md/dokter",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Paket
{
ChildrenParentID: "4",
ChildrenMenuID: "12",
ChildrenMenuName: "Paket",
ChildrenMenuURL: "/client/md/paket",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Harga Single
{
ChildrenParentID: "4",
ChildrenMenuID: "13",
ChildrenMenuName: "Harga Single",
ChildrenMenuURL: "/client/md/hargasingle",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
},
},
}
return dummyMenu, nil
}
func GetUserLogin() (models.User, error) {
a := models.User{
UserID: 1,
Username: "andy",
UserFullName: "Alfianto Andy P",
UserPosition: "Software Developer",
}
return a, nil
}

View File

@@ -1,878 +0,0 @@
package dev_services
import (
"cpone/db"
"cpone/models"
"fmt"
"math"
"strconv"
"strings"
dbx "cpone/package/database"
"go.uber.org/zap"
)
func NewServicesGroupResult(uStore db.AppStore) *ServicesGroupResult {
return &ServicesGroupResult{
GroupResultStore: uStore,
}
}
type ServicesGroupResult struct {
GroupResultStore db.AppStore
}
func (su *ServicesGroupResult) GetMasterMenus() ([]MasterMenu, error) {
// dummyBreadcrumb := []Breadcrumb{
// {
// Name: "Dashboard",
// Url: "/client/dashboard",
// },
// {
// Name: "Front Office",
// Url: "/client/usermanagement",
// },
// }
dummyMenu := []MasterMenu{
// 1. Dashboard
{
ID: "1",
ParentMenuID: "0",
ParentMenuName: "Dashboard",
ParentUrl: "/client/md/dashboard",
ParentIcon: "",
Children: []ChildrenMenu{
{
ChildrenParentID: "1",
ChildrenMenuID: "1",
ChildrenMenuName: "Master User",
ChildrenMenuURL: "/client/md/user",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "Y",
// },
// },
},
},
},
// 2. Front Office
{
ID: "2",
ParentMenuID: "1",
ParentMenuName: "Front Office",
ParentUrl: "#",
ParentIcon: "",
Children: []ChildrenMenu{
{
ChildrenParentID: "1",
ChildrenMenuID: "1",
ChildrenMenuName: "Registrasi",
ChildrenMenuURL: "/fo/registrasi",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User",
// IsActive: "Y",
// },
// },
},
},
},
// 3. Station
{
ID: "3",
ParentMenuID: "2",
ParentMenuName: "Station",
ParentUrl: "#",
ParentIcon: "",
Children: []ChildrenMenu{
{
ChildrenParentID: "2",
ChildrenMenuID: "1",
ChildrenMenuName: "Sample Station",
ChildrenMenuURL: "/station/sample",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User",
// IsActive: "Y",
// },
// },
},
},
},
// 4. Management MCU
{
ID: "4",
ParentMenuID: "3",
ParentMenuName: "Management MCU",
ParentUrl: "#",
ParentIcon: "",
Children: []ChildrenMenu{
{
ChildrenParentID: "3",
ChildrenMenuID: "1",
ChildrenMenuName: "Setup MCU",
ChildrenMenuURL: "/mcu/setup",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User",
// IsActive: "Y",
// },
// },
},
{
ChildrenParentID: "3",
ChildrenMenuID: "2",
ChildrenMenuName: "Pre-Registrasi",
ChildrenMenuURL: "/mcu/preregister",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User",
// IsActive: "Y",
// },
// },
},
},
},
// 5. Master Data
{
ID: "5",
ParentMenuID: "4",
ParentMenuName: "Master Data",
ParentUrl: "#",
ParentIcon: "",
Children: []ChildrenMenu{
// * Master User
{
ChildrenParentID: "4",
ChildrenMenuID: "1",
ChildrenMenuName: "Master User",
ChildrenMenuURL: "/client/md/user",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User",
// IsActive: "Y",
// },
// },
},
// * Master User Group
{
ChildrenParentID: "4",
ChildrenMenuID: "2",
ChildrenMenuName: "Master User Group",
ChildrenMenuURL: "/client/md/usergroup",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Master Corporate
{
ChildrenParentID: "4",
ChildrenMenuID: "3",
ChildrenMenuName: "Corporate",
ChildrenMenuURL: "/client/md/corp",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Test
{
ChildrenParentID: "4",
ChildrenMenuID: "4",
ChildrenMenuName: "Test",
ChildrenMenuURL: "/client/md/test",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Bahan
{
ChildrenParentID: "4",
ChildrenMenuID: "5",
ChildrenMenuName: "Bahan",
ChildrenMenuURL: "/client/md/bahan",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Sample Type
{
ChildrenParentID: "4",
ChildrenMenuID: "6",
ChildrenMenuName: "Sample Type",
ChildrenMenuURL: "/client/sample/type",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Sample Station
{
ChildrenParentID: "4",
ChildrenMenuID: "7",
ChildrenMenuName: "Sample Station",
ChildrenMenuURL: "/station/sample",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Result Non Lab
{
ChildrenParentID: "4",
ChildrenMenuID: "8",
ChildrenMenuName: "Result Non Lab",
ChildrenMenuURL: "/client/md/resultnonlab",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Template Fisik
{
ChildrenParentID: "4",
ChildrenMenuID: "9",
ChildrenMenuName: "Template Fisik",
ChildrenMenuURL: "/client/md/template-fisik",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Pasien
{
ChildrenParentID: "4",
ChildrenMenuID: "10",
ChildrenMenuName: "Pasien",
ChildrenMenuURL: "/client/md/pasien",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Dokter
{
ChildrenParentID: "4",
ChildrenMenuID: "11",
ChildrenMenuName: "Dokter",
ChildrenMenuURL: "/client/md/dokter",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Paket
{
ChildrenParentID: "4",
ChildrenMenuID: "12",
ChildrenMenuName: "Paket",
ChildrenMenuURL: "/client/md/paket",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Harga Single
{
ChildrenParentID: "4",
ChildrenMenuID: "13",
ChildrenMenuName: "Harga Single",
ChildrenMenuURL: "/client/md/hargasingle",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
},
},
}
return dummyMenu, nil
}
func (ug *ServicesGroupResult) GetUserGroup() ([]models.UserGroup, error) {
data := []models.UserGroup{
{UserGroupID: 1, UserGroupKode: "A", UserGroupName: "UG1"},
{UserGroupID: 2, UserGroupKode: "B", UserGroupName: "UG2"},
{UserGroupID: 3, UserGroupKode: "C", UserGroupName: "UG3"},
}
return data, nil
}
func (su *ServicesGroupResult) GetListBreadCrumb(title string) (models.BreadCrumbV1, error) {
var ret models.BreadCrumbV1
dummyBreadcrumb := []models.BreadCrumbV1{
{
Title: "Master User Group",
Item: []models.ItemBreadCrumbV1{
{
Item: "Dashboard",
Url: "/dev/dashboard",
},
{
Item: "Master",
Url: "/dev/master",
},
{
Item: "User Group",
Url: "",
},
},
},
{
Title: "Master User",
Item: []models.ItemBreadCrumbV1{
{
Item: "Dashboard",
Url: "/dev/dashboard",
},
{
Item: "Master",
Url: "/dev/master",
},
{
Item: "User",
Url: "",
},
},
},
{
Title: "Master Group Result",
Item: []models.ItemBreadCrumbV1{
{
Item: "Dashboard",
Url: "/dev/dashboard",
},
{
Item: "Master",
Url: "/dev/master",
},
{
Item: "Group Result",
Url: "",
},
},
},
}
for _, breadcrumb := range dummyBreadcrumb {
// if utils.Contains(breadcrumb.Title, title) {
// ret = breadcrumb
// return ret, nil
// }
if breadcrumb.Title == title {
ret = breadcrumb
return ret, nil
}
}
return ret, nil
}
// (LAB, NONLAB, FISIK, DOCTOR)
// hardcore group result resume mcu
func (ug *ServicesGroupResult) GetGroupResultResumeMcu() ([]models.GroupResultResumeMcu, error) {
data := []models.GroupResultResumeMcu{
{
ID: 1,
Text: "LAB",
},
{
ID: 2,
Text: "NONLAB",
},
{
ID: 3,
Text: "FISIK",
},
{
ID: 4,
Text: "DOCTOR",
},
}
return data, nil
}
// versi 2
func (su *ServicesGroupResult) GetListGroupResult(search string, currentPage int, rowPerPage int) ([]models.GroupResult, int, error) {
var groupresultList []models.GroupResult
logger, _ := zap.NewProduction()
defer logger.Sync()
var totalData int
offset := (currentPage - 1) * rowPerPage
prm := "%" + strings.TrimSpace(search) + "%"
querytotal := `
SELECT COUNT(*)
FROM group_result
WHERE Group_ResultIsActive = 'Y'
AND (Group_ResultName LIKE ? OR Group_ResultResumeMcu LIKE ?)
`
logger.Info("QUERY SEARCH INITIAL TOTAL COUNT",
zap.String("query search", querytotal),
)
if err := dbx.Handlex.Get(&totalData, querytotal, prm, prm); err != nil {
return nil, 0, fmt.Errorf("error querying database: %v", err)
}
query := `
SELECT
ROW_NUMBER() OVER () AS nomor,
Group_ResultID,
IFNULL(Group_ResultName, '') AS Group_ResultName,
IFNULL(Group_ResultFlagPerTest, '') AS Group_ResultFlagPerTest,
IFNULL(Group_ResultFlagNonLab, '') AS Group_ResultFlagNonLab,
IFNULL(Group_ResultResumeMcu, '') AS Group_ResultResumeMcu,
Group_ResultIsActive
FROM group_result
WHERE Group_ResultIsActive = 'Y'
AND (Group_ResultName LIKE ? OR Group_ResultResumeMcu LIKE ?)
ORDER BY Group_ResultID ASC
LIMIT ? OFFSET ?
`
logger.Info("QUERY SEARCH INITIAL",
zap.String("query search", query),
)
if err := dbx.Handlex.Select(&groupresultList, 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 groupresultList, totalPage, nil
}
// GET BY ID
func (ug *ServicesGroupResult) GetGroupResultByIDV1(id string) (models.GroupResult, error) {
logger, _ := zap.NewProduction()
var data models.GroupResult
err := dbx.Handlex.Get(&data, `SELECT
Group_ResultID,
Group_ResultName,
CASE
WHEN Group_ResultFlagPerTest = 'Y' THEN 'on'
ELSE Group_ResultFlagPerTest
END AS Group_ResultFlagPerTest,
CASE
WHEN Group_ResultFlagNonLab = 'Y' THEN 'on'
ELSE Group_ResultFlagNonLab
END AS Group_ResultFlagNonLab,
Group_ResultResumeMcu,
Group_ResultIsActive
FROM group_result
WHERE Group_ResultID = ?`, id)
if err != nil {
defer logger.Sync()
logger.Error("Error get data gr by id vs",
zap.String("ID", id),
zap.Error(err),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}
// ADD DATA
func (ug *ServicesGroupResult) AddGroupResult(groupresultname string, groupresultflagpertest string, groupresultflagnonlab string, groupresultresumemcu string) (models.GroupResult, error) {
logger, _ := zap.NewProduction()
var data models.GroupResult
var datacek []models.GroupResult
// var groupresultflagpertestConvert string = ""
// var groupresultflagnonlabConvert string = ""
// var groupresultresumemcuConvert string = ""
prm := "%" + strings.TrimSpace(groupresultname) + "%"
qryCek := `SELECT Group_ResultName FROM group_result WHERE Group_ResultName LIKE ? AND Group_ResultIsActive = 'Y'`
err := dbx.Handlex.Select(&datacek, qryCek, prm)
if err != nil {
defer logger.Sync()
logger.Error("Error cek data by groupresultname",
zap.String("groupresultname", groupresultname),
zap.Any("datacek", datacek),
)
return data, fmt.Errorf("QUERY_FAILED")
}
if len(datacek) > 0 {
defer logger.Sync()
logger.Error("Group Result Name already taken by another data",
zap.String("groupresultname", groupresultname),
)
return data, fmt.Errorf("group result name sudah dipakai")
}
qry := `INSERT INTO group_result
(
Group_ResultName,
Group_ResultFlagPerTest,
Group_ResultFlagNonLab,
Group_ResultResumeMcu
)
VALUES (
?,
?,
?,
?
);`
// time.Sleep(5 * time.Second)
rst := dbx.Handlex.MustExec(qry, groupresultname, groupresultflagpertest, groupresultflagnonlab, groupresultresumemcu)
insertedID, err := rst.LastInsertId()
if err != nil {
defer logger.Sync()
logger.Error("Error Insert group result",
zap.Any("groupresultname", groupresultname),
zap.Any("groupresultflagpertest", groupresultflagpertest),
zap.Any("groupresultflagnonlab", groupresultflagnonlab),
zap.Any("groupresultresumemcu", groupresultresumemcu),
)
return data, fmt.Errorf("QUERY_FAILED")
}
s := strconv.Itoa(int(insertedID))
data, err = ug.GetGroupResultByIDV1(s)
if err != nil {
defer logger.Sync()
logger.Error("Error get usergroup by id",
zap.Any("groupresultname", groupresultname),
zap.Any("groupresultflagpertest", groupresultflagpertest),
zap.Any("groupresultflagnonlab", groupresultflagnonlab),
zap.Any("groupresultresumemcu", groupresultresumemcu),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}
// EDIT DATA
func (ug *ServicesGroupResult) EditGroupResult(id string, groupresultname string, groupresultflagpertest string, groupresultflagnonlab string, groupresultresumemcu string) (models.GroupResult, error) {
logger, _ := zap.NewProduction()
var data models.GroupResult
var datacek []models.GroupResult
prm := "%" + strings.TrimSpace(groupresultname) + "%"
qryCek := `SELECT Group_ResultName FROM group_result WHERE Group_ResultName LIKE ? AND Group_ResultIsActive = 'Y' AND Group_ResultID <> ?`
err := dbx.Handlex.Select(&datacek, qryCek, prm, id)
if err != nil {
defer logger.Sync()
logger.Error("Error cek data by code",
zap.String("groupresultname", groupresultname),
zap.Any("datacek", datacek),
)
return data, fmt.Errorf("QUERY_FAILED")
}
if len(datacek) > 0 {
defer logger.Sync()
logger.Error("Code already taken by another data",
zap.String("groupresultname", groupresultname),
)
return data, fmt.Errorf("group result name sudah dipakai")
}
qry := `UPDATE group_result
SET Group_ResultName = ?,
Group_ResultFlagPerTest = ?,
Group_ResultFlagNonLab = ?,
Group_ResultResumeMcu = ?
WHERE Group_ResultID = ?`
// time.Sleep(5 * time.Second)
rst := dbx.Handlex.MustExec(qry, groupresultname, groupresultflagpertest, groupresultflagnonlab, groupresultresumemcu, id)
_, err = rst.RowsAffected()
if err != nil {
defer logger.Sync()
logger.Error("Error Update group result",
zap.Any("groupresultname", groupresultname),
zap.Any("groupresultflagpertest", groupresultflagpertest),
zap.Any("groupresultflagnonlab", groupresultflagnonlab),
zap.Any("groupresultresumemcu", groupresultresumemcu),
)
return data, fmt.Errorf("QUERY_FAILED")
}
data, err = ug.GetGroupResultByIDV1(id)
if err != nil {
defer logger.Sync()
logger.Error("Error get group result by id",
zap.Any("groupresultname", groupresultname),
zap.Any("groupresultflagpertest", groupresultflagpertest),
zap.Any("groupresultflagnonlab", groupresultflagnonlab),
zap.Any("groupresultresumemcu", groupresultresumemcu),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}
// DELETE DATA
func (ug *ServicesGroupResult) DeleteGroupResult(id string) (models.GroupResult, error) {
logger, _ := zap.NewProduction()
var data models.GroupResult
qry := `UPDATE group_result
SET Group_ResultIsActive = 'N'
WHERE Group_ResultID = ?;`
// time.Sleep(5 * time.Second)
rst := dbx.Handlex.MustExec(qry, id)
_, err := rst.RowsAffected()
if err != nil {
defer logger.Sync()
logger.Error("Error delete group result",
zap.String("id", id),
)
return data, fmt.Errorf("QUERY_FAILED")
}
data, err = ug.GetGroupResultByIDV1(id)
if err != nil {
defer logger.Sync()
logger.Error("Error get group result by id",
zap.String("id", id),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}

View File

@@ -2,9 +2,7 @@ package dev_services
import (
"fmt"
"math"
"strconv"
"strings"
"cpone/db"
"cpone/models"
@@ -54,6 +52,508 @@ type AutoComplete struct {
Name string `json:"name"`
}
func (su *ServicesMasterMenuUserGroup) GetMasterMenus() ([]MasterMenu, error) {
// dummyBreadcrumb := []Breadcrumb{
// {
// Name: "Dashboard",
// Url: "/client/dashboard",
// },
// {
// Name: "Front Office",
// Url: "/client/usermanagement",
// },
// }
dummyMenu := []MasterMenu{
// 1. Dashboard
{
ID: "1",
ParentMenuID: "0",
ParentMenuName: "Dashboard",
ParentUrl: "/client/md/dashboard",
ParentIcon: "",
Children: []ChildrenMenu{
{
ChildrenParentID: "1",
ChildrenMenuID: "1",
ChildrenMenuName: "Master User",
ChildrenMenuURL: "/client/md/user",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "Y",
// },
// },
},
},
},
// 2. Front Office
{
ID: "2",
ParentMenuID: "1",
ParentMenuName: "Front Office",
ParentUrl: "#",
ParentIcon: "",
Children: []ChildrenMenu{
{
ChildrenParentID: "1",
ChildrenMenuID: "1",
ChildrenMenuName: "Registrasi",
ChildrenMenuURL: "/fo/registrasi",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User",
// IsActive: "Y",
// },
// },
},
},
},
// 3. Station
{
ID: "3",
ParentMenuID: "2",
ParentMenuName: "Station",
ParentUrl: "#",
ParentIcon: "",
Children: []ChildrenMenu{
{
ChildrenParentID: "2",
ChildrenMenuID: "1",
ChildrenMenuName: "Sample Station",
ChildrenMenuURL: "/station/sample",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User",
// IsActive: "Y",
// },
// },
},
},
},
// 4. Management MCU
{
ID: "4",
ParentMenuID: "3",
ParentMenuName: "Management MCU",
ParentUrl: "#",
ParentIcon: "",
Children: []ChildrenMenu{
{
ChildrenParentID: "3",
ChildrenMenuID: "1",
ChildrenMenuName: "Setup MCU",
ChildrenMenuURL: "/mcu/setup",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User",
// IsActive: "Y",
// },
// },
},
{
ChildrenParentID: "3",
ChildrenMenuID: "2",
ChildrenMenuName: "Pre-Registrasi",
ChildrenMenuURL: "/mcu/preregister",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User",
// IsActive: "Y",
// },
// },
},
},
},
// 5. Master Data
{
ID: "5",
ParentMenuID: "4",
ParentMenuName: "Master Data",
ParentUrl: "#",
ParentIcon: "",
Children: []ChildrenMenu{
// * Master User
{
ChildrenParentID: "4",
ChildrenMenuID: "1",
ChildrenMenuName: "Master User",
ChildrenMenuURL: "/client/md/user",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User",
// IsActive: "Y",
// },
// },
},
// * Master User Group
{
ChildrenParentID: "4",
ChildrenMenuID: "2",
ChildrenMenuName: "Master User Group",
ChildrenMenuURL: "/client/md/usergroup",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Master Corporate
{
ChildrenParentID: "4",
ChildrenMenuID: "3",
ChildrenMenuName: "Corporate",
ChildrenMenuURL: "/client/md/corp",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Test
{
ChildrenParentID: "4",
ChildrenMenuID: "4",
ChildrenMenuName: "Test",
ChildrenMenuURL: "/client/md/test",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Bahan
{
ChildrenParentID: "4",
ChildrenMenuID: "5",
ChildrenMenuName: "Bahan",
ChildrenMenuURL: "/client/md/bahan",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Sample Type
{
ChildrenParentID: "4",
ChildrenMenuID: "6",
ChildrenMenuName: "Sample Type",
ChildrenMenuURL: "/client/sample/type",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Sample Station
{
ChildrenParentID: "4",
ChildrenMenuID: "7",
ChildrenMenuName: "Sample Station",
ChildrenMenuURL: "/station/sample",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Result Non Lab
{
ChildrenParentID: "4",
ChildrenMenuID: "8",
ChildrenMenuName: "Result Non Lab",
ChildrenMenuURL: "/client/md/resultnonlab",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Template Fisik
{
ChildrenParentID: "4",
ChildrenMenuID: "9",
ChildrenMenuName: "Template Fisik",
ChildrenMenuURL: "/client/md/template-fisik",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Pasien
{
ChildrenParentID: "4",
ChildrenMenuID: "10",
ChildrenMenuName: "Pasien",
ChildrenMenuURL: "/client/md/pasien",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Dokter
{
ChildrenParentID: "4",
ChildrenMenuID: "11",
ChildrenMenuName: "Dokter",
ChildrenMenuURL: "/client/md/dokter",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Paket
{
ChildrenParentID: "4",
ChildrenMenuID: "12",
ChildrenMenuName: "Paket",
ChildrenMenuURL: "/client/md/paket",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Harga Single
{
ChildrenParentID: "4",
ChildrenMenuID: "13",
ChildrenMenuName: "Harga Single",
ChildrenMenuURL: "/client/md/hargasingle",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
},
},
}
return dummyMenu, nil
}
func (ug *ServicesMasterMenuUserGroup) GetUserGroup() ([]models.UserGroup, error) {
data := []models.UserGroup{
{UserGroupID: 1, UserGroupKode: "A", UserGroupName: "UG1"},
@@ -175,7 +675,6 @@ func (ug *ServicesMasterMenuUserGroup) GetUserGroupByIDV1(id string) (models.Use
defer logger.Sync()
logger.Error("Error get data ug by id vs",
zap.String("ID", id),
zap.Error(err),
)
return data, fmt.Errorf("QUERY_FAILED")
}
@@ -234,33 +733,13 @@ func (ug *ServicesMasterMenuUserGroup) AddUserGroup(code string, name string) (m
func (ug *ServicesMasterMenuUserGroup) EditUserGroup(id string, code string, name string) (models.UserGroupV1, error) {
logger, _ := zap.NewProduction()
var data models.UserGroupV1
var datacek []models.UserGroupV1
qryCek := `SELECT M_UserGroupCode FROM m_usergroup WHERE M_UserGroupCode = ? AND M_UserGroupIsActive = 'Y' AND M_UserGroupID <> ?`
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 data, fmt.Errorf("QUERY_FAILED")
}
if len(datacek) > 0 {
defer logger.Sync()
logger.Error("Code already taken by another data",
zap.String("code", code),
)
return data, fmt.Errorf("code sudah dipakai")
}
qry := `UPDATE m_usergroup
SET M_UserGroupCode = ?,
M_UserGroupName= ?
WHERE M_UserGroupID = ?;`
// time.Sleep(5 * time.Second)
rst := dbx.Handlex.MustExec(qry, code, name, id)
_, err = rst.RowsAffected()
_, err := rst.RowsAffected()
if err != nil {
defer logger.Sync()
logger.Error("Error Update usergroup",
@@ -310,20 +789,9 @@ func (ug *ServicesMasterMenuUserGroup) DeleteUserGroup(id string) (models.UserGr
return data, nil
}
func (su *ServicesMasterMenuUserGroup) GetListMasterUserGroupV2(search string, currentPage int, rowPerPage int) ([]models.UserGroupV1, int, error) {
func (su *ServicesMasterMenuUserGroup) GetListMasterUserGroupFilteredBySearch(search string) ([]models.UserGroupV1, error) {
var userGroupList []models.UserGroupV1
var totalData int
offset := (currentPage - 1) * rowPerPage
prm := "%" + strings.TrimSpace(search) + "%"
querytotal := `
SELECT COUNT(*)
FROM m_usergroup
WHERE M_UserGroupIsActive = 'Y'
AND (M_UserGroupCode LIKE ? OR M_UserGroupName LIKE ?)
`
if err := dbx.Handlex.Get(&totalData, querytotal, prm, prm); err != nil {
return nil, 0, fmt.Errorf("error querying database: %v", err)
}
query := `
SELECT
ROW_NUMBER() OVER () AS nomor,
@@ -335,15 +803,113 @@ func (su *ServicesMasterMenuUserGroup) GetListMasterUserGroupV2(search string, c
M_UserGroupIsActive
FROM m_usergroup
WHERE M_UserGroupIsActive = 'Y'
AND (M_UserGroupCode LIKE ? OR M_UserGroupName LIKE ?)
order by M_UserGroupID ASC
LIMIT ? OFFSET ?
`
if err := dbx.Handlex.Select(&userGroupList, query, prm, prm, rowPerPage, offset); err != nil {
return nil, 0, fmt.Errorf("error querying database: %v", err)
// check jika parameter search nya tidak kosong
if search != "" {
query += fmt.Sprintf(" AND (M_UserGroupName LIKE '%%%s%%' OR M_UserGroupCode LIKE '%%%s%%')", search, search)
} else {
search = "%%"
}
totalPage := int(math.Ceil(float64(totalData) / float64(rowPerPage)))
return userGroupList, totalPage, nil
// query += " ORDER BY M_UserGroupID ASC"
query += fmt.Sprintf(" ORDER BY M_UserGroupID ASC")
logger, _ := zap.NewProduction()
defer logger.Sync()
logger.Info("QUERY SEARCH ONlY FOR COUNT TOTAL PAGES PAGINATION",
zap.String("query search", query),
)
if err := dbx.Handlex.Select(&userGroupList, query); err != nil {
return nil, fmt.Errorf("error querying database: %v", err)
}
return userGroupList, nil
}
func (su *ServicesMasterMenuUserGroup) GetListMasterUserGroupBySearch(search string) ([]models.UserGroupV1, error) {
var userGroupList []models.UserGroupV1
query := `
SELECT
ROW_NUMBER() OVER () AS nomor,
M_UserGroupID,
M_UserGroupCode,
M_UserGroupName,
M_UserGroupCreated,
M_UserGroupLastUpdated,
M_UserGroupIsActive
FROM m_usergroup
WHERE M_UserGroupIsActive = 'Y'
`
// fmt.Errorf(search)
rowPerPage := 2
offset := 0
// check jika parameter search nya tidak kosong
if search != "" {
query += fmt.Sprintf(" AND (M_UserGroupName LIKE '%%%s%%' OR M_UserGroupCode LIKE '%%%s%%')", search, search)
} else {
search = "%%"
}
// query += " ORDER BY M_UserGroupID ASC"
query += fmt.Sprintf(" ORDER BY M_UserGroupID ASC LIMIT %d OFFSET %d", rowPerPage, offset)
logger, _ := zap.NewProduction()
defer logger.Sync()
logger.Info("QUERY SEARCH ONlY AND SETTING LIMIT",
zap.String("query search", query),
)
if err := dbx.Handlex.Select(&userGroupList, query); err != nil {
return nil, fmt.Errorf("error querying database: %v", err)
}
return userGroupList, nil
}
func (su *ServicesMasterMenuUserGroup) GetListMasterUserGroupPagination(search string, currentPage int, rowPerPage int) ([]models.UserGroupV1, error) {
var userGroupList []models.UserGroupV1
query := `
SELECT
ROW_NUMBER() OVER () AS nomor,
M_UserGroupID,
M_UserGroupCode,
M_UserGroupName,
M_UserGroupCreated,
M_UserGroupLastUpdated,
M_UserGroupIsActive
FROM m_usergroup
WHERE M_UserGroupIsActive = 'Y'
`
// rmaxPerPage := 2
// rpage := (currentPage - 1) * rmaxPerPage
offset := (currentPage - 1) * rowPerPage
// offset := currentPage
if search != "" {
query += fmt.Sprintf(" AND (M_UserGroupName LIKE '%%%s%%' OR M_UserGroupCode LIKE '%%%s%%')", search, search)
} else {
search = "%%"
}
query += fmt.Sprintf(" ORDER BY M_UserGroupID ASC LIMIT %d OFFSET %d", rowPerPage, offset)
logger, _ := zap.NewProduction()
defer logger.Sync()
logger.Info("QUERY SEARCH WITH PAGINATION",
zap.String("query search", query),
)
if err := dbx.Handlex.Select(&userGroupList, query); err != nil {
return nil, fmt.Errorf("error querying database: %v", err)
}
return userGroupList, nil
}

View File

@@ -1,878 +0,0 @@
package dev_services
import (
"cpone/db"
"cpone/models"
"fmt"
"math"
"strconv"
"strings"
dbx "cpone/package/database"
"go.uber.org/zap"
)
func NewServicesMdGroupResult(uStore db.AppStore) *ServicesMdGroupResult {
return &ServicesMdGroupResult{
MdGroupResultStore: uStore,
}
}
type ServicesMdGroupResult struct {
MdGroupResultStore db.AppStore
}
func (su *ServicesMdGroupResult) GetMasterMenus() ([]MasterMenu, error) {
// dummyBreadcrumb := []Breadcrumb{
// {
// Name: "Dashboard",
// Url: "/client/dashboard",
// },
// {
// Name: "Front Office",
// Url: "/client/usermanagement",
// },
// }
dummyMenu := []MasterMenu{
// 1. Dashboard
{
ID: "1",
ParentMenuID: "0",
ParentMenuName: "Dashboard",
ParentUrl: "/client/md/dashboard",
ParentIcon: "",
Children: []ChildrenMenu{
{
ChildrenParentID: "1",
ChildrenMenuID: "1",
ChildrenMenuName: "Master User",
ChildrenMenuURL: "/client/md/user",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "Y",
// },
// },
},
},
},
// 2. Front Office
{
ID: "2",
ParentMenuID: "1",
ParentMenuName: "Front Office",
ParentUrl: "#",
ParentIcon: "",
Children: []ChildrenMenu{
{
ChildrenParentID: "1",
ChildrenMenuID: "1",
ChildrenMenuName: "Registrasi",
ChildrenMenuURL: "/fo/registrasi",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User",
// IsActive: "Y",
// },
// },
},
},
},
// 3. Station
{
ID: "3",
ParentMenuID: "2",
ParentMenuName: "Station",
ParentUrl: "#",
ParentIcon: "",
Children: []ChildrenMenu{
{
ChildrenParentID: "2",
ChildrenMenuID: "1",
ChildrenMenuName: "Sample Station",
ChildrenMenuURL: "/station/sample",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User",
// IsActive: "Y",
// },
// },
},
},
},
// 4. Management MCU
{
ID: "4",
ParentMenuID: "3",
ParentMenuName: "Management MCU",
ParentUrl: "#",
ParentIcon: "",
Children: []ChildrenMenu{
{
ChildrenParentID: "3",
ChildrenMenuID: "1",
ChildrenMenuName: "Setup MCU",
ChildrenMenuURL: "/mcu/setup",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User",
// IsActive: "Y",
// },
// },
},
{
ChildrenParentID: "3",
ChildrenMenuID: "2",
ChildrenMenuName: "Pre-Registrasi",
ChildrenMenuURL: "/mcu/preregister",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User",
// IsActive: "Y",
// },
// },
},
},
},
// 5. Master Data
{
ID: "5",
ParentMenuID: "4",
ParentMenuName: "Master Data",
ParentUrl: "#",
ParentIcon: "",
Children: []ChildrenMenu{
// * Master User
{
ChildrenParentID: "4",
ChildrenMenuID: "1",
ChildrenMenuName: "Master User",
ChildrenMenuURL: "/client/md/user",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User",
// IsActive: "Y",
// },
// },
},
// * Master User Group
{
ChildrenParentID: "4",
ChildrenMenuID: "2",
ChildrenMenuName: "Master User Group",
ChildrenMenuURL: "/client/md/usergroup",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Master Corporate
{
ChildrenParentID: "4",
ChildrenMenuID: "3",
ChildrenMenuName: "Corporate",
ChildrenMenuURL: "/client/md/corp",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Test
{
ChildrenParentID: "4",
ChildrenMenuID: "4",
ChildrenMenuName: "Test",
ChildrenMenuURL: "/client/md/test",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Bahan
{
ChildrenParentID: "4",
ChildrenMenuID: "5",
ChildrenMenuName: "Bahan",
ChildrenMenuURL: "/client/md/bahan",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Sample Type
{
ChildrenParentID: "4",
ChildrenMenuID: "6",
ChildrenMenuName: "Sample Type",
ChildrenMenuURL: "/client/sample/type",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Sample Station
{
ChildrenParentID: "4",
ChildrenMenuID: "7",
ChildrenMenuName: "Sample Station",
ChildrenMenuURL: "/station/sample",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Result Non Lab
{
ChildrenParentID: "4",
ChildrenMenuID: "8",
ChildrenMenuName: "Result Non Lab",
ChildrenMenuURL: "/client/md/resultnonlab",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Template Fisik
{
ChildrenParentID: "4",
ChildrenMenuID: "9",
ChildrenMenuName: "Template Fisik",
ChildrenMenuURL: "/client/md/template-fisik",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Pasien
{
ChildrenParentID: "4",
ChildrenMenuID: "10",
ChildrenMenuName: "Pasien",
ChildrenMenuURL: "/client/md/pasien",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Dokter
{
ChildrenParentID: "4",
ChildrenMenuID: "11",
ChildrenMenuName: "Dokter",
ChildrenMenuURL: "/client/md/dokter",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Paket
{
ChildrenParentID: "4",
ChildrenMenuID: "12",
ChildrenMenuName: "Paket",
ChildrenMenuURL: "/client/md/paket",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
// * Harga Single
{
ChildrenParentID: "4",
ChildrenMenuID: "13",
ChildrenMenuName: "Harga Single",
ChildrenMenuURL: "/client/md/hargasingle",
// Breadcrumb: []Breadcrumb{
// {
// IDBreadcrumb: "1",
// Title: "Dashboard",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "2",
// Title: "Master",
// IsActive: "N",
// },
// {
// IDBreadcrumb: "3",
// Title: "User Group",
// IsActive: "Y",
// },
// },
},
},
},
}
return dummyMenu, nil
}
func (ug *ServicesMdGroupResult) GetUserGroup() ([]models.UserGroup, error) {
data := []models.UserGroup{
{UserGroupID: 1, UserGroupKode: "A", UserGroupName: "UG1"},
{UserGroupID: 2, UserGroupKode: "B", UserGroupName: "UG2"},
{UserGroupID: 3, UserGroupKode: "C", UserGroupName: "UG3"},
}
return data, nil
}
func (su *ServicesMdGroupResult) GetMdGroupResultBreadcrumb(title string) (models.BreadCrumbV1, error) {
var ret models.BreadCrumbV1
dummyBreadcrumb := []models.BreadCrumbV1{
{
Title: "Master User Group",
Item: []models.ItemBreadCrumbV1{
{
Item: "Dashboard",
Url: "/dev/dashboard",
},
{
Item: "Master",
Url: "/dev/master",
},
{
Item: "User Group",
Url: "",
},
},
},
{
Title: "Master User",
Item: []models.ItemBreadCrumbV1{
{
Item: "Dashboard",
Url: "/dev/dashboard",
},
{
Item: "Master",
Url: "/dev/master",
},
{
Item: "User",
Url: "",
},
},
},
{
Title: "Master Group Result",
Item: []models.ItemBreadCrumbV1{
{
Item: "Dashboard",
Url: "/dev/dashboard",
},
{
Item: "Master",
Url: "/dev/master",
},
{
Item: "Group Result",
Url: "",
},
},
},
}
for _, breadcrumb := range dummyBreadcrumb {
// if utils.Contains(breadcrumb.Title, title) {
// ret = breadcrumb
// return ret, nil
// }
if breadcrumb.Title == title {
ret = breadcrumb
return ret, nil
}
}
return ret, nil
}
// (LAB, NONLAB, FISIK, DOCTOR)
// hardcore group result resume mcu
func (ug *ServicesMdGroupResult) GetMdGroupResultResumeMcu() ([]models.GroupResultResumeMcu, error) {
data := []models.GroupResultResumeMcu{
{
ID: 1,
Text: "LAB",
},
{
ID: 2,
Text: "NONLAB",
},
{
ID: 3,
Text: "FISIK",
},
{
ID: 4,
Text: "DOCTOR",
},
}
return data, nil
}
// versi 2
func (su *ServicesMdGroupResult) GetListMdGroupResult(search string, currentPage int, rowPerPage int) ([]models.GroupResult, int, error) {
var groupresultList []models.GroupResult
logger, _ := zap.NewProduction()
defer logger.Sync()
var totalData int
offset := (currentPage - 1) * rowPerPage
prm := "%" + strings.TrimSpace(search) + "%"
querytotal := `
SELECT COUNT(*)
FROM group_result
WHERE Group_ResultIsActive = 'Y'
AND (Group_ResultName LIKE ? OR Group_ResultResumeMcu LIKE ?)
`
logger.Info("QUERY SEARCH INITIAL TOTAL COUNT",
zap.String("query search", querytotal),
)
if err := dbx.Handlex.Get(&totalData, querytotal, prm, prm); err != nil {
return nil, 0, fmt.Errorf("error querying database: %v", err)
}
query := `
SELECT
ROW_NUMBER() OVER () AS nomor,
Group_ResultID,
IFNULL(Group_ResultName, '') AS Group_ResultName,
IFNULL(Group_ResultFlagPerTest, '') AS Group_ResultFlagPerTest,
IFNULL(Group_ResultFlagNonLab, '') AS Group_ResultFlagNonLab,
IFNULL(Group_ResultResumeMcu, '') AS Group_ResultResumeMcu,
Group_ResultIsActive
FROM group_result
WHERE Group_ResultIsActive = 'Y'
AND (Group_ResultName LIKE ? OR Group_ResultResumeMcu LIKE ?)
ORDER BY Group_ResultID ASC
LIMIT ? OFFSET ?
`
logger.Info("QUERY SEARCH INITIAL",
zap.String("query search", query),
)
if err := dbx.Handlex.Select(&groupresultList, 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 groupresultList, totalPage, nil
}
// GET BY ID
func (ug *ServicesMdGroupResult) GetMdGroupResultByID(id string) (models.GroupResult, error) {
logger, _ := zap.NewProduction()
var data models.GroupResult
err := dbx.Handlex.Get(&data, `SELECT
Group_ResultID,
Group_ResultName,
CASE
WHEN Group_ResultFlagPerTest = 'Y' THEN 'on'
ELSE Group_ResultFlagPerTest
END AS Group_ResultFlagPerTest,
CASE
WHEN Group_ResultFlagNonLab = 'Y' THEN 'on'
ELSE Group_ResultFlagNonLab
END AS Group_ResultFlagNonLab,
Group_ResultResumeMcu,
Group_ResultIsActive
FROM group_result
WHERE Group_ResultID = ?`, id)
if err != nil {
defer logger.Sync()
logger.Error("Error get data gr by id vs",
zap.String("ID", id),
zap.Error(err),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}
// ADD DATA
func (ug *ServicesMdGroupResult) AddMdGroupResult(groupresultname string, groupresultflagpertest string, groupresultflagnonlab string, groupresultresumemcu string) (models.GroupResult, error) {
logger, _ := zap.NewProduction()
var data models.GroupResult
var datacek []models.GroupResult
// var groupresultflagpertestConvert string = ""
// var groupresultflagnonlabConvert string = ""
// var groupresultresumemcuConvert string = ""
prm := "%" + strings.TrimSpace(groupresultname) + "%"
qryCek := `SELECT Group_ResultName FROM group_result WHERE Group_ResultName LIKE ? AND Group_ResultIsActive = 'Y'`
err := dbx.Handlex.Select(&datacek, qryCek, prm)
if err != nil {
defer logger.Sync()
logger.Error("Error cek data by groupresultname",
zap.String("groupresultname", groupresultname),
zap.Any("datacek", datacek),
)
return data, fmt.Errorf("QUERY_FAILED")
}
if len(datacek) > 0 {
defer logger.Sync()
logger.Error("Group Result Name already taken by another data",
zap.String("groupresultname", groupresultname),
)
return data, fmt.Errorf("group result name sudah dipakai")
}
qry := `INSERT INTO group_result
(
Group_ResultName,
Group_ResultFlagPerTest,
Group_ResultFlagNonLab,
Group_ResultResumeMcu
)
VALUES (
?,
?,
?,
?
);`
// time.Sleep(5 * time.Second)
rst := dbx.Handlex.MustExec(qry, groupresultname, groupresultflagpertest, groupresultflagnonlab, groupresultresumemcu)
insertedID, err := rst.LastInsertId()
if err != nil {
defer logger.Sync()
logger.Error("Error Insert group result",
zap.Any("groupresultname", groupresultname),
zap.Any("groupresultflagpertest", groupresultflagpertest),
zap.Any("groupresultflagnonlab", groupresultflagnonlab),
zap.Any("groupresultresumemcu", groupresultresumemcu),
)
return data, fmt.Errorf("QUERY_FAILED")
}
s := strconv.Itoa(int(insertedID))
data, err = ug.GetMdGroupResultByID(s)
if err != nil {
defer logger.Sync()
logger.Error("Error get usergroup by id",
zap.Any("groupresultname", groupresultname),
zap.Any("groupresultflagpertest", groupresultflagpertest),
zap.Any("groupresultflagnonlab", groupresultflagnonlab),
zap.Any("groupresultresumemcu", groupresultresumemcu),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}
// EDIT DATA
func (ug *ServicesMdGroupResult) EditMdGroupResult(id string, groupresultname string, groupresultflagpertest string, groupresultflagnonlab string, groupresultresumemcu string) (models.GroupResult, error) {
logger, _ := zap.NewProduction()
var data models.GroupResult
var datacek []models.GroupResult
prm := "%" + strings.TrimSpace(groupresultname) + "%"
qryCek := `SELECT Group_ResultName FROM group_result WHERE Group_ResultName LIKE ? AND Group_ResultIsActive = 'Y' AND Group_ResultID <> ?`
err := dbx.Handlex.Select(&datacek, qryCek, prm, id)
if err != nil {
defer logger.Sync()
logger.Error("Error cek data by code",
zap.String("groupresultname", groupresultname),
zap.Any("datacek", datacek),
)
return data, fmt.Errorf("QUERY_FAILED")
}
if len(datacek) > 0 {
defer logger.Sync()
logger.Error("Code already taken by another data",
zap.String("groupresultname", groupresultname),
)
return data, fmt.Errorf("group result name sudah dipakai")
}
qry := `UPDATE group_result
SET Group_ResultName = ?,
Group_ResultFlagPerTest = ?,
Group_ResultFlagNonLab = ?,
Group_ResultResumeMcu = ?
WHERE Group_ResultID = ?`
// time.Sleep(5 * time.Second)
rst := dbx.Handlex.MustExec(qry, groupresultname, groupresultflagpertest, groupresultflagnonlab, groupresultresumemcu, id)
_, err = rst.RowsAffected()
if err != nil {
defer logger.Sync()
logger.Error("Error Update group result",
zap.Any("groupresultname", groupresultname),
zap.Any("groupresultflagpertest", groupresultflagpertest),
zap.Any("groupresultflagnonlab", groupresultflagnonlab),
zap.Any("groupresultresumemcu", groupresultresumemcu),
)
return data, fmt.Errorf("QUERY_FAILED")
}
data, err = ug.GetMdGroupResultByID(id)
if err != nil {
defer logger.Sync()
logger.Error("Error get group result by id",
zap.Any("groupresultname", groupresultname),
zap.Any("groupresultflagpertest", groupresultflagpertest),
zap.Any("groupresultflagnonlab", groupresultflagnonlab),
zap.Any("groupresultresumemcu", groupresultresumemcu),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}
// DELETE DATA
func (ug *ServicesMdGroupResult) DeleteMdGroupResult(id string) (models.GroupResult, error) {
logger, _ := zap.NewProduction()
var data models.GroupResult
qry := `UPDATE group_result
SET Group_ResultIsActive = 'N'
WHERE Group_ResultID = ?;`
// time.Sleep(5 * time.Second)
rst := dbx.Handlex.MustExec(qry, id)
_, err := rst.RowsAffected()
if err != nil {
defer logger.Sync()
logger.Error("Error delete group result",
zap.String("id", id),
)
return data, fmt.Errorf("QUERY_FAILED")
}
data, err = ug.GetMdGroupResultByID(id)
if err != nil {
defer logger.Sync()
logger.Error("Error get group result by id",
zap.String("id", id),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}

View File

@@ -1,262 +0,0 @@
package dev_services
import (
"cpone/db"
"cpone/models"
dbx "cpone/package/database"
"fmt"
"math"
"strconv"
"strings"
"go.uber.org/zap"
)
func NewMdNatUnitServices(uStore db.AppStore) *MdNatUnitServices {
return &MdNatUnitServices{
MdNatUnitStore: uStore,
}
}
type MdNatUnitServices struct {
MdNatUnitStore db.AppStore
}
func (nu *MdNatUnitServices) GetListMdNatUnit(search string, currentPage int, rowPerPage int) ([]models.NatUnit, int, error) {
var natUnitList []models.NatUnit
var totalData int
offset := (currentPage - 1) * rowPerPage
prm := "%" + strings.TrimSpace(search) + "%"
querytotal := `SELECT COUNT(*)
FROM nat_unit
WHERE Nat_UnitIsActive = 'Y'
AND (Nat_UnitCode LIKE ? OR Nat_UnitName LIKE ?)`
if err := dbx.Handlex.Get(&totalData, querytotal, prm, prm); err != nil {
return nil, 0, fmt.Errorf("error querying database: %v", err)
}
query := `SELECT ROW_NUMBER() OVER (ORDER BY Nat_UnitID DESC) AS nomor,
Nat_UnitID,
Nat_UnitCode,
Nat_UnitName,
Nat_UnitCreated,
Nat_UnitLastUpdated,
Nat_UnitIsActive
FROM nat_unit
WHERE Nat_UnitIsActive = 'Y'
AND (Nat_UnitCode LIKE ? OR Nat_UnitName LIKE ?)
ORDER BY Nat_UnitID DESC
LIMIT ? OFFSET ?`
if err := dbx.Handlex.Select(&natUnitList, 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 natUnitList, totalPage, nil
}
func (nu *MdNatUnitServices) GetMdNatUnitBreadCrumb(title string) (models.BreadCrumbV1, error) {
var ret models.BreadCrumbV1
dummyBreadcrumb := []models.BreadCrumbV1{
{
Title: "Master Unit",
Item: []models.ItemBreadCrumbV1{
{
Item: "Dashboard",
Url: "/dev/dashboard",
},
{
Item: "Master",
Url: "/dev/master",
},
{
Item: "Unit",
Url: "",
},
},
},
{
Title: "Master User",
Item: []models.ItemBreadCrumbV1{
{
Item: "Dashboard",
Url: "/dev/dashboard",
},
{
Item: "Master",
Url: "/dev/master",
},
{
Item: "User",
Url: "",
},
},
},
}
for _, breadcrumb := range dummyBreadcrumb {
if breadcrumb.Title == title {
ret = breadcrumb
return ret, nil
}
}
return ret, nil
}
func (nu *MdNatUnitServices) GetMdNatUnitByID(id string) (models.NatUnit, error) {
logger, _ := zap.NewProduction()
var data models.NatUnit
err := dbx.Handlex.Get(&data, `SELECT * FROM nat_unit
WHERE Nat_UnitID = ?`, id)
if err != nil {
defer logger.Sync()
logger.Error("Error get data unit by id",
zap.String("ID", id),
zap.Error(err),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}
func (nu *MdNatUnitServices) AddMdNatUnit(code string, name string) (models.NatUnit, error) {
logger, _ := zap.NewProduction()
var data models.NatUnit
var datacek []models.NatUnit
qryCek := `SELECT Nat_UnitCode FROM nat_unit
WHERE Nat_UnitCode = ? AND Nat_UnitIsActive = '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 data, fmt.Errorf("QUERY_FAILED")
}
if len(datacek) > 0 {
defer logger.Sync()
logger.Error("Code already taken by another data",
zap.String("code", code),
)
return data, fmt.Errorf("code sudah dipakai")
}
qry := `INSERT INTO nat_unit
(Nat_UnitCode,
Nat_UnitName) VALUES(?,?)`
rst := dbx.Handlex.MustExec(qry, code, name)
insertedID, err := rst.LastInsertId()
if err != nil {
defer logger.Sync()
logger.Error("Error Insert natunit",
zap.String("code", code),
zap.String("name", name),
)
return data, fmt.Errorf("QUERY_FAILED")
}
s := strconv.Itoa(int(insertedID))
data, err = nu.GetMdNatUnitByID(s)
if err != nil {
defer logger.Sync()
logger.Error("Error get natunit by id",
zap.String("code", code),
zap.String("name", name),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}
func (nu *MdNatUnitServices) EditMdNatUnit(id string, code string, name string) (models.NatUnit, error) {
logger, _ := zap.NewProduction()
var data models.NatUnit
var datacek []models.NatUnit
qryCek := `SELECT Nat_UnitCode FROM nat_unit
WHERE Nat_UnitCode = ? AND Nat_UnitIsActive = 'Y' AND Nat_UnitID <> ?`
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 data, fmt.Errorf("QUERY_FAILED")
}
if len(datacek) > 0 {
defer logger.Sync()
logger.Error("Code already taken by another data",
zap.String("code", code),
)
return data, fmt.Errorf("code sudah dipakai")
}
qry := `UPDATE nat_unit
SET Nat_UnitCode = ?,
Nat_UnitName = ?,
Nat_UnitLastUpdated = NOW()
WHERE Nat_UnitID = ?`
rst := dbx.Handlex.MustExec(qry, code, name, id)
_, err = rst.RowsAffected()
if err != nil {
defer logger.Sync()
logger.Error("Error Update natunit",
zap.String("code", code),
zap.String("name", name),
)
return data, fmt.Errorf("QUERY_FAILED")
}
data, err = nu.GetMdNatUnitByID(id)
if err != nil {
defer logger.Sync()
logger.Error("Error get natunit by id",
zap.String("code", code),
zap.String("name", name),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}
func (nu *MdNatUnitServices) DeleteMdNatUnit(id string) (models.NatUnit, error) {
logger, _ := zap.NewProduction()
var data models.NatUnit
qry := `UPDATE nat_unit
SET Nat_UnitLastUpdated = NOW(),
Nat_UnitIsActive = 'N'
WHERE Nat_UnitID = ?`
rst := dbx.Handlex.MustExec(qry, id)
_, err := rst.RowsAffected()
if err != nil {
defer logger.Sync()
logger.Error("Error delete nat unit",
zap.String("id", id),
)
return data, fmt.Errorf("QUERY_FAILED")
}
data, err = nu.GetMdNatUnitByID(id)
if err != nil {
defer logger.Sync()
logger.Error("Error get nat unit by id",
zap.String("id", id),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}

View File

@@ -1,261 +0,0 @@
package dev_services
import (
"cpone/db"
"cpone/models"
dbx "cpone/package/database"
"fmt"
"math"
"strconv"
"strings"
"go.uber.org/zap"
)
func NewMdUserGroupServices(uStore db.AppStore) *MdUserGroupServices {
return &MdUserGroupServices{
MdUserGroupStore: uStore,
}
}
type MdUserGroupServices struct {
MdUserGroupStore db.AppStore
}
func (su *MdUserGroupServices) GetListMdUserGroup(search string, currentPage int, rowPerPage int) ([]models.UserGroupV1, int, error) {
var userGroupList []models.UserGroupV1
var totalData int
offset := (currentPage - 1) * rowPerPage
prm := "%" + strings.TrimSpace(search) + "%"
querytotal := `
SELECT COUNT(*)
FROM m_usergroup
WHERE M_UserGroupIsActive = 'Y'
AND (M_UserGroupCode LIKE ? OR M_UserGroupName LIKE ?)
`
if err := dbx.Handlex.Get(&totalData, querytotal, prm, prm); err != nil {
return nil, 0, fmt.Errorf("error querying database: %v", err)
}
query := `
SELECT
ROW_NUMBER() OVER () AS nomor,
M_UserGroupID,
M_UserGroupCode,
M_UserGroupName,
M_UserGroupCreated,
M_UserGroupLastUpdated,
M_UserGroupIsActive
FROM m_usergroup
WHERE M_UserGroupIsActive = 'Y'
AND (M_UserGroupCode LIKE ? OR M_UserGroupName LIKE ?)
order by M_UserGroupID ASC
LIMIT ? OFFSET ?
`
if err := dbx.Handlex.Select(&userGroupList, 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 userGroupList, totalPage, nil
}
func (ug *MdUserGroupServices) GetMdUserGroupByID(id string) (models.UserGroupV1, error) {
logger, _ := zap.NewProduction()
var data models.UserGroupV1
err := dbx.Handlex.Get(&data, `SELECT * FROM m_usergroup
WHERE M_UserGroupID = ?`, id)
if err != nil {
defer logger.Sync()
logger.Error("Error get data ug by id vs",
zap.String("ID", id),
zap.Error(err),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}
func (ug *MdUserGroupServices) AddMdUserGroup(code string, name string) (models.UserGroupV1, error) {
logger, _ := zap.NewProduction()
var data models.UserGroupV1
var datacek []models.UserGroupV1
qryCek := `SELECT M_UserGroupCode FROM m_usergroup WHERE M_UserGroupCode = ? AND M_UserGroupIsActive = '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 data, fmt.Errorf("QUERY_FAILED")
}
if len(datacek) > 0 {
defer logger.Sync()
logger.Error("Code already taken by another data",
zap.String("code", code),
)
return data, fmt.Errorf("code sudah dipakai")
}
qry := `INSERT INTO m_usergroup
(M_UserGroupCode,
M_UserGroupName)
VALUES (?,?);`
// time.Sleep(5 * time.Second)
rst := dbx.Handlex.MustExec(qry, code, name)
insertedID, err := rst.LastInsertId()
if err != nil {
defer logger.Sync()
logger.Error("Error Insert usergroup",
zap.String("code", code),
zap.String("name", name),
)
return data, fmt.Errorf("QUERY_FAILED")
}
s := strconv.Itoa(int(insertedID))
data, err = ug.GetMdUserGroupByID(s)
if err != nil {
defer logger.Sync()
logger.Error("Error get usergroup by id",
zap.String("code", code),
zap.String("name", name),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}
func (ug *MdUserGroupServices) EditMdUsergroup(id string, code string, name string) (models.UserGroupV1, error) {
logger, _ := zap.NewProduction()
var data models.UserGroupV1
var datacek []models.UserGroupV1
qryCek := `SELECT M_UserGroupCode FROM m_usergroup WHERE M_UserGroupCode = ? AND M_UserGroupIsActive = 'Y' AND M_UserGroupID <> ?`
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 data, fmt.Errorf("QUERY_FAILED")
}
if len(datacek) > 0 {
defer logger.Sync()
logger.Error("Code already taken by another data",
zap.String("code", code),
)
return data, fmt.Errorf("code sudah dipakai")
}
qry := `UPDATE m_usergroup
SET M_UserGroupCode = ?,
M_UserGroupName= ?
WHERE M_UserGroupID = ?;`
// time.Sleep(5 * time.Second)
rst := dbx.Handlex.MustExec(qry, code, name, id)
_, err = rst.RowsAffected()
if err != nil {
defer logger.Sync()
logger.Error("Error Update usergroup",
zap.String("code", code),
zap.String("name", name),
)
return data, fmt.Errorf("QUERY_FAILED")
}
data, err = ug.GetMdUserGroupByID(id)
if err != nil {
defer logger.Sync()
logger.Error("Error get usergroup by id",
zap.String("code", code),
zap.String("name", name),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}
func (ug *MdUserGroupServices) DeleteMdUserGroup(id string) (models.UserGroupV1, error) {
logger, _ := zap.NewProduction()
var data models.UserGroupV1
qry := `UPDATE m_usergroup
SET M_UserGroupIsActive = 'N',
M_UserGroupDeleted = NOW(),
M_UserGroupDeletedUserID = '1'
WHERE M_UserGroupID = ?;`
// time.Sleep(5 * time.Second)
rst := dbx.Handlex.MustExec(qry, id)
_, err := rst.RowsAffected()
if err != nil {
defer logger.Sync()
logger.Error("Error delete usergroup",
zap.String("id", id),
)
return data, fmt.Errorf("QUERY_FAILED")
}
data, err = ug.GetMdUserGroupByID(id)
if err != nil {
defer logger.Sync()
logger.Error("Error get usergroup by id",
zap.String("id", id),
)
return data, fmt.Errorf("QUERY_FAILED")
}
return data, nil
}
func (su *MdUserGroupServices) GetMdUserGroupBreadCrumb(title string) (models.BreadCrumbV1, error) {
var ret models.BreadCrumbV1
dummyBreadcrumb := []models.BreadCrumbV1{
{
Title: "Master User Group",
Item: []models.ItemBreadCrumbV1{
{
Item: "Dashboard",
Url: "/dev/dashboard",
},
{
Item: "Master",
Url: "/dev/master",
},
{
Item: "User Group",
Url: "",
},
},
},
{
Title: "Master User",
Item: []models.ItemBreadCrumbV1{
{
Item: "Dashboard",
Url: "/dev/dashboard",
},
{
Item: "Master",
Url: "/dev/master",
},
{
Item: "User",
Url: "",
},
},
},
}
for _, breadcrumb := range dummyBreadcrumb {
if breadcrumb.Title == title {
ret = breadcrumb
return ret, nil
}
}
return ret, nil
}

View File

@@ -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
}

View File

@@ -1,112 +0,0 @@
package public_services
import (
"cpone/db"
"cpone/models"
"go.uber.org/zap"
)
func NewServicesKartuKontrol(uStore db.AppStore) *ServicesKartuKontrol {
return &ServicesKartuKontrol{
KartuKontrolStore: uStore,
}
}
type ServicesKartuKontrol struct {
KartuKontrolStore db.AppStore
}
func (su *ServicesKartuKontrol) GetkartuKontrolById(nomorRegistrasi string) ([]models.KartuKontrolModel, error) {
logger, _ := zap.NewProduction()
defer logger.Sync()
logger.Info("QUERY SEARCH GET KARTU KONTROL",
zap.String("query search", ""),
)
dataPasien := []models.DataPasien{
{
NomorRegistrasi: "00234",
NomorLab: "LA90002",
NamaPasien: "Hendra Setiawan",
TanggalLahir: "2000-01-01",
Umur: "24 tahun",
JenisKelamin: "Laki-laki",
NamaDivisi: "Development",
NamaCompany: "PT. Sadhana Abiyasa Sampoerna",
},
}
dataPemeriksaanList := []models.DataPemeriksaanList{
{NamaPemeriksaanList: "Hematologi Lengkap"},
{NamaPemeriksaanList: "Urine Lengkap"},
{NamaPemeriksaanList: "ACG"},
{NamaPemeriksaanList: "Treadmill"},
{NamaPemeriksaanList: "Pemeriksaan Fisik"},
{NamaPemeriksaanList: "Hematologi Lengkap"},
{NamaPemeriksaanList: "Urine Lengkap"},
{NamaPemeriksaanList: "ACG"},
{NamaPemeriksaanList: "Treadmill"},
{NamaPemeriksaanList: "Pemeriksaan Fisik"},
{NamaPemeriksaanList: "Hematologi Lengkap"},
{NamaPemeriksaanList: "Urine Lengkap"},
{NamaPemeriksaanList: "ACG"},
{NamaPemeriksaanList: "Treadmill"},
{NamaPemeriksaanList: "Pemeriksaan Fisik"},
{NamaPemeriksaanList: "Hematologi Lengkap"},
{NamaPemeriksaanList: "Urine Lengkap"},
{NamaPemeriksaanList: "ACG"},
{NamaPemeriksaanList: "Treadmill"},
{NamaPemeriksaanList: "Pemeriksaan Fisik"},
}
dataPemeriksaanPengambilanSample := []models.DataPemeriksaanPengambilanSample{
{
NamaPemeriksaanPengambilanSample: "Laboratorium",
SampleTypeListData: []models.SampleTypeList{
{
SampleTypeName: "Darah",
SampleTypeDateTime: "15-05-2024 10:00",
SampleTypeStatus: "Sudah",
},
{
SampleTypeName: "Urine",
SampleTypeDateTime: "15-05-2024 10:00",
SampleTypeStatus: "Sudah",
},
},
},
{
NamaPemeriksaanPengambilanSample: "Rontgen",
SampleTypeListData: []models.SampleTypeList{
{
SampleTypeName: "Thorax AP (PCR)",
SampleTypeDateTime: "",
SampleTypeStatus: "Sudah",
},
},
},
{
NamaPemeriksaanPengambilanSample: "Elektromedis",
SampleTypeListData: []models.SampleTypeList{
{
SampleTypeName: "ECG",
SampleTypeStatus: "Belum",
SampleTypeDateTime: "",
},
},
},
}
kartuKontrol := []models.KartuKontrolModel{
{
KartuKontrolDataPasienList: dataPasien,
KartuKontrolDataPemeriksaanList: dataPemeriksaanList,
KartuKontrolDataPemeriksaanPengambilanSample: dataPemeriksaanPengambilanSample,
},
}
return kartuKontrol, nil
}

View File

@@ -1,120 +0,0 @@
package public_services
import (
"cpone/db"
"cpone/models"
"go.uber.org/zap"
)
func NewServicesSurveyMcu(uStore db.AppStore) *SurveyMcuService {
return &SurveyMcuService{
SurveyMcuStore: uStore,
}
}
type SurveyMcuService struct {
SurveyMcuStore db.AppStore
}
func (su *SurveyMcuService) GetSurveyMcuByNoreg(nomorRegistrasi string) ([]models.SurveyMcu, error) {
logger, _ := zap.NewProduction()
defer logger.Sync()
logger.Info("QUERY SEARCH GET SURVEY MCU BY NOMOR REGISTRASI",
zap.String("query search", ""),
)
// radio button
dataItemSurveyMcu := []models.ItemSurveyMcu{
{
IDItemSurvey: "1",
Nomor: "1",
Pertanyaan: "Bagaimana Penilaian Sikap & Keramahan Petugas?",
ErrorMessage: "",
NameRadioButton: "radio-1",
},
{
IDItemSurvey: "2",
Nomor: "2",
Pertanyaan: "Bagaimana Penilaian Penampilan Petugas?",
ErrorMessage: "",
NameRadioButton: "radio-2",
},
{
IDItemSurvey: "3",
Nomor: "3",
Pertanyaan: "Bagaimana Penilaian Ketrampilan Petugas?",
ErrorMessage: "",
NameRadioButton: "radio-3",
},
{
IDItemSurvey: "4",
Nomor: "4",
Pertanyaan: "Bagaimana Penilaian Pemberian Informasi Petugas?",
ErrorMessage: "",
NameRadioButton: "radio-4",
},
{
IDItemSurvey: "5",
Nomor: "5",
Pertanyaan: "Bagaimana Penilaian Kelengkapan Alat?",
ErrorMessage: "",
NameRadioButton: "radio-5",
},
{
IDItemSurvey: "6",
Nomor: "6",
Pertanyaan: "Bagaimana Penilaian Kelayakan Alat?",
ErrorMessage: "",
NameRadioButton: "radio-6",
},
{
IDItemSurvey: "7",
Nomor: "7",
Pertanyaan: "Bagaimana Penilaian Kebersihan Ruangan?",
ErrorMessage: "",
NameRadioButton: "radio-7",
},
{
IDItemSurvey: "8",
Nomor: "8",
Pertanyaan: "Bagaimana Penilaian Kebersihan Ruangan?",
ErrorMessage: "",
NameRadioButton: "radio-8",
},
{
IDItemSurvey: "9",
Nomor: "9",
Pertanyaan: "Bagaimana Penilaian Alur Pelayanan?",
ErrorMessage: "",
NameRadioButton: "radio-9",
},
{
IDItemSurvey: "10",
Nomor: "10",
Pertanyaan: "Bagaimana Penilaian Ketepatan Waktu?",
ErrorMessage: "",
NameRadioButton: "radio-10",
},
}
// saran
dataItemSurveyMcuSaran := []models.ItemSurveyMcuSaran{
{
IDItemSurveyMcuSaran: "11",
NameSurveyMcuSaran: "saranmcu-11",
ErrorMessageSurveyMcuSaran: "",
},
}
surveymcu := []models.SurveyMcu{
{
DataListItemSurveyMcu: dataItemSurveyMcu,
DataListItemSurveyMcuSaran: dataItemSurveyMcuSaran,
},
}
return surveymcu, nil
}

View File

@@ -1,35 +0,0 @@
package utils
import (
"cpone/models"
"strings"
)
func GetIdSurveyMcu(id string) string {
return id
}
func ConcatHxIncludeSurveyMcu(dataSurveyMcu []models.SurveyMcu) string {
var elements []string
if len(dataSurveyMcu) > 0 {
for _, x := range dataSurveyMcu {
// radio button
if len(x.DataListItemSurveyMcu) > 0 {
for _, v := range x.DataListItemSurveyMcu {
elements = append(elements, "[name='radio-"+v.IDItemSurvey+"']", "[name='default-radio-"+v.IDItemSurvey+"']", "[name='id-radio']")
}
}
// saran
if len(x.DataListItemSurveyMcuSaran) > 0 {
for _, v := range x.DataListItemSurveyMcuSaran {
elements = append(elements, "[name='saranmcu-"+v.IDItemSurveyMcuSaran+"']", "[name='default-saranmcu-"+v.IDItemSurveyMcuSaran+"']", "[name='id-saran']")
}
}
}
}
// Gabungkan semua elemen dengan koma
return strings.Join(elements, ", ")
}

View File

@@ -1,32 +1,10 @@
package utils
import (
"bytes"
"net/http"
"github.com/a-h/templ"
"github.com/labstack/echo/v4"
)
func ViewMulti(c echo.Context, cmp []templ.Component) error {
var stringHtml string = ""
buf := new(bytes.Buffer)
var err error
for _, x := range cmp {
err = x.Render(c.Request().Context(), buf)
if err != nil {
return err
}
stringHtml += buf.String()
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML)
return c.String(http.StatusOK, stringHtml)
}
func View(c echo.Context, cmp templ.Component) error {
c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML)

View File

@@ -1,388 +0,0 @@
package groupresult
import (
"cpone/layout"
"cpone/models"
"cpone/component/modal"
"strconv"
"cpone/component/table"
"cpone/component/customtextfield"
)
// "cpone/component/sidebar_user_profile"
templ ContentGroupResultV1(
tableID string,
paginationID string,
searchID string,
dialogAddID string,
dialogAddBodyID string,
dialogEditID string,
dialogEditBodyID string,
dialogDeleteID string,
dialogDeleteBodyID string,
breadcrumb templ.Component,
tablecontent templ.Component,
filter templ.Component,
paginationGroupResult templ.Component,
modaladdform templ.Component,
modalEditform templ.Component,
modalDeleteform templ.Component,
) {
<div class="container-fluid">
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "tableID",
Name: "tableID",
Type: "hidden",
Value: tableID})
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "paginationID",
Name: "paginationID",
Type: "hidden",
Value: paginationID})
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "searchID",
Name: "searchID",
Type: "hidden",
Value: searchID})
@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})
<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>
@filter
// table content
@tablecontent
@paginationGroupResult
<div class="d-flex justify-content-center text-primary">
<div class="htmx-indicator spinner-border text-primary" role="status" id="indicator">
<span class="sr-only"></span>
</div>
</div>
// hx-on::after-request="showtoast()"
// hx-on::reponse-error="cobaerror()"
// hx-on::send-error="cobaerror()"
@modaladdform
@modalEditform
@modalDeleteform
// @modalcomponent.Modal("dialogEdit", "Edit - User Group", DialogEditBody("", ""), DialogEditAction(), BtnCloseNew())
@JSkuGroupResultV1()
</div>
}
templ TableRowGroupResultV1(data []models.GroupResult,
hxGetEdit string,
hxTargetEdit string,
hxSwapEdit string,
hxIncludeEdit string,
hxGetDelete string,
hxTargetDelete string,
hxSwapDelete string,
hxIncludeDelete string) {
if len(data) == 0 {
<tr>
<td colspan="3" class="text-center">Data Tidak Ditemukan</td>
</tr>
}
for _, v := range data {
<tr>
<td>{ v.Group_ResultName }</td>
<td>{ v.Group_ResultFlagPerTest }</td>
<td>{ v.Group_ResultFlagNonLab }</td>
<td>{ v.Group_ResultResumeMcu }</td>
<td>
@TableAction(v.Group_ResultID, 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
id="btneditug"
type="button"
class="btneditug col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-tosca mb-2"
hx-get={ hxGetEdit + "?id=" + strconv.Itoa(id) }
hx-target={ hxTargetEdit }
hx-swap={ hxSwapEdit }
hx-include={ hxIncludeEdit }
>
// { "/dev/usergroupshoweditform?id=" + strconv.Itoa(v.M_UserGroupID) }
// data-toggle="modal"
// data-target={ "#dialogEdit" + strconv.Itoa(v.M_UserGroupID) }
Edit
</a>
<a
id="btndeleteug"
type="button"
class=" btndeleteug col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-danger mb-2"
hx-get={ hxGetDelete + "?id=" + strconv.Itoa(id) }
hx-target={ hxTargetDelete }
hx-swap={ hxSwapDelete }
hx-include={ hxIncludeDelete }
>
// hx-get={ "/dev/usergroupshowdeleteform?id=" + strconv.Itoa(v.M_UserGroupID) }
// data-toggle="modal"
// data-target={ "#dialogDelete" + strconv.Itoa(v.M_UserGroupID) }
Hapus
</a>
</div>
}
templ DialogDeleteGroupResultActionV1() {
<div>
<button
type="button"
class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4"
data-dismiss="modal"
>
Batal
</button>
<button
type="button"
class="btn btn-primary btn-shadow font-weight-bold rounded-lg"
>
Yakin
</button>
</div>
}
templ BtnCloseDeleteGroupResultV1() {
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
>
<i aria-hidden="true" class="ki ki-close"></i>
</button>
}
templ JSkuGroupResultV1() {
<script>
function ShowLoading(evt) {
document
.getElementById("modalLoadEdit")
.setAttribute("style", "display:block !important;");
document
.getElementById("modalbdyEdit")
.setAttribute("style", "display:none !important;");
console.log(evt);
}
function ShowForm() {
document
.getElementById("modalLoadEdit")
.setAttribute("style", "display:none !important;");
document
.getElementById("modalbdyEdit")
.setAttribute("style", "display:block !important;;");
}
</script>
}
templ CssMasterGroupResultV1x() {
<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; */
}
#div-chart {
/* overflow-x: scroll; */
margin: 40px 10vw 40px 10vw;
}
.title {
font-size:20px;
font-weight: bold;
}
#title {
font-weight: 600;
}
.dropdown-menu{
transform: translate3d(0px, 35px, 0px)!important;
}
</style>
}
// for item dropdown
templ ItemDropdown(dataDropdown []models.GroupResultResumeMcu, selectedId int) {
if len(dataDropdown) == 0 {
<option value="0" disabled selected>Tidak Ada Data</option>
} else {
for _, v := range dataDropdown {
if (selectedId == v.ID) {
<option value={ strconv.Itoa(v.ID) } selected>{ v.Text }</option>
} else {
<option value={ strconv.Itoa(v.ID) }>{ v.Text }</option>
}
}
}
}
// for empty div
templ EmptyDiv1() {
<div></div>
}
templ ShowGroupResultV1x(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
}
}
// table
templ TableGroupResult(data []models.GroupResult, 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{"GROUP RESULT NAME", "RESULT FLAG PER TEST", "RESULT FLAG NON LAB", "RESULT RESUME MCU", "AKSI"},
[]string{"20%", "20%", "20%", "20%", "20%"},
TableRowGroupResultV1(data, hxGetEdit, hxTargetEdit, hxSwapEdit, hxIncludeEdit, hxGetDelete, hxTargetDelete, hxSwapDelete, hxIncludeDelete))
</div>
}
templ SwapTableGroupResult(pagination templ.Component, table templ.Component) {
@pagination
@table
}
templ GroupResultForm(data models.GroupResultFormComponent) {
<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-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 boxes = document.querySelectorAll('.btnaddact');
for (let i = 0; i < boxes.length; i++) {
boxes[i].setAttribute('disabled', 'true');
}
}
script HandleFormAfterRequest() {
console.log("handle enable btn add");
const boxes = document.querySelectorAll('.btnaddact');
for (let i = 0; i < boxes.length; i++) {
boxes[i].removeAttribute('disabled');
}
}
templ DeleteConfirmationBody(inputId models.CustomTextFieldv2Prm,
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(inputId)
</div>
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,111 +0,0 @@
package groupresult
import (
"cpone/models"
"cpone/component/customtextfield"
"cpone/component/customcheckbox"
"cpone/component/customdropdown"
)
templ DialogNewBodyV1(inputId models.CustomTextFieldv2Prm,
inputGrName models.CustomTextFieldv2Prm,
checkboxGrFlagPerTest models.CustomCheckboxv1Prm,
checkboxGrFlagNonLab models.CustomCheckboxv1Prm,
dropdownGrResumeMcu models.CustomDropdownv1Prm,
listItem templ.Component,
componentID string,
hxOnLoad templ.ComponentScript) {
<div id={ componentID } hx-on::load={ hxOnLoad }>
@customtextfield.CustomTextFieldv2(
inputId)
@customtextfield.CustomTextFieldv2(
inputGrName)
@customcheckbox.MainCustomCheckboxInput(
checkboxGrFlagPerTest)
@customcheckbox.MainCustomCheckboxInput(
checkboxGrFlagNonLab)
@customdropdown.MainCustomDropdownInput(
dropdownGrResumeMcu,
listItem)
</div>
<script>
document.addEventListener('htmx:afterSwap', function(event) {
// Reinitialize selectpicker after HTMX content swap
$('.selectpicker').selectpicker('refresh');
});
</script>
}
script HandleJSModalAddGR(modalID string) {
$(modalID).modal('hide');
}
script HandleJSModalAddGRShow(modalID string) {
$(modalID).modal('show')
}
templ DialogNewActionV1(LinkClose string, targetClose string, hxSwapClose string, modalID string) {
<div>
<button
hx-on::after-request={ HandleJSModalAddGR(modalID) }
hx-post={ LinkClose }
hx-target={ targetClose }
hx-swap={ hxSwapClose }
type="button"
class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnaddact"
data-dismiss="modal"
>
Batal
</button>
<button
type="submit"
class="btn btn-primary btn-shadow font-weight-bold rounded-lg btnaddact"
>
Save
</button>
</div>
}
templ DialogNewAction() {
<div>
<button
type="button"
class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4"
data-dismiss="modal"
>
Batal
</button>
<button
type="submit"
class="btn btn-primary btn-shadow font-weight-bold rounded-lg"
>
Save changes
</button>
</div>
}
templ BtnCloseNew() {
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
>
<i aria-hidden="true" class="ki ki-close"></i>
</button>
}
templ BtnCloseNewV1(LinkClose string, targetClose string, hxSwapClose string, modalID string) {
<button
hx-post={ LinkClose }
hx-target={ targetClose }
hx-swap={ hxSwapClose }
type="button"
hx-on::after-request={ HandleJSModalAddGR(modalID) }
class="close btnaddact"
data-dismiss="modal"
aria-label="Close"
>
<i aria-hidden="true" class="ki ki-close"></i>
</button>
}

View File

@@ -1,329 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package groupresult
//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/customcheckbox"
"cpone/component/customdropdown"
"cpone/component/customtextfield"
"cpone/models"
)
func DialogNewBodyV1(inputId models.CustomTextFieldv2Prm,
inputGrName models.CustomTextFieldv2Prm,
checkboxGrFlagPerTest models.CustomCheckboxv1Prm,
checkboxGrFlagNonLab models.CustomCheckboxv1Prm,
dropdownGrResumeMcu models.CustomDropdownv1Prm,
listItem templ.Component,
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_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = 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_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(componentID)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\groupresult\modaladdgroupresult.templ`, Line: 18, Col: 22}
}
_, 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-on::load=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 templ.ComponentScript = hxOnLoad
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var3.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(
inputId).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(
inputGrName).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = customcheckbox.MainCustomCheckboxInput(
checkboxGrFlagPerTest).Render(ctx, templ_7745c5c3_Buffer)
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 = customdropdown.MainCustomDropdownInput(
dropdownGrResumeMcu,
listItem).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div><script>\r\n document.addEventListener('htmx:afterSwap', function(event) {\r\n // Reinitialize selectpicker after HTMX content swap\r\n $('.selectpicker').selectpicker('refresh');\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 HandleJSModalAddGR(modalID string) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_HandleJSModalAddGR_a6af`,
Function: `function __templ_HandleJSModalAddGR_a6af(modalID){$(modalID).modal('hide');
}`,
Call: templ.SafeScript(`__templ_HandleJSModalAddGR_a6af`, modalID),
CallInline: templ.SafeScriptInline(`__templ_HandleJSModalAddGR_a6af`, modalID),
}
}
func HandleJSModalAddGRShow(modalID string) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_HandleJSModalAddGRShow_3147`,
Function: `function __templ_HandleJSModalAddGRShow_3147(modalID){$(modalID).modal('show')
}`,
Call: templ.SafeScript(`__templ_HandleJSModalAddGRShow_3147`, modalID),
CallInline: templ.SafeScriptInline(`__templ_HandleJSModalAddGRShow_3147`, modalID),
}
}
func DialogNewActionV1(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_Var4 := templ.GetChildren(ctx)
if templ_7745c5c3_Var4 == nil {
templ_7745c5c3_Var4 = 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, HandleJSModalAddGR(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_Var5 templ.ComponentScript = HandleJSModalAddGR(modalID)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var5.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_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(LinkClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\groupresult\modaladdgroupresult.templ`, Line: 51, Col: 22}
}
_, 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-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(targetClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\groupresult\modaladdgroupresult.templ`, Line: 52, Col: 26}
}
_, 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-swap=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\groupresult\modaladdgroupresult.templ`, Line: 53, Col: 24}
}
_, 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("\" type=\"button\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnaddact\" data-dismiss=\"modal\">Batal\r</button> <button type=\"submit\" class=\"btn btn-primary btn-shadow font-weight-bold rounded-lg btnaddact\">Save\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 DialogNewAction() 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><button type=\"button\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4\" data-dismiss=\"modal\">Batal\r</button> <button type=\"submit\" class=\"btn btn-primary btn-shadow font-weight-bold rounded-lg\">Save changes\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 BtnCloseNew() 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)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button type=\"button\" class=\"close\" 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 BtnCloseNewV1(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_Var11 := templ.GetChildren(ctx)
if templ_7745c5c3_Var11 == nil {
templ_7745c5c3_Var11 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, HandleJSModalAddGR(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_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(LinkClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\groupresult\modaladdgroupresult.templ`, Line: 100, Col: 21}
}
_, 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-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(targetClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\groupresult\modaladdgroupresult.templ`, Line: 101, Col: 25}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
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_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\groupresult\modaladdgroupresult.templ`, Line: 102, Col: 23}
}
_, 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("\" type=\"button\" hx-on::after-request=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var15 templ.ComponentScript = HandleJSModalAddGR(modalID)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var15.Call)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"close btnaddact\" 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
})
}

View File

@@ -1,101 +0,0 @@
package groupresult
import (
"cpone/models"
"cpone/component/customtextfield"
"cpone/component/customcheckbox"
"cpone/component/customdropdown"
)
templ DialogEditForm(groupresultname string, groupresultflagpertest string, groupresultflagnonlab string, listItem templ.Component) {
@customtextfield.CustomTextFieldv2(
models.CustomTextFieldv2Prm{
Label: "Group Result name",
Name: "groupresultid",
Placeholder: "Group Result name",
Type: "hidden",
ID: "groupresultid",
})
@customtextfield.CustomTextFieldv2(
models.CustomTextFieldv2Prm{
Label: "Group Result Name",
Name: "groupresultname",
Placeholder: "Group Result Name",
Value: groupresultname,
Type: "text", ID: "groupresultname"})
@customcheckbox.MainCustomCheckboxInput(
models.CustomCheckboxv1Prm{
Label: "Group Result Flag Per Test (Dicentang Maka Ya)",
Name: "groupresultflagpertest",
ID: "groupresultflagpertest",
Value: groupresultflagpertest,
})
@customcheckbox.MainCustomCheckboxInput(
models.CustomCheckboxv1Prm{
Label: "Group Result Flag Non Lab (Dicentang Maka Ya)",
Name: "groupresultflagnonlab",
ID: "groupresultflagnonlab",
Value: groupresultflagnonlab,
})
@customdropdown.MainCustomDropdownInput(
models.CustomDropdownv1Prm{
Label: "Group Result Resume MCU",
Name: "groupresultresumemcu",
ID: "groupresultresumemcu",
},
listItem)
}
templ DialogEditBody(groupresultname string, groupresultflagpertest string, groupresultflagnonlab string, listItem templ.Component) {
<div id="modalbdyEdit">
@DialogEditForm(groupresultname, groupresultflagpertest, groupresultflagnonlab, listItem)
</div>
<div>
// <div class="text-center text-primary" id="modalLoadEdit" style="">
// <div class="spinner-border" role="status"></div>
// </div>
</div>
}
templ LoadingSpinner() {
<div id="modalbdyEdit">
<div class="text-center text-primary">
<div class="spinner-border" role="status"></div>
</div>
</div>
}
templ DialogEditAction() {
<div>
<button
id="btledit"
type="button"
hx-swap="delete"
hx-target="#modalbdyEdit"
onclick="htmx.trigger('.btneditusgp', 'htmx:abort')"
class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4"
data-dismiss="modal"
>
Batal
</button>
<button
type="button"
class="btn btn-primary btn-shadow font-weight-bold rounded-lg"
>
Save changes
</button>
</div>
}
templ BtnCloseEdit() {
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
hx-target="#modalbdyEdit"
onclick="htmx.trigger('.btneditusgp', 'htmx:abort')"
>
<i aria-hidden="true" class="ki ki-close"></i>
</button>
}

View File

@@ -1,193 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package groupresult
//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/customcheckbox"
"cpone/component/customdropdown"
"cpone/component/customtextfield"
"cpone/models"
)
func DialogEditForm(groupresultname string, groupresultflagpertest string, groupresultflagnonlab string, 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_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(
models.CustomTextFieldv2Prm{
Label: "Group Result name",
Name: "groupresultid",
Placeholder: "Group Result name",
Type: "hidden",
ID: "groupresultid",
}).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(
models.CustomTextFieldv2Prm{
Label: "Group Result Name",
Name: "groupresultname",
Placeholder: "Group Result Name",
Value: groupresultname,
Type: "text", ID: "groupresultname"}).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = customcheckbox.MainCustomCheckboxInput(
models.CustomCheckboxv1Prm{
Label: "Group Result Flag Per Test (Dicentang Maka Ya)",
Name: "groupresultflagpertest",
ID: "groupresultflagpertest",
Value: groupresultflagpertest,
}).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = customcheckbox.MainCustomCheckboxInput(
models.CustomCheckboxv1Prm{
Label: "Group Result Flag Non Lab (Dicentang Maka Ya)",
Name: "groupresultflagnonlab",
ID: "groupresultflagnonlab",
Value: groupresultflagnonlab,
}).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = customdropdown.MainCustomDropdownInput(
models.CustomDropdownv1Prm{
Label: "Group Result Resume MCU",
Name: "groupresultresumemcu",
ID: "groupresultresumemcu",
},
listItem).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 DialogEditBody(groupresultname string, groupresultflagpertest string, groupresultflagnonlab string, 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_Var2 := templ.GetChildren(ctx)
if templ_7745c5c3_Var2 == nil {
templ_7745c5c3_Var2 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div id=\"modalbdyEdit\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = DialogEditForm(groupresultname, groupresultflagpertest, groupresultflagnonlab, listItem).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 LoadingSpinner() 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)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div id=\"modalbdyEdit\"><div class=\"text-center text-primary\"><div class=\"spinner-border\" role=\"status\"></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 DialogEditAction() 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)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div><button id=\"btledit\" type=\"button\" hx-swap=\"delete\" hx-target=\"#modalbdyEdit\" onclick=\"htmx.trigger(&#39;.btneditusgp&#39;, &#39;htmx:abort&#39;)\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4\" data-dismiss=\"modal\">Batal\r</button> <button type=\"button\" class=\"btn btn-primary btn-shadow font-weight-bold rounded-lg\">Save changes\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 BtnCloseEdit() 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("<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\" hx-target=\"#modalbdyEdit\" onclick=\"htmx.trigger(&#39;.btneditusgp&#39;, &#39;htmx:abort&#39;)\"><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
})
}

View File

@@ -39,7 +39,7 @@ templ ContentMasterMenuUserGroup(ugData []models.UserGroup, contentID string) {
<span class="sr-only"></span>
</div>
</div>
@modalcomponent.Modal("dialogNew", "New - User Group", DialogNewBody("", "", "", "", ""), DialogNewAction(), BtnCloseNew())
@modalcomponent.Modal("dialogNew", "New - User Group", DialogNewBody("", ""), DialogNewAction(), BtnCloseNew())
@modalcomponent.Modal("dialogEdit", "Edit - User Group", DialogEditBody("", ""), DialogEditAction(), BtnCloseNew())
@JSku()
</div>

View File

@@ -66,7 +66,7 @@ func ContentMasterMenuUserGroup(ugData []models.UserGroup, contentID string) tem
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = modalcomponent.Modal("dialogNew", "New - User Group", DialogNewBody("", "", "", "", ""), DialogNewAction(), BtnCloseNew()).Render(ctx, templ_7745c5c3_Buffer)
templ_7745c5c3_Err = modalcomponent.Modal("dialogNew", "New - User Group", DialogNewBody("", ""), DialogNewAction(), BtnCloseNew()).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}

View File

@@ -5,66 +5,11 @@ import (
"cpone/models"
"cpone/component/modal"
"strconv"
"cpone/component/table"
"cpone/component/customtextfield"
)
// "cpone/component/sidebar_user_profile"
templ ContentMasterMenuUserGroupV1(
tableID string,
paginationID string,
searchID string,
dialogAddID string,
dialogAddBodyID string,
dialogEditID string,
dialogEditBodyID string,
dialogDeleteID string,
dialogDeleteBodyID string,
breadcrumb templ.Component,
tablecontent templ.Component,
filterUserGroup templ.Component,
paginationUserGroup templ.Component,
modaladdform templ.Component,
modalEditform templ.Component,
modalDeleteform templ.Component,
) {
templ ContentMasterMenuUserGroupV1(contentID string, breadcrumb templ.Component, tablecontent templ.Component, inputanSearch templ.Component) {
<div class="container-fluid">
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "tableID",
Name: "tableID",
Type: "hidden",
Value: tableID})
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "paginationID",
Name: "paginationID",
Type: "hidden",
Value: paginationID})
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "searchID",
Name: "searchID",
Type: "hidden",
Value: searchID})
@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})
<div class="row align-items-center mb-10">
<div class="col-md-10 col-sm-12 p-0 ">
@breadcrumb
@@ -76,48 +21,44 @@ templ ContentMasterMenuUserGroupV1(
type="button"
class="btn btn-primary"
data-toggle="modal"
data-target={ "#" + dialogAddID }
data-target="#dialogNew"
>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>
<button type="button" class="btn btn-primary btn-block">Add New</button>
</div>
</div>
@filterUserGroup
// table content
@tablecontent
@paginationUserGroup
<div class="d-flex justify-content-center text-primary">
<div class="htmx-indicator spinner-border text-primary" role="status" id="indicator">
<div class="htmx-indicator spinner-border" role="status" id="indicator">
<span class="sr-only"></span>
</div>
</div>
// hx-on::after-request="showtoast()"
// hx-on::reponse-error="cobaerror()"
// hx-on::send-error="cobaerror()"
@modaladdform
@modalEditform
@modalDeleteform
// @modalcomponent.Modal("dialogEdit", "Edit - User Group", DialogEditBody("", ""), DialogEditAction(), BtnCloseNew())
@modalcomponent.Modal("dialogNew", "New - User Group", DialogNewBody("", ""), DialogNewAction(), BtnCloseNew())
@modalcomponent.Modal("dialogEdit", "Edit - User Group", DialogEditBody("", ""), DialogEditAction(), BtnCloseNew())
@JSku()
</div>
}
templ TableRowV1(data []models.UserGroupV1,
hxGetEdit string,
hxTargetEdit string,
hxSwapEdit string,
hxIncludeEdit string,
hxGetDelete string,
hxTargetDelete string,
hxSwapDelete string,
hxIncludeDelete string) {
templ TableRowV1(data []models.UserGroupV1) {
// /usergroup/edit
// <a
// id="btneditug"
// type="button"
// class="btneditusgp col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-tosca mb-2"
// onclick="htmx.trigger('#btneditug', 'htmx:abort')"
// hx-target="#modalbdyEdit"
// hx-swap="innerHTML"
// hx-get={ "/client/usergroup/edit?id=" + strconv.Itoa(v.UserGroupID) }
// hx-on::before-request="ShowLoading()"
// hx-on::after-request="ShowForm()"
// data-toggle="modal"
// data-target="#dialogEdit"
// >
// Edit
// </a>
if len(data) == 0 {
<tr>
<td colspan="3" class="text-center">Data Tidak Ditemukan</td>
@@ -128,55 +69,38 @@ templ TableRowV1(data []models.UserGroupV1,
<td>{ v.M_UserGroupCode }</td>
<td>{ v.M_UserGroupName }</td>
<td>
@TableAction(v.M_UserGroupID, hxGetEdit, hxTargetEdit, hxSwapEdit, hxIncludeEdit, hxGetDelete, hxTargetDelete, hxSwapDelete, hxIncludeDelete)
<div class="row px-5 d-flex justify-content-around">
<a
id="btneditug"
type="button"
class="btneditusgp col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-tosca mb-2"
data-toggle="modal"
data-target={ "#dialogEdit" + strconv.Itoa(v.M_UserGroupID) }
>
Edit
</a>
<a
type="button"
class="col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-danger mb-2"
data-toggle="modal"
data-target={ "#dialogDelete" + strconv.Itoa(v.M_UserGroupID) }
>Hapus</a>
@modalcomponent.Modal("dialogEdit"+strconv.Itoa(v.M_UserGroupID),
"Edit - User Group",
DialogEditBody(v.M_UserGroupCode, v.M_UserGroupName),
DialogEditAction(),
BtnCloseNew())
@modalcomponent.ModalConfirmation(
"dialogDelete"+strconv.Itoa(v.M_UserGroupID),
"Konfirmasi",
"Apakah anda yakin menghapus user group berikut ?", BtnCloseDelete(),
[]string{"Kode", "User Group"}, []string{v.M_UserGroupCode, v.M_UserGroupName}, DialogDeleteAction())
</div>
</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
id="btneditug"
type="button"
class="btneditug col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-tosca mb-2"
hx-get={ hxGetEdit + "?id=" + strconv.Itoa(id) }
hx-target={ hxTargetEdit }
hx-swap={ hxSwapEdit }
hx-include={ hxIncludeEdit }
>
// { "/dev/usergroupshoweditform?id=" + strconv.Itoa(v.M_UserGroupID) }
// data-toggle="modal"
// data-target={ "#dialogEdit" + strconv.Itoa(v.M_UserGroupID) }
Edit
</a>
<a
id="btndeleteug"
type="button"
class=" btndeleteug col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-danger mb-2"
hx-get={ hxGetDelete + "?id=" + strconv.Itoa(id) }
hx-target={ hxTargetDelete }
hx-swap={ hxSwapDelete }
hx-include={ hxIncludeDelete }
>
// hx-get={ "/dev/usergroupshowdeleteform?id=" + strconv.Itoa(v.M_UserGroupID) }
// data-toggle="modal"
// data-target={ "#dialogDelete" + strconv.Itoa(v.M_UserGroupID) }
Hapus
</a>
</div>
}
templ DialogDeleteActionV1() {
<div>
<button
@@ -228,6 +152,25 @@ templ JSkuV1() {
</script>
}
templ PaginationV1() {
<div class="d-flex justify-content-between align-items-center flex-wrap">
<div class="d-flex flex-wrap py-2 mr-3">
<a href="#" class="btn btn-icon btn-sm btn-light mr-2 my-1"><i class="ki ki-bold-double-arrow-back icon-xs"></i></a>
<a href="#" class="btn btn-icon btn-sm btn-light mr-2 my-1"><i class="ki ki-bold-arrow-back icon-xs"></i></a>
<a href="#" class="btn btn-icon btn-sm border-0 btn-light mr-2 my-1">...</a>
<a href="#" class="btn btn-icon btn-sm border-0 btn-light mr-2 my-1">23</a>
<a href="#" class="btn btn-icon btn-sm border-0 btn-light btn-hover-primary active mr-2 my-1">24</a>
<a href="#" class="btn btn-icon btn-sm border-0 btn-light mr-2 my-1">25</a>
<a href="#" class="btn btn-icon btn-sm border-0 btn-light mr-2 my-1">26</a>
<a href="#" class="btn btn-icon btn-sm border-0 btn-light mr-2 my-1">27</a>
<a href="#" class="btn btn-icon btn-sm border-0 btn-light mr-2 my-1">28</a>
<a href="#" class="btn btn-icon btn-sm border-0 btn-light mr-2 my-1">...</a>
<a href="#" class="btn btn-icon btn-sm btn-light mr-2 my-1"><i class="ki ki-bold-arrow-next icon-xs"></i></a>
<a href="#" class="btn btn-icon btn-sm btn-light mr-2 my-1"><i class="ki ki-bold-double-arrow-next icon-xs"></i></a>
</div>
</div>
}
templ CssMasterMenuUserGroupV1x() {
<link
rel="stylesheet"
@@ -268,99 +211,9 @@ templ JsMasterMenuUserGroupV1x() {
templ ShowMasterMenuUserGroupV1x(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) {
userprofile templ.Component,
) {
@layout.CorporateLayout(title, css, js, navbarmenu, navbaruser, userprofile,) {
@cmp
}
}
templ TableUserGroup(data []models.UserGroupV1, 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", "USERGROUP", "AKSI"},
[]string{"40%", "40%", "20%"},
TableRowV1(data, hxGetEdit, hxTargetEdit, hxSwapEdit, hxIncludeEdit, hxGetDelete, hxTargetDelete, hxSwapDelete, hxIncludeDelete))
</div>
}
templ SwapTableUserGroup(pagination templ.Component, table templ.Component) {
@pagination
@table
}
templ UserGroupForm(data models.UserGroupFormComponent) {
<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-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 boxes = document.querySelectorAll('.btnaddact');
for (let i = 0; i < boxes.length; i++) {
boxes[i].setAttribute('disabled', 'true');
}
}
script HandleFormAfterRequest() {
console.log("handle enable btn add");
const boxes = document.querySelectorAll('.btnaddact');
for (let i = 0; i < boxes.length; i++) {
boxes[i].removeAttribute('disabled');
}
}
templ DeleteConfirmationBody(inputId models.CustomTextFieldv2Prm,
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(inputId)
</div>
}

View File

@@ -11,33 +11,14 @@ import "io"
import "bytes"
import (
"cpone/component/customtextfield"
"cpone/component/modal"
"cpone/component/table"
"cpone/layout"
"cpone/models"
"strconv"
)
// "cpone/component/sidebar_user_profile"
func ContentMasterMenuUserGroupV1(
tableID string,
paginationID string,
searchID string,
dialogAddID string,
dialogAddBodyID string,
dialogEditID string,
dialogEditBodyID string,
dialogDeleteID string,
dialogDeleteBodyID string,
breadcrumb templ.Component,
tablecontent templ.Component,
filterUserGroup templ.Component,
paginationUserGroup templ.Component,
modaladdform templ.Component,
modalEditform templ.Component,
modalDeleteform templ.Component,
) templ.Component {
func ContentMasterMenuUserGroupV1(contentID string, breadcrumb templ.Component, tablecontent templ.Component, inputanSearch 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 {
@@ -50,74 +31,7 @@ func ContentMasterMenuUserGroupV1(
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: "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 = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "searchID",
Name: "searchID",
Type: "hidden",
Value: searchID}).Render(ctx, templ_7745c5c3_Buffer)
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 = templ_7745c5c3_Buffer.WriteString("<div class=\"row align-items-center mb-10\"><div class=\"col-md-10 col-sm-12 p-0 \">")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"container-fluid\"><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
}
@@ -125,37 +39,7 @@ func ContentMasterMenuUserGroupV1(
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\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 79, 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\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 88, 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>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = filterUserGroup.Render(ctx, templ_7745c5c3_Buffer)
_, 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=\"#dialogNew\">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\">Add New</button></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -163,23 +47,15 @@ func ContentMasterMenuUserGroupV1(
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = paginationUserGroup.Render(ctx, templ_7745c5c3_Buffer)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"d-flex justify-content-center text-primary\"><div class=\"htmx-indicator spinner-border\" role=\"status\" id=\"indicator\"><span class=\"sr-only\"></span></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"d-flex justify-content-center text-primary\"><div class=\"htmx-indicator spinner-border text-primary\" role=\"status\" id=\"indicator\"><span class=\"sr-only\"></span></div></div>")
templ_7745c5c3_Err = modalcomponent.Modal("dialogNew", "New - User Group", DialogNewBody("", ""), DialogNewAction(), BtnCloseNew()).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = modaladdform.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = modalEditform.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = modalDeleteform.Render(ctx, templ_7745c5c3_Buffer)
templ_7745c5c3_Err = modalcomponent.Modal("dialogEdit", "Edit - User Group", DialogEditBody("", ""), DialogEditAction(), BtnCloseNew()).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -198,15 +74,7 @@ func ContentMasterMenuUserGroupV1(
})
}
func TableRowV1(data []models.UserGroupV1,
hxGetEdit string,
hxTargetEdit string,
hxSwapEdit string,
hxIncludeEdit string,
hxGetDelete string,
hxTargetDelete string,
hxSwapDelete string,
hxIncludeDelete string) templ.Component {
func TableRowV1(data []models.UserGroupV1) 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 {
@@ -214,9 +82,9 @@ func TableRowV1(data []models.UserGroupV1,
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
templ_7745c5c3_Var2 := templ.GetChildren(ctx)
if templ_7745c5c3_Var2 == nil {
templ_7745c5c3_Var2 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
if len(data) == 0 {
@@ -230,178 +98,78 @@ func TableRowV1(data []models.UserGroupV1,
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(v.M_UserGroupCode)
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(v.M_UserGroupCode)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 128, Col: 26}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 69, Col: 26}
}
_, 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("</td><td>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(v.M_UserGroupName)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 70, Col: 26}
}
_, 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><div class=\"row px-5 d-flex justify-content-around\"><a id=\"btneditug\" type=\"button\" class=\"btneditusgp col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-tosca mb-2\" data-toggle=\"modal\" data-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs("#dialogEdit" + strconv.Itoa(v.M_UserGroupID))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 78, Col: 65}
}
_, 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>")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">Edit\r</a> <a type=\"button\" class=\"col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-danger mb-2\" data-toggle=\"modal\" data-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(v.M_UserGroupName)
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs("#dialogDelete" + strconv.Itoa(v.M_UserGroupID))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 129, Col: 26}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 86, Col: 67}
}
_, 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>")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">Hapus</a>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = TableAction(v.M_UserGroupID, hxGetEdit, hxTargetEdit, hxSwapEdit, hxIncludeEdit, hxGetDelete, hxTargetDelete, hxSwapDelete, hxIncludeDelete).Render(ctx, templ_7745c5c3_Buffer)
templ_7745c5c3_Err = modalcomponent.Modal("dialogEdit"+strconv.Itoa(v.M_UserGroupID),
"Edit - User Group",
DialogEditBody(v.M_UserGroupCode, v.M_UserGroupName),
DialogEditAction(),
BtnCloseNew()).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</td></tr>")
templ_7745c5c3_Err = modalcomponent.ModalConfirmation(
"dialogDelete"+strconv.Itoa(v.M_UserGroupID),
"Konfirmasi",
"Apakah anda yakin menghapus user group berikut ?", BtnCloseDelete(),
[]string{"Kode", "User Group"}, []string{v.M_UserGroupCode, v.M_UserGroupName}, DialogDeleteAction()).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></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\"><a id=\"btneditug\" type=\"button\" class=\"btneditug col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-tosca mb-2\" 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\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 153, 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\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 154, 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\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 155, 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\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 156, 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("\">Edit\r</a> <a id=\"btndeleteug\" type=\"button\" class=\" btndeleteug col-12 col-sm-12 col-md-12 col-lg-5 col-xl-5 col-xxl-5 btn btn-light-danger mb-2\" hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, 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\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 167, Col: 51}
}
_, 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-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 168, Col: 29}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
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_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 169, Col: 25}
}
_, 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-include=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(hxIncludeDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 170, Col: 31}
}
_, 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("\">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)
@@ -418,9 +186,9 @@ func DialogDeleteActionV1() templ.Component {
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var16 := templ.GetChildren(ctx)
if templ_7745c5c3_Var16 == nil {
templ_7745c5c3_Var16 = templ.NopComponent
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><button type=\"button\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4\" data-dismiss=\"modal\">Batal\r</button> <button type=\"button\" class=\"btn btn-primary btn-shadow font-weight-bold rounded-lg\">Yakin\r</button></div>")
@@ -442,9 +210,9 @@ func BtnCloseDeleteV1() templ.Component {
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
templ_7745c5c3_Var8 := templ.GetChildren(ctx)
if templ_7745c5c3_Var8 == nil {
templ_7745c5c3_Var8 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><i aria-hidden=\"true\" class=\"ki ki-close\"></i></button>")
@@ -466,9 +234,9 @@ func JSkuV1() templ.Component {
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var18 := templ.GetChildren(ctx)
if templ_7745c5c3_Var18 == nil {
templ_7745c5c3_Var18 = templ.NopComponent
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("<script>\r\n\t\t function ShowLoading(evt) {\r\n document\r\n .getElementById(\"modalLoadEdit\")\r\n .setAttribute(\"style\", \"display:block !important;\");\r\n document\r\n .getElementById(\"modalbdyEdit\")\r\n .setAttribute(\"style\", \"display:none !important;\");\r\n\t\t console.log(evt);\r\n }\r\n function ShowForm() {\r\n document\r\n .getElementById(\"modalLoadEdit\")\r\n .setAttribute(\"style\", \"display:none !important;\");\r\n document\r\n .getElementById(\"modalbdyEdit\")\r\n .setAttribute(\"style\", \"display:block !important;;\");\r\n }\r\n\t</script>")
@@ -482,6 +250,30 @@ func JSkuV1() templ.Component {
})
}
func PaginationV1() 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)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"d-flex justify-content-between align-items-center flex-wrap\"><div class=\"d-flex flex-wrap py-2 mr-3\"><a href=\"#\" class=\"btn btn-icon btn-sm btn-light mr-2 my-1\"><i class=\"ki ki-bold-double-arrow-back icon-xs\"></i></a> <a href=\"#\" class=\"btn btn-icon btn-sm btn-light mr-2 my-1\"><i class=\"ki ki-bold-arrow-back icon-xs\"></i></a> <a href=\"#\" class=\"btn btn-icon btn-sm border-0 btn-light mr-2 my-1\">...</a> <a href=\"#\" class=\"btn btn-icon btn-sm border-0 btn-light mr-2 my-1\">23</a> <a href=\"#\" class=\"btn btn-icon btn-sm border-0 btn-light btn-hover-primary active mr-2 my-1\">24</a> <a href=\"#\" class=\"btn btn-icon btn-sm border-0 btn-light mr-2 my-1\">25</a> <a href=\"#\" class=\"btn btn-icon btn-sm border-0 btn-light mr-2 my-1\">26</a> <a href=\"#\" class=\"btn btn-icon btn-sm border-0 btn-light mr-2 my-1\">27</a> <a href=\"#\" class=\"btn btn-icon btn-sm border-0 btn-light mr-2 my-1\">28</a> <a href=\"#\" class=\"btn btn-icon btn-sm border-0 btn-light mr-2 my-1\">...</a> <a href=\"#\" class=\"btn btn-icon btn-sm btn-light mr-2 my-1\"><i class=\"ki ki-bold-arrow-next icon-xs\"></i></a> <a href=\"#\" class=\"btn btn-icon btn-sm btn-light mr-2 my-1\"><i class=\"ki ki-bold-double-arrow-next icon-xs\"></i></a></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 CssMasterMenuUserGroupV1x() 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)
@@ -490,9 +282,9 @@ func CssMasterMenuUserGroupV1x() templ.Component {
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
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 #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 \r\n</style>")
@@ -514,9 +306,9 @@ func JsMasterMenuUserGroupV1x() templ.Component {
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var20 := templ.GetChildren(ctx)
if templ_7745c5c3_Var20 == nil {
templ_7745c5c3_Var20 = templ.NopComponent
templ_7745c5c3_Var12 := templ.GetChildren(ctx)
if templ_7745c5c3_Var12 == nil {
templ_7745c5c3_Var12 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
if !templ_7745c5c3_IsBuffer {
@@ -529,7 +321,8 @@ func JsMasterMenuUserGroupV1x() templ.Component {
func ShowMasterMenuUserGroupV1x(title string, cmp templ.Component, css templ.Component, js templ.Component,
navbarmenu templ.Component,
navbaruser templ.Component,
userprofile templ.Component) 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 {
@@ -537,12 +330,12 @@ func ShowMasterMenuUserGroupV1x(title string, cmp templ.Component, css templ.Com
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var21 := templ.GetChildren(ctx)
if templ_7745c5c3_Var21 == nil {
templ_7745c5c3_Var21 = templ.NopComponent
templ_7745c5c3_Var13 := templ.GetChildren(ctx)
if templ_7745c5c3_Var13 == nil {
templ_7745c5c3_Var13 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var22 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
templ_7745c5c3_Var14 := 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()
@@ -557,372 +350,7 @@ func ShowMasterMenuUserGroupV1x(title string, cmp templ.Component, css templ.Com
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, navbarmenu, navbaruser, userprofile).Render(templ.WithChildren(ctx, templ_7745c5c3_Var22), 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 TableUserGroup(data []models.UserGroupV1, 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_Var23 := templ.GetChildren(ctx)
if templ_7745c5c3_Var23 == nil {
templ_7745c5c3_Var23 = 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_Var24 string
templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(tableID)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 286, Col: 18}
}
_, 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-swap-oob=\"true\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = tablecomponent.TableV3([]string{"KODE", "USERGROUP", "AKSI"},
[]string{"40%", "40%", "20%"},
TableRowV1(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 SwapTableUserGroup(pagination templ.Component, table 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_Var25 := templ.GetChildren(ctx)
if templ_7745c5c3_Var25 == nil {
templ_7745c5c3_Var25 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = pagination.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = table.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 UserGroupForm(data models.UserGroupFormComponent) 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_Var26 := templ.GetChildren(ctx)
if templ_7745c5c3_Var26 == nil {
templ_7745c5c3_Var26 = 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_Var27 string
templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(data.IDComponent)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 301, Col: 24}
}
_, 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-post=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var28 string
templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(data.Link)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 302, 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("\" class=\"form\" hx-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var29 string
templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(data.HxTarget)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 304, Col: 28}
}
_, 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-swap=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var30 string
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(data.HxSwap)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 305, Col: 24}
}
_, 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-include=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var31 string
templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(data.HxInclude)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 306, Col: 30}
}
_, 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-on::before-request=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var32 templ.ComponentScript = HandleFormBeforeRequest()
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var32.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_Var33 templ.ComponentScript = HandleFormAfterRequest()
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var33.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_1e3f`,
Function: `function __templ_HandleFormBeforeRequest_1e3f(){console.log("handle disable btn add");
const boxes = document.querySelectorAll('.btnaddact');
for (let i = 0; i < boxes.length; i++) {
boxes[i].setAttribute('disabled', 'true');
}
}`,
Call: templ.SafeScript(`__templ_HandleFormBeforeRequest_1e3f`),
CallInline: templ.SafeScriptInline(`__templ_HandleFormBeforeRequest_1e3f`),
}
}
func HandleFormAfterRequest() templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_HandleFormAfterRequest_ee07`,
Function: `function __templ_HandleFormAfterRequest_ee07(){console.log("handle enable btn add");
const boxes = document.querySelectorAll('.btnaddact');
for (let i = 0; i < boxes.length; i++) {
boxes[i].removeAttribute('disabled');
}
}`,
Call: templ.SafeScript(`__templ_HandleFormAfterRequest_ee07`),
CallInline: templ.SafeScriptInline(`__templ_HandleFormAfterRequest_ee07`),
}
}
func DeleteConfirmationBody(inputId models.CustomTextFieldv2Prm,
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_Var34 := templ.GetChildren(ctx)
if templ_7745c5c3_Var34 == nil {
templ_7745c5c3_Var34 = 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_Var35 string
templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(componentID)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 346, Col: 22}
}
_, 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("\" hx-on::load=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var36 templ.ComponentScript = hxOnLoad
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var36.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_Var37 string
templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(message)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 347, Col: 14}
}
_, 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("</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_Var38 string
templ_7745c5c3_Var38, templ_7745c5c3_Err = templ.JoinStringErrs(v)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 352, Col: 68}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var38))
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_Var39 string
templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(v)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\mastermenuusergroupv1.templ`, Line: 358, Col: 10}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39))
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(inputId).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, navbarmenu, navbaruser, userprofile).Render(templ.WithChildren(ctx, templ_7745c5c3_Var14), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}

View File

@@ -5,17 +5,8 @@ import (
"cpone/component/customtextfield"
)
templ DialogNewBody(code string, name string, id string, codeErrorMsg string, nameErrorMsg string) {
templ DialogNewBody(code string, name string) {
<div id="modalbdy">
@customtextfield.CustomTextFieldv2(
models.CustomTextFieldv2Prm{
Label: "id user group",
Name: "usergroupid",
Placeholder: "id user Group",
Type: "hidden",
Value: code,
ErrorMsg: codeErrorMsg,
})
@customtextfield.CustomTextFieldv2(
models.CustomTextFieldv2Prm{
Label: "Kode user group",
@@ -23,7 +14,6 @@ templ DialogNewBody(code string, name string, id string, codeErrorMsg string, na
Placeholder: "Kode user Group",
Type: "text",
Value: code,
ErrorMsg: codeErrorMsg,
})
@customtextfield.CustomTextFieldv2(
models.CustomTextFieldv2Prm{
@@ -32,56 +22,10 @@ templ DialogNewBody(code string, name string, id string, codeErrorMsg string, na
Placeholder: "Nama User Group",
Type: "text",
Value: name,
ErrorMsg: nameErrorMsg,
})
</div>
}
templ DialogNewBodyV1(inputId models.CustomTextFieldv2Prm,
inputCode models.CustomTextFieldv2Prm,
inputName models.CustomTextFieldv2Prm,
componentID string,
hxOnLoad templ.ComponentScript) {
<div id={ componentID } hx-on::load={ hxOnLoad }>
@customtextfield.CustomTextFieldv2(
inputId)
@customtextfield.CustomTextFieldv2(
inputCode)
@customtextfield.CustomTextFieldv2(
inputName)
</div>
}
script HandleJSModalAddUG(modalID string) {
$(modalID).modal('hide')
}
script HandleJSModalAddUGShow(modalID string) {
$(modalID).modal('show')
}
templ DialogNewActionV1(LinkClose string, targetClose string, hxSwapClose string, modalID string) {
<div>
<button
hx-on::after-request={ HandleJSModalAddUG(modalID) }
hx-post={ LinkClose }
hx-target={ targetClose }
hx-swap={ hxSwapClose }
type="button"
class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnaddact"
data-dismiss="modal"
>
Batal
</button>
<button
type="submit"
class="btn btn-primary btn-shadow font-weight-bold rounded-lg btnaddact"
>
Save
</button>
</div>
}
templ DialogNewAction() {
<div>
<button
@@ -92,7 +36,7 @@ templ DialogNewAction() {
Batal
</button>
<button
type="submit"
type="button"
class="btn btn-primary btn-shadow font-weight-bold rounded-lg"
>
Save changes
@@ -110,18 +54,3 @@ templ BtnCloseNew() {
<i aria-hidden="true" class="ki ki-close"></i>
</button>
}
templ BtnCloseNewV1(LinkClose string, targetClose string, hxSwapClose string, modalID string) {
<button
hx-post={ LinkClose }
hx-target={ targetClose }
hx-swap={ hxSwapClose }
type="button"
hx-on::after-request={ HandleJSModalAddUG(modalID) }
class="close btnaddact"
data-dismiss="modal"
aria-label="Close"
>
<i aria-hidden="true" class="ki ki-close"></i>
</button>
}

View File

@@ -15,7 +15,7 @@ import (
"cpone/models"
)
func DialogNewBody(code string, name string, id string, codeErrorMsg string, nameErrorMsg string) templ.Component {
func DialogNewBody(code string, name 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 {
@@ -32,18 +32,6 @@ func DialogNewBody(code string, name string, id string, codeErrorMsg string, nam
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(
models.CustomTextFieldv2Prm{
Label: "id user group",
Name: "usergroupid",
Placeholder: "id user Group",
Type: "hidden",
Value: code,
ErrorMsg: codeErrorMsg,
}).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(
models.CustomTextFieldv2Prm{
Label: "Kode user group",
@@ -51,7 +39,6 @@ func DialogNewBody(code string, name string, id string, codeErrorMsg string, nam
Placeholder: "Kode user Group",
Type: "text",
Value: code,
ErrorMsg: codeErrorMsg,
}).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
@@ -63,7 +50,6 @@ func DialogNewBody(code string, name string, id string, codeErrorMsg string, nam
Placeholder: "Nama User Group",
Type: "text",
Value: name,
ErrorMsg: nameErrorMsg,
}).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
@@ -79,179 +65,6 @@ func DialogNewBody(code string, name string, id string, codeErrorMsg string, nam
})
}
func DialogNewBodyV1(inputId models.CustomTextFieldv2Prm,
inputCode models.CustomTextFieldv2Prm,
inputName models.CustomTextFieldv2Prm,
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_Var2 := templ.GetChildren(ctx)
if templ_7745c5c3_Var2 == nil {
templ_7745c5c3_Var2 = 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_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(componentID)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\modaladdusergroup.templ`, Line: 45, 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("\" hx-on::load=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 templ.ComponentScript = hxOnLoad
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var4.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(
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 = 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 HandleJSModalAddUG(modalID string) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_HandleJSModalAddUG_da6c`,
Function: `function __templ_HandleJSModalAddUG_da6c(modalID){$(modalID).modal('hide')
}`,
Call: templ.SafeScript(`__templ_HandleJSModalAddUG_da6c`, modalID),
CallInline: templ.SafeScriptInline(`__templ_HandleJSModalAddUG_da6c`, modalID),
}
}
func HandleJSModalAddUGShow(modalID string) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_HandleJSModalAddUGShow_3147`,
Function: `function __templ_HandleJSModalAddUGShow_3147(modalID){$(modalID).modal('show')
}`,
Call: templ.SafeScript(`__templ_HandleJSModalAddUGShow_3147`, modalID),
CallInline: templ.SafeScriptInline(`__templ_HandleJSModalAddUGShow_3147`, modalID),
}
}
func DialogNewActionV1(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_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("<div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, HandleJSModalAddUG(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_Var6 templ.ComponentScript = HandleJSModalAddUG(modalID)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var6.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_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(LinkClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\modaladdusergroup.templ`, Line: 67, Col: 22}
}
_, 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-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(targetClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\modaladdusergroup.templ`, Line: 68, Col: 26}
}
_, 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-swap=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\modaladdusergroup.templ`, Line: 69, Col: 24}
}
_, 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("\" type=\"button\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4 btnaddact\" data-dismiss=\"modal\">Batal\r</button> <button type=\"submit\" class=\"btn btn-primary btn-shadow font-weight-bold rounded-lg btnaddact\">Save\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 DialogNewAction() 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)
@@ -260,12 +73,12 @@ func DialogNewAction() templ.Component {
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
templ_7745c5c3_Var2 := templ.GetChildren(ctx)
if templ_7745c5c3_Var2 == nil {
templ_7745c5c3_Var2 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div><button type=\"button\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4\" data-dismiss=\"modal\">Batal\r</button> <button type=\"submit\" class=\"btn btn-primary btn-shadow font-weight-bold rounded-lg\">Save changes\r</button></div>")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div><button type=\"button\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4\" data-dismiss=\"modal\">Batal\r</button> <button type=\"button\" class=\"btn btn-primary btn-shadow font-weight-bold rounded-lg\">Save changes\r</button></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -284,9 +97,9 @@ func BtnCloseNew() templ.Component {
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
templ_7745c5c3_Var3 := templ.GetChildren(ctx)
if templ_7745c5c3_Var3 == nil {
templ_7745c5c3_Var3 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><i aria-hidden=\"true\" class=\"ki ki-close\"></i></button>")
@@ -299,79 +112,3 @@ func BtnCloseNew() templ.Component {
return templ_7745c5c3_Err
})
}
func BtnCloseNewV1(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.RenderScriptItems(ctx, templ_7745c5c3_Buffer, HandleJSModalAddUG(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_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(LinkClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\modaladdusergroup.templ`, Line: 116, Col: 21}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
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_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(targetClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\modaladdusergroup.templ`, Line: 117, Col: 25}
}
_, 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-swap=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapClose)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mastermenuusergroup\modaladdusergroup.templ`, Line: 118, Col: 23}
}
_, 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("\" type=\"button\" hx-on::after-request=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var16 templ.ComponentScript = HandleJSModalAddUG(modalID)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var16.Call)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"close btnaddact\" 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
})
}

View File

@@ -152,6 +152,25 @@ templ JSkuV1() {
</script>
}
templ PaginationV1() {
<div class="d-flex justify-content-between align-items-center flex-wrap">
<div class="d-flex flex-wrap py-2 mr-3">
<a href="#" class="btn btn-icon btn-sm btn-light mr-2 my-1"><i class="ki ki-bold-double-arrow-back icon-xs"></i></a>
<a href="#" class="btn btn-icon btn-sm btn-light mr-2 my-1"><i class="ki ki-bold-arrow-back icon-xs"></i></a>
<a href="#" class="btn btn-icon btn-sm border-0 btn-light mr-2 my-1">...</a>
<a href="#" class="btn btn-icon btn-sm border-0 btn-light mr-2 my-1">23</a>
<a href="#" class="btn btn-icon btn-sm border-0 btn-light btn-hover-primary active mr-2 my-1">24</a>
<a href="#" class="btn btn-icon btn-sm border-0 btn-light mr-2 my-1">25</a>
<a href="#" class="btn btn-icon btn-sm border-0 btn-light mr-2 my-1">26</a>
<a href="#" class="btn btn-icon btn-sm border-0 btn-light mr-2 my-1">27</a>
<a href="#" class="btn btn-icon btn-sm border-0 btn-light mr-2 my-1">28</a>
<a href="#" class="btn btn-icon btn-sm border-0 btn-light mr-2 my-1">...</a>
<a href="#" class="btn btn-icon btn-sm btn-light mr-2 my-1"><i class="ki ki-bold-arrow-next icon-xs"></i></a>
<a href="#" class="btn btn-icon btn-sm btn-light mr-2 my-1"><i class="ki ki-bold-double-arrow-next icon-xs"></i></a>
</div>
</div>
}
templ CssMasterMenuUserGroupV1x() {
<link
rel="stylesheet"
@@ -192,8 +211,10 @@ templ JsMasterMenuUserGroupV1x() {
templ ShowMasterMenuUserGroupV1x(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) {
userprofile templ.Component,
) {
@layout.CorporateLayout(title, css, js, navbarmenu, navbaruser, userprofile,
) {
@cmp
}
}

View File

@@ -252,7 +252,7 @@ func JSkuV1() templ.Component {
})
}
func CssMasterMenuUserGroupV1x() templ.Component {
func PaginationV1() 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 {
@@ -265,6 +265,30 @@ func CssMasterMenuUserGroupV1x() templ.Component {
templ_7745c5c3_Var10 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"d-flex justify-content-between align-items-center flex-wrap\"><div class=\"d-flex flex-wrap py-2 mr-3\"><a href=\"#\" class=\"btn btn-icon btn-sm btn-light mr-2 my-1\"><i class=\"ki ki-bold-double-arrow-back icon-xs\"></i></a> <a href=\"#\" class=\"btn btn-icon btn-sm btn-light mr-2 my-1\"><i class=\"ki ki-bold-arrow-back icon-xs\"></i></a> <a href=\"#\" class=\"btn btn-icon btn-sm border-0 btn-light mr-2 my-1\">...</a> <a href=\"#\" class=\"btn btn-icon btn-sm border-0 btn-light mr-2 my-1\">23</a> <a href=\"#\" class=\"btn btn-icon btn-sm border-0 btn-light btn-hover-primary active mr-2 my-1\">24</a> <a href=\"#\" class=\"btn btn-icon btn-sm border-0 btn-light mr-2 my-1\">25</a> <a href=\"#\" class=\"btn btn-icon btn-sm border-0 btn-light mr-2 my-1\">26</a> <a href=\"#\" class=\"btn btn-icon btn-sm border-0 btn-light mr-2 my-1\">27</a> <a href=\"#\" class=\"btn btn-icon btn-sm border-0 btn-light mr-2 my-1\">28</a> <a href=\"#\" class=\"btn btn-icon btn-sm border-0 btn-light mr-2 my-1\">...</a> <a href=\"#\" class=\"btn btn-icon btn-sm btn-light mr-2 my-1\"><i class=\"ki ki-bold-arrow-next icon-xs\"></i></a> <a href=\"#\" class=\"btn btn-icon btn-sm btn-light mr-2 my-1\"><i class=\"ki ki-bold-double-arrow-next icon-xs\"></i></a></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 CssMasterMenuUserGroupV1x() 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 #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 \r\n</style>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
@@ -284,9 +308,9 @@ func JsMasterMenuUserGroupV1x() templ.Component {
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
templ_7745c5c3_Var12 := templ.GetChildren(ctx)
if templ_7745c5c3_Var12 == nil {
templ_7745c5c3_Var12 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
if !templ_7745c5c3_IsBuffer {
@@ -299,7 +323,8 @@ func JsMasterMenuUserGroupV1x() templ.Component {
func ShowMasterMenuUserGroupV1x(title string, cmp templ.Component, css templ.Component, js templ.Component,
navbarmenu templ.Component,
navbaruser templ.Component,
userprofile templ.Component) 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 {
@@ -307,12 +332,12 @@ func ShowMasterMenuUserGroupV1x(title string, cmp templ.Component, css templ.Com
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
templ_7745c5c3_Var13 := templ.GetChildren(ctx)
if templ_7745c5c3_Var13 == nil {
templ_7745c5c3_Var13 = 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_Var14 := 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()
@@ -327,7 +352,7 @@ func ShowMasterMenuUserGroupV1x(title string, cmp templ.Component, css templ.Com
}
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)
templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, navbarmenu, navbaruser, userprofile).Render(templ.WithChildren(ctx, templ_7745c5c3_Var14), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}

View File

@@ -1,237 +0,0 @@
package dev_mdgroupresultview
import (
"cpone/layout"
"cpone/component/customtextfield"
"cpone/models"
"strconv"
)
templ MdGroupResultScreen(
tableID string,
paginationID string,
searchID string,
dialogAddID string,
dialogAddBodyID string,
dialogEditID string,
dialogEditBodyID string,
dialogDeleteID string,
dialogDeleteBodyID string,
breadcrumb templ.Component,
tablecontent templ.Component,
filterComponent templ.Component,
paginationComponent templ.Component,
modalAddForm templ.Component,
modalEditForm templ.Component,
modalDeleteForm templ.Component) {
<div class="container-fluid">
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "tableID",
Name: "tableID",
Type: "hidden",
Value: tableID})
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "paginationID",
Name: "paginationID",
Type: "hidden",
Value: paginationID})
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "searchID",
Name: "searchID",
Type: "hidden",
Value: searchID})
@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})
<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>
@filterComponent
<div id="loading-parent" class=" rounded">
@tablecontent
@paginationComponent
@modalAddForm
@modalEditForm
@modalDeleteForm
<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>
</div>
}
// for item dropdown
templ ItemDropdown(dataDropdown []models.GroupResultResumeMcu, selectedId int) {
if len(dataDropdown) == 0 {
<option value="0" disabled selected>Tidak Ada Data</option>
} else {
for _, v := range dataDropdown {
if (selectedId == v.ID) {
<option value={ strconv.Itoa(v.ID) } selected>{ v.Text }</option>
} else {
<option value={ strconv.Itoa(v.ID) }>{ v.Text }</option>
}
}
}
}
// for empty div
templ EmptyDiv1() {
<div></div>
}
templ CssMdGroupResult() {
<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; */
}
#div-chart {
/* overflow-x: scroll; */
margin: 40px 10vw 40px 10vw;
}
.title {
font-size:20px;
font-weight: bold;
}
#title {
font-weight: 600;
}
.dropdown-menu{
transform: translate3d(0px, 35px, 0px)!important;
}
</style>
}
templ JsMdGroupResult() {
<script>
function onLoadingStart() {
// 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");
// Additional logic when loading starts
}
function onLoadingEnd() {
console.log('Loading ended');
// 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");
}
document.addEventListener('htmx:beforeRequest', function(event) {
var indicator = document.querySelector('#loadingcontent');
console.log(event.detail.xhr)
console.log(event.detail.elt)
if (indicator) {
onLoadingStart();
}
});
document.addEventListener('htmx:afterRequest', function(event) {
var indicator = document.querySelector('#loadingcontent');
if (indicator) {
onLoadingEnd();
}
});
</script>
}
script BeforeRequestContentMdGroupResult() {
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 AfterRequestContentMdGroupResult() {
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 ShowMdGroupResultScreen(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
}
}

View File

@@ -1,433 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package dev_mdgroupresultview
//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/customtextfield"
"cpone/layout"
"cpone/models"
"strconv"
)
func MdGroupResultScreen(
tableID string,
paginationID string,
searchID string,
dialogAddID string,
dialogAddBodyID string,
dialogEditID string,
dialogEditBodyID string,
dialogDeleteID string,
dialogDeleteBodyID string,
breadcrumb templ.Component,
tablecontent templ.Component,
filterComponent templ.Component,
paginationComponent templ.Component,
modalAddForm templ.Component,
modalEditForm templ.Component,
modalDeleteForm 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: "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 = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "searchID",
Name: "searchID",
Type: "hidden",
Value: searchID}).Render(ctx, templ_7745c5c3_Buffer)
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 = 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\mdgroupresult\mdgroupresult.templ`, Line: 75, 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\mdgroupresult\mdgroupresult.templ`, Line: 84, 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>")
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 = templ_7745c5c3_Buffer.WriteString("<div id=\"loading-parent\" class=\" rounded\">")
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 = paginationComponent.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = modalAddForm.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = modalEditForm.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = modalDeleteForm.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></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
})
}
// for item dropdown
func ItemDropdown(dataDropdown []models.GroupResultResumeMcu, selectedId 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_Var4 := templ.GetChildren(ctx)
if templ_7745c5c3_Var4 == nil {
templ_7745c5c3_Var4 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
if len(dataDropdown) == 0 {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<option value=\"0\" disabled selected>Tidak Ada Data</option>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
for _, v := range dataDropdown {
if selectedId == v.ID {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<option value=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(v.ID))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresult.templ`, Line: 113, Col: 38}
}
_, 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("\" selected>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(v.Text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresult.templ`, Line: 113, Col: 58}
}
_, 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("</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_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(v.ID))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresult.templ`, Line: 115, Col: 38}
}
_, 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.Text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresult.templ`, Line: 115, 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("</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
})
}
// for empty div
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_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></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 CssMdGroupResult() 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)
_, 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>")
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 JsMdGroupResult() 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("<script>\r\n function onLoadingStart() {\r\n // const loadingParent = document.getElementById(\"loading-parent\");\r\n\t\t\t// const loadingChild = document.getElementById(\"loading-child\");\r\n\t\t\t// const loadingSpinner = document.getElementById(\"loading-spinner\");\r\n\r\n\t\t\t// loadingParent.classList.add(\"overlay\");\r\n\t\t\t// loadingParent.classList.add(\"overlay-block\");\r\n\t\t\t// loadingChild.classList.add(\"overlay-layer\");\r\n\t\t\t// loadingSpinner.classList.remove(\"d-none\");\r\n\r\n // Additional logic when loading starts\r\n }\r\n\r\n function onLoadingEnd() {\r\n console.log('Loading ended');\r\n // const loadingParent = document.getElementById(\"loading-parent\");\r\n\t\t\t// const loadingChild = document.getElementById(\"loading-child\");\r\n\t\t\t// const loadingSpinner = document.getElementById(\"loading-spinner\");\r\n\r\n\t\t\t// loadingParent.classList.remove(\"overlay\");\r\n\t\t\t// loadingParent.classList.remove(\"overlay-block\");\r\n\t\t\t// loadingChild.classList.remove(\"overlay-layer\");\r\n\t\t\t// loadingSpinner.classList.add(\"d-none\");\r\n }\r\n\r\n document.addEventListener('htmx:beforeRequest', function(event) {\r\n var indicator = document.querySelector('#loadingcontent');\r\n\t\t\tconsole.log(event.detail.xhr)\r\n\t\t\tconsole.log(event.detail.elt)\r\n if (indicator) {\r\n onLoadingStart();\r\n }\r\n });\r\n\r\n document.addEventListener('htmx:afterRequest', function(event) {\r\n var indicator = document.querySelector('#loadingcontent');\r\n if (indicator) {\r\n onLoadingEnd();\r\n }\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 BeforeRequestContentMdGroupResult() templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_BeforeRequestContentMdGroupResult_911f`,
Function: `function __templ_BeforeRequestContentMdGroupResult_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_BeforeRequestContentMdGroupResult_911f`),
CallInline: templ.SafeScriptInline(`__templ_BeforeRequestContentMdGroupResult_911f`),
}
}
func AfterRequestContentMdGroupResult() templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_AfterRequestContentMdGroupResult_6cc0`,
Function: `function __templ_AfterRequestContentMdGroupResult_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_AfterRequestContentMdGroupResult_6cc0`),
CallInline: templ.SafeScriptInline(`__templ_AfterRequestContentMdGroupResult_6cc0`),
}
}
func ShowMdGroupResultScreen(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
})
}

View File

@@ -1,203 +0,0 @@
package dev_mdgroupresultview
import "cpone/models"
import "cpone/component/modal"
import "cpone/component/customtextfield"
import "cpone/component/customcheckbox"
import "cpone/component/customdropdown"
templ GroupResultForm(data models.GroupResultFormComponent) {
<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 BodyFormGroupResult(inputId models.CustomTextFieldv2Prm,
inputGrName models.CustomTextFieldv2Prm,
checkboxGrFlagPerTest models.CustomCheckboxv1Prm,
checkboxGrFlagNonLab models.CustomCheckboxv1Prm,
dropdownGrResumeMcu models.CustomDropdownv1Prm,
listItem templ.Component,
componentID string,
hxOnLoad templ.ComponentScript) {
<div id={ componentID } hx-on::load={ hxOnLoad }>
@customtextfield.CustomTextFieldv2(
inputId)
@customtextfield.CustomTextFieldv2(
inputGrName)
@customcheckbox.MainCustomCheckboxInput(
checkboxGrFlagPerTest)
@customcheckbox.MainCustomCheckboxInput(
checkboxGrFlagNonLab)
@customdropdown.MainCustomDropdownInput(
dropdownGrResumeMcu,
listItem)
</div>
<script>
document.addEventListener('htmx:afterSwap', function(event) {
// Reinitialize selectpicker after HTMX content swap
$('.selectpicker').selectpicker('refresh');
});
</script>
}
script JsHideModalGroupResult(modalID string) {
$(modalID).modal('hide')
}
script JsShowModalGroupResult(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 ActionFormGroupResult(LinkClose string, targetClose string, hxSwapClose string, modalID string) {
<div>
<button
hx-on::after-request={ JsHideModalGroupResult(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 BtnCloseFormGroupResult(LinkClose string, targetClose string, hxSwapClose string, modalID string) {
<button
hx-post={ LinkClose }
hx-target={ targetClose }
hx-swap={ hxSwapClose }
type="button"
hx-on::after-request={ JsHideModalGroupResult(modalID) }
class="close btnactcancel"
data-dismiss="modal"
aria-label="Close"
>
<i aria-hidden="true" class="ki ki-close"></i>
</button>
}
templ DeleteConfirmationBodyGroupResult(inputId models.CustomTextFieldv2Prm,
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(inputId)
</div>
}
templ ActionFormGroupResultDelete(LinkClose string, targetClose string, hxSwapClose string, modalID string) {
<div>
<button
hx-on::after-request={ JsHideModalGroupResult(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>
}

View File

@@ -1,665 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package dev_mdgroupresultview
//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/customcheckbox"
import "cpone/component/customdropdown"
func GroupResultForm(data models.GroupResultFormComponent) 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\mdgroupresult\mdgroupresultformmodal.templ`, Line: 12, 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\mdgroupresult\mdgroupresultformmodal.templ`, Line: 13, 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\mdgroupresult\mdgroupresultformmodal.templ`, Line: 15, 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\mdgroupresult\mdgroupresultformmodal.templ`, Line: 16, 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\mdgroupresult\mdgroupresultformmodal.templ`, Line: 17, 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 BodyFormGroupResult(inputId models.CustomTextFieldv2Prm,
inputGrName models.CustomTextFieldv2Prm,
checkboxGrFlagPerTest models.CustomCheckboxv1Prm,
checkboxGrFlagNonLab models.CustomCheckboxv1Prm,
dropdownGrResumeMcu models.CustomDropdownv1Prm,
listItem templ.Component,
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\mdgroupresult\mdgroupresultformmodal.templ`, Line: 71, 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(
inputId).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(
inputGrName).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = customcheckbox.MainCustomCheckboxInput(
checkboxGrFlagPerTest).Render(ctx, templ_7745c5c3_Buffer)
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 = customdropdown.MainCustomDropdownInput(
dropdownGrResumeMcu,
listItem).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div><script>\r\n document.addEventListener('htmx:afterSwap', function(event) {\r\n // Reinitialize selectpicker after HTMX content swap\r\n $('.selectpicker').selectpicker('refresh');\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 JsHideModalGroupResult(modalID string) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_JsHideModalGroupResult_da6c`,
Function: `function __templ_JsHideModalGroupResult_da6c(modalID){$(modalID).modal('hide')
}`,
Call: templ.SafeScript(`__templ_JsHideModalGroupResult_da6c`, modalID),
CallInline: templ.SafeScriptInline(`__templ_JsHideModalGroupResult_da6c`, modalID),
}
}
func JsShowModalGroupResult(modalID string) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_JsShowModalGroupResult_b74d`,
Function: `function __templ_JsShowModalGroupResult_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_JsShowModalGroupResult_b74d`, modalID),
CallInline: templ.SafeScriptInline(`__templ_JsShowModalGroupResult_b74d`, modalID),
}
}
func ActionFormGroupResult(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, JsHideModalGroupResult(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 = JsHideModalGroupResult(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\mdgroupresult\mdgroupresultformmodal.templ`, Line: 116, 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\mdgroupresult\mdgroupresultformmodal.templ`, Line: 117, 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\mdgroupresult\mdgroupresultformmodal.templ`, Line: 118, 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 BtnCloseFormGroupResult(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, JsHideModalGroupResult(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\mdgroupresult\mdgroupresultformmodal.templ`, Line: 139, 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\mdgroupresult\mdgroupresultformmodal.templ`, Line: 140, 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\mdgroupresult\mdgroupresultformmodal.templ`, Line: 141, 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 = JsHideModalGroupResult(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 DeleteConfirmationBodyGroupResult(inputId models.CustomTextFieldv2Prm,
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\mdgroupresult\mdgroupresultformmodal.templ`, Line: 158, 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\mdgroupresult\mdgroupresultformmodal.templ`, Line: 159, 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\mdgroupresult\mdgroupresultformmodal.templ`, Line: 164, 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\mdgroupresult\mdgroupresultformmodal.templ`, Line: 170, 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(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 ActionFormGroupResultDelete(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, JsHideModalGroupResult(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 = JsHideModalGroupResult(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\mdgroupresult\mdgroupresultformmodal.templ`, Line: 184, 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\mdgroupresult\mdgroupresultformmodal.templ`, Line: 185, 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\mdgroupresult\mdgroupresultformmodal.templ`, Line: 186, 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
})
}

View File

@@ -1,131 +0,0 @@
package dev_mdgroupresultview
import "cpone/component/table"
import "cpone/models"
import "strconv"
templ TableGroupResult(data []models.GroupResult,
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{"GROUP RESULT NAME", "RESULT FLAG PER TEST", "RESULT FLAG NON LAB", "RESULT RESUME MCU", "AKSI"},
[]string{"20%", "20%", "20%", "20%", "20%"},
RowGroupResult(data,
hxGetEdit,
hxTargetEdit,
hxSwapEdit,
hxIncludeEdit,
hxGetDelete,
hxTargetDelete,
hxSwapDelete,
hxIncludeDelete,
))
</div>
}
templ RowGroupResult(data []models.GroupResult,
hxGetEdit string,
hxTargetEdit string,
hxSwapEdit string,
hxIncludeEdit string,
hxGetDelete string,
hxTargetDelete string,
hxSwapDelete string,
hxIncludeDelete string,
) {
if len(data) == 0 {
<tr>
<td colspan="3" class="text-center">Data Tidak Ditemukan</td>
</tr>
}
for _, v := range data {
<tr>
<td>{ v.Group_ResultName }</td>
<td>{ v.Group_ResultFlagPerTest }</td>
<td>{ v.Group_ResultFlagNonLab }</td>
<td>{ v.Group_ResultResumeMcu }</td>
<td>
@TableAction(v.Group_ResultID,
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="btnactiongr 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=" btnactiongr 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('btnactiongr');
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('btnactiongr');
for (var i = 0; i < cusid_ele.length; ++i) {
var item = cusid_ele[i];
item.classList.remove('disabled');
}
console.log(id)
}

View File

@@ -1,464 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package dev_mdgroupresultview
//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 TableGroupResult(data []models.GroupResult,
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\mdgroupresult\mdgroupresulttable.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{"GROUP RESULT NAME", "RESULT FLAG PER TEST", "RESULT FLAG NON LAB", "RESULT RESUME MCU", "AKSI"},
[]string{"20%", "20%", "20%", "20%", "20%"},
RowGroupResult(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 RowGroupResult(data []models.GroupResult,
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=\"3\" 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.Group_ResultName)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresulttable.templ`, Line: 51, Col: 27}
}
_, 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.Group_ResultFlagPerTest)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresulttable.templ`, Line: 52, Col: 34}
}
_, 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.Group_ResultFlagNonLab)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresulttable.templ`, Line: 53, Col: 33}
}
_, 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
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(v.Group_ResultResumeMcu)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresulttable.templ`, Line: 54, Col: 32}
}
_, 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("</td><td>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = TableAction(v.Group_ResultID,
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_Var8 := templ.GetChildren(ctx)
if templ_7745c5c3_Var8 == nil {
templ_7745c5c3_Var8 = 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=\"btnactiongr 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_Var9 string
templ_7745c5c3_Var9, 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\mdgroupresult\mdgroupresulttable.templ`, Line: 87, Col: 49}
}
_, 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-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetEdit)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresulttable.templ`, Line: 88, Col: 27}
}
_, 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(hxSwapEdit)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresulttable.templ`, Line: 89, Col: 23}
}
_, 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-include=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(hxIncludeEdit)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresulttable.templ`, Line: 90, Col: 29}
}
_, 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-indicator=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs("#spnredt" + strconv.Itoa(id))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresulttable.templ`, Line: 91, Col: 47}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
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_Var14 templ.ComponentScript = HandleBeforeRequestRow(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("\" hx-on::after-request=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var15 templ.ComponentScript = HandleAfterRequestRow(strconv.Itoa(id))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var15.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_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs("spnredt" + strconv.Itoa(id))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresulttable.templ`, Line: 95, Col: 42}
}
_, 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("\" 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=\" btnactiongr 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_Var17 string
templ_7745c5c3_Var17, 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\mdgroupresult\mdgroupresulttable.templ`, Line: 101, Col: 51}
}
_, 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-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var18 string
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresulttable.templ`, Line: 102, Col: 29}
}
_, 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-swap=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var19 string
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresulttable.templ`, Line: 103, 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-include=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var20 string
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(hxIncludeDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresulttable.templ`, Line: 104, Col: 31}
}
_, 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-indicator=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var21 string
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs("#spnrdel" + strconv.Itoa(id))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresulttable.templ`, Line: 105, Col: 47}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
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_Var22 templ.ComponentScript = HandleBeforeRequestRow(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("\" hx-on::after-request=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var23 templ.ComponentScript = HandleAfterRequestRow(strconv.Itoa(id))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var23.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_Var24 string
templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs("spnrdel" + strconv.Itoa(id))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdgroupresult\mdgroupresulttable.templ`, Line: 109, Col: 42}
}
_, 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("\" 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_8869`,
Function: `function __templ_HandleBeforeRequestRow_8869(id){var cusid_ele = document.getElementsByClassName('btnactiongr');
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_8869`, id),
CallInline: templ.SafeScriptInline(`__templ_HandleBeforeRequestRow_8869`, id),
}
}
func HandleAfterRequestRow(id string) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_HandleAfterRequestRow_ef01`,
Function: `function __templ_HandleAfterRequestRow_ef01(id){var cusid_ele = document.getElementsByClassName('btnactiongr');
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_ef01`, id),
CallInline: templ.SafeScriptInline(`__templ_HandleAfterRequestRow_ef01`, id),
}
}

View File

@@ -1,212 +0,0 @@
package dev_mdnatunitview
import (
"cpone/layout"
"cpone/component/customtextfield"
"cpone/models"
)
templ MdNatUnitScreen(
tableID string,
paginationID string,
searchID string,
dialogAddID string,
dialogAddBodyID string,
dialogEditID string,
dialogEditBodyID string,
dialogDeleteID string,
dialogDeleteBodyID string,
breadcrumb templ.Component,
tablecontent templ.Component,
filterComponent templ.Component,
paginationComponent templ.Component,
modalAddForm templ.Component,
modalEditForm templ.Component,
modalDeleteForm templ.Component) {
<div class="container-fluid">
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "tableID",
Name: "tableID",
Type: "hidden",
Value: tableID})
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "paginationID",
Name: "paginationID",
Type: "hidden",
Value: paginationID})
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "searchID",
Name: "searchID",
Type: "hidden",
Value: searchID})
@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})
<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>
@filterComponent
<div id="loading-parent" class=" rounded">
@tablecontent
@paginationComponent
@modalAddForm
@modalEditForm
@modalDeleteForm
<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>
</div>
}
templ CssMdNatUnit() {
<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; */
}
#div-chart {
/* overflow-x: scroll; */
margin: 40px 10vw 40px 10vw;
}
.title {
font-size:20px;
font-weight: bold;
}
#title {
font-weight: 600;
}
</style>
}
templ JsMdNatUnit() {
<script>
function onLoadingStart() {
// 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");
// Additional logic when loading starts
}
function onLoadingEnd() {
console.log('Loading ended');
// 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");
}
document.addEventListener('htmx:beforeRequest', function(event) {
var indicator = document.querySelector('#loadingcontent');
console.log(event.detail.xhr)
console.log(event.detail.elt)
if (indicator) {
onLoadingStart();
}
});
document.addEventListener('htmx:afterRequest', function(event) {
var indicator = document.querySelector('#loadingcontent');
if (indicator) {
onLoadingEnd();
}
});
</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 ShowMdNatUnitScreen(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
}
}

View File

@@ -1,314 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package dev_mdnatunitview
//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/customtextfield"
"cpone/layout"
"cpone/models"
)
func MdNatUnitScreen(
tableID string,
paginationID string,
searchID string,
dialogAddID string,
dialogAddBodyID string,
dialogEditID string,
dialogEditBodyID string,
dialogDeleteID string,
dialogDeleteBodyID string,
breadcrumb templ.Component,
tablecontent templ.Component,
filterComponent templ.Component,
paginationComponent templ.Component,
modalAddForm templ.Component,
modalEditForm templ.Component,
modalDeleteForm 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: "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 = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "searchID",
Name: "searchID",
Type: "hidden",
Value: searchID}).Render(ctx, templ_7745c5c3_Buffer)
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 = 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\mdnatunit\mdnatunit.templ`, Line: 74, 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\mdnatunit\mdnatunit.templ`, Line: 83, 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>")
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 = templ_7745c5c3_Buffer.WriteString("<div id=\"loading-parent\" class=\" rounded\">")
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 = paginationComponent.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = modalAddForm.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = modalEditForm.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = modalDeleteForm.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></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 CssMdNatUnit() 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)
_, 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 </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 JsMdNatUnit() 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 function onLoadingStart() {\r\n // const loadingParent = document.getElementById(\"loading-parent\");\r\n\t\t\t// const loadingChild = document.getElementById(\"loading-child\");\r\n\t\t\t// const loadingSpinner = document.getElementById(\"loading-spinner\");\r\n\r\n\t\t\t// loadingParent.classList.add(\"overlay\");\r\n\t\t\t// loadingParent.classList.add(\"overlay-block\");\r\n\t\t\t// loadingChild.classList.add(\"overlay-layer\");\r\n\t\t\t// loadingSpinner.classList.remove(\"d-none\");\r\n\r\n // Additional logic when loading starts\r\n }\r\n\r\n function onLoadingEnd() {\r\n console.log('Loading ended');\r\n // const loadingParent = document.getElementById(\"loading-parent\");\r\n\t\t\t// const loadingChild = document.getElementById(\"loading-child\");\r\n\t\t\t// const loadingSpinner = document.getElementById(\"loading-spinner\");\r\n\r\n\t\t\t// loadingParent.classList.remove(\"overlay\");\r\n\t\t\t// loadingParent.classList.remove(\"overlay-block\");\r\n\t\t\t// loadingChild.classList.remove(\"overlay-layer\");\r\n\t\t\t// loadingSpinner.classList.add(\"d-none\");\r\n }\r\n\r\n document.addEventListener('htmx:beforeRequest', function(event) {\r\n var indicator = document.querySelector('#loadingcontent');\r\n\t\t\tconsole.log(event.detail.xhr)\r\n\t\t\tconsole.log(event.detail.elt)\r\n if (indicator) {\r\n onLoadingStart();\r\n }\r\n });\r\n\r\n document.addEventListener('htmx:afterRequest', function(event) {\r\n var indicator = document.querySelector('#loadingcontent');\r\n if (indicator) {\r\n onLoadingEnd();\r\n }\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 ShowMdNatUnitScreen(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_Var6 := templ.GetChildren(ctx)
if templ_7745c5c3_Var6 == nil {
templ_7745c5c3_Var6 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var7 := 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_Var7), 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
})
}

View File

@@ -1,187 +0,0 @@
package dev_mdnatunitview
import "cpone/models"
import "cpone/component/modal"
import "cpone/component/customtextfield"
templ NatUnitForm(data models.NatUnitFormComponent) {
<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 BodyFormNatUnit(inputId models.CustomTextFieldv2Prm,
inputCode models.CustomTextFieldv2Prm,
inputName models.CustomTextFieldv2Prm,
componentID string,
hxOnLoad templ.ComponentScript) {
<div id={ componentID } hx-on::load={ hxOnLoad }>
@customtextfield.CustomTextFieldv2(
inputId)
@customtextfield.CustomTextFieldv2(
inputCode)
@customtextfield.CustomTextFieldv2(
inputName)
</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 ActionFormNatUnit(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 BtnCloseFormNatUnit(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 models.CustomTextFieldv2Prm,
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(inputId)
</div>
}
templ ActionFormUserGroupDelete(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>
}

View File

@@ -1,649 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package dev_mdnatunitview
//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"
func NatUnitForm(data models.NatUnitFormComponent) 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\mdnatunit\mdnatunitformmodal.templ`, Line: 10, 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\mdnatunit\mdnatunitformmodal.templ`, Line: 11, 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\mdnatunit\mdnatunitformmodal.templ`, Line: 13, 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\mdnatunit\mdnatunitformmodal.templ`, Line: 14, 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\mdnatunit\mdnatunitformmodal.templ`, Line: 15, 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 BodyFormNatUnit(inputId models.CustomTextFieldv2Prm,
inputCode models.CustomTextFieldv2Prm,
inputName models.CustomTextFieldv2Prm,
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\mdnatunit\mdnatunitformmodal.templ`, Line: 66, 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(
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 = 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 ActionFormNatUnit(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\mdnatunit\mdnatunitformmodal.templ`, Line: 100, 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\mdnatunit\mdnatunitformmodal.templ`, Line: 101, 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\mdnatunit\mdnatunitformmodal.templ`, Line: 102, 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 BtnCloseFormNatUnit(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\mdnatunit\mdnatunitformmodal.templ`, Line: 123, 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\mdnatunit\mdnatunitformmodal.templ`, Line: 124, 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\mdnatunit\mdnatunitformmodal.templ`, Line: 125, 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 models.CustomTextFieldv2Prm,
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\mdnatunit\mdnatunitformmodal.templ`, Line: 142, 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\mdnatunit\mdnatunitformmodal.templ`, Line: 143, 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\mdnatunit\mdnatunitformmodal.templ`, Line: 148, 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\mdnatunit\mdnatunitformmodal.templ`, Line: 154, 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(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 ActionFormUserGroupDelete(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\mdnatunit\mdnatunitformmodal.templ`, Line: 168, 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\mdnatunit\mdnatunitformmodal.templ`, Line: 169, 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\mdnatunit\mdnatunitformmodal.templ`, Line: 170, 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
})
}

View File

@@ -1,130 +0,0 @@
package dev_mdnatunitview
import (
"cpone/component/table"
"cpone/models"
"strconv"
)
templ TableNatUnit(data []models.NatUnit,
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", "UNIT", "AKSI"},
[]string{"40%", "40%", "20%"},
RowNatUnit(data,
hxGetEdit,
hxTargetEdit,
hxSwapEdit,
hxIncludeEdit,
hxGetDelete,
hxTargetDelete,
hxSwapDelete,
hxIncludeDelete,
))
</div>
}
templ RowNatUnit(data []models.NatUnit,
hxGetEdit string,
hxTargetEdit string,
hxSwapEdit string,
hxIncludeEdit string,
hxGetDelete string,
hxTargetDelete string,
hxSwapDelete string,
hxIncludeDelete string,
) {
if len(data) == 0 {
<tr>
<td colspan="3" class="text-center">Data Tidak Ditemukan</td>
</tr>
}
for _, v := range data {
<tr>
<td>{ v.Nat_UnitCode }</td>
<td>{ v.Nat_UnitName }</td>
<td>
@TableAction(v.Nat_UnitID,
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="btnactionug 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=" btnactionug 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('btnactionug');
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('btnactionug');
for (var i = 0; i < cusid_ele.length; ++i) {
var item = cusid_ele[i];
item.classList.remove('disabled');
}
// console.log(id)
}

View File

@@ -1,439 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package dev_mdnatunitview
//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"
"cpone/models"
"strconv"
)
func TableNatUnit(data []models.NatUnit,
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\mdnatunit\mdnatunittable.templ`, Line: 20, 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", "UNIT", "AKSI"},
[]string{"40%", "40%", "20%"},
RowNatUnit(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 RowNatUnit(data []models.NatUnit,
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=\"3\" 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.Nat_UnitCode)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnatunit\mdnatunittable.templ`, Line: 53, Col: 23}
}
_, 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.Nat_UnitName)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnatunit\mdnatunittable.templ`, Line: 54, Col: 23}
}
_, 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
}
templ_7745c5c3_Err = TableAction(v.Nat_UnitID,
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_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=\"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=\"btnactionug 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_Var7 string
templ_7745c5c3_Var7, 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\mdnatunit\mdnatunittable.templ`, Line: 86, Col: 49}
}
_, 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-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetEdit)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnatunit\mdnatunittable.templ`, Line: 87, 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-swap=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapEdit)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnatunit\mdnatunittable.templ`, Line: 88, Col: 23}
}
_, 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-include=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(hxIncludeEdit)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnatunit\mdnatunittable.templ`, Line: 89, Col: 29}
}
_, 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-indicator=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs("#spnredt" + strconv.Itoa(id))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnatunit\mdnatunittable.templ`, Line: 90, Col: 47}
}
_, 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 = HandleBeforeRequestRow(strconv.Itoa(id))
_, 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 = HandleAfterRequestRow(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("\"><span id=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs("spnredt" + strconv.Itoa(id))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnatunit\mdnatunittable.templ`, Line: 94, Col: 42}
}
_, 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("\" 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=\" btnactionug 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_Var15 string
templ_7745c5c3_Var15, 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\mdnatunit\mdnatunittable.templ`, Line: 100, Col: 51}
}
_, 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-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnatunit\mdnatunittable.templ`, Line: 101, Col: 29}
}
_, 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-swap=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnatunit\mdnatunittable.templ`, Line: 102, Col: 25}
}
_, 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-include=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var18 string
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(hxIncludeDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnatunit\mdnatunittable.templ`, Line: 103, Col: 31}
}
_, 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-indicator=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var19 string
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs("#spnrdel" + strconv.Itoa(id))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnatunit\mdnatunittable.templ`, Line: 104, Col: 47}
}
_, 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-on::before-request=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var20 templ.ComponentScript = HandleBeforeRequestRow(strconv.Itoa(id))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var20.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_Var21 templ.ComponentScript = HandleAfterRequestRow(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("\"><span id=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var22 string
templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs("spnrdel" + strconv.Itoa(id))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdnatunit\mdnatunittable.templ`, Line: 108, Col: 42}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
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_9a4e`,
Function: `function __templ_HandleBeforeRequestRow_9a4e(id){var cusid_ele = document.getElementsByClassName('btnactionug');
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_9a4e`, id),
CallInline: templ.SafeScriptInline(`__templ_HandleBeforeRequestRow_9a4e`, id),
}
}
func HandleAfterRequestRow(id string) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_HandleAfterRequestRow_9e81`,
Function: `function __templ_HandleAfterRequestRow_9e81(id){var cusid_ele = document.getElementsByClassName('btnactionug');
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_9e81`, id),
CallInline: templ.SafeScriptInline(`__templ_HandleAfterRequestRow_9e81`, id),
}
}

View File

@@ -1,213 +0,0 @@
package dev_mdusergroupview
import (
"cpone/layout"
"cpone/component/customtextfield"
"cpone/models"
)
templ MdUserGroupScreen(
tableID string,
paginationID string,
searchID string,
dialogAddID string,
dialogAddBodyID string,
dialogEditID string,
dialogEditBodyID string,
dialogDeleteID string,
dialogDeleteBodyID string,
breadcrumb templ.Component,
tablecontent templ.Component,
filterComponent templ.Component,
paginationComponent templ.Component,
modalAddForm templ.Component,
modalEditForm templ.Component,
modalDeleteForm templ.Component) {
<div class="container-fluid">
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "tableID",
Name: "tableID",
Type: "hidden",
Value: tableID})
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "paginationID",
Name: "paginationID",
Type: "hidden",
Value: paginationID})
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "searchID",
Name: "searchID",
Type: "hidden",
Value: searchID})
@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})
<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>
@filterComponent
<div id="loading-parent" class=" rounded">
@tablecontent
@paginationComponent
@modalAddForm
@modalEditForm
@modalDeleteForm
<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>
</div>
}
templ CssMdUserGroup() {
<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; */
}
#div-chart {
/* overflow-x: scroll; */
margin: 40px 10vw 40px 10vw;
}
.title {
font-size:20px;
font-weight: bold;
}
#title {
font-weight: 600;
}
</style>
}
templ JsMdUserGroup() {
<script>
function onLoadingStart() {
// 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");
// Additional logic when loading starts
}
function onLoadingEnd() {
console.log('Loading ended');
// 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");
}
document.addEventListener('htmx:beforeRequest', function(event) {
var indicator = document.querySelector('#loadingcontent');
console.log(event.detail.xhr)
console.log(event.detail.elt)
if (indicator) {
onLoadingStart();
}
});
document.addEventListener('htmx:afterRequest', function(event) {
var indicator = document.querySelector('#loadingcontent');
if (indicator) {
onLoadingEnd();
}
});
</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 ShowMdUserGroupScreen(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
}
}

View File

@@ -1,314 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package dev_mdusergroupview
//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/customtextfield"
"cpone/layout"
"cpone/models"
)
func MdUserGroupScreen(
tableID string,
paginationID string,
searchID string,
dialogAddID string,
dialogAddBodyID string,
dialogEditID string,
dialogEditBodyID string,
dialogDeleteID string,
dialogDeleteBodyID string,
breadcrumb templ.Component,
tablecontent templ.Component,
filterComponent templ.Component,
paginationComponent templ.Component,
modalAddForm templ.Component,
modalEditForm templ.Component,
modalDeleteForm 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: "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 = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "searchID",
Name: "searchID",
Type: "hidden",
Value: searchID}).Render(ctx, templ_7745c5c3_Buffer)
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 = 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\mdusergroup\mdusergroup.templ`, Line: 74, 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\mdusergroup\mdusergroup.templ`, Line: 83, 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>")
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 = templ_7745c5c3_Buffer.WriteString("<div id=\"loading-parent\" class=\" rounded\">")
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 = paginationComponent.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = modalAddForm.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = modalEditForm.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = modalDeleteForm.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></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)
_, 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 \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 JsMdUserGroup() 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 function onLoadingStart() {\r\n // const loadingParent = document.getElementById(\"loading-parent\");\r\n\t\t\t// const loadingChild = document.getElementById(\"loading-child\");\r\n\t\t\t// const loadingSpinner = document.getElementById(\"loading-spinner\");\r\n\r\n\t\t\t// loadingParent.classList.add(\"overlay\");\r\n\t\t\t// loadingParent.classList.add(\"overlay-block\");\r\n\t\t\t// loadingChild.classList.add(\"overlay-layer\");\r\n\t\t\t// loadingSpinner.classList.remove(\"d-none\");\r\n\r\n // Additional logic when loading starts\r\n }\r\n\r\n function onLoadingEnd() {\r\n console.log('Loading ended');\r\n // const loadingParent = document.getElementById(\"loading-parent\");\r\n\t\t\t// const loadingChild = document.getElementById(\"loading-child\");\r\n\t\t\t// const loadingSpinner = document.getElementById(\"loading-spinner\");\r\n\r\n\t\t\t// loadingParent.classList.remove(\"overlay\");\r\n\t\t\t// loadingParent.classList.remove(\"overlay-block\");\r\n\t\t\t// loadingChild.classList.remove(\"overlay-layer\");\r\n\t\t\t// loadingSpinner.classList.add(\"d-none\");\r\n }\r\n\r\n document.addEventListener('htmx:beforeRequest', function(event) {\r\n var indicator = document.querySelector('#loadingcontent');\r\n\t\t\tconsole.log(event.detail.xhr)\r\n\t\t\tconsole.log(event.detail.elt)\r\n if (indicator) {\r\n onLoadingStart();\r\n }\r\n });\r\n\r\n document.addEventListener('htmx:afterRequest', function(event) {\r\n var indicator = document.querySelector('#loadingcontent');\r\n if (indicator) {\r\n onLoadingEnd();\r\n }\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 ShowMdUserGroupScreen(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_Var6 := templ.GetChildren(ctx)
if templ_7745c5c3_Var6 == nil {
templ_7745c5c3_Var6 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var7 := 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_Var7), 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
})
}

View File

@@ -1,187 +0,0 @@
package dev_mdusergroupview
import "cpone/models"
import "cpone/component/modal"
import "cpone/component/customtextfield"
templ UserGroupForm(data models.UserGroupFormComponent) {
<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 BodyFormUserGroup(inputId models.CustomTextFieldv2Prm,
inputCode models.CustomTextFieldv2Prm,
inputName models.CustomTextFieldv2Prm,
componentID string,
hxOnLoad templ.ComponentScript) {
<div id={ componentID } hx-on::load={ hxOnLoad }>
@customtextfield.CustomTextFieldv2(
inputId)
@customtextfield.CustomTextFieldv2(
inputCode)
@customtextfield.CustomTextFieldv2(
inputName)
</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 ActionFormUserGroup(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 BtnCloseFormUserGroup(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 models.CustomTextFieldv2Prm,
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(inputId)
</div>
}
templ ActionFormUserGroupDelete(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>
}

View File

@@ -1,649 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package dev_mdusergroupview
//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"
func UserGroupForm(data models.UserGroupFormComponent) 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\mdusergroup\mdusergroupformmodal.templ`, Line: 10, 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\mdusergroup\mdusergroupformmodal.templ`, Line: 11, 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\mdusergroup\mdusergroupformmodal.templ`, Line: 13, 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\mdusergroup\mdusergroupformmodal.templ`, Line: 14, 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\mdusergroup\mdusergroupformmodal.templ`, Line: 15, 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 BodyFormUserGroup(inputId models.CustomTextFieldv2Prm,
inputCode models.CustomTextFieldv2Prm,
inputName models.CustomTextFieldv2Prm,
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\mdusergroup\mdusergroupformmodal.templ`, Line: 66, 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(
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 = 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 ActionFormUserGroup(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\mdusergroup\mdusergroupformmodal.templ`, Line: 100, 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\mdusergroup\mdusergroupformmodal.templ`, Line: 101, 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\mdusergroup\mdusergroupformmodal.templ`, Line: 102, 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 BtnCloseFormUserGroup(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\mdusergroup\mdusergroupformmodal.templ`, Line: 123, 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\mdusergroup\mdusergroupformmodal.templ`, Line: 124, 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\mdusergroup\mdusergroupformmodal.templ`, Line: 125, 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 models.CustomTextFieldv2Prm,
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\mdusergroup\mdusergroupformmodal.templ`, Line: 142, 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\mdusergroup\mdusergroupformmodal.templ`, Line: 143, 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\mdusergroup\mdusergroupformmodal.templ`, Line: 148, 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\mdusergroup\mdusergroupformmodal.templ`, Line: 154, 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(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 ActionFormUserGroupDelete(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\mdusergroup\mdusergroupformmodal.templ`, Line: 168, 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\mdusergroup\mdusergroupformmodal.templ`, Line: 169, 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\mdusergroup\mdusergroupformmodal.templ`, Line: 170, 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
})
}

View File

@@ -1,129 +0,0 @@
package dev_mdusergroupview
import "cpone/component/table"
import "cpone/models"
import "strconv"
templ TableUserGroup(data []models.UserGroupV1,
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", "USERGROUP", "AKSI"},
[]string{"40%", "40%", "20%"},
RowUserGroup(data,
hxGetEdit,
hxTargetEdit,
hxSwapEdit,
hxIncludeEdit,
hxGetDelete,
hxTargetDelete,
hxSwapDelete,
hxIncludeDelete,
))
</div>
}
templ RowUserGroup(data []models.UserGroupV1,
hxGetEdit string,
hxTargetEdit string,
hxSwapEdit string,
hxIncludeEdit string,
hxGetDelete string,
hxTargetDelete string,
hxSwapDelete string,
hxIncludeDelete string,
) {
if len(data) == 0 {
<tr>
<td colspan="3" class="text-center">Data Tidak Ditemukan</td>
</tr>
}
for _, v := range data {
<tr>
<td>{ v.M_UserGroupCode }</td>
<td>{ v.M_UserGroupName }</td>
<td>
@TableAction(v.M_UserGroupID,
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="btnactionug 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=" btnactionug 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('btnactionug');
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('btnactionug');
for (var i = 0; i < cusid_ele.length; ++i) {
var item = cusid_ele[i];
item.classList.remove('disabled');
}
console.log(id)
}

View File

@@ -1,438 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package dev_mdusergroupview
//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 TableUserGroup(data []models.UserGroupV1,
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\mdusergroup\mdusergrouptable.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", "USERGROUP", "AKSI"},
[]string{"40%", "40%", "20%"},
RowUserGroup(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 RowUserGroup(data []models.UserGroupV1,
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=\"3\" 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.M_UserGroupCode)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergrouptable.templ`, Line: 51, Col: 26}
}
_, 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.M_UserGroupName)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergrouptable.templ`, Line: 52, Col: 26}
}
_, 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
}
templ_7745c5c3_Err = TableAction(v.M_UserGroupID,
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_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=\"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=\"btnactionug 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_Var7 string
templ_7745c5c3_Var7, 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\mdusergroup\mdusergrouptable.templ`, Line: 85, Col: 49}
}
_, 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-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetEdit)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergrouptable.templ`, Line: 86, 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-swap=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapEdit)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergrouptable.templ`, Line: 87, Col: 23}
}
_, 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-include=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(hxIncludeEdit)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergrouptable.templ`, Line: 88, Col: 29}
}
_, 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-indicator=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs("#spnredt" + strconv.Itoa(id))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergrouptable.templ`, Line: 89, Col: 47}
}
_, 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 = HandleBeforeRequestRow(strconv.Itoa(id))
_, 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 = HandleAfterRequestRow(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("\"><span id=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs("spnredt" + strconv.Itoa(id))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergrouptable.templ`, Line: 93, Col: 42}
}
_, 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("\" 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=\" btnactionug 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_Var15 string
templ_7745c5c3_Var15, 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\mdusergroup\mdusergrouptable.templ`, Line: 99, Col: 51}
}
_, 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-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(hxTargetDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergrouptable.templ`, Line: 100, Col: 29}
}
_, 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-swap=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(hxSwapDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergrouptable.templ`, Line: 101, Col: 25}
}
_, 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-include=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var18 string
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(hxIncludeDelete)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergrouptable.templ`, Line: 102, Col: 31}
}
_, 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-indicator=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var19 string
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs("#spnrdel" + strconv.Itoa(id))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergrouptable.templ`, Line: 103, Col: 47}
}
_, 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-on::before-request=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var20 templ.ComponentScript = HandleBeforeRequestRow(strconv.Itoa(id))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var20.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_Var21 templ.ComponentScript = HandleAfterRequestRow(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("\"><span id=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var22 string
templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs("spnrdel" + strconv.Itoa(id))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\mdusergroup\mdusergrouptable.templ`, Line: 107, Col: 42}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
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_ee28`,
Function: `function __templ_HandleBeforeRequestRow_ee28(id){var cusid_ele = document.getElementsByClassName('btnactionug');
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_ee28`, id),
CallInline: templ.SafeScriptInline(`__templ_HandleBeforeRequestRow_ee28`, id),
}
}
func HandleAfterRequestRow(id string) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_HandleAfterRequestRow_2a96`,
Function: `function __templ_HandleAfterRequestRow_2a96(id){var cusid_ele = document.getElementsByClassName('btnactionug');
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_2a96`, id),
CallInline: templ.SafeScriptInline(`__templ_HandleAfterRequestRow_2a96`, id),
}
}

View File

@@ -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
}
}

View File

@@ -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=&#39;selectedvalue&#39;]\" 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
})
}

View File

@@ -1,35 +0,0 @@
package xtemplmulti
import "cpone/models"
func stringToTemplComp(textAll string) templ.Component {
return templ.ComponentFunc(func(ctx context.Context, w io.Writer) error {
_, err := io.WriteString(w, textAll)
return err
})
}
templ MainXTemplMulti(arrString []models.XtemplModel) {
<div id="dataMhs" style="margin-bottom: 20px">
<table>
<tr>
<td>Jarot</td>
</tr>
</table>
</div>
<div id="dataGuru" style="margin-bottom: 20px">
<table>
<tr>
<td>Desy</td>
</tr>
</table>
</div>
for _, v := range arrString {
{ v.NameTempl }
{ v.HtmlString }
@stringToTemplComp(v.HtmlString)
}
}

View File

@@ -1,72 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package xtemplmulti
//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 stringToTemplComp(textAll string) templ.Component {
return templ.ComponentFunc(func(ctx context.Context, w io.Writer) error {
_, err := io.WriteString(w, textAll)
return err
})
}
func MainXTemplMulti(arrString []models.XtemplModel) 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=\"dataMhs\" style=\"margin-bottom: 20px\"><table><tr><td>Jarot</td></tr></table></div><div id=\"dataGuru\" style=\"margin-bottom: 20px\"><table><tr><td>Desy</td></tr></table></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, v := range arrString {
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(v.NameTempl)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\xtemplmulti\xtemplmulti.templ`, Line: 29, Col: 21}
}
_, 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(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(v.HtmlString)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\xtemplmulti\xtemplmulti.templ`, Line: 30, 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 = stringToTemplComp(v.HtmlString).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
})
}

Some files were not shown because too many files have changed in this diff Show More