diff --git a/html/template/sync/mailer-2.html b/html/template/sync/mailer-2.html new file mode 100644 index 00000000..0dafb467 --- /dev/null +++ b/html/template/sync/mailer-2.html @@ -0,0 +1,406 @@ +{{ template "sync/layout/base.html" . }} + +{{ define "title" }}Mailer{{ end }} +{{ define "extraheader" }} + +{{ end }} +{{ define "content" }} + + +
+
+
+
+

+ Aerial review indicates possible standing water at this address. +

+

Upload a photo to confirm conditions and close this case.

+

Not your property? Please let us know.

+
+ Pool photo +
+
ID {{ .DocumentID }}
+
+ +
+

Dear Resident,

+

+ The {{ .Organization.Name }} is contacting you because recent aerial + imagery indicates that your swimming pool may be holding standing water. + When water sits without circulation or treatment, mosquitoes can develop + quickly and affect the surrounding neighborhood. +

+
+ Action requested + Please scan the QR code on this letter and upload a current photo of + your pool. The image should clearly show the deep end and overall water + condition. We request a photo whether the water appears clear, cloudy, + or green so we can accurately assess the situation and close the matter + if no issue exists. +
+

+ If your pool has started to look more like a pond than a pool, that is + more common than most people realize. Standing water creates ideal + conditions for mosquito production. If treatment is needed, we can + coordinate access while longer-term maintenance or repairs are + addressed. +

+

+ Our objective is to prevent mosquito production and protect your + neighborhood. A quick photo response through the QR code is the fastest + way to resolve this. +

+

+ If you are unable to use the QR code, please visit + {{ .ReportURL }} or contact our office + for assistance. +

+
+ Sincerely,
+ {{ .Organization.Name }}
+ {{ .Organization.OfficeAddressStreet.GetOr "" }} - + {{ .Organization.OfficeAddressCity.GetOr "" }}, + {{ .Organization.OfficeAddressState.GetOr "" }} + {{ .Organization.OfficeAddressPostalCode.GetOr "" }}
+ Phone: + {{ .Organization.OfficePhone.GetOr "" }} +
+ District logo +
+ +
+
Scan. Snap. Done.
+ QR code +
+ Takes less than 60 seconds. +
    +
  1. Scan the QR code
  2. +
  3. Upload one pool
    photo
  4. +
  5. Case closed if clear
  6. +
+ If treatment is needed, we
coordinate next steps. +
+
Clear photo tips
+ +
Clear photos allow faster
review.
+
+
+ + +
+
+
+
+

+ La revisión aérea indica posible agua estancada en esta dirección. +

+

+ Suba una foto para confirmar las condiciones y cerrar este caso. +

+

¿No es su propiedad? Por favor infórmenos.

+
+ Foto de la piscina +
+
ID {{ .DocumentID }}
+
+ +
+

Estimado Residente,

+

+ El Distrito de Control de Mosquitos y Vectores del Delta se comunica con + usted porque imágenes aéreas recientes indican que su piscina puede + estar reteniendo agua estancada. Cuando el agua permanece sin + circulación o tratamiento, los mosquitos pueden desarrollarse + rápidamente y afectar al vecindario. +

+
+ Acción requerida + Por favor escanee el código QR en esta carta y suba una foto actual de + su piscina. La imagen debe mostrar claramente la parte profunda y la + condición general del agua. Solicitamos una foto ya sea que el agua esté + clara, turbia o verde para poder evaluar la situación y cerrar el caso + si no existe ningún problema. +
+

+ Si su piscina ha comenzado a parecer más un estanque que una piscina, es + más común de lo que muchos creen. El agua estancada crea condiciones + ideales para la producción de mosquitos. Si se necesita tratamiento, + podemos coordinar el acceso mientras se realizan reparaciones o + mantenimiento a largo plazo. +

+ Nuestro objetivo es prevenir la producción de mosquitos y proteger su + vecindario. Una respuesta rápida con una foto a través del código QR es + la manera más rápida de resolver esto. +

+ Si no puede usar el código QR, visite + {{ .ReportURL }} o comuníquese con + nuestra oficina para recibir ayuda. +

+
+ Atentamente,
+ {{ .Organization.Name }}
+ {{ .Organization.OfficeAddressStreet.GetOr "" }} - + {{ .Organization.OfficeAddressCity.GetOr "" }}, + {{ .Organization.OfficeAddressState.GetOr "" }} + {{ .Organization.OfficeAddressPostalCode.GetOr "" }}
+ Teléfono: + {{ .Organization.OfficePhone.GetOr "" }} +
+ Logotipo del distrito +
+ +
+
Escanee. Tome foto. Listo.
+ Código QR +
+ Toma menos de 60 segundos. +
    +
  1. Escanee el código QR
  2. +
  3. Suba una foto de la
    piscina
  4. +
  5. Caso cerrado si está claro
  6. +
