scrollable calendar

This commit is contained in:
Daniel O'Connell 2020-11-22 20:15:23 +01:00
parent 5870093a4c
commit 01da5c90f4
6 changed files with 26 additions and 5 deletions

View File

@ -5,6 +5,11 @@
[:html {:height "100%"}
[:body {:height "100%"}
[:.full-height {:height "100%"}]
[:.scroll-bar {:position :absolute
:right "10px"
:width "50px"}]
[:.popup {:position :fixed
:height "100%"
:width "100%"
@ -59,4 +64,11 @@
:max-height "5px"}]]
]]]]]]
; Chrome, Safari, Edge, Opera
["input::-webkit-outer-spin-button" {:-webkit-appearance :none :margin 0}]
["input::-webkit-inner-spin-button"{:-webkit-appearance :none :margin 0}]
; Firefox
["input[type=number]" {:-moz-appearance :textfield}]
)

View File

@ -35,7 +35,7 @@
:waiting [:button {:on-click #(re-frame/dispatch [::event/fulfill-order id])} "✓"]
:fulfilled [:button {:on-click #(re-frame/dispatch [::event/reset-order id])} "X"]
:pending nil
:default nil)
nil nil)
[:button {:on-click #(re-frame/dispatch [::event/edit-order day id])} "E"]
[:button {:on-click #(re-frame/dispatch [::event/remove-order id])} "-"]]
[:div {:class :who} who]

View File

@ -52,6 +52,7 @@
(re-frame/reg-event-fx
::save-order
(fn [{{order :order-edit} :db} _]
(println "saving")
{:fx [[:dispatch [::hide-modal]]]
:http {:method :post
:url "save-order"
@ -109,6 +110,11 @@
{:from (->> missing-days (sort time/before?) first time/iso-date)
:to (->> missing-days (sort time/before?) last time/iso-date)})))
(re-frame/reg-event-fx
::scroll-weeks
(fn [{db :db} [_ offset]]
{:fx [[:dispatch [::show-from-date (-> db :start-date time/parse-date (time/date-offset (* 7 offset)))]]]}))
(re-frame/reg-event-fx
::show-from-date
(fn [{db :db} [_ day]]

View File

@ -9,7 +9,7 @@
(assoc m k (->> v
(map :amount)
(reduce +)))) {})))
(select-keys [:id :who :day :hour :products])))
(select-keys [:id :who :day :hour :products :state])))
;;;;;;;; Backend mocks

View File

@ -16,8 +16,8 @@
[:option {:key (gensym) :value product} (name product)])]]
(html/input :amount "ile"
{:type :number :default amount :min 0
;; :on-blur #(re-frame/dispatch [::event/changed-amount (-> % .-target .-value) product-no])
:on-input #(re-frame/dispatch [::event/changed-amount (-> % .-target .-value) product-no])
:on-blur #(re-frame/dispatch [::event/changed-amount (-> % .-target .-value) product-no])
;; :on-change #(re-frame/dispatch [::event/changed-amount (-> % .-target .-value) product-no])
})])
(defn format-product [[product amount]]

View File

@ -3,12 +3,15 @@
[re-frame.core :as re-frame]
[chicken-master.subs :as subs]
[chicken-master.calendar :as cal]
[chicken-master.time :as time]))
[chicken-master.events :as event]))
(defn main-panel []
(let [name (re-frame/subscribe [::subs/name])]
[:div {:class :full-height}
[:div {:class :scroll-bar}
[:button {:on-click #(re-frame/dispatch [::event/scroll-weeks -2])} "^"]
[:button {:on-click #(re-frame/dispatch [::event/scroll-weeks 2])}"v"]]
(when @(re-frame/subscribe [::subs/show-edit-modal])
(cal/edit-order))
(cal/calendar @(re-frame/subscribe [::subs/current-days]))