mirror of
https://github.com/mruwnik/chicken-master.git
synced 2025-06-08 13:24:42 +02:00
scrollable calendar
This commit is contained in:
parent
5870093a4c
commit
01da5c90f4
@ -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}]
|
||||
)
|
||||
|
@ -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]
|
||||
|
@ -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]]
|
||||
|
@ -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
|
||||
|
||||
|
@ -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]]
|
||||
|
@ -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]))
|
||||
|
Loading…
x
Reference in New Issue
Block a user