mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-06 02:36:49 +00:00
add host details
This commit is contained in:
parent
fc0f9c574b
commit
3d6d1474a2
5 changed files with 182 additions and 4 deletions
115
assets/html/invoice.html
Normal file
115
assets/html/invoice.html
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
<tr>
|
||||
<td>
|
||||
<strong>Au : </strong></td>
|
||||
ss="text-break product_name">
|
||||
{{ row.name }}
|
||||
</td>
|
||||
<td>{{ row.quantity }}</td>
|
||||
e d'intérêts de retard. Le montant des pénalités résulte de l'application aux sommes restant dues d'un taux d'intérêt légal en vigueur au moment de l'incident. <br/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="order-total space-between">
|
||||
<div></div>
|
||||
<div class="total">
|
||||
<div class="amount-due">
|
||||
Total
|
||||
</div>
|
||||
<div class="amount-due-total">
|
||||
{{ total }} €
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html> <td>{{row.price }} €</td>
|
||||
<td class="align-right">{{ row.total }} €</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="order-summary space-between">
|
||||
<div class="card">
|
||||
<b>Notes</b> <br/>
|
||||
TVA non applicable, art. 293 B du CGI <br/>
|
||||
Dispensé d’immatriculation au registre du commerce et des sociétés (RCS) et au répertoire des métiers. <br/>
|
||||
Conditions de paiement : paiement à réception de facture. Aucun escompte consenti pour règlement anticipé ou désistement. Tout incident de paiement est passibl <td>{{ to }}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Montant : </strong></td>
|
||||
<td>{{ total }} €</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="order-details">
|
||||
<table class="items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Objet</th>
|
||||
<th>Quantité</th>
|
||||
<th>Prix</th>
|
||||
<th class="align-right">Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-gray rounded">
|
||||
{% for row in lines %}
|
||||
<tr class="item-row">
|
||||
<td cla<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" href="main.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="header space-between">
|
||||
<img class="logo" src="logo.png">
|
||||
<div class="payee">
|
||||
<b>{{ host.name }}</b><br/>
|
||||
{{ host.address }}<br/>
|
||||
{{ host.zip_code}} {{ host.city }}<br/>
|
||||
<b>Tel : </b>{{ host.phone }}<br/>
|
||||
<b>Mail : </b>{{ host.email }}<br/>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="billing-details space-between">
|
||||
<table class="info-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>{{name}}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Tel : </strong></td>
|
||||
<td>{{phone_number}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Voyageurs : </strong></td>
|
||||
<td>{{ customers_number }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Plateforme : </strong></td>
|
||||
<td>{{platform}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="info-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Nº de facture : </strong></td>
|
||||
<td>{{id}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Du : </strong></td>
|
||||
<td>{{ from }}</td>
|
||||
</tr>
|
||||
|
||||
|
|
@ -1,6 +1,12 @@
|
|||
package config
|
||||
|
||||
type Host struct {
|
||||
Name string
|
||||
Address string
|
||||
City string
|
||||
ZipCode string
|
||||
PhoneNumber string
|
||||
Email string
|
||||
InvoicePrefix string
|
||||
PaymentMethods []string
|
||||
Platforms []string
|
||||
|
|
@ -15,6 +21,12 @@ type HostItem struct {
|
|||
|
||||
func NewHost() *Host {
|
||||
return &Host{
|
||||
Name: "VillaFleurie",
|
||||
Address: "4 rue Gerty Archimede",
|
||||
City: "Le Gosier",
|
||||
ZipCode: "97190",
|
||||
PhoneNumber: "+590 690 44 15 30",
|
||||
Email: "location.villafleurie@gmail.com",
|
||||
CustomerSeed: 239,
|
||||
InvoicePrefix: "VFNI",
|
||||
PaymentMethods: []string{"Card", "Cash", "Cheque", "Transfer"},
|
||||
|
|
|
|||
|
|
@ -45,6 +45,14 @@ func (ps PdfService) BuildInvoice(b *booking.Booking, hc *config.Host) error {
|
|||
ProjectId string `json:"projectId"`
|
||||
}{
|
||||
Context: map[string]any{
|
||||
"host": map[string]any{
|
||||
"name": hc.Name,
|
||||
"address": hc.Address,
|
||||
"zip": hc.ZipCode,
|
||||
"city": hc.City,
|
||||
"phone": hc.PhoneNumber,
|
||||
"email": hc.Email,
|
||||
},
|
||||
"id": b.InvoiceNumber(hc),
|
||||
"name": b.Name,
|
||||
"phone_number": b.PhoneNumber,
|
||||
|
|
@ -74,7 +82,50 @@ func (ps PdfService) BuildInvoice(b *booking.Booking, hc *config.Host) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// build request to third-party API
|
||||
return ps.sendData(payload)
|
||||
}
|
||||
|
||||
func (ps PdfService) BuildReport(r *booking.Report) error {
|
||||
// data := struct {
|
||||
// Context map[string]any `w`
|
||||
// Path string `json:"path"`
|
||||
// ProjectId string `json:"projectId"`
|
||||
// }{
|
||||
// Context: map[string]any{
|
||||
// "id": r.InvoiceNumber(hc),
|
||||
// "name": r.Name,
|
||||
// "phone_number": r.PhoneNumber,
|
||||
// "customers_number": r.CustomerNumber,
|
||||
// "platform": r.Platform,
|
||||
// "from": r.From.Format("02/01/2006"),
|
||||
// "to": r.To.Format("02/01/2006"),
|
||||
// "lines": u.Map(b.Items, func(i booking.Item) map[string]any {
|
||||
// return map[string]any{
|
||||
// "name": i.Item,
|
||||
// "quantity": i.Quantity,
|
||||
// "price": i.Price,
|
||||
// "total": i.Price * float64(i.Quantity),
|
||||
// }
|
||||
// }),
|
||||
// "total": strconv.FormatFloat(u.Reduce(b.Items, func(i booking.Item, sum float64) float64 {
|
||||
// return sum + i.Price*float64(i.Quantity)
|
||||
// }, 0.0), 'f', 2, 64),
|
||||
// },
|
||||
// Path: ps.invoicePath,
|
||||
// ProjectId: ps.projectId,
|
||||
// }
|
||||
|
||||
// payload, err := json.Marshal(data)
|
||||
// if err != nil {
|
||||
// log.Warnf("Error marshalling JSON:", err)
|
||||
// return err
|
||||
// }
|
||||
//
|
||||
// return ps.sendData(payload)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ps PdfService) sendData(payload []byte) error {
|
||||
req, err := http.NewRequest("POST", ps.url, bytes.NewBuffer(payload))
|
||||
if err != nil {
|
||||
log.Warnf("Error creating request:", err)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ templ BaseLayout() {
|
|||
<meta name="description" content="AI assistant to help you improve your management"/>
|
||||
<link rel="icon" href="/static/img/favicon.svg"/>
|
||||
<link rel="stylesheet" href="/static/css/pico.min.css"/>
|
||||
<script src="/static/js/htmx.js"></script>
|
||||
<script src="/static/js/htmx.js" defer></script>
|
||||
</head>
|
||||
<body hx-boost="true">
|
||||
<nav class="container-fluid">
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ func BaseLayout() templ.Component {
|
|||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!doctype html><html lang=\"en\"><head><title>RentEase | Your Property Management System</title><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><meta name=\"description\" content=\"AI assistant to help you improve your management\"><link rel=\"icon\" href=\"/static/img/favicon.svg\"><link rel=\"stylesheet\" href=\"/static/css/pico.min.css\"><script src=\"/static/js/htmx.js\"></script></head><body hx-boost=\"true\"><nav class=\"container-fluid\"><ul><li><a href=\"/\"><b>🏨 RentEase </b></a></li></ul><ul><li><a href=\"/bookings\">Bookings</a></li><li><a href=\"/reports\">Reports</a></li><li><a href=\"/bookings/new\" role=\"button\">New Booking</a></li></ul></nav><main class=\"container\">")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
@ -31,7 +31,7 @@ func BaseLayout() templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</main><footer class=\"container-fluid\">🏨 RentEase © 2024</footer></body></html>")
|
||||
templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue