balance sheet
This commit is contained in:
@@ -161,6 +161,23 @@ const getFourWeekPeriods = endDate => {
|
|||||||
return periods;
|
return periods;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const withLastYear = (date) => {
|
||||||
|
|
||||||
|
if (!date) {
|
||||||
|
date= new Date()
|
||||||
|
} else {
|
||||||
|
date = parseMMDDYYYY(date)
|
||||||
|
}
|
||||||
|
const originalYear = date.getFullYear();
|
||||||
|
const priorYear = originalYear - 1;
|
||||||
|
|
||||||
|
// Create new Date objects for both years
|
||||||
|
const originalDate = new Date(originalYear, date.getMonth(), date.getDate());
|
||||||
|
const priorYearDate = new Date(priorYear, date.getMonth(), date.getDate());
|
||||||
|
|
||||||
|
return [formatDateMMDDYYYY(originalDate), formatDateMMDDYYYY(priorYearDate)];
|
||||||
|
}
|
||||||
|
|
||||||
initMultiDatepicker = function(elem, startingValue) {
|
initMultiDatepicker = function(elem, startingValue) {
|
||||||
const modalParent = elem.closest('#modal-content');
|
const modalParent = elem.closest('#modal-content');
|
||||||
if (modalParent) {
|
if (modalParent) {
|
||||||
|
|||||||
@@ -116,10 +116,13 @@
|
|||||||
(str " bg-white dark:bg-gray-600 border-gray-300 dark:border-gray-700 text-gray-500 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-100 font-medium border border-gray-300 dark:border-gray-700")))
|
(str " bg-white dark:bg-gray-600 border-gray-300 dark:border-gray-700 text-gray-500 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-100 font-medium border border-gray-300 dark:border-gray-700")))
|
||||||
(assoc :tabindex 0)
|
(assoc :tabindex 0)
|
||||||
(assoc :href (:href params "#")))
|
(assoc :href (:href params "#")))
|
||||||
[:div.htmx-indicator.flex.items-center
|
(when (:indicator? params true)
|
||||||
(svg/spinner {:class "inline w-4 h-4 text-white"})
|
[:div.htmx-indicator.flex.items-center
|
||||||
[:div.ml-3 "Loading..."]]
|
(svg/spinner {:class "inline w-4 h-4 text-white"})
|
||||||
(into [:div.htmx-indicator-hidden.inline-flex.gap-2.items-center.justify-center] children)])
|
[:div.ml-3 "Loading..."]])
|
||||||
|
(into [:div.inline-flex.gap-2.items-center.justify-center {:class (when (:indicator? params true)
|
||||||
|
"htmx-indicator-hidden")}]
|
||||||
|
children)])
|
||||||
|
|
||||||
(defn icon-button- [params & children]
|
(defn icon-button- [params & children]
|
||||||
(into
|
(into
|
||||||
|
|||||||
@@ -369,7 +369,7 @@
|
|||||||
(assoc :value value)
|
(assoc :value value)
|
||||||
;; the data-date field has to be bound before the datepicker can be initialized
|
;; the data-date field has to be bound before the datepicker can be initialized
|
||||||
(assoc :x-init "$nextTick(() => { dp = initMultiDatepicker($el, value); ;}); ")
|
(assoc :x-init "$nextTick(() => { dp = initMultiDatepicker($el, value); ;}); ")
|
||||||
(assoc "x-effect" "setTimeout(()=> { if(dp) { dp.setDate(Array.from(value), {clear: true}); }}, 2000) ")
|
(assoc "x-effect" "if(dp) { dp.setDate(Array.from(value), {clear: true}); } ")
|
||||||
(assoc ":data-date" "Array.prototype.join.call(value, ', ')")
|
(assoc ":data-date" "Array.prototype.join.call(value, ', ')")
|
||||||
(assoc "@htmx:before-history-save" "destroyDatepicker(dp)" )
|
(assoc "@htmx:before-history-save" "destroyDatepicker(dp)" )
|
||||||
(assoc "@htmx:before-cleanup-element" "destroyDatepicker(dp)" )
|
(assoc "@htmx:before-cleanup-element" "destroyDatepicker(dp)" )
|
||||||
|
|||||||
@@ -295,7 +295,8 @@
|
|||||||
[:input {:type "hidden"
|
[:input {:type "hidden"
|
||||||
:name (fc/field-name)
|
:name (fc/field-name)
|
||||||
:x-model "v"}] ]
|
:x-model "v"}] ]
|
||||||
(com/a-button {"x-tooltip.on.click.theme.dropdown.placement.bottom.interactive" "{content: ()=> $refs.tooltip.innerHTML, allowHTML: true, appendTo: $root}"}
|
(com/a-button {"x-tooltip.on.click.theme.dropdown.placement.bottom.interactive" "{content: ()=> $refs.tooltip.innerHTML, allowHTML: true, appendTo: $root}"
|
||||||
|
:indicator? false}
|
||||||
|
|
||||||
[:template {:x-if "dates.length == 0"}
|
[:template {:x-if "dates.length == 0"}
|
||||||
[:span.text-left.text-gray-400 "None selected"]]
|
[:span.text-left.text-gray-400 "None selected"]]
|
||||||
@@ -316,6 +317,7 @@
|
|||||||
(com/multi-date-input {:placeholder "12/21/2020"
|
(com/multi-date-input {:placeholder "12/21/2020"
|
||||||
:x-model "dates" })
|
:x-model "dates" })
|
||||||
(com/a-button {"@click" "dates=getFourWeekPeriods(dates[dates.length -1])"} "13 periods")
|
(com/a-button {"@click" "dates=getFourWeekPeriods(dates[dates.length -1])"} "13 periods")
|
||||||
|
(com/a-button {"@click" "dates=withLastYear(dates[dates.length -1])"} "Add prior year")
|
||||||
(com/a-button {"@click" "dates=[]"} "Clear")]]]]))
|
(com/a-button {"@click" "dates=[]"} "Clear")]]]]))
|
||||||
|
|
||||||
(com/button {:color :primary :class "w-32"}
|
(com/button {:color :primary :class "w-32"}
|
||||||
|
|||||||
Reference in New Issue
Block a user