-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f66b8e
commit 88102c9
Showing
10 changed files
with
157 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,56 @@ | ||
package employee | ||
|
||
import ( | ||
"github.com/henriquepw/imperium-tattoo/web/types" | ||
"github.com/henriquepw/imperium-tattoo/web/view/layout" | ||
"github.com/henriquepw/imperium-tattoo/web/view/ui" | ||
"github.com/henriquepw/imperium-tattoo/web/types" | ||
"github.com/henriquepw/imperium-tattoo/web/view/layout" | ||
"github.com/henriquepw/imperium-tattoo/web/view/ui" | ||
) | ||
|
||
templ EmployeeCreatePage(boosted bool) { | ||
@layout.Dashbaord("Novo Profissional", "employees", boosted) { | ||
<section> | ||
@layout.PageHeader( | ||
"Novo Profissional", | ||
[]ui.BreadcrumbItem{ | ||
{Label: "Profissinais", Href: "/employees"}, | ||
{Label: "Novo", Href: "/employees/create"}, | ||
}, | ||
) | ||
@ui.Card() { | ||
@EmployeeCreateForm(EmployeeCreateFormProps{}) | ||
} | ||
</section> | ||
} | ||
@layout.Dashbaord("Novo Profissional", "employees", boosted) { | ||
<section> | ||
@layout.PageHeader( | ||
"Novo Profissional", | ||
[]ui.BreadcrumbItem{ | ||
{Label: "Funcionários", Href: "/employees"}, | ||
{Label: "Novo", Href: "/employees/create"}, | ||
}, | ||
) | ||
@ui.Card() { | ||
@EmployeeCreateForm(EmployeeCreateFormProps{}) | ||
} | ||
</section> | ||
} | ||
} | ||
|
||
type EmployeeCreateFormProps struct { | ||
Values types.EmployeeCreateDTO | ||
Errors map[string]string | ||
Values types.EmployeeCreateDTO | ||
Errors map[string]string | ||
} | ||
|
||
templ EmployeeCreateForm(props EmployeeCreateFormProps) { | ||
<form hx-post="/employees/create" hx-target="this" hx-swap="outerHTML" class="flex flex-col gap-4 group"> | ||
@ui.TextInput(ui.TextInputProps{ | ||
Name: "name", | ||
Label: "Nome", | ||
Placeholder: "Nome do Profissinal", | ||
Value: props.Values.Name, | ||
Error: props.Errors["name"], | ||
}) | ||
@ui.TextInput(ui.TextInputProps{ | ||
Name: "email", | ||
Label: "Email", | ||
Placeholder: "[email protected]", | ||
Value: props.Values.Email, | ||
Error: props.Errors["email"], | ||
}) | ||
@ui.TextInput(ui.TextInputProps{ | ||
Name: "roles", | ||
Label: "Cargo", | ||
Placeholder: "Admin", | ||
Value: props.Values.Roles, | ||
Error: props.Errors["roles"], | ||
}) | ||
@ui.SubmitBtn("save", "Criando...", "ml-auto") { | ||
Criar | ||
} | ||
</form> | ||
<form | ||
hx-post="/employees/create" | ||
hx-target="this" | ||
hx-swap="outerHTML" | ||
class="flex flex-col gap-4 group [&.htmx-request]:pointer-events-none" | ||
> | ||
@ui.TextInput(ui.TextInputProps{ | ||
Name: "name", | ||
Label: "Nome", | ||
Placeholder: "Nome do Funcionário", | ||
Value: props.Values.Name, | ||
Error: props.Errors["name"], | ||
}) | ||
@ui.TextInput(ui.TextInputProps{ | ||
Name: "email", | ||
Label: "Email", | ||
Placeholder: "[email protected]", | ||
Value: props.Values.Email, | ||
Error: props.Errors["email"], | ||
}) | ||
@ui.SubmitBtn("save", "Criando...", "ml-auto") { | ||
Criar | ||
} | ||
</form> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package employee | ||
|
||
import ( | ||
"github.com/henriquepw/imperium-tattoo/web/types" | ||
"github.com/henriquepw/imperium-tattoo/web/view/layout" | ||
"github.com/henriquepw/imperium-tattoo/web/view/ui" | ||
) | ||
|
||
templ badge(role string, classname ...string) { | ||
<span class={ "text-sm text-accent-12 bg-accent-3 border border-accent-6 px-1 py-0.5 rounded" , classname }> | ||
{ role } | ||
</span> | ||
} | ||
|
||
templ EmployeesPage(boosted bool, items []types.Employee) { | ||
@layout.Dashbaord("Funcionários", "employees", boosted) { | ||
<div> | ||
@layout.PageHeader("Funcionários", []ui.BreadcrumbItem{ | ||
{Label: "Funcionários", Href: "/employees"}, | ||
}) { | ||
<a href={ templ.URL("employees/create") } class="btn-primary"> | ||
@ui.Icon("plus") | ||
</a> | ||
} | ||
<section class="w-full card p-0 overflow-hidden"> | ||
<table class="table-auto w-full"> | ||
<thead class="bg-gray-2"> | ||
<tr class="uppercase"> | ||
<td class="md:hidden">Funcionário</td> | ||
<td class="hidden md:table-cell">Cargo</td> | ||
<td class="hidden md:table-cell">Nome</td> | ||
<td class="hidden md:table-cell">Email</td> | ||
<td></td> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
for _, i := range items { | ||
<tr> | ||
<td class="max-w-10 hidden md:table-cell"> | ||
@badge(i.Role) | ||
</td> | ||
<td> | ||
<div class="flex flex-col"> | ||
<div class="space-x-2"> | ||
@badge(i.Role, "md:hidden") | ||
<span>{ i.Name }</span> | ||
</div> | ||
<span class="text-gray-11 md:hidden">{ i.Email }</span> | ||
</div> | ||
</td> | ||
<td class="hidden md:block">{ i.Email }</td> | ||
<td class="max-w-4"> | ||
@ui.Icon("edit", "h-4 text-gray-11") | ||
</td> | ||
</tr> | ||
} | ||
if len(items) == 0 { | ||
<tr> | ||
<td colspan="4" class="bg-warning-2"> | ||
<div class="text-center text-warning-12"> | ||
Nenhum Funcionário cadastrado | ||
</div> | ||
</td> | ||
</tr> | ||
} | ||
</tbody> | ||
</table> | ||
</section> | ||
</div> | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters