At most one result should exist for each loan stored but not redeclaring
the 'estimate' variable within the seed loop caused the loan entries of
the first estimate to be copied onto the second, which caused an error
while seeding result entries.
Summary component was moved to master.tpl because sub-template calls
allow only one argument to be passed. Passing info for both Estimate and
Loan structs dynamically would involve looping during template
execution, or calling a custom function to restructure the estimate,
which are all too complicated.
the htmltopdf.js library renders all PDF text as images instead of
vectors, and Go does not have a reliable native library for generating
PDFs that is actively maintained. The best solution appears to be to
make a system call to wkhtmltopdf, but now there is a hidden package
dependency that is not checked at build time and exists in another
process. Maybe in the future a C library can be used and linked with the
Go binary.
Update the database tables for user and branch to give more information
required for PDF generation. Also set up a test component to preview
change to the view during development. It will be reconfigured once the
genrated PDF is satisfactory.
Since request.Body can only be read once, calling patchUser from
patchSelf always returned an error. request.Body needed to be either be
saved in a variable and reset or have a new function created.
Uses gift package for server side resizing of selected letterhead
file. It should fit an image file with aspect ratio of 2:1 and be a
reasonable size. A 400x200 resizeToFit is used for now.
gift just uses the native image/draw package internally.
https://pkg.go.dev/image/draw