+ Si se necesita tratamiento,
coordinamos los siguientes pasos. +
+
Consejos para la foto
+ +
+ Fotos claras permiten una
revisión más rápida. +
+
+
+{{ end }} diff --git a/sync/mailer.go b/sync/mailer.go index 6786d3c1..121a5bc5 100644 --- a/sync/mailer.go +++ b/sync/mailer.go @@ -41,6 +41,17 @@ func getMailer1(w http.ResponseWriter, r *http.Request) { } } func getMailer2(w http.ResponseWriter, r *http.Request) { + path := "/mailer/mode-2/preview" + content, err := pdf.GeneratePDF(r.Context(), path) + if err != nil { + respondError(w, "generate pdf failure", err, http.StatusInternalServerError) + return + } + err = writePDF(w, content, "mailer-mode-2.pdf") + if err != nil { + respondError(w, "copy error", err, http.StatusInternalServerError) + return + } } func getMailer3(w http.ResponseWriter, r *http.Request) { code := chi.URLParam(r, "code") @@ -72,7 +83,23 @@ func getMailer1Preview(w http.ResponseWriter, r *http.Request) { html.RenderOrError(w, "sync/mailer-1.html", contentMailer{}) } func getMailer2Preview(w http.ResponseWriter, r *http.Request) { - html.RenderOrError(w, "sync/mailer-2.html", contentMailer{}) + ctx := r.Context() + org, err := models.FindOrganization(ctx, db.PGInstance.BobDB, 1) + //org, err := platform.OrganizationByID(ctx, 1) + if err != nil { + http.Error(w, "no comp", http.StatusInternalServerError) + return + } + + html.RenderOrError(w, "sync/mailer-2.html", contentMailer{ + Config: html.NewContentConfig(), + DocumentID: "abc-123", + LogoURL: config.MakeURLNidus("/api/district/delta-mvcd/logo"), + Organization: org, + PoolImageURL: config.MakeURLNidus("/mailer/pool/random"), + QRCodeURL: config.MakeURLNidus("/qr-code/marketing"), + ReportURL: "https://nidus.cloud", + }) } func getMailer3Preview(w http.ResponseWriter, r *http.Request) { code := chi.URLParam(r, "code") diff --git a/sync/qr.go b/sync/qr.go index 5d2807f8..a63a67b1 100644 --- a/sync/qr.go +++ b/sync/qr.go @@ -17,6 +17,10 @@ func getQRCodeMailer(w http.ResponseWriter, r *http.Request) { content := config.MakeURLReport("/mailer/%s", code) writeQRCode(w, r, content) } +func getQRCodeMarketing(w http.ResponseWriter, r *http.Request) { + content := "https://nidus.cloud" + writeQRCode(w, r, content) +} func getQRCodeReport(w http.ResponseWriter, r *http.Request) { code := chi.URLParam(r, "code") diff --git a/sync/routes.go b/sync/routes.go index 11bacbad..2c25bf57 100644 --- a/sync/routes.go +++ b/sync/routes.go @@ -14,7 +14,7 @@ func Router() chi.Router { r.Get("/arcgis/oauth/callback", getArcgisOauthCallback) r.Get("/mailer/pool/random", getMailerPoolRandom) r.Get("/mailer/mode-1", getMailer1) - r.Get("/mailer/mode-2/{code}", getMailer2) + r.Get("/mailer/mode-2", getMailer2) r.Get("/mailer/mode-3/{code}", getMailer3) r.Get("/mailer/mode-1/preview", getMailer1Preview) r.Get("/mailer/mode-2/preview", getMailer2Preview) @@ -33,6 +33,7 @@ func Router() chi.Router { // Utility endpoints r.Get("/privacy", getPrivacy) + r.Get("/qr-code/marketing", getQRCodeMarketing) r.Get("/qr-code/report/{code}", getQRCodeReport) r.Get("/qr-code/mailer/{code}", getQRCodeMailer) r.Get("/template-test", getTemplateTest) diff --git a/vite.config.ts b/vite.config.ts index a0966d8f..56390aac 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -69,6 +69,14 @@ export default defineConfig({ target: "http://127.0.0.1:9002", changeOrigin: false, }, + "/mailer": { + target: "http://127.0.0.1:9002", + changeOrigin: false, + }, + "/qr-code": { + target: "http://127.0.0.1:9002", + changeOrigin: false, + }, "/signin": { target: "http://localhost:9002", changeOrigin: false,