a full workflow using htmx is finished.
Still needs lots of polish, but it works now.
This commit is contained in:
parent
ba1fdd967e
commit
d653ccdf9f
4 changed files with 506 additions and 460 deletions
|
@ -381,6 +381,58 @@ with the image attached"
|
|||
(:th (car row))
|
||||
(:td (cdr row))))))))))))
|
||||
|
||||
(tbnl:define-easy-handler (respond :uri "/health-form") ()
|
||||
(setf (tbnl:header-out :access-control-expose-headers) "*")
|
||||
(let* ((data (tbnl:post-parameters* tbnl:*request*))
|
||||
(registration (cdr (assoc "registration" data :test 'string=)))
|
||||
(image (cdr (assoc "image" data :test 'string=)))
|
||||
(first-name (cdr (assoc "firstname" data :test 'string=)))
|
||||
(last-name (cdr (assoc "lastname" data :test 'string=)))
|
||||
(image (cdr (assoc "image" data :test 'string=)))
|
||||
(attachment nil))
|
||||
(loop :for d :in data
|
||||
:do (progn
|
||||
(uiop:println d)
|
||||
(if (string= "firstname" (car d))
|
||||
(progn
|
||||
(uiop:println (cdr d))
|
||||
(setf first-name (cdr d))))
|
||||
(if (string= "lastname" (car d))
|
||||
(progn
|
||||
(uiop:println (cdr d))
|
||||
(setf last-name (cdr d))))
|
||||
(if (string= "image" (car d))
|
||||
(let ((path (path-join
|
||||
hunchentoot:*tmp-directory*
|
||||
(format nil "~a_~a.~a" first-name last-name
|
||||
(cadr (uiop:split-string
|
||||
(car (last d 2)) :separator "."))))))
|
||||
(uiop:copy-file
|
||||
(cadr d)
|
||||
(path-join
|
||||
hunchentoot:*tmp-directory*
|
||||
(format nil "~a_~a.~a" first-name last-name
|
||||
(cadr (uiop:split-string
|
||||
(car (last d 2)) :separator ".")))))
|
||||
(setf attachment path)
|
||||
(uiop:println attachment)))))
|
||||
(uiop:println data)
|
||||
(mail-health-form data attachment)
|
||||
(cond ((string= registration "now")
|
||||
(setf (hunchentoot:header-out :HX-Redirect) "https://secure.myvanco.com/L-Z772/campaign/C-13JPJ"))
|
||||
((string= registration "full")
|
||||
(setf (tbnl:header-out :HX-Redirect) "https://secure.myvanco.com/L-Z772/campaign/C-13JQE"))
|
||||
((string= registration "later")
|
||||
(with-html-string
|
||||
(:div
|
||||
:class "mt-8"
|
||||
(:h2 (format nil
|
||||
"Thank You ~A!"
|
||||
(concat
|
||||
first-name " " last-name)))
|
||||
(:p :class "text-md"
|
||||
"If you'd like to pay for your registration go to the donate tab in the top right when you are ready and find the camp registration option.")))))))
|
||||
|
||||
(hunchentoot:define-easy-handler (respond :uri "/camp-api") ()
|
||||
(let* ((request-type (hunchentoot:request-method hunchentoot:*request*))
|
||||
(data (hunchentoot:post-parameters* hunchentoot:*request*))
|
||||
|
@ -403,14 +455,17 @@ with the image attached"
|
|||
((string= registration "later")
|
||||
(let ((first-name (cdr (assoc "firstname" data :test 'string=)))
|
||||
(last-name (cdr (assoc "lastname" data :test 'string=))))
|
||||
(mail-camp-form data nil)
|
||||
(with-html-string
|
||||
(:div
|
||||
:class "mt-8"
|
||||
(:p :class "text-lg"
|
||||
(format nil
|
||||
"Thank You ~A, can't wait to see you at camp!!"
|
||||
(concat
|
||||
first-name " " last-name)))))))))
|
||||
(:h2 (format nil
|
||||
"Thank You ~A!"
|
||||
(concat
|
||||
first-name " " last-name)))
|
||||
(:p "Can't wait to see you at camp!!")
|
||||
(:p :class "text-md"
|
||||
"If you'd like to pay for your registration go to the donate tab in the top right when you are ready and find the camp registration option.")))))))
|
||||
(progn
|
||||
(uiop:println "Health now")
|
||||
(setf (tbnl:header-out :HX-Redirect) (format nil "/camp-health-form?registration=~A" registration))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue