From b278020911f1596e6e71a0bf684d67a60b07b8b3 Mon Sep 17 00:00:00 2001 From: Sas Andy Date: Fri, 3 May 2024 16:45:58 +0700 Subject: [PATCH 01/12] custom buton tosca --- .../asset-corporate-portal/css/sas.bundle.css | 569 +++++++++++++++++- 1 file changed, 568 insertions(+), 1 deletion(-) diff --git a/assets/asset-corporate-portal/css/sas.bundle.css b/assets/asset-corporate-portal/css/sas.bundle.css index dad9a39..4a6dafd 100644 --- a/assets/asset-corporate-portal/css/sas.bundle.css +++ b/assets/asset-corporate-portal/css/sas.bundle.css @@ -193,7 +193,7 @@ a.text-white:focus { background-color: var(--grey) !important; } .bg-header-table { - background-color: var(--text-header-table) !important; + background-color: var(--header-table-bg) !important; } .bg-primary { background-color: var(--primary) !important; @@ -565,6 +565,39 @@ a.text-white:focus { -webkit-box-shadow: 0 0 0 0.2rem rgba(54, 153, 255, 0.5); box-shadow: 0 0 0 0.2rem rgba(54, 153, 255, 0.5); } +/* ## BUTTON OUTLINE TOSCA*/ +.btn-outline-tosca { + color: var(--tosca) !important; + border-color: var(--tosca) !important; +} +.btn-outline-tosca:hover { + color: #ffffff !important; + background-color: var(--tosca) !important; + border-color: var(--tosca) !important; +} +.btn-outline-tosca:focus, +.btn-outline-tosca.focus { + -webkit-box-shadow: 0 0 0 0.2rem rgba(54, 153, 255, 0.5); + box-shadow: 0 0 0 0.2rem rgba(54, 153, 255, 0.5); +} +.btn-outline-tosca.disabled, +.btn-outline-tosca:disabled { + color: var(--tosca) !important; + background-color: transparent; +} +.btn-outline-tosca:not(:disabled):not(.disabled):active, +.btn-outline-tosca:not(:disabled):not(.disabled).active, +.show > .btn-outline-tosca.dropdown-toggle { + color: #ffffff !important; + background-color: var(--tosca) !important; + border-color: var(--tosca) !important; +} +.btn-outline-tosca:not(:disabled):not(.disabled):active:focus, +.btn-outline-tosca:not(:disabled):not(.disabled).active:focus, +.show > .btn-outline-tosca.dropdown-toggle:focus { + -webkit-box-shadow: 0 0 0 0.2rem rgba(54, 153, 255, 0.5); + box-shadow: 0 0 0 0.2rem rgba(54, 153, 255, 0.5); +} /* ## BUTTON OUTLINE SECONDARY*/ .btn-outline-secondary { @@ -919,6 +952,147 @@ a.text-white:focus { .show .btn.btn-light-primary.btn-dropdown.dropdown-toggle:after { color: #ffffff !important; } + +/* ## BUTTON LIGHT TOSCA*/ + +.btn.btn-light-tosca { + color: var(--tosca) !important; + background-color: var(--toscabg) !important; + border-color: transparent; +} +.btn.btn-light-tosca i { + color: var(--tosca) !important; +} +.btn.btn-light-tosca .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--tosca) !important; +} +.btn.btn-light-tosca .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-light-tosca.dropdown-toggle:after { + color: var(--tosca) !important; +} +.btn.btn-light-tosca:hover:not(.btn-text):not(:disabled):not(.disabled), +.btn.btn-light-tosca:focus:not(.btn-text), +.btn.btn-light-tosca.focus:not(.btn-text) { + color: #ffffff !important; + background-color: var(--tosca) !important; + border-color: transparent; +} +.btn.btn-light-tosca:hover:not(.btn-text):not(:disabled):not(.disabled) i, +.btn.btn-light-tosca:focus:not(.btn-text) i, +.btn.btn-light-tosca.focus:not(.btn-text) i { + color: #ffffff !important; +} +.btn.btn-light-tosca:hover:not(.btn-text):not(:disabled):not(.disabled) + .svg-icon + svg + g + [fill], +.btn.btn-light-tosca:focus:not(.btn-text) .svg-icon svg g [fill], +.btn.btn-light-tosca.focus:not(.btn-text) .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: #ffffff !important; +} +.btn.btn-light-tosca:hover:not(.btn-text):not(:disabled):not(.disabled) + .svg-icon + svg:hover + g + [fill], +.btn.btn-light-tosca:focus:not(.btn-text) .svg-icon svg:hover g [fill], +.btn.btn-light-tosca.focus:not(.btn-text) .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-light-tosca:hover:not(.btn-text):not(:disabled):not( + .disabled + ).dropdown-toggle:after, +.btn.btn-light-tosca:focus:not(.btn-text).dropdown-toggle:after, +.btn.btn-light-tosca.focus:not(.btn-text).dropdown-toggle:after { + color: #ffffff !important; +} +.btn.btn-light-tosca.disabled, +.btn.btn-light-tosca:disabled { + color: var(--tosca) !important; + background-color: #e1f0ff; + border-color: transparent; +} +.btn.btn-light-tosca.disabled i, +.btn.btn-light-tosca:disabled i { + color: var(--tosca) !important; +} +.btn.btn-light-tosca.disabled .svg-icon svg g [fill], +.btn.btn-light-tosca:disabled .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--tosca) !important; +} +.btn.btn-light-tosca.disabled .svg-icon svg:hover g [fill], +.btn.btn-light-tosca:disabled .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-light-tosca.disabled.dropdown-toggle:after, +.btn.btn-light-tosca:disabled.dropdown-toggle:after { + color: var(--tosca) !important; +} +.btn.btn-light-tosca:not(:disabled):not(.disabled):active:not(.btn-text), +.btn.btn-light-tosca:not(:disabled):not(.disabled).active, +.show > .btn.btn-light-tosca.dropdown-toggle, +.show .btn.btn-light-tosca.btn-dropdown { + color: #ffffff !important; + background-color: var(--tosca) !important; + border-color: transparent; +} +.btn.btn-light-tosca:not(:disabled):not(.disabled):active:not(.btn-text) i, +.btn.btn-light-tosca:not(:disabled):not(.disabled).active i, +.show > .btn.btn-light-tosca.dropdown-toggle i, +.show .btn.btn-light-tosca.btn-dropdown i { + color: #ffffff !important; +} +.btn.btn-light-tosca:not(:disabled):not(.disabled):active:not(.btn-text) + .svg-icon + svg + g + [fill], +.btn.btn-light-tosca:not(:disabled):not(.disabled).active + .svg-icon + svg + g + [fill], +.show > .btn.btn-light-tosca.dropdown-toggle .svg-icon svg g [fill], +.show .btn.btn-light-tosca.btn-dropdown .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: #ffffff !important; +} +.btn.btn-light-tosca:not(:disabled):not(.disabled):active:not(.btn-text) + .svg-icon + svg:hover + g + [fill], +.btn.btn-light-tosca:not(:disabled):not(.disabled).active + .svg-icon + svg:hover + g + [fill], +.show > .btn.btn-light-tosca.dropdown-toggle .svg-icon svg:hover g [fill], +.show .btn.btn-light-tosca.btn-dropdown .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-light-tosca:not(:disabled):not(.disabled):active:not( + .btn-text + ).dropdown-toggle:after, +.btn.btn-light-tosca:not(:disabled):not(.disabled).active.dropdown-toggle:after, +.show > .btn.btn-light-tosca.dropdown-toggle.dropdown-toggle:after, +.show .btn.btn-light-tosca.btn-dropdown.dropdown-toggle:after { + color: #ffffff !important; +} /* ## BUTTON LIGHT SECONDARY*/ .btn.btn-light-secondary { @@ -1689,6 +1863,65 @@ a.text-white:focus { .show .btn.btn-hover-light-primary.btn-dropdown.dropdown-toggle:after { color: var(--primary) !important; } + +/* ## BUTTON HOVER LIGHT TOSCA*/ +.btn.btn-hover-light-tosca:not(:disabled):not(.disabled):active:not(.btn-text), +.btn.btn-hover-light-tosca:not(:disabled):not(.disabled).active, +.show > .btn.btn-hover-light-tosca.dropdown-toggle, +.show .btn.btn-hover-light-tosca.btn-dropdown { + color: var(--tosca) !important; + background-color: var(--toscabg) !important; + border-color: transparent; +} +.btn.btn-hover-light-tosca:not(:disabled):not(.disabled):active:not(.btn-text) + i, +.btn.btn-hover-light-tosca:not(:disabled):not(.disabled).active i, +.show > .btn.btn-hover-light-tosca.dropdown-toggle i, +.show .btn.btn-hover-light-tosca.btn-dropdown i { + color: var(--tosca) !important; +} +.btn.btn-hover-light-tosca:not(:disabled):not(.disabled):active:not(.btn-text) + .svg-icon + svg + g + [fill], +.btn.btn-hover-light-tosca:not(:disabled):not(.disabled).active + .svg-icon + svg + g + [fill], +.show > .btn.btn-hover-light-tosca.dropdown-toggle .svg-icon svg g [fill], +.show .btn.btn-hover-light-tosca.btn-dropdown .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--tosca) !important; +} +.btn.btn-hover-light-tosca:not(:disabled):not(.disabled):active:not(.btn-text) + .svg-icon + svg:hover + g + [fill], +.btn.btn-hover-light-tosca:not(:disabled):not(.disabled).active + .svg-icon + svg:hover + g + [fill], +.show > .btn.btn-hover-light-tosca.dropdown-toggle .svg-icon svg:hover g [fill], +.show .btn.btn-hover-light-tosca.btn-dropdown .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-hover-light-tosca:not(:disabled):not(.disabled):active:not( + .btn-text + ).dropdown-toggle:after, +.btn.btn-hover-light-tosca:not(:disabled):not( + .disabled + ).active.dropdown-toggle:after, +.show > .btn.btn-hover-light-tosca.dropdown-toggle.dropdown-toggle:after, +.show .btn.btn-hover-light-tosca.btn-dropdown.dropdown-toggle:after { + color: var(--tosca) !important; +} + /* ## BUTTON HOVER LIGHT SECONDARY*/ .btn.btn-hover-light-secondary:hover:not(.btn-text):not(:disabled):not( @@ -2286,6 +2519,15 @@ a.text-white:focus { color: var(--warning); } +/* ## BUTTON WARNING */ +.btn.btn-text-tosca { + color: var(--tosca); +} +.btn.btn-text-tosca.disabled, +.btn.btn-text-tosca:disabled { + color: var(--tosca); +} + /* ### BUTTON HOVER BG */ /* ## BUTTON HOVER BG PRIMARY */ .btn.btn-hover-bg-primary:hover:not(.btn-text):not(:disabled):not(.disabled), @@ -2378,6 +2620,23 @@ a.text-white:focus { background-color: var(--danger) !important; border-color: var(--danger) !important; } + +/* ## BUTTON HOVER BG TOSCA */ +.btn.btn-hover-bg-tosca:hover:not(.btn-text):not(:disabled):not(.disabled), +.btn.btn-hover-bg-tosca:focus:not(.btn-text), +.btn.btn-hover-bg-tosca.focus:not(.btn-text) { + background-color: var(--tosca) !important; + border-color: var(--tosca) !important; +} + +.btn.btn-hover-bg-tosca:not(:disabled):not(.disabled):active:not(.btn-text), +.btn.btn-hover-bg-tosca:not(:disabled):not(.disabled).active, +.show > .btn.btn-hover-bg-tosca.dropdown-toggle, +.show .btn.btn-hover-bg-tosca.btn-dropdown { + background-color: var(--tosca) !important; + border-color: var(--tosca) !important; +} + /* ### BUTTON HOVER */ /* ## BUTTON HOVER PRIMARY */ .btn.btn-hover-primary:hover:not(.btn-text):not(:disabled):not(.disabled), @@ -2960,6 +3219,101 @@ a.text-white:focus { .show .btn.btn-hover-warning.btn-dropdown.dropdown-toggle:after { color: #ffffff !important; } +/* ## BUTTON HOVER TOSCA */ +.btn.btn-hover-tosca:hover:not(.btn-text):not(:disabled):not(.disabled), +.btn.btn-hover-tosca:focus:not(.btn-text), +.btn.btn-hover-tosca.focus:not(.btn-text) { + color: #ffffff !important; + background-color: var(--tosca) !important; + border-color: var(--tosca) !important; +} +.btn.btn-hover-tosca:hover:not(.btn-text):not(:disabled):not(.disabled) i, +.btn.btn-hover-tosca:focus:not(.btn-text) i, +.btn.btn-hover-tosca.focus:not(.btn-text) i { + color: #ffffff !important; +} +.btn.btn-hover-tosca:hover:not(.btn-text):not(:disabled):not(.disabled) + .svg-icon + svg + g + [fill], +.btn.btn-hover-tosca:focus:not(.btn-text) .svg-icon svg g [fill], +.btn.btn-hover-tosca.focus:not(.btn-text) .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: #ffffff !important; +} +.btn.btn-hover-tosca:hover:not(.btn-text):not(:disabled):not(.disabled) + .svg-icon + svg:hover + g + [fill], +.btn.btn-hover-tosca:focus:not(.btn-text) .svg-icon svg:hover g [fill], +.btn.btn-hover-tosca.focus:not(.btn-text) .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-hover-tosca:hover:not(.btn-text):not(:disabled):not( + .disabled + ).dropdown-toggle:after, +.btn.btn-hover-tosca:focus:not(.btn-text).dropdown-toggle:after, +.btn.btn-hover-tosca.focus:not(.btn-text).dropdown-toggle:after { + color: #ffffff !important; +} + +.btn.btn-hover-tosca:not(:disabled):not(.disabled):active:not(.btn-text), +.btn.btn-hover-tosca:not(:disabled):not(.disabled).active, +.show > .btn.btn-hover-tosca.dropdown-toggle, +.show .btn.btn-hover-tosca.btn-dropdown { + color: #ffffff !important; + background-color: var(--tosca) !important; + border-color: var(--tosca) !important; +} +.btn.btn-hover-tosca:not(:disabled):not(.disabled):active:not(.btn-text) i, +.btn.btn-hover-tosca:not(:disabled):not(.disabled).active i, +.show > .btn.btn-hover-tosca.dropdown-toggle i, +.show .btn.btn-hover-tosca.btn-dropdown i { + color: #ffffff !important; +} +.btn.btn-hover-tosca:not(:disabled):not(.disabled):active:not(.btn-text) + .svg-icon + svg + g + [fill], +.btn.btn-hover-tosca:not(:disabled):not(.disabled).active + .svg-icon + svg + g + [fill], +.show > .btn.btn-hover-tosca.dropdown-toggle .svg-icon svg g [fill], +.show .btn.btn-hover-tosca.btn-dropdown .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: #ffffff !important; +} +.btn.btn-hover-tosca:not(:disabled):not(.disabled):active:not(.btn-text) + .svg-icon + svg:hover + g + [fill], +.btn.btn-hover-tosca:not(:disabled):not(.disabled).active + .svg-icon + svg:hover + g + [fill], +.show > .btn.btn-hover-tosca.dropdown-toggle .svg-icon svg:hover g [fill], +.show .btn.btn-hover-tosca.btn-dropdown .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-hover-tosca:not(:disabled):not(.disabled):active:not( + .btn-text + ).dropdown-toggle:after, +.btn.btn-hover-tosca:not(:disabled):not(.disabled).active.dropdown-toggle:after, +.show > .btn.btn-hover-tosca.dropdown-toggle.dropdown-toggle:after, +.show .btn.btn-hover-tosca.btn-dropdown.dropdown-toggle:after { + color: #ffffff !important; +} /* ### BUTTON LINK */ /* ## BUTTON LINK PRIMARY*/ @@ -3535,6 +3889,7 @@ a.text-white:focus { .show .btn.btn-link-info.btn-dropdown.dropdown-toggle:after { color: var(--info) !important; } + /* ## BUTTON LINK WARNING*/ .btn.btn-link-warning { border: 0; @@ -3679,6 +4034,7 @@ a.text-white:focus { .show .btn.btn-link-warning.btn-dropdown.dropdown-toggle:after { color: var(--warning) !important; } + /* ## BUTTON LINK DANGER*/ .btn.btn-link-danger { border: 0; @@ -3822,6 +4178,145 @@ a.text-white:focus { color: var(--danger) !important; } +/* ## BUTTON LINK TOSCA*/ +.btn.btn-link-tosca { + border: 0; + padding: 0 !important; + border-radius: 0 !important; + color: var(--tosca) !important; + background-color: transparent !important; + border-color: transparent !important; +} +.btn.btn-link-tosca i { + color: var(--tosca) !important; +} +.btn.btn-link-tosca .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--tosca) !important; +} +.btn.btn-link-tosca .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-link-tosca.dropdown-toggle:after { + color: var(--tosca) !important; +} +.btn.btn-link-tosca:hover:not(.btn-text):not(:disabled):not(.disabled), +.btn.btn-link-tosca:focus:not(.btn-text), +.btn.btn-link-tosca.focus:not(.btn-text) { + color: var(--tosca) !important; + background-color: transparent !important; + border-color: transparent !important; +} +.btn.btn-link-tosca:hover:not(.btn-text):not(:disabled):not(.disabled) i, +.btn.btn-link-tosca:focus:not(.btn-text) i, +.btn.btn-link-tosca.focus:not(.btn-text) i { + color: var(--tosca) !important; +} +.btn.btn-link-tosca:hover:not(.btn-text):not(:disabled):not(.disabled) + .svg-icon + svg + g + [fill], +.btn.btn-link-tosca:focus:not(.btn-text) .svg-icon svg g [fill], +.btn.btn-link-tosca.focus:not(.btn-text) .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--tosca) !important; +} +.btn.btn-link-tosca:hover:not(.btn-text):not(:disabled):not(.disabled) + .svg-icon + svg:hover + g + [fill], +.btn.btn-link-tosca:focus:not(.btn-text) .svg-icon svg:hover g [fill], +.btn.btn-link-tosca.focus:not(.btn-text) .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-link-tosca:hover:not(.btn-text):not(:disabled):not( + .disabled + ).dropdown-toggle:after, +.btn.btn-link-tosca:focus:not(.btn-text).dropdown-toggle:after, +.btn.btn-link-tosca.focus:not(.btn-text).dropdown-toggle:after { + color: var(--tosca) !important; +} +.btn.btn-link-tosca.disabled, +.btn.btn-link-tosca:disabled { + color: var(--tosca) !important; + background-color: transparent !important; + border-color: transparent !important; +} +.btn.btn-link-tosca.disabled i, +.btn.btn-link-tosca:disabled i { + color: var(--tosca) !important; +} +.btn.btn-link-tosca.disabled .svg-icon svg g [fill], +.btn.btn-link-tosca:disabled .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--tosca) !important; +} +.btn.btn-link-tosca.disabled .svg-icon svg:hover g [fill], +.btn.btn-link-tosca:disabled .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-link-tosca.disabled.dropdown-toggle:after, +.btn.btn-link-tosca:disabled.dropdown-toggle:after { + color: var(--tosca) !important; +} +.btn.btn-link-tosca:not(:disabled):not(.disabled):active:not(.btn-text), +.btn.btn-link-tosca:not(:disabled):not(.disabled).active, +.show > .btn.btn-link-tosca.dropdown-toggle, +.show .btn.btn-link-tosca.btn-dropdown { + color: var(--tosca) !important; + background-color: transparent !important; + border-color: transparent !important; +} +.btn.btn-link-tosca:not(:disabled):not(.disabled):active:not(.btn-text) i, +.btn.btn-link-tosca:not(:disabled):not(.disabled).active i, +.show > .btn.btn-link-tosca.dropdown-toggle i, +.show .btn.btn-link-tosca.btn-dropdown i { + color: var(--tosca) !important; +} +.btn.btn-link-tosca:not(:disabled):not(.disabled):active:not(.btn-text) + .svg-icon + svg + g + [fill], +.btn.btn-link-tosca:not(:disabled):not(.disabled).active .svg-icon svg g [fill], +.show > .btn.btn-link-tosca.dropdown-toggle .svg-icon svg g [fill], +.show .btn.btn-link-tosca.btn-dropdown .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--tosca) !important; +} +.btn.btn-link-tosca:not(:disabled):not(.disabled):active:not(.btn-text) + .svg-icon + svg:hover + g + [fill], +.btn.btn-link-tosca:not(:disabled):not(.disabled).active + .svg-icon + svg:hover + g + [fill], +.show > .btn.btn-link-tosca.dropdown-toggle .svg-icon svg:hover g [fill], +.show .btn.btn-link-tosca.btn-dropdown .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-link-tosca:not(:disabled):not(.disabled):active:not( + .btn-text + ).dropdown-toggle:after, +.btn.btn-link-tosca:not(:disabled):not(.disabled).active.dropdown-toggle:after, +.show > .btn.btn-link-tosca.dropdown-toggle.dropdown-toggle:after, +.show .btn.btn-link-tosca.btn-dropdown.dropdown-toggle:after { + color: var(--tosca) !important; +} + /* ### BUTTON SHADOW */ /* ## BUTTON SHADOW PRIMARY */ .btn.btn-primary.btn-shadow { @@ -4002,6 +4497,41 @@ a.text-white:focus { -webkit-box-shadow: 0px 9px 16px 0px rgba(var(--dangerrgb), var(--opacity03)) !important; box-shadow: 0px 9px 16px 0px rgba(var(--dangerrgb), var(--opacity03)) !important; } +/* ## BUTTON SHADOW TOSCA */ +.btn.btn-tosca.btn-shadow { + -webkit-box-shadow: 0px 9px 16px 0px rgba(var(--toscargb), var(--opacity02)) !important; + box-shadow: 0px 9px 16px 0px rgba(var(--toscargb), var(--opacity02)) !important; +} +.btn.btn-tosca.btn-shadow:hover:not(.btn-text):not(:disabled):not(.disabled), +.btn.btn-tosca.btn-shadow:focus:not(.btn-text), +.btn.btn-tosca.btn-shadow.focus:not(.btn-text) { + -webkit-box-shadow: 0px 9px 16px 0px rgba(var(--toscargb), var(--opacity03)) !important; + box-shadow: 0px 9px 16px 0px rgba(var(--toscargb), var(--opacity03)) !important; +} +.btn.btn-tosca.btn-shadow:not(:disabled):not(.disabled):active:not(.btn-text), +.btn.btn-tosca.btn-shadow:not(:disabled):not(.disabled).active, +.show > .btn.btn-tosca.btn-shadow.dropdown-toggle { + -webkit-box-shadow: 0px 9px 16px 0px rgba(var(--toscargb), var(--opacity03)) !important; + box-shadow: 0px 9px 16px 0px rgba(var(--toscargb), var(--opacity03)) !important; +} + +.btn.btn-tosca.btn-shadow-hover:hover:not(.btn-text):not(:disabled):not( + .disabled + ), +.btn.btn-tosca.btn-shadow-hover:focus:not(.btn-text), +.btn.btn-tosca.btn-shadow-hover.focus:not(.btn-text) { + -webkit-box-shadow: 0px 9px 16px 0px rgba(var(--toscargb), var(--opacity03)) !important; + box-shadow: 0px 9px 16px 0px rgba(var(--toscargb), var(--opacity03)) !important; +} + +.btn.btn-tosca.btn-shadow-hover:not(:disabled):not(.disabled):active:not( + .btn-text + ), +.btn.btn-tosca.btn-shadow-hover:not(:disabled):not(.disabled).active, +.show > .btn.btn-tosca.btn-shadow-hover.dropdown-toggle { + -webkit-box-shadow: 0px 9px 16px 0px rgba(var(--toscargb), var(--opacity03)) !important; + box-shadow: 0px 9px 16px 0px rgba(var(--toscargb), var(--opacity03)) !important; +} /* ## PRIMARY */ .btn.btn-hover-text-primary:not(:disabled):not(.disabled):active:not(.btn-text), @@ -4103,6 +4633,43 @@ a.text-white:focus { line-height: 22px !important; text-align: center !important; } +/* ### TABLE */ +/* ## BORDER RADIUS */ +table th { + background-color: var(--header-table-bg) !important; +} +th { + color: var(--text-header-table) !important; + font-family: Poppins !important; + font-size: 12px !important; + font-style: normal !important; + font-weight: 600 !important; + line-height: normal !important; + letter-spacing: 0.36px !important; +} +td { + color: var(--text-black) !important; + font-family: Poppins !important; + justify-content: center !important; + vertical-align: middle !important; + font-size: 14px !important; + font-style: normal !important; + font-weight: 600 !important; + line-height: normal !important; + padding-top: 20px !important; + padding-bottom: 20px !important; +} + +td:first-child, +th:first-child { + border-radius: 6px 0 0 6px !important; + padding-left: 20px !important; +} +td:last-child, +th:last-child { + border-radius: 0 6px 6px 0 !important; +} + /* ### BUTTON HOVER TEXT */ /* ### */ /* ## PRIMARY */ From 662382b50bf431e04e8db4de17e29cbacf1bb559 Mon Sep 17 00:00:00 2001 From: Sas Andy Date: Fri, 3 May 2024 16:54:04 +0700 Subject: [PATCH 02/12] user group table --- models/table.models.go | 1 + .../component/navbarmaster/navbarmaster.templ | 655 +++++++++++++++ .../navbarmaster/navbarmaster_templ.go | 138 ++++ views/layout/layout_corporate.templ | 177 ++++ views/layout/layout_corporate_templ.go | 73 ++ .../mastermenuusergroup.templ | 764 ++---------------- .../mastermenuusergroup_templ.go | 62 +- 7 files changed, 1138 insertions(+), 732 deletions(-) create mode 100644 models/table.models.go create mode 100644 views/component/navbarmaster/navbarmaster.templ create mode 100644 views/component/navbarmaster/navbarmaster_templ.go create mode 100644 views/layout/layout_corporate.templ create mode 100644 views/layout/layout_corporate_templ.go diff --git a/models/table.models.go b/models/table.models.go new file mode 100644 index 0000000..2640e7f --- /dev/null +++ b/models/table.models.go @@ -0,0 +1 @@ +package models diff --git a/views/component/navbarmaster/navbarmaster.templ b/views/component/navbarmaster/navbarmaster.templ new file mode 100644 index 0000000..e501b68 --- /dev/null +++ b/views/component/navbarmaster/navbarmaster.templ @@ -0,0 +1,655 @@ +package navbarmaster + +import ( + "github.com/emarifer/go-templ-project-structure/views/component/sidebarmaster" + "github.com/emarifer/go-templ-project-structure/services" +) + +templ MainNavbar(datamenu []services.MasterMenu) { +
+ +
+ + + +
+ +
+} + +templ Navbarmaster(datamenu []services.MasterMenu, content templ.Component) { + +
+ + + Logo + + + +
+ + + + + + +
+ +
+ + +
+ +
+ +
+ +
+ + + + + + +
+ + + @MainNavbar(datamenu) + +
+ + +
+ +
+ +
+ +
+ + +
+ +
+
+ Hi, + Sean + + S + +
+
+ +
+ +
+ +
+ + + @content + +
+ +
+ +
+ +} + +templ Navbaruserprofile() { +
+ +
+

+ User Profile + 12 messages +

+ + + +
+ + +
+ +
+
+
+ +
+ +
+ + +
+ + + + + +
+ + +
+ +
+ Recent Notifications +
+ + +
+ + + + + + + + + + + + + + +28% +
+ + +
+ + + + + + + + + + + + +
+ + Would + be to people + + Due in 2 Days +
+ +50% +
+ + +
+ + + + + + + + + + + + + + -27% +
+ + +
+ + + + + + + + + + + + + + +
+ + The + best product + + Due in 2 Days +
+ +8% +
+ +
+ +
+ +
+} diff --git a/views/component/navbarmaster/navbarmaster_templ.go b/views/component/navbarmaster/navbarmaster_templ.go new file mode 100644 index 0000000..7fb123b --- /dev/null +++ b/views/component/navbarmaster/navbarmaster_templ.go @@ -0,0 +1,138 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package navbarmaster + +//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 ( + "github.com/emarifer/go-templ-project-structure/services" + "github.com/emarifer/go-templ-project-structure/views/component/sidebarmaster" +) + +func MainNavbar(datamenu []services.MasterMenu) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + 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("
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for index, d := range datamenu { + if index == 0 { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = sidebarmaster.MenuDashboard(d.ParentMenuName, d.ParentUrl).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
  • Menu

  • ") + 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 index+1 < len(datamenu) { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = sidebarmaster.ListMenuNavbar(datamenu[index+1].ParentMenuName, datamenu[index+1].Children).Render(ctx, templ_7745c5c3_Buffer) + 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func Navbarmaster(datamenu []services.MasterMenu, content templ.Component) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var2 := templ.GetChildren(ctx) + if templ_7745c5c3_Var2 == nil { + templ_7745c5c3_Var2 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
\"Logo\"
\"Logo\"
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = MainNavbar(datamenu).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Hi, Sean S
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = content.Render(ctx, templ_7745c5c3_Buffer) + 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func Navbaruserprofile() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var3 := templ.GetChildren(ctx) + if templ_7745c5c3_Var3 == nil { + templ_7745c5c3_Var3 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + 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 + }) +} diff --git a/views/layout/layout_corporate.templ b/views/layout/layout_corporate.templ new file mode 100644 index 0000000..84e01e0 --- /dev/null +++ b/views/layout/layout_corporate.templ @@ -0,0 +1,177 @@ +package layout + +// LAYOUT PLAYGROUND +templ CorporateLayout(title string, css templ.Component, js templ.Component) { + + + + + + + + Company Portal | { title } + + + + + + + + + + + + + + + + + + + + + + + @css + + + + + // htmx + + + { children... } + + + + + + + + + + + + @js + + + + +} diff --git a/views/layout/layout_corporate_templ.go b/views/layout/layout_corporate_templ.go new file mode 100644 index 0000000..2fa0c4a --- /dev/null +++ b/views/layout/layout_corporate_templ.go @@ -0,0 +1,73 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package layout + +//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" + +// LAYOUT PLAYGROUND +func CorporateLayout(title string, css templ.Component, js templ.Component) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Company Portal | ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var2 string + templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\layout\layout_corporate.templ`, Line: 23, 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 + } + templ_7745c5c3_Err = css.Render(ctx, templ_7745c5c3_Buffer) + 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_Var1.Render(ctx, templ_7745c5c3_Buffer) + 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 = js.Render(ctx, templ_7745c5c3_Buffer) + 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} diff --git a/views/mastermenuusergroup/mastermenuusergroup.templ b/views/mastermenuusergroup/mastermenuusergroup.templ index 624e94f..8d2baf0 100644 --- a/views/mastermenuusergroup/mastermenuusergroup.templ +++ b/views/mastermenuusergroup/mastermenuusergroup.templ @@ -1,704 +1,20 @@ package mastermenuusergroup import ( + "github.com/emarifer/go-templ-project-structure/views/component/breadcrumbadmin" "github.com/emarifer/go-templ-project-structure/views/layout" "github.com/emarifer/go-templ-project-structure/services" - "github.com/emarifer/go-templ-project-structure/views/component/sidebarmaster" - "github.com/emarifer/go-templ-project-structure/views/component/breadcrumbadmin" + "github.com/emarifer/go-templ-project-structure/views/component/navbarmaster" ) - -templ MainNavbar(datamenu []services.MasterMenu) { -
- -
- - - -
- -
-} - templ MainMasterMenuUserGroup(datamenu []services.MasterMenu) { -
- - - Logo - - - -
- - - - - - - - - -
- -
+ @navbarmaster.Navbarmaster(datamenu, ContentMasterMenuUserGroup()) -
- -
- -
- -
- - - - - - -
- - - @MainNavbar(datamenu) - -
- - -
- -
- -
- -
- - -
- -
-
- Hi, - Sean - - S - -
-
- -
- -
- -
- - -
-
- @breadcrumadmin.MainBreadcrumbAdmin() -
-
- - - - -
- -
- -
-
- -
-

- User Profile - 12 messages -

- - - -
- - -
- -
-
-
- -
- -
- - -
- - - - - -
- - -
- -
- Recent Notifications -
- - -
- - - - - - - - - - - - - - +28% -
- - -
- - - - - - - - - - - - -
- - Would - be to people - - Due in 2 Days -
- +50% -
- - -
- - - - - - - - - - - - - - -27% -
- - -
- - - - - - - - - - - - - - -
- - The - best product - - Due in 2 Days -
- +8% -
- -
- -
- -
+ @navbarmaster.Navbaruserprofile()
@@ -727,6 +43,78 @@ templ MainMasterMenuUserGroup(datamenu []services.MasterMenu) { } +templ ContentMasterMenuUserGroup() { +
+
+
+ @breadcrumadmin.MainBreadcrumbAdmin() +
+
+ //
+
+ +
+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + +
KODEUSER GROUPACTION
001Admin +
+ + +
+
002Tes +
+ + +
+
+
+
+ +
+
+ + + ... + 23 + 24 + 25 + 26 + 27 + 28 + ... + + +
+
+ +
+
+} + templ CssMasterMenuUserGroup() {
    ") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - for index, d := range datamenu { - if index == 0 { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = sidebarmaster.MenuDashboard(d.ParentMenuName, d.ParentUrl).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
  • Menu

  • ") - 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 index+1 < len(datamenu) { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = sidebarmaster.ListMenuNavbar(datamenu[index+1].ParentMenuName, datamenu[index+1].Children).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } + templ_7745c5c3_Err = navbarmaster.Navbarmaster(datamenu, ContentMasterMenuUserGroup()).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = navbarmaster.Navbaruserprofile().Render(ctx, templ_7745c5c3_Buffer) + 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 } @@ -75,7 +57,7 @@ func MainNavbar(datamenu []services.MasterMenu) templ.Component { }) } -func MainMasterMenuUserGroup(datamenu []services.MasterMenu) templ.Component { +func ContentMasterMenuUserGroup() 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 { @@ -88,15 +70,7 @@ func MainMasterMenuUserGroup(datamenu []services.MasterMenu) templ.Component { templ_7745c5c3_Var2 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
\"Logo\"
\"Logo\"
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = MainNavbar(datamenu).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Hi, Sean S
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -104,7 +78,7 @@ func MainMasterMenuUserGroup(datamenu []services.MasterMenu) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
KODEUSER GROUPACTION
001Admin
002Tes
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } From 6972963f41a2c5761a7177a8e5290ad5c2d6575f Mon Sep 17 00:00:00 2001 From: Sas Andy Date: Mon, 6 May 2024 13:27:01 +0700 Subject: [PATCH 03/12] text hover css --- .../asset-corporate-portal/css/sas.bundle.css | 498 ++++++++++++++++++ 1 file changed, 498 insertions(+) diff --git a/assets/asset-corporate-portal/css/sas.bundle.css b/assets/asset-corporate-portal/css/sas.bundle.css index 4a6dafd..8e83486 100644 --- a/assets/asset-corporate-portal/css/sas.bundle.css +++ b/assets/asset-corporate-portal/css/sas.bundle.css @@ -4670,6 +4670,504 @@ th:last-child { border-radius: 0 6px 6px 0 !important; } +/* ### TEXT HOVER */ +/* ## TEXT HOVER PRIMARY */ +a.text-hover-primary, +.text-hover-primary { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; +} +a.text-hover-primary:hover, +.text-hover-primary:hover { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--primary-hover) !important; +} +a.text-hover-primary:hover i, +.text-hover-primary:hover i { + color: var(--primary-hover) !important; +} +a.text-hover-primary:hover .svg-icon svg g [fill], +.text-hover-primary:hover .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--primary-hover); +} +a.text-hover-primary:hover .svg-icon svg:hover g [fill], +.text-hover-primary:hover .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +.hoverable:hover a.text-hover-primary, +.hoverable:hover .text-hover-primary { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--primary-hover) !important; +} +.hoverable:hover a.text-hover-primary i, +.hoverable:hover .text-hover-primary i { + color: var(--primary-hover) !important; +} +.hoverable:hover a.text-hover-primary .svg-icon svg g [fill], +.hoverable:hover .text-hover-primary .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--primary-hover) !important; +} +.hoverable:hover a.text-hover-primary .svg-icon svg:hover g [fill], +.hoverable:hover .text-hover-primary .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +/* ## TEXT HOVER SECONDARY */ +a.text-hover-secondary, +.text-hover-secondary { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; +} +a.text-hover-secondary:hover, +.text-hover-secondary:hover { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--secondary-hover) !important; +} +a.text-hover-secondary:hover i, +.text-hover-secondary:hover i { + color: var(--secondary-hover) !important; +} +a.text-hover-secondary:hover .svg-icon svg g [fill], +.text-hover-secondary:hover .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--secondary-hover); +} +a.text-hover-secondary:hover .svg-icon svg:hover g [fill], +.text-hover-secondary:hover .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +.hoverable:hover a.text-hover-secondary, +.hoverable:hover .text-hover-secondary { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--secondary-hover) !important; +} +.hoverable:hover a.text-hover-secondary i, +.hoverable:hover .text-hover-secondary i { + color: var(--secondary-hover) !important; +} +.hoverable:hover a.text-hover-secondary .svg-icon svg g [fill], +.hoverable:hover .text-hover-secondary .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--secondary-hover) !important; +} +.hoverable:hover a.text-hover-secondary .svg-icon svg:hover g [fill], +.hoverable:hover .text-hover-secondary .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +/* ## TEXT HOVER SUCCESS */ +a.text-hover-success, +.text-hover-success { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; +} +a.text-hover-success:hover, +.text-hover-success:hover { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--success-hover) !important; +} +a.text-hover-success:hover i, +.text-hover-success:hover i { + color: var(--success-hover) !important; +} +a.text-hover-success:hover .svg-icon svg g [fill], +.text-hover-success:hover .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--success-hover); +} +a.text-hover-success:hover .svg-icon svg:hover g [fill], +.text-hover-success:hover .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +.hoverable:hover a.text-hover-success, +.hoverable:hover .text-hover-success { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--success-hover) !important; +} +.hoverable:hover a.text-hover-success i, +.hoverable:hover .text-hover-success i { + color: var(--success-hover) !important; +} +.hoverable:hover a.text-hover-success .svg-icon svg g [fill], +.hoverable:hover .text-hover-success .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--success-hover) !important; +} +.hoverable:hover a.text-hover-success .svg-icon svg:hover g [fill], +.hoverable:hover .text-hover-success .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +/* ## TEXT HOVER INFO */ +a.text-hover-info, +.text-hover-info { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; +} +a.text-hover-info:hover, +.text-hover-info:hover { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--info-hover) !important; +} +a.text-hover-info:hover i, +.text-hover-info:hover i { + color: var(--info-hover) !important; +} +a.text-hover-info:hover .svg-icon svg g [fill], +.text-hover-info:hover .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--info-hover); +} +a.text-hover-info:hover .svg-icon svg:hover g [fill], +.text-hover-info:hover .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +.hoverable:hover a.text-hover-info, +.hoverable:hover .text-hover-info { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--info-hover) !important; +} +.hoverable:hover a.text-hover-info i, +.hoverable:hover .text-hover-info i { + color: var(--info-hover) !important; +} +.hoverable:hover a.text-hover-info .svg-icon svg g [fill], +.hoverable:hover .text-hover-info .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--info-hover) !important; +} +.hoverable:hover a.text-hover-info .svg-icon svg:hover g [fill], +.hoverable:hover .text-hover-info .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +/* ## TEXT HOVER WARNING */ +a.text-hover-warning, +.text-hover-warning { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; +} +a.text-hover-warning:hover, +.text-hover-warning:hover { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--warning-hover) !important; +} +a.text-hover-warning:hover i, +.text-hover-warning:hover i { + color: var(--warning-hover) !important; +} +a.text-hover-warning:hover .svg-icon svg g [fill], +.text-hover-warning:hover .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--warning-hover); +} +a.text-hover-warning:hover .svg-icon svg:hover g [fill], +.text-hover-warning:hover .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +.hoverable:hover a.text-hover-warning, +.hoverable:hover .text-hover-warning { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--warning-hover) !important; +} +.hoverable:hover a.text-hover-warning i, +.hoverable:hover .text-hover-warning i { + color: var(--warning-hover) !important; +} +.hoverable:hover a.text-hover-warning .svg-icon svg g [fill], +.hoverable:hover .text-hover-warning .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--warning-hover) !important; +} +.hoverable:hover a.text-hover-warning .svg-icon svg:hover g [fill], +.hoverable:hover .text-hover-warning .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +/* ## TEXT HOVER DANGER */ +a.text-hover-danger, +.text-hover-danger { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; +} +a.text-hover-danger:hover, +.text-hover-danger:hover { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--danger-hover) !important; +} +a.text-hover-danger:hover i, +.text-hover-danger:hover i { + color: var(--danger-hover) !important; +} +a.text-hover-danger:hover .svg-icon svg g [fill], +.text-hover-danger:hover .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--danger-hover); +} +a.text-hover-danger:hover .svg-icon svg:hover g [fill], +.text-hover-danger:hover .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +.hoverable:hover a.text-hover-danger, +.hoverable:hover .text-hover-danger { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--danger-hover) !important; +} +.hoverable:hover a.text-hover-danger i, +.hoverable:hover .text-hover-danger i { + color: var(--danger-hover) !important; +} +.hoverable:hover a.text-hover-danger .svg-icon svg g [fill], +.hoverable:hover .text-hover-danger .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--danger-hover) !important; +} +.hoverable:hover a.text-hover-danger .svg-icon svg:hover g [fill], +.hoverable:hover .text-hover-danger .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +/* ## TEXT HOVER TOSCA */ +a.text-hover-tosca, +.text-hover-tosca { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; +} +a.text-hover-tosca:hover, +.text-hover-tosca:hover { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--tosca-hover) !important; +} +a.text-hover-tosca:hover i, +.text-hover-tosca:hover i { + color: var(--tosca-hover) !important; +} +a.text-hover-tosca:hover .svg-icon svg g [fill], +.text-hover-tosca:hover .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--tosca-hover); +} +a.text-hover-tosca:hover .svg-icon svg:hover g [fill], +.text-hover-tosca:hover .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +.hoverable:hover a.text-hover-tosca, +.hoverable:hover .text-hover-tosca { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--tosca-hover) !important; +} +.hoverable:hover a.text-hover-tosca i, +.hoverable:hover .text-hover-tosca i { + color: var(--tosca-hover) !important; +} +.hoverable:hover a.text-hover-tosca .svg-icon svg g [fill], +.hoverable:hover .text-hover-tosca .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--tosca-hover) !important; +} +.hoverable:hover a.text-hover-tosca .svg-icon svg:hover g [fill], +.hoverable:hover .text-hover-tosca .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + /* ### BUTTON HOVER TEXT */ /* ### */ /* ## PRIMARY */ From 728c4ccf7af9b7459d275f48e05997b548477712 Mon Sep 17 00:00:00 2001 From: Sas Andy Date: Mon, 6 May 2024 13:27:28 +0700 Subject: [PATCH 04/12] layout corporate, navbar & side bar templ --- handlers/mastermenuusergroup.handlers.go | 17 +- handlers/routes.go | 1 + handlers/xsample.handlers.go | 25 + models/table.models.go | 1 - models/user.models.go | 8 + services/user.services.go | 11 + services/xsample.services.go | 502 ++++++++++++++ utils/generaterandomid.utils.go | 16 + views/component/navbar/navbar.templ | 74 ++ views/component/navbar/navbar_templ.go | 112 +++ .../component/navbarmaster/navbarmaster.templ | 655 ------------------ .../navbarmaster/navbarmaster_templ.go | 138 ---- .../sidebar_user_profile.templ | 82 +++ .../sidebar_user_profile_templ.go | 127 ++++ views/layout/layout_corporate.templ | 133 +++- views/layout/layout_corporate_templ.go | 39 +- .../mastermenuusergroup.templ | 43 +- .../mastermenuusergroup_templ.go | 69 +- views/xsample/coba.templ | 23 + views/xsample/coba_templ.go | 133 ++++ 20 files changed, 1306 insertions(+), 903 deletions(-) delete mode 100644 models/table.models.go create mode 100644 models/user.models.go create mode 100644 utils/generaterandomid.utils.go create mode 100644 views/component/navbar/navbar.templ create mode 100644 views/component/navbar/navbar_templ.go delete mode 100644 views/component/navbarmaster/navbarmaster.templ delete mode 100644 views/component/navbarmaster/navbarmaster_templ.go create mode 100644 views/component/sidebar_user_profile/sidebar_user_profile.templ create mode 100644 views/component/sidebar_user_profile/sidebar_user_profile_templ.go create mode 100644 views/xsample/coba.templ create mode 100644 views/xsample/coba_templ.go diff --git a/handlers/mastermenuusergroup.handlers.go b/handlers/mastermenuusergroup.handlers.go index 7065a55..b7babb7 100644 --- a/handlers/mastermenuusergroup.handlers.go +++ b/handlers/mastermenuusergroup.handlers.go @@ -31,18 +31,21 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroup(c echo.Cont fmt.Println(dataMenu) return err } - // fmt.Printf("%+v\n", dataMenu) - // si := mastermenu.ShowMasterMenu("Master Menu", - // mastermenu.MainMasterMenu(dataMenu), - // mastermenu.CssMasterMenu(), - // mastermenu.JsMasterMenu(), - // ) + dataUser, err := services.GetUser() + fmt.Println(dataUser) + fmt.Println(err) + if err != nil { + fmt.Println(dataUser) + return err + } si := mastermenuusergroup.ShowMasterMenuUserGroup( "Master Menu", - mastermenuusergroup.MainMasterMenuUserGroup(dataMenu), + mastermenuusergroup.ContentMasterMenuUserGroup(), mastermenuusergroup.CssMasterMenuUserGroup(), mastermenuusergroup.JsMasterMenuUserGroup(), + dataMenu, + dataUser, ) return lh.View(c, si) diff --git a/handlers/routes.go b/handlers/routes.go index b34dc81..b30c9db 100644 --- a/handlers/routes.go +++ b/handlers/routes.go @@ -18,6 +18,7 @@ func SetupRoutesLogin(app *echo.Echo, h *LoginHandler) { func SetupRoutesXsample(app *echo.Echo, h *XsampleHandler) { xSample := app.Group("/xsample") xSample.GET("/xsample01", h.Hello) + xSample.GET("/coba", h.ShowCoba) } func SetupRoutesLandingPage(app *echo.Echo, h *LandingPageHandler, mastermenuusergroupHandler *MasterMenuUserGroupHandler) { Lp := app.Group("/landing_page") diff --git a/handlers/xsample.handlers.go b/handlers/xsample.handlers.go index 9253c6b..7d07e58 100644 --- a/handlers/xsample.handlers.go +++ b/handlers/xsample.handlers.go @@ -1,13 +1,18 @@ package handlers import ( + "fmt" + "github.com/a-h/templ" + "github.com/emarifer/go-templ-project-structure/services" + "github.com/emarifer/go-templ-project-structure/utils" "github.com/emarifer/go-templ-project-structure/views/xsample" "github.com/labstack/echo/v4" ) type XsampleService interface { + GetListMenus() ([]services.MasterMenu, error) } func NewXsampleHandler(us XsampleService) *XsampleHandler { @@ -24,6 +29,26 @@ func (uh *XsampleHandler) Hello(c echo.Context) error { helo := xsample.ShowHelo("Hello World", xsample.HelloWorld("Hello World"), xsample.CssHelo(), xsample.JsHelo()) return uh.View(c, helo) } +func (uh *XsampleHandler) ShowCoba(c echo.Context) error { + dataMenu, err := uh.XsampleService.GetListMenus() + fmt.Println(dataMenu) + fmt.Println(err) + if err != nil { + fmt.Println(dataMenu) + return err + } + randomID := utils.GenerateRandomID("coba") + fmt.Println(randomID) + dataUser, err := services.GetUser() + fmt.Println(dataUser) + fmt.Println(err) + if err != nil { + fmt.Println(dataUser) + return err + } + helo := xsample.ShowCoba("Hello World", xsample.Coba("Hello World"), xsample.CssCoba(), xsample.JsCoba(), dataMenu, dataUser) + return uh.View(c, helo) +} func (uh *XsampleHandler) View(c echo.Context, cmp templ.Component) error { c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML) diff --git a/models/table.models.go b/models/table.models.go deleted file mode 100644 index 2640e7f..0000000 --- a/models/table.models.go +++ /dev/null @@ -1 +0,0 @@ -package models diff --git a/models/user.models.go b/models/user.models.go new file mode 100644 index 0000000..bb118c8 --- /dev/null +++ b/models/user.models.go @@ -0,0 +1,8 @@ +package models + +type User struct { + UserID int `json:"userID"` + Username string `json:"username"` + UserFullName string `json:"userFullName"` + UserPosition string `json:"userPosition"` +} diff --git a/services/user.services.go b/services/user.services.go index 37e071b..63f63f8 100644 --- a/services/user.services.go +++ b/services/user.services.go @@ -4,6 +4,7 @@ import ( "time" "github.com/emarifer/go-templ-project-structure/db" + "github.com/emarifer/go-templ-project-structure/models" ) func NewServicesUser(u User, uStore db.UserStore) *ServicesUser { @@ -84,3 +85,13 @@ func ConverDateTime(tz string, dt time.Time) string { return dt.In(loc).Format(time.RFC822Z) } + +func GetUser() (models.User, error) { + a := models.User{ + UserID: 1, + Username: "andy", + UserFullName: "Alfianto Andy P", + UserPosition: "Software Developer", + } + return a, nil +} diff --git a/services/xsample.services.go b/services/xsample.services.go index fc24081..517f131 100644 --- a/services/xsample.services.go +++ b/services/xsample.services.go @@ -78,3 +78,505 @@ func (su *ServicesXsample) GetXsampleById(id int) (Xsample, error) { return su.Xsample, nil } + +func (su *ServicesXsample) GetListMenus() ([]MasterMenu, error) { + + // dummyBreadcrumb := []Breadcrumb{ + // { + // Name: "Dashboard", + // Url: "/client/dashboard", + // }, + // { + // Name: "Front Office", + // Url: "/client/usermanagement", + // }, + // } + + dummyMenu := []MasterMenu{ + // 1. Dashboard + { + ID: "1", + ParentMenuID: "0", + ParentMenuName: "Dashboard", + ParentUrl: "/client/md/dashboard", + ParentIcon: "", + Children: []ChildrenMenu{ + { + ChildrenParentID: "1", + ChildrenMenuID: "1", + ChildrenMenuName: "Master User", + ChildrenMenuURL: "/client/md/user", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "Y", + // }, + // }, + }, + }, + }, + + // 2. Front Office + { + ID: "2", + ParentMenuID: "1", + ParentMenuName: "Front Office", + ParentUrl: "#", + ParentIcon: "", + Children: []ChildrenMenu{ + { + ChildrenParentID: "1", + ChildrenMenuID: "1", + ChildrenMenuName: "Registrasi", + ChildrenMenuURL: "/fo/registrasi", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User", + // IsActive: "Y", + // }, + // }, + }, + }, + }, + + // 3. Station + { + ID: "3", + ParentMenuID: "2", + ParentMenuName: "Station", + ParentUrl: "#", + ParentIcon: "", + Children: []ChildrenMenu{ + { + ChildrenParentID: "2", + ChildrenMenuID: "1", + ChildrenMenuName: "Sample Station", + ChildrenMenuURL: "/station/sample", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User", + // IsActive: "Y", + // }, + // }, + }, + }, + }, + + // 4. Management MCU + { + ID: "4", + ParentMenuID: "3", + ParentMenuName: "Management MCU", + ParentUrl: "#", + ParentIcon: "", + Children: []ChildrenMenu{ + { + ChildrenParentID: "3", + ChildrenMenuID: "1", + ChildrenMenuName: "Setup MCU", + ChildrenMenuURL: "/mcu/setup", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User", + // IsActive: "Y", + // }, + // }, + }, + { + ChildrenParentID: "3", + ChildrenMenuID: "2", + ChildrenMenuName: "Pre-Registrasi", + ChildrenMenuURL: "/mcu/preregister", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User", + // IsActive: "Y", + // }, + // }, + }, + }, + }, + + // 5. Master Data + { + ID: "5", + ParentMenuID: "4", + ParentMenuName: "Master Data", + ParentUrl: "#", + ParentIcon: "", + Children: []ChildrenMenu{ + // * Master User + { + ChildrenParentID: "4", + ChildrenMenuID: "1", + ChildrenMenuName: "Master User", + ChildrenMenuURL: "/client/md/user", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User", + // IsActive: "Y", + // }, + // }, + }, + + // * Master User Group + { + ChildrenParentID: "4", + ChildrenMenuID: "2", + ChildrenMenuName: "Master User Group", + ChildrenMenuURL: "/client/md/usergroup", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Master Corporate + { + ChildrenParentID: "4", + ChildrenMenuID: "3", + ChildrenMenuName: "Corporate", + ChildrenMenuURL: "/client/md/corp", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Test + { + ChildrenParentID: "4", + ChildrenMenuID: "4", + ChildrenMenuName: "Test", + ChildrenMenuURL: "/client/md/test", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Bahan + { + ChildrenParentID: "4", + ChildrenMenuID: "5", + ChildrenMenuName: "Bahan", + ChildrenMenuURL: "/client/md/bahan", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Sample Type + { + ChildrenParentID: "4", + ChildrenMenuID: "6", + ChildrenMenuName: "Sample Type", + ChildrenMenuURL: "/client/sample/type", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Sample Station + { + ChildrenParentID: "4", + ChildrenMenuID: "7", + ChildrenMenuName: "Sample Station", + ChildrenMenuURL: "/station/sample", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Result Non Lab + { + ChildrenParentID: "4", + ChildrenMenuID: "8", + ChildrenMenuName: "Result Non Lab", + ChildrenMenuURL: "/client/md/resultnonlab", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Template Fisik + { + ChildrenParentID: "4", + ChildrenMenuID: "9", + ChildrenMenuName: "Template Fisik", + ChildrenMenuURL: "/client/md/template-fisik", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Pasien + { + ChildrenParentID: "4", + ChildrenMenuID: "10", + ChildrenMenuName: "Pasien", + ChildrenMenuURL: "/client/md/pasien", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Dokter + { + ChildrenParentID: "4", + ChildrenMenuID: "11", + ChildrenMenuName: "Dokter", + ChildrenMenuURL: "/client/md/dokter", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Paket + { + ChildrenParentID: "4", + ChildrenMenuID: "12", + ChildrenMenuName: "Paket", + ChildrenMenuURL: "/client/md/paket", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Harga Single + { + ChildrenParentID: "4", + ChildrenMenuID: "13", + ChildrenMenuName: "Harga Single", + ChildrenMenuURL: "/client/md/hargasingle", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + }, + }, + } + + return dummyMenu, nil +} diff --git a/utils/generaterandomid.utils.go b/utils/generaterandomid.utils.go new file mode 100644 index 0000000..5b69c70 --- /dev/null +++ b/utils/generaterandomid.utils.go @@ -0,0 +1,16 @@ +package utils + +import ( + "crypto/md5" + "encoding/hex" + "strings" + "time" +) + +func GenerateRandomID(text string) string { + seed := text + time.Now().String() + hash := md5.Sum([]byte(seed)) + randomID := hex.EncodeToString(hash[:]) + randomID = strings.ReplaceAll(randomID, "-", "") + return randomID +} diff --git a/views/component/navbar/navbar.templ b/views/component/navbar/navbar.templ new file mode 100644 index 0000000..c892f01 --- /dev/null +++ b/views/component/navbar/navbar.templ @@ -0,0 +1,74 @@ +package navbar + +import ( + "github.com/emarifer/go-templ-project-structure/views/component/sidebarmaster" + "github.com/emarifer/go-templ-project-structure/services" + "github.com/emarifer/go-templ-project-structure/models" +) + +templ Navbar(dataUser models.User) { +
+ +
+ +
+ + +
+ +
+
+ Hi, + { dataUser.Username } + + + +
+
+ +
+ +
+ +
+} + +templ NavbarMenu(datamenu []services.MasterMenu) { +
+ +
+ + + +
+ +
+} diff --git a/views/component/navbar/navbar_templ.go b/views/component/navbar/navbar_templ.go new file mode 100644 index 0000000..4b166a5 --- /dev/null +++ b/views/component/navbar/navbar_templ.go @@ -0,0 +1,112 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package navbar + +//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 ( + "github.com/emarifer/go-templ-project-structure/models" + "github.com/emarifer/go-templ-project-structure/services" + "github.com/emarifer/go-templ-project-structure/views/component/sidebarmaster" +) + +func Navbar(dataUser models.User) 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("
Hi, ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var2 string + templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(dataUser.Username) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\component\navbar\navbar.templ`, Line: 29, Col: 26} + } + _, 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func NavbarMenu(datamenu []services.MasterMenu) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var3 := templ.GetChildren(ctx) + if templ_7745c5c3_Var3 == nil { + templ_7745c5c3_Var3 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for index, d := range datamenu { + if index == 0 { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = sidebarmaster.MenuDashboard(d.ParentMenuName, d.ParentUrl).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
  • Menu

  • ") + 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 index+1 < len(datamenu) { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = sidebarmaster.ListMenuNavbar(datamenu[index+1].ParentMenuName, datamenu[index+1].Children).Render(ctx, templ_7745c5c3_Buffer) + 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} diff --git a/views/component/navbarmaster/navbarmaster.templ b/views/component/navbarmaster/navbarmaster.templ deleted file mode 100644 index e501b68..0000000 --- a/views/component/navbarmaster/navbarmaster.templ +++ /dev/null @@ -1,655 +0,0 @@ -package navbarmaster - -import ( - "github.com/emarifer/go-templ-project-structure/views/component/sidebarmaster" - "github.com/emarifer/go-templ-project-structure/services" -) - -templ MainNavbar(datamenu []services.MasterMenu) { -
- -
- - - -
- -
-} - -templ Navbarmaster(datamenu []services.MasterMenu, content templ.Component) { - -
- - - Logo - - - -
- - - - - - -
- -
- - -
- -
- -
- -
- - - - - - -
- - - @MainNavbar(datamenu) - -
- - -
- -
- -
- -
- - -
- -
-
- Hi, - Sean - - S - -
-
- -
- -
- -
- - - @content - -
- -
- -
- -} - -templ Navbaruserprofile() { -
- -
-

- User Profile - 12 messages -

- - - -
- - -
- -
-
-
- -
- -
- - -
- - - - - -
- - -
- -
- Recent Notifications -
- - -
- - - - - - - - - - - - - - +28% -
- - -
- - - - - - - - - - - - -
- - Would - be to people - - Due in 2 Days -
- +50% -
- - -
- - - - - - - - - - - - - - -27% -
- - -
- - - - - - - - - - - - - - -
- - The - best product - - Due in 2 Days -
- +8% -
- -
- -
- -
-} diff --git a/views/component/navbarmaster/navbarmaster_templ.go b/views/component/navbarmaster/navbarmaster_templ.go deleted file mode 100644 index 7fb123b..0000000 --- a/views/component/navbarmaster/navbarmaster_templ.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.663 -package navbarmaster - -//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 ( - "github.com/emarifer/go-templ-project-structure/services" - "github.com/emarifer/go-templ-project-structure/views/component/sidebarmaster" -) - -func MainNavbar(datamenu []services.MasterMenu) templ.Component { - return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - 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("
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - for index, d := range datamenu { - if index == 0 { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = sidebarmaster.MenuDashboard(d.ParentMenuName, d.ParentUrl).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
  • Menu

  • ") - 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 index+1 < len(datamenu) { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = sidebarmaster.ListMenuNavbar(datamenu[index+1].ParentMenuName, datamenu[index+1].Children).Render(ctx, templ_7745c5c3_Buffer) - 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 !templ_7745c5c3_IsBuffer { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) - } - return templ_7745c5c3_Err - }) -} - -func Navbarmaster(datamenu []services.MasterMenu, content templ.Component) templ.Component { - return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - templ_7745c5c3_Buffer = templ.GetBuffer() - defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var2 := templ.GetChildren(ctx) - if templ_7745c5c3_Var2 == nil { - templ_7745c5c3_Var2 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
\"Logo\"
\"Logo\"
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = MainNavbar(datamenu).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Hi, Sean S
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = content.Render(ctx, templ_7745c5c3_Buffer) - 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 !templ_7745c5c3_IsBuffer { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) - } - return templ_7745c5c3_Err - }) -} - -func Navbaruserprofile() templ.Component { - return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - templ_7745c5c3_Buffer = templ.GetBuffer() - defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templ.GetChildren(ctx) - if templ_7745c5c3_Var3 == nil { - templ_7745c5c3_Var3 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - 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 - }) -} diff --git a/views/component/sidebar_user_profile/sidebar_user_profile.templ b/views/component/sidebar_user_profile/sidebar_user_profile.templ new file mode 100644 index 0000000..7e2242c --- /dev/null +++ b/views/component/sidebar_user_profile/sidebar_user_profile.templ @@ -0,0 +1,82 @@ +package sidebaruserprofile + +import "github.com/emarifer/go-templ-project-structure/models" + +templ Navbaruserprofile(dataUser models.User) { +
+ +
+

+ User Profile + // 12 messages +

+ + + +
+ + +
+ + @ProfileHeader(dataUser) + + +
+ + +
+ +
+ Recent Notifications +
+ + + @NotificationCard() + +
+ +
+ +
+} + +templ ProfileHeader(dataUser models.User) { +
+
+ //
+ // + +
+
+ + { dataUser.UserFullName } + +
+ { dataUser.UserPosition } +
+ +
+
+} + +templ NotificationCard() { +
+ + + + + + + +
+} diff --git a/views/component/sidebar_user_profile/sidebar_user_profile_templ.go b/views/component/sidebar_user_profile/sidebar_user_profile_templ.go new file mode 100644 index 0000000..779eb04 --- /dev/null +++ b/views/component/sidebar_user_profile/sidebar_user_profile_templ.go @@ -0,0 +1,127 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package sidebaruserprofile + +//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 "github.com/emarifer/go-templ-project-structure/models" + +func Navbaruserprofile(dataUser models.User) 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("

User Profile\r

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = ProfileHeader(dataUser).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Recent Notifications\r
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = NotificationCard().Render(ctx, templ_7745c5c3_Buffer) + 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func ProfileHeader(dataUser models.User) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var2 := templ.GetChildren(ctx) + if templ_7745c5c3_Var2 == nil { + templ_7745c5c3_Var2 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var3 string + templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(dataUser.UserFullName) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\component\sidebar_user_profile\sidebar_user_profile.templ`, Line: 52, Col: 27} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var4 string + templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(dataUser.UserPosition) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\component\sidebar_user_profile\sidebar_user_profile.templ`, Line: 55, Col: 27} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + 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 NotificationCard() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var5 := templ.GetChildren(ctx) + if templ_7745c5c3_Var5 == nil { + templ_7745c5c3_Var5 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + 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 + }) +} diff --git a/views/layout/layout_corporate.templ b/views/layout/layout_corporate.templ index 84e01e0..2c74e19 100644 --- a/views/layout/layout_corporate.templ +++ b/views/layout/layout_corporate.templ @@ -1,7 +1,14 @@ package layout +import ( + "github.com/emarifer/go-templ-project-structure/services" + "github.com/emarifer/go-templ-project-structure/views/component/navbar" + "github.com/emarifer/go-templ-project-structure/views/component/sidebar_user_profile" + "github.com/emarifer/go-templ-project-structure/models" +) + // LAYOUT PLAYGROUND -templ CorporateLayout(title string, css templ.Component, js templ.Component) { +templ CorporateLayout(title string, css templ.Component, js templ.Component, datamenu []services.MasterMenu, dataUser models.User) { // htmx - - { children... } - + +
+ + + Logo + + + +
+ + + + + + +
+ +
+ + +
+ +
+ +
+ +
+ + + + + + +
+ + + @navbar.NavbarMenu(datamenu) + +
+ + +
+ + @navbar.Navbar(dataUser) + + +
+ { children... } +
+ +
+ +
+ +
+ + @sidebaruserprofile.Navbaruserprofile(dataUser) ") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
\"Logo\"
\"Logo\"
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = navbar.NavbarMenu(datamenu).Render(ctx, templ_7745c5c3_Buffer) + 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 = navbar.Navbar(dataUser).Render(ctx, templ_7745c5c3_Buffer) + 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 } @@ -53,7 +76,15 @@ func CorporateLayout(title string, css templ.Component, js templ.Component) temp if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = sidebaruserprofile.Navbaruserprofile(dataUser).Render(ctx, templ_7745c5c3_Buffer) + 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 } diff --git a/views/mastermenuusergroup/mastermenuusergroup.templ b/views/mastermenuusergroup/mastermenuusergroup.templ index 8d2baf0..9db78ae 100644 --- a/views/mastermenuusergroup/mastermenuusergroup.templ +++ b/views/mastermenuusergroup/mastermenuusergroup.templ @@ -4,45 +4,10 @@ import ( "github.com/emarifer/go-templ-project-structure/views/component/breadcrumbadmin" "github.com/emarifer/go-templ-project-structure/views/layout" "github.com/emarifer/go-templ-project-structure/services" - "github.com/emarifer/go-templ-project-structure/views/component/navbarmaster" + "github.com/emarifer/go-templ-project-structure/models" ) -templ MainMasterMenuUserGroup(datamenu []services.MasterMenu) { - - - @navbarmaster.Navbarmaster(datamenu, ContentMasterMenuUserGroup()) - - - - @navbarmaster.Navbaruserprofile() - - -
- - - - - - - - - - -
- -} - +// "github.com/emarifer/go-templ-project-structure/views/component/sidebar_user_profile" templ ContentMasterMenuUserGroup() {
@@ -152,8 +117,8 @@ templ CssMasterMenuUserGroup() { templ JsMasterMenuUserGroup() { } -templ ShowMasterMenuUserGroup(title string, cmp templ.Component, css templ.Component, js templ.Component) { - @layout.PlaygroundLayout(title, css, js) { +templ ShowMasterMenuUserGroup(title string, cmp templ.Component, css templ.Component, js templ.Component, dataMenu []services.MasterMenu, dataUser models.User) { + @layout.CorporateLayout(title, css, js, dataMenu, dataUser) { @cmp } } diff --git a/views/mastermenuusergroup/mastermenuusergroup_templ.go b/views/mastermenuusergroup/mastermenuusergroup_templ.go index fb038ea..bd87efb 100644 --- a/views/mastermenuusergroup/mastermenuusergroup_templ.go +++ b/views/mastermenuusergroup/mastermenuusergroup_templ.go @@ -11,13 +11,14 @@ import "io" import "bytes" import ( + "github.com/emarifer/go-templ-project-structure/models" "github.com/emarifer/go-templ-project-structure/services" "github.com/emarifer/go-templ-project-structure/views/component/breadcrumbadmin" - "github.com/emarifer/go-templ-project-structure/views/component/navbarmaster" "github.com/emarifer/go-templ-project-structure/views/layout" ) -func MainMasterMenuUserGroup(datamenu []services.MasterMenu) templ.Component { +// "github.com/emarifer/go-templ-project-structure/views/component/sidebar_user_profile" +func ContentMasterMenuUserGroup() 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 { @@ -30,46 +31,6 @@ func MainMasterMenuUserGroup(datamenu []services.MasterMenu) templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = navbarmaster.Navbarmaster(datamenu, ContentMasterMenuUserGroup()).Render(ctx, templ_7745c5c3_Buffer) - 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 = navbarmaster.Navbaruserprofile().Render(ctx, templ_7745c5c3_Buffer) - 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 !templ_7745c5c3_IsBuffer { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) - } - return templ_7745c5c3_Err - }) -} - -func ContentMasterMenuUserGroup() templ.Component { - return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - templ_7745c5c3_Buffer = templ.GetBuffer() - defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var2 := templ.GetChildren(ctx) - if templ_7745c5c3_Var2 == nil { - templ_7745c5c3_Var2 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err @@ -97,9 +58,9 @@ func CssMasterMenuUserGroup() templ.Component { defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templ.GetChildren(ctx) - if templ_7745c5c3_Var3 == nil { - templ_7745c5c3_Var3 = templ.NopComponent + templ_7745c5c3_Var2 := templ.GetChildren(ctx) + if templ_7745c5c3_Var2 == nil { + templ_7745c5c3_Var2 = templ.NopComponent } ctx = templ.ClearChildren(ctx) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") @@ -121,9 +82,9 @@ func JsMasterMenuUserGroup() templ.Component { defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var4 := templ.GetChildren(ctx) - if templ_7745c5c3_Var4 == nil { - templ_7745c5c3_Var4 = templ.NopComponent + templ_7745c5c3_Var3 := templ.GetChildren(ctx) + if templ_7745c5c3_Var3 == nil { + templ_7745c5c3_Var3 = templ.NopComponent } ctx = templ.ClearChildren(ctx) if !templ_7745c5c3_IsBuffer { @@ -133,7 +94,7 @@ func JsMasterMenuUserGroup() templ.Component { }) } -func ShowMasterMenuUserGroup(title string, cmp templ.Component, css templ.Component, js templ.Component) templ.Component { +func ShowMasterMenuUserGroup(title string, cmp templ.Component, css templ.Component, js templ.Component, dataMenu []services.MasterMenu, dataUser models.User) 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 { @@ -141,12 +102,12 @@ func ShowMasterMenuUserGroup(title string, cmp templ.Component, css templ.Compon defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var5 := templ.GetChildren(ctx) - if templ_7745c5c3_Var5 == nil { - templ_7745c5c3_Var5 = templ.NopComponent + templ_7745c5c3_Var4 := templ.GetChildren(ctx) + if templ_7745c5c3_Var4 == nil { + templ_7745c5c3_Var4 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var6 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var5 := 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() @@ -161,7 +122,7 @@ func ShowMasterMenuUserGroup(title string, cmp templ.Component, css templ.Compon } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = layout.PlaygroundLayout(title, css, js).Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, dataMenu, dataUser).Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/views/xsample/coba.templ b/views/xsample/coba.templ new file mode 100644 index 0000000..08351fa --- /dev/null +++ b/views/xsample/coba.templ @@ -0,0 +1,23 @@ +package xsample + +import ( + "github.com/emarifer/go-templ-project-structure/views/layout" + "github.com/emarifer/go-templ-project-structure/services" + "github.com/emarifer/go-templ-project-structure/models" +) + +templ Coba(title string) { +
{ title }
+} + +templ CssCoba() { +} + +templ JsCoba() { +} + +templ ShowCoba(title string, cmp templ.Component, css templ.Component, js templ.Component, dataMenu []services.MasterMenu, dataUser models.User) { + @layout.CorporateLayout(title, css, js, dataMenu, dataUser) { + @cmp + } +} diff --git a/views/xsample/coba_templ.go b/views/xsample/coba_templ.go new file mode 100644 index 0000000..932685b --- /dev/null +++ b/views/xsample/coba_templ.go @@ -0,0 +1,133 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package xsample + +//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 ( + "github.com/emarifer/go-templ-project-structure/models" + "github.com/emarifer/go-templ-project-structure/services" + "github.com/emarifer/go-templ-project-structure/views/layout" +) + +func Coba(title string) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var2 string + templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\xsample\coba.templ`, Line: 10, Col: 13} + } + _, 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func CssCoba() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var3 := templ.GetChildren(ctx) + if templ_7745c5c3_Var3 == nil { + templ_7745c5c3_Var3 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func JsCoba() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var4 := templ.GetChildren(ctx) + if templ_7745c5c3_Var4 == nil { + templ_7745c5c3_Var4 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func ShowCoba(title string, cmp templ.Component, css templ.Component, js templ.Component, dataMenu []services.MasterMenu, dataUser models.User) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var5 := templ.GetChildren(ctx) + if templ_7745c5c3_Var5 == nil { + templ_7745c5c3_Var5 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var6 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + templ_7745c5c3_Err = cmp.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer) + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, dataMenu, dataUser).Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} From e157e2fe435e86f8a341293f73da8f2687b471b2 Mon Sep 17 00:00:00 2001 From: Sas Andy Date: Mon, 6 May 2024 15:23:34 +0700 Subject: [PATCH 05/12] table component --- .../asset-corporate-portal/js/ktappsetting.js | 58 ++++++++++++ models/table.models.go | 15 +++ views/component/table/table.templ | 25 +++++ views/component/table/table_templ.go | 94 +++++++++++++++++++ views/layout/canvas_layout.templ | 68 +------------- views/layout/canvas_layout_templ.go | 2 +- views/layout/layout_corporate.templ | 65 +------------ views/layout/layout_corporate_templ.go | 2 +- views/layout/playground_layout.templ | 66 +------------ views/layout/playground_layout_templ.go | 2 +- .../mastermenuusergroup.templ | 91 +++++++++--------- .../mastermenuusergroup_templ.go | 81 +++++++++++++--- views/xsample/coba.templ | 44 +++++++++ views/xsample/coba_templ.go | 61 +++++++++++- 14 files changed, 411 insertions(+), 263 deletions(-) create mode 100644 assets/asset-corporate-portal/js/ktappsetting.js create mode 100644 models/table.models.go create mode 100644 views/component/table/table.templ create mode 100644 views/component/table/table_templ.go diff --git a/assets/asset-corporate-portal/js/ktappsetting.js b/assets/asset-corporate-portal/js/ktappsetting.js new file mode 100644 index 0000000..ed678af --- /dev/null +++ b/assets/asset-corporate-portal/js/ktappsetting.js @@ -0,0 +1,58 @@ +var KTAppSettings = { + breakpoints: { + sm: 576, + md: 768, + lg: 992, + xl: 1200, + xxl: 1400, + }, + colors: { + theme: { + base: { + white: "#ffffff", + primary: "#3699FF", + secondary: "#E5EAEE", + success: "#1BC5BD", + info: "#8950FC", + warning: "#FFA800", + danger: "#F64E60", + light: "#E4E6EF", + dark: "#181C32", + }, + light: { + white: "#ffffff", + primary: "#E1F0FF", + secondary: "#EBEDF3", + success: "#C9F7F5", + info: "#EEE5FF", + warning: "#FFF4DE", + danger: "#FFE2E5", + light: "#F3F6F9", + dark: "#D6D6E0", + }, + inverse: { + white: "#ffffff", + primary: "#ffffff", + secondary: "#3F4254", + success: "#ffffff", + info: "#ffffff", + warning: "#ffffff", + danger: "#ffffff", + light: "#464E5F", + dark: "#ffffff", + }, + }, + gray: { + "gray-100": "#F3F6F9", + "gray-200": "#EBEDF3", + "gray-300": "#E4E6EF", + "gray-400": "#D1D3E0", + "gray-500": "#B5B5C3", + "gray-600": "#7E8299", + "gray-700": "#5E6278", + "gray-800": "#3F4254", + "gray-900": "#181C32", + }, + }, + "font-family": "Poppins", +}; \ No newline at end of file diff --git a/models/table.models.go b/models/table.models.go new file mode 100644 index 0000000..76d0d99 --- /dev/null +++ b/models/table.models.go @@ -0,0 +1,15 @@ +package models + +type TableHead struct { + Name string `json:"name"` + Width string `json:"width"` +} + +func GetTableHead() []TableHead { + a := []TableHead{ + {Name: "Kode", Width: "30%"}, + {Name: "User Group", Width: "40%"}, + {Name: "Aksi", Width: "30%"}, + } + return a +} diff --git a/views/component/table/table.templ b/views/component/table/table.templ new file mode 100644 index 0000000..ef66f32 --- /dev/null +++ b/views/component/table/table.templ @@ -0,0 +1,25 @@ +package tablecomponent + +templ Table(thName []string, thWidth []string, trComponent templ.Component, pagination templ.Component) { + if len(thName) != len(thWidth) { +
length array thname berbeda dengan array thwidth
+ } else { +
+ + + + for i, item := range thName { + + } + + + + @trComponent + +
{ item }
+
+
+ @pagination +
+ } +} diff --git a/views/component/table/table_templ.go b/views/component/table/table_templ.go new file mode 100644 index 0000000..78877c7 --- /dev/null +++ b/views/component/table/table_templ.go @@ -0,0 +1,94 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package tablecomponent + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import "context" +import "io" +import "bytes" + +func Table(thName []string, thWidth []string, trComponent templ.Component, pagination templ.Component) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + if len(thName) != len(thWidth) { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
length array thname berbeda dengan array thwidth
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for i, item := range thName { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + 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 = trComponent.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var3 string + templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(item) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\component\table\table.templ`, Line: 12, Col: 50} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = pagination.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + 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 + }) +} diff --git a/views/layout/canvas_layout.templ b/views/layout/canvas_layout.templ index 4557116..5aeaf2a 100644 --- a/views/layout/canvas_layout.templ +++ b/views/layout/canvas_layout.templ @@ -94,72 +94,8 @@ templ CanvasLayout(title string, css templ.Component, js templ.Component) { { children... } - - - - + + diff --git a/views/layout/canvas_layout_templ.go b/views/layout/canvas_layout_templ.go index 006f939..6685c82 100644 --- a/views/layout/canvas_layout_templ.go +++ b/views/layout/canvas_layout_templ.go @@ -52,7 +52,7 @@ func CanvasLayout(title string, css templ.Component, js templ.Component) templ.C if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/views/layout/layout_corporate.templ b/views/layout/layout_corporate.templ index 2c74e19..43d3df4 100644 --- a/views/layout/layout_corporate.templ +++ b/views/layout/layout_corporate.templ @@ -220,71 +220,8 @@ templ CorporateLayout(title string, css templ.Component, js templ.Component, dat
@sidebaruserprofile.Navbaruserprofile(dataUser) - - + diff --git a/views/layout/layout_corporate_templ.go b/views/layout/layout_corporate_templ.go index aa3d0b2..9d8d95a 100644 --- a/views/layout/layout_corporate_templ.go +++ b/views/layout/layout_corporate_templ.go @@ -84,7 +84,7 @@ func CorporateLayout(title string, css templ.Component, js templ.Component, data if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/views/layout/playground_layout.templ b/views/layout/playground_layout.templ index 014e012..80354d2 100644 --- a/views/layout/playground_layout.templ +++ b/views/layout/playground_layout.templ @@ -97,71 +97,7 @@ templ PlaygroundLayout(title string, css templ.Component, js templ.Component) { { children... } - - - + diff --git a/views/layout/playground_layout_templ.go b/views/layout/playground_layout_templ.go index 8c1df4b..6af2408 100644 --- a/views/layout/playground_layout_templ.go +++ b/views/layout/playground_layout_templ.go @@ -53,7 +53,7 @@ func PlaygroundLayout(title string, css templ.Component, js templ.Component) tem if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/views/mastermenuusergroup/mastermenuusergroup.templ b/views/mastermenuusergroup/mastermenuusergroup.templ index 9db78ae..c7c045f 100644 --- a/views/mastermenuusergroup/mastermenuusergroup.templ +++ b/views/mastermenuusergroup/mastermenuusergroup.templ @@ -5,6 +5,7 @@ import ( "github.com/emarifer/go-templ-project-structure/views/layout" "github.com/emarifer/go-templ-project-structure/services" "github.com/emarifer/go-templ-project-structure/models" + "github.com/emarifer/go-templ-project-structure/views/component/table" ) // "github.com/emarifer/go-templ-project-structure/views/component/sidebar_user_profile" @@ -25,57 +26,49 @@ templ ContentMasterMenuUserGroup() {
- - - - - - - - - - - - - - - - - - - - -
KODEUSER GROUPACTION
001Admin -
- - -
-
002Tes -
- - -
-
+ @tablecomponent.Table([]string{"KODE", "USERGROUP", "AKSI"}, []string{"40%", "40%", "20%"}, TableRow(), Pagination())
-
- -
-
- - - ... - 23 - 24 - 25 - 26 - 27 - 28 - ... - - -
+
+} + +templ TableRow() { + + 001 + Admin + +
+ +
- + + + + 002 + Tes + +
+ + +
+ + +} + +templ Pagination() { +
+
+ + + ... + 23 + 24 + 25 + 26 + 27 + 28 + ... + +
} diff --git a/views/mastermenuusergroup/mastermenuusergroup_templ.go b/views/mastermenuusergroup/mastermenuusergroup_templ.go index bd87efb..c235a4f 100644 --- a/views/mastermenuusergroup/mastermenuusergroup_templ.go +++ b/views/mastermenuusergroup/mastermenuusergroup_templ.go @@ -14,6 +14,7 @@ import ( "github.com/emarifer/go-templ-project-structure/models" "github.com/emarifer/go-templ-project-structure/services" "github.com/emarifer/go-templ-project-structure/views/component/breadcrumbadmin" + "github.com/emarifer/go-templ-project-structure/views/component/table" "github.com/emarifer/go-templ-project-structure/views/layout" ) @@ -39,7 +40,63 @@ func ContentMasterMenuUserGroup() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
KODEUSER GROUPACTION
001Admin
002Tes
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = tablecomponent.Table([]string{"KODE", "USERGROUP", "AKSI"}, []string{"40%", "40%", "20%"}, TableRow(), Pagination()).Render(ctx, templ_7745c5c3_Buffer) + 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func TableRow() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var2 := templ.GetChildren(ctx) + if templ_7745c5c3_Var2 == nil { + templ_7745c5c3_Var2 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("001Admin
002Tes
") + 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 Pagination() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var3 := templ.GetChildren(ctx) + if templ_7745c5c3_Var3 == nil { + templ_7745c5c3_Var3 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -58,9 +115,9 @@ func CssMasterMenuUserGroup() templ.Component { defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var2 := templ.GetChildren(ctx) - if templ_7745c5c3_Var2 == nil { - templ_7745c5c3_Var2 = templ.NopComponent + templ_7745c5c3_Var4 := templ.GetChildren(ctx) + if templ_7745c5c3_Var4 == nil { + templ_7745c5c3_Var4 = templ.NopComponent } ctx = templ.ClearChildren(ctx) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") @@ -82,9 +139,9 @@ func JsMasterMenuUserGroup() templ.Component { defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templ.GetChildren(ctx) - if templ_7745c5c3_Var3 == nil { - templ_7745c5c3_Var3 = templ.NopComponent + templ_7745c5c3_Var5 := templ.GetChildren(ctx) + if templ_7745c5c3_Var5 == nil { + templ_7745c5c3_Var5 = templ.NopComponent } ctx = templ.ClearChildren(ctx) if !templ_7745c5c3_IsBuffer { @@ -102,12 +159,12 @@ func ShowMasterMenuUserGroup(title string, cmp templ.Component, css templ.Compon defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var4 := templ.GetChildren(ctx) - if templ_7745c5c3_Var4 == nil { - templ_7745c5c3_Var4 = templ.NopComponent + templ_7745c5c3_Var6 := templ.GetChildren(ctx) + if templ_7745c5c3_Var6 == nil { + templ_7745c5c3_Var6 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var5 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var7 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) if !templ_7745c5c3_IsBuffer { templ_7745c5c3_Buffer = templ.GetBuffer() @@ -122,7 +179,7 @@ func ShowMasterMenuUserGroup(title string, cmp templ.Component, css templ.Compon } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, dataMenu, dataUser).Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, dataMenu, dataUser).Render(templ.WithChildren(ctx, templ_7745c5c3_Var7), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/views/xsample/coba.templ b/views/xsample/coba.templ index 08351fa..1fe07c8 100644 --- a/views/xsample/coba.templ +++ b/views/xsample/coba.templ @@ -4,10 +4,12 @@ import ( "github.com/emarifer/go-templ-project-structure/views/layout" "github.com/emarifer/go-templ-project-structure/services" "github.com/emarifer/go-templ-project-structure/models" + "github.com/emarifer/go-templ-project-structure/views/component/table" ) templ Coba(title string) {
{ title }
+ @tablecomponent.Table([]string{"kode", "user group", "aksi"}, []string{"40%", "40%", "20%"}, tr(), pagination()) } templ CssCoba() { @@ -16,6 +18,48 @@ templ CssCoba() { templ JsCoba() { } +templ tr() { + + 001 + Admin + +
+ + +
+ + + + 002 + Tes + +
+ + +
+ + +} + +templ pagination() { +
+
+ + + ... + 23 + 24 + 25 + 26 + 27 + 28 + ... + + +
+
+} + templ ShowCoba(title string, cmp templ.Component, css templ.Component, js templ.Component, dataMenu []services.MasterMenu, dataUser models.User) { @layout.CorporateLayout(title, css, js, dataMenu, dataUser) { @cmp diff --git a/views/xsample/coba_templ.go b/views/xsample/coba_templ.go index 932685b..d6be95f 100644 --- a/views/xsample/coba_templ.go +++ b/views/xsample/coba_templ.go @@ -13,6 +13,7 @@ import "bytes" import ( "github.com/emarifer/go-templ-project-structure/models" "github.com/emarifer/go-templ-project-structure/services" + "github.com/emarifer/go-templ-project-structure/views/component/table" "github.com/emarifer/go-templ-project-structure/views/layout" ) @@ -36,7 +37,7 @@ func Coba(title string) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\xsample\coba.templ`, Line: 10, Col: 13} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\xsample\coba.templ`, Line: 11, Col: 13} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -46,6 +47,10 @@ func Coba(title string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + templ_7745c5c3_Err = tablecomponent.Table([]string{"kode", "user group", "aksi"}, []string{"40%", "40%", "20%"}, tr(), pagination()).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) } @@ -93,7 +98,7 @@ func JsCoba() templ.Component { }) } -func ShowCoba(title string, cmp templ.Component, css templ.Component, js templ.Component, dataMenu []services.MasterMenu, dataUser models.User) templ.Component { +func tr() 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 { @@ -106,7 +111,55 @@ func ShowCoba(title string, cmp templ.Component, css templ.Component, js templ.C templ_7745c5c3_Var5 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var6 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("001Admin
002Tes
") + 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 pagination() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var6 := templ.GetChildren(ctx) + if templ_7745c5c3_Var6 == nil { + templ_7745c5c3_Var6 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + 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 ShowCoba(title string, cmp templ.Component, css templ.Component, js templ.Component, dataMenu []services.MasterMenu, dataUser models.User) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var7 := templ.GetChildren(ctx) + if templ_7745c5c3_Var7 == nil { + templ_7745c5c3_Var7 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var8 := 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() @@ -121,7 +174,7 @@ func ShowCoba(title string, cmp templ.Component, css templ.Component, js templ.C } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, dataMenu, dataUser).Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, dataMenu, dataUser).Render(templ.WithChildren(ctx, templ_7745c5c3_Var8), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } From 89bac6fabe5d4a1eb62b1691fc394c290fbac2e1 Mon Sep 17 00:00:00 2001 From: Sas Andy Date: Fri, 3 May 2024 16:45:58 +0700 Subject: [PATCH 06/12] custom buton tosca --- .../asset-corporate-portal/css/sas.bundle.css | 569 +++++++++++++++++- 1 file changed, 568 insertions(+), 1 deletion(-) diff --git a/assets/asset-corporate-portal/css/sas.bundle.css b/assets/asset-corporate-portal/css/sas.bundle.css index dad9a39..4a6dafd 100644 --- a/assets/asset-corporate-portal/css/sas.bundle.css +++ b/assets/asset-corporate-portal/css/sas.bundle.css @@ -193,7 +193,7 @@ a.text-white:focus { background-color: var(--grey) !important; } .bg-header-table { - background-color: var(--text-header-table) !important; + background-color: var(--header-table-bg) !important; } .bg-primary { background-color: var(--primary) !important; @@ -565,6 +565,39 @@ a.text-white:focus { -webkit-box-shadow: 0 0 0 0.2rem rgba(54, 153, 255, 0.5); box-shadow: 0 0 0 0.2rem rgba(54, 153, 255, 0.5); } +/* ## BUTTON OUTLINE TOSCA*/ +.btn-outline-tosca { + color: var(--tosca) !important; + border-color: var(--tosca) !important; +} +.btn-outline-tosca:hover { + color: #ffffff !important; + background-color: var(--tosca) !important; + border-color: var(--tosca) !important; +} +.btn-outline-tosca:focus, +.btn-outline-tosca.focus { + -webkit-box-shadow: 0 0 0 0.2rem rgba(54, 153, 255, 0.5); + box-shadow: 0 0 0 0.2rem rgba(54, 153, 255, 0.5); +} +.btn-outline-tosca.disabled, +.btn-outline-tosca:disabled { + color: var(--tosca) !important; + background-color: transparent; +} +.btn-outline-tosca:not(:disabled):not(.disabled):active, +.btn-outline-tosca:not(:disabled):not(.disabled).active, +.show > .btn-outline-tosca.dropdown-toggle { + color: #ffffff !important; + background-color: var(--tosca) !important; + border-color: var(--tosca) !important; +} +.btn-outline-tosca:not(:disabled):not(.disabled):active:focus, +.btn-outline-tosca:not(:disabled):not(.disabled).active:focus, +.show > .btn-outline-tosca.dropdown-toggle:focus { + -webkit-box-shadow: 0 0 0 0.2rem rgba(54, 153, 255, 0.5); + box-shadow: 0 0 0 0.2rem rgba(54, 153, 255, 0.5); +} /* ## BUTTON OUTLINE SECONDARY*/ .btn-outline-secondary { @@ -919,6 +952,147 @@ a.text-white:focus { .show .btn.btn-light-primary.btn-dropdown.dropdown-toggle:after { color: #ffffff !important; } + +/* ## BUTTON LIGHT TOSCA*/ + +.btn.btn-light-tosca { + color: var(--tosca) !important; + background-color: var(--toscabg) !important; + border-color: transparent; +} +.btn.btn-light-tosca i { + color: var(--tosca) !important; +} +.btn.btn-light-tosca .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--tosca) !important; +} +.btn.btn-light-tosca .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-light-tosca.dropdown-toggle:after { + color: var(--tosca) !important; +} +.btn.btn-light-tosca:hover:not(.btn-text):not(:disabled):not(.disabled), +.btn.btn-light-tosca:focus:not(.btn-text), +.btn.btn-light-tosca.focus:not(.btn-text) { + color: #ffffff !important; + background-color: var(--tosca) !important; + border-color: transparent; +} +.btn.btn-light-tosca:hover:not(.btn-text):not(:disabled):not(.disabled) i, +.btn.btn-light-tosca:focus:not(.btn-text) i, +.btn.btn-light-tosca.focus:not(.btn-text) i { + color: #ffffff !important; +} +.btn.btn-light-tosca:hover:not(.btn-text):not(:disabled):not(.disabled) + .svg-icon + svg + g + [fill], +.btn.btn-light-tosca:focus:not(.btn-text) .svg-icon svg g [fill], +.btn.btn-light-tosca.focus:not(.btn-text) .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: #ffffff !important; +} +.btn.btn-light-tosca:hover:not(.btn-text):not(:disabled):not(.disabled) + .svg-icon + svg:hover + g + [fill], +.btn.btn-light-tosca:focus:not(.btn-text) .svg-icon svg:hover g [fill], +.btn.btn-light-tosca.focus:not(.btn-text) .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-light-tosca:hover:not(.btn-text):not(:disabled):not( + .disabled + ).dropdown-toggle:after, +.btn.btn-light-tosca:focus:not(.btn-text).dropdown-toggle:after, +.btn.btn-light-tosca.focus:not(.btn-text).dropdown-toggle:after { + color: #ffffff !important; +} +.btn.btn-light-tosca.disabled, +.btn.btn-light-tosca:disabled { + color: var(--tosca) !important; + background-color: #e1f0ff; + border-color: transparent; +} +.btn.btn-light-tosca.disabled i, +.btn.btn-light-tosca:disabled i { + color: var(--tosca) !important; +} +.btn.btn-light-tosca.disabled .svg-icon svg g [fill], +.btn.btn-light-tosca:disabled .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--tosca) !important; +} +.btn.btn-light-tosca.disabled .svg-icon svg:hover g [fill], +.btn.btn-light-tosca:disabled .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-light-tosca.disabled.dropdown-toggle:after, +.btn.btn-light-tosca:disabled.dropdown-toggle:after { + color: var(--tosca) !important; +} +.btn.btn-light-tosca:not(:disabled):not(.disabled):active:not(.btn-text), +.btn.btn-light-tosca:not(:disabled):not(.disabled).active, +.show > .btn.btn-light-tosca.dropdown-toggle, +.show .btn.btn-light-tosca.btn-dropdown { + color: #ffffff !important; + background-color: var(--tosca) !important; + border-color: transparent; +} +.btn.btn-light-tosca:not(:disabled):not(.disabled):active:not(.btn-text) i, +.btn.btn-light-tosca:not(:disabled):not(.disabled).active i, +.show > .btn.btn-light-tosca.dropdown-toggle i, +.show .btn.btn-light-tosca.btn-dropdown i { + color: #ffffff !important; +} +.btn.btn-light-tosca:not(:disabled):not(.disabled):active:not(.btn-text) + .svg-icon + svg + g + [fill], +.btn.btn-light-tosca:not(:disabled):not(.disabled).active + .svg-icon + svg + g + [fill], +.show > .btn.btn-light-tosca.dropdown-toggle .svg-icon svg g [fill], +.show .btn.btn-light-tosca.btn-dropdown .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: #ffffff !important; +} +.btn.btn-light-tosca:not(:disabled):not(.disabled):active:not(.btn-text) + .svg-icon + svg:hover + g + [fill], +.btn.btn-light-tosca:not(:disabled):not(.disabled).active + .svg-icon + svg:hover + g + [fill], +.show > .btn.btn-light-tosca.dropdown-toggle .svg-icon svg:hover g [fill], +.show .btn.btn-light-tosca.btn-dropdown .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-light-tosca:not(:disabled):not(.disabled):active:not( + .btn-text + ).dropdown-toggle:after, +.btn.btn-light-tosca:not(:disabled):not(.disabled).active.dropdown-toggle:after, +.show > .btn.btn-light-tosca.dropdown-toggle.dropdown-toggle:after, +.show .btn.btn-light-tosca.btn-dropdown.dropdown-toggle:after { + color: #ffffff !important; +} /* ## BUTTON LIGHT SECONDARY*/ .btn.btn-light-secondary { @@ -1689,6 +1863,65 @@ a.text-white:focus { .show .btn.btn-hover-light-primary.btn-dropdown.dropdown-toggle:after { color: var(--primary) !important; } + +/* ## BUTTON HOVER LIGHT TOSCA*/ +.btn.btn-hover-light-tosca:not(:disabled):not(.disabled):active:not(.btn-text), +.btn.btn-hover-light-tosca:not(:disabled):not(.disabled).active, +.show > .btn.btn-hover-light-tosca.dropdown-toggle, +.show .btn.btn-hover-light-tosca.btn-dropdown { + color: var(--tosca) !important; + background-color: var(--toscabg) !important; + border-color: transparent; +} +.btn.btn-hover-light-tosca:not(:disabled):not(.disabled):active:not(.btn-text) + i, +.btn.btn-hover-light-tosca:not(:disabled):not(.disabled).active i, +.show > .btn.btn-hover-light-tosca.dropdown-toggle i, +.show .btn.btn-hover-light-tosca.btn-dropdown i { + color: var(--tosca) !important; +} +.btn.btn-hover-light-tosca:not(:disabled):not(.disabled):active:not(.btn-text) + .svg-icon + svg + g + [fill], +.btn.btn-hover-light-tosca:not(:disabled):not(.disabled).active + .svg-icon + svg + g + [fill], +.show > .btn.btn-hover-light-tosca.dropdown-toggle .svg-icon svg g [fill], +.show .btn.btn-hover-light-tosca.btn-dropdown .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--tosca) !important; +} +.btn.btn-hover-light-tosca:not(:disabled):not(.disabled):active:not(.btn-text) + .svg-icon + svg:hover + g + [fill], +.btn.btn-hover-light-tosca:not(:disabled):not(.disabled).active + .svg-icon + svg:hover + g + [fill], +.show > .btn.btn-hover-light-tosca.dropdown-toggle .svg-icon svg:hover g [fill], +.show .btn.btn-hover-light-tosca.btn-dropdown .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-hover-light-tosca:not(:disabled):not(.disabled):active:not( + .btn-text + ).dropdown-toggle:after, +.btn.btn-hover-light-tosca:not(:disabled):not( + .disabled + ).active.dropdown-toggle:after, +.show > .btn.btn-hover-light-tosca.dropdown-toggle.dropdown-toggle:after, +.show .btn.btn-hover-light-tosca.btn-dropdown.dropdown-toggle:after { + color: var(--tosca) !important; +} + /* ## BUTTON HOVER LIGHT SECONDARY*/ .btn.btn-hover-light-secondary:hover:not(.btn-text):not(:disabled):not( @@ -2286,6 +2519,15 @@ a.text-white:focus { color: var(--warning); } +/* ## BUTTON WARNING */ +.btn.btn-text-tosca { + color: var(--tosca); +} +.btn.btn-text-tosca.disabled, +.btn.btn-text-tosca:disabled { + color: var(--tosca); +} + /* ### BUTTON HOVER BG */ /* ## BUTTON HOVER BG PRIMARY */ .btn.btn-hover-bg-primary:hover:not(.btn-text):not(:disabled):not(.disabled), @@ -2378,6 +2620,23 @@ a.text-white:focus { background-color: var(--danger) !important; border-color: var(--danger) !important; } + +/* ## BUTTON HOVER BG TOSCA */ +.btn.btn-hover-bg-tosca:hover:not(.btn-text):not(:disabled):not(.disabled), +.btn.btn-hover-bg-tosca:focus:not(.btn-text), +.btn.btn-hover-bg-tosca.focus:not(.btn-text) { + background-color: var(--tosca) !important; + border-color: var(--tosca) !important; +} + +.btn.btn-hover-bg-tosca:not(:disabled):not(.disabled):active:not(.btn-text), +.btn.btn-hover-bg-tosca:not(:disabled):not(.disabled).active, +.show > .btn.btn-hover-bg-tosca.dropdown-toggle, +.show .btn.btn-hover-bg-tosca.btn-dropdown { + background-color: var(--tosca) !important; + border-color: var(--tosca) !important; +} + /* ### BUTTON HOVER */ /* ## BUTTON HOVER PRIMARY */ .btn.btn-hover-primary:hover:not(.btn-text):not(:disabled):not(.disabled), @@ -2960,6 +3219,101 @@ a.text-white:focus { .show .btn.btn-hover-warning.btn-dropdown.dropdown-toggle:after { color: #ffffff !important; } +/* ## BUTTON HOVER TOSCA */ +.btn.btn-hover-tosca:hover:not(.btn-text):not(:disabled):not(.disabled), +.btn.btn-hover-tosca:focus:not(.btn-text), +.btn.btn-hover-tosca.focus:not(.btn-text) { + color: #ffffff !important; + background-color: var(--tosca) !important; + border-color: var(--tosca) !important; +} +.btn.btn-hover-tosca:hover:not(.btn-text):not(:disabled):not(.disabled) i, +.btn.btn-hover-tosca:focus:not(.btn-text) i, +.btn.btn-hover-tosca.focus:not(.btn-text) i { + color: #ffffff !important; +} +.btn.btn-hover-tosca:hover:not(.btn-text):not(:disabled):not(.disabled) + .svg-icon + svg + g + [fill], +.btn.btn-hover-tosca:focus:not(.btn-text) .svg-icon svg g [fill], +.btn.btn-hover-tosca.focus:not(.btn-text) .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: #ffffff !important; +} +.btn.btn-hover-tosca:hover:not(.btn-text):not(:disabled):not(.disabled) + .svg-icon + svg:hover + g + [fill], +.btn.btn-hover-tosca:focus:not(.btn-text) .svg-icon svg:hover g [fill], +.btn.btn-hover-tosca.focus:not(.btn-text) .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-hover-tosca:hover:not(.btn-text):not(:disabled):not( + .disabled + ).dropdown-toggle:after, +.btn.btn-hover-tosca:focus:not(.btn-text).dropdown-toggle:after, +.btn.btn-hover-tosca.focus:not(.btn-text).dropdown-toggle:after { + color: #ffffff !important; +} + +.btn.btn-hover-tosca:not(:disabled):not(.disabled):active:not(.btn-text), +.btn.btn-hover-tosca:not(:disabled):not(.disabled).active, +.show > .btn.btn-hover-tosca.dropdown-toggle, +.show .btn.btn-hover-tosca.btn-dropdown { + color: #ffffff !important; + background-color: var(--tosca) !important; + border-color: var(--tosca) !important; +} +.btn.btn-hover-tosca:not(:disabled):not(.disabled):active:not(.btn-text) i, +.btn.btn-hover-tosca:not(:disabled):not(.disabled).active i, +.show > .btn.btn-hover-tosca.dropdown-toggle i, +.show .btn.btn-hover-tosca.btn-dropdown i { + color: #ffffff !important; +} +.btn.btn-hover-tosca:not(:disabled):not(.disabled):active:not(.btn-text) + .svg-icon + svg + g + [fill], +.btn.btn-hover-tosca:not(:disabled):not(.disabled).active + .svg-icon + svg + g + [fill], +.show > .btn.btn-hover-tosca.dropdown-toggle .svg-icon svg g [fill], +.show .btn.btn-hover-tosca.btn-dropdown .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: #ffffff !important; +} +.btn.btn-hover-tosca:not(:disabled):not(.disabled):active:not(.btn-text) + .svg-icon + svg:hover + g + [fill], +.btn.btn-hover-tosca:not(:disabled):not(.disabled).active + .svg-icon + svg:hover + g + [fill], +.show > .btn.btn-hover-tosca.dropdown-toggle .svg-icon svg:hover g [fill], +.show .btn.btn-hover-tosca.btn-dropdown .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-hover-tosca:not(:disabled):not(.disabled):active:not( + .btn-text + ).dropdown-toggle:after, +.btn.btn-hover-tosca:not(:disabled):not(.disabled).active.dropdown-toggle:after, +.show > .btn.btn-hover-tosca.dropdown-toggle.dropdown-toggle:after, +.show .btn.btn-hover-tosca.btn-dropdown.dropdown-toggle:after { + color: #ffffff !important; +} /* ### BUTTON LINK */ /* ## BUTTON LINK PRIMARY*/ @@ -3535,6 +3889,7 @@ a.text-white:focus { .show .btn.btn-link-info.btn-dropdown.dropdown-toggle:after { color: var(--info) !important; } + /* ## BUTTON LINK WARNING*/ .btn.btn-link-warning { border: 0; @@ -3679,6 +4034,7 @@ a.text-white:focus { .show .btn.btn-link-warning.btn-dropdown.dropdown-toggle:after { color: var(--warning) !important; } + /* ## BUTTON LINK DANGER*/ .btn.btn-link-danger { border: 0; @@ -3822,6 +4178,145 @@ a.text-white:focus { color: var(--danger) !important; } +/* ## BUTTON LINK TOSCA*/ +.btn.btn-link-tosca { + border: 0; + padding: 0 !important; + border-radius: 0 !important; + color: var(--tosca) !important; + background-color: transparent !important; + border-color: transparent !important; +} +.btn.btn-link-tosca i { + color: var(--tosca) !important; +} +.btn.btn-link-tosca .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--tosca) !important; +} +.btn.btn-link-tosca .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-link-tosca.dropdown-toggle:after { + color: var(--tosca) !important; +} +.btn.btn-link-tosca:hover:not(.btn-text):not(:disabled):not(.disabled), +.btn.btn-link-tosca:focus:not(.btn-text), +.btn.btn-link-tosca.focus:not(.btn-text) { + color: var(--tosca) !important; + background-color: transparent !important; + border-color: transparent !important; +} +.btn.btn-link-tosca:hover:not(.btn-text):not(:disabled):not(.disabled) i, +.btn.btn-link-tosca:focus:not(.btn-text) i, +.btn.btn-link-tosca.focus:not(.btn-text) i { + color: var(--tosca) !important; +} +.btn.btn-link-tosca:hover:not(.btn-text):not(:disabled):not(.disabled) + .svg-icon + svg + g + [fill], +.btn.btn-link-tosca:focus:not(.btn-text) .svg-icon svg g [fill], +.btn.btn-link-tosca.focus:not(.btn-text) .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--tosca) !important; +} +.btn.btn-link-tosca:hover:not(.btn-text):not(:disabled):not(.disabled) + .svg-icon + svg:hover + g + [fill], +.btn.btn-link-tosca:focus:not(.btn-text) .svg-icon svg:hover g [fill], +.btn.btn-link-tosca.focus:not(.btn-text) .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-link-tosca:hover:not(.btn-text):not(:disabled):not( + .disabled + ).dropdown-toggle:after, +.btn.btn-link-tosca:focus:not(.btn-text).dropdown-toggle:after, +.btn.btn-link-tosca.focus:not(.btn-text).dropdown-toggle:after { + color: var(--tosca) !important; +} +.btn.btn-link-tosca.disabled, +.btn.btn-link-tosca:disabled { + color: var(--tosca) !important; + background-color: transparent !important; + border-color: transparent !important; +} +.btn.btn-link-tosca.disabled i, +.btn.btn-link-tosca:disabled i { + color: var(--tosca) !important; +} +.btn.btn-link-tosca.disabled .svg-icon svg g [fill], +.btn.btn-link-tosca:disabled .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--tosca) !important; +} +.btn.btn-link-tosca.disabled .svg-icon svg:hover g [fill], +.btn.btn-link-tosca:disabled .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-link-tosca.disabled.dropdown-toggle:after, +.btn.btn-link-tosca:disabled.dropdown-toggle:after { + color: var(--tosca) !important; +} +.btn.btn-link-tosca:not(:disabled):not(.disabled):active:not(.btn-text), +.btn.btn-link-tosca:not(:disabled):not(.disabled).active, +.show > .btn.btn-link-tosca.dropdown-toggle, +.show .btn.btn-link-tosca.btn-dropdown { + color: var(--tosca) !important; + background-color: transparent !important; + border-color: transparent !important; +} +.btn.btn-link-tosca:not(:disabled):not(.disabled):active:not(.btn-text) i, +.btn.btn-link-tosca:not(:disabled):not(.disabled).active i, +.show > .btn.btn-link-tosca.dropdown-toggle i, +.show .btn.btn-link-tosca.btn-dropdown i { + color: var(--tosca) !important; +} +.btn.btn-link-tosca:not(:disabled):not(.disabled):active:not(.btn-text) + .svg-icon + svg + g + [fill], +.btn.btn-link-tosca:not(:disabled):not(.disabled).active .svg-icon svg g [fill], +.show > .btn.btn-link-tosca.dropdown-toggle .svg-icon svg g [fill], +.show .btn.btn-link-tosca.btn-dropdown .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--tosca) !important; +} +.btn.btn-link-tosca:not(:disabled):not(.disabled):active:not(.btn-text) + .svg-icon + svg:hover + g + [fill], +.btn.btn-link-tosca:not(:disabled):not(.disabled).active + .svg-icon + svg:hover + g + [fill], +.show > .btn.btn-link-tosca.dropdown-toggle .svg-icon svg:hover g [fill], +.show .btn.btn-link-tosca.btn-dropdown .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} +.btn.btn-link-tosca:not(:disabled):not(.disabled):active:not( + .btn-text + ).dropdown-toggle:after, +.btn.btn-link-tosca:not(:disabled):not(.disabled).active.dropdown-toggle:after, +.show > .btn.btn-link-tosca.dropdown-toggle.dropdown-toggle:after, +.show .btn.btn-link-tosca.btn-dropdown.dropdown-toggle:after { + color: var(--tosca) !important; +} + /* ### BUTTON SHADOW */ /* ## BUTTON SHADOW PRIMARY */ .btn.btn-primary.btn-shadow { @@ -4002,6 +4497,41 @@ a.text-white:focus { -webkit-box-shadow: 0px 9px 16px 0px rgba(var(--dangerrgb), var(--opacity03)) !important; box-shadow: 0px 9px 16px 0px rgba(var(--dangerrgb), var(--opacity03)) !important; } +/* ## BUTTON SHADOW TOSCA */ +.btn.btn-tosca.btn-shadow { + -webkit-box-shadow: 0px 9px 16px 0px rgba(var(--toscargb), var(--opacity02)) !important; + box-shadow: 0px 9px 16px 0px rgba(var(--toscargb), var(--opacity02)) !important; +} +.btn.btn-tosca.btn-shadow:hover:not(.btn-text):not(:disabled):not(.disabled), +.btn.btn-tosca.btn-shadow:focus:not(.btn-text), +.btn.btn-tosca.btn-shadow.focus:not(.btn-text) { + -webkit-box-shadow: 0px 9px 16px 0px rgba(var(--toscargb), var(--opacity03)) !important; + box-shadow: 0px 9px 16px 0px rgba(var(--toscargb), var(--opacity03)) !important; +} +.btn.btn-tosca.btn-shadow:not(:disabled):not(.disabled):active:not(.btn-text), +.btn.btn-tosca.btn-shadow:not(:disabled):not(.disabled).active, +.show > .btn.btn-tosca.btn-shadow.dropdown-toggle { + -webkit-box-shadow: 0px 9px 16px 0px rgba(var(--toscargb), var(--opacity03)) !important; + box-shadow: 0px 9px 16px 0px rgba(var(--toscargb), var(--opacity03)) !important; +} + +.btn.btn-tosca.btn-shadow-hover:hover:not(.btn-text):not(:disabled):not( + .disabled + ), +.btn.btn-tosca.btn-shadow-hover:focus:not(.btn-text), +.btn.btn-tosca.btn-shadow-hover.focus:not(.btn-text) { + -webkit-box-shadow: 0px 9px 16px 0px rgba(var(--toscargb), var(--opacity03)) !important; + box-shadow: 0px 9px 16px 0px rgba(var(--toscargb), var(--opacity03)) !important; +} + +.btn.btn-tosca.btn-shadow-hover:not(:disabled):not(.disabled):active:not( + .btn-text + ), +.btn.btn-tosca.btn-shadow-hover:not(:disabled):not(.disabled).active, +.show > .btn.btn-tosca.btn-shadow-hover.dropdown-toggle { + -webkit-box-shadow: 0px 9px 16px 0px rgba(var(--toscargb), var(--opacity03)) !important; + box-shadow: 0px 9px 16px 0px rgba(var(--toscargb), var(--opacity03)) !important; +} /* ## PRIMARY */ .btn.btn-hover-text-primary:not(:disabled):not(.disabled):active:not(.btn-text), @@ -4103,6 +4633,43 @@ a.text-white:focus { line-height: 22px !important; text-align: center !important; } +/* ### TABLE */ +/* ## BORDER RADIUS */ +table th { + background-color: var(--header-table-bg) !important; +} +th { + color: var(--text-header-table) !important; + font-family: Poppins !important; + font-size: 12px !important; + font-style: normal !important; + font-weight: 600 !important; + line-height: normal !important; + letter-spacing: 0.36px !important; +} +td { + color: var(--text-black) !important; + font-family: Poppins !important; + justify-content: center !important; + vertical-align: middle !important; + font-size: 14px !important; + font-style: normal !important; + font-weight: 600 !important; + line-height: normal !important; + padding-top: 20px !important; + padding-bottom: 20px !important; +} + +td:first-child, +th:first-child { + border-radius: 6px 0 0 6px !important; + padding-left: 20px !important; +} +td:last-child, +th:last-child { + border-radius: 0 6px 6px 0 !important; +} + /* ### BUTTON HOVER TEXT */ /* ### */ /* ## PRIMARY */ From 559f0b41a234050c3f0deb59c9b9ca692664ca6e Mon Sep 17 00:00:00 2001 From: Sas Andy Date: Fri, 3 May 2024 16:54:04 +0700 Subject: [PATCH 07/12] user group table --- models/table.models.go | 1 + .../component/navbarmaster/navbarmaster.templ | 655 +++++++++++++++ .../navbarmaster/navbarmaster_templ.go | 138 ++++ views/layout/layout_corporate.templ | 177 ++++ views/layout/layout_corporate_templ.go | 73 ++ .../mastermenuusergroup.templ | 764 ++---------------- .../mastermenuusergroup_templ.go | 62 +- 7 files changed, 1138 insertions(+), 732 deletions(-) create mode 100644 models/table.models.go create mode 100644 views/component/navbarmaster/navbarmaster.templ create mode 100644 views/component/navbarmaster/navbarmaster_templ.go create mode 100644 views/layout/layout_corporate.templ create mode 100644 views/layout/layout_corporate_templ.go diff --git a/models/table.models.go b/models/table.models.go new file mode 100644 index 0000000..2640e7f --- /dev/null +++ b/models/table.models.go @@ -0,0 +1 @@ +package models diff --git a/views/component/navbarmaster/navbarmaster.templ b/views/component/navbarmaster/navbarmaster.templ new file mode 100644 index 0000000..e501b68 --- /dev/null +++ b/views/component/navbarmaster/navbarmaster.templ @@ -0,0 +1,655 @@ +package navbarmaster + +import ( + "github.com/emarifer/go-templ-project-structure/views/component/sidebarmaster" + "github.com/emarifer/go-templ-project-structure/services" +) + +templ MainNavbar(datamenu []services.MasterMenu) { +
+ +
+ + + +
+ +
+} + +templ Navbarmaster(datamenu []services.MasterMenu, content templ.Component) { + +
+ + + Logo + + + +
+ + + + + + +
+ +
+ + +
+ +
+ +
+ +
+ + + + + + +
+ + + @MainNavbar(datamenu) + +
+ + +
+ +
+ +
+ +
+ + +
+ +
+
+ Hi, + Sean + + S + +
+
+ +
+ +
+ +
+ + + @content + +
+ +
+ +
+ +} + +templ Navbaruserprofile() { +
+ +
+

+ User Profile + 12 messages +

+ + + +
+ + +
+ +
+
+
+ +
+ +
+ + +
+ + + + + +
+ + +
+ +
+ Recent Notifications +
+ + +
+ + + + + + + + + + + + + + +28% +
+ + +
+ + + + + + + + + + + + +
+ + Would + be to people + + Due in 2 Days +
+ +50% +
+ + +
+ + + + + + + + + + + + + + -27% +
+ + +
+ + + + + + + + + + + + + + +
+ + The + best product + + Due in 2 Days +
+ +8% +
+ +
+ +
+ +
+} diff --git a/views/component/navbarmaster/navbarmaster_templ.go b/views/component/navbarmaster/navbarmaster_templ.go new file mode 100644 index 0000000..7fb123b --- /dev/null +++ b/views/component/navbarmaster/navbarmaster_templ.go @@ -0,0 +1,138 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package navbarmaster + +//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 ( + "github.com/emarifer/go-templ-project-structure/services" + "github.com/emarifer/go-templ-project-structure/views/component/sidebarmaster" +) + +func MainNavbar(datamenu []services.MasterMenu) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + 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("
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for index, d := range datamenu { + if index == 0 { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = sidebarmaster.MenuDashboard(d.ParentMenuName, d.ParentUrl).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
  • Menu

  • ") + 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 index+1 < len(datamenu) { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = sidebarmaster.ListMenuNavbar(datamenu[index+1].ParentMenuName, datamenu[index+1].Children).Render(ctx, templ_7745c5c3_Buffer) + 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func Navbarmaster(datamenu []services.MasterMenu, content templ.Component) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var2 := templ.GetChildren(ctx) + if templ_7745c5c3_Var2 == nil { + templ_7745c5c3_Var2 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
\"Logo\"
\"Logo\"
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = MainNavbar(datamenu).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Hi, Sean S
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = content.Render(ctx, templ_7745c5c3_Buffer) + 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func Navbaruserprofile() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var3 := templ.GetChildren(ctx) + if templ_7745c5c3_Var3 == nil { + templ_7745c5c3_Var3 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + 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 + }) +} diff --git a/views/layout/layout_corporate.templ b/views/layout/layout_corporate.templ new file mode 100644 index 0000000..84e01e0 --- /dev/null +++ b/views/layout/layout_corporate.templ @@ -0,0 +1,177 @@ +package layout + +// LAYOUT PLAYGROUND +templ CorporateLayout(title string, css templ.Component, js templ.Component) { + + + + + + + + Company Portal | { title } + + + + + + + + + + + + + + + + + + + + + + + @css + + + + + // htmx + + + { children... } + + + + + + + + + + + + @js + + + + +} diff --git a/views/layout/layout_corporate_templ.go b/views/layout/layout_corporate_templ.go new file mode 100644 index 0000000..2fa0c4a --- /dev/null +++ b/views/layout/layout_corporate_templ.go @@ -0,0 +1,73 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package layout + +//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" + +// LAYOUT PLAYGROUND +func CorporateLayout(title string, css templ.Component, js templ.Component) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Company Portal | ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var2 string + templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\layout\layout_corporate.templ`, Line: 23, 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 + } + templ_7745c5c3_Err = css.Render(ctx, templ_7745c5c3_Buffer) + 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_Var1.Render(ctx, templ_7745c5c3_Buffer) + 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 = js.Render(ctx, templ_7745c5c3_Buffer) + 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} diff --git a/views/mastermenuusergroup/mastermenuusergroup.templ b/views/mastermenuusergroup/mastermenuusergroup.templ index 624e94f..8d2baf0 100644 --- a/views/mastermenuusergroup/mastermenuusergroup.templ +++ b/views/mastermenuusergroup/mastermenuusergroup.templ @@ -1,704 +1,20 @@ package mastermenuusergroup import ( + "github.com/emarifer/go-templ-project-structure/views/component/breadcrumbadmin" "github.com/emarifer/go-templ-project-structure/views/layout" "github.com/emarifer/go-templ-project-structure/services" - "github.com/emarifer/go-templ-project-structure/views/component/sidebarmaster" - "github.com/emarifer/go-templ-project-structure/views/component/breadcrumbadmin" + "github.com/emarifer/go-templ-project-structure/views/component/navbarmaster" ) - -templ MainNavbar(datamenu []services.MasterMenu) { -
- -
- - - -
- -
-} - templ MainMasterMenuUserGroup(datamenu []services.MasterMenu) { -
- - - Logo - - - -
- - - - - - - - - -
- -
+ @navbarmaster.Navbarmaster(datamenu, ContentMasterMenuUserGroup()) -
- -
- -
- -
- - - - - - -
- - - @MainNavbar(datamenu) - -
- - -
- -
- -
- -
- - -
- -
-
- Hi, - Sean - - S - -
-
- -
- -
- -
- - -
-
- @breadcrumadmin.MainBreadcrumbAdmin() -
-
- - - - -
- -
- -
-
- -
-

- User Profile - 12 messages -

- - - -
- - -
- -
-
-
- -
- -
- - -
- - - - - -
- - -
- -
- Recent Notifications -
- - -
- - - - - - - - - - - - - - +28% -
- - -
- - - - - - - - - - - - -
- - Would - be to people - - Due in 2 Days -
- +50% -
- - -
- - - - - - - - - - - - - - -27% -
- - -
- - - - - - - - - - - - - - -
- - The - best product - - Due in 2 Days -
- +8% -
- -
- -
- -
+ @navbarmaster.Navbaruserprofile()
@@ -727,6 +43,78 @@ templ MainMasterMenuUserGroup(datamenu []services.MasterMenu) { } +templ ContentMasterMenuUserGroup() { +
+
+
+ @breadcrumadmin.MainBreadcrumbAdmin() +
+
+ //
+
+ +
+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + +
KODEUSER GROUPACTION
001Admin +
+ + +
+
002Tes +
+ + +
+
+
+
+ +
+
+ + + ... + 23 + 24 + 25 + 26 + 27 + 28 + ... + + +
+
+ +
+
+} + templ CssMasterMenuUserGroup() {
    ") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - for index, d := range datamenu { - if index == 0 { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = sidebarmaster.MenuDashboard(d.ParentMenuName, d.ParentUrl).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
  • Menu

  • ") - 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 index+1 < len(datamenu) { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = sidebarmaster.ListMenuNavbar(datamenu[index+1].ParentMenuName, datamenu[index+1].Children).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } + templ_7745c5c3_Err = navbarmaster.Navbarmaster(datamenu, ContentMasterMenuUserGroup()).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = navbarmaster.Navbaruserprofile().Render(ctx, templ_7745c5c3_Buffer) + 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 } @@ -75,7 +57,7 @@ func MainNavbar(datamenu []services.MasterMenu) templ.Component { }) } -func MainMasterMenuUserGroup(datamenu []services.MasterMenu) templ.Component { +func ContentMasterMenuUserGroup() 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 { @@ -88,15 +70,7 @@ func MainMasterMenuUserGroup(datamenu []services.MasterMenu) templ.Component { templ_7745c5c3_Var2 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
\"Logo\"
\"Logo\"
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = MainNavbar(datamenu).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Hi, Sean S
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -104,7 +78,7 @@ func MainMasterMenuUserGroup(datamenu []services.MasterMenu) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
KODEUSER GROUPACTION
001Admin
002Tes
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } From f527eaa17ea41fea12138ab136bb616bfb8c6e29 Mon Sep 17 00:00:00 2001 From: Sas Andy Date: Mon, 6 May 2024 13:27:01 +0700 Subject: [PATCH 08/12] text hover css --- .../asset-corporate-portal/css/sas.bundle.css | 498 ++++++++++++++++++ 1 file changed, 498 insertions(+) diff --git a/assets/asset-corporate-portal/css/sas.bundle.css b/assets/asset-corporate-portal/css/sas.bundle.css index 4a6dafd..8e83486 100644 --- a/assets/asset-corporate-portal/css/sas.bundle.css +++ b/assets/asset-corporate-portal/css/sas.bundle.css @@ -4670,6 +4670,504 @@ th:last-child { border-radius: 0 6px 6px 0 !important; } +/* ### TEXT HOVER */ +/* ## TEXT HOVER PRIMARY */ +a.text-hover-primary, +.text-hover-primary { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; +} +a.text-hover-primary:hover, +.text-hover-primary:hover { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--primary-hover) !important; +} +a.text-hover-primary:hover i, +.text-hover-primary:hover i { + color: var(--primary-hover) !important; +} +a.text-hover-primary:hover .svg-icon svg g [fill], +.text-hover-primary:hover .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--primary-hover); +} +a.text-hover-primary:hover .svg-icon svg:hover g [fill], +.text-hover-primary:hover .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +.hoverable:hover a.text-hover-primary, +.hoverable:hover .text-hover-primary { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--primary-hover) !important; +} +.hoverable:hover a.text-hover-primary i, +.hoverable:hover .text-hover-primary i { + color: var(--primary-hover) !important; +} +.hoverable:hover a.text-hover-primary .svg-icon svg g [fill], +.hoverable:hover .text-hover-primary .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--primary-hover) !important; +} +.hoverable:hover a.text-hover-primary .svg-icon svg:hover g [fill], +.hoverable:hover .text-hover-primary .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +/* ## TEXT HOVER SECONDARY */ +a.text-hover-secondary, +.text-hover-secondary { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; +} +a.text-hover-secondary:hover, +.text-hover-secondary:hover { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--secondary-hover) !important; +} +a.text-hover-secondary:hover i, +.text-hover-secondary:hover i { + color: var(--secondary-hover) !important; +} +a.text-hover-secondary:hover .svg-icon svg g [fill], +.text-hover-secondary:hover .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--secondary-hover); +} +a.text-hover-secondary:hover .svg-icon svg:hover g [fill], +.text-hover-secondary:hover .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +.hoverable:hover a.text-hover-secondary, +.hoverable:hover .text-hover-secondary { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--secondary-hover) !important; +} +.hoverable:hover a.text-hover-secondary i, +.hoverable:hover .text-hover-secondary i { + color: var(--secondary-hover) !important; +} +.hoverable:hover a.text-hover-secondary .svg-icon svg g [fill], +.hoverable:hover .text-hover-secondary .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--secondary-hover) !important; +} +.hoverable:hover a.text-hover-secondary .svg-icon svg:hover g [fill], +.hoverable:hover .text-hover-secondary .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +/* ## TEXT HOVER SUCCESS */ +a.text-hover-success, +.text-hover-success { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; +} +a.text-hover-success:hover, +.text-hover-success:hover { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--success-hover) !important; +} +a.text-hover-success:hover i, +.text-hover-success:hover i { + color: var(--success-hover) !important; +} +a.text-hover-success:hover .svg-icon svg g [fill], +.text-hover-success:hover .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--success-hover); +} +a.text-hover-success:hover .svg-icon svg:hover g [fill], +.text-hover-success:hover .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +.hoverable:hover a.text-hover-success, +.hoverable:hover .text-hover-success { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--success-hover) !important; +} +.hoverable:hover a.text-hover-success i, +.hoverable:hover .text-hover-success i { + color: var(--success-hover) !important; +} +.hoverable:hover a.text-hover-success .svg-icon svg g [fill], +.hoverable:hover .text-hover-success .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--success-hover) !important; +} +.hoverable:hover a.text-hover-success .svg-icon svg:hover g [fill], +.hoverable:hover .text-hover-success .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +/* ## TEXT HOVER INFO */ +a.text-hover-info, +.text-hover-info { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; +} +a.text-hover-info:hover, +.text-hover-info:hover { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--info-hover) !important; +} +a.text-hover-info:hover i, +.text-hover-info:hover i { + color: var(--info-hover) !important; +} +a.text-hover-info:hover .svg-icon svg g [fill], +.text-hover-info:hover .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--info-hover); +} +a.text-hover-info:hover .svg-icon svg:hover g [fill], +.text-hover-info:hover .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +.hoverable:hover a.text-hover-info, +.hoverable:hover .text-hover-info { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--info-hover) !important; +} +.hoverable:hover a.text-hover-info i, +.hoverable:hover .text-hover-info i { + color: var(--info-hover) !important; +} +.hoverable:hover a.text-hover-info .svg-icon svg g [fill], +.hoverable:hover .text-hover-info .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--info-hover) !important; +} +.hoverable:hover a.text-hover-info .svg-icon svg:hover g [fill], +.hoverable:hover .text-hover-info .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +/* ## TEXT HOVER WARNING */ +a.text-hover-warning, +.text-hover-warning { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; +} +a.text-hover-warning:hover, +.text-hover-warning:hover { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--warning-hover) !important; +} +a.text-hover-warning:hover i, +.text-hover-warning:hover i { + color: var(--warning-hover) !important; +} +a.text-hover-warning:hover .svg-icon svg g [fill], +.text-hover-warning:hover .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--warning-hover); +} +a.text-hover-warning:hover .svg-icon svg:hover g [fill], +.text-hover-warning:hover .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +.hoverable:hover a.text-hover-warning, +.hoverable:hover .text-hover-warning { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--warning-hover) !important; +} +.hoverable:hover a.text-hover-warning i, +.hoverable:hover .text-hover-warning i { + color: var(--warning-hover) !important; +} +.hoverable:hover a.text-hover-warning .svg-icon svg g [fill], +.hoverable:hover .text-hover-warning .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--warning-hover) !important; +} +.hoverable:hover a.text-hover-warning .svg-icon svg:hover g [fill], +.hoverable:hover .text-hover-warning .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +/* ## TEXT HOVER DANGER */ +a.text-hover-danger, +.text-hover-danger { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; +} +a.text-hover-danger:hover, +.text-hover-danger:hover { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--danger-hover) !important; +} +a.text-hover-danger:hover i, +.text-hover-danger:hover i { + color: var(--danger-hover) !important; +} +a.text-hover-danger:hover .svg-icon svg g [fill], +.text-hover-danger:hover .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--danger-hover); +} +a.text-hover-danger:hover .svg-icon svg:hover g [fill], +.text-hover-danger:hover .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +.hoverable:hover a.text-hover-danger, +.hoverable:hover .text-hover-danger { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--danger-hover) !important; +} +.hoverable:hover a.text-hover-danger i, +.hoverable:hover .text-hover-danger i { + color: var(--danger-hover) !important; +} +.hoverable:hover a.text-hover-danger .svg-icon svg g [fill], +.hoverable:hover .text-hover-danger .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--danger-hover) !important; +} +.hoverable:hover a.text-hover-danger .svg-icon svg:hover g [fill], +.hoverable:hover .text-hover-danger .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +/* ## TEXT HOVER TOSCA */ +a.text-hover-tosca, +.text-hover-tosca { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; +} +a.text-hover-tosca:hover, +.text-hover-tosca:hover { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--tosca-hover) !important; +} +a.text-hover-tosca:hover i, +.text-hover-tosca:hover i { + color: var(--tosca-hover) !important; +} +a.text-hover-tosca:hover .svg-icon svg g [fill], +.text-hover-tosca:hover .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--tosca-hover); +} +a.text-hover-tosca:hover .svg-icon svg:hover g [fill], +.text-hover-tosca:hover .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + +.hoverable:hover a.text-hover-tosca, +.hoverable:hover .text-hover-tosca { + -webkit-transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, -webkit-box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease; + transition: color 0.15s ease, background-color 0.15s ease, + border-color 0.15s ease, box-shadow 0.15s ease, + -webkit-box-shadow 0.15s ease; + color: var(--tosca-hover) !important; +} +.hoverable:hover a.text-hover-tosca i, +.hoverable:hover .text-hover-tosca i { + color: var(--tosca-hover) !important; +} +.hoverable:hover a.text-hover-tosca .svg-icon svg g [fill], +.hoverable:hover .text-hover-tosca .svg-icon svg g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; + fill: var(--tosca-hover) !important; +} +.hoverable:hover a.text-hover-tosca .svg-icon svg:hover g [fill], +.hoverable:hover .text-hover-tosca .svg-icon svg:hover g [fill] { + -webkit-transition: fill 0.3s ease; + transition: fill 0.3s ease; +} + /* ### BUTTON HOVER TEXT */ /* ### */ /* ## PRIMARY */ From 329db2e2ac6ab7bad0a0525cca56425755d1680f Mon Sep 17 00:00:00 2001 From: Sas Andy Date: Mon, 6 May 2024 13:27:28 +0700 Subject: [PATCH 09/12] layout corporate, navbar & side bar templ --- handlers/mastermenuusergroup.handlers.go | 17 +- handlers/routes.go | 1 + handlers/xsample.handlers.go | 25 + models/table.models.go | 1 - models/user.models.go | 8 + services/user.services.go | 11 + services/xsample.services.go | 502 ++++++++++++++ utils/generaterandomid.utils.go | 16 + views/component/navbar/navbar.templ | 74 ++ views/component/navbar/navbar_templ.go | 112 +++ .../component/navbarmaster/navbarmaster.templ | 655 ------------------ .../navbarmaster/navbarmaster_templ.go | 138 ---- .../sidebar_user_profile.templ | 82 +++ .../sidebar_user_profile_templ.go | 127 ++++ views/layout/layout_corporate.templ | 133 +++- views/layout/layout_corporate_templ.go | 39 +- .../mastermenuusergroup.templ | 43 +- .../mastermenuusergroup_templ.go | 69 +- views/xsample/coba.templ | 23 + views/xsample/coba_templ.go | 133 ++++ 20 files changed, 1306 insertions(+), 903 deletions(-) delete mode 100644 models/table.models.go create mode 100644 models/user.models.go create mode 100644 utils/generaterandomid.utils.go create mode 100644 views/component/navbar/navbar.templ create mode 100644 views/component/navbar/navbar_templ.go delete mode 100644 views/component/navbarmaster/navbarmaster.templ delete mode 100644 views/component/navbarmaster/navbarmaster_templ.go create mode 100644 views/component/sidebar_user_profile/sidebar_user_profile.templ create mode 100644 views/component/sidebar_user_profile/sidebar_user_profile_templ.go create mode 100644 views/xsample/coba.templ create mode 100644 views/xsample/coba_templ.go diff --git a/handlers/mastermenuusergroup.handlers.go b/handlers/mastermenuusergroup.handlers.go index 7065a55..b7babb7 100644 --- a/handlers/mastermenuusergroup.handlers.go +++ b/handlers/mastermenuusergroup.handlers.go @@ -31,18 +31,21 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroup(c echo.Cont fmt.Println(dataMenu) return err } - // fmt.Printf("%+v\n", dataMenu) - // si := mastermenu.ShowMasterMenu("Master Menu", - // mastermenu.MainMasterMenu(dataMenu), - // mastermenu.CssMasterMenu(), - // mastermenu.JsMasterMenu(), - // ) + dataUser, err := services.GetUser() + fmt.Println(dataUser) + fmt.Println(err) + if err != nil { + fmt.Println(dataUser) + return err + } si := mastermenuusergroup.ShowMasterMenuUserGroup( "Master Menu", - mastermenuusergroup.MainMasterMenuUserGroup(dataMenu), + mastermenuusergroup.ContentMasterMenuUserGroup(), mastermenuusergroup.CssMasterMenuUserGroup(), mastermenuusergroup.JsMasterMenuUserGroup(), + dataMenu, + dataUser, ) return lh.View(c, si) diff --git a/handlers/routes.go b/handlers/routes.go index b34dc81..b30c9db 100644 --- a/handlers/routes.go +++ b/handlers/routes.go @@ -18,6 +18,7 @@ func SetupRoutesLogin(app *echo.Echo, h *LoginHandler) { func SetupRoutesXsample(app *echo.Echo, h *XsampleHandler) { xSample := app.Group("/xsample") xSample.GET("/xsample01", h.Hello) + xSample.GET("/coba", h.ShowCoba) } func SetupRoutesLandingPage(app *echo.Echo, h *LandingPageHandler, mastermenuusergroupHandler *MasterMenuUserGroupHandler) { Lp := app.Group("/landing_page") diff --git a/handlers/xsample.handlers.go b/handlers/xsample.handlers.go index 9253c6b..7d07e58 100644 --- a/handlers/xsample.handlers.go +++ b/handlers/xsample.handlers.go @@ -1,13 +1,18 @@ package handlers import ( + "fmt" + "github.com/a-h/templ" + "github.com/emarifer/go-templ-project-structure/services" + "github.com/emarifer/go-templ-project-structure/utils" "github.com/emarifer/go-templ-project-structure/views/xsample" "github.com/labstack/echo/v4" ) type XsampleService interface { + GetListMenus() ([]services.MasterMenu, error) } func NewXsampleHandler(us XsampleService) *XsampleHandler { @@ -24,6 +29,26 @@ func (uh *XsampleHandler) Hello(c echo.Context) error { helo := xsample.ShowHelo("Hello World", xsample.HelloWorld("Hello World"), xsample.CssHelo(), xsample.JsHelo()) return uh.View(c, helo) } +func (uh *XsampleHandler) ShowCoba(c echo.Context) error { + dataMenu, err := uh.XsampleService.GetListMenus() + fmt.Println(dataMenu) + fmt.Println(err) + if err != nil { + fmt.Println(dataMenu) + return err + } + randomID := utils.GenerateRandomID("coba") + fmt.Println(randomID) + dataUser, err := services.GetUser() + fmt.Println(dataUser) + fmt.Println(err) + if err != nil { + fmt.Println(dataUser) + return err + } + helo := xsample.ShowCoba("Hello World", xsample.Coba("Hello World"), xsample.CssCoba(), xsample.JsCoba(), dataMenu, dataUser) + return uh.View(c, helo) +} func (uh *XsampleHandler) View(c echo.Context, cmp templ.Component) error { c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML) diff --git a/models/table.models.go b/models/table.models.go deleted file mode 100644 index 2640e7f..0000000 --- a/models/table.models.go +++ /dev/null @@ -1 +0,0 @@ -package models diff --git a/models/user.models.go b/models/user.models.go new file mode 100644 index 0000000..bb118c8 --- /dev/null +++ b/models/user.models.go @@ -0,0 +1,8 @@ +package models + +type User struct { + UserID int `json:"userID"` + Username string `json:"username"` + UserFullName string `json:"userFullName"` + UserPosition string `json:"userPosition"` +} diff --git a/services/user.services.go b/services/user.services.go index 37e071b..63f63f8 100644 --- a/services/user.services.go +++ b/services/user.services.go @@ -4,6 +4,7 @@ import ( "time" "github.com/emarifer/go-templ-project-structure/db" + "github.com/emarifer/go-templ-project-structure/models" ) func NewServicesUser(u User, uStore db.UserStore) *ServicesUser { @@ -84,3 +85,13 @@ func ConverDateTime(tz string, dt time.Time) string { return dt.In(loc).Format(time.RFC822Z) } + +func GetUser() (models.User, error) { + a := models.User{ + UserID: 1, + Username: "andy", + UserFullName: "Alfianto Andy P", + UserPosition: "Software Developer", + } + return a, nil +} diff --git a/services/xsample.services.go b/services/xsample.services.go index fc24081..517f131 100644 --- a/services/xsample.services.go +++ b/services/xsample.services.go @@ -78,3 +78,505 @@ func (su *ServicesXsample) GetXsampleById(id int) (Xsample, error) { return su.Xsample, nil } + +func (su *ServicesXsample) GetListMenus() ([]MasterMenu, error) { + + // dummyBreadcrumb := []Breadcrumb{ + // { + // Name: "Dashboard", + // Url: "/client/dashboard", + // }, + // { + // Name: "Front Office", + // Url: "/client/usermanagement", + // }, + // } + + dummyMenu := []MasterMenu{ + // 1. Dashboard + { + ID: "1", + ParentMenuID: "0", + ParentMenuName: "Dashboard", + ParentUrl: "/client/md/dashboard", + ParentIcon: "", + Children: []ChildrenMenu{ + { + ChildrenParentID: "1", + ChildrenMenuID: "1", + ChildrenMenuName: "Master User", + ChildrenMenuURL: "/client/md/user", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "Y", + // }, + // }, + }, + }, + }, + + // 2. Front Office + { + ID: "2", + ParentMenuID: "1", + ParentMenuName: "Front Office", + ParentUrl: "#", + ParentIcon: "", + Children: []ChildrenMenu{ + { + ChildrenParentID: "1", + ChildrenMenuID: "1", + ChildrenMenuName: "Registrasi", + ChildrenMenuURL: "/fo/registrasi", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User", + // IsActive: "Y", + // }, + // }, + }, + }, + }, + + // 3. Station + { + ID: "3", + ParentMenuID: "2", + ParentMenuName: "Station", + ParentUrl: "#", + ParentIcon: "", + Children: []ChildrenMenu{ + { + ChildrenParentID: "2", + ChildrenMenuID: "1", + ChildrenMenuName: "Sample Station", + ChildrenMenuURL: "/station/sample", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User", + // IsActive: "Y", + // }, + // }, + }, + }, + }, + + // 4. Management MCU + { + ID: "4", + ParentMenuID: "3", + ParentMenuName: "Management MCU", + ParentUrl: "#", + ParentIcon: "", + Children: []ChildrenMenu{ + { + ChildrenParentID: "3", + ChildrenMenuID: "1", + ChildrenMenuName: "Setup MCU", + ChildrenMenuURL: "/mcu/setup", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User", + // IsActive: "Y", + // }, + // }, + }, + { + ChildrenParentID: "3", + ChildrenMenuID: "2", + ChildrenMenuName: "Pre-Registrasi", + ChildrenMenuURL: "/mcu/preregister", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User", + // IsActive: "Y", + // }, + // }, + }, + }, + }, + + // 5. Master Data + { + ID: "5", + ParentMenuID: "4", + ParentMenuName: "Master Data", + ParentUrl: "#", + ParentIcon: "", + Children: []ChildrenMenu{ + // * Master User + { + ChildrenParentID: "4", + ChildrenMenuID: "1", + ChildrenMenuName: "Master User", + ChildrenMenuURL: "/client/md/user", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User", + // IsActive: "Y", + // }, + // }, + }, + + // * Master User Group + { + ChildrenParentID: "4", + ChildrenMenuID: "2", + ChildrenMenuName: "Master User Group", + ChildrenMenuURL: "/client/md/usergroup", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Master Corporate + { + ChildrenParentID: "4", + ChildrenMenuID: "3", + ChildrenMenuName: "Corporate", + ChildrenMenuURL: "/client/md/corp", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Test + { + ChildrenParentID: "4", + ChildrenMenuID: "4", + ChildrenMenuName: "Test", + ChildrenMenuURL: "/client/md/test", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Bahan + { + ChildrenParentID: "4", + ChildrenMenuID: "5", + ChildrenMenuName: "Bahan", + ChildrenMenuURL: "/client/md/bahan", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Sample Type + { + ChildrenParentID: "4", + ChildrenMenuID: "6", + ChildrenMenuName: "Sample Type", + ChildrenMenuURL: "/client/sample/type", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Sample Station + { + ChildrenParentID: "4", + ChildrenMenuID: "7", + ChildrenMenuName: "Sample Station", + ChildrenMenuURL: "/station/sample", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Result Non Lab + { + ChildrenParentID: "4", + ChildrenMenuID: "8", + ChildrenMenuName: "Result Non Lab", + ChildrenMenuURL: "/client/md/resultnonlab", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Template Fisik + { + ChildrenParentID: "4", + ChildrenMenuID: "9", + ChildrenMenuName: "Template Fisik", + ChildrenMenuURL: "/client/md/template-fisik", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Pasien + { + ChildrenParentID: "4", + ChildrenMenuID: "10", + ChildrenMenuName: "Pasien", + ChildrenMenuURL: "/client/md/pasien", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Dokter + { + ChildrenParentID: "4", + ChildrenMenuID: "11", + ChildrenMenuName: "Dokter", + ChildrenMenuURL: "/client/md/dokter", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Paket + { + ChildrenParentID: "4", + ChildrenMenuID: "12", + ChildrenMenuName: "Paket", + ChildrenMenuURL: "/client/md/paket", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + + // * Harga Single + { + ChildrenParentID: "4", + ChildrenMenuID: "13", + ChildrenMenuName: "Harga Single", + ChildrenMenuURL: "/client/md/hargasingle", + // Breadcrumb: []Breadcrumb{ + // { + // IDBreadcrumb: "1", + // Title: "Dashboard", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "2", + // Title: "Master", + // IsActive: "N", + // }, + // { + // IDBreadcrumb: "3", + // Title: "User Group", + // IsActive: "Y", + // }, + // }, + }, + }, + }, + } + + return dummyMenu, nil +} diff --git a/utils/generaterandomid.utils.go b/utils/generaterandomid.utils.go new file mode 100644 index 0000000..5b69c70 --- /dev/null +++ b/utils/generaterandomid.utils.go @@ -0,0 +1,16 @@ +package utils + +import ( + "crypto/md5" + "encoding/hex" + "strings" + "time" +) + +func GenerateRandomID(text string) string { + seed := text + time.Now().String() + hash := md5.Sum([]byte(seed)) + randomID := hex.EncodeToString(hash[:]) + randomID = strings.ReplaceAll(randomID, "-", "") + return randomID +} diff --git a/views/component/navbar/navbar.templ b/views/component/navbar/navbar.templ new file mode 100644 index 0000000..c892f01 --- /dev/null +++ b/views/component/navbar/navbar.templ @@ -0,0 +1,74 @@ +package navbar + +import ( + "github.com/emarifer/go-templ-project-structure/views/component/sidebarmaster" + "github.com/emarifer/go-templ-project-structure/services" + "github.com/emarifer/go-templ-project-structure/models" +) + +templ Navbar(dataUser models.User) { +
+ +
+ +
+ + +
+ +
+
+ Hi, + { dataUser.Username } + + + +
+
+ +
+ +
+ +
+} + +templ NavbarMenu(datamenu []services.MasterMenu) { +
+ +
+ + + +
+ +
+} diff --git a/views/component/navbar/navbar_templ.go b/views/component/navbar/navbar_templ.go new file mode 100644 index 0000000..4b166a5 --- /dev/null +++ b/views/component/navbar/navbar_templ.go @@ -0,0 +1,112 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package navbar + +//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 ( + "github.com/emarifer/go-templ-project-structure/models" + "github.com/emarifer/go-templ-project-structure/services" + "github.com/emarifer/go-templ-project-structure/views/component/sidebarmaster" +) + +func Navbar(dataUser models.User) 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("
Hi, ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var2 string + templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(dataUser.Username) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\component\navbar\navbar.templ`, Line: 29, Col: 26} + } + _, 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func NavbarMenu(datamenu []services.MasterMenu) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var3 := templ.GetChildren(ctx) + if templ_7745c5c3_Var3 == nil { + templ_7745c5c3_Var3 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for index, d := range datamenu { + if index == 0 { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = sidebarmaster.MenuDashboard(d.ParentMenuName, d.ParentUrl).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
  • Menu

  • ") + 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 index+1 < len(datamenu) { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = sidebarmaster.ListMenuNavbar(datamenu[index+1].ParentMenuName, datamenu[index+1].Children).Render(ctx, templ_7745c5c3_Buffer) + 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} diff --git a/views/component/navbarmaster/navbarmaster.templ b/views/component/navbarmaster/navbarmaster.templ deleted file mode 100644 index e501b68..0000000 --- a/views/component/navbarmaster/navbarmaster.templ +++ /dev/null @@ -1,655 +0,0 @@ -package navbarmaster - -import ( - "github.com/emarifer/go-templ-project-structure/views/component/sidebarmaster" - "github.com/emarifer/go-templ-project-structure/services" -) - -templ MainNavbar(datamenu []services.MasterMenu) { -
- -
- - - -
- -
-} - -templ Navbarmaster(datamenu []services.MasterMenu, content templ.Component) { - -
- - - Logo - - - -
- - - - - - -
- -
- - -
- -
- -
- -
- - - - - - -
- - - @MainNavbar(datamenu) - -
- - -
- -
- -
- -
- - -
- -
-
- Hi, - Sean - - S - -
-
- -
- -
- -
- - - @content - -
- -
- -
- -} - -templ Navbaruserprofile() { -
- -
-

- User Profile - 12 messages -

- - - -
- - -
- -
-
-
- -
- -
- - -
- - - - - -
- - -
- -
- Recent Notifications -
- - -
- - - - - - - - - - - - - - +28% -
- - -
- - - - - - - - - - - - -
- - Would - be to people - - Due in 2 Days -
- +50% -
- - -
- - - - - - - - - - - - - - -27% -
- - -
- - - - - - - - - - - - - - -
- - The - best product - - Due in 2 Days -
- +8% -
- -
- -
- -
-} diff --git a/views/component/navbarmaster/navbarmaster_templ.go b/views/component/navbarmaster/navbarmaster_templ.go deleted file mode 100644 index 7fb123b..0000000 --- a/views/component/navbarmaster/navbarmaster_templ.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.2.663 -package navbarmaster - -//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 ( - "github.com/emarifer/go-templ-project-structure/services" - "github.com/emarifer/go-templ-project-structure/views/component/sidebarmaster" -) - -func MainNavbar(datamenu []services.MasterMenu) templ.Component { - return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - 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("
    ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - for index, d := range datamenu { - if index == 0 { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = sidebarmaster.MenuDashboard(d.ParentMenuName, d.ParentUrl).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
  • Menu

  • ") - 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 index+1 < len(datamenu) { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = sidebarmaster.ListMenuNavbar(datamenu[index+1].ParentMenuName, datamenu[index+1].Children).Render(ctx, templ_7745c5c3_Buffer) - 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 !templ_7745c5c3_IsBuffer { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) - } - return templ_7745c5c3_Err - }) -} - -func Navbarmaster(datamenu []services.MasterMenu, content templ.Component) templ.Component { - return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - templ_7745c5c3_Buffer = templ.GetBuffer() - defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var2 := templ.GetChildren(ctx) - if templ_7745c5c3_Var2 == nil { - templ_7745c5c3_Var2 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
\"Logo\"
\"Logo\"
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = MainNavbar(datamenu).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Hi, Sean S
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = content.Render(ctx, templ_7745c5c3_Buffer) - 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 !templ_7745c5c3_IsBuffer { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) - } - return templ_7745c5c3_Err - }) -} - -func Navbaruserprofile() templ.Component { - return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - templ_7745c5c3_Buffer = templ.GetBuffer() - defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templ.GetChildren(ctx) - if templ_7745c5c3_Var3 == nil { - templ_7745c5c3_Var3 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - 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 - }) -} diff --git a/views/component/sidebar_user_profile/sidebar_user_profile.templ b/views/component/sidebar_user_profile/sidebar_user_profile.templ new file mode 100644 index 0000000..7e2242c --- /dev/null +++ b/views/component/sidebar_user_profile/sidebar_user_profile.templ @@ -0,0 +1,82 @@ +package sidebaruserprofile + +import "github.com/emarifer/go-templ-project-structure/models" + +templ Navbaruserprofile(dataUser models.User) { +
+ +
+

+ User Profile + // 12 messages +

+ + + +
+ + +
+ + @ProfileHeader(dataUser) + + +
+ + +
+ +
+ Recent Notifications +
+ + + @NotificationCard() + +
+ +
+ +
+} + +templ ProfileHeader(dataUser models.User) { +
+
+ //
+ // + +
+
+ + { dataUser.UserFullName } + +
+ { dataUser.UserPosition } +
+ +
+
+} + +templ NotificationCard() { +
+ + + + + + + +
+} diff --git a/views/component/sidebar_user_profile/sidebar_user_profile_templ.go b/views/component/sidebar_user_profile/sidebar_user_profile_templ.go new file mode 100644 index 0000000..779eb04 --- /dev/null +++ b/views/component/sidebar_user_profile/sidebar_user_profile_templ.go @@ -0,0 +1,127 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package sidebaruserprofile + +//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 "github.com/emarifer/go-templ-project-structure/models" + +func Navbaruserprofile(dataUser models.User) 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("

User Profile\r

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = ProfileHeader(dataUser).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Recent Notifications\r
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = NotificationCard().Render(ctx, templ_7745c5c3_Buffer) + 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func ProfileHeader(dataUser models.User) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var2 := templ.GetChildren(ctx) + if templ_7745c5c3_Var2 == nil { + templ_7745c5c3_Var2 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var3 string + templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(dataUser.UserFullName) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\component\sidebar_user_profile\sidebar_user_profile.templ`, Line: 52, Col: 27} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var4 string + templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(dataUser.UserPosition) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\component\sidebar_user_profile\sidebar_user_profile.templ`, Line: 55, Col: 27} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + 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 NotificationCard() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var5 := templ.GetChildren(ctx) + if templ_7745c5c3_Var5 == nil { + templ_7745c5c3_Var5 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + 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 + }) +} diff --git a/views/layout/layout_corporate.templ b/views/layout/layout_corporate.templ index 84e01e0..2c74e19 100644 --- a/views/layout/layout_corporate.templ +++ b/views/layout/layout_corporate.templ @@ -1,7 +1,14 @@ package layout +import ( + "github.com/emarifer/go-templ-project-structure/services" + "github.com/emarifer/go-templ-project-structure/views/component/navbar" + "github.com/emarifer/go-templ-project-structure/views/component/sidebar_user_profile" + "github.com/emarifer/go-templ-project-structure/models" +) + // LAYOUT PLAYGROUND -templ CorporateLayout(title string, css templ.Component, js templ.Component) { +templ CorporateLayout(title string, css templ.Component, js templ.Component, datamenu []services.MasterMenu, dataUser models.User) { // htmx - - { children... } - + +
+ + + Logo + + + +
+ + + + + + +
+ +
+ + +
+ +
+ +
+ +
+ + + + + + +
+ + + @navbar.NavbarMenu(datamenu) + +
+ + +
+ + @navbar.Navbar(dataUser) + + +
+ { children... } +
+ +
+ +
+ +
+ + @sidebaruserprofile.Navbaruserprofile(dataUser) ") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
\"Logo\"
\"Logo\"
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = navbar.NavbarMenu(datamenu).Render(ctx, templ_7745c5c3_Buffer) + 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 = navbar.Navbar(dataUser).Render(ctx, templ_7745c5c3_Buffer) + 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 } @@ -53,7 +76,15 @@ func CorporateLayout(title string, css templ.Component, js templ.Component) temp if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = sidebaruserprofile.Navbaruserprofile(dataUser).Render(ctx, templ_7745c5c3_Buffer) + 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 } diff --git a/views/mastermenuusergroup/mastermenuusergroup.templ b/views/mastermenuusergroup/mastermenuusergroup.templ index 8d2baf0..9db78ae 100644 --- a/views/mastermenuusergroup/mastermenuusergroup.templ +++ b/views/mastermenuusergroup/mastermenuusergroup.templ @@ -4,45 +4,10 @@ import ( "github.com/emarifer/go-templ-project-structure/views/component/breadcrumbadmin" "github.com/emarifer/go-templ-project-structure/views/layout" "github.com/emarifer/go-templ-project-structure/services" - "github.com/emarifer/go-templ-project-structure/views/component/navbarmaster" + "github.com/emarifer/go-templ-project-structure/models" ) -templ MainMasterMenuUserGroup(datamenu []services.MasterMenu) { - - - @navbarmaster.Navbarmaster(datamenu, ContentMasterMenuUserGroup()) - - - - @navbarmaster.Navbaruserprofile() - - -
- - - - - - - - - - -
- -} - +// "github.com/emarifer/go-templ-project-structure/views/component/sidebar_user_profile" templ ContentMasterMenuUserGroup() {
@@ -152,8 +117,8 @@ templ CssMasterMenuUserGroup() { templ JsMasterMenuUserGroup() { } -templ ShowMasterMenuUserGroup(title string, cmp templ.Component, css templ.Component, js templ.Component) { - @layout.PlaygroundLayout(title, css, js) { +templ ShowMasterMenuUserGroup(title string, cmp templ.Component, css templ.Component, js templ.Component, dataMenu []services.MasterMenu, dataUser models.User) { + @layout.CorporateLayout(title, css, js, dataMenu, dataUser) { @cmp } } diff --git a/views/mastermenuusergroup/mastermenuusergroup_templ.go b/views/mastermenuusergroup/mastermenuusergroup_templ.go index fb038ea..bd87efb 100644 --- a/views/mastermenuusergroup/mastermenuusergroup_templ.go +++ b/views/mastermenuusergroup/mastermenuusergroup_templ.go @@ -11,13 +11,14 @@ import "io" import "bytes" import ( + "github.com/emarifer/go-templ-project-structure/models" "github.com/emarifer/go-templ-project-structure/services" "github.com/emarifer/go-templ-project-structure/views/component/breadcrumbadmin" - "github.com/emarifer/go-templ-project-structure/views/component/navbarmaster" "github.com/emarifer/go-templ-project-structure/views/layout" ) -func MainMasterMenuUserGroup(datamenu []services.MasterMenu) templ.Component { +// "github.com/emarifer/go-templ-project-structure/views/component/sidebar_user_profile" +func ContentMasterMenuUserGroup() 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 { @@ -30,46 +31,6 @@ func MainMasterMenuUserGroup(datamenu []services.MasterMenu) templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = navbarmaster.Navbarmaster(datamenu, ContentMasterMenuUserGroup()).Render(ctx, templ_7745c5c3_Buffer) - 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 = navbarmaster.Navbaruserprofile().Render(ctx, templ_7745c5c3_Buffer) - 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 !templ_7745c5c3_IsBuffer { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) - } - return templ_7745c5c3_Err - }) -} - -func ContentMasterMenuUserGroup() templ.Component { - return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) - if !templ_7745c5c3_IsBuffer { - templ_7745c5c3_Buffer = templ.GetBuffer() - defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var2 := templ.GetChildren(ctx) - if templ_7745c5c3_Var2 == nil { - templ_7745c5c3_Var2 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err @@ -97,9 +58,9 @@ func CssMasterMenuUserGroup() templ.Component { defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templ.GetChildren(ctx) - if templ_7745c5c3_Var3 == nil { - templ_7745c5c3_Var3 = templ.NopComponent + templ_7745c5c3_Var2 := templ.GetChildren(ctx) + if templ_7745c5c3_Var2 == nil { + templ_7745c5c3_Var2 = templ.NopComponent } ctx = templ.ClearChildren(ctx) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") @@ -121,9 +82,9 @@ func JsMasterMenuUserGroup() templ.Component { defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var4 := templ.GetChildren(ctx) - if templ_7745c5c3_Var4 == nil { - templ_7745c5c3_Var4 = templ.NopComponent + templ_7745c5c3_Var3 := templ.GetChildren(ctx) + if templ_7745c5c3_Var3 == nil { + templ_7745c5c3_Var3 = templ.NopComponent } ctx = templ.ClearChildren(ctx) if !templ_7745c5c3_IsBuffer { @@ -133,7 +94,7 @@ func JsMasterMenuUserGroup() templ.Component { }) } -func ShowMasterMenuUserGroup(title string, cmp templ.Component, css templ.Component, js templ.Component) templ.Component { +func ShowMasterMenuUserGroup(title string, cmp templ.Component, css templ.Component, js templ.Component, dataMenu []services.MasterMenu, dataUser models.User) 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 { @@ -141,12 +102,12 @@ func ShowMasterMenuUserGroup(title string, cmp templ.Component, css templ.Compon defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var5 := templ.GetChildren(ctx) - if templ_7745c5c3_Var5 == nil { - templ_7745c5c3_Var5 = templ.NopComponent + templ_7745c5c3_Var4 := templ.GetChildren(ctx) + if templ_7745c5c3_Var4 == nil { + templ_7745c5c3_Var4 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var6 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var5 := 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() @@ -161,7 +122,7 @@ func ShowMasterMenuUserGroup(title string, cmp templ.Component, css templ.Compon } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = layout.PlaygroundLayout(title, css, js).Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, dataMenu, dataUser).Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/views/xsample/coba.templ b/views/xsample/coba.templ new file mode 100644 index 0000000..08351fa --- /dev/null +++ b/views/xsample/coba.templ @@ -0,0 +1,23 @@ +package xsample + +import ( + "github.com/emarifer/go-templ-project-structure/views/layout" + "github.com/emarifer/go-templ-project-structure/services" + "github.com/emarifer/go-templ-project-structure/models" +) + +templ Coba(title string) { +
{ title }
+} + +templ CssCoba() { +} + +templ JsCoba() { +} + +templ ShowCoba(title string, cmp templ.Component, css templ.Component, js templ.Component, dataMenu []services.MasterMenu, dataUser models.User) { + @layout.CorporateLayout(title, css, js, dataMenu, dataUser) { + @cmp + } +} diff --git a/views/xsample/coba_templ.go b/views/xsample/coba_templ.go new file mode 100644 index 0000000..932685b --- /dev/null +++ b/views/xsample/coba_templ.go @@ -0,0 +1,133 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package xsample + +//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 ( + "github.com/emarifer/go-templ-project-structure/models" + "github.com/emarifer/go-templ-project-structure/services" + "github.com/emarifer/go-templ-project-structure/views/layout" +) + +func Coba(title string) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var2 string + templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\xsample\coba.templ`, Line: 10, Col: 13} + } + _, 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func CssCoba() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var3 := templ.GetChildren(ctx) + if templ_7745c5c3_Var3 == nil { + templ_7745c5c3_Var3 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func JsCoba() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var4 := templ.GetChildren(ctx) + if templ_7745c5c3_Var4 == nil { + templ_7745c5c3_Var4 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func ShowCoba(title string, cmp templ.Component, css templ.Component, js templ.Component, dataMenu []services.MasterMenu, dataUser models.User) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var5 := templ.GetChildren(ctx) + if templ_7745c5c3_Var5 == nil { + templ_7745c5c3_Var5 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var6 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + templ_7745c5c3_Err = cmp.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer) + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, dataMenu, dataUser).Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} From 1f2973360cf89933ba2d91562fe6184983579224 Mon Sep 17 00:00:00 2001 From: Sas Andy Date: Mon, 6 May 2024 15:23:34 +0700 Subject: [PATCH 10/12] table component --- .../asset-corporate-portal/js/ktappsetting.js | 58 ++++++++++++ models/table.models.go | 15 +++ views/component/table/table.templ | 25 +++++ views/component/table/table_templ.go | 94 +++++++++++++++++++ views/layout/canvas_layout.templ | 68 +------------- views/layout/canvas_layout_templ.go | 2 +- views/layout/layout_corporate.templ | 65 +------------ views/layout/layout_corporate_templ.go | 2 +- views/layout/playground_layout.templ | 66 +------------ views/layout/playground_layout_templ.go | 2 +- .../mastermenuusergroup.templ | 91 +++++++++--------- .../mastermenuusergroup_templ.go | 81 +++++++++++++--- views/xsample/coba.templ | 44 +++++++++ views/xsample/coba_templ.go | 61 +++++++++++- 14 files changed, 411 insertions(+), 263 deletions(-) create mode 100644 assets/asset-corporate-portal/js/ktappsetting.js create mode 100644 models/table.models.go create mode 100644 views/component/table/table.templ create mode 100644 views/component/table/table_templ.go diff --git a/assets/asset-corporate-portal/js/ktappsetting.js b/assets/asset-corporate-portal/js/ktappsetting.js new file mode 100644 index 0000000..ed678af --- /dev/null +++ b/assets/asset-corporate-portal/js/ktappsetting.js @@ -0,0 +1,58 @@ +var KTAppSettings = { + breakpoints: { + sm: 576, + md: 768, + lg: 992, + xl: 1200, + xxl: 1400, + }, + colors: { + theme: { + base: { + white: "#ffffff", + primary: "#3699FF", + secondary: "#E5EAEE", + success: "#1BC5BD", + info: "#8950FC", + warning: "#FFA800", + danger: "#F64E60", + light: "#E4E6EF", + dark: "#181C32", + }, + light: { + white: "#ffffff", + primary: "#E1F0FF", + secondary: "#EBEDF3", + success: "#C9F7F5", + info: "#EEE5FF", + warning: "#FFF4DE", + danger: "#FFE2E5", + light: "#F3F6F9", + dark: "#D6D6E0", + }, + inverse: { + white: "#ffffff", + primary: "#ffffff", + secondary: "#3F4254", + success: "#ffffff", + info: "#ffffff", + warning: "#ffffff", + danger: "#ffffff", + light: "#464E5F", + dark: "#ffffff", + }, + }, + gray: { + "gray-100": "#F3F6F9", + "gray-200": "#EBEDF3", + "gray-300": "#E4E6EF", + "gray-400": "#D1D3E0", + "gray-500": "#B5B5C3", + "gray-600": "#7E8299", + "gray-700": "#5E6278", + "gray-800": "#3F4254", + "gray-900": "#181C32", + }, + }, + "font-family": "Poppins", +}; \ No newline at end of file diff --git a/models/table.models.go b/models/table.models.go new file mode 100644 index 0000000..76d0d99 --- /dev/null +++ b/models/table.models.go @@ -0,0 +1,15 @@ +package models + +type TableHead struct { + Name string `json:"name"` + Width string `json:"width"` +} + +func GetTableHead() []TableHead { + a := []TableHead{ + {Name: "Kode", Width: "30%"}, + {Name: "User Group", Width: "40%"}, + {Name: "Aksi", Width: "30%"}, + } + return a +} diff --git a/views/component/table/table.templ b/views/component/table/table.templ new file mode 100644 index 0000000..ef66f32 --- /dev/null +++ b/views/component/table/table.templ @@ -0,0 +1,25 @@ +package tablecomponent + +templ Table(thName []string, thWidth []string, trComponent templ.Component, pagination templ.Component) { + if len(thName) != len(thWidth) { +
length array thname berbeda dengan array thwidth
+ } else { +
+ + + + for i, item := range thName { + + } + + + + @trComponent + +
{ item }
+
+
+ @pagination +
+ } +} diff --git a/views/component/table/table_templ.go b/views/component/table/table_templ.go new file mode 100644 index 0000000..78877c7 --- /dev/null +++ b/views/component/table/table_templ.go @@ -0,0 +1,94 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package tablecomponent + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import "context" +import "io" +import "bytes" + +func Table(thName []string, thWidth []string, trComponent templ.Component, pagination templ.Component) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + if len(thName) != len(thWidth) { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
length array thname berbeda dengan array thwidth
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for i, item := range thName { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + 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 = trComponent.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var3 string + templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(item) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\component\table\table.templ`, Line: 12, Col: 50} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = pagination.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + 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 + }) +} diff --git a/views/layout/canvas_layout.templ b/views/layout/canvas_layout.templ index 4557116..5aeaf2a 100644 --- a/views/layout/canvas_layout.templ +++ b/views/layout/canvas_layout.templ @@ -94,72 +94,8 @@ templ CanvasLayout(title string, css templ.Component, js templ.Component) { { children... } - - - - + + diff --git a/views/layout/canvas_layout_templ.go b/views/layout/canvas_layout_templ.go index 006f939..6685c82 100644 --- a/views/layout/canvas_layout_templ.go +++ b/views/layout/canvas_layout_templ.go @@ -52,7 +52,7 @@ func CanvasLayout(title string, css templ.Component, js templ.Component) templ.C if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/views/layout/layout_corporate.templ b/views/layout/layout_corporate.templ index 2c74e19..43d3df4 100644 --- a/views/layout/layout_corporate.templ +++ b/views/layout/layout_corporate.templ @@ -220,71 +220,8 @@ templ CorporateLayout(title string, css templ.Component, js templ.Component, dat
@sidebaruserprofile.Navbaruserprofile(dataUser) - - + diff --git a/views/layout/layout_corporate_templ.go b/views/layout/layout_corporate_templ.go index aa3d0b2..9d8d95a 100644 --- a/views/layout/layout_corporate_templ.go +++ b/views/layout/layout_corporate_templ.go @@ -84,7 +84,7 @@ func CorporateLayout(title string, css templ.Component, js templ.Component, data if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/views/layout/playground_layout.templ b/views/layout/playground_layout.templ index 014e012..80354d2 100644 --- a/views/layout/playground_layout.templ +++ b/views/layout/playground_layout.templ @@ -97,71 +97,7 @@ templ PlaygroundLayout(title string, css templ.Component, js templ.Component) { { children... } - - - + diff --git a/views/layout/playground_layout_templ.go b/views/layout/playground_layout_templ.go index 8c1df4b..6af2408 100644 --- a/views/layout/playground_layout_templ.go +++ b/views/layout/playground_layout_templ.go @@ -53,7 +53,7 @@ func PlaygroundLayout(title string, css templ.Component, js templ.Component) tem if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/views/mastermenuusergroup/mastermenuusergroup.templ b/views/mastermenuusergroup/mastermenuusergroup.templ index 9db78ae..c7c045f 100644 --- a/views/mastermenuusergroup/mastermenuusergroup.templ +++ b/views/mastermenuusergroup/mastermenuusergroup.templ @@ -5,6 +5,7 @@ import ( "github.com/emarifer/go-templ-project-structure/views/layout" "github.com/emarifer/go-templ-project-structure/services" "github.com/emarifer/go-templ-project-structure/models" + "github.com/emarifer/go-templ-project-structure/views/component/table" ) // "github.com/emarifer/go-templ-project-structure/views/component/sidebar_user_profile" @@ -25,57 +26,49 @@ templ ContentMasterMenuUserGroup() {
- - - - - - - - - - - - - - - - - - - - -
KODEUSER GROUPACTION
001Admin -
- - -
-
002Tes -
- - -
-
+ @tablecomponent.Table([]string{"KODE", "USERGROUP", "AKSI"}, []string{"40%", "40%", "20%"}, TableRow(), Pagination())
-
- -
-
- - - ... - 23 - 24 - 25 - 26 - 27 - 28 - ... - - -
+
+} + +templ TableRow() { + + 001 + Admin + +
+ +
- + + + + 002 + Tes + +
+ + +
+ + +} + +templ Pagination() { +
+
+ + + ... + 23 + 24 + 25 + 26 + 27 + 28 + ... + +
} diff --git a/views/mastermenuusergroup/mastermenuusergroup_templ.go b/views/mastermenuusergroup/mastermenuusergroup_templ.go index bd87efb..c235a4f 100644 --- a/views/mastermenuusergroup/mastermenuusergroup_templ.go +++ b/views/mastermenuusergroup/mastermenuusergroup_templ.go @@ -14,6 +14,7 @@ import ( "github.com/emarifer/go-templ-project-structure/models" "github.com/emarifer/go-templ-project-structure/services" "github.com/emarifer/go-templ-project-structure/views/component/breadcrumbadmin" + "github.com/emarifer/go-templ-project-structure/views/component/table" "github.com/emarifer/go-templ-project-structure/views/layout" ) @@ -39,7 +40,63 @@ func ContentMasterMenuUserGroup() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
KODEUSER GROUPACTION
001Admin
002Tes
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = tablecomponent.Table([]string{"KODE", "USERGROUP", "AKSI"}, []string{"40%", "40%", "20%"}, TableRow(), Pagination()).Render(ctx, templ_7745c5c3_Buffer) + 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func TableRow() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var2 := templ.GetChildren(ctx) + if templ_7745c5c3_Var2 == nil { + templ_7745c5c3_Var2 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("001Admin
002Tes
") + 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 Pagination() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var3 := templ.GetChildren(ctx) + if templ_7745c5c3_Var3 == nil { + templ_7745c5c3_Var3 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -58,9 +115,9 @@ func CssMasterMenuUserGroup() templ.Component { defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var2 := templ.GetChildren(ctx) - if templ_7745c5c3_Var2 == nil { - templ_7745c5c3_Var2 = templ.NopComponent + templ_7745c5c3_Var4 := templ.GetChildren(ctx) + if templ_7745c5c3_Var4 == nil { + templ_7745c5c3_Var4 = templ.NopComponent } ctx = templ.ClearChildren(ctx) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") @@ -82,9 +139,9 @@ func JsMasterMenuUserGroup() templ.Component { defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templ.GetChildren(ctx) - if templ_7745c5c3_Var3 == nil { - templ_7745c5c3_Var3 = templ.NopComponent + templ_7745c5c3_Var5 := templ.GetChildren(ctx) + if templ_7745c5c3_Var5 == nil { + templ_7745c5c3_Var5 = templ.NopComponent } ctx = templ.ClearChildren(ctx) if !templ_7745c5c3_IsBuffer { @@ -102,12 +159,12 @@ func ShowMasterMenuUserGroup(title string, cmp templ.Component, css templ.Compon defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var4 := templ.GetChildren(ctx) - if templ_7745c5c3_Var4 == nil { - templ_7745c5c3_Var4 = templ.NopComponent + templ_7745c5c3_Var6 := templ.GetChildren(ctx) + if templ_7745c5c3_Var6 == nil { + templ_7745c5c3_Var6 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var5 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var7 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) if !templ_7745c5c3_IsBuffer { templ_7745c5c3_Buffer = templ.GetBuffer() @@ -122,7 +179,7 @@ func ShowMasterMenuUserGroup(title string, cmp templ.Component, css templ.Compon } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, dataMenu, dataUser).Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, dataMenu, dataUser).Render(templ.WithChildren(ctx, templ_7745c5c3_Var7), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/views/xsample/coba.templ b/views/xsample/coba.templ index 08351fa..1fe07c8 100644 --- a/views/xsample/coba.templ +++ b/views/xsample/coba.templ @@ -4,10 +4,12 @@ import ( "github.com/emarifer/go-templ-project-structure/views/layout" "github.com/emarifer/go-templ-project-structure/services" "github.com/emarifer/go-templ-project-structure/models" + "github.com/emarifer/go-templ-project-structure/views/component/table" ) templ Coba(title string) {
{ title }
+ @tablecomponent.Table([]string{"kode", "user group", "aksi"}, []string{"40%", "40%", "20%"}, tr(), pagination()) } templ CssCoba() { @@ -16,6 +18,48 @@ templ CssCoba() { templ JsCoba() { } +templ tr() { + + 001 + Admin + +
+ + +
+ + + + 002 + Tes + +
+ + +
+ + +} + +templ pagination() { +
+
+ + + ... + 23 + 24 + 25 + 26 + 27 + 28 + ... + + +
+
+} + templ ShowCoba(title string, cmp templ.Component, css templ.Component, js templ.Component, dataMenu []services.MasterMenu, dataUser models.User) { @layout.CorporateLayout(title, css, js, dataMenu, dataUser) { @cmp diff --git a/views/xsample/coba_templ.go b/views/xsample/coba_templ.go index 932685b..d6be95f 100644 --- a/views/xsample/coba_templ.go +++ b/views/xsample/coba_templ.go @@ -13,6 +13,7 @@ import "bytes" import ( "github.com/emarifer/go-templ-project-structure/models" "github.com/emarifer/go-templ-project-structure/services" + "github.com/emarifer/go-templ-project-structure/views/component/table" "github.com/emarifer/go-templ-project-structure/views/layout" ) @@ -36,7 +37,7 @@ func Coba(title string) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\xsample\coba.templ`, Line: 10, Col: 13} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\xsample\coba.templ`, Line: 11, Col: 13} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -46,6 +47,10 @@ func Coba(title string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + templ_7745c5c3_Err = tablecomponent.Table([]string{"kode", "user group", "aksi"}, []string{"40%", "40%", "20%"}, tr(), pagination()).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) } @@ -93,7 +98,7 @@ func JsCoba() templ.Component { }) } -func ShowCoba(title string, cmp templ.Component, css templ.Component, js templ.Component, dataMenu []services.MasterMenu, dataUser models.User) templ.Component { +func tr() 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 { @@ -106,7 +111,55 @@ func ShowCoba(title string, cmp templ.Component, css templ.Component, js templ.C templ_7745c5c3_Var5 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var6 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("001Admin
002Tes
") + 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 pagination() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var6 := templ.GetChildren(ctx) + if templ_7745c5c3_Var6 == nil { + templ_7745c5c3_Var6 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + 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 ShowCoba(title string, cmp templ.Component, css templ.Component, js templ.Component, dataMenu []services.MasterMenu, dataUser models.User) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var7 := templ.GetChildren(ctx) + if templ_7745c5c3_Var7 == nil { + templ_7745c5c3_Var7 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var8 := 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() @@ -121,7 +174,7 @@ func ShowCoba(title string, cmp templ.Component, css templ.Component, js templ.C } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, dataMenu, dataUser).Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, dataMenu, dataUser).Render(templ.WithChildren(ctx, templ_7745c5c3_Var8), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } From 8f2104270d867e210dff9a104e30021f06fbd682 Mon Sep 17 00:00:00 2001 From: Sas Andy Date: Wed, 8 May 2024 09:23:43 +0700 Subject: [PATCH 11/12] modal edit user group --- assets/andy/usergroup.html | 274 ++++++++++++++++++ .../asset-corporate-portal/css/sas.bundle.css | 17 +- handlers/mastermenuusergroup.handlers.go | 26 +- handlers/routes.go | 4 + handlers/xsample.handlers.go | 41 +++ models/CustomTextField.models.go | 14 + models/usergroup.models.go | 7 + services/mastermenuusergroup.services.go | 35 +++ .../customtextfield/customtextfield.templ | 2 +- .../customtextfield/customtextfield_templ.go | 2 +- .../customtextfield/customtextfieldv2.templ | 17 ++ .../customtextfieldv2_templ.go | 115 ++++++++ views/component/modal/modal.templ | 30 ++ views/component/modal/modal_templ.go | 85 ++++++ .../mastermenuusergroup.templ | 99 +++++-- .../mastermenuusergroup_templ.go | 123 ++++++-- .../modaladdusergroup.templ | 56 ++++ .../modaladdusergroup_templ.go | 114 ++++++++ .../modaleditusergroup.templ | 79 +++++ .../modaleditusergroup_templ.go | 162 +++++++++++ views/xsample/trycounter.templ | 51 ++++ views/xsample/trycounter_templ.go | 194 +++++++++++++ 22 files changed, 1496 insertions(+), 51 deletions(-) create mode 100644 assets/andy/usergroup.html create mode 100644 models/CustomTextField.models.go create mode 100644 models/usergroup.models.go create mode 100644 views/component/customtextfield/customtextfieldv2.templ create mode 100644 views/component/customtextfield/customtextfieldv2_templ.go create mode 100644 views/component/modal/modal.templ create mode 100644 views/component/modal/modal_templ.go create mode 100644 views/mastermenuusergroup/modaladdusergroup.templ create mode 100644 views/mastermenuusergroup/modaladdusergroup_templ.go create mode 100644 views/mastermenuusergroup/modaleditusergroup.templ create mode 100644 views/mastermenuusergroup/modaleditusergroup_templ.go create mode 100644 views/xsample/trycounter.templ create mode 100644 views/xsample/trycounter_templ.go diff --git a/assets/andy/usergroup.html b/assets/andy/usergroup.html new file mode 100644 index 0000000..39a2d6d --- /dev/null +++ b/assets/andy/usergroup.html @@ -0,0 +1,274 @@ + + + + + + + + Company Portal | { title } + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
KODEUSERGROUPAKSI
001Admin +
+ + +
+
002Tes +
+ + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + diff --git a/assets/asset-corporate-portal/css/sas.bundle.css b/assets/asset-corporate-portal/css/sas.bundle.css index 8e83486..9d4b59f 100644 --- a/assets/asset-corporate-portal/css/sas.bundle.css +++ b/assets/asset-corporate-portal/css/sas.bundle.css @@ -601,12 +601,12 @@ a.text-white:focus { /* ## BUTTON OUTLINE SECONDARY*/ .btn-outline-secondary { - color: var(--secondary) !important; - border-color: var(--secondary) !important; + color: var(--text-black) !important; + border-color: var(--grey) !important; } .btn-outline-secondary:hover { - color: #181c32; - background-color: var(--secondary) !important; + color: var(--white); + background-color: var(--grey) !important; border-color: var(--secondary) !important; } .btn-outline-secondary:focus, @@ -5168,6 +5168,15 @@ a.text-hover-tosca:hover .svg-icon svg:hover g [fill], transition: fill 0.3s ease; } +.htmx-indicator { + display: none; +} +.htmx-request .htmx-indicator { + display: inline; +} +.htmx-request.htmx-indicator { + display: inline; +} /* ### BUTTON HOVER TEXT */ /* ### */ /* ## PRIMARY */ diff --git a/handlers/mastermenuusergroup.handlers.go b/handlers/mastermenuusergroup.handlers.go index b7babb7..721ce7f 100644 --- a/handlers/mastermenuusergroup.handlers.go +++ b/handlers/mastermenuusergroup.handlers.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/a-h/templ" + "github.com/emarifer/go-templ-project-structure/models" "github.com/emarifer/go-templ-project-structure/services" mastermenuusergroup "github.com/emarifer/go-templ-project-structure/views/mastermenuusergroup" "github.com/labstack/echo/v4" @@ -11,6 +12,8 @@ import ( type MasterMenuUserGroupService interface { GetMasterMenus() ([]services.MasterMenu, error) + GetUserGroup() ([]models.UserGroup, error) + GetUserGroupByID(id string) (models.UserGroup, error) } func NewMasterMenuUserGroupHandler(us MasterMenuUserGroupService) *MasterMenuUserGroupHandler { @@ -38,10 +41,17 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroup(c echo.Cont fmt.Println(dataUser) return err } + dataUserGroup, err := lh.MasterMenuUserGroupService.GetUserGroup() + fmt.Println(dataUserGroup) + fmt.Println(err) + if err != nil { + fmt.Println(dataUserGroup) + return err + } si := mastermenuusergroup.ShowMasterMenuUserGroup( "Master Menu", - mastermenuusergroup.ContentMasterMenuUserGroup(), + mastermenuusergroup.ContentMasterMenuUserGroup(dataUserGroup), mastermenuusergroup.CssMasterMenuUserGroup(), mastermenuusergroup.JsMasterMenuUserGroup(), dataMenu, @@ -51,6 +61,20 @@ func (lh *MasterMenuUserGroupHandler) HandlerShowMasterMenuUserGroup(c echo.Cont return lh.View(c, si) } +func (lh *MasterMenuUserGroupHandler) ChangeFormEdit(c echo.Context) error { + id := c.QueryParam("id") + dataUserGroup, err := lh.MasterMenuUserGroupService.GetUserGroupByID(id) + fmt.Println(dataUserGroup) + fmt.Println(err) + if err != nil { + fmt.Println(dataUserGroup) + return err + } + vw := mastermenuusergroup.DialogEditForm(dataUserGroup.UserGroupKode, dataUserGroup.UserGroupName) + + return lh.View(c, vw) +} + func (uh *MasterMenuUserGroupHandler) View(c echo.Context, cmp templ.Component) error { c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML) diff --git a/handlers/routes.go b/handlers/routes.go index b30c9db..e2d9099 100644 --- a/handlers/routes.go +++ b/handlers/routes.go @@ -19,6 +19,8 @@ func SetupRoutesXsample(app *echo.Echo, h *XsampleHandler) { xSample := app.Group("/xsample") xSample.GET("/xsample01", h.Hello) xSample.GET("/coba", h.ShowCoba) + xSample.GET("/counter", h.ShowCounter) + xSample.GET("/counterchange", h.ChangeCounter) } func SetupRoutesLandingPage(app *echo.Echo, h *LandingPageHandler, mastermenuusergroupHandler *MasterMenuUserGroupHandler) { Lp := app.Group("/landing_page") @@ -27,6 +29,8 @@ func SetupRoutesLandingPage(app *echo.Echo, h *LandingPageHandler, mastermenuuse // mdgroup := clientgroup.Group("/md") // clientusergroup.GET("/md", mastermenuusergroupHandler.HandlerShowMasterMenuUserGroup) clientgroup.GET("/usergroup", mastermenuusergroupHandler.HandlerShowMasterMenuUserGroup) + clientgroup.GET("/usergroup/edit", mastermenuusergroupHandler.ChangeFormEdit) + } func SetupRoutesPieChart(app *echo.Echo, h *PiechartHandler) { Lp := app.Group("/pie_chart") diff --git a/handlers/xsample.handlers.go b/handlers/xsample.handlers.go index 7d07e58..8292816 100644 --- a/handlers/xsample.handlers.go +++ b/handlers/xsample.handlers.go @@ -2,6 +2,7 @@ package handlers import ( "fmt" + "strconv" "github.com/a-h/templ" "github.com/emarifer/go-templ-project-structure/services" @@ -49,6 +50,46 @@ func (uh *XsampleHandler) ShowCoba(c echo.Context) error { helo := xsample.ShowCoba("Hello World", xsample.Coba("Hello World"), xsample.CssCoba(), xsample.JsCoba(), dataMenu, dataUser) return uh.View(c, helo) } +func (uh *XsampleHandler) ShowCounter(c echo.Context) error { + typectr := c.QueryParam("type") + + counter := c.QueryParam("counter") + if counter == "" { + counter = "0" + } + ctr, err := strconv.Atoi(counter) + if err != nil { + fmt.Println("Error counter parse int") + return err + } + + if typectr == "min" { + ctr = ctr - 1 + } else if typectr == "plus" { + ctr = ctr + 1 + } + helo := xsample.Page(ctr) + return uh.View(c, helo) +} +func (uh *XsampleHandler) ChangeCounter(c echo.Context) error { + + typectr := c.QueryParam("type") + + counter := c.QueryParam("counter") + ctr, err := strconv.Atoi(counter) + if err != nil { + fmt.Println("Error counter parse int") + return err + } + + if typectr == "min" { + ctr = ctr - 1 + } else { + ctr = ctr + 1 + } + helo := xsample.Counts(ctr) + return uh.View(c, helo) +} func (uh *XsampleHandler) View(c echo.Context, cmp templ.Component) error { c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML) diff --git a/models/CustomTextField.models.go b/models/CustomTextField.models.go new file mode 100644 index 0000000..6fc167c --- /dev/null +++ b/models/CustomTextField.models.go @@ -0,0 +1,14 @@ +package models + +// inpLabelText, +// inpName, +// inpPlaceHolder, +// inpType string +// MainCustomTextField +type CustomTextFieldv2Prm struct { + Label string `default:"Label"` + Name string `default:"name"` + Placeholder string `default:"Placeholder"` + Type string `default:"text"` + Value string `default:""` +} diff --git a/models/usergroup.models.go b/models/usergroup.models.go new file mode 100644 index 0000000..1aa130a --- /dev/null +++ b/models/usergroup.models.go @@ -0,0 +1,7 @@ +package models + +type UserGroup struct { + UserGroupID int `json:"user_group_id"` + UserGroupKode string `json:"user_group_kode"` + UserGroupName string `json:"user_group_name"` +} diff --git a/services/mastermenuusergroup.services.go b/services/mastermenuusergroup.services.go index 4b3d65c..81feea9 100644 --- a/services/mastermenuusergroup.services.go +++ b/services/mastermenuusergroup.services.go @@ -1,7 +1,12 @@ package services import ( + "fmt" + "strconv" + "time" + "github.com/emarifer/go-templ-project-structure/db" + "github.com/emarifer/go-templ-project-structure/models" ) func NewServicesMasterMenuUserGroup(u MasterMenu, uStore db.MasterMenuUserGroupStore) *ServicesMasterMenuUserGroup { @@ -543,6 +548,36 @@ func (su *ServicesMasterMenuUserGroup) GetMasterMenus() ([]MasterMenu, error) { return dummyMenu, nil } +func (ug *ServicesMasterMenuUserGroup) GetUserGroup() ([]models.UserGroup, error) { + data := []models.UserGroup{ + {UserGroupID: 1, UserGroupKode: "A", UserGroupName: "UG1"}, + {UserGroupID: 2, UserGroupKode: "B", UserGroupName: "UG2"}, + {UserGroupID: 3, UserGroupKode: "C", UserGroupName: "UG3"}, + } + return data, nil +} + +func (ug *ServicesMasterMenuUserGroup) GetUserGroupByID(id string) (models.UserGroup, error) { + listdata := []models.UserGroup{ + {UserGroupID: 1, UserGroupKode: "A", UserGroupName: "UG1"}, + {UserGroupID: 2, UserGroupKode: "B", UserGroupName: "UG2"}, + {UserGroupID: 3, UserGroupKode: "C", UserGroupName: "UG3"}, + } + var data models.UserGroup + idData, err := strconv.Atoi(id) + if err != nil { + return data, fmt.Errorf("pack %v: %w", "Error", err) + } + for _, v := range listdata { + + if v.UserGroupID == idData { + data = v + } + } + time.Sleep(5 * time.Second) + return data, nil +} + // func (su *ServicesMasterMenuUserGroup) GetAllMasterMenus() ([]MasterMenu, error) { // query := `SELECT id, MasterMenuname, email, created_at FROM MasterMenus ORDER BY created_at DESC` diff --git a/views/component/customtextfield/customtextfield.templ b/views/component/customtextfield/customtextfield.templ index 189b9be..73c5598 100644 --- a/views/component/customtextfield/customtextfield.templ +++ b/views/component/customtextfield/customtextfield.templ @@ -11,7 +11,7 @@ templ MainCustomTextField(inpLabelText, name={ inpName } type={ inpType } placeholder={ inpPlaceHolder } - class="form-control bg-field border-0" + class="form-control bg-field border-0 h-auto py-6 px-6 rounded-lg" /> } diff --git a/views/component/customtextfield/customtextfield_templ.go b/views/component/customtextfield/customtextfield_templ.go index eaa6d1d..52c41ac 100644 --- a/views/component/customtextfield/customtextfield_templ.go +++ b/views/component/customtextfield/customtextfield_templ.go @@ -91,7 +91,7 @@ func MainCustomTextField(inpLabelText, if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"form-control bg-field border-0\">") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"form-control bg-field border-0 h-auto py-6 px-6 rounded-lg\">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/views/component/customtextfield/customtextfieldv2.templ b/views/component/customtextfield/customtextfieldv2.templ new file mode 100644 index 0000000..c24ff90 --- /dev/null +++ b/views/component/customtextfield/customtextfieldv2.templ @@ -0,0 +1,17 @@ +package customtextfield + +import "github.com/emarifer/go-templ-project-structure/models" + +templ CustomTextFieldv2(inp models.CustomTextFieldv2Prm) { +
+ + +
+} diff --git a/views/component/customtextfield/customtextfieldv2_templ.go b/views/component/customtextfield/customtextfieldv2_templ.go new file mode 100644 index 0000000..8b20ddb --- /dev/null +++ b/views/component/customtextfield/customtextfieldv2_templ.go @@ -0,0 +1,115 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package customtextfield + +//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 "github.com/emarifer/go-templ-project-structure/models" + +func CustomTextFieldv2(inp models.CustomTextFieldv2Prm) 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("
") + 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 + }) +} diff --git a/views/component/modal/modal.templ b/views/component/modal/modal.templ new file mode 100644 index 0000000..9742c2f --- /dev/null +++ b/views/component/modal/modal.templ @@ -0,0 +1,30 @@ +package modalcomponent + +templ Modal(modalID string, modalTitle string, modalBody templ.Component, modalAction templ.Component, btnClose templ.Component) { + +} diff --git a/views/component/modal/modal_templ.go b/views/component/modal/modal_templ.go new file mode 100644 index 0000000..7f79716 --- /dev/null +++ b/views/component/modal/modal_templ.go @@ -0,0 +1,85 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package modalcomponent + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import "context" +import "io" +import "bytes" + +func Modal(modalID string, modalTitle string, modalBody templ.Component, modalAction templ.Component, btnClose templ.Component) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var3 string + templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(modalTitle) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\component\modal\modal.templ`, Line: 17, Col: 18} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = btnClose.Render(ctx, templ_7745c5c3_Buffer) + 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 = modalBody.Render(ctx, templ_7745c5c3_Buffer) + 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} diff --git a/views/mastermenuusergroup/mastermenuusergroup.templ b/views/mastermenuusergroup/mastermenuusergroup.templ index c7c045f..80a4aad 100644 --- a/views/mastermenuusergroup/mastermenuusergroup.templ +++ b/views/mastermenuusergroup/mastermenuusergroup.templ @@ -6,10 +6,12 @@ import ( "github.com/emarifer/go-templ-project-structure/services" "github.com/emarifer/go-templ-project-structure/models" "github.com/emarifer/go-templ-project-structure/views/component/table" + "github.com/emarifer/go-templ-project-structure/views/component/modal" + "strconv" ) // "github.com/emarifer/go-templ-project-structure/views/component/sidebar_user_profile" -templ ContentMasterMenuUserGroup() { +templ ContentMasterMenuUserGroup(ugData []models.UserGroup) {
@@ -18,7 +20,12 @@ templ ContentMasterMenuUserGroup() {
//
- +
@@ -26,32 +33,76 @@ templ ContentMasterMenuUserGroup() {
- @tablecomponent.Table([]string{"KODE", "USERGROUP", "AKSI"}, []string{"40%", "40%", "20%"}, TableRow(), Pagination()) + @tablecomponent.Table([]string{"KODE", "USERGROUP", "AKSI"}, []string{"40%", "40%", "20%"}, TableRow(ugData), Pagination())
+ @modalcomponent.Modal("dialogNew", "New - User Group", DialogNewBody("", ""), DialogNewAction(), BtnCloseNew()) + @modalcomponent.Modal("dialogEdit", "Edit - User Group", DialogEditBody("", ""), DialogEditAction(), BtnCloseNew()) + @JSku()
} -templ TableRow() { - - 001 - Admin - -
- - -
- - - - 002 - Tes - -
- - -
- - +templ TableRow(data []models.UserGroup) { + // /usergroup/edit + for _, v := range data { + + { v.UserGroupKode } + { v.UserGroupName } + +
+ + Hapus +
+ + + } +} + +templ JSku() { + } templ Pagination() { diff --git a/views/mastermenuusergroup/mastermenuusergroup_templ.go b/views/mastermenuusergroup/mastermenuusergroup_templ.go index c235a4f..bd99e4a 100644 --- a/views/mastermenuusergroup/mastermenuusergroup_templ.go +++ b/views/mastermenuusergroup/mastermenuusergroup_templ.go @@ -14,12 +14,14 @@ import ( "github.com/emarifer/go-templ-project-structure/models" "github.com/emarifer/go-templ-project-structure/services" "github.com/emarifer/go-templ-project-structure/views/component/breadcrumbadmin" + "github.com/emarifer/go-templ-project-structure/views/component/modal" "github.com/emarifer/go-templ-project-structure/views/component/table" "github.com/emarifer/go-templ-project-structure/views/layout" + "strconv" ) // "github.com/emarifer/go-templ-project-structure/views/component/sidebar_user_profile" -func ContentMasterMenuUserGroup() templ.Component { +func ContentMasterMenuUserGroup(ugData []models.UserGroup) 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 { @@ -40,15 +42,31 @@ func ContentMasterMenuUserGroup() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = tablecomponent.Table([]string{"KODE", "USERGROUP", "AKSI"}, []string{"40%", "40%", "20%"}, TableRow(), Pagination()).Render(ctx, templ_7745c5c3_Buffer) + templ_7745c5c3_Err = tablecomponent.Table([]string{"KODE", "USERGROUP", "AKSI"}, []string{"40%", "40%", "20%"}, TableRow(ugData), Pagination()).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = modalcomponent.Modal("dialogNew", "New - User Group", DialogNewBody("", ""), DialogNewAction(), BtnCloseNew()).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = modalcomponent.Modal("dialogEdit", "Edit - User Group", DialogEditBody("", ""), DialogEditAction(), BtnCloseNew()).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = JSku().Render(ctx, templ_7745c5c3_Buffer) + 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 } @@ -59,7 +77,7 @@ func ContentMasterMenuUserGroup() templ.Component { }) } -func TableRow() templ.Component { +func TableRow(data []models.UserGroup) 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 { @@ -72,7 +90,72 @@ func TableRow() templ.Component { templ_7745c5c3_Var2 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("001Admin
002Tes
") + for _, v := range data { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var3 string + templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(v.UserGroupKode) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\mastermenuusergroup\mastermenuusergroup.templ`, Line: 48, Col: 24} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var4 string + templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(v.UserGroupName) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\mastermenuusergroup\mastermenuusergroup.templ`, Line: 49, Col: 24} + } + _, 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("
Hapus
") + 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 JSku() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var6 := templ.GetChildren(ctx) + if templ_7745c5c3_Var6 == nil { + templ_7745c5c3_Var6 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -91,9 +174,9 @@ func Pagination() templ.Component { defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templ.GetChildren(ctx) - if templ_7745c5c3_Var3 == nil { - templ_7745c5c3_Var3 = templ.NopComponent + templ_7745c5c3_Var7 := templ.GetChildren(ctx) + if templ_7745c5c3_Var7 == nil { + templ_7745c5c3_Var7 = templ.NopComponent } ctx = templ.ClearChildren(ctx) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") @@ -115,9 +198,9 @@ func CssMasterMenuUserGroup() templ.Component { defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var4 := templ.GetChildren(ctx) - if templ_7745c5c3_Var4 == nil { - templ_7745c5c3_Var4 = templ.NopComponent + templ_7745c5c3_Var8 := templ.GetChildren(ctx) + if templ_7745c5c3_Var8 == nil { + templ_7745c5c3_Var8 = templ.NopComponent } ctx = templ.ClearChildren(ctx) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") @@ -139,9 +222,9 @@ func JsMasterMenuUserGroup() templ.Component { defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var5 := templ.GetChildren(ctx) - if templ_7745c5c3_Var5 == nil { - templ_7745c5c3_Var5 = templ.NopComponent + templ_7745c5c3_Var9 := templ.GetChildren(ctx) + if templ_7745c5c3_Var9 == nil { + templ_7745c5c3_Var9 = templ.NopComponent } ctx = templ.ClearChildren(ctx) if !templ_7745c5c3_IsBuffer { @@ -159,12 +242,12 @@ func ShowMasterMenuUserGroup(title string, cmp templ.Component, css templ.Compon defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var6 := templ.GetChildren(ctx) - if templ_7745c5c3_Var6 == nil { - templ_7745c5c3_Var6 = templ.NopComponent + templ_7745c5c3_Var10 := templ.GetChildren(ctx) + if templ_7745c5c3_Var10 == nil { + templ_7745c5c3_Var10 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var7 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var11 := 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() @@ -179,7 +262,7 @@ func ShowMasterMenuUserGroup(title string, cmp templ.Component, css templ.Compon } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, dataMenu, dataUser).Render(templ.WithChildren(ctx, templ_7745c5c3_Var7), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, dataMenu, dataUser).Render(templ.WithChildren(ctx, templ_7745c5c3_Var11), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/views/mastermenuusergroup/modaladdusergroup.templ b/views/mastermenuusergroup/modaladdusergroup.templ new file mode 100644 index 0000000..c4303fd --- /dev/null +++ b/views/mastermenuusergroup/modaladdusergroup.templ @@ -0,0 +1,56 @@ +package mastermenuusergroup + +import ( + "github.com/emarifer/go-templ-project-structure/models" + "github.com/emarifer/go-templ-project-structure/views/component/customtextfield" +) + +templ DialogNewBody(code string, name string) { +
+ @customtextfield.CustomTextFieldv2( + models.CustomTextFieldv2Prm{ + Label: "Kode user group", + Name: "usergroupcode", + Placeholder: "Kode user Group", + Type: "text", + Value: code, + }) + @customtextfield.CustomTextFieldv2( + models.CustomTextFieldv2Prm{ + Label: "Nama User Group", + Name: "usergroupname", + Placeholder: "Nama User Group", + Type: "text", + Value: name, + }) +
+} + +templ DialogNewAction() { +
+ + +
+} + +templ BtnCloseNew() { + +} diff --git a/views/mastermenuusergroup/modaladdusergroup_templ.go b/views/mastermenuusergroup/modaladdusergroup_templ.go new file mode 100644 index 0000000..cf7559d --- /dev/null +++ b/views/mastermenuusergroup/modaladdusergroup_templ.go @@ -0,0 +1,114 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package mastermenuusergroup + +//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 ( + "github.com/emarifer/go-templ-project-structure/models" + "github.com/emarifer/go-templ-project-structure/views/component/customtextfield" +) + +func DialogNewBody(code string, name string) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + 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("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = customtextfield.CustomTextFieldv2( + models.CustomTextFieldv2Prm{ + Label: "Kode user group", + Name: "usergroupcode", + Placeholder: "Kode user Group", + Type: "text", + Value: code, + }).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = customtextfield.CustomTextFieldv2( + models.CustomTextFieldv2Prm{ + Label: "Nama User Group", + Name: "usergroupname", + Placeholder: "Nama User Group", + Type: "text", + Value: name, + }).Render(ctx, templ_7745c5c3_Buffer) + 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func DialogNewAction() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var2 := templ.GetChildren(ctx) + if templ_7745c5c3_Var2 == nil { + templ_7745c5c3_Var2 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func BtnCloseNew() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var3 := templ.GetChildren(ctx) + if templ_7745c5c3_Var3 == nil { + templ_7745c5c3_Var3 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + 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 + }) +} diff --git a/views/mastermenuusergroup/modaleditusergroup.templ b/views/mastermenuusergroup/modaleditusergroup.templ new file mode 100644 index 0000000..a0a61dd --- /dev/null +++ b/views/mastermenuusergroup/modaleditusergroup.templ @@ -0,0 +1,79 @@ +package mastermenuusergroup + +import ( + "github.com/emarifer/go-templ-project-structure/models" + "github.com/emarifer/go-templ-project-structure/views/component/customtextfield" +) + +templ DialogEditForm(code string, name string) { + @customtextfield.CustomTextFieldv2( + models.CustomTextFieldv2Prm{ + Label: "Kode user group", + Name: "usergroupcode", + Placeholder: "Kode user Group", + Type: "text", + Value: code, + }) + @customtextfield.CustomTextFieldv2( + models.CustomTextFieldv2Prm{ + Label: "Nama User Group", + Name: "usergroupname", + Placeholder: "Nama User Group", + Type: "text", + Value: name, + }) +} + +templ DialogEditBody(code string, name string) { +
+ @DialogEditForm(code, name) +
+
+
+
+
+
+} + +templ LoadingSpinner() { +
+
+
+
+
+} + +templ DialogEditAction() { +
+ + +
+} + +templ BtnCloseEdit() { + +} diff --git a/views/mastermenuusergroup/modaleditusergroup_templ.go b/views/mastermenuusergroup/modaleditusergroup_templ.go new file mode 100644 index 0000000..a4192aa --- /dev/null +++ b/views/mastermenuusergroup/modaleditusergroup_templ.go @@ -0,0 +1,162 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package mastermenuusergroup + +//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 ( + "github.com/emarifer/go-templ-project-structure/models" + "github.com/emarifer/go-templ-project-structure/views/component/customtextfield" +) + +func DialogEditForm(code string, name string) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Err = customtextfield.CustomTextFieldv2( + models.CustomTextFieldv2Prm{ + Label: "Kode user group", + Name: "usergroupcode", + Placeholder: "Kode user Group", + Type: "text", + Value: code, + }).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = customtextfield.CustomTextFieldv2( + models.CustomTextFieldv2Prm{ + Label: "Nama User Group", + Name: "usergroupname", + Placeholder: "Nama User Group", + Type: "text", + Value: name, + }).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func DialogEditBody(code string, name string) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var2 := templ.GetChildren(ctx) + if templ_7745c5c3_Var2 == nil { + templ_7745c5c3_Var2 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = DialogEditForm(code, name).Render(ctx, templ_7745c5c3_Buffer) + 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func LoadingSpinner() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var3 := templ.GetChildren(ctx) + if templ_7745c5c3_Var3 == nil { + templ_7745c5c3_Var3 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func DialogEditAction() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var4 := templ.GetChildren(ctx) + if templ_7745c5c3_Var4 == nil { + templ_7745c5c3_Var4 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func BtnCloseEdit() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var5 := templ.GetChildren(ctx) + if templ_7745c5c3_Var5 == nil { + templ_7745c5c3_Var5 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + 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 + }) +} diff --git a/views/xsample/trycounter.templ b/views/xsample/trycounter.templ new file mode 100644 index 0000000..9f41ba4 --- /dev/null +++ b/views/xsample/trycounter.templ @@ -0,0 +1,51 @@ +package xsample + +import "strconv" +import ( + "github.com/emarifer/go-templ-project-structure/views/layout" +) + +templ Counts(counter int) { +
counter: { strconv.Itoa(counter) }
+} + +templ Form(counter int) { + // /show?team=x-men&member=wolverine + // hx-get="/xsample/counterchange?type=min&counter" + // /xsample/counterchange?type=min&counter= +
+ +1 +
+
+ -1 +
+} + +templ CssCtr() { +} + +templ JsCtr() { +} + +templ Page(counter int) { + @layout.PlaygroundLayout("Coba counter", CssCtr(), JsCtr()) { +
+ @Counts(counter) + @Form(counter) +
+ } +} diff --git a/views/xsample/trycounter_templ.go b/views/xsample/trycounter_templ.go new file mode 100644 index 0000000..0650659 --- /dev/null +++ b/views/xsample/trycounter_templ.go @@ -0,0 +1,194 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package xsample + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import "context" +import "io" +import "bytes" + +import "strconv" +import ( + "github.com/emarifer/go-templ-project-structure/views/layout" +) + +func Counts(counter int) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_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("
counter: ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var2 string + templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(counter)) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\xsample\trycounter.templ`, Line: 9, Col: 48} + } + _, 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func Form(counter int) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var3 := templ.GetChildren(ctx) + if templ_7745c5c3_Var3 == nil { + templ_7745c5c3_Var3 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + 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 CssCtr() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var6 := templ.GetChildren(ctx) + if templ_7745c5c3_Var6 == nil { + templ_7745c5c3_Var6 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func JsCtr() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var7 := templ.GetChildren(ctx) + if templ_7745c5c3_Var7 == nil { + templ_7745c5c3_Var7 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func Page(counter int) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var8 := templ.GetChildren(ctx) + if templ_7745c5c3_Var8 == nil { + templ_7745c5c3_Var8 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var9 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = Counts(counter).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = Form(counter).Render(ctx, templ_7745c5c3_Buffer) + 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 !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer) + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = layout.PlaygroundLayout("Coba counter", CssCtr(), JsCtr()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var9), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} From ad26d88febc410a2d4364d10af3064ecde586a57 Mon Sep 17 00:00:00 2001 From: Sas Andy Date: Wed, 8 May 2024 13:28:03 +0700 Subject: [PATCH 12/12] try pagination templ --- assets/andy/usergroup.html | 62 ++++++++ handlers/mastermenuusergroup.handlers.go | 26 ++++ handlers/routes.go | 1 + services/mastermenuusergroup.services.go | 3 +- .../component/modal/modal_confirmation.templ | 52 +++++++ .../modal/modal_confirmation_templ.go | 143 ++++++++++++++++++ views/component/pagination/pagination.templ | 17 +++ .../component/pagination/pagination_templ.go | 80 ++++++++++ .../mastermenuusergroup.templ | 74 +++++++-- .../mastermenuusergroup_templ.go | 130 +++++++++++++--- .../modaleditusergroup.templ | 6 +- .../modaleditusergroup_templ.go | 2 +- 12 files changed, 554 insertions(+), 42 deletions(-) create mode 100644 views/component/modal/modal_confirmation.templ create mode 100644 views/component/modal/modal_confirmation_templ.go create mode 100644 views/component/pagination/pagination.templ create mode 100644 views/component/pagination/pagination_templ.go diff --git a/assets/andy/usergroup.html b/assets/andy/usergroup.html index 39a2d6d..86b1985 100644 --- a/assets/andy/usergroup.html +++ b/assets/andy/usergroup.html @@ -143,6 +143,68 @@
+ + + + + +} diff --git a/views/component/modal/modal_confirmation_templ.go b/views/component/modal/modal_confirmation_templ.go new file mode 100644 index 0000000..eeb1046 --- /dev/null +++ b/views/component/modal/modal_confirmation_templ.go @@ -0,0 +1,143 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package modalcomponent + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import "context" +import "io" +import "bytes" + +func ModalConfirmation( + id string, + modalTitle string, + message string, + btnClose templ.Component, + datHeader []string, + dataText []string, + modalAction templ.Component) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var3 string + templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(modalTitle) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\component\modal\modal_confirmation.templ`, Line: 23, Col: 18} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = btnClose.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var4 string + templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(message) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\component\modal\modal_confirmation.templ`, Line: 28, Col: 17} + } + _, 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("

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for _, v := range datHeader { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var5 string + templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(v) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\component\modal\modal_confirmation.templ`, Line: 33, Col: 66} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) + if templ_7745c5c3_Err != nil { + 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("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for _, v := range dataText { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var6 string + templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(v) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\component\modal\modal_confirmation.templ`, Line: 39, Col: 13} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + 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 + }) +} diff --git a/views/component/pagination/pagination.templ b/views/component/pagination/pagination.templ new file mode 100644 index 0000000..9dd55bd --- /dev/null +++ b/views/component/pagination/pagination.templ @@ -0,0 +1,17 @@ +package pagination + +import "strconv" + +templ Pagination(length int, currentPage int) { +
+
+ for i:=0; i{ strconv.Itoa(i+1) } + } else { + { strconv.Itoa(i+1) } + } + } +
+
+} diff --git a/views/component/pagination/pagination_templ.go b/views/component/pagination/pagination_templ.go new file mode 100644 index 0000000..eaf1a44 --- /dev/null +++ b/views/component/pagination/pagination_templ.go @@ -0,0 +1,80 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package pagination + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import "context" +import "io" +import "bytes" + +import "strconv" + +func Pagination(length int, currentPage int) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_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("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for i := 0; i < length; i++ { + if (i + 1) == currentPage { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var2 string + templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(i + 1)) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\component\pagination\pagination.templ`, Line: 10, Col: 118} + } + _, 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 + } + } else { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var3 string + templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(i + 1)) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\component\pagination\pagination.templ`, Line: 12, Col: 93} + } + _, 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("
") + 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 + }) +} diff --git a/views/mastermenuusergroup/mastermenuusergroup.templ b/views/mastermenuusergroup/mastermenuusergroup.templ index 80a4aad..1d919f1 100644 --- a/views/mastermenuusergroup/mastermenuusergroup.templ +++ b/views/mastermenuusergroup/mastermenuusergroup.templ @@ -8,6 +8,7 @@ import ( "github.com/emarifer/go-templ-project-structure/views/component/table" "github.com/emarifer/go-templ-project-structure/views/component/modal" "strconv" + "github.com/emarifer/go-templ-project-structure/views/component/pagination" ) // "github.com/emarifer/go-templ-project-structure/views/component/sidebar_user_profile" @@ -32,8 +33,8 @@ templ ContentMasterMenuUserGroup(ugData []models.UserGroup) { -
- @tablecomponent.Table([]string{"KODE", "USERGROUP", "AKSI"}, []string{"40%", "40%", "20%"}, TableRow(ugData), Pagination()) +
+ @tablecomponent.Table([]string{"KODE", "USERGROUP", "AKSI"}, []string{"40%", "40%", "20%"}, TableRow(ugData), pagination.Pagination(20, 1))
@modalcomponent.Modal("dialogNew", "New - User Group", DialogNewBody("", ""), DialogNewAction(), BtnCloseNew()) @modalcomponent.Modal("dialogEdit", "Edit - User Group", DialogEditBody("", ""), DialogEditAction(), BtnCloseNew()) @@ -43,38 +44,87 @@ templ ContentMasterMenuUserGroup(ugData []models.UserGroup) { templ TableRow(data []models.UserGroup) { // /usergroup/edit + // + // Edit + // for _, v := range data { { v.UserGroupKode } { v.UserGroupName }
- + Hapus + @modalcomponent.Modal("dialogEdit"+strconv.Itoa(v.UserGroupID), + "Edit - User Group", + DialogEditBody(v.UserGroupKode, v.UserGroupName), + DialogEditAction(), + BtnCloseNew()) + @modalcomponent.ModalConfirmation( + "dialogDelete"+strconv.Itoa(v.UserGroupID), + "Konfirmasi", + "Apakah anda yakin menghapus user group berikut ?", BtnCloseDelete(), + []string{"Kode", "User Group"}, []string{v.UserGroupKode, v.UserGroupName}, DialogDeleteAction())
} } +templ DialogDeleteAction() { +
+ + +
+} + +templ BtnCloseDelete() { + +} + templ JSku() { ") @@ -174,9 +256,9 @@ func Pagination() templ.Component { defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var7 := templ.GetChildren(ctx) - if templ_7745c5c3_Var7 == nil { - templ_7745c5c3_Var7 = templ.NopComponent + templ_7745c5c3_Var10 := templ.GetChildren(ctx) + if templ_7745c5c3_Var10 == nil { + templ_7745c5c3_Var10 = templ.NopComponent } ctx = templ.ClearChildren(ctx) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") @@ -198,9 +280,9 @@ func CssMasterMenuUserGroup() templ.Component { defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var8 := templ.GetChildren(ctx) - if templ_7745c5c3_Var8 == nil { - templ_7745c5c3_Var8 = templ.NopComponent + templ_7745c5c3_Var11 := templ.GetChildren(ctx) + if templ_7745c5c3_Var11 == nil { + templ_7745c5c3_Var11 = templ.NopComponent } ctx = templ.ClearChildren(ctx) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") @@ -222,9 +304,9 @@ func JsMasterMenuUserGroup() templ.Component { defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var9 := templ.GetChildren(ctx) - if templ_7745c5c3_Var9 == nil { - templ_7745c5c3_Var9 = templ.NopComponent + templ_7745c5c3_Var12 := templ.GetChildren(ctx) + if templ_7745c5c3_Var12 == nil { + templ_7745c5c3_Var12 = templ.NopComponent } ctx = templ.ClearChildren(ctx) if !templ_7745c5c3_IsBuffer { @@ -242,12 +324,12 @@ func ShowMasterMenuUserGroup(title string, cmp templ.Component, css templ.Compon defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var10 := templ.GetChildren(ctx) - if templ_7745c5c3_Var10 == nil { - templ_7745c5c3_Var10 = templ.NopComponent + templ_7745c5c3_Var13 := templ.GetChildren(ctx) + if templ_7745c5c3_Var13 == nil { + templ_7745c5c3_Var13 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var11 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var14 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) if !templ_7745c5c3_IsBuffer { templ_7745c5c3_Buffer = templ.GetBuffer() @@ -262,7 +344,7 @@ func ShowMasterMenuUserGroup(title string, cmp templ.Component, css templ.Compon } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, dataMenu, dataUser).Render(templ.WithChildren(ctx, templ_7745c5c3_Var11), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, dataMenu, dataUser).Render(templ.WithChildren(ctx, templ_7745c5c3_Var14), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/views/mastermenuusergroup/modaleditusergroup.templ b/views/mastermenuusergroup/modaleditusergroup.templ index a0a61dd..4be0c5b 100644 --- a/views/mastermenuusergroup/modaleditusergroup.templ +++ b/views/mastermenuusergroup/modaleditusergroup.templ @@ -29,9 +29,9 @@ templ DialogEditBody(code string, name string) { @DialogEditForm(code, name)
-
-
-
+ //
+ //
+ //
} diff --git a/views/mastermenuusergroup/modaleditusergroup_templ.go b/views/mastermenuusergroup/modaleditusergroup_templ.go index a4192aa..28abe48 100644 --- a/views/mastermenuusergroup/modaleditusergroup_templ.go +++ b/views/mastermenuusergroup/modaleditusergroup_templ.go @@ -78,7 +78,7 @@ func DialogEditBody(code string, name string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }