11-module (element_comboLookupEdit ).
22-include_lib (" nitro/include/comboLookupEdit.hrl" ).
33-include_lib (" nitro/include/comboLookup.hrl" ).
4+ -include_lib (" nitro/include/sortable_list.hrl" ).
45-include_lib (" nitro/include/nitro.hrl" ).
56-include_lib (" nitro/include/event.hrl" ).
67-export ([render_element /1 ]).
78
8- render_element (# comboLookupEdit {id = Id , input = Input , disabled = Disabled , validation = Validation , form = Form }) ->
9+ render_element (# comboLookupEdit {id = Id , input = Input , disabled = Disabled , validation = Validation , form = Form , values = Values , multiple = Multiple }) ->
10+ ListId = form :atom ([Id , " list" ]),
911 InputId = element (# element .id , Input ),
1012 nitro :render (
1113 # panel {
@@ -17,12 +19,24 @@ render_element(#comboLookupEdit{id=Id, input=Input, disabled=Disabled, validatio
1719 style = " display: flex; position: relative; width: 100%; justify-content: center;" ,
1820 body =
1921 [ Input ,
22+ case Multiple of
23+ true ->
24+ # link {
25+ class = [button , sgreen ],
26+ style = " min-width: 40px; text-align: center; height: fit-content; margin-left: 5px;" ,
27+ onclick = nitro :jse (" addSortableItemFrom('#" ++ ListId ++ " ', '" ++ InputId ++ " ')" ),
28+ body = <<" +" >>};
29+ false -> []
30+ end ,
2031 case Disabled of
2132 true -> [];
2233 _ ->
2334 # panel {
2435 id = form :atom ([InputId , " form" ]),
2536 class = ['dropdown-content' ],
2637 body = # panel {class = ['dropdown-item' ], body = Form }
27- } end ]}
28- ]}).
38+ } end ]},
39+ case Multiple of
40+ true -> # sortable_list {id = ListId , values = Values , closeable = true , disabled = Disabled };
41+ false -> []
42+ end ]}).
0 commit comments