Current section

11 Versions

Jump to

Compare versions

13 files changed
+210 additions
-209 deletions
  @@ -4,14 +4,14 @@
4 4 {<<"elixir">>,<<"~> 1.0">>}.
5 5 {<<"files">>,
6 6 [<<"lib">>,<<"lib/error_helpers.ex">>,<<"lib/live">>,
7 - <<"lib/live/edit_component.ex">>,<<"lib/live/edit_component.html.leex">>,
8 - <<"lib/live/list_component.ex">>,<<"lib/live/list_component.html.leex">>,
7 + <<"lib/live/edit_component.ex">>,<<"lib/live/edit_component.html.heex">>,
8 + <<"lib/live/list_component.ex">>,<<"lib/live/list_component.html.heex">>,
9 9 <<"lib/live/mavu_list">>,<<"lib/live/mavu_list/pagination_component.ex">>,
10 + <<"lib/live/mavu_list/label_component.html.heex">>,
10 11 <<"lib/live/mavu_list/label_component.ex">>,
11 - <<"lib/live/mavu_list/label_component.html.leex">>,
12 12 <<"lib/live/mavu_list/searchbox_component.ex">>,
13 - <<"lib/live/mavu_list/pagination_component.html.leex">>,
14 - <<"lib/live/mavu_list/searchbox_component.html.leex">>,
13 + <<"lib/live/mavu_list/pagination_component.html.heex">>,
14 + <<"lib/live/mavu_list/searchbox_component.html.heex">>,
15 15 <<"lib/backend_helpers.ex">>,<<"lib/mavu_be_user_ui.ex">>,
16 16 <<"lib/mavu_be_user_ui_web.ex">>,<<".formatter.exs">>,<<"mix.exs">>,
17 17 <<"README.md">>]}.
  @@ -33,7 +33,7 @@
33 33 {<<"name">>,<<"phoenix_live_view">>},
34 34 {<<"optional">>,false},
35 35 {<<"repository">>,<<"hexpm">>},
36 - {<<"requirement">>,<<">= 0.15.7">>}],
36 + {<<"requirement">>,<<"0.17.2">>}],
37 37 [{<<"app">>,<<"mavu_form">>},
38 38 {<<"name">>,<<"mavu_form">>},
39 39 {<<"optional">>,false},
  @@ -54,4 +54,4 @@
54 54 {<<"optional">>,false},
55 55 {<<"repository">>,<<"hexpm">>},
56 56 {<<"requirement">>,<<">= 3.0.0">>}]]}.
57 - {<<"version">>,<<"0.1.5">>}.
57 + {<<"version">>,<<"0.1.6">>}.
  @@ -0,0 +1,39 @@
1 + <section id={"#{ @id }"} class="be_userlist_edit_component">
2 + <%= if @local_edit_component do %>
3 +
4 + <%= live_component @local_edit_component,
5 + context: @context,
6 + base_path: @base_path,
7 + changeset: @changeset,
8 + parent_id: @id,
9 + rec_id: @rec_id
10 + %>
11 +
12 +
13 + <% else %>
14 +
15 +
16 + <%= live_component MyAppBe.Live.Components.CenteredModalComponent, phx_target: "##{@id}", class: "sm:max-w-[90vw] sm:w-[400px] w-full" do %>
17 + <div class="my-8 be_userlist_component_inner">
18 +
19 +
20 +
21 + <.form let={f} for={@changeset} url="#" as={:fdata} phx-change={:validate} phx-submit={:save} phx-target="##{@id}">
22 +
23 +
24 + <%= input f, :email , label: "Email" %>
25 +
26 + <%= input f, :is_active ,using: :checkbox, label: "Is Active" %>
27 +
28 +
29 + <div class="my-4 text-right">
30 + <%= content_tag :button, "OK",class: "btn-outline-primary px-10" %>
31 + </div>
32 +
33 +
34 + </.form>
35 + </div>
36 + <% end %>
37 +
38 + <% end %>
39 + </section>
  @@ -1,37 +0,0 @@
