|
@@ -1,4 +1,5 @@
|
|
-module(element_calendar).
|
|
-module(element_calendar).
|
|
|
|
+-include_lib("nitro/include/calendar.hrl").
|
|
-include_lib("nitro/include/nitro.hrl").
|
|
-include_lib("nitro/include/nitro.hrl").
|
|
-include_lib("nitro/include/event.hrl").
|
|
-include_lib("nitro/include/event.hrl").
|
|
-export([render_element/1]).
|
|
-export([render_element/1]).
|
|
@@ -44,6 +45,7 @@ render_element(Record) ->
|
|
{<<"required">>,if Record#calendar.required == true -> "required"; true -> [] end},
|
|
{<<"required">>,if Record#calendar.required == true -> "required"; true -> [] end},
|
|
{<<"step">>,Record#calendar.step},
|
|
{<<"step">>,Record#calendar.step},
|
|
{<<"type">>, <<"calendar">>},
|
|
{<<"type">>, <<"calendar">>},
|
|
|
|
+ {<<"value">>, case Record#calendar.value of {Yv,Mv,Dv} -> io_lib:format("~p-~p-~p",[Yv,Mv,Dv]); [] -> []; _ -> "2019, 10, 7" end},
|
|
{<<"pattern">>,Record#calendar.pattern},
|
|
{<<"pattern">>,Record#calendar.pattern},
|
|
{<<"placeholder">>,Record#calendar.placeholder},
|
|
{<<"placeholder">>,Record#calendar.placeholder},
|
|
{<<"onkeypress">>, Record#calendar.onkeypress} | Record#calendar.data_fields
|
|
{<<"onkeypress">>, Record#calendar.onkeypress} | Record#calendar.data_fields
|
|
@@ -58,7 +60,7 @@ init(Id,#calendar{minDate=Min,maxDate=Max,lang=Lang,format=Form,
|
|
I18n = "clLangs.ua",
|
|
I18n = "clLangs.ua",
|
|
Format = "YYYY-MM-DD",
|
|
Format = "YYYY-MM-DD",
|
|
DefaultDate = case Value of {Yv,Mv,Dv} -> nitro:f("new Date(~s,~s,~s)",[nitro:to_list(Yv),nitro:to_list(Mv-1),nitro:to_list(Dv)]); _ -> "new Date(2019, 10, 7)" end,
|
|
DefaultDate = case Value of {Yv,Mv,Dv} -> nitro:f("new Date(~s,~s,~s)",[nitro:to_list(Yv),nitro:to_list(Mv-1),nitro:to_list(Dv)]); _ -> "new Date(2019, 10, 7)" end,
|
|
-% io:format("Default Date: ~p~n",[DefaultDate]),
|
|
|
|
|
|
+ % io:format("Default Date: ~p~n",[DefaultDate]),
|
|
MinDate = "null", % case Min of {Y,M,D} -> nitro:f("new Date(~s,~s,~s)",[nitro:to_list(Y), nitro:to_list(M-1), nitro:to_list(D)]); _ -> "new Date(2009, 3, 4)" end,
|
|
MinDate = "null", % case Min of {Y,M,D} -> nitro:f("new Date(~s,~s,~s)",[nitro:to_list(Y), nitro:to_list(M-1), nitro:to_list(D)]); _ -> "new Date(2009, 3, 4)" end,
|
|
MaxDate = "new Date(2020,10,10)", %case Max of {Y1,M1,D1} -> nitro:f("new Date(~s,~s,~s)",[nitro:to_list(Y1),nitro:to_list(M1-1),nitro:to_list(D1)]); _ -> "new Date(2089, 4, 1)" end,
|
|
MaxDate = "new Date(2020,10,10)", %case Max of {Y1,M1,D1} -> nitro:f("new Date(~s,~s,~s)",[nitro:to_list(Y1),nitro:to_list(M1-1),nitro:to_list(D1)]); _ -> "new Date(2089, 4, 1)" end,
|
|
OnSelect = "null",
|
|
OnSelect = "null",
|
|
@@ -83,4 +85,5 @@ init(Id,#calendar{minDate=Min,maxDate=Max,lang=Lang,format=Form,
|
|
});",
|
|
});",
|
|
[ID,ID,I18n,DefaultDate,MinDate,MaxDate,Format,OnSelect,DisDay,
|
|
[ID,ID,I18n,DefaultDate,MinDate,MaxDate,Format,OnSelect,DisDay,
|
|
Position,Reposition,nitro:to_list(YearRange)]
|
|
Position,Reposition,nitro:to_list(YearRange)]
|
|
- )).
|
|
|
|
|
|
+ )).
|
|
|
|
+
|