diff --git a/pkg/booking/cart.go b/pkg/booking/cart.go index d2a27ca..15e1760 100644 --- a/pkg/booking/cart.go +++ b/pkg/booking/cart.go @@ -10,10 +10,11 @@ import ( ) type bookingCart struct { - Lines []*cartLine - Total string - DownPayment string - Enabled bool + Lines []*cartLine + Total string + DownPayment string + DownPaymentPercent int + Enabled bool } type cartLine struct { @@ -95,6 +96,7 @@ func newBookingCart(ctx context.Context, conn *database.Conn, f *bookingForm, ca , to_price(subtotal_tourist_tax, decimal_digits) , to_price(total, decimal_digits) , to_price(payment.down_payment, decimal_digits) + , (payment.down_payment_percent * 100)::int from draft_payment($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) as payment join currency using (currency_code) `, @@ -131,6 +133,7 @@ func newBookingCart(ctx context.Context, conn *database.Conn, f *bookingForm, ca &touristTax, &total, &downPayment, + &cart.DownPaymentPercent, ); err != nil { if database.ErrorIsNotFound(err) { return cart, nil diff --git a/po/ca.po b/po/ca.po index 59dff74..0053e78 100644 --- a/po/ca.po +++ b/po/ca.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: camper\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n" -"POT-Creation-Date: 2024-02-14 04:43+0100\n" +"POT-Creation-Date: 2024-02-15 15:41+0100\n" "PO-Revision-Date: 2024-02-06 10:04+0100\n" "Last-Translator: jordi fita mas \n" "Language-Team: Catalan \n" @@ -256,7 +256,7 @@ msgid "Discover" msgstr "Descobreix" #: web/templates/public/campsite/type.gohtml:49 -#: web/templates/public/booking/fields.gohtml:256 +#: web/templates/public/booking/fields.gohtml:266 msgctxt "action" msgid "Book" msgstr "Reserva" @@ -776,6 +776,18 @@ msgctxt "cart" msgid "Down payment" msgstr "A compte" +#: web/templates/public/booking/fields.gohtml:258 +msgid "By down paying the %d %% of the total, you are pre-booking your preferences. We will respond within 24 hours and this percentage will be charged if accepted." +msgstr "En tramitar el %d %% del total esteu realitzant la prereserva de les vostres preferències. Us respondrem en un termini de 24 hores i us cobrarem aquest percentatge en cas que sigui acceptada." + +#: web/templates/public/booking/fields.gohtml:260 +msgid "By paying the total you are pre-booking your preferences. We will respond within 24 hours and this amount will be charged if accepted." +msgstr "En tramitar el pagament del total esteu realitzant la prereserva de les vostres preferències. Us respondrem en un termini de 24 hores i us cobrarem aquesta quantitat en cas que sigui acceptada." + +#: web/templates/public/booking/fields.gohtml:264 +msgid "See <%s>our conditions for more information." +msgstr "Consulteu <%s>les nostres condicions per a més informació." + #: web/templates/admin/payment/settings.gohtml:6 #: web/templates/admin/payment/index.gohtml:14 msgctxt "title" @@ -891,7 +903,7 @@ msgctxt "cart" msgid "Nights" msgstr "Nits" -#: web/templates/admin/payment/details.gohtml:80 pkg/booking/cart.go:188 +#: web/templates/admin/payment/details.gohtml:80 pkg/booking/cart.go:191 msgctxt "cart" msgid "Tourist tax" msgstr "Impost turístic" @@ -2702,27 +2714,27 @@ msgstr "No podeu deixar el fitxer del mèdia en blanc." msgid "Filename can not be empty." msgstr "No podeu deixar el nom del fitxer en blanc." -#: pkg/booking/cart.go:150 +#: pkg/booking/cart.go:153 msgctxt "cart" msgid "Night" msgstr "Nit" -#: pkg/booking/cart.go:151 +#: pkg/booking/cart.go:154 msgctxt "cart" msgid "Adult" msgstr "Adult" -#: pkg/booking/cart.go:152 +#: pkg/booking/cart.go:155 msgctxt "cart" msgid "Teenager" msgstr "Adolescent" -#: pkg/booking/cart.go:153 +#: pkg/booking/cart.go:156 msgctxt "cart" msgid "Child" msgstr "Nen" -#: pkg/booking/cart.go:154 +#: pkg/booking/cart.go:157 msgctxt "cart" msgid "Dog" msgstr "Gos" diff --git a/po/es.po b/po/es.po index d6c3575..0bc5fec 100644 --- a/po/es.po +++ b/po/es.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: camper\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n" -"POT-Creation-Date: 2024-02-14 04:47+0100\n" +"POT-Creation-Date: 2024-02-15 15:41+0100\n" "PO-Revision-Date: 2024-02-06 10:04+0100\n" "Last-Translator: jordi fita mas \n" "Language-Team: Spanish \n" @@ -256,7 +256,7 @@ msgid "Discover" msgstr "Descubre" #: web/templates/public/campsite/type.gohtml:49 -#: web/templates/public/booking/fields.gohtml:256 +#: web/templates/public/booking/fields.gohtml:266 msgctxt "action" msgid "Book" msgstr "Reservar" @@ -776,6 +776,18 @@ msgctxt "cart" msgid "Down payment" msgstr "A cuenta" +#: web/templates/public/booking/fields.gohtml:258 +msgid "By down paying the %d %% of the total, you are pre-booking your preferences. We will respond within 24 hours and this percentage will be charged if accepted." +msgstr "En tramitar el %d %% del total estáis realizando la prerreserva de vuestras preferencias. Os responderemos en un término de 24 horas y os cobraremos este porcentaje en caso que sea aceptada." + +#: web/templates/public/booking/fields.gohtml:260 +msgid "By paying the total you are pre-booking your preferences. We will respond within 24 hours and this amount will be charged if accepted." +msgstr "En tramitar el pago del total estáis realizando la prerreserva de vuestras preferencias. Os responderemos en un término de 24 horas y os cobraremos esta cantidad en caso que sea aceptada." + +#: web/templates/public/booking/fields.gohtml:264 +msgid "See <%s>our conditions for more information." +msgstr "Consultad <%s>nuestras condiciones para más información." + #: web/templates/admin/payment/settings.gohtml:6 #: web/templates/admin/payment/index.gohtml:14 msgctxt "title" @@ -893,7 +905,7 @@ msgctxt "cart" msgid "Nights" msgstr "Noches" -#: web/templates/admin/payment/details.gohtml:80 pkg/booking/cart.go:188 +#: web/templates/admin/payment/details.gohtml:80 pkg/booking/cart.go:191 msgctxt "cart" msgid "Tourist tax" msgstr "Impuesto turístico" @@ -2704,27 +2716,27 @@ msgstr "No podéis dejar el archivo del medio en blanco." msgid "Filename can not be empty." msgstr "No podéis dejar el nombre del archivo en blanco." -#: pkg/booking/cart.go:150 +#: pkg/booking/cart.go:153 msgctxt "cart" msgid "Night" msgstr "Noche" -#: pkg/booking/cart.go:151 +#: pkg/booking/cart.go:154 msgctxt "cart" msgid "Adult" msgstr "Adulto" -#: pkg/booking/cart.go:152 +#: pkg/booking/cart.go:155 msgctxt "cart" msgid "Teenager" msgstr "Adolescente" -#: pkg/booking/cart.go:153 +#: pkg/booking/cart.go:156 msgctxt "cart" msgid "Child" msgstr "Niño" -#: pkg/booking/cart.go:154 +#: pkg/booking/cart.go:157 msgctxt "cart" msgid "Dog" msgstr "Perro" diff --git a/po/fr.po b/po/fr.po index caae0a6..03936c9 100644 --- a/po/fr.po +++ b/po/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: camper\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n" -"POT-Creation-Date: 2024-02-14 04:47+0100\n" +"POT-Creation-Date: 2024-02-15 15:48+0100\n" "PO-Revision-Date: 2024-02-06 10:05+0100\n" "Last-Translator: Oriol Carbonell \n" "Language-Team: French \n" @@ -256,7 +256,7 @@ msgid "Discover" msgstr "Découvrir" #: web/templates/public/campsite/type.gohtml:49 -#: web/templates/public/booking/fields.gohtml:256 +#: web/templates/public/booking/fields.gohtml:266 msgctxt "action" msgid "Book" msgstr "Réserver" @@ -776,6 +776,18 @@ msgctxt "cart" msgid "Down payment" msgstr "Acompte" +#: web/templates/public/booking/fields.gohtml:258 +msgid "By down paying the %d %% of the total, you are pre-booking your preferences. We will respond within 24 hours and this percentage will be charged if accepted." +msgstr "En En effectuant le paiement de %d %% du total vous pré-réservez vos préférences. Nous vous répondrons dans les 24 heures et ce pourcentage sera facturé en cas d’acceptation." + +#: web/templates/public/booking/fields.gohtml:260 +msgid "By paying the total you are pre-booking your preferences. We will respond within 24 hours and this amount will be charged if accepted." +msgstr "En procédant au paiement du montant total vous pré-réservez vos préférences. Nous vous répondrons dans les 24 heures et ce montant sera facturé en cas d’acceptation." + +#: web/templates/public/booking/fields.gohtml:264 +msgid "See <%s>our conditions for more information." +msgstr "Consultez <%s>nos conditions pour plus d’informations." + #: web/templates/admin/payment/settings.gohtml:6 #: web/templates/admin/payment/index.gohtml:14 msgctxt "title" @@ -893,7 +905,7 @@ msgctxt "cart" msgid "Nights" msgstr "Nuits" -#: web/templates/admin/payment/details.gohtml:80 pkg/booking/cart.go:188 +#: web/templates/admin/payment/details.gohtml:80 pkg/booking/cart.go:191 msgctxt "cart" msgid "Tourist tax" msgstr "Taxe touristique" @@ -2704,27 +2716,27 @@ msgstr "Le fichier téléchargé ne peut pas être vide." msgid "Filename can not be empty." msgstr "Le nom de fichier ne peut pas être vide." -#: pkg/booking/cart.go:150 +#: pkg/booking/cart.go:153 msgctxt "cart" msgid "Night" msgstr "Nuit" -#: pkg/booking/cart.go:151 +#: pkg/booking/cart.go:154 msgctxt "cart" msgid "Adult" msgstr "Adulte" -#: pkg/booking/cart.go:152 +#: pkg/booking/cart.go:155 msgctxt "cart" msgid "Teenager" msgstr "Adolescent" -#: pkg/booking/cart.go:153 +#: pkg/booking/cart.go:156 msgctxt "cart" msgid "Child" msgstr "Enfant" -#: pkg/booking/cart.go:154 +#: pkg/booking/cart.go:157 msgctxt "cart" msgid "Dog" msgstr "Chien" diff --git a/web/static/public.css b/web/static/public.css index 5ef9d55..573311a 100644 --- a/web/static/public.css +++ b/web/static/public.css @@ -1463,6 +1463,10 @@ input[type="checkbox"]:focus { text-decoration: var(--accent) wavy underline; } +#booking footer p + p { + margin: .75em 0; +} + /**/ #booking .cart { diff --git a/web/templates/public/booking/fields.gohtml b/web/templates/public/booking/fields.gohtml index 575dcd2..c4ed5e3 100644 --- a/web/templates/public/booking/fields.gohtml +++ b/web/templates/public/booking/fields.gohtml @@ -253,6 +253,16 @@ Maestro +

+ {{- if lt .DownPaymentPercent 100 -}} + {{ printf (gettext "By down paying the %d %% of the total, you are pre-booking your preferences. We will respond within 24 hours and this percentage will be charged if accepted.") .DownPaymentPercent }} + {{- else -}} + {{( gettext "By paying the total you are pre-booking your preferences. We will respond within 24 hours and this amount will be charged if accepted." )}} + {{- end -}} +

+

+ {{ ( printf ( gettext "See <%s>our conditions for more information.") (printf "a target=\"_blank\" href=\"/%s/%s\"" currentLocale "legal/reservation") "a") | raw }} +