mdpasien add edit
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,3 +4,4 @@ config.yaml
|
||||
restapi.rest
|
||||
cpone.db
|
||||
coba.Http
|
||||
uploads
|
||||
|
||||
@@ -296,7 +296,7 @@ a.text-white:focus {
|
||||
}
|
||||
|
||||
.btn-field {
|
||||
color: var(--text-black);
|
||||
color: var(--text-black) !important;
|
||||
background-color: var(--fieldbg) !important;
|
||||
border-color: var(--fieldbg) !important;
|
||||
}
|
||||
@@ -313,13 +313,13 @@ a.text-white:focus {
|
||||
border-radius: 0.85rem !important;
|
||||
}
|
||||
.btn-field:hover {
|
||||
color: var(--text-black);
|
||||
color: var(--text-black) !important;
|
||||
background-color: var(--fieldbg) !important;
|
||||
border-color: var(--fieldbg) !important;
|
||||
}
|
||||
.btn-field:focus,
|
||||
.btn-field.focus {
|
||||
color: var(--text-black);
|
||||
color: var(--text-black) !important;
|
||||
background-color: var(--fieldbg) !important;
|
||||
border-color: var(--fieldbg) !important;
|
||||
-webkit-box-shadow: 0 0 0 0rem var(--fieldbg) !important;
|
||||
@@ -327,14 +327,14 @@ a.text-white:focus {
|
||||
}
|
||||
.btn-field.disabled,
|
||||
.btn-field:disabled {
|
||||
color: var(--text-black);
|
||||
color: var(--text-black) !important;
|
||||
background-color: var(--fieldbg) !important;
|
||||
border-color: var(--fieldbg) !important;
|
||||
}
|
||||
.btn-field:not(:disabled):not(.disabled):active,
|
||||
.btn-field:not(:disabled):not(.disabled).active,
|
||||
.show > .btn-field.dropdown-toggle {
|
||||
color: var(--text-black);
|
||||
color: var(--text-black) !important;
|
||||
background-color: var(--fieldbg) !important;
|
||||
border-color: var(--fieldbg) !important;
|
||||
}
|
||||
@@ -5277,7 +5277,7 @@ a.text-hover-tosca:hover .svg-icon svg:hover g [fill],
|
||||
}
|
||||
|
||||
/* ### CUSTOM CSS SELECTPICKER */
|
||||
.btn-custom-selectpicker{
|
||||
.btn-custom-selectpicker {
|
||||
height: 8vh;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
2
assets/assets/js/jquery/jquery.bundle.min.js
vendored
Normal file
2
assets/assets/js/jquery/jquery.bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -129,8 +129,75 @@
|
||||
id="kt_body"
|
||||
class="bg-white header-fixed header-mobile-fixed subheader-enabled subheader-fixed subheader-mobile-fixed aside-enabled aside-fixed aside-minimize-hoverable page-loading"
|
||||
>
|
||||
<style></style>
|
||||
<style>
|
||||
/* input[type="file"] {
|
||||
display: none;
|
||||
} */
|
||||
</style>
|
||||
<!--begin::Main-->
|
||||
<script
|
||||
src="https://unpkg.com/htmx.org@1.9.12"
|
||||
integrity="sha384-ujb1lZYygJmzgSwoxRggbCHcjc0rB2XoQrxeTUQyRjrOnlCoYta87iKBWq3EsdM2"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script>
|
||||
function onChangeInput() {
|
||||
const fileInput = document.getElementById("file-upload");
|
||||
|
||||
const previewImage = document.getElementById("preview-image");
|
||||
|
||||
if (fileInput.files.length > 0) {
|
||||
if (fileInput.files[0].size > 500000) {
|
||||
fileInput.value = "";
|
||||
Swal.fire("Warning", "File is too big!", "warning");
|
||||
} else {
|
||||
previewImage.src = URL.createObjectURL(fileInput.files[0]);
|
||||
console.log(URL.createObjectURL(fileInput.files[0]));
|
||||
console.log(fileInput.files[0].mozFullPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
// window.addEventListener("DOMContentLoaded", () => {
|
||||
// const fileInput = document.getElementById("file-upload");
|
||||
|
||||
// const previewImage = document.getElementById("preview-image");
|
||||
|
||||
// fileInput.addEventListener("change", (event) => {
|
||||
// if (event.target.files.length > 0) {
|
||||
// previewImage.src = URL.createObjectURL(event.target.files[0]);
|
||||
// }
|
||||
|
||||
// // 👇️ reset file input once you're done
|
||||
// fileInput.value = null;
|
||||
// });
|
||||
// });
|
||||
</script>
|
||||
<div>
|
||||
<input
|
||||
type="file"
|
||||
hx-post="\dev\md\pasien\add"
|
||||
name="pasienprofile"
|
||||
hx-trigger="change"
|
||||
/>
|
||||
<div class="text-center">
|
||||
<img
|
||||
id="preview-image"
|
||||
src="asset-corporate-portal/media/person/person.png"
|
||||
class="rounded-lg"
|
||||
alt="..."
|
||||
style="width: 10vw; min-width: 100px;"
|
||||
/>
|
||||
</div>
|
||||
<label for="file-upload" class="btn btn-light-primary d-block mt-5">
|
||||
Update Foto
|
||||
</label>
|
||||
<input
|
||||
id="file-upload"
|
||||
type="file"
|
||||
accept=".png, .jpg, .jpeg"
|
||||
onchange="onChangeInput()"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="wrapperx p-5 h-100">
|
||||
<div class="row">
|
||||
@@ -141,7 +208,7 @@
|
||||
<label
|
||||
for="input1"
|
||||
class="font-weight-bolder"
|
||||
style="font-family: Poppins"
|
||||
style="font-family: Poppins;"
|
||||
>Sapaan</label
|
||||
>
|
||||
<select
|
||||
@@ -157,7 +224,9 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-3">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600;"
|
||||
>Imbuhan Awal</label
|
||||
>
|
||||
<input
|
||||
@@ -167,7 +236,9 @@
|
||||
/>
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-5">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600;"
|
||||
>Nama
|
||||
</label>
|
||||
<input
|
||||
@@ -177,7 +248,9 @@
|
||||
/>
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-2">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600;"
|
||||
>Imbuhan Akhir</label
|
||||
>
|
||||
<input
|
||||
@@ -195,7 +268,7 @@
|
||||
<div class="form-row">
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600"
|
||||
style="font-family: Poppins; font-weight: 600;"
|
||||
>Jenis Kelamin</label
|
||||
>
|
||||
<select
|
||||
@@ -215,7 +288,7 @@
|
||||
<div class="col-md-6">
|
||||
<!-- begin::Tanggal Lahir -->
|
||||
<div class="form-row">
|
||||
<label style="font-family: Poppins; font-weight: 600"
|
||||
<label style="font-family: Poppins; font-weight: 600;"
|
||||
>Tanggal Lahir</label
|
||||
>
|
||||
<div class="input-group date bg-field border-0 rounded-lg">
|
||||
@@ -234,7 +307,7 @@
|
||||
<span
|
||||
class="iconify text-grey"
|
||||
data-icon="heroicons-solid:calendar"
|
||||
style="font-size: 20px"
|
||||
style="font-size: 20px;"
|
||||
></span>
|
||||
</span>
|
||||
</div>
|
||||
@@ -252,7 +325,7 @@
|
||||
<div class="col">
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600"
|
||||
style="font-family: Poppins; font-weight: 600;"
|
||||
>Umur</label
|
||||
>
|
||||
<div class="input-container">
|
||||
@@ -294,7 +367,7 @@
|
||||
<div class="col">
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600"
|
||||
style="font-family: Poppins; font-weight: 600;"
|
||||
>Golongan Darah</label
|
||||
>
|
||||
<select
|
||||
@@ -314,7 +387,7 @@
|
||||
<!-- end::Golongan Darah -->
|
||||
<!-- begin::Rhesus -->
|
||||
<div class="col">
|
||||
<label style="font-family: Poppins; font-weight: 600"
|
||||
<label style="font-family: Poppins; font-weight: 600;"
|
||||
>Rhesus</label
|
||||
>
|
||||
<select
|
||||
@@ -339,7 +412,9 @@
|
||||
<div class="row mt-5">
|
||||
<!--begin::Pekerjaan-->
|
||||
<div class="col-md-6">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600;"
|
||||
>Pekerjaan</label
|
||||
>
|
||||
<input
|
||||
@@ -354,7 +429,7 @@
|
||||
<div class="form-row">
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600"
|
||||
style="font-family: Poppins; font-weight: 600;"
|
||||
>Departemen</label
|
||||
>
|
||||
<input
|
||||
@@ -371,7 +446,9 @@
|
||||
<div class="row mt-5">
|
||||
<!--begin::Posisi-->
|
||||
<div class="col-md-6">
|
||||
<label for="input1" style="font-family: Poppins; font-weight: 600"
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600;"
|
||||
>Posisi</label
|
||||
>
|
||||
<input
|
||||
@@ -384,7 +461,7 @@
|
||||
<!--Begin::Pendidikan Terakhir-->
|
||||
<div class="col-md-6">
|
||||
<div class="form-row">
|
||||
<label style="font-family: Poppins; font-weight: 600"
|
||||
<label style="font-family: Poppins; font-weight: 600;"
|
||||
>Pendidikan Terakhir</label
|
||||
>
|
||||
<select
|
||||
@@ -413,26 +490,26 @@
|
||||
<div class="form-row">
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600"
|
||||
style="font-family: Poppins; font-weight: 600;"
|
||||
>Kewarganegaraan</label
|
||||
>
|
||||
<div class="form-control border-0 h-auto p-0 mt-3">
|
||||
<div class="form-group">
|
||||
<div
|
||||
class="justify-content-between"
|
||||
style="display: flex; gap: 20px"
|
||||
style="display: flex; gap: 20px;"
|
||||
>
|
||||
<label
|
||||
style="display: flex; align-items: center; gap: 5px"
|
||||
style="display: flex; align-items: center; gap: 5px;"
|
||||
>
|
||||
<input type="radio" name="nationality" value="wni" />
|
||||
<p style="margin: 0">WNI</p>
|
||||
<p style="margin: 0;">WNI</p>
|
||||
</label>
|
||||
<label
|
||||
style="display: flex; align-items: center; gap: 5px"
|
||||
style="display: flex; align-items: center; gap: 5px;"
|
||||
>
|
||||
<input type="radio" name="nationality" value="wna" />
|
||||
<p style="margin: 0">WNA</p>
|
||||
<p style="margin: 0;">WNA</p>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -443,7 +520,7 @@
|
||||
<!--Begin::Etnis-->
|
||||
<div class="col-md-6">
|
||||
<div class="form-row">
|
||||
<label style="font-family: Poppins; font-weight: 600"
|
||||
<label style="font-family: Poppins; font-weight: 600;"
|
||||
>Etnis</label
|
||||
>
|
||||
<select
|
||||
@@ -473,7 +550,7 @@
|
||||
<div class="col">
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600"
|
||||
style="font-family: Poppins; font-weight: 600;"
|
||||
>Identitas</label
|
||||
>
|
||||
<select
|
||||
@@ -500,7 +577,7 @@
|
||||
<div class="col">
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600"
|
||||
style="font-family: Poppins; font-weight: 600;"
|
||||
>Nomor Identitas</label
|
||||
>
|
||||
<input
|
||||
@@ -522,7 +599,7 @@
|
||||
<div class="col">
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600"
|
||||
style="font-family: Poppins; font-weight: 600;"
|
||||
>Nomor HP</label
|
||||
>
|
||||
<input
|
||||
@@ -540,7 +617,7 @@
|
||||
<div class="col">
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600"
|
||||
style="font-family: Poppins; font-weight: 600;"
|
||||
>Email</label
|
||||
>
|
||||
<input
|
||||
@@ -561,7 +638,7 @@
|
||||
<div class="col">
|
||||
<img
|
||||
src="asset-corporate-portal/media/person/person.png"
|
||||
style="display: block; width: 13vw"
|
||||
style="display: block; width: 13vw;"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -570,7 +647,7 @@
|
||||
<div class="col">
|
||||
<button
|
||||
class="btn bg-primary-transparent text-center text-primary"
|
||||
style="width: 13vw; font-weight: 600"
|
||||
style="width: 13vw; font-weight: 600;"
|
||||
>
|
||||
Update Foto
|
||||
</button>
|
||||
@@ -580,6 +657,45 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div
|
||||
class="image-input image-input-empty image-input-outline"
|
||||
id="kt_image_5"
|
||||
style="background-image: url(assets/media/users/blank.png);"
|
||||
>
|
||||
<div class="image-input-wrapper"></div>
|
||||
|
||||
<label
|
||||
class="btn btn-xs btn-icon btn-circle btn-white btn-hover-text-primary btn-shadow"
|
||||
data-action="change"
|
||||
data-toggle="tooltip"
|
||||
title=""
|
||||
data-original-title="Change avatar"
|
||||
>
|
||||
<i class="fa fa-pen icon-sm text-muted"></i>
|
||||
<input type="file" name="profile_avatar" accept=".png, .jpg, .jpeg" />
|
||||
<input type="hidden" name="profile_avatar_remove" />
|
||||
</label>
|
||||
|
||||
<span
|
||||
class="btn btn-xs btn-icon btn-circle btn-white btn-hover-text-primary btn-shadow"
|
||||
data-action="cancel"
|
||||
data-toggle="tooltip"
|
||||
title="Cancel avatar"
|
||||
>
|
||||
<i class="ki ki-bold-close icon-xs text-muted"></i>
|
||||
</span>
|
||||
|
||||
<span
|
||||
class="btn btn-xs btn-icon btn-circle btn-white btn-hover-text-primary btn-shadow"
|
||||
data-action="remove"
|
||||
data-toggle="tooltip"
|
||||
title="Remove avatar"
|
||||
>
|
||||
<i class="ki ki-bold-close icon-xs text-muted"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--end::Main-->
|
||||
<script src="asset-corporate-portal/js/ktappsetting.js"></script>
|
||||
@@ -593,6 +709,7 @@
|
||||
<script src="assets/js/pages/crud/forms/widgets/bootstrap-datepicker.js"></script>
|
||||
|
||||
<script>
|
||||
var avatar5 = new KTImageInput("kt_image_5");
|
||||
function ShowLoading() {
|
||||
document
|
||||
.getElementById("demo")
|
||||
|
||||
@@ -41,18 +41,60 @@ templ CustomDatePicker(inp models.CustomDatePickerPrm) {
|
||||
ID Mandatory
|
||||
</div>
|
||||
}
|
||||
@TES(inp.ID)
|
||||
// @JsDatePicker("#" + inp.ID)
|
||||
}
|
||||
|
||||
script Format(id) {
|
||||
$(id).datepicker({
|
||||
templ CustomDatePickerV2(inp models.CustomDatePickerPrm) {
|
||||
<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>
|
||||
<input
|
||||
id={ inp.Name }
|
||||
name={ inp.Name }
|
||||
type="date"
|
||||
placeholder={ inp.Placeholder }
|
||||
value={ inp.Value }
|
||||
if inp.ErrorMsg =="" {
|
||||
class="form-control bg-field border-0 form-control-lg bg-field rounded-lg"
|
||||
} else {
|
||||
class="form-control bg-field border-1 form-control-lg bg-field rounded-lg is-invalid"
|
||||
}
|
||||
/>
|
||||
<div class="invalid-feedback text-danger mt-3 ml-2">
|
||||
{ inp.ErrorMsg }
|
||||
</div>
|
||||
</div>
|
||||
// @JsDatePicker("#" + inp.ID)
|
||||
}
|
||||
|
||||
script TES(id string) {
|
||||
$(document).ready(function () {
|
||||
$(id).datepicker({
|
||||
format: "dd/mm/yyyy",
|
||||
});
|
||||
$("#calendar-icon").click(function () {
|
||||
$(id).datepicker("show");
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
script Format(idtest string) {
|
||||
$(idtest).datepicker({
|
||||
format: "dd/mm/yyyy",
|
||||
});
|
||||
}
|
||||
|
||||
script IconOnClick(id) {
|
||||
script IconOnClick(idtest string) {
|
||||
$("#calendar-icon").click(function () {
|
||||
$(id).datepicker("show");
|
||||
$(idtest).datepicker("show");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -115,6 +115,10 @@ func CustomDatePicker(inp models.CustomDatePickerPrm) templ.Component {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = TES(inp.ID).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)
|
||||
}
|
||||
@@ -122,7 +126,7 @@ func CustomDatePicker(inp models.CustomDatePickerPrm) templ.Component {
|
||||
})
|
||||
}
|
||||
|
||||
func JsDatePicker(id string) templ.Component {
|
||||
func CustomDatePickerV2(inp models.CustomDatePickerPrm) 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 {
|
||||
@@ -135,6 +139,180 @@ func JsDatePicker(id string) templ.Component {
|
||||
templ_7745c5c3_Var7 = 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;\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var8 string
|
||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Label)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdatepicker\customdatepicker.templ`, Line: 57, Col: 14}
|
||||
}
|
||||
_, 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("</label> <input id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var9 string
|
||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdatepicker\customdatepicker.templ`, Line: 59, Col: 16}
|
||||
}
|
||||
_, 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("\" name=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var10 string
|
||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdatepicker\customdatepicker.templ`, Line: 60, Col: 18}
|
||||
}
|
||||
_, 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("\" type=\"date\" placeholder=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var11 string
|
||||
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Placeholder)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdatepicker\customdatepicker.templ`, Line: 62, Col: 32}
|
||||
}
|
||||
_, 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("\" value=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var12 string
|
||||
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Value)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customdatepicker\customdatepicker.templ`, Line: 63, Col: 20}
|
||||
}
|
||||
_, 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
|
||||
}
|
||||
if inp.ErrorMsg == "" {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" class=\"form-control bg-field border-0 form-control-lg bg-field rounded-lg\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" class=\"form-control bg-field border-1 form-control-lg bg-field rounded-lg is-invalid\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("><div class=\"invalid-feedback text-danger mt-3 ml-2\">")
|
||||
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\customdatepicker\customdatepicker.templ`, Line: 71, 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 TES(id string) templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_TES_b105`,
|
||||
Function: `function __templ_TES_b105(id){$(document).ready(function () {
|
||||
$(id).datepicker({
|
||||
format: "dd/mm/yyyy",
|
||||
});
|
||||
$("#calendar-icon").click(function () {
|
||||
$(id).datepicker("show");
|
||||
});
|
||||
});
|
||||
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_TES_b105`, id),
|
||||
CallInline: templ.SafeScriptInline(`__templ_TES_b105`, id),
|
||||
}
|
||||
}
|
||||
|
||||
func Format(idtest string) templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_Format_c41d`,
|
||||
Function: `function __templ_Format_c41d(idtest){$(idtest).datepicker({
|
||||
format: "dd/mm/yyyy",
|
||||
});
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_Format_c41d`, idtest),
|
||||
CallInline: templ.SafeScriptInline(`__templ_Format_c41d`, idtest),
|
||||
}
|
||||
}
|
||||
|
||||
func IconOnClick(idtest string) templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_IconOnClick_a67e`,
|
||||
Function: `function __templ_IconOnClick_a67e(idtest){$("#calendar-icon").click(function () {
|
||||
$(idtest).datepicker("show");
|
||||
});
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_IconOnClick_a67e`, idtest),
|
||||
CallInline: templ.SafeScriptInline(`__templ_IconOnClick_a67e`, idtest),
|
||||
}
|
||||
}
|
||||
|
||||
func JsDatePicker(id 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_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("<script>\r\n\tvar idCoba = {inp.ID}\r\n\t$(document).ready(function () {\r\n $(idDp).datepicker({\r\n \t\tformat: \"dd/mm/yyyy\",\r\n });\r\n $(\"#calendar-icon\").click(function () {\r\n \t\t$(idDp).datepicker(\"show\");\r\n });\r\n });\r\n\t</script>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
|
||||
@@ -98,9 +98,9 @@ templ CustomDropdownForm(
|
||||
<label class="text-black" style="font-family: Poppins; font-weight: 600;">{ inp.Label } </label>
|
||||
<select
|
||||
if inp.ErrorMsg =="" {
|
||||
class="form-control form-control-lg bg-field btn-lg rounded-lg selectpicker"
|
||||
class="form-control text-black form-control-lg bg-field btn-lg border-0 rounded-lg selectpicker"
|
||||
} else {
|
||||
class="form-control form-control-lg bg-field btn-lg rounded-lg selectpicker is-invalid"
|
||||
class="form-control text-black form-control-lg bg-field btn-lg border-1 rounded-lg selectpicker is-invalid"
|
||||
}
|
||||
data-live-search="true"
|
||||
data-size="5"
|
||||
|
||||
@@ -529,12 +529,12 @@ func CustomDropdownForm(
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if inp.ErrorMsg == "" {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" class=\"form-control form-control-lg bg-field btn-lg rounded-lg selectpicker\"")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" class=\"form-control text-black form-control-lg bg-field btn-lg border-0 rounded-lg selectpicker\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" class=\"form-control form-control-lg bg-field btn-lg rounded-lg selectpicker is-invalid\"")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" class=\"form-control text-black form-control-lg bg-field btn-lg border-1 rounded-lg selectpicker is-invalid\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ templ CustomTextFieldv2(inp models.CustomTextFieldv2Prm) {
|
||||
type={ inp.Type }
|
||||
placeholder={ inp.Placeholder }
|
||||
value={ inp.Value }
|
||||
min={ inp.Min }
|
||||
min={ inp.Max }
|
||||
if inp.ErrorMsg =="" {
|
||||
class="form-control bg-field border-0 form-control-lg bg-field rounded-lg"
|
||||
} else {
|
||||
|
||||
@@ -118,6 +118,32 @@ func CustomTextFieldv2(inp models.CustomTextFieldv2Prm) templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" min=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var8 string
|
||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Min)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfield\customtextfieldv2.templ`, Line: 21, Col: 16}
|
||||
}
|
||||
_, 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("\" min=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var9 string
|
||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(inp.Max)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customtextfield\customtextfieldv2.templ`, Line: 22, Col: 16}
|
||||
}
|
||||
_, 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("\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
@@ -137,12 +163,12 @@ func CustomTextFieldv2(inp models.CustomTextFieldv2Prm) templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var8 string
|
||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(inp.ErrorMsg)
|
||||
var templ_7745c5c3_Var10 string
|
||||
templ_7745c5c3_Var10, 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: 30, Col: 17}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
51
component/customuploadfoto/customuploadfoto.templ
Normal file
51
component/customuploadfoto/customuploadfoto.templ
Normal file
@@ -0,0 +1,51 @@
|
||||
package customuploadfoto
|
||||
|
||||
import "cpone/models"
|
||||
|
||||
templ CustomUploadFotoWithPreview(prm models.CustomUploadFotoPrm) {
|
||||
<div>
|
||||
<div class="text-center">
|
||||
<img
|
||||
id={ prm.ID + "-preview-image" }
|
||||
if prm.LinkFoto == "" {
|
||||
src="asset-corporate-portal/media/person/person.png"
|
||||
} else {
|
||||
src={ prm.LinkFoto }
|
||||
}
|
||||
class="rounded-lg"
|
||||
alt="..."
|
||||
style="width: 10vw; min-width: 100px;"
|
||||
/>
|
||||
</div>
|
||||
<label for={ prm.ID } class="btn btn-light-primary d-block mt-5">
|
||||
{ prm.Label }
|
||||
</label>
|
||||
<input
|
||||
id={ prm.ID }
|
||||
style="display: none;"
|
||||
name={ prm.Name }
|
||||
type="file"
|
||||
accept={ prm.Accept }
|
||||
onchange={ OnSelect(prm.ID) }
|
||||
hx-on::load={ OnSelect(prm.ID) }
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
|
||||
script OnSelect(id string) {
|
||||
const fileInput = document.getElementById(id);
|
||||
|
||||
const previewImage = document.getElementById(id+"-preview-image");
|
||||
|
||||
if (fileInput.files.length > 0) {
|
||||
if (fileInput.files[0].size > 500000) {
|
||||
fileInput.value = "";
|
||||
Swal.fire("Warning", "File is too big!", "warning");
|
||||
} else {
|
||||
previewImage.src = URL.createObjectURL(fileInput.files[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// 👇️ reset file input once you're done
|
||||
|
||||
}
|
||||
193
component/customuploadfoto/customuploadfoto_templ.go
Normal file
193
component/customuploadfoto/customuploadfoto_templ.go
Normal file
@@ -0,0 +1,193 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.663
|
||||
package customuploadfoto
|
||||
|
||||
//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 CustomUploadFotoWithPreview(prm models.CustomUploadFotoPrm) 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 class=\"text-center\"><img id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(prm.ID + "-preview-image")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customuploadfoto\customuploadfoto.templ`, Line: 9, Col: 34}
|
||||
}
|
||||
_, 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
|
||||
}
|
||||
if prm.LinkFoto == "" {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" src=\"asset-corporate-portal/media/person/person.png\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" src=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(prm.LinkFoto)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customuploadfoto\customuploadfoto.templ`, Line: 13, Col: 23}
|
||||
}
|
||||
_, 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
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" class=\"rounded-lg\" alt=\"...\" style=\"width: 10vw; min-width: 100px;\"></div><label for=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(prm.ID)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customuploadfoto\customuploadfoto.templ`, Line: 20, 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("\" class=\"btn btn-light-primary d-block mt-5\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(prm.Label)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customuploadfoto\customuploadfoto.templ`, Line: 21, Col: 14}
|
||||
}
|
||||
_, 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("</label> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, OnSelect(prm.ID), OnSelect(prm.ID))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<input id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var6 string
|
||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(prm.ID)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customuploadfoto\customuploadfoto.templ`, Line: 24, Col: 14}
|
||||
}
|
||||
_, 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("\" style=\"display: none;\" name=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var7 string
|
||||
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(prm.Name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customuploadfoto\customuploadfoto.templ`, Line: 26, Col: 18}
|
||||
}
|
||||
_, 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("\" type=\"file\" accept=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var8 string
|
||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(prm.Accept)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `component\customuploadfoto\customuploadfoto.templ`, Line: 28, Col: 22}
|
||||
}
|
||||
_, 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("\" onchange=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var9 templ.ComponentScript = OnSelect(prm.ID)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var9.Call)
|
||||
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_Var10 templ.ComponentScript = OnSelect(prm.ID)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var10.Call)
|
||||
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 OnSelect(id string) templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_OnSelect_4511`,
|
||||
Function: `function __templ_OnSelect_4511(id){const fileInput = document.getElementById(id);
|
||||
|
||||
const previewImage = document.getElementById(id+"-preview-image");
|
||||
|
||||
if (fileInput.files.length > 0) {
|
||||
if (fileInput.files[0].size > 500000) {
|
||||
fileInput.value = "";
|
||||
Swal.fire("Warning", "File is too big!", "warning");
|
||||
} else {
|
||||
previewImage.src = URL.createObjectURL(fileInput.files[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// 👇️ reset file input once you're done
|
||||
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_OnSelect_4511`, id),
|
||||
CallInline: templ.SafeScriptInline(`__templ_OnSelect_4511`, id),
|
||||
}
|
||||
}
|
||||
@@ -6,11 +6,16 @@ import (
|
||||
navbarmenu "cpone/component/navbar"
|
||||
"cpone/component/pagination"
|
||||
sidebaruserprofile "cpone/component/sidebar_user_profile"
|
||||
customtoastv2 "cpone/component/toastbootstrap"
|
||||
"cpone/models"
|
||||
"cpone/services"
|
||||
"cpone/utils"
|
||||
dev_mdpasienview "cpone/views/dev/mdpasien"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/a-h/templ"
|
||||
"github.com/labstack/echo/v4"
|
||||
@@ -23,6 +28,19 @@ type MdPasienServices interface {
|
||||
currentPage int,
|
||||
rowPerPage int) ([]models.Pasien, int, error)
|
||||
GetMdPasienBreadCrumb(title string) (models.BreadCrumbV1, error)
|
||||
GetPasienTitle() ([]models.SapaanPasien, error)
|
||||
Addpasien(prm models.PasienFormServicesPrm) (string, error)
|
||||
GetPasienByID(id string) (*models.Pasien, error)
|
||||
GetPasienTermonology() (
|
||||
sapaan []models.SapaanPasien,
|
||||
gender []models.TerminologyV0,
|
||||
goldar []models.TerminologyV0,
|
||||
rh []models.TerminologyV0,
|
||||
pendidikan []models.TerminologyV0,
|
||||
etnis []models.TerminologyV0,
|
||||
idType []models.TerminologyV0,
|
||||
err error)
|
||||
EditPasien(prm models.PasienFormServicesPrm) (string, error)
|
||||
}
|
||||
|
||||
func NewMdPasienHandler(us MdPasienServices) *MdPasienHandler {
|
||||
@@ -35,6 +53,20 @@ type MdPasienHandler struct {
|
||||
MdPasienServices MdPasienServices
|
||||
}
|
||||
|
||||
func (lh *MdPasienHandler) GetFotoProfile(c echo.Context) error {
|
||||
// Mengambil nama file dari parameter URL
|
||||
filename := c.Param("filename")
|
||||
_, b, _, _ := runtime.Caller(0)
|
||||
basepath := filepath.Dir(b)
|
||||
println("Basepath")
|
||||
println(basepath)
|
||||
// Menentukan path file (relative to the dev/services folder)
|
||||
filePath := filepath.Join(basepath, "..", "..", "uploads", "patient", filename)
|
||||
|
||||
// Mengembalikan file sebagai respon
|
||||
return c.File(filePath)
|
||||
}
|
||||
|
||||
func (lh *MdPasienHandler) HandleShowMdPasienScreen(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
dataMenu, err := services.GetMenu()
|
||||
@@ -111,9 +143,9 @@ func (lh *MdPasienHandler) HandleShowMdPasienScreen(c echo.Context) error {
|
||||
}
|
||||
|
||||
tablePasien := dev_mdpasienview.TablePasien(pasienlist, tablePasienID,
|
||||
"getEdit",
|
||||
"trgtedt",
|
||||
"swpedt",
|
||||
"/dev/md/pasien/openedit",
|
||||
"#"+dialogEditBodyID,
|
||||
"outerHTML",
|
||||
"#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID,
|
||||
"getdlt",
|
||||
"trgtdlt",
|
||||
@@ -132,6 +164,95 @@ func (lh *MdPasienHandler) HandleShowMdPasienScreen(c echo.Context) error {
|
||||
dev_mdpasienview.BeforeRequestContent(),
|
||||
dev_mdpasienview.AfterRequestContent())
|
||||
|
||||
//Form add
|
||||
//Sapaan
|
||||
sapaanList, genderList, goldarList, rhesusList, pendidikanList, etnisList, idTypeList, err := lh.MdPasienServices.GetPasienTermonology()
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERROR GET PASIEN TERMINOLOGY",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return err
|
||||
}
|
||||
sapaanOpt := dev_mdpasienview.ListItemSapaan(sapaanList, 0)
|
||||
genderOpt := dev_mdpasienview.ListItemTerminology(genderList, "")
|
||||
goldarOpt := dev_mdpasienview.ListItemTerminology(goldarList, "")
|
||||
rhesusOpt := dev_mdpasienview.ListItemTerminology(rhesusList, "")
|
||||
pendidikanOpt := dev_mdpasienview.ListItemTerminology(pendidikanList, "")
|
||||
etnisOpt := dev_mdpasienview.ListItemTerminology(etnisList, "")
|
||||
idTypeOpt := dev_mdpasienview.ListItemTerminology(idTypeList, "")
|
||||
formAddBodyCmp := dev_mdpasienview.BodyFormPasien(
|
||||
models.PasineFormBodyComponent{
|
||||
IDComponentUpload: "addFotoProfile",
|
||||
IDForm: dialogAddBodyID,
|
||||
SapaanItems: sapaanOpt,
|
||||
GenderItems: genderOpt,
|
||||
GoldarItems: goldarOpt,
|
||||
RhesusItems: rhesusOpt,
|
||||
PendidikanItems: pendidikanOpt,
|
||||
EtnisItems: etnisOpt,
|
||||
IDItems: idTypeOpt,
|
||||
HxSwapOOB: "true",
|
||||
},
|
||||
)
|
||||
formAddAction := dev_mdpasienview.ActionFormPasien("/dev/md/pasien/closeaddform", "#"+dialogAddBodyID, "outerHtml", dialogAddID)
|
||||
formAddBtnClose := dev_mdpasienview.BtnCloseFormPasien("/dev/md/pasien/closeaddform", "#"+dialogAddBodyID, "outerHtml", dialogAddID)
|
||||
formAddCmp := dev_mdpasienview.PasienForm(models.PasienFormComponent{
|
||||
IDComponent: "",
|
||||
Link: "/dev/md/pasien/add",
|
||||
HxTarget: "#" + dialogAddBodyID,
|
||||
HxSwap: "none",
|
||||
HxInclude: "#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage" + paginationID,
|
||||
ModalID: dialogAddID,
|
||||
ModalTitle: "New-Pasien",
|
||||
DialogBody: formAddBodyCmp,
|
||||
DialogAction: formAddAction,
|
||||
ButtonCLose: formAddBtnClose,
|
||||
})
|
||||
|
||||
formEditBodyCmp := dev_mdpasienview.BodyFormPasien(
|
||||
models.PasineFormBodyComponent{
|
||||
IDComponentUpload: "editFotoProfile",
|
||||
IDForm: dialogEditBodyID,
|
||||
SapaanItems: sapaanOpt,
|
||||
GenderItems: genderOpt,
|
||||
GoldarItems: goldarOpt,
|
||||
RhesusItems: rhesusOpt,
|
||||
PendidikanItems: pendidikanOpt,
|
||||
EtnisItems: etnisOpt,
|
||||
IDItems: idTypeOpt,
|
||||
},
|
||||
)
|
||||
formEditAction := dev_mdpasienview.ActionFormPasien("/dev/md/pasien/closeeditform", "#"+dialogEditBodyID, "outerHtml", dialogEditID)
|
||||
formEditBtnClose := dev_mdpasienview.BtnCloseFormPasien("/dev/md/pasien/closeeditform", "#"+dialogEditBodyID, "outerHtml", dialogEditID)
|
||||
formEditCmp := dev_mdpasienview.PasienForm(models.PasienFormComponent{
|
||||
IDComponent: "",
|
||||
Link: "/dev/md/pasien/edit",
|
||||
HxTarget: "#" + dialogEditBodyID,
|
||||
HxSwap: "outerHTML",
|
||||
HxInclude: "#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage" + paginationID,
|
||||
ModalID: dialogEditID,
|
||||
ModalTitle: "Edit-Pasien",
|
||||
DialogBody: formEditBodyCmp,
|
||||
DialogAction: formEditAction,
|
||||
ButtonCLose: formEditBtnClose,
|
||||
})
|
||||
//Delete
|
||||
formDeleteBodyCmp := dev_mdpasienview.DeleteConfirmationBody("", dialogDeleteBodyID, "Apakah anda yakin menghapus pasien berikut ?", []string{"PID", "NAMA"}, []string{"", ""}, dev_mdpasienview.JsHideModal(""))
|
||||
formDeleteAction := dev_mdpasienview.ActionFormPasien("/dev/md/pasien/closeeditform", "#"+dialogEditBodyID, "outerHtml", dialogEditID)
|
||||
formDeleteBtnClose := dev_mdpasienview.BtnCloseFormPasien("/dev/md/pasien/closeeditform", "#"+dialogEditBodyID, "outerHtml", dialogEditID)
|
||||
formDeleteCmp := dev_mdpasienview.PasienForm(models.PasienFormComponent{
|
||||
IDComponent: "",
|
||||
Link: "",
|
||||
HxTarget: "#" + dialogDeleteBodyID,
|
||||
HxSwap: "outerHTML",
|
||||
HxInclude: "#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage" + paginationID,
|
||||
ModalID: dialogDeleteID,
|
||||
ModalTitle: "Edit-Pasien",
|
||||
DialogBody: formDeleteBodyCmp,
|
||||
DialogAction: formDeleteAction,
|
||||
ButtonCLose: formDeleteBtnClose,
|
||||
})
|
||||
//Pasien Screen
|
||||
cmpPasienContent := dev_mdpasienview.MdPasienScreen(
|
||||
tablePasienID,
|
||||
@@ -146,9 +267,9 @@ func (lh *MdPasienHandler) HandleShowMdPasienScreen(c echo.Context) error {
|
||||
tablePasien,
|
||||
filterPasien,
|
||||
paginationPasien,
|
||||
breadcrumbComponent,
|
||||
breadcrumbComponent,
|
||||
breadcrumbComponent)
|
||||
formAddCmp,
|
||||
formEditCmp,
|
||||
formDeleteCmp)
|
||||
jsMDpasien := dev_mdpasienview.JsMdPasien()
|
||||
cssMdPasien := dev_mdpasienview.CssMdPasien()
|
||||
viewMdPasienScreen := dev_mdpasienview.ShowMdPasienScreen("Master Pasien",
|
||||
@@ -163,7 +284,7 @@ func (lh *MdPasienHandler) HandleSearchMdPasien(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
var retval []templ.Component
|
||||
search := c.QueryParam("search")
|
||||
// dialogEditBodyID := c.QueryParam("dialogEditBodyID")
|
||||
dialogEditBodyID := c.QueryParam("dialogEditBodyID")
|
||||
// dialogDeleteBodyID := c.QueryParam("dialogDeleteBodyID")
|
||||
tableID := c.QueryParam("tableID")
|
||||
paginationID := c.QueryParam("paginationID")
|
||||
@@ -178,9 +299,9 @@ func (lh *MdPasienHandler) HandleSearchMdPasien(c echo.Context) error {
|
||||
//Bahan Table
|
||||
|
||||
tablePasien := dev_mdpasienview.TablePasien(pasienList, tableID,
|
||||
"getEdit",
|
||||
"trgtedt",
|
||||
"swpedt",
|
||||
"/dev/md/pasien/openedit",
|
||||
"#"+dialogEditBodyID,
|
||||
"outerHTML",
|
||||
"#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID,
|
||||
"getdlt",
|
||||
"trgtdlt",
|
||||
@@ -206,7 +327,7 @@ func (lh *MdPasienHandler) HandlePaginationMdPasien(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
var retval []templ.Component
|
||||
search := c.QueryParam("search")
|
||||
// dialogEditBodyID := c.QueryParam("dialogEditBodyID")
|
||||
dialogEditBodyID := c.QueryParam("dialogEditBodyID")
|
||||
// dialogDeleteBodyID := c.QueryParam("dialogDeleteBodyID")
|
||||
pageparam := c.QueryParam("page")
|
||||
tableID := c.QueryParam("tableID")
|
||||
@@ -229,9 +350,9 @@ func (lh *MdPasienHandler) HandlePaginationMdPasien(c echo.Context) error {
|
||||
zap.Any("totalPage", totalPage),
|
||||
)
|
||||
tablePasien := dev_mdpasienview.TablePasien(pasienList, tableID,
|
||||
"getEdit",
|
||||
"trgtedt",
|
||||
"swpedt",
|
||||
"/dev/md/pasien/openedit",
|
||||
"#"+dialogEditBodyID,
|
||||
"outerHTML",
|
||||
"#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID,
|
||||
"getdlt",
|
||||
"trgtdlt",
|
||||
@@ -253,3 +374,640 @@ func (lh *MdPasienHandler) HandlePaginationMdPasien(c echo.Context) error {
|
||||
retval = append(retval, paginationPasien)
|
||||
return utils.ViewMulti(c, retval)
|
||||
}
|
||||
func (lh *MdPasienHandler) HandleAddMdPasien(c echo.Context) error {
|
||||
dialogAddBodyID := c.FormValue("dialogAddBodyID")
|
||||
dialogEditBodyID := c.FormValue("dialogEditBodyID")
|
||||
dialogAddID := c.FormValue("dialogAddID")
|
||||
paginationID := c.FormValue("paginationID")
|
||||
tableID := c.FormValue("tableID")
|
||||
search := c.FormValue("search")
|
||||
currpagePrm := c.FormValue("currpage" + paginationID)
|
||||
page, err := strconv.Atoi(currpagePrm)
|
||||
if err != nil {
|
||||
toast := customtoastv2.CustomToastV2Show("Gagal", err.Error(), "danger")
|
||||
return utils.View(c, toast)
|
||||
}
|
||||
logger, _ := zap.NewProduction()
|
||||
file, err := c.FormFile("pasienprofile")
|
||||
if err != nil && err != http.ErrMissingFile {
|
||||
toast := customtoastv2.CustomToastV2Show("Gagal", err.Error(), "danger")
|
||||
return utils.View(c, toast)
|
||||
}
|
||||
|
||||
prm := models.PasienFormServicesPrm{
|
||||
Sapaan: c.FormValue("sapaan"),
|
||||
Imbuhanawal: c.FormValue("imbuhanawal"),
|
||||
Nama: c.FormValue("nama"),
|
||||
Imbuhanakhir: c.FormValue("imbuhanakhir"),
|
||||
Gender: c.FormValue("gender"),
|
||||
Dob: c.FormValue("dob"),
|
||||
Goldar: c.FormValue("goldar"),
|
||||
Rhesus: c.FormValue("rhesus"),
|
||||
Pekerjaan: c.FormValue("pekerjaan"),
|
||||
Departement: c.FormValue("departement"),
|
||||
Posisi: c.FormValue("posisi"),
|
||||
Pendidikan: c.FormValue("pendidikan"),
|
||||
Nationality: c.FormValue("nationality"),
|
||||
Etnis: c.FormValue("etnis"),
|
||||
Identitas: c.FormValue("identitas"),
|
||||
Nomoridentitas: c.FormValue("nomoridentitas"),
|
||||
Hp: c.FormValue("hp"),
|
||||
Tahun: c.FormValue("tahun"),
|
||||
Bulan: c.FormValue("bulan"),
|
||||
Hari: c.FormValue("hari"),
|
||||
Email: c.FormValue("email"),
|
||||
UserID: "1",
|
||||
Foto: file,
|
||||
}
|
||||
defer logger.Sync()
|
||||
logger.Info("PARAM ADD PASIEN",
|
||||
zap.Any("error", prm),
|
||||
)
|
||||
validationArr := []string{}
|
||||
sapaanValidation := ""
|
||||
// imbuhanawalValidation := ""
|
||||
namaValidation := ""
|
||||
// imbuhanakhirValidation := ""
|
||||
genderValidation := ""
|
||||
dobValidation := ""
|
||||
// goldarValidation := ""
|
||||
// rhesusValidation := ""
|
||||
// pekerjaanValidation := ""
|
||||
// departementValidation := ""
|
||||
// posisiValidation := ""
|
||||
// pendidikanValidation := ""
|
||||
nationalityValidation := ""
|
||||
// etnisValidation := ""
|
||||
identitasValidation := ""
|
||||
nomoridentitasValidation := ""
|
||||
hpValidation := ""
|
||||
// emailValidation := ""
|
||||
// userIDValidation := ""
|
||||
formValidation := ""
|
||||
if strings.TrimSpace(prm.Nama) == "" {
|
||||
namaValidation = "Nama tidak boleh kosong"
|
||||
validationArr = append(validationArr, namaValidation)
|
||||
}
|
||||
if strings.TrimSpace(prm.Gender) == "" {
|
||||
genderValidation = "Gender tidak boleh kosong"
|
||||
validationArr = append(validationArr, genderValidation)
|
||||
}
|
||||
if strings.TrimSpace(prm.Dob) == "" {
|
||||
dobValidation = "Tanggal Lahir tidak boleh kosong"
|
||||
validationArr = append(validationArr, dobValidation)
|
||||
}
|
||||
if prm.Sapaan == "" {
|
||||
sapaanValidation = "Sapaan tidak boleh kosong"
|
||||
validationArr = append(validationArr, sapaanValidation)
|
||||
}
|
||||
if prm.Hp == "" {
|
||||
hpValidation = "No Hp tidak boleh kosong"
|
||||
validationArr = append(validationArr, hpValidation)
|
||||
}
|
||||
if prm.Identitas == "" {
|
||||
identitasValidation = "Pilih salah satu tipe identitas"
|
||||
validationArr = append(validationArr, identitasValidation)
|
||||
}
|
||||
if strings.TrimSpace(prm.Nomoridentitas) == "" {
|
||||
nomoridentitasValidation = "Nomor identitas tidak boleh kosong"
|
||||
validationArr = append(validationArr, nomoridentitasValidation)
|
||||
}
|
||||
if prm.Nationality == "" {
|
||||
nationalityValidation = "Pilih kewarganegaraan"
|
||||
validationArr = append(validationArr, nationalityValidation)
|
||||
}
|
||||
selectedSapaan := 0
|
||||
if prm.Sapaan != "" {
|
||||
selectedSapaan, err = strconv.Atoi(prm.Sapaan)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERRO SELECTED SAPAAN",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return err
|
||||
}
|
||||
}
|
||||
sapaanList, genderList, goldarList, rhesusList, pendidikanList, etnisList, idTypeList, err := lh.MdPasienServices.GetPasienTermonology()
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERROR GET PASIEN TERMINOLOGY",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return err
|
||||
}
|
||||
sapaanOpt := dev_mdpasienview.ListItemSapaan(sapaanList, selectedSapaan)
|
||||
genderOpt := dev_mdpasienview.ListItemTerminology(genderList, prm.Gender)
|
||||
goldarOpt := dev_mdpasienview.ListItemTerminology(goldarList, prm.Goldar)
|
||||
rhesusOpt := dev_mdpasienview.ListItemTerminology(rhesusList, prm.Rhesus)
|
||||
pendidikanOpt := dev_mdpasienview.ListItemTerminology(pendidikanList, prm.Pendidikan)
|
||||
etnisOpt := dev_mdpasienview.ListItemTerminology(etnisList, prm.Etnis)
|
||||
idTypeOpt := dev_mdpasienview.ListItemTerminology(idTypeList, prm.Identitas)
|
||||
if len(validationArr) > 0 {
|
||||
formValidation = "Silahkan cek ulang form"
|
||||
formAddBodyCmp := dev_mdpasienview.BodyFormPasien(
|
||||
models.PasineFormBodyComponent{
|
||||
IDComponentUpload: utils.GenerateRandomID("k"),
|
||||
HxSwapOOB: "true",
|
||||
IDForm: dialogAddBodyID,
|
||||
SapaanErr: sapaanValidation,
|
||||
ImbuhanAwalErr: "",
|
||||
ImbuhanAwalVal: prm.Imbuhanawal,
|
||||
NamaVal: prm.Nama,
|
||||
NamaErr: namaValidation,
|
||||
ImbuhanAkhirErr: "",
|
||||
ImbuhanAkhirVal: prm.Imbuhanakhir,
|
||||
DobErr: dobValidation,
|
||||
DobVal: prm.Dob,
|
||||
YearVal: prm.Tahun,
|
||||
MonthVal: prm.Bulan,
|
||||
DayVal: prm.Hari,
|
||||
HpErr: hpValidation,
|
||||
IDErr: identitasValidation,
|
||||
NoIDhVal: prm.Nomoridentitas,
|
||||
NoIDErr: nomoridentitasValidation,
|
||||
SapaanItems: sapaanOpt,
|
||||
GenderItems: genderOpt,
|
||||
GoldarItems: goldarOpt,
|
||||
GenderErr: genderValidation,
|
||||
RhesusItems: rhesusOpt,
|
||||
PendidikanItems: pendidikanOpt,
|
||||
EtnisItems: etnisOpt,
|
||||
IDItems: idTypeOpt,
|
||||
PekerjaanVal: prm.Pekerjaan,
|
||||
DepartementVal: prm.Departement,
|
||||
PosisiVal: prm.Posisi,
|
||||
HpVal: prm.Hp,
|
||||
EmailVal: prm.Email,
|
||||
CitizenshipVal: prm.Nationality,
|
||||
},
|
||||
)
|
||||
|
||||
defer logger.Sync()
|
||||
logger.Info("WARNING FORM",
|
||||
zap.Any("Warning", validationArr),
|
||||
)
|
||||
toast := customtoastv2.CustomToastV2Show("Warning", formValidation, "warning")
|
||||
return utils.ViewMulti(c, []templ.Component{toast, formAddBodyCmp})
|
||||
}
|
||||
numbering, err := lh.MdPasienServices.Addpasien(prm)
|
||||
if err != nil {
|
||||
toast := customtoastv2.CustomToastV2Show("Gagal", err.Error(), "danger")
|
||||
return utils.View(c, toast)
|
||||
}
|
||||
sapaanOptReset := dev_mdpasienview.ListItemSapaan(sapaanList, 0)
|
||||
genderOptReset := dev_mdpasienview.ListItemTerminology(genderList, "")
|
||||
goldarOptReset := dev_mdpasienview.ListItemTerminology(goldarList, "")
|
||||
rhesusOptReset := dev_mdpasienview.ListItemTerminology(rhesusList, "")
|
||||
pendidikanOptReset := dev_mdpasienview.ListItemTerminology(pendidikanList, "")
|
||||
etnisOptReset := dev_mdpasienview.ListItemTerminology(etnisList, "")
|
||||
idTypeOptReset := dev_mdpasienview.ListItemTerminology(idTypeList, "")
|
||||
formAddBodyCmp := dev_mdpasienview.BodyFormPasien(
|
||||
models.PasineFormBodyComponent{
|
||||
IDComponentUpload: utils.GenerateRandomID("k"),
|
||||
HxSwapOOB: "true",
|
||||
IDForm: dialogAddBodyID,
|
||||
SapaanItems: sapaanOptReset,
|
||||
GenderItems: genderOptReset,
|
||||
GoldarItems: goldarOptReset,
|
||||
RhesusItems: rhesusOptReset,
|
||||
PendidikanItems: pendidikanOptReset,
|
||||
EtnisItems: etnisOptReset,
|
||||
IDItems: idTypeOptReset,
|
||||
HxOnLoad: dev_mdpasienview.JsHideModal("#" + dialogAddID),
|
||||
},
|
||||
)
|
||||
//table component
|
||||
pasienlist, totalPage, err := lh.MdPasienServices.GetListMdPasien(search, page, 5)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERRO GET DATA PASIEN",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
tablePasien := dev_mdpasienview.TablePasien(pasienlist, tableID,
|
||||
"/dev/md/pasien/openedit",
|
||||
"#"+dialogEditBodyID,
|
||||
"outerHTML",
|
||||
"#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID,
|
||||
"getdlt",
|
||||
"trgtdlt",
|
||||
"swpdlt",
|
||||
"#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID)
|
||||
|
||||
//Pagination
|
||||
paginationPasien := pagination.PaginationV3(totalPage, page,
|
||||
"/dev/md/pasien/pagination",
|
||||
paginationID,
|
||||
"#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID,
|
||||
"#"+paginationID,
|
||||
"outerHTML",
|
||||
"",
|
||||
"true",
|
||||
dev_mdpasienview.BeforeRequestContent(),
|
||||
dev_mdpasienview.AfterRequestContent())
|
||||
toast := customtoastv2.CustomToastV2Show("Success", "Berhasil Add Pasien "+numbering, "success")
|
||||
|
||||
return utils.ViewMulti(c, []templ.Component{toast, tablePasien, paginationPasien, formAddBodyCmp})
|
||||
}
|
||||
func (lh *MdPasienHandler) HandleCloseModalMdPasien(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
|
||||
dialogAddBodyID := c.FormValue("dialogAddBodyID")
|
||||
dialogAddID := c.FormValue("dialogAddID")
|
||||
|
||||
selectedSapaan := 0
|
||||
sapaanList, genderList, goldarList, rhesusList, pendidikanList, etnisList, idTypeList, err := lh.MdPasienServices.GetPasienTermonology()
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERROR GET PASIEN TERMINOLOGY",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return err
|
||||
}
|
||||
sapaanOpt := dev_mdpasienview.ListItemSapaan(sapaanList, selectedSapaan)
|
||||
genderOpt := dev_mdpasienview.ListItemTerminology(genderList, "")
|
||||
goldarOpt := dev_mdpasienview.ListItemTerminology(goldarList, "")
|
||||
rhesusOpt := dev_mdpasienview.ListItemTerminology(rhesusList, "")
|
||||
pendidikanOpt := dev_mdpasienview.ListItemTerminology(pendidikanList, "")
|
||||
etnisOpt := dev_mdpasienview.ListItemTerminology(etnisList, "")
|
||||
idTypeOpt := dev_mdpasienview.ListItemTerminology(idTypeList, "")
|
||||
formAddBodyCmp := dev_mdpasienview.BodyFormPasien(
|
||||
models.PasineFormBodyComponent{
|
||||
IDComponentUpload: utils.GenerateRandomID("kjh"),
|
||||
HxSwapOOB: "true",
|
||||
IDForm: dialogAddBodyID,
|
||||
SapaanItems: sapaanOpt,
|
||||
GenderItems: genderOpt,
|
||||
GoldarItems: goldarOpt,
|
||||
RhesusItems: rhesusOpt,
|
||||
PendidikanItems: pendidikanOpt,
|
||||
EtnisItems: etnisOpt,
|
||||
IDItems: idTypeOpt,
|
||||
HxOnLoad: dev_mdpasienview.JsHideModal("#" + dialogAddID),
|
||||
},
|
||||
)
|
||||
return utils.ViewMulti(c, []templ.Component{formAddBodyCmp})
|
||||
}
|
||||
|
||||
func (lh *MdPasienHandler) HandleOpenEditMdPasien(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
dialogEditBodyID := c.QueryParam("dialogEditBodyID")
|
||||
dialogEditID := c.QueryParam("dialogEditID")
|
||||
id := c.QueryParam("id")
|
||||
logger.Info("prm open edit",
|
||||
zap.Any("prm", c.QueryParams()),
|
||||
)
|
||||
|
||||
pasien, err := lh.MdPasienServices.GetPasienByID(id)
|
||||
if err != nil {
|
||||
toast := customtoastv2.CustomToastV2Show("Error", "Error get data Pasien ", "danger")
|
||||
return utils.View(c, toast)
|
||||
}
|
||||
sapaanList, genderList, goldarList, rhesusList, pendidikanList, etnisList, idTypeList, err := lh.MdPasienServices.GetPasienTermonology()
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERROR GET PASIEN TERMINOLOGY",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return err
|
||||
}
|
||||
selectedSapaan := 0
|
||||
if pasien.M_PatientM_TitleID != "" {
|
||||
selectedSapaan, err = strconv.Atoi(pasien.M_PatientM_TitleID)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERRO SELECTED SAPAAN",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return err
|
||||
}
|
||||
}
|
||||
years, month, day, err := utils.CalculateStringAge(pasien.M_PatientDOB)
|
||||
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERRO CALCULATE AGE",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
sapaanOpt := dev_mdpasienview.ListItemSapaan(sapaanList, selectedSapaan)
|
||||
genderOpt := dev_mdpasienview.ListItemTerminology(genderList, pasien.M_PatientGender+"@")
|
||||
goldarOpt := dev_mdpasienview.ListItemTerminology(goldarList, pasien.M_PatientBloodTypeCode+"@"+pasien.M_PatientBloodTypeSystem)
|
||||
rhesusOpt := dev_mdpasienview.ListItemTerminology(rhesusList, pasien.M_PatientBloodRhCode+"@"+pasien.M_PatientBloodRhSystem)
|
||||
pendidikanOpt := dev_mdpasienview.ListItemTerminology(pendidikanList, pasien.M_PatientEducationCode+"@"+pasien.M_PatientEducationSystem)
|
||||
etnisOpt := dev_mdpasienview.ListItemTerminology(etnisList, pasien.M_PatientEtnicCode+"@"+pasien.M_PatientEtnicSystem)
|
||||
idTypeOpt := dev_mdpasienview.ListItemTerminology(idTypeList, pasien.M_PatientIdentifierCode+"@"+pasien.M_PatientIdentifierSystem)
|
||||
linkFoto := ""
|
||||
if pasien.M_PatientPhoto != "" {
|
||||
linkFoto = "/dev/md/pasien/foto/" + pasien.M_PatientPhoto
|
||||
}
|
||||
formEditBodyCmp := dev_mdpasienview.BodyFormPasien(
|
||||
models.PasineFormBodyComponent{
|
||||
IDComponentUpload: utils.GenerateRandomID("kjh"),
|
||||
YearVal: strconv.Itoa(years),
|
||||
MonthVal: strconv.Itoa(month),
|
||||
DayVal: strconv.Itoa(day),
|
||||
IDForm: dialogEditBodyID,
|
||||
ImbuhanAwalVal: pasien.M_PatientPrefix,
|
||||
NamaVal: pasien.M_PatientName,
|
||||
ImbuhanAkhirVal: pasien.M_PatientSuffix,
|
||||
DobVal: pasien.M_PatientDOB,
|
||||
NoIDhVal: pasien.M_PatientIdentifierValue,
|
||||
SapaanItems: sapaanOpt,
|
||||
GenderItems: genderOpt,
|
||||
GoldarItems: goldarOpt,
|
||||
RhesusItems: rhesusOpt,
|
||||
PendidikanItems: pendidikanOpt,
|
||||
EtnisItems: etnisOpt,
|
||||
IDItems: idTypeOpt,
|
||||
PekerjaanVal: pasien.M_PatientJob,
|
||||
DepartementVal: pasien.M_PatientDivisi,
|
||||
PosisiVal: pasien.M_PatientPosisi,
|
||||
HpVal: pasien.M_PatientHp,
|
||||
EmailVal: pasien.M_PatientEmail,
|
||||
LinkFoto: linkFoto,
|
||||
IDPasien: strconv.Itoa(pasien.M_PatientID),
|
||||
HxOnLoad: dev_mdpasienview.JsShowModal("#" + dialogEditID),
|
||||
CitizenshipVal: pasien.M_PatientCitizenship,
|
||||
})
|
||||
return utils.View(c, formEditBodyCmp)
|
||||
}
|
||||
|
||||
func (lh *MdPasienHandler) HandleCloseModalEditMdPasien(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
|
||||
dialogEditBodyID := c.FormValue("dialogEditBodyID")
|
||||
dialogEditID := c.FormValue("dialogEditID")
|
||||
selectedSapaan := 0
|
||||
sapaanList, genderList, goldarList, rhesusList, pendidikanList, etnisList, idTypeList, err := lh.MdPasienServices.GetPasienTermonology()
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERROR GET PASIEN TERMINOLOGY",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return err
|
||||
}
|
||||
sapaanOpt := dev_mdpasienview.ListItemSapaan(sapaanList, selectedSapaan)
|
||||
genderOpt := dev_mdpasienview.ListItemTerminology(genderList, "")
|
||||
goldarOpt := dev_mdpasienview.ListItemTerminology(goldarList, "")
|
||||
rhesusOpt := dev_mdpasienview.ListItemTerminology(rhesusList, "")
|
||||
pendidikanOpt := dev_mdpasienview.ListItemTerminology(pendidikanList, "")
|
||||
etnisOpt := dev_mdpasienview.ListItemTerminology(etnisList, "")
|
||||
idTypeOpt := dev_mdpasienview.ListItemTerminology(idTypeList, "")
|
||||
formEditBodyCmp := dev_mdpasienview.BodyFormPasien(
|
||||
models.PasineFormBodyComponent{
|
||||
IDComponentUpload: utils.GenerateRandomID("kjh"),
|
||||
IDForm: dialogEditBodyID,
|
||||
SapaanItems: sapaanOpt,
|
||||
GenderItems: genderOpt,
|
||||
GoldarItems: goldarOpt,
|
||||
RhesusItems: rhesusOpt,
|
||||
PendidikanItems: pendidikanOpt,
|
||||
EtnisItems: etnisOpt,
|
||||
IDItems: idTypeOpt,
|
||||
HxOnLoad: dev_mdpasienview.JsHideModal("#" + dialogEditID),
|
||||
},
|
||||
)
|
||||
return utils.ViewMulti(c, []templ.Component{formEditBodyCmp})
|
||||
}
|
||||
func (lh *MdPasienHandler) HandleEditMdPasien(c echo.Context) error {
|
||||
dialogEditBodyID := c.FormValue("dialogEditBodyID")
|
||||
dialogEditID := c.FormValue("dialogEditID")
|
||||
paginationID := c.FormValue("paginationID")
|
||||
tableID := c.FormValue("tableID")
|
||||
search := c.FormValue("search")
|
||||
currpagePrm := c.FormValue("currpage" + paginationID)
|
||||
page, err := strconv.Atoi(currpagePrm)
|
||||
if err != nil {
|
||||
toast := customtoastv2.CustomToastV2Show("Gagal", err.Error(), "danger")
|
||||
return utils.View(c, toast)
|
||||
}
|
||||
logger, _ := zap.NewProduction()
|
||||
file, err := c.FormFile("pasienprofile")
|
||||
if err != nil && err != http.ErrMissingFile {
|
||||
toast := customtoastv2.CustomToastV2Show("Gagal", err.Error(), "danger")
|
||||
return utils.View(c, toast)
|
||||
}
|
||||
|
||||
prm := models.PasienFormServicesPrm{
|
||||
Sapaan: c.FormValue("sapaan"),
|
||||
Imbuhanawal: c.FormValue("imbuhanawal"),
|
||||
Nama: c.FormValue("nama"),
|
||||
Imbuhanakhir: c.FormValue("imbuhanakhir"),
|
||||
Gender: c.FormValue("gender"),
|
||||
Dob: c.FormValue("dob"),
|
||||
Goldar: c.FormValue("goldar"),
|
||||
Rhesus: c.FormValue("rhesus"),
|
||||
Pekerjaan: c.FormValue("pekerjaan"),
|
||||
Departement: c.FormValue("departement"),
|
||||
Posisi: c.FormValue("posisi"),
|
||||
Pendidikan: c.FormValue("pendidikan"),
|
||||
Nationality: c.FormValue("nationality"),
|
||||
Etnis: c.FormValue("etnis"),
|
||||
Identitas: c.FormValue("identitas"),
|
||||
Nomoridentitas: c.FormValue("nomoridentitas"),
|
||||
Hp: c.FormValue("hp"),
|
||||
Tahun: c.FormValue("tahun"),
|
||||
Bulan: c.FormValue("bulan"),
|
||||
Hari: c.FormValue("hari"),
|
||||
Email: c.FormValue("email"),
|
||||
UserID: "1",
|
||||
Foto: file,
|
||||
PasienID: c.FormValue("pasienid"),
|
||||
}
|
||||
defer logger.Sync()
|
||||
logger.Info("PARAM Edit PASIEN",
|
||||
zap.Any("error", prm),
|
||||
)
|
||||
validationArr := []string{}
|
||||
sapaanValidation := ""
|
||||
// imbuhanawalValidation := ""
|
||||
namaValidation := ""
|
||||
// imbuhanakhirValidation := ""
|
||||
genderValidation := ""
|
||||
dobValidation := ""
|
||||
// goldarValidation := ""
|
||||
// rhesusValidation := ""
|
||||
// pekerjaanValidation := ""
|
||||
// departementValidation := ""
|
||||
// posisiValidation := ""
|
||||
// pendidikanValidation := ""
|
||||
nationalityValidation := ""
|
||||
// etnisValidation := ""
|
||||
identitasValidation := ""
|
||||
nomoridentitasValidation := ""
|
||||
hpValidation := ""
|
||||
// emailValidation := ""
|
||||
// userIDValidation := ""
|
||||
formValidation := ""
|
||||
if strings.TrimSpace(prm.Nama) == "" {
|
||||
namaValidation = "Nama tidak boleh kosong"
|
||||
validationArr = append(validationArr, namaValidation)
|
||||
}
|
||||
if strings.TrimSpace(prm.Gender) == "" {
|
||||
genderValidation = "Gender tidak boleh kosong"
|
||||
validationArr = append(validationArr, genderValidation)
|
||||
}
|
||||
if strings.TrimSpace(prm.Dob) == "" {
|
||||
dobValidation = "Tanggal Lahir tidak boleh kosong"
|
||||
validationArr = append(validationArr, dobValidation)
|
||||
}
|
||||
if prm.Sapaan == "" {
|
||||
sapaanValidation = "Sapaan tidak boleh kosong"
|
||||
validationArr = append(validationArr, sapaanValidation)
|
||||
}
|
||||
if prm.Hp == "" {
|
||||
hpValidation = "No Hp tidak boleh kosong"
|
||||
validationArr = append(validationArr, hpValidation)
|
||||
}
|
||||
if prm.Identitas == "" {
|
||||
identitasValidation = "Pilih salah satu tipe identitas"
|
||||
validationArr = append(validationArr, identitasValidation)
|
||||
}
|
||||
if strings.TrimSpace(prm.Nomoridentitas) == "" {
|
||||
nomoridentitasValidation = "Nomor identitas tidak boleh kosong"
|
||||
validationArr = append(validationArr, nomoridentitasValidation)
|
||||
}
|
||||
if prm.Nationality == "" {
|
||||
nationalityValidation = "Pilih kewarganegaraan"
|
||||
validationArr = append(validationArr, nationalityValidation)
|
||||
}
|
||||
selectedSapaan := 0
|
||||
if prm.Sapaan != "" {
|
||||
selectedSapaan, err = strconv.Atoi(prm.Sapaan)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERRO SELECTED SAPAAN",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return err
|
||||
}
|
||||
}
|
||||
sapaanList, genderList, goldarList, rhesusList, pendidikanList, etnisList, idTypeList, err := lh.MdPasienServices.GetPasienTermonology()
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERROR GET PASIEN TERMINOLOGY",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return err
|
||||
}
|
||||
sapaanOpt := dev_mdpasienview.ListItemSapaan(sapaanList, selectedSapaan)
|
||||
genderOpt := dev_mdpasienview.ListItemTerminology(genderList, prm.Gender)
|
||||
goldarOpt := dev_mdpasienview.ListItemTerminology(goldarList, prm.Goldar)
|
||||
rhesusOpt := dev_mdpasienview.ListItemTerminology(rhesusList, prm.Rhesus)
|
||||
pendidikanOpt := dev_mdpasienview.ListItemTerminology(pendidikanList, prm.Pendidikan)
|
||||
etnisOpt := dev_mdpasienview.ListItemTerminology(etnisList, prm.Etnis)
|
||||
idTypeOpt := dev_mdpasienview.ListItemTerminology(idTypeList, prm.Identitas)
|
||||
formEditBodyCmp := dev_mdpasienview.BodyFormPasien(
|
||||
models.PasineFormBodyComponent{
|
||||
IDPasien: prm.PasienID,
|
||||
IDComponentUpload: utils.GenerateRandomID("k"),
|
||||
IDForm: dialogEditBodyID,
|
||||
SapaanErr: sapaanValidation,
|
||||
ImbuhanAwalErr: "",
|
||||
ImbuhanAwalVal: prm.Imbuhanawal,
|
||||
NamaVal: prm.Nama,
|
||||
NamaErr: namaValidation,
|
||||
ImbuhanAkhirErr: "",
|
||||
ImbuhanAkhirVal: prm.Imbuhanakhir,
|
||||
DobErr: dobValidation,
|
||||
DobVal: prm.Dob,
|
||||
YearVal: prm.Tahun,
|
||||
MonthVal: prm.Bulan,
|
||||
DayVal: prm.Hari,
|
||||
HpErr: hpValidation,
|
||||
IDErr: identitasValidation,
|
||||
NoIDhVal: prm.Nomoridentitas,
|
||||
NoIDErr: nomoridentitasValidation,
|
||||
SapaanItems: sapaanOpt,
|
||||
GenderItems: genderOpt,
|
||||
GoldarItems: goldarOpt,
|
||||
GenderErr: genderValidation,
|
||||
RhesusItems: rhesusOpt,
|
||||
PendidikanItems: pendidikanOpt,
|
||||
EtnisItems: etnisOpt,
|
||||
IDItems: idTypeOpt,
|
||||
PekerjaanVal: prm.Pekerjaan,
|
||||
DepartementVal: prm.Departement,
|
||||
PosisiVal: prm.Posisi,
|
||||
HpVal: prm.Hp,
|
||||
EmailVal: prm.Email,
|
||||
CitizenshipVal: prm.Nationality,
|
||||
},
|
||||
)
|
||||
if len(validationArr) > 0 {
|
||||
formValidation = "Silahkan cek ulang form"
|
||||
|
||||
defer logger.Sync()
|
||||
logger.Info("WARNING FORM",
|
||||
zap.Any("Warning", validationArr),
|
||||
)
|
||||
toast := customtoastv2.CustomToastV2Show("Warning", formValidation, "warning")
|
||||
return utils.ViewMulti(c, []templ.Component{toast, formEditBodyCmp})
|
||||
}
|
||||
_, err = lh.MdPasienServices.EditPasien(prm)
|
||||
if err != nil {
|
||||
toast := customtoastv2.CustomToastV2Show("Gagal", err.Error(), "danger")
|
||||
return utils.ViewMulti(c, []templ.Component{toast, formEditBodyCmp})
|
||||
}
|
||||
sapaanOptReset := dev_mdpasienview.ListItemSapaan(sapaanList, 0)
|
||||
genderOptReset := dev_mdpasienview.ListItemTerminology(genderList, "")
|
||||
goldarOptReset := dev_mdpasienview.ListItemTerminology(goldarList, "")
|
||||
rhesusOptReset := dev_mdpasienview.ListItemTerminology(rhesusList, "")
|
||||
pendidikanOptReset := dev_mdpasienview.ListItemTerminology(pendidikanList, "")
|
||||
etnisOptReset := dev_mdpasienview.ListItemTerminology(etnisList, "")
|
||||
idTypeOptReset := dev_mdpasienview.ListItemTerminology(idTypeList, "")
|
||||
formEditBodyCmp = dev_mdpasienview.BodyFormPasien(
|
||||
models.PasineFormBodyComponent{
|
||||
IDPasien: prm.PasienID,
|
||||
IDComponentUpload: utils.GenerateRandomID("k"),
|
||||
IDForm: dialogEditBodyID,
|
||||
SapaanItems: sapaanOptReset,
|
||||
GenderItems: genderOptReset,
|
||||
GoldarItems: goldarOptReset,
|
||||
RhesusItems: rhesusOptReset,
|
||||
PendidikanItems: pendidikanOptReset,
|
||||
EtnisItems: etnisOptReset,
|
||||
IDItems: idTypeOptReset,
|
||||
HxOnLoad: dev_mdpasienview.JsHideModal("#" + dialogEditID),
|
||||
},
|
||||
)
|
||||
//table component
|
||||
pasienlist, totalPage, err := lh.MdPasienServices.GetListMdPasien(search, page, 5)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERRO GET DATA PASIEN",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
tablePasien := dev_mdpasienview.TablePasien(pasienlist, tableID,
|
||||
"/dev/md/pasien/openedit",
|
||||
"#"+dialogEditBodyID,
|
||||
"outerHTML",
|
||||
"#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID,
|
||||
"getdlt",
|
||||
"trgtdlt",
|
||||
"swpdlt",
|
||||
"#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID)
|
||||
|
||||
//Pagination
|
||||
paginationPasien := pagination.PaginationV3(totalPage, page,
|
||||
"/dev/md/pasien/pagination",
|
||||
paginationID,
|
||||
"#filtersearch, #tableID, #paginationID, #dialogAddID, #dialogAddBodyID, #dialogEditID, #dialogEditBodyID, #dialogDeleteBodyID, #dialogDeleteID, #currpage"+paginationID,
|
||||
"#"+paginationID,
|
||||
"outerHTML",
|
||||
"",
|
||||
"true",
|
||||
dev_mdpasienview.BeforeRequestContent(),
|
||||
dev_mdpasienview.AfterRequestContent())
|
||||
toast := customtoastv2.CustomToastV2Show("Success", "Berhasil Edit Pasien "+prm.Nama, "success")
|
||||
|
||||
return utils.ViewMulti(c, []templ.Component{toast, tablePasien, paginationPasien, formEditBodyCmp})
|
||||
}
|
||||
|
||||
@@ -328,5 +328,11 @@ func SetupRoutesDev(app *echo.Echo, appStore db.AppStore) {
|
||||
dev.GET("/md/pasien", devMdPasienHandlers.HandleShowMdPasienScreen)
|
||||
dev.GET("/md/pasien/filter", devMdPasienHandlers.HandleSearchMdPasien)
|
||||
dev.GET("/md/pasien/pagination", devMdPasienHandlers.HandlePaginationMdPasien)
|
||||
dev.POST("/md/pasien/add", devMdPasienHandlers.HandleAddMdPasien)
|
||||
dev.POST("/md/pasien/closeaddform", devMdPasienHandlers.HandleCloseModalMdPasien)
|
||||
dev.GET("/md/pasien/openedit", devMdPasienHandlers.HandleOpenEditMdPasien)
|
||||
dev.POST("/md/pasien/closeeditform", devMdPasienHandlers.HandleCloseModalEditMdPasien)
|
||||
dev.GET("/md/pasien/foto/:filename", devMdPasienHandlers.GetFotoProfile)
|
||||
dev.POST("/md/pasien/edit", devMdPasienHandlers.HandleEditMdPasien)
|
||||
|
||||
}
|
||||
|
||||
@@ -114,6 +114,16 @@ templ CorporateLayout(title string, css templ.Component, js templ.Component, nav
|
||||
>
|
||||
// htmx
|
||||
<script src="assets/js/htmx/htmx.min.js"></script>
|
||||
<script src="asset-corporate-portal/js/ktappsetting.js"></script>
|
||||
<!--end::Global Config-->
|
||||
<!--begin::Global Theme Bundle(used by all pages)-->
|
||||
<script src="assets/plugins/global/plugins.bundle.js"></script>
|
||||
<script src="assets/plugins/custom/prismjs/prismjs.bundle.js"></script>
|
||||
<script src="assets/js/scripts.bundle.js"></script>
|
||||
<!--end::Global Theme Bundle-->
|
||||
<script src="assets/js/iconify/iconify.min.js"></script>
|
||||
// bootstrap datepicker
|
||||
<script src="assets/js/pages/crud/forms/widgets/bootstrap-datepicker.js"></script>
|
||||
<!--start::Navbar Mobile-->
|
||||
<div id="kt_header_mobile" class="header-mobile align-items-center header-mobile-fixed ">
|
||||
<!--begin::Logo-->
|
||||
@@ -258,16 +268,6 @@ templ CorporateLayout(title string, css templ.Component, js templ.Component, nav
|
||||
<!--end::Navbar Laptop With Sidebar-->
|
||||
@sidebaruserprofile
|
||||
<!--begin::Global Config(global config for global JS scripts)-->
|
||||
<script src="asset-corporate-portal/js/ktappsetting.js"></script>
|
||||
<!--end::Global Config-->
|
||||
<!--begin::Global Theme Bundle(used by all pages)-->
|
||||
<script src="assets/plugins/global/plugins.bundle.js"></script>
|
||||
<script src="assets/plugins/custom/prismjs/prismjs.bundle.js"></script>
|
||||
<script src="assets/js/scripts.bundle.js"></script>
|
||||
<!--end::Global Theme Bundle-->
|
||||
<script src="assets/js/iconify/iconify.min.js"></script>
|
||||
// bootstrap datepicker
|
||||
<script src="assets/js/pages/crud/forms/widgets/bootstrap-datepicker.js"></script>
|
||||
@js
|
||||
<!--end::Page Scripts-->
|
||||
</body>
|
||||
|
||||
@@ -46,7 +46,7 @@ func CorporateLayout(title string, css templ.Component, js templ.Component, navb
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</head><!--end::Head--><!--begin::Body--><body id=\"kt_body\" class=\"header-fixed header-mobile-fixed subheader-enabled subheader-fixed subheader-mobile-fixed aside-enabled aside-fixed aside-minimize-hoverable page-loading bg-white\"><script src=\"assets/js/htmx/htmx.min.js\"></script><!--start::Navbar Mobile--><div id=\"kt_header_mobile\" class=\"header-mobile align-items-center header-mobile-fixed \"><!--begin::Logo--><a href=\"index.html\"><img alt=\"Logo\" src=\"asset-corporate-portal/media/logo/logo.png\" style=\"object-fit: contain;height: 4vh;\"></a><!--end::Logo--><!--begin::Toolbar--><div class=\"d-flex align-items-center\"><!--begin::Aside Mobile Toggle--><button class=\"btn p-0 burger-icon burger-icon-left\" id=\"kt_aside_mobile_toggle\"><span></span></button><!--end::Aside Mobile Toggle--><!--begin::Topbar Mobile Toggle--><button class=\"btn btn-hover-text-primary p-0 ml-2\" id=\"kt_header_mobile_topbar_toggle\"><span class=\"svg-icon svg-icon-xl\"><!--begin::Svg Icon | path:/assets/media/svg/icons/General/User.svg--><svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"24px\" height=\"24px\" viewBox=\"0 0 24 24\" version=\"1.1\"><g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\"><polygon points=\"0 0 24 0 24 24 0 24\"></polygon> <path d=\"M12,11 C9.790861,11 8,9.209139 8,7 C8,4.790861 9.790861,3 12,3 C14.209139,3 16,4.790861 16,7 C16,9.209139 14.209139,11 12,11 Z\" fill=\"#000000\" fill-rule=\"nonzero\" opacity=\"0.3\"></path> <path d=\"M3.00065168,20.1992055 C3.38825852,15.4265159 7.26191235,13 11.9833413,13 C16.7712164,13 20.7048837,15.2931929 20.9979143,20.2 C21.0095879,20.3954741 20.9979143,21 20.2466999,21 C16.541124,21 11.0347247,21 3.72750223,21 C3.47671215,21 2.97953825,20.45918 3.00065168,20.1992055 Z\" fill=\"#000000\" fill-rule=\"nonzero\"></path></g></svg><!--end::Svg Icon--></span></button><!--end::Topbar Mobile Toggle--></div><!--end::Toolbar--></div><!--start::Navbar Mobile--><!--start::Navbar Laptop With Sidebar--><div class=\"d-flex flex-column flex-root\"><!--begin::Page--><div class=\"d-flex flex-row flex-column-fluid page\"><!--begin::Aside--><div class=\"aside aside-left aside-fixed d-flex flex-column flex-row-auto\" id=\"kt_aside\"><!--begin::Brand--><div class=\"brand flex-column-auto \" id=\"kt_brand\"><!--begin::Logo--><a href=\"index.html\" class=\"brand-logo\" style=\"\"><img alt=\"Logo\" class=\"img-fluid\" src=\"asset-corporate-portal/media/logo/logo.png\"></a><!--end::Logo--><!--begin::Toggle--><button class=\"brand-toggle btn btn-sm px-0\" id=\"kt_aside_toggle\"><span class=\"svg-icon svg-icon svg-icon-xl\"><!--begin::Svg Icon | path:/assets/media/svg/icons/Navigation/Angle-double-left.svg--><svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"24px\" height=\"24px\" viewBox=\"0 0 24 24\" version=\"1.1\"><g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\"><polygon points=\"0 0 24 0 24 24 0 24\"></polygon> <path d=\"M5.29288961,6.70710318 C4.90236532,6.31657888 4.90236532,5.68341391 5.29288961,5.29288961 C5.68341391,4.90236532 6.31657888,4.90236532 6.70710318,5.29288961 L12.7071032,11.2928896 C13.0856821,11.6714686 13.0989277,12.281055 12.7371505,12.675721 L7.23715054,18.675721 C6.86395813,19.08284 6.23139076,19.1103429 5.82427177,18.7371505 C5.41715278,18.3639581 5.38964985,17.7313908 5.76284226,17.3242718 L10.6158586,12.0300721 L5.29288961,6.70710318 Z\" fill=\"#000000\" fill-rule=\"nonzero\" transform=\"translate(8.999997, 11.999999) scale(-1, 1) translate(-8.999997, -11.999999) \"></path> <path d=\"M10.7071009,15.7071068 C10.3165766,16.0976311 9.68341162,16.0976311 9.29288733,15.7071068 C8.90236304,15.3165825 8.90236304,14.6834175 9.29288733,14.2928932 L15.2928873,8.29289322 C15.6714663,7.91431428 16.2810527,7.90106866 16.6757187,8.26284586 L22.6757187,13.7628459 C23.0828377,14.1360383 23.1103407,14.7686056 22.7371482,15.1757246 C22.3639558,15.5828436 21.7313885,15.6103465 21.3242695,15.2371541 L16.0300699,10.3841378 L10.7071009,15.7071068 Z\" fill=\"#000000\" fill-rule=\"nonzero\" opacity=\"0.3\" transform=\"translate(15.999997, 11.999999) scale(-1, 1) rotate(-270.000000) translate(-15.999997, -11.999999) \"></path></g></svg><!--end::Svg Icon--></span></button><!--end::Toolbar--></div><!--end::Brand--><!--begin::Aside Menu-->")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</head><!--end::Head--><!--begin::Body--><body id=\"kt_body\" class=\"header-fixed header-mobile-fixed subheader-enabled subheader-fixed subheader-mobile-fixed aside-enabled aside-fixed aside-minimize-hoverable page-loading bg-white\"><script src=\"assets/js/htmx/htmx.min.js\"></script><script src=\"asset-corporate-portal/js/ktappsetting.js\"></script><!--end::Global Config--><!--begin::Global Theme Bundle(used by all pages)--><script src=\"assets/plugins/global/plugins.bundle.js\"></script><script src=\"assets/plugins/custom/prismjs/prismjs.bundle.js\"></script><script src=\"assets/js/scripts.bundle.js\"></script><!--end::Global Theme Bundle--><script src=\"assets/js/iconify/iconify.min.js\"></script><script src=\"assets/js/pages/crud/forms/widgets/bootstrap-datepicker.js\"></script><!--start::Navbar Mobile--><div id=\"kt_header_mobile\" class=\"header-mobile align-items-center header-mobile-fixed \"><!--begin::Logo--><a href=\"index.html\"><img alt=\"Logo\" src=\"asset-corporate-portal/media/logo/logo.png\" style=\"object-fit: contain;height: 4vh;\"></a><!--end::Logo--><!--begin::Toolbar--><div class=\"d-flex align-items-center\"><!--begin::Aside Mobile Toggle--><button class=\"btn p-0 burger-icon burger-icon-left\" id=\"kt_aside_mobile_toggle\"><span></span></button><!--end::Aside Mobile Toggle--><!--begin::Topbar Mobile Toggle--><button class=\"btn btn-hover-text-primary p-0 ml-2\" id=\"kt_header_mobile_topbar_toggle\"><span class=\"svg-icon svg-icon-xl\"><!--begin::Svg Icon | path:/assets/media/svg/icons/General/User.svg--><svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"24px\" height=\"24px\" viewBox=\"0 0 24 24\" version=\"1.1\"><g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\"><polygon points=\"0 0 24 0 24 24 0 24\"></polygon> <path d=\"M12,11 C9.790861,11 8,9.209139 8,7 C8,4.790861 9.790861,3 12,3 C14.209139,3 16,4.790861 16,7 C16,9.209139 14.209139,11 12,11 Z\" fill=\"#000000\" fill-rule=\"nonzero\" opacity=\"0.3\"></path> <path d=\"M3.00065168,20.1992055 C3.38825852,15.4265159 7.26191235,13 11.9833413,13 C16.7712164,13 20.7048837,15.2931929 20.9979143,20.2 C21.0095879,20.3954741 20.9979143,21 20.2466999,21 C16.541124,21 11.0347247,21 3.72750223,21 C3.47671215,21 2.97953825,20.45918 3.00065168,20.1992055 Z\" fill=\"#000000\" fill-rule=\"nonzero\"></path></g></svg><!--end::Svg Icon--></span></button><!--end::Topbar Mobile Toggle--></div><!--end::Toolbar--></div><!--start::Navbar Mobile--><!--start::Navbar Laptop With Sidebar--><div class=\"d-flex flex-column flex-root\"><!--begin::Page--><div class=\"d-flex flex-row flex-column-fluid page\"><!--begin::Aside--><div class=\"aside aside-left aside-fixed d-flex flex-column flex-row-auto\" id=\"kt_aside\"><!--begin::Brand--><div class=\"brand flex-column-auto \" id=\"kt_brand\"><!--begin::Logo--><a href=\"index.html\" class=\"brand-logo\" style=\"\"><img alt=\"Logo\" class=\"img-fluid\" src=\"asset-corporate-portal/media/logo/logo.png\"></a><!--end::Logo--><!--begin::Toggle--><button class=\"brand-toggle btn btn-sm px-0\" id=\"kt_aside_toggle\"><span class=\"svg-icon svg-icon svg-icon-xl\"><!--begin::Svg Icon | path:/assets/media/svg/icons/Navigation/Angle-double-left.svg--><svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"24px\" height=\"24px\" viewBox=\"0 0 24 24\" version=\"1.1\"><g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\"><polygon points=\"0 0 24 0 24 24 0 24\"></polygon> <path d=\"M5.29288961,6.70710318 C4.90236532,6.31657888 4.90236532,5.68341391 5.29288961,5.29288961 C5.68341391,4.90236532 6.31657888,4.90236532 6.70710318,5.29288961 L12.7071032,11.2928896 C13.0856821,11.6714686 13.0989277,12.281055 12.7371505,12.675721 L7.23715054,18.675721 C6.86395813,19.08284 6.23139076,19.1103429 5.82427177,18.7371505 C5.41715278,18.3639581 5.38964985,17.7313908 5.76284226,17.3242718 L10.6158586,12.0300721 L5.29288961,6.70710318 Z\" fill=\"#000000\" fill-rule=\"nonzero\" transform=\"translate(8.999997, 11.999999) scale(-1, 1) translate(-8.999997, -11.999999) \"></path> <path d=\"M10.7071009,15.7071068 C10.3165766,16.0976311 9.68341162,16.0976311 9.29288733,15.7071068 C8.90236304,15.3165825 8.90236304,14.6834175 9.29288733,14.2928932 L15.2928873,8.29289322 C15.6714663,7.91431428 16.2810527,7.90106866 16.6757187,8.26284586 L22.6757187,13.7628459 C23.0828377,14.1360383 23.1103407,14.7686056 22.7371482,15.1757246 C22.3639558,15.5828436 21.7313885,15.6103465 21.3242695,15.2371541 L16.0300699,10.3841378 L10.7071009,15.7071068 Z\" fill=\"#000000\" fill-rule=\"nonzero\" opacity=\"0.3\" transform=\"translate(15.999997, 11.999999) scale(-1, 1) rotate(-270.000000) translate(-15.999997, -11.999999) \"></path></g></svg><!--end::Svg Icon--></span></button><!--end::Toolbar--></div><!--end::Brand--><!--begin::Aside Menu-->")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -78,7 +78,7 @@ func CorporateLayout(title string, css templ.Component, js templ.Component, navb
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!--begin::Global Config(global config for global JS scripts)--><script src=\"asset-corporate-portal/js/ktappsetting.js\"></script><!--end::Global Config--><!--begin::Global Theme Bundle(used by all pages)--><script src=\"assets/plugins/global/plugins.bundle.js\"></script><script src=\"assets/plugins/custom/prismjs/prismjs.bundle.js\"></script><script src=\"assets/js/scripts.bundle.js\"></script><!--end::Global Theme Bundle--><script src=\"assets/js/iconify/iconify.min.js\"></script><script src=\"assets/js/pages/crud/forms/widgets/bootstrap-datepicker.js\"></script>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!--begin::Global Config(global config for global JS scripts)-->")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
@@ -12,5 +12,7 @@ type CustomTextFieldv2Prm struct {
|
||||
Type string `default:"text"`
|
||||
Value string `default:""`
|
||||
ErrorMsg string `default:""`
|
||||
Min string
|
||||
Max string
|
||||
ID string
|
||||
}
|
||||
|
||||
11
models/customdatepicker.models.go
Normal file
11
models/customdatepicker.models.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package models
|
||||
|
||||
type CustomDatePickerPrm struct {
|
||||
Label string `default:"Label"`
|
||||
Name string `default:"name"`
|
||||
Placeholder string `default:"Placeholder"`
|
||||
Type string `default:"text"`
|
||||
Value string `default:""`
|
||||
ErrorMsg string `default:""`
|
||||
ID string
|
||||
}
|
||||
9
models/customuploadfoto.models.go
Normal file
9
models/customuploadfoto.models.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package models
|
||||
|
||||
type CustomUploadFotoPrm struct {
|
||||
ID string `desc:"ID"`
|
||||
Name string `desc:"name"`
|
||||
Accept string `desc:"ekstension acc (.png, .jpg, .jpeg)"`
|
||||
Label string `desc:"label title"`
|
||||
LinkFoto string
|
||||
}
|
||||
@@ -1,5 +1,11 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"mime/multipart"
|
||||
|
||||
"github.com/a-h/templ"
|
||||
)
|
||||
|
||||
type Pasien struct {
|
||||
M_PatientID int `db:"M_PatientID"`
|
||||
M_PatientNoReg string `db:"M_PatientNoReg"`
|
||||
@@ -45,3 +51,107 @@ type Pasien struct {
|
||||
M_PatientDeletedUserID string `db:"M_PatientDeletedUserID"`
|
||||
M_PatientDeleted string `db:"M_PatientDeleted"`
|
||||
}
|
||||
|
||||
type SapaanPasien struct {
|
||||
M_TitleID int `db:"M_TitleID"`
|
||||
M_TitleName string `db:"M_TitleName"`
|
||||
M_TitleGender string `db:"M_TitleGender"`
|
||||
M_TitleOrder string `db:"M_TitleOrder"`
|
||||
M_TitleIsActive string `db:"M_TitleIsActive"`
|
||||
M_TitleCreated string `db:"M_TitleCreated"`
|
||||
M_TitleCreatedUserID string `db:"M_TitleCreatedUserID"`
|
||||
M_TitleLastUpdated string `db:"M_TitleLastUpdated"`
|
||||
M_TitleLastUpdatedUserID string `db:"M_TitleLastUpdatedUserID"`
|
||||
M_TitleDeleted string `db:"M_TitleDeleted"`
|
||||
M_TitleDeletedUserID string `db:"M_TitleDeletedUserID"`
|
||||
}
|
||||
|
||||
type PasienFormComponent struct {
|
||||
IDComponent string
|
||||
Link string
|
||||
HxTarget string
|
||||
HxSwap string
|
||||
HxInclude string
|
||||
ModalID string
|
||||
ModalTitle string
|
||||
DialogBody templ.Component
|
||||
DialogAction templ.Component
|
||||
ButtonCLose templ.Component
|
||||
}
|
||||
|
||||
type PasineFormBodyComponent struct {
|
||||
IDComponentUpload string
|
||||
IDForm string
|
||||
SapaanErr string `json:"sapaanErr"`
|
||||
SapaanItems templ.Component
|
||||
ImbuhanAwalErr string `json:"imbuhanAwalErr"`
|
||||
ImbuhanAwalVal string `json:"imbuhanAwalVal"`
|
||||
NamaErr string `json:"namaErr"`
|
||||
NamaVal string `json:"namaVal"`
|
||||
ImbuhanAkhirErr string `json:"imbuhanAkhirErr"`
|
||||
ImbuhanAkhirVal string `json:"imbuhanAkhirVal"`
|
||||
GenderErr string `json:"genderErr"`
|
||||
GenderItems templ.Component
|
||||
DobErr string `json:"dobErr"`
|
||||
DobVal string `json:"dobVal"`
|
||||
YearErr string `json:"yearErr"`
|
||||
YearVal string `json:"yearVal"`
|
||||
MonthErr string `json:"monthErr"`
|
||||
MonthVal string `json:"monthVal"`
|
||||
DayErr string `json:"DayErr"`
|
||||
DayVal string `json:"DayVal"`
|
||||
GoldarErr string `json:"goldarErr"`
|
||||
GoldarItems templ.Component
|
||||
RhesusErr string `json:"rhesusErr"`
|
||||
RhesusItems templ.Component
|
||||
PekerjaanErr string `json:"pekerjaanErr"`
|
||||
PekerjaanVal string `json:"pekerjaanVal"`
|
||||
DepartementErr string `json:"departementErr"`
|
||||
DepartementVal string `json:"departementVal"`
|
||||
PosisiErr string `json:"posisiErr"`
|
||||
PosisiVal string `json:"posisiVal"`
|
||||
PendidikanErr string `json:"pendidikanErr"`
|
||||
PendidikanItems templ.Component
|
||||
EtnisErr string `json:"etnisErr"`
|
||||
EtnisItems templ.Component
|
||||
IDErr string `json:"idErr"`
|
||||
IDItems templ.Component
|
||||
NoIDErr string `json:"noIDErr"`
|
||||
NoIDhVal string `json:"noIDhVal"`
|
||||
HpErr string `json:"hpErr"`
|
||||
HpVal string `json:"hpVal"`
|
||||
EmailErr string `json:"emailErr"`
|
||||
EmailVal string `json:"emailVal"`
|
||||
HxOnLoad templ.ComponentScript
|
||||
HxSwapOOB string
|
||||
LinkFoto string
|
||||
IDPasien string
|
||||
CitizenshipVal string `json:"CitizenshipVal"`
|
||||
}
|
||||
|
||||
type PasienFormServicesPrm struct {
|
||||
PasienID string
|
||||
Sapaan string
|
||||
Imbuhanawal string
|
||||
Nama string
|
||||
Imbuhanakhir string
|
||||
Gender string
|
||||
Dob string
|
||||
Tahun string
|
||||
Bulan string
|
||||
Hari string
|
||||
Goldar string
|
||||
Rhesus string
|
||||
Pekerjaan string
|
||||
Departement string
|
||||
Posisi string
|
||||
Pendidikan string
|
||||
Nationality string
|
||||
Etnis string
|
||||
Identitas string
|
||||
Nomoridentitas string
|
||||
Hp string
|
||||
Email string
|
||||
UserID string
|
||||
Foto *multipart.FileHeader
|
||||
}
|
||||
|
||||
@@ -1,24 +1,28 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
type TerminologyV0 struct {
|
||||
ResourceType string `db:"resource_type"`
|
||||
AttributePath string `db:"attribute_path"`
|
||||
Code string `db:"code"`
|
||||
ParentCode string `db:"parent_code"`
|
||||
Display string `db:"display"`
|
||||
DisplayEn string `db:"display_en"`
|
||||
CodeSystem string `db:"code_system"`
|
||||
OrderNo uint `db:"order_no"`
|
||||
FtIndex string `db:"ft_index"`
|
||||
UseInd bool `db:"use_ind"`
|
||||
Description string `db:"description"`
|
||||
StatusCd string `db:"status_cd"`
|
||||
CreatedDttm string `db:"created_dttm"`
|
||||
CreatedUserID uint `db:"created_user_id"`
|
||||
UpdatedDttm string `db:"updated_dttm"`
|
||||
UpdatedUserID uint `db:"updated_user_id"`
|
||||
NullifiedDttm string `db:"nullified_dttm"`
|
||||
NullifiedUserID uint `db:"nullified_user_id"`
|
||||
ResourceType string `db:"resource_type"`
|
||||
AttributePath string `db:"attribute_path"`
|
||||
Code string `db:"code"`
|
||||
ParentCode string `db:"parent_code"`
|
||||
Display string `db:"display"`
|
||||
DisplayEn string `db:"display_en"`
|
||||
CodeSystem string `db:"code_system"`
|
||||
OrderNo uint `db:"order_no"`
|
||||
FtIndex sql.NullString `db:"ft_index"`
|
||||
UseInd bool `db:"use_ind"`
|
||||
Description sql.NullString `db:"description"`
|
||||
StatusCd string `db:"status_cd"`
|
||||
CreatedDttm string `db:"created_dttm"`
|
||||
CreatedUserID uint `db:"created_user_id"`
|
||||
UpdatedDttm string `db:"updated_dttm"`
|
||||
UpdatedUserID uint `db:"updated_user_id"`
|
||||
NullifiedDttm string `db:"nullified_dttm"`
|
||||
NullifiedUserID uint `db:"nullified_user_id"`
|
||||
}
|
||||
|
||||
type TerminologyParamv0 struct {
|
||||
|
||||
@@ -542,7 +542,7 @@ func GetTerminologyList(inp models.TerminologyParamv0) ([]models.TerminologyV0,
|
||||
|
||||
if err := dbx.Handlex.Select(&term, query,
|
||||
inp.CodeSystem,
|
||||
inp.CodeSystem); err != nil {
|
||||
inp.AttributePath); err != nil {
|
||||
return nil, fmt.Errorf("error querying database terminology: %v", err)
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,17 @@ import (
|
||||
"cpone/db"
|
||||
"cpone/models"
|
||||
dbx "cpone/package/database"
|
||||
"cpone/services"
|
||||
"cpone/utils"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func NewMdPasienServices(uStore db.AppStore) *MdPasienServices {
|
||||
@@ -44,7 +52,12 @@ func (su *MdPasienServices) GetListMdPasien(
|
||||
return nil, 0, fmt.Errorf("error querying database: %v", err)
|
||||
}
|
||||
query := `
|
||||
SELECT m_patient.*
|
||||
SELECT m_patient.*,
|
||||
CASE
|
||||
WHEN M_PatientGender = "MALE" THEN "Laki-laki"
|
||||
WHEN M_PatientGender = "FEMALE" THEN "Perempuan"
|
||||
ELSE ""
|
||||
END AS M_PatientGender
|
||||
FROM m_patient
|
||||
JOIN m_title
|
||||
ON M_PatientM_TitleID = M_TitleID
|
||||
@@ -85,3 +98,519 @@ func (su *MdPasienServices) GetMdPasienBreadCrumb(title string) (models.BreadCru
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
func (su *MdPasienServices) GetPasienTitle() ([]models.SapaanPasien, error) {
|
||||
var sapaanList []models.SapaanPasien
|
||||
query := `
|
||||
SELECT * FROM m_title WHERE M_TitleIsActive = 'Y'
|
||||
`
|
||||
|
||||
if err := dbx.Handlex.Select(&sapaanList, query); err != nil {
|
||||
return nil, fmt.Errorf("error querying database: %v", err)
|
||||
}
|
||||
|
||||
return sapaanList, nil
|
||||
|
||||
}
|
||||
func (su *MdPasienServices) Addpasien(prm models.PasienFormServicesPrm) (string, error) {
|
||||
logger, _ := zap.NewProduction()
|
||||
tx := dbx.Handlex.MustBegin()
|
||||
var numbering string
|
||||
var newFileName string
|
||||
if prm.Foto != nil {
|
||||
_, b, _, _ := runtime.Caller(0)
|
||||
basepath := filepath.Dir(b)
|
||||
println("Basepath")
|
||||
println(basepath)
|
||||
// defer logger.Sync()
|
||||
// logger.Info("FIlE",
|
||||
// zap.Any("filename", file.Filename),
|
||||
// )
|
||||
src, err := prm.Foto.Open()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("error open file")
|
||||
}
|
||||
defer src.Close()
|
||||
ext := filepath.Ext(prm.Foto.Filename)
|
||||
newFileName = utils.GenerateRandomID(prm.Foto.Filename) + ext
|
||||
uploadDir := filepath.Join(basepath, "..", "..", "uploads", "patient")
|
||||
println(uploadDir)
|
||||
// Menentukan path file tujuan
|
||||
dstPath := filepath.Join(uploadDir, newFileName)
|
||||
// Membuat direktori jika belum ada
|
||||
if err := os.MkdirAll(uploadDir, os.ModePerm); err != nil {
|
||||
return "", fmt.Errorf("error mkdir")
|
||||
}
|
||||
// Membuka file tujuan
|
||||
dst, err := os.Create(dstPath)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("error create file")
|
||||
}
|
||||
defer dst.Close()
|
||||
// Menyalin konten file yang diupload ke file tujuan
|
||||
if _, err = io.Copy(dst, src); err != nil {
|
||||
return "", fmt.Errorf("error copy file")
|
||||
}
|
||||
}
|
||||
|
||||
qryNum :=
|
||||
`SELECT fn_numbering("P") AS numbering`
|
||||
if err := tx.Get(&numbering, qryNum); err != nil {
|
||||
tx.Rollback()
|
||||
defer logger.Sync()
|
||||
logger.Error("Error get numbering",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return "", fmt.Errorf("error querying database: %v", err)
|
||||
}
|
||||
gender := strings.Trim(prm.Gender, "@")
|
||||
bloodType := []string{}
|
||||
if prm.Goldar == "" {
|
||||
bloodType = append(bloodType, "")
|
||||
bloodType = append(bloodType, "")
|
||||
} else {
|
||||
bloodType = strings.Split(prm.Goldar, "@")
|
||||
if prm.Goldar != "" && len(bloodType) != 2 {
|
||||
tx.Rollback()
|
||||
defer logger.Sync()
|
||||
logger.Error("Error split bloodtype",
|
||||
zap.Any("blood Type", bloodType),
|
||||
)
|
||||
return "", fmt.Errorf("error bloodtype")
|
||||
}
|
||||
}
|
||||
rhesus := []string{}
|
||||
if prm.Rhesus == "" {
|
||||
rhesus = append(rhesus, "")
|
||||
rhesus = append(rhesus, "")
|
||||
} else {
|
||||
rhesus = strings.Split(prm.Rhesus, "@")
|
||||
if prm.Rhesus != "" && len(rhesus) != 2 {
|
||||
tx.Rollback()
|
||||
defer logger.Sync()
|
||||
logger.Error("Error split rhesus",
|
||||
zap.Any("blood Type", rhesus),
|
||||
)
|
||||
return "", fmt.Errorf("error rhesus")
|
||||
}
|
||||
}
|
||||
education := []string{}
|
||||
if prm.Pendidikan == "" {
|
||||
education = append(education, "")
|
||||
education = append(education, "")
|
||||
} else {
|
||||
education = strings.Split(prm.Pendidikan, "@")
|
||||
if prm.Pendidikan != "" && len(education) != 2 {
|
||||
tx.Rollback()
|
||||
defer logger.Sync()
|
||||
logger.Error("Error split education",
|
||||
zap.Any("blood Type", education),
|
||||
)
|
||||
return "", fmt.Errorf("error education")
|
||||
}
|
||||
}
|
||||
etnis := []string{}
|
||||
if prm.Etnis == "" {
|
||||
etnis = append(etnis, "")
|
||||
etnis = append(etnis, "")
|
||||
} else {
|
||||
etnis = strings.Split(prm.Etnis, "@")
|
||||
if prm.Etnis != "" && len(etnis) != 2 {
|
||||
tx.Rollback()
|
||||
defer logger.Sync()
|
||||
logger.Error("Error split etnis",
|
||||
zap.Any("blood Type", etnis),
|
||||
)
|
||||
return "", fmt.Errorf("error etnis")
|
||||
}
|
||||
}
|
||||
identifier := strings.Split(prm.Identitas, "@")
|
||||
if len(identifier) != 2 {
|
||||
tx.Rollback()
|
||||
defer logger.Sync()
|
||||
logger.Error("Error split identifier",
|
||||
zap.Any("blood Type", identifier),
|
||||
)
|
||||
return "", fmt.Errorf("error identifier")
|
||||
}
|
||||
|
||||
query := `
|
||||
INSERT INTO m_patient
|
||||
(M_PatientNoReg,
|
||||
M_PatientM_TitleID,
|
||||
M_PatientPrefix,
|
||||
M_PatientName,
|
||||
M_PatientSuffix,
|
||||
M_PatientGender,
|
||||
M_PatientDOB,
|
||||
M_PatientReligionCode,
|
||||
M_PatientReligionSystem,
|
||||
M_PatientBloodTypeCode,
|
||||
M_PatientBloodTypeSystem,
|
||||
M_PatientBloodRhCode,
|
||||
M_PatientBloodRhSystem,
|
||||
M_PatientEducationCode,
|
||||
M_PatientEducationSystem,
|
||||
M_PatientCitizenship,
|
||||
M_PatientEtnicCode,
|
||||
M_PatientEtnicSystem,
|
||||
M_PatientIdentifierCode,
|
||||
M_PatientIdentifierSystem,
|
||||
M_PatientIdentifierValue,
|
||||
M_PatientJob,
|
||||
M_PatientPosisi,
|
||||
M_PatientDivisi,
|
||||
M_PatientHp,
|
||||
M_PatientEmail,
|
||||
M_PatientPhoto,
|
||||
M_PatientAddress,
|
||||
M_PatientAddressRegionalCd,
|
||||
M_PatientAddressCity,
|
||||
M_PatientAddressDistrict,
|
||||
M_PatientAddressState,
|
||||
M_PatientAddressCountry,
|
||||
M_PatientCreatedUserID
|
||||
)
|
||||
VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
|
||||
`
|
||||
|
||||
rst := tx.MustExec(query,
|
||||
numbering,
|
||||
prm.Sapaan,
|
||||
prm.Imbuhanawal,
|
||||
prm.Nama,
|
||||
prm.Imbuhanakhir,
|
||||
gender,
|
||||
prm.Dob,
|
||||
"",
|
||||
"",
|
||||
bloodType[0],
|
||||
bloodType[1],
|
||||
rhesus[0],
|
||||
rhesus[1],
|
||||
education[0],
|
||||
education[1],
|
||||
prm.Nationality,
|
||||
etnis[0],
|
||||
etnis[1],
|
||||
identifier[0],
|
||||
identifier[1],
|
||||
prm.Nomoridentitas,
|
||||
prm.Pekerjaan,
|
||||
prm.Posisi,
|
||||
prm.Departement,
|
||||
prm.Hp,
|
||||
prm.Email,
|
||||
newFileName,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
prm.UserID,
|
||||
)
|
||||
_, err := rst.LastInsertId()
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
defer logger.Sync()
|
||||
logger.Error("Error insert db",
|
||||
zap.Any("rows Affected", rst),
|
||||
zap.Any("Error", err.Error()),
|
||||
)
|
||||
return "", fmt.Errorf("error querying database: %v", err)
|
||||
}
|
||||
tx.Commit()
|
||||
return numbering, nil
|
||||
|
||||
}
|
||||
func (su *MdPasienServices) GetPasienByID(id string) (*models.Pasien, error) {
|
||||
logger, _ := zap.NewProduction()
|
||||
|
||||
var pasien models.Pasien
|
||||
query := `SELECT * FROM m_patient WHERE M_PatientID = ?`
|
||||
err := dbx.Handlex.Get(&pasien, query, id)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("Error get patient",
|
||||
zap.Any("Error", err.Error()),
|
||||
)
|
||||
return nil, fmt.Errorf("error querying database: %v", err)
|
||||
}
|
||||
return &pasien, nil
|
||||
}
|
||||
|
||||
func (su *MdPasienServices) GetPasienTermonology() (
|
||||
sapaan []models.SapaanPasien,
|
||||
gender []models.TerminologyV0,
|
||||
goldar []models.TerminologyV0,
|
||||
rh []models.TerminologyV0,
|
||||
pendidikan []models.TerminologyV0,
|
||||
etnis []models.TerminologyV0,
|
||||
idType []models.TerminologyV0,
|
||||
err error) {
|
||||
logger, err := zap.NewProduction()
|
||||
sapaanList, err := su.GetPasienTitle()
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERRO GET SAPAAN LIST",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return nil, nil, nil, nil, nil, nil, nil, fmt.Errorf("error get sapaan")
|
||||
}
|
||||
genderList := []models.TerminologyV0{{Code: "MALE", Display: "Laki Laki"}, {Code: "FEMALE", Display: "Perempuan"}}
|
||||
goldarList, err := services.GetTerminologyList(models.TerminologyParamv0{AttributePath: "Person.blood.type", CodeSystem: "http://loinc.org"})
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERRO GET GOLDAR LIST",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return nil, nil, nil, nil, nil, nil, nil, fmt.Errorf("error get tipe golongan darah")
|
||||
}
|
||||
rhesusList, err := services.GetTerminologyList(models.TerminologyParamv0{AttributePath: "Person.blood.rhesus", CodeSystem: "http://snomed.info/sct"})
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERRO GET RH LIST",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return nil, nil, nil, nil, nil, nil, nil, fmt.Errorf("error get tipe rhesus")
|
||||
|
||||
}
|
||||
pendidikanList, err := services.GetTerminologyList(models.TerminologyParamv0{AttributePath: "Person.education", CodeSystem: "xhis.code.education.level"})
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERRO GET PENDIDIKAN LIST",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return nil, nil, nil, nil, nil, nil, nil, fmt.Errorf("error get pendidikan")
|
||||
|
||||
}
|
||||
etnisList, err := services.GetTerminologyList(models.TerminologyParamv0{AttributePath: "Person.etnicity", CodeSystem: "xhis.code.etnicity"})
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERRO GET ETNIS LIST",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return nil, nil, nil, nil, nil, nil, nil, fmt.Errorf("error get sapaan")
|
||||
|
||||
}
|
||||
idTypeList, err := services.GetTerminologyList(models.TerminologyParamv0{AttributePath: "Person.identifier.type", CodeSystem: "http://terminology.hl7.org/CodeSystem/v2-0203"})
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERRO GET ID TYPE LIST",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return nil, nil, nil, nil, nil, nil, nil, fmt.Errorf("error get tipe identitas")
|
||||
|
||||
}
|
||||
return sapaanList,
|
||||
genderList,
|
||||
goldarList,
|
||||
rhesusList,
|
||||
pendidikanList,
|
||||
etnisList,
|
||||
idTypeList,
|
||||
nil
|
||||
}
|
||||
|
||||
func (su *MdPasienServices) EditPasien(prm models.PasienFormServicesPrm) (string, error) {
|
||||
logger, _ := zap.NewProduction()
|
||||
tx := dbx.Handlex.MustBegin()
|
||||
var newFileName string
|
||||
if prm.Foto != nil {
|
||||
_, b, _, _ := runtime.Caller(0)
|
||||
basepath := filepath.Dir(b)
|
||||
println("Basepath")
|
||||
println(basepath)
|
||||
// defer logger.Sync()
|
||||
// logger.Info("FIlE",
|
||||
// zap.Any("filename", file.Filename),
|
||||
// )
|
||||
src, err := prm.Foto.Open()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("error open file")
|
||||
}
|
||||
defer src.Close()
|
||||
ext := filepath.Ext(prm.Foto.Filename)
|
||||
newFileName = utils.GenerateRandomID(prm.Foto.Filename) + ext
|
||||
uploadDir := filepath.Join(basepath, "..", "..", "uploads", "patient")
|
||||
println(uploadDir)
|
||||
// Menentukan path file tujuan
|
||||
dstPath := filepath.Join(uploadDir, newFileName)
|
||||
// Membuat direktori jika belum ada
|
||||
if err := os.MkdirAll(uploadDir, os.ModePerm); err != nil {
|
||||
return "", fmt.Errorf("error mkdir")
|
||||
}
|
||||
// Membuka file tujuan
|
||||
dst, err := os.Create(dstPath)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("error create file")
|
||||
}
|
||||
defer dst.Close()
|
||||
// Menyalin konten file yang diupload ke file tujuan
|
||||
if _, err = io.Copy(dst, src); err != nil {
|
||||
return "", fmt.Errorf("error copy file")
|
||||
}
|
||||
}
|
||||
updateFotoPath := ""
|
||||
if newFileName != "" {
|
||||
updateFotoPath = "M_PatientPhoto = '" + newFileName + "',"
|
||||
}
|
||||
gender := strings.Trim(prm.Gender, "@")
|
||||
bloodType := []string{}
|
||||
if prm.Goldar == "" {
|
||||
bloodType = append(bloodType, "")
|
||||
bloodType = append(bloodType, "")
|
||||
} else {
|
||||
bloodType = strings.Split(prm.Goldar, "@")
|
||||
if prm.Goldar != "" && len(bloodType) != 2 {
|
||||
tx.Rollback()
|
||||
defer logger.Sync()
|
||||
logger.Error("Error split bloodtype",
|
||||
zap.Any("blood Type", bloodType),
|
||||
)
|
||||
return "", fmt.Errorf("error bloodtype")
|
||||
}
|
||||
}
|
||||
rhesus := []string{}
|
||||
if prm.Rhesus == "" {
|
||||
rhesus = append(rhesus, "")
|
||||
rhesus = append(rhesus, "")
|
||||
} else {
|
||||
rhesus = strings.Split(prm.Rhesus, "@")
|
||||
if prm.Rhesus != "" && len(rhesus) != 2 {
|
||||
tx.Rollback()
|
||||
defer logger.Sync()
|
||||
logger.Error("Error split rhesus",
|
||||
zap.Any("blood Type", rhesus),
|
||||
)
|
||||
return "", fmt.Errorf("error rhesus")
|
||||
}
|
||||
}
|
||||
education := []string{}
|
||||
if prm.Pendidikan == "" {
|
||||
education = append(education, "")
|
||||
education = append(education, "")
|
||||
} else {
|
||||
education = strings.Split(prm.Pendidikan, "@")
|
||||
if prm.Pendidikan != "" && len(education) != 2 {
|
||||
tx.Rollback()
|
||||
defer logger.Sync()
|
||||
logger.Error("Error split education",
|
||||
zap.Any("blood Type", education),
|
||||
)
|
||||
return "", fmt.Errorf("error education")
|
||||
}
|
||||
}
|
||||
etnis := []string{}
|
||||
if prm.Etnis == "" {
|
||||
etnis = append(etnis, "")
|
||||
etnis = append(etnis, "")
|
||||
} else {
|
||||
etnis = strings.Split(prm.Etnis, "@")
|
||||
if prm.Etnis != "" && len(etnis) != 2 {
|
||||
tx.Rollback()
|
||||
defer logger.Sync()
|
||||
logger.Error("Error split etnis",
|
||||
zap.Any("blood Type", etnis),
|
||||
)
|
||||
return "", fmt.Errorf("error etnis")
|
||||
}
|
||||
}
|
||||
identifier := strings.Split(prm.Identitas, "@")
|
||||
if len(identifier) != 2 {
|
||||
tx.Rollback()
|
||||
defer logger.Sync()
|
||||
logger.Error("Error split identifier",
|
||||
zap.Any("blood Type", identifier),
|
||||
)
|
||||
return "", fmt.Errorf("error identifier")
|
||||
}
|
||||
|
||||
query := `
|
||||
UPDATE m_patient
|
||||
SET
|
||||
M_PatientM_TitleID = ?,
|
||||
M_PatientPrefix = ?,
|
||||
M_PatientName = ?,
|
||||
M_PatientSuffix = ?,
|
||||
M_PatientGender = ?,
|
||||
M_PatientDOB = ?,
|
||||
M_PatientReligionCode = ?,
|
||||
M_PatientReligionSystem = ?,
|
||||
M_PatientBloodTypeCode = ?,
|
||||
M_PatientBloodTypeSystem = ?,
|
||||
M_PatientBloodRhCode = ?,
|
||||
M_PatientBloodRhSystem = ?,
|
||||
M_PatientEducationCode = ?,
|
||||
M_PatientEducationSystem = ?,
|
||||
M_PatientCitizenship = ?,
|
||||
M_PatientEtnicCode = ?,
|
||||
M_PatientEtnicSystem = ?,
|
||||
M_PatientIdentifierCode = ?,
|
||||
M_PatientIdentifierSystem = ?,
|
||||
M_PatientIdentifierValue = ?,
|
||||
M_PatientJob = ?,
|
||||
M_PatientPosisi = ?,
|
||||
M_PatientDivisi = ?,
|
||||
M_PatientHp = ?,
|
||||
M_PatientEmail = ?,
|
||||
` + updateFotoPath + `
|
||||
M_PatientAddress = ?,
|
||||
M_PatientAddressRegionalCd = ?,
|
||||
M_PatientAddressCity = ?,
|
||||
M_PatientAddressDistrict = ?,
|
||||
M_PatientAddressState = ?,
|
||||
M_PatientAddressCountry = ?,
|
||||
M_PatientCreatedUserID = ?
|
||||
WHERE M_PatientID = ?
|
||||
`
|
||||
|
||||
rst := tx.MustExec(query,
|
||||
prm.Sapaan,
|
||||
prm.Imbuhanawal,
|
||||
prm.Nama,
|
||||
prm.Imbuhanakhir,
|
||||
gender,
|
||||
prm.Dob,
|
||||
"",
|
||||
"",
|
||||
bloodType[0],
|
||||
bloodType[1],
|
||||
rhesus[0],
|
||||
rhesus[1],
|
||||
education[0],
|
||||
education[1],
|
||||
prm.Nationality,
|
||||
etnis[0],
|
||||
etnis[1],
|
||||
identifier[0],
|
||||
identifier[1],
|
||||
prm.Nomoridentitas,
|
||||
prm.Pekerjaan,
|
||||
prm.Posisi,
|
||||
prm.Departement,
|
||||
prm.Hp,
|
||||
prm.Email,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
prm.UserID,
|
||||
prm.PasienID,
|
||||
)
|
||||
_, err := rst.LastInsertId()
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
defer logger.Sync()
|
||||
logger.Error("Error update db",
|
||||
zap.Any("rows Affected", rst),
|
||||
zap.Any("Error", err.Error()),
|
||||
)
|
||||
return "", fmt.Errorf("error querying database: %v", err)
|
||||
}
|
||||
tx.Commit()
|
||||
return "", nil
|
||||
|
||||
}
|
||||
|
||||
42
utils/getage.utils.go
Normal file
42
utils/getage.utils.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
func daysInMonth(t time.Time) int {
|
||||
firstDayOfMonth := time.Date(t.Year(), t.Month(), 1, 0, 0, 0, 0, t.Location())
|
||||
firstDayOfNextMonth := firstDayOfMonth.AddDate(0, 1, 0)
|
||||
return int(firstDayOfNextMonth.Sub(firstDayOfMonth).Hours() / 24)
|
||||
}
|
||||
func CalculateStringAge(birthDateStr string) (int, int, int, error) {
|
||||
layout := "2006-01-02"
|
||||
birthDate, err := time.Parse(layout, birthDateStr)
|
||||
if err != nil {
|
||||
return 0, 0, 0, err
|
||||
}
|
||||
|
||||
currentDate := time.Now()
|
||||
if currentDate.Before(birthDate) {
|
||||
return 0, 0, 0, fmt.Errorf("birth date is in the future")
|
||||
}
|
||||
|
||||
years := currentDate.Year() - birthDate.Year()
|
||||
months := int(currentDate.Month() - birthDate.Month())
|
||||
days := currentDate.Day() - birthDate.Day()
|
||||
|
||||
// Adjust if current month and day are before birth month and day
|
||||
if days < 0 {
|
||||
previousMonth := currentDate.AddDate(0, -1, 0)
|
||||
days += daysInMonth(previousMonth)
|
||||
months--
|
||||
}
|
||||
|
||||
if months < 0 {
|
||||
years--
|
||||
months += 12
|
||||
}
|
||||
|
||||
return years, months, days, nil
|
||||
}
|
||||
@@ -98,78 +98,254 @@ templ CssMdPasien() {
|
||||
}
|
||||
|
||||
templ JsMdPasien() {
|
||||
<script>
|
||||
document.addEventListener('htmx:afterSwap', function(event) {
|
||||
// Reinitialize selectpicker after HTMX content swap
|
||||
$('.selectpicker').selectpicker('refresh');
|
||||
});
|
||||
|
||||
document.addEventListener('htmx:beforeRequest', function(event) {
|
||||
console.log("Before Request")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.target)
|
||||
|
||||
});
|
||||
<script type="text/javascript">
|
||||
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
document.addEventListener('htmx:afterSwap', function(event) {
|
||||
// Reinitialize selectpicker after HTMX content swap
|
||||
$('.selectpicker').selectpicker('refresh');
|
||||
});
|
||||
|
||||
document.addEventListener('htmx:beforeRequest', function(event) {
|
||||
console.log("Before Request")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.target)
|
||||
|
||||
});
|
||||
|
||||
document.addEventListener('htmx:afterRequest', function(event) {
|
||||
console.log("After Request")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.target)
|
||||
});
|
||||
document.addEventListener('htmx:historyCacheError', function(event) {
|
||||
console.log("Error History Cache Error")
|
||||
console.log(event.detail.cause)
|
||||
|
||||
});
|
||||
document.addEventListener('htmx:historyCacheMissError', function(event) {
|
||||
console.log("Error History Cache Miss Error")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.path)
|
||||
|
||||
});
|
||||
document.addEventListener('htmx:oobErrorNoTarget', function(event) {
|
||||
console.log("Error OOB No Target")
|
||||
console.log(event.detail.content)
|
||||
});
|
||||
document.addEventListener('htmx:onLoadError', function(event) {
|
||||
console.log("Error On Load")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.elt)
|
||||
console.log(event.detail.target)
|
||||
console.log(event.detail.exception)
|
||||
console.log(event.detail.requestConfig)
|
||||
});
|
||||
document.addEventListener('htmx:responseError', function(event) {
|
||||
console.log("Error Response")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.elt)
|
||||
console.log(event.detail.requestConfig)
|
||||
});
|
||||
document.addEventListener('htmx:sendError', function(event) {
|
||||
console.log("Error Send Error")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.elt)
|
||||
console.log(event.detail.requestConfig)
|
||||
});
|
||||
document.addEventListener('htmx:sseError', function(event) {
|
||||
console.log("Error Sse ")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.error)
|
||||
console.log(event.detail.source)
|
||||
});
|
||||
document.addEventListener('htmx:swapError', function(event) {
|
||||
console.log("Error Swap Error")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.elt)
|
||||
console.log("Target Swap: "+event.detail.target)
|
||||
console.log(event.detail.requestConfig)
|
||||
});
|
||||
document.addEventListener('htmx:targetError', function(event) {
|
||||
console.log("Error target")
|
||||
console.log(event.detail.elt)
|
||||
console.log("Target ID: "+event.detail.target)
|
||||
});
|
||||
htmx.onLoad(function(content) {
|
||||
const dobElement = document.querySelectorAll("input[name='dob']");
|
||||
const dayElement = document.querySelectorAll("input[name='hari']");
|
||||
const monthElement = document.querySelectorAll("input[name='bulan']");
|
||||
const yearElement = document.querySelectorAll("input[name='tahun']");
|
||||
|
||||
for(var i = 0; i < dobElement.length; i++) {
|
||||
dobElement[i].addEventListener("change", (event) => {
|
||||
try {
|
||||
todate= new Date();
|
||||
|
||||
|
||||
var age= [], fromdate= new Date(event.target.value),
|
||||
y= [todate.getFullYear(), fromdate.getFullYear()],
|
||||
ydiff= y[0]-y[1],
|
||||
m= [todate.getMonth(), fromdate.getMonth()],
|
||||
mdiff= m[0]-m[1],
|
||||
d= [todate.getDate(), fromdate.getDate()],
|
||||
ddiff= d[0]-d[1];
|
||||
|
||||
if(mdiff < 0 || (mdiff=== 0 && ddiff<0))--ydiff;
|
||||
if(mdiff<0) mdiff+= 12;
|
||||
if(ddiff<0){
|
||||
fromdate.setMonth(m[1]+1, 0);
|
||||
ddiff= fromdate.getDate()-d[1]+d[0];
|
||||
--mdiff;
|
||||
}
|
||||
if(ydiff> 0) age.push(ydiff+ ' year'+(ydiff> 1? 's ':' '));
|
||||
if(mdiff> 0) age.push(mdiff+ ' month'+(mdiff> 1? 's':''));
|
||||
if(ddiff> 0) age.push(ddiff+ ' day'+(ddiff> 1? 's':''));
|
||||
if(age.length>1) age.splice(age.length-1,0,' and ');
|
||||
for (var t = 0; t < yearElement.length; ++t) {
|
||||
yearElement[t].value = ydiff;
|
||||
}
|
||||
for (var m = 0; m < monthElement.length; ++m) {
|
||||
monthElement[m].value = mdiff;
|
||||
|
||||
}
|
||||
for (var d = 0; d < dayElement.length; ++d) {
|
||||
dayElement[d].value = ddiff;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// var tanggalLahir = event.target.value;
|
||||
// console.log("tgl lahir");
|
||||
// console.log(tanggalLahir);
|
||||
// const [ tahunLahir, bulanLahir, hariLahir] = tanggalLahir.split('-').map(Number);
|
||||
|
||||
// // Mendapatkan tanggal saat ini
|
||||
// const tanggalSekarang = new Date();
|
||||
// const tahunSekarang = tanggalSekarang.getFullYear();
|
||||
// const bulanSekarang = tanggalSekarang.getMonth() + 1; // getMonth() dimulai dari 0
|
||||
// const hariSekarang = tanggalSekarang.getDate();
|
||||
// console.log("Menghitung tahun, bulan, dan hari")
|
||||
|
||||
// // Menghitung tahun, bulan, dan hari
|
||||
// let tahunUmur = tahunSekarang - tahunLahir;
|
||||
// let bulanUmur = bulanSekarang - bulanLahir;
|
||||
// let hariUmur = hariSekarang - hariLahir;
|
||||
// console.log("bulanUmur < 0")
|
||||
|
||||
// // Jika bulan negatif, kurangi satu tahun dan tambah 12 bulan
|
||||
// if (bulanUmur < 0) {
|
||||
// tahunUmur--;
|
||||
// bulanUmur += 12;
|
||||
// }
|
||||
// console.log("hariUmur < 0")
|
||||
|
||||
// // Jika hari negatif, kurangi satu bulan dan tambahkan jumlah hari dari bulan sebelumnya
|
||||
// if (hariUmur < 0) {
|
||||
// bulanUmur--;
|
||||
|
||||
// // Mendapatkan jumlah hari dalam bulan sebelumnya
|
||||
// const bulanSebelumnya = bulanSekarang - 1 < 1 ? 12 : bulanSekarang - 1;
|
||||
// const tahunSebelumnya = bulanSebelumnya === 12 ? tahunSekarang - 1 : tahunSekarang;
|
||||
// hariUmur += new Date(tahunSebelumnya, bulanSebelumnya, 0).getDate();
|
||||
// }
|
||||
// console.log("sampai mau assign value")
|
||||
// for (var t = 0; t < yearElement.length; ++t) {
|
||||
// yearElement[t].value = tahunUmur;
|
||||
// }
|
||||
// for (var m = 0; m < monthElement.length; ++m) {
|
||||
// monthElement[m].value = bulanUmur;
|
||||
|
||||
// }
|
||||
// for (var d = 0; d < dayElement.length; ++d) {
|
||||
// dayElement[d].value = hariUmur;
|
||||
|
||||
// }
|
||||
// // yearElement[i].value = tahunUmur;
|
||||
// // monthElement[i].value = bulanUmur;
|
||||
// // dayElement[i].value = hariUmur;
|
||||
// console.log("tahunUmur "+ tahunUmur);
|
||||
// console.log("bukanUmur "+ bulanUmur);
|
||||
// console.log("hariUmur "+ hariUmur);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
function tentukanTanggalLahir(umurTahun, umurBulan, umurHari) {
|
||||
// Memecah tanggal sekarang menjadi tahun, bulan, dan hari
|
||||
var tanggalSekarang = new Date().toISOString().slice(0, 10)
|
||||
console.log("tanggal sekarang");
|
||||
console.log(tanggalSekarang);
|
||||
const [tahunSekarang, bulanSekarang, hariSekarang] = tanggalSekarang.split('-').map(Number);
|
||||
|
||||
|
||||
// Mengurangi umur dari tanggal sekarang
|
||||
let tahunLahir = tahunSekarang - umurTahun;
|
||||
let bulanLahir = bulanSekarang - umurBulan;
|
||||
let hariLahir = hariSekarang - umurHari;
|
||||
|
||||
// Jika hari negatif, kurangi satu bulan dan tambahkan jumlah hari dari bulan sebelumnya
|
||||
if (hariLahir < 0) {
|
||||
bulanLahir--;
|
||||
|
||||
// Mendapatkan jumlah hari dalam bulan sebelumnya
|
||||
const bulanSebelumnya = bulanSekarang - 1 < 1 ? 12 : bulanSekarang - 1;
|
||||
const tahunSebelumnya = bulanSebelumnya === 12 ? tahunSekarang - 1 : tahunSekarang;
|
||||
hariLahir += new Date(tahunSebelumnya, bulanSebelumnya, 0).getDate();
|
||||
}
|
||||
|
||||
// Jika bulan negatif, kurangi satu tahun dan tambahkan 12 bulan
|
||||
if (bulanLahir < 0) {
|
||||
tahunLahir--;
|
||||
bulanLahir += 12;
|
||||
}
|
||||
|
||||
// Mengembalikan tanggal lahir dalam format YYYY-MM-DD
|
||||
return `${tahunLahir}-${String(bulanLahir).padStart(2, '0')}-${String(hariLahir).padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
dayElement[0].addEventListener("change", (event) => {
|
||||
const tgll = tentukanTanggalLahir(yearElement[0].value, monthElement[0].value, dayElement[0].value);
|
||||
console.log(`Tanggal Lahir: ${tgll}`);
|
||||
dobElement[0].value = tgll
|
||||
});
|
||||
monthElement[0].addEventListener("change", (event) => {
|
||||
const tgll = tentukanTanggalLahir(yearElement[0].value, monthElement[0].value, dayElement[0].value);
|
||||
console.log(`Tanggal Lahir: ${tgll}`);
|
||||
dobElement[0].value = tgll
|
||||
|
||||
});
|
||||
yearElement[0].addEventListener("change", (event) => {
|
||||
const tgll = tentukanTanggalLahir(yearElement[0].value, monthElement[0].value, dayElement[0].value);
|
||||
console.log(`Tanggal Lahir: ${tgll}`);
|
||||
dobElement[0].value = tgll
|
||||
});
|
||||
dayElement[1].addEventListener("change", (event) => {
|
||||
const tgll = tentukanTanggalLahir(yearElement[1].value, monthElement[1].value, dayElement[1].value);
|
||||
console.log(`Tanggal Lahir: ${tgll}`);
|
||||
dobElement[1].value = tgll
|
||||
});
|
||||
monthElement[1].addEventListener("change", (event) => {
|
||||
const tgll = tentukanTanggalLahir(yearElement[1].value, monthElement[1].value, dayElement[1].value);
|
||||
console.log(`Tanggal Lahir: ${tgll}`);
|
||||
dobElement[1].value = tgll
|
||||
|
||||
});
|
||||
yearElement[1].addEventListener("change", (event) => {
|
||||
const tgll = tentukanTanggalLahir(yearElement[1].value, monthElement[1].value, dayElement[1].value);
|
||||
console.log(`Tanggal Lahir: ${tgll}`);
|
||||
dobElement[1].value = tgll
|
||||
});
|
||||
});
|
||||
|
||||
document.addEventListener('htmx:afterRequest', function(event) {
|
||||
console.log("After Request")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.target)
|
||||
});
|
||||
document.addEventListener('htmx:historyCacheError', function(event) {
|
||||
console.log("Error History Cache Error")
|
||||
console.log(event.detail.cause)
|
||||
|
||||
});
|
||||
document.addEventListener('htmx:historyCacheMissError', function(event) {
|
||||
console.log("Error History Cache Miss Error")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.path)
|
||||
|
||||
});
|
||||
document.addEventListener('htmx:oobErrorNoTarget', function(event) {
|
||||
console.log("Error OOB No Target")
|
||||
console.log(event.detail.content)
|
||||
});
|
||||
document.addEventListener('htmx:onLoadError', function(event) {
|
||||
console.log("Error On Load")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.elt)
|
||||
console.log(event.detail.target)
|
||||
console.log(event.detail.exception)
|
||||
console.log(event.detail.requestConfig)
|
||||
});
|
||||
document.addEventListener('htmx:responseError', function(event) {
|
||||
console.log("Error Response")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.elt)
|
||||
console.log(event.detail.requestConfig)
|
||||
});
|
||||
document.addEventListener('htmx:sendError', function(event) {
|
||||
console.log("Error Send Error")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.elt)
|
||||
console.log(event.detail.requestConfig)
|
||||
});
|
||||
document.addEventListener('htmx:sseError', function(event) {
|
||||
console.log("Error Sse ")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.error)
|
||||
console.log(event.detail.source)
|
||||
});
|
||||
document.addEventListener('htmx:swapError', function(event) {
|
||||
console.log("Error Swap Error")
|
||||
console.log(event.detail.xhr)
|
||||
console.log(event.detail.elt)
|
||||
console.log("Target Swap: "+event.detail.target)
|
||||
console.log(event.detail.requestConfig)
|
||||
});
|
||||
document.addEventListener('htmx:targetError', function(event) {
|
||||
console.log("Error target")
|
||||
console.log(event.detail.elt)
|
||||
console.log("Target ID: "+event.detail.target)
|
||||
});
|
||||
</script>
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
}
|
||||
|
||||
script BeforeRequestContent() {
|
||||
|
||||
File diff suppressed because one or more lines are too long
585
views/dev/mdpasien/mdpasienformmodal.templ
Normal file
585
views/dev/mdpasien/mdpasienformmodal.templ
Normal file
@@ -0,0 +1,585 @@
|
||||
package dev_mdpasienview
|
||||
|
||||
import "cpone/models"
|
||||
import "cpone/component/modal"
|
||||
import "cpone/component/customdatepicker"
|
||||
import "cpone/component/customdropdown"
|
||||
import "cpone/component/customtextfield"
|
||||
import "strconv"
|
||||
import "cpone/component/customuploadfoto"
|
||||
|
||||
templ PasienForm(data models.PasienFormComponent) {
|
||||
<div class="">
|
||||
<form
|
||||
id={ data.IDComponent }
|
||||
hx-encoding="multipart/form-data"
|
||||
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.ModalXL(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 TmpisiDD() {
|
||||
<option>a</option>
|
||||
}
|
||||
|
||||
templ ListItemSapaan(
|
||||
dataStation []models.SapaanPasien,
|
||||
selected int) {
|
||||
for _, v := range dataStation {
|
||||
if v.M_TitleID == selected {
|
||||
<option value={ strconv.Itoa(v.M_TitleID) } selected="selected">{ v.M_TitleName }</option>
|
||||
} else {
|
||||
<option value={ strconv.Itoa(v.M_TitleID) }>{ v.M_TitleName }</option>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
templ ListItemTerminology(
|
||||
dataStation []models.TerminologyV0,
|
||||
selected string) {
|
||||
for _, v := range dataStation {
|
||||
if (v.Code + "@" + v.CodeSystem) == selected {
|
||||
<option value={ v.Code + "@" + v.CodeSystem } selected="selected">{ v.Display }</option>
|
||||
} else {
|
||||
<option value={ v.Code + "@" + v.CodeSystem }>{ v.Display }</option>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
templ BodyFormPasien(prm models.PasineFormBodyComponent) {
|
||||
<div id={ prm.IDForm } hx-swap-oob={ prm.HxSwapOOB } hx-on::load={ prm.HxOnLoad }>
|
||||
<div class="container p-0">
|
||||
<div class="row">
|
||||
<div class="col-lg-10">
|
||||
<!--begin::Row 1-->
|
||||
<div class="form-row">
|
||||
<div class="col-md-6 col-lg-2">
|
||||
@customdropdown.CustomDropdownForm(models.CustomDropdownV2Prm{
|
||||
Name: "sapaan",
|
||||
Label: "Sapaan",
|
||||
Placeholder: "Sapaan",
|
||||
ErrorMsg: prm.SapaanErr,
|
||||
ListItem: prm.SapaanItems})
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-3">
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{
|
||||
Label: "Imbuhan Awal",
|
||||
Name: "imbuhanawal",
|
||||
Placeholder: "Imbuhan Awal",
|
||||
Type: "text",
|
||||
Value: prm.ImbuhanAwalVal,
|
||||
ErrorMsg: prm.ImbuhanAwalErr})
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-5">
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{
|
||||
Label: "Nama",
|
||||
Name: "nama",
|
||||
Placeholder: "Nama",
|
||||
Type: "text",
|
||||
Value: prm.NamaVal,
|
||||
ErrorMsg: prm.NamaErr})
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-2">
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{
|
||||
Label: "Imbuhan Akhir",
|
||||
Name: "imbuhanakhir",
|
||||
Placeholder: "Imbuhan Akhir",
|
||||
Type: "text",
|
||||
Value: prm.ImbuhanAkhirVal,
|
||||
ErrorMsg: prm.ImbuhanAkhirErr})
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Row 1-->
|
||||
<!--begin::Row 2-->
|
||||
<div class="row mt-5">
|
||||
<div class="col-md-6">
|
||||
<!-- begin::Jenis Kelamin -->
|
||||
@customdropdown.CustomDropdownForm(models.CustomDropdownV2Prm{
|
||||
Name: "gender",
|
||||
Label: "Jenis Kelamin",
|
||||
Placeholder: "Jenis Kelamin",
|
||||
ErrorMsg: prm.GenderErr,
|
||||
ListItem: prm.GenderItems})
|
||||
<!-- end::Jenis Kelamin -->
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<!-- begin::Tanggal Lahir -->
|
||||
@customdatepicker.CustomDatePickerV2(models.CustomDatePickerPrm{Label: "Tanggal Lahir",
|
||||
Name: "dob",
|
||||
Placeholder: "Tanggal lahir",
|
||||
Value: prm.DobVal,
|
||||
|
||||
ErrorMsg: prm.DobErr,
|
||||
})
|
||||
<!-- end::Tanggal Lahir -->
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Row 2-->
|
||||
<!--begin::Row 3-->
|
||||
<div class="row mt-5">
|
||||
<div class="col-lg-6">
|
||||
<!-- begin::Umur -->
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{
|
||||
|
||||
Label: "Tahun",
|
||||
Name: "tahun",
|
||||
Placeholder: "Tahun",
|
||||
Type: "number",
|
||||
Value: prm.YearVal,
|
||||
ErrorMsg: prm.YearErr})
|
||||
</div>
|
||||
<div class="col">
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{
|
||||
|
||||
Label: "Bulan",
|
||||
Name: "bulan",
|
||||
Placeholder: "Bulan",
|
||||
Min: "0",
|
||||
Max: "12",
|
||||
Type: "number",
|
||||
Value: prm.MonthVal,
|
||||
ErrorMsg: prm.MonthErr})
|
||||
</div>
|
||||
<div class="col">
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{
|
||||
|
||||
Label: "Hari",
|
||||
Name: "hari",
|
||||
Placeholder: "Hari",
|
||||
Type: "number",
|
||||
Min: "0",
|
||||
Max: "31",
|
||||
Value: prm.DayVal,
|
||||
ErrorMsg: prm.DayErr})
|
||||
</div>
|
||||
</div>
|
||||
<!-- end::Umur -->
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<!-- begin::Darah -->
|
||||
<div class="form-row">
|
||||
<!-- begin::Golongan Darah -->
|
||||
<div class="col">
|
||||
@customdropdown.CustomDropdownForm(models.CustomDropdownV2Prm{
|
||||
Name: "goldar",
|
||||
Label: "Golongan Darah",
|
||||
Placeholder: "Golongan Darah",
|
||||
ErrorMsg: prm.GoldarErr,
|
||||
ListItem: prm.GoldarItems})
|
||||
</div>
|
||||
<!-- end::Golongan Darah -->
|
||||
<!-- begin::Rhesus -->
|
||||
<div class="col">
|
||||
@customdropdown.CustomDropdownForm(models.CustomDropdownV2Prm{
|
||||
Name: "rhesus",
|
||||
Label: "Rhesus",
|
||||
Placeholder: "Rhesus",
|
||||
ErrorMsg: prm.RhesusErr,
|
||||
ListItem: prm.RhesusItems})
|
||||
</div>
|
||||
<!-- end::Rhesus -->
|
||||
</div>
|
||||
<!-- end::Darah -->
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Row 3-->
|
||||
<!--begin::Row 4-->
|
||||
<div class="row mt-5">
|
||||
<!--begin::Pekerjaan-->
|
||||
<div class="col-md-6">
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{
|
||||
Label: "Pekerjaan",
|
||||
Name: "pekerjaan",
|
||||
Placeholder: "Pekerjaan",
|
||||
Type: "text",
|
||||
Value: prm.PekerjaanVal,
|
||||
ErrorMsg: prm.PekerjaanErr})
|
||||
</div>
|
||||
<!--end::Pekerjaan-->
|
||||
<!--begin::Departemen-->
|
||||
<div class="col-md-6">
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{
|
||||
Label: "Departement",
|
||||
Name: "departement",
|
||||
Placeholder: "Departement",
|
||||
Type: "text",
|
||||
Value: prm.DepartementVal,
|
||||
ErrorMsg: prm.DepartementErr})
|
||||
</div>
|
||||
<!--end::Departemen-->
|
||||
</div>
|
||||
<!--end::Row 4-->
|
||||
<!--begin::Row 5-->
|
||||
<div class="row mt-5">
|
||||
<!--begin::Posisi-->
|
||||
<div class="col-md-6">
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{
|
||||
Label: "Posisi",
|
||||
Name: "posisi",
|
||||
Placeholder: "Posisi",
|
||||
Type: "text",
|
||||
Value: prm.PosisiVal,
|
||||
ErrorMsg: prm.PosisiErr})
|
||||
</div>
|
||||
<!--end::Posisi-->
|
||||
<!--Begin::Pendidikan Terakhir-->
|
||||
<div class="col-md-6">
|
||||
@customdropdown.CustomDropdownForm(models.CustomDropdownV2Prm{
|
||||
Name: "pendidikan",
|
||||
Label: "Pendidikan Terakhir",
|
||||
Placeholder: "Pendidikan Terakhir",
|
||||
ErrorMsg: prm.PendidikanErr,
|
||||
ListItem: prm.PendidikanItems})
|
||||
</div>
|
||||
<!--end::Pendidikan Terakhir-->
|
||||
</div>
|
||||
<!--end::Row 5-->
|
||||
<!--begin::Row 6-->
|
||||
<div class="row mt-5">
|
||||
<!--begin::Kewarganegaraan-->
|
||||
<div class="col-md-6">
|
||||
<div class="form-row">
|
||||
<label
|
||||
for="input1"
|
||||
style="font-family: Poppins; font-weight: 600;"
|
||||
>Kewarganegaraan</label>
|
||||
<div class="form-control border-0 h-auto p-0 mt-3">
|
||||
<div class="form-group">
|
||||
<div
|
||||
class="justify-content-around"
|
||||
style="display: flex; gap: 20px;"
|
||||
>
|
||||
<label
|
||||
style="display: flex; align-items: center; gap: 5px;"
|
||||
>
|
||||
<input
|
||||
type="radio"
|
||||
if prm.CitizenshipVal == "WNI" {
|
||||
checked="checked"
|
||||
}
|
||||
if prm.CitizenshipVal == "" {
|
||||
checked="checked"
|
||||
}
|
||||
name="nationality"
|
||||
value="WNI"
|
||||
/>
|
||||
<p style="margin: 0;">WNI</p>
|
||||
</label>
|
||||
<label
|
||||
style="display: flex; align-items: center; gap: 5px;"
|
||||
>
|
||||
<input
|
||||
type="radio"
|
||||
if prm.CitizenshipVal == "WNA" {
|
||||
checked="checked"
|
||||
}
|
||||
name="nationality"
|
||||
value="WNA"
|
||||
/>
|
||||
<p style="margin: 0;">WNA</p>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Kewarganegaraan-->
|
||||
<!--Begin::Etnis-->
|
||||
<div class="col-md-6">
|
||||
@customdropdown.CustomDropdownForm(models.CustomDropdownV2Prm{
|
||||
Name: "etnis",
|
||||
Label: "Etnis",
|
||||
Placeholder: "Etnis",
|
||||
ErrorMsg: prm.EtnisErr,
|
||||
ListItem: prm.EtnisItems})
|
||||
</div>
|
||||
<!--end::Etnis-->
|
||||
</div>
|
||||
<!--end::Row 6-->
|
||||
<!--begin::Row 7-->
|
||||
<div class="row mt-5">
|
||||
<!--begin::Identitas-->
|
||||
<div class="col-md-6">
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
@customdropdown.CustomDropdownForm(models.CustomDropdownV2Prm{
|
||||
Name: "identitas",
|
||||
Label: "Identitas",
|
||||
Placeholder: "Identitas",
|
||||
ErrorMsg: prm.IDErr,
|
||||
ListItem: prm.IDItems})
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Identitas-->
|
||||
<!--Begin::Nomor Identitas-->
|
||||
<div class="col-md-6">
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{
|
||||
Label: "Nomor Identitas",
|
||||
Name: "nomoridentitas",
|
||||
Placeholder: "Nomor Identitas",
|
||||
Type: "text",
|
||||
Value: prm.NoIDhVal,
|
||||
ErrorMsg: prm.NoIDErr})
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Nomor Identitas-->
|
||||
</div>
|
||||
<!--end::Row 7-->
|
||||
<!--begin::Row 8-->
|
||||
<div class="row mt-5">
|
||||
<!--begin::Nomor Hp-->
|
||||
<div class="col-md-6">
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{
|
||||
Label: "Nomor Hp",
|
||||
Name: "hp",
|
||||
Placeholder: "Nomor Hp",
|
||||
Type: "text",
|
||||
Value: prm.HpVal,
|
||||
ErrorMsg: prm.HpErr})
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Nomor Hp-->
|
||||
<!--Begin::Email-->
|
||||
<div class="col-md-6">
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{
|
||||
Label: "Email",
|
||||
Name: "email",
|
||||
Placeholder: "email",
|
||||
Type: "text",
|
||||
Value: prm.EmailVal,
|
||||
ErrorMsg: prm.EmailErr})
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--end::Email-->
|
||||
</div>
|
||||
<!--end::Row 8-->
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<!-- person.png start -->
|
||||
// <div class="row">
|
||||
// <div class="col">
|
||||
// <img
|
||||
// src="asset-corporate-portal/media/person/person.png"
|
||||
// />
|
||||
// // style="display: block; width: 13vw;"
|
||||
// </div>
|
||||
// </div>
|
||||
// <div class="row mt-5">
|
||||
// <div class="col">
|
||||
// <button
|
||||
// class="btn bg-primary-transparent text-center text-primary"
|
||||
// >
|
||||
// // style="width: 13vw; font-weight: 600;"
|
||||
// Update Foto
|
||||
// </button>
|
||||
// </div>
|
||||
// </div>
|
||||
// <div>
|
||||
// <div class="text-center">
|
||||
// <img
|
||||
// id="preview-image"
|
||||
// if prm.LinkFoto == "" {
|
||||
// src="asset-corporate-portal/media/person/person.png"
|
||||
// } else {
|
||||
// src={ prm.LinkFoto }
|
||||
// }
|
||||
// class="rounded-lg"
|
||||
// alt="..."
|
||||
// style="width: 10vw; min-width: 100px;"
|
||||
// />
|
||||
// </div>
|
||||
// <label for="file-upload" class="btn btn-light-primary d-block mt-5">
|
||||
// Update Foto
|
||||
// </label>
|
||||
// <input
|
||||
// id="file-upload"
|
||||
// style="display: none;"
|
||||
// name="pasienprofile"
|
||||
// type="file"
|
||||
// accept=".png, .jpg, .jpeg"
|
||||
// onchange={ OnSelect() }
|
||||
// hx-on::load={ OnSelect() }
|
||||
// />
|
||||
// </div>
|
||||
<div>
|
||||
@customuploadfoto.CustomUploadFotoWithPreview(models.CustomUploadFotoPrm{
|
||||
ID: prm.IDComponentUpload,
|
||||
Name: "pasienprofile",
|
||||
Accept: ".png, .jpg, .jpeg",
|
||||
Label: "Update Foto",
|
||||
LinkFoto: prm.LinkFoto,
|
||||
})
|
||||
</div>
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "pasienid",
|
||||
Name: "pasienid",
|
||||
Type: "hidden",
|
||||
Value: prm.IDPasien})
|
||||
<!-- person.png end -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
script JsHideModal(modalID string) {
|
||||
$(modalID).modal('hide')
|
||||
}
|
||||
|
||||
script OnSelect() {
|
||||
const fileInput = document.getElementById("file-upload");
|
||||
|
||||
const previewImage = document.getElementById("preview-image");
|
||||
|
||||
if (fileInput.files.length > 0) {
|
||||
if (fileInput.files[0].size > 500000) {
|
||||
fileInput.value = "";
|
||||
Swal.fire("Warning", "File is too big!", "warning");
|
||||
} else {
|
||||
previewImage.src = URL.createObjectURL(fileInput.files[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// 👇️ reset file input once you're done
|
||||
|
||||
}
|
||||
|
||||
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 ActionFormPasien(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 BtnCloseFormPasien(LinkClose string, targetClose string, hxSwapClose string, modalID string) {
|
||||
<button
|
||||
hx-post={ LinkClose }
|
||||
hx-target={ targetClose }
|
||||
hx-swap={ hxSwapClose }
|
||||
type="button"
|
||||
hx-on::after-request={ JsHideModal(modalID) }
|
||||
class="close btnactcancel"
|
||||
data-dismiss="modal"
|
||||
aria-label="Close"
|
||||
>
|
||||
<i aria-hidden="true" class="ki ki-close"></i>
|
||||
</button>
|
||||
}
|
||||
|
||||
templ DeleteConfirmationBody(inputId string,
|
||||
componentID string,
|
||||
message string,
|
||||
datHeader []string,
|
||||
dataText []string,
|
||||
hxOnLoad templ.ComponentScript) {
|
||||
<div id={ componentID } hx-on::load={ hxOnLoad }>
|
||||
<p>{ message }</p>
|
||||
<div class="card rounded-lg">
|
||||
<div class="card-body d-flex flex-row">
|
||||
<div class="d-flex flex-column">
|
||||
for _, v := range datHeader {
|
||||
<div class="mb-1 mt-1 text-disabled font-weight-bold mr-5">{ v }</div>
|
||||
}
|
||||
</div>
|
||||
<div class="d-flex flex-column ">
|
||||
for _, v := range dataText {
|
||||
<div class="mb-1 mt-1 font-weight-bold">
|
||||
{ v }
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{Name: "pasienid", ID: "pasienid", Type: "hidden", Value: inputId})
|
||||
</div>
|
||||
}
|
||||
1116
views/dev/mdpasien/mdpasienformmodal_templ.go
Normal file
1116
views/dev/mdpasien/mdpasienformmodal_templ.go
Normal file
File diff suppressed because it is too large
Load Diff
@@ -43,7 +43,7 @@ templ RowPasien(data []models.Pasien,
|
||||
) {
|
||||
if len(data) == 0 {
|
||||
<tr>
|
||||
<td colspan="4" class="text-center">Data Tidak Ditemukan</td>
|
||||
<td colspan="5" class="text-center">Data Tidak Ditemukan</td>
|
||||
</tr>
|
||||
}
|
||||
for _, v := range data {
|
||||
|
||||
@@ -103,7 +103,7 @@ func RowPasien(data []models.Pasien,
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
if len(data) == 0 {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<tr><td colspan=\"4\" class=\"text-center\">Data Tidak Ditemukan</td></tr>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<tr><td colspan=\"5\" class=\"text-center\">Data Tidak Ditemukan</td></tr>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user