summaryrefslogtreecommitdiff
path: root/lisp/webapps/resume/clojurescript
diff options
context:
space:
mode:
authorckonstanski <kostcarl@isu.edu>2026-07-20 21:09:54 -0600
committerckonstanski <kostcarl@isu.edu>2026-07-20 21:09:54 -0600
commit8ab94f4677f8d56655a45bb636917429dcddda24 (patch)
treeb8481a5b04eca19fca1056340e35f1d6665a4fbd /lisp/webapps/resume/clojurescript
parent9486b95432298bc89f6d7e4639721fb4e49879e0 (diff)
got contact info working
Diffstat (limited to 'lisp/webapps/resume/clojurescript')
-rw-r--r--lisp/webapps/resume/clojurescript/resume/src/core.cljs209
1 files changed, 208 insertions, 1 deletions
diff --git a/lisp/webapps/resume/clojurescript/resume/src/core.cljs b/lisp/webapps/resume/clojurescript/resume/src/core.cljs
index 34108b7..cde1a89 100644
--- a/lisp/webapps/resume/clojurescript/resume/src/core.cljs
+++ b/lisp/webapps/resume/clojurescript/resume/src/core.cljs
@@ -149,6 +149,29 @@
(declare on-resumes-delete-clicked)
(declare handler-resumes-delete)
(declare render-resumes-delete)
+(declare template-contactinfo)
+(declare handler-contactinfo)
+(declare render-contactinfo)
+(declare template-contactinfo-view)
+(declare handler-contactinfo-view)
+(declare render-contactinfo-view)
+(declare on-contactinfo-add-clicked)
+(declare template-contactinfo-add)
+(declare handler-contactinfo-add)
+(declare render-contactinfo-add)
+(declare on-contactinfo-add-submit-clicked)
+(declare handler-contactinfo-add-submit)
+(declare render-contactinfo-add-submit)
+(declare on-contactinfo-modify-clicked)
+(declare template-contactinfo-modify)
+(declare handler-contactinfo-modify)
+(declare render-contactinfo-modify)
+(declare on-contactinfo-modify-submit-clicked)
+(declare handler-contactinfo-modify-submit)
+(declare render-contactinfo-modify-submit)
+(declare on-contactinfo-delete-clicked)
+(declare handler-contactinfo-delete)
+(declare render-contactinfo-delete)
(declare on-menu-clicked)
(declare handler-location)
(declare goto-location)
@@ -1190,6 +1213,189 @@
{:format :raw
:handler handler-resumes-delete}))
+;; contactinfo
+
+(hiccups/defhtml template-contactinfo [jsonobj]
+ [:h3 {:style "text-align: center"} (get jsonobj "title")]
+ [:div {:id "content"}]
+ [:div {:id "modify"
+ :class "modal fade"
+ :role "dialog"
+ :tabindex "-1"}
+ [:div {:class "modal-dialog modal-lg"}
+ [:div {:class "modal-content"}
+ [:div {:class "modal-header"}
+ [:h5 [:span {:id "modify-title"}]]
+ [:button {:type "button"
+ :class "close"
+ :data-dismiss "modal"}
+ "&times;"]]
+ [:div {:id "modify-body"
+ :class "modal-body"
+ :style "height: 450px;"}]
+ [:div {:class "modal-footer"}
+ [:button {:type "submit"
+ :class "btn btn-danger btn-default"
+ :data-dismiss "modal"}
+ [:span {:class "glyphicon glyphicon-remove"}]
+ "Cancel"]]]]])
+
+(defn handler-contactinfo [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (notifications jsonobj)
+ (dommy/set-html! (dommy/sel1 :#body) (template-contactinfo jsonobj))
+ (render-contactinfo-view)))
+
+(defn render-contactinfo []
+ (GET "/resumes/contactinfo" {:handler handler-contactinfo}))
+
+;; contactinfo-view
+
+(hiccups/defhtml template-contactinfo-view [jsonobj]
+ [:div {:style "text-align: right"}
+ [:img {:src "/static/images/add.png"
+ :style "cursor:pointer; cursor:hand"
+ :onclick (str (namespace ::x) ".on_contactinfo_add_clicked()")}]]
+ [:table {:class "table table-striped table-hover table-sm"}
+ [:thead
+ [:tr
+ [:th {:scope "col"} "Address"]
+ [:th {:scope "col"} "City"]
+ [:th {:scope "col"} "State"]
+ [:th {:scope "col"} "Phone"]
+ [:th {:scope "col"} "Email"]
+ [:th {:scope "col"} "VISA Status"]
+ [:th {:scope "col"} "Mod"]
+ [:th {:scope "col"} "Del"]]]
+ [:tbody
+ (for [contactinfo (get jsonobj "contactinfos")]
+ [:tr
+ [:td (get contactinfo "address")]
+ [:td (get contactinfo "city")]
+ [:td (get contactinfo "state_abbr")]
+ [:td (get contactinfo "phone")]
+ [:td (get contactinfo "email")]
+ [:td (get contactinfo "visastatus")]
+ [:td {:width "30"}
+ [:img {:src "/static/images/modify.png"
+ :onclick (str (namespace ::x) ".on_contactinfo_modify_clicked(" (get contactinfo "id") ")")}]]
+ [:td {:width "30"}
+ [:img {:src "/static/images/delete.png"
+ :onclick (str (namespace ::x) ".on_contactinfo_delete_clicked(" (get contactinfo "id") ", '" (str (get contactinfo "address") ", " (get contactinfo "city") " " (get contactinfo "state_abbr")) "')")}]]])]])
+
+(defn handler-contactinfo-view [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (dommy/set-html! (dommy/sel1 :#content) (template-contactinfo-view jsonobj))))
+
+(defn render-contactinfo-view []
+ (GET "/resumes/contactinfo/view" {:handler handler-contactinfo-view}))
+
+;; contactinfo-add
+
+(defn on-contactinfo-add-clicked []
+ (render-contactinfo-add))
+
+(hiccups/defhtml template-contactinfo-add [jsonobj]
+ (ck-form/template-generic-form (get jsonobj "form") (namespace ::x)))
+
+(defn handler-contactinfo-add [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (auth-notifications jsonobj)
+ (dommy/set-html! (dommy/sel1 :#modify-title) (get jsonobj "title"))
+ (dommy/set-html! (dommy/sel1 :#modify-body) (template-contactinfo-add jsonobj))
+ (.modal (jquery "#modify"))))
+
+(defn render-contactinfo-add []
+ (POST "/resumes/contactinfo/add" {:handler handler-contactinfo-add}))
+
+;; contactinfo-add-submit
+
+(defn on-contactinfo-add-submit-clicked []
+ (when (-> (jquery "#contactinfo-add-form")
+ (.get "0")
+ (.checkValidity))
+ (.modal (jquery "#modify") "hide")
+ (render-contactinfo-add-submit)))
+
+(defn handler-contactinfo-add-submit [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (auth-notifications jsonobj)
+ (on-menu-clicked "/resumes/contactinfo")))
+
+(defn render-contactinfo-add-submit []
+ (POST "/resumes/contactinfo/add/submit"
+ {:format :raw
+ :params {:address (dommy/value (dommy/sel1 :#address))
+ :city (dommy/value (dommy/sel1 :#city))
+ :state_id (dommy/value (dommy/sel1 :#state_id))
+ :phone (dommy/value (dommy/sel1 :#phone))
+ :email (dommy/value (dommy/sel1 :#email))
+ :visastatus_id (dommy/value (dommy/sel1 :#visastatus_id))}
+ :handler handler-contactinfo-add-submit}))
+
+;; contactinfo-modify
+
+(defn on-contactinfo-modify-clicked [id]
+ (render-contactinfo-modify id))
+
+(hiccups/defhtml template-contactinfo-modify [jsonobj]
+ (ck-form/template-generic-form (get jsonobj "form") (namespace ::x)))
+
+(defn handler-contactinfo-modify [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (auth-notifications jsonobj)
+ (dommy/set-html! (dommy/sel1 :#modify-title) (get jsonobj "title"))
+ (dommy/set-html! (dommy/sel1 :#modify-body) (template-contactinfo-modify jsonobj))
+ (.modal (jquery "#modify"))))
+
+(defn render-contactinfo-modify [id]
+ (POST "/resumes/contactinfo/modify"
+ {:format :raw
+ :params {:id id}
+ :handler handler-contactinfo-modify}))
+
+;; contactinfo-modify-submit
+
+(defn on-contactinfo-modify-submit-clicked []
+ (when (-> (jquery "#contactinfo-modify-form")
+ (.get "0")
+ (.checkValidity))
+ (.modal (jquery "#modify") "hide")
+ (render-contactinfo-modify-submit)))
+
+(defn handler-contactinfo-modify-submit [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (auth-notifications jsonobj)
+ (on-menu-clicked "/resumes/contactinfo")))
+
+(defn render-contactinfo-modify-submit []
+ (POST "/resumes/contactinfo/modify/submit"
+ {:format :raw
+ :params {:id (dommy/value (dommy/sel1 :#id))
+ :address (dommy/value (dommy/sel1 :#address))
+ :city (dommy/value (dommy/sel1 :#city))
+ :state_id (dommy/value (dommy/sel1 :#state_id))
+ :phone (dommy/value (dommy/sel1 :#phone))
+ :email (dommy/value (dommy/sel1 :#email))
+ :visastatus_id (dommy/value (dommy/sel1 :#visastatus_id))}
+ :handler handler-contactinfo-modify-submit}))
+
+;; contactinfo-delete
+
+(defn on-contactinfo-delete-clicked [id name]
+ (when (js/confirm (str "Are you sure you want to delete " name "? This action cannot be undone."))
+ (render-contactinfo-delete id)))
+
+(defn handler-contactinfo-delete [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (auth-notifications jsonobj)
+ (on-menu-clicked "/resumes/contactinfo")))
+
+(defn render-contactinfo-delete [id]
+ (DELETE (str "/resumes/contactinfo/delete/" id)
+ {:format :raw
+ :handler handler-contactinfo-delete}))
+
;; location
(defn on-menu-clicked [handler]
@@ -1203,7 +1409,8 @@
(= handler "/contact-us") (render-contact-us)
(= handler "/messages") (render-messages)
(= handler "/users") (render-users)
- (= handler "/resumes") (render-resumes)))
+ (= handler "/resumes") (render-resumes)
+ (= handler "/resumes/contactinfo") (render-contactinfo)))
(defn handler-location [response]
(let [jsonobj (js->clj (js/JSON.parse response))]