From b278020911f1596e6e71a0bf684d67a60b07b8b3 Mon Sep 17 00:00:00 2001 From: Sas Andy Date: Fri, 3 May 2024 16:45:58 +0700 Subject: [PATCH 1/5] 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 2/5] 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 3/5] 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 4/5] 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 5/5] 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 }