mirror of
https://github.com/mruwnik/chicken-master.git
synced 2025-06-08 21:34:43 +02:00
scrollable calendar
This commit is contained in:
parent
5870093a4c
commit
01da5c90f4
@ -5,6 +5,11 @@
|
|||||||
[:html {:height "100%"}
|
[:html {:height "100%"}
|
||||||
[:body {:height "100%"}
|
[:body {:height "100%"}
|
||||||
[:.full-height {:height "100%"}]
|
[:.full-height {:height "100%"}]
|
||||||
|
|
||||||
|
[:.scroll-bar {:position :absolute
|
||||||
|
:right "10px"
|
||||||
|
:width "50px"}]
|
||||||
|
|
||||||
[:.popup {:position :fixed
|
[:.popup {:position :fixed
|
||||||
:height "100%"
|
:height "100%"
|
||||||
:width "100%"
|
:width "100%"
|
||||||
@ -59,4 +64,11 @@
|
|||||||
:max-height "5px"}]]
|
: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])} "✓"]
|
:waiting [:button {:on-click #(re-frame/dispatch [::event/fulfill-order id])} "✓"]
|
||||||
:fulfilled [:button {:on-click #(re-frame/dispatch [::event/reset-order id])} "X"]
|
:fulfilled [:button {:on-click #(re-frame/dispatch [::event/reset-order id])} "X"]
|
||||||
:pending nil
|
: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/edit-order day id])} "E"]
|
||||||
[:button {:on-click #(re-frame/dispatch [::event/remove-order id])} "-"]]
|
[:button {:on-click #(re-frame/dispatch [::event/remove-order id])} "-"]]
|
||||||
[:div {:class :who} who]
|
[:div {:class :who} who]
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-fx
|
||||||
::save-order
|
::save-order
|
||||||
(fn [{{order :order-edit} :db} _]
|
(fn [{{order :order-edit} :db} _]
|
||||||
|
(println "saving")
|
||||||
{:fx [[:dispatch [::hide-modal]]]
|
{:fx [[:dispatch [::hide-modal]]]
|
||||||
:http {:method :post
|
:http {:method :post
|
||||||
:url "save-order"
|
:url "save-order"
|
||||||
@ -109,6 +110,11 @@
|
|||||||
{:from (->> missing-days (sort time/before?) first time/iso-date)
|
{:from (->> missing-days (sort time/before?) first time/iso-date)
|
||||||
:to (->> missing-days (sort time/before?) last 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
|
(re-frame/reg-event-fx
|
||||||
::show-from-date
|
::show-from-date
|
||||||
(fn [{db :db} [_ day]]
|
(fn [{db :db} [_ day]]
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
(assoc m k (->> v
|
(assoc m k (->> v
|
||||||
(map :amount)
|
(map :amount)
|
||||||
(reduce +)))) {})))
|
(reduce +)))) {})))
|
||||||
(select-keys [:id :who :day :hour :products])))
|
(select-keys [:id :who :day :hour :products :state])))
|
||||||
|
|
||||||
;;;;;;;; Backend mocks
|
;;;;;;;; Backend mocks
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
[:option {:key (gensym) :value product} (name product)])]]
|
[:option {:key (gensym) :value product} (name product)])]]
|
||||||
(html/input :amount "ile"
|
(html/input :amount "ile"
|
||||||
{:type :number :default amount :min 0
|
{:type :number :default amount :min 0
|
||||||
;; :on-blur #(re-frame/dispatch [::event/changed-amount (-> % .-target .-value) product-no])
|
: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-change #(re-frame/dispatch [::event/changed-amount (-> % .-target .-value) product-no])
|
||||||
})])
|
})])
|
||||||
|
|
||||||
(defn format-product [[product amount]]
|
(defn format-product [[product amount]]
|
||||||
|
@ -3,12 +3,15 @@
|
|||||||
[re-frame.core :as re-frame]
|
[re-frame.core :as re-frame]
|
||||||
[chicken-master.subs :as subs]
|
[chicken-master.subs :as subs]
|
||||||
[chicken-master.calendar :as cal]
|
[chicken-master.calendar :as cal]
|
||||||
[chicken-master.time :as time]))
|
[chicken-master.events :as event]))
|
||||||
|
|
||||||
|
|
||||||
(defn main-panel []
|
(defn main-panel []
|
||||||
(let [name (re-frame/subscribe [::subs/name])]
|
(let [name (re-frame/subscribe [::subs/name])]
|
||||||
[:div {:class :full-height}
|
[: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])
|
(when @(re-frame/subscribe [::subs/show-edit-modal])
|
||||||
(cal/edit-order))
|
(cal/edit-order))
|
||||||
(cal/calendar @(re-frame/subscribe [::subs/current-days]))
|
(cal/calendar @(re-frame/subscribe [::subs/current-days]))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user