1 - <div id="<%= @id %>" class="be_userlist_edit_component">
2 - <%= if @local_edit_component do %>
3 -
4 - <%= live_component @local_edit_component,
5 - context: @context,
6 - base_path: @base_path,
7 - changeset: @changeset,
8 - parent_id: @id,
9 - rec_id: @rec_id
10 - %>
11 -
12 -
13 - <% else %>
14 -
15 -
16 - <%= live_component MyAppBe.Live.Components.CenteredModalComponent, phx_target: "##{@id}", class: "sm:max-w-[90vw] sm:w-[400px] w-full" do %>
17 - <div class="my-8 be_userlist_component_inner">
18 -
19 -
20 -
21 - <%= f = form_for(@changeset, "#", [ as: :fdata, phx_change: :validate, phx_submit: :save, phx_target: "##{@id}"]) %>
22 -
23 -
24 - <%= input f, :email , label: "Email" %>
25 -
26 - <%= input f, :is_active ,using: :checkbox, label: "Is Active" %>
27 -
28 -
29 - <div class="my-4 text-right">
30 - <%= content_tag :button, "OK",class: "btn-outline-primary px-10" %>
31 - </div>
32 -
33 -
34 - </form>
35 - </div> <% end %> </div>
36 - <% end %>
37 - </div>
  @@ -71,7 +71,7 @@ defmodule MavuBeUserUi.Live.ListComponent do
71 71 end
72 72
73 73 def handle_event("delete_item", %{"id" => rec_id}, socket) do
74 - accounts_module(socket.assigns).get_be_user!(
74 + accounts_module(socket.assigns).get_user!(
75 75 !MavuUtils.to_int(rec_id)
76 76 |> Repo.delete()
77 77 )
  @@ -0,0 +1,72 @@
1 + <div id={"#{ @id }"}>
2 +
3 + <%= live_component MavuBeUserUi.Live.MavuList.SearchboxComponent , list: @items_filtered %>
4 +
5 + <div class="px-10 mt-8 border-[#ff0000]">
6 + <div class="flex flex-col ">
7 + <div class="-my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
8 + <div class="inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8">
9 + <div class="overflow-hidden border-b border-gray-200 shadow sm:rounded-lg">
10 + <table class="min-w-full divide-y divide-gray-200">
11 + <thead class="bg-gray-50">
12 + <tr>
13 + <%= for col <- @items_filtered.metadata.columns do %>
14 + <th class="px-6 py-3 text-xs font-bold tracking-wider text-left text-black ">
15 + <%= live_component MavuBeUserUi.Live.MavuList.LabelComponent , list: @items_filtered, name: col.name %>
16 + </th> <% end %>
17 + <th>&nbsp;</th>
18 + </tr>
19 + </thead>
20 + <tbody class="bg-white divide-y divide-gray-200">
21 + <%= for row <- @items_filtered.data do %>
22 +
23 + <tr>
24 + <%= for col <- @items_filtered.metadata.columns do %>
25 +
26 + <%= case {col[:type], MavuList.get_colval(row,@items_filtered.conf,col.name), col.name} do %>
27 + <% {_,val,_} -> %>
28 + <td class="px-6 py-4 text-sm font-medium text-gray-900 whitespace-nowrap"><%= val %></td>
29 + <% end %>
30 + <% end %>
31 + <td class="flex items-center h-12 space-x-3 text-gray-500">
32 +
33 + <%= link tw_icon(&Heroicons.Outline.pencil/1, "w-5 h-5"), to: "#", class: "inline-block", phx_click: "edit_item", phx_value_id: row.id, phx_target: @myself %>
34 +
35 + <%= link tw_icon(&Heroicons.Outline.trash/1, "w-5 h-5"), to: "#",
36 + class: "inline-block",
37 + phx_click: "delete_item",
38 + phx_value_id: row.id,
39 + phx_target: @myself,
40 + data: [confirm: "Are you sure you want to delete item '#{row.id}' ?"] %>
41 +
42 + </td>
43 + </tr>
44 + <% end %>
45 + </tbody>
46 + </table>
47 + </div>
48 +
49 + <div class="mt-8 mb-4">
50 + <%= link tw_icon(&Heroicons.Outline.plus/1,"w-8 h-8 text-gray-400 hover:text-primary-500 inline-block"), to: "#", class: "text-gray-400", phx_click: "add_item", phx_target: @myself %>
51 + </div>
52 + </div>
53 + </div>
54 + </div>
55 + </div>
56 +
57 + <%= live_component MavuBeUserUi.Live.MavuList.PaginationComponent , list: @items_filtered, class: "mx-8 mt-8 mb-4 " %>
58 +
59 + <%= case @context.params["rec"] do %>
60 +
61 + <% rec_id when is_binary(rec_id) -> %>
62 +
63 + <%= live_component MavuBeUserUi.Live.EditComponent,
64 + id: "be_user_detail",
65 + rec_id: rec_id,
66 + context: @context,
67 + base_path: @base_path
68 + %>
69 + <% _ -> %>
70 +
71 + <% end %>
72 + </div>
Loading more files…