-
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
3307bd0
commit 1e4d448
Showing
9 changed files
with
136 additions
and
94 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package clientview | ||
|
||
import ( | ||
"github.com/henriquepw/imperium-tattoo/web/types" | ||
"github.com/henriquepw/imperium-tattoo/web/view/ui" | ||
) | ||
|
||
templ ClientDetailSection(client types.Client) { | ||
<section x-data="{expanded: false}" class="column"> | ||
<div x-show="expanded" x-transition class="row"> | ||
@ui.Tile("Adicionado em") { | ||
<span x-text={ ui.FormatDate(client.CreatedAt) }></span> | ||
} | ||
@ui.Tile("Última atualização em") { | ||
<span x-text={ ui.FormatDate(client.UpdatedAt) }></span> | ||
} | ||
</div> | ||
<div class="row"> | ||
@ui.Tile("CPF", templ.Attributes{"x-show": "expanded", "x-transition": true}) { | ||
{ client.CPF } | ||
} | ||
@ui.Tile("Data de Nascimento", templ.Attributes{"x-show": "expanded"}) { | ||
<span x-text={ ui.FormatDate(client.Brithday) }></span> | ||
} | ||
@ui.Tile("Email", templ.Attributes{"x-show": "expanded", "x-transition": true}) { | ||
{ client.Email } | ||
} | ||
</div> | ||
<div class="row"> | ||
@ui.LinkTile("Whatsapp", "https://api.whatsapp.com/send?phone="+ui.OnlyNumber(client.Phone)) { | ||
{ client.Phone } | ||
} | ||
@ui.LinkTile("Instagram", "https://www.instagram.com/"+client.Instagram) { | ||
{ client.Instagram } | ||
} | ||
</div> | ||
<div x-show="expanded" x-transition class="row"> | ||
@ui.Tile("Endereço") { | ||
{ client.Address.ToString() } | ||
} | ||
</div> | ||
<div class="flex justify-center"> | ||
<button class="rounded border px-2 py-0.5 flex gap-1 items-center" @click="expanded = !expanded"> | ||
<span x-text="expanded?'menos detalhes':'mais detalhes'"></span> | ||
<span :class="expanded?'rotate-180':''"> | ||
@ui.Icon("chevron-down") | ||
</span> | ||
</button> | ||
</div> | ||
</section> | ||
} |
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,5 @@ | ||
package clientview | ||
|
||
templ a() { | ||
TODO | ||
} |
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,17 @@ | ||
package clientview | ||
|
||
import "github.com/henriquepw/imperium-tattoo/web/types" | ||
|
||
templ clientRow(i types.Client) { | ||
<td> | ||
<a class="underline text-accent-11" href={ templ.SafeURL("/clients/" + i.ID) }> | ||
{ i.Name } | ||
</a> | ||
</td> | ||
<td> | ||
{ i.Email } | ||
</td> | ||
<td class="whitespace-nowrap"> | ||
{ i.Phone } | ||
</td> | ||
} |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package ui | ||
|
||
import ( | ||
"fmt" | ||
"maps" | ||
"time" | ||
"unicode" | ||
|
||
"github.com/a-h/templ" | ||
) | ||
|
||
func GetAttrs(attrs ...templ.Attributes) templ.Attributes { | ||
result := templ.Attributes{} | ||
for _, a := range attrs { | ||
maps.Copy(result, a) | ||
} | ||
|
||
return result | ||
} | ||
|
||
func FormatDate(dt time.Time) string { | ||
return fmt.Sprintf("new Date('%v').toLocaleDateString('pt-BR')", dt) | ||
} | ||
|
||
func OnlyNumber(str string) string { | ||
num := "" | ||
for _, c := range str { | ||
if unicode.IsDigit(c) { | ||
num = num + string(c) | ||
} | ||
} | ||
|
||
return num | ||
} |