From 4ba73868d152fe7e7764f16c3033c8ba1448ce39 Mon Sep 17 00:00:00 2001 From: timujeen Date: Fri, 27 Mar 2026 20:20:35 +0000 Subject: [PATCH 1/4] Remove duplicate LayoutWrapper from admin module templates All module admin views (customer_service, storage, db, referrals, maintenance, sitemap) were wrapped in LayoutWrapper.app_layout, but they render inside admin live_session which already applies the admin layout. This caused double sidebar rendering. Remove the redundant wrapper from 16 .heex templates and 1 .ex file, keeping only the inner content div. --- .../customer_service/web/details.html.heex | 728 ++++++----- .../customer_service/web/edit.html.heex | 350 +++--- .../customer_service/web/list.html.heex | 650 +++++----- .../customer_service/web/settings.html.heex | 242 ++-- lib/modules/db/web/activity.html.heex | 331 +++-- lib/modules/db/web/index.html.heex | 249 ++-- lib/modules/db/web/show.html.heex | 767 ++++++------ lib/modules/maintenance/settings.ex | 9 - .../maintenance/web/settings.html.heex | 281 ++--- lib/modules/referrals/web/form.html.heex | 384 +++--- lib/modules/referrals/web/list.html.heex | 436 ++++--- lib/modules/referrals/web/settings.html.heex | 249 ++-- lib/modules/sitemap/web/settings.html.heex | 1095 ++++++++--------- lib/modules/storage/web/bucket_form.html.heex | 621 +++++----- .../storage/web/dimension_form.html.heex | 427 ++++--- lib/modules/storage/web/dimensions.html.heex | 693 +++++------ lib/modules/storage/web/settings.html.heex | 965 +++++++-------- 17 files changed, 4165 insertions(+), 4312 deletions(-) diff --git a/lib/modules/customer_service/web/details.html.heex b/lib/modules/customer_service/web/details.html.heex index a93194ddd..63cd2cdb0 100644 --- a/lib/modules/customer_service/web/details.html.heex +++ b/lib/modules/customer_service/web/details.html.heex @@ -1,138 +1,222 @@ - -
- <.admin_page_header back={PhoenixKit.Utils.Routes.path("/admin/customer-service/tickets")} /> +
+ <.admin_page_header back={PhoenixKit.Utils.Routes.path("/admin/customer-service/tickets")} /> -
- <%!-- Main Content --%> -
- <%!-- Ticket Info Card --%> -
-
-
-
-

{@ticket.title}

-
- #{String.slice(@ticket.uuid, 0, 8)} - - Created {Calendar.strftime(@ticket.inserted_at, "%Y-%m-%d %H:%M")} -
-
-
- <.link - navigate={ - PhoenixKit.Utils.Routes.path( - "/admin/customer-service/tickets/#{@ticket.uuid}/edit" - ) - } - class="btn btn-outline btn-sm" - > - Edit - +
+ <%!-- Main Content --%> +
+ <%!-- Ticket Info Card --%> +
+
+
+
+

{@ticket.title}

+
+ #{String.slice(@ticket.uuid, 0, 8)} + + Created {Calendar.strftime(@ticket.inserted_at, "%Y-%m-%d %H:%M")}
+
+ <.link + navigate={ + PhoenixKit.Utils.Routes.path( + "/admin/customer-service/tickets/#{@ticket.uuid}/edit" + ) + } + class="btn btn-outline btn-sm" + > + Edit + +
+
-
+
- <%!-- Description --%> -
-

{@ticket.description}

-
+ <%!-- Description --%> +
+

{@ticket.description}

+
- <%!-- Attachments Section --%> - <%= if @attachments_enabled do %> -
-
-

Attachments ({length(@attachments)})

- -
+ <%!-- Attachments Section --%> + <%= if @attachments_enabled do %> +
+
+

Attachments ({length(@attachments)})

+ +
- <%= if Enum.any?(@attachments) do %> -
- <%= for attachment <- @attachments do %> -
- <%= if attachment.file do %> - <%= if attachment.file.file_type == "image" do %> - {attachment.caption - <% else %> -
- <.icon name="hero-document" class="w-8 h-8 text-base-content/50" /> -
- <% end %> -
-
{attachment.file.original_file_name}
+ <%= if Enum.any?(@attachments) do %> +
+ <%= for attachment <- @attachments do %> +
+ <%= if attachment.file do %> + <%= if attachment.file.file_type == "image" do %> + {attachment.caption + <% else %> +
+ <.icon name="hero-document" class="w-8 h-8 text-base-content/50" />
- <% end %> +
+
{attachment.file.original_file_name}
+
+ + <% end %> +
+ <% end %> +
+ <% else %> +
+ No attachments yet. Click "Add Files" to attach files. +
+ <% end %> + <% end %> +
+
+ + <%!-- Public Comments Section --%> +
+
+

Comments ({length(@public_comments)})

+ + <%!-- Comments List --%> +
+ <%= if Enum.empty?(@public_comments) do %> +
+ No comments yet. Be the first to respond. +
+ <% else %> + <%= for comment <- @public_comments do %> +
+
+
+ <.user_avatar user={comment.user} size="sm" /> +
+ {comment.user.email} + + {Calendar.strftime(comment.inserted_at, "%Y-%m-%d %H:%M")} + +
- <% end %> -
- <% else %> -
- No attachments yet. Click "Add Files" to attach files. + +
+
{comment.content}
<% end %> <% end %>
+ + <%!-- Add Comment Form --%> +
+
+ + +
+ +
+
+
- <%!-- Public Comments Section --%> -
+ <%!-- Internal Notes Section (Staff Only) --%> + <%= if @can_view_internal and @internal_notes_enabled do %> +
-

Comments ({length(@public_comments)})

+
+ + + +

+ Internal Notes ({length(@internal_notes)}) +

+ Staff Only +
- <%!-- Comments List --%> + <%!-- Internal Notes List --%>
- <%= if Enum.empty?(@public_comments) do %> -
- No comments yet. Be the first to respond. + <%= if Enum.empty?(@internal_notes) do %> +
+ No internal notes yet.
<% else %> - <%= for comment <- @public_comments do %> -
+ <%= for note <- @internal_notes do %> +
- <.user_avatar user={comment.user} size="sm" /> + <.user_avatar user={note.user} size="sm" />
- {comment.user.email} + {note.user.email} - {Calendar.strftime(comment.inserted_at, "%Y-%m-%d %H:%M")} + {Calendar.strftime(note.inserted_at, "%Y-%m-%d %H:%M")}
-
{comment.content}
+
{note.content}
<% end %> <% end %>
- <%!-- Add Comment Form --%> + <%!-- Add Internal Note Form --%>
- +
-
+ <% end %> +
- <%!-- Internal Notes Section (Staff Only) --%> - <%= if @can_view_internal and @internal_notes_enabled do %> -
-
-
- - - -

- Internal Notes ({length(@internal_notes)}) -

- Staff Only -
+ <%!-- Sidebar --%> +
+ <%!-- Status & Actions Card --%> +
+
+

Status & Actions

- <%!-- Internal Notes List --%> -
- <%= if Enum.empty?(@internal_notes) do %> -
- No internal notes yet. -
- <% else %> - <%= for note <- @internal_notes do %> -
-
-
- <.user_avatar user={note.user} size="sm" /> -
- {note.user.email} - - {Calendar.strftime(note.inserted_at, "%Y-%m-%d %H:%M")} - -
-
- -
-
{note.content}
-
- <% end %> - <% end %> -
- - <%!-- Add Internal Note Form --%> -
-
- - -
- -
-
+ <%!-- Current Status --%> +
+ Current Status +
+ <%= case @ticket.status do %> + <% "open" -> %> + Open + <% "in_progress" -> %> + In Progress + <% "resolved" -> %> + Resolved + <% "closed" -> %> + Closed + <% end %>
- <% end %> -
- <%!-- Sidebar --%> -
- <%!-- Status & Actions Card --%> -
-
-

Status & Actions

+ <%!-- Status Actions --%> +
+ <%= if @ticket.status == "open" do %> + + + <% end %> - <%!-- Current Status --%> -
- Current Status -
- <%= case @ticket.status do %> - <% "open" -> %> - Open - <% "in_progress" -> %> - In Progress - <% "resolved" -> %> - Resolved - <% "closed" -> %> - Closed - <% end %> -
-
+ <%= if @ticket.status == "in_progress" do %> + + + <% end %> - <%!-- Status Actions --%> -
- <%= if @ticket.status == "open" do %> - - - <% end %> + <%= if @ticket.status == "resolved" do %> + + + <% end %> - <%= if @ticket.status == "in_progress" do %> - - - <% end %> + <%= if @ticket.status == "closed" do %> + + <% end %> +
+
+
- <%= if @ticket.status == "resolved" do %> - - + <%!-- Details Card --%> +
+
+

Details

+ + <%!-- Customer --%> +
+ Customer +
+ <%= if @ticket.user do %> + <.user_avatar user={@ticket.user} size="xs" /> + {@ticket.user.email} + <% else %> + Unknown <% end %> +
+
- <%= if @ticket.status == "closed" do %> - + <%!-- Assigned To --%> +
+ Assigned To +
+ <%= if @ticket.assigned_to do %> + {@ticket.assigned_to.email} + <% else %> +
+ Unassigned + +
<% end %>
-
- <%!-- Details Card --%> -
-
-

Details

+ <%!-- Comments Count --%> +
+ Comments +
{@ticket.comment_count}
+
- <%!-- Customer --%> + <%!-- Timestamps --%> + <%= if @ticket.resolved_at do %>
- Customer -
- <%= if @ticket.user do %> - <.user_avatar user={@ticket.user} size="xs" /> - {@ticket.user.email} - <% else %> - Unknown - <% end %> + Resolved At +
+ {Calendar.strftime(@ticket.resolved_at, "%Y-%m-%d %H:%M")}
+ <% end %> - <%!-- Assigned To --%> + <%= if @ticket.closed_at do %>
- Assigned To -
- <%= if @ticket.assigned_to do %> - {@ticket.assigned_to.email} - <% else %> -
- Unassigned - -
- <% end %> + Closed At +
+ {Calendar.strftime(@ticket.closed_at, "%Y-%m-%d %H:%M")}
- - <%!-- Comments Count --%> -
- Comments -
{@ticket.comment_count}
-
- - <%!-- Timestamps --%> - <%= if @ticket.resolved_at do %> -
- Resolved At -
- {Calendar.strftime(@ticket.resolved_at, "%Y-%m-%d %H:%M")} -
-
- <% end %> - - <%= if @ticket.closed_at do %> -
- Closed At -
- {Calendar.strftime(@ticket.closed_at, "%Y-%m-%d %H:%M")} -
-
- <% end %> -
+ <% end %>
+
- <%!-- Status History Card --%> -
-
-

Status History

+ <%!-- Status History Card --%> +
+
+

Status History

-
- <%= for entry <- @status_history do %> -
-
+
+ <%= for entry <- @status_history do %> +
+
+
-
- <%= if entry.from_status do %> - {entry.from_status} → - <% end %> - {entry.to_status} -
-
- by {(entry.changed_by && entry.changed_by.email) || "System"} -
- {Calendar.strftime(entry.inserted_at, "%Y-%m-%d %H:%M")} -
- <%= if entry.reason do %> -
"{entry.reason}"
+ <%= if entry.from_status do %> + {entry.from_status} → <% end %> + {entry.to_status} +
+
+ by {(entry.changed_by && entry.changed_by.email) || "System"} +
+ {Calendar.strftime(entry.inserted_at, "%Y-%m-%d %H:%M")}
+ <%= if entry.reason do %> +
"{entry.reason}"
+ <% end %>
- <% end %> -
+
+ <% end %>
- - <%!-- Media Selector Modal --%> - <%= if @attachments_enabled do %> - <.live_component - module={PhoenixKitWeb.Live.Components.MediaSelectorModal} - id="ticket-media-selector" - show={@show_media_selector} - mode={:multiple} - selected_uuids={Enum.map(@attachments, & &1.file_uuid)} - phoenix_kit_current_user={@current_user} - /> - <% end %>
- + + <%!-- Media Selector Modal --%> + <%= if @attachments_enabled do %> + <.live_component + module={PhoenixKitWeb.Live.Components.MediaSelectorModal} + id="ticket-media-selector" + show={@show_media_selector} + mode={:multiple} + selected_uuids={Enum.map(@attachments, & &1.file_uuid)} + phoenix_kit_current_user={@current_user} + /> + <% end %> +
diff --git a/lib/modules/customer_service/web/edit.html.heex b/lib/modules/customer_service/web/edit.html.heex index 0b6df4e26..31ff9b66b 100644 --- a/lib/modules/customer_service/web/edit.html.heex +++ b/lib/modules/customer_service/web/edit.html.heex @@ -1,202 +1,194 @@ - -
- <.admin_page_header back={PhoenixKit.Utils.Routes.path("/admin/customer-service/tickets")} /> +
+ <.admin_page_header back={PhoenixKit.Utils.Routes.path("/admin/customer-service/tickets")} /> -
-
-

- {if @action == :new, do: "New Ticket", else: "Edit Ticket"} -

+
+
+

+ {if @action == :new, do: "New Ticket", else: "Edit Ticket"} +

- <.form for={@form} phx-change="validate" phx-submit="save" class="space-y-6"> - <%!-- Customer (for new tickets) --%> - <%= if @action == :new do %> -
- - - -
+ <.form for={@form} phx-change="validate" phx-submit="save" class="space-y-6"> + <%!-- Customer (for new tickets) --%> + <%= if @action == :new do %> +
+ + + +
+ <% end %> + + <%!-- Title --%> +
+ + + <%= if @form[:title].errors != [] do %> + <% end %> +
- <%!-- Title --%> + <%!-- Description --%> +
+ + + <%= if @form[:description].errors != [] do %> + + <% end %> +
+ + <%!-- Assignment (for edit) --%> + <%= if @action == :edit do %>
- - <%= if @form[:title].errors != [] do %> - - <% end %> +
- <%!-- Description --%> + <%!-- Status (for edit) --%>
- - <%= if @form[:description].errors != [] do %> - - <% end %> +
+ <% end %> - <%!-- Assignment (for edit) --%> - <%= if @action == :edit do %> -
- - -
- - <%!-- Status (for edit) --%> -
- - -
- <% end %> - - <%!-- Attachments (for new tickets) --%> - <%= if @action == :new and @attachments_enabled do %> -
- + <%!-- Attachments (for new tickets) --%> + <%= if @action == :new and @attachments_enabled do %> +
+ - <%= if Enum.any?(@pending_files) do %> -
- <%= for file <- @pending_files do %> -
- <%= if file.file_type == "image" do %> - {file.original_file_name} - <% else %> -
- <.icon name="hero-document" class="w-6 h-6 text-base-content/50" /> -
- <% end %> -
-
{file.original_file_name}
+ <%= if Enum.any?(@pending_files) do %> +
+ <%= for file <- @pending_files do %> +
+ <%= if file.file_type == "image" do %> + {file.original_file_name} + <% else %> +
+ <.icon name="hero-document" class="w-6 h-6 text-base-content/50" />
- + <% end %> +
+
{file.original_file_name}
- <% end %> -
- <% end %> - - -
- <% end %> + +
+ <% end %> +
+ <% end %> - <%!-- Actions --%> -
- <.link - navigate={PhoenixKit.Utils.Routes.path("/admin/customer-service/tickets")} - class="btn btn-ghost" +
- -
-
+ <% end %> - <%!-- Media Selector Modal (for new tickets) --%> - <%= if @action == :new and @attachments_enabled do %> - <.live_component - module={PhoenixKitWeb.Live.Components.MediaSelectorModal} - id="new-ticket-media-selector" - show={@show_media_selector} - mode={:multiple} - selected_uuids={@pending_file_uuids} - phoenix_kit_current_user={@current_user} - /> - <% end %> + <%!-- Actions --%> +
+ <.link + navigate={PhoenixKit.Utils.Routes.path("/admin/customer-service/tickets")} + class="btn btn-ghost" + > + Cancel + + +
+ +
- + + <%!-- Media Selector Modal (for new tickets) --%> + <%= if @action == :new and @attachments_enabled do %> + <.live_component + module={PhoenixKitWeb.Live.Components.MediaSelectorModal} + id="new-ticket-media-selector" + show={@show_media_selector} + mode={:multiple} + selected_uuids={@pending_file_uuids} + phoenix_kit_current_user={@current_user} + /> + <% end %> +
diff --git a/lib/modules/customer_service/web/list.html.heex b/lib/modules/customer_service/web/list.html.heex index 55d0f75cb..05fffefaf 100644 --- a/lib/modules/customer_service/web/list.html.heex +++ b/lib/modules/customer_service/web/list.html.heex @@ -1,310 +1,223 @@ - -
- <.admin_page_header - back={PhoenixKit.Utils.Routes.path("/admin")} - title="Support Tickets" - subtitle="Manage customer support requests" +
+ <.admin_page_header + back={PhoenixKit.Utils.Routes.path("/admin")} + title="Support Tickets" + subtitle="Manage customer support requests" + > + <:actions> + <.link + navigate={PhoenixKit.Utils.Routes.path("/admin/customer-service/tickets/new")} + class="btn btn-primary" + > + <.icon name="hero-plus" class="h-5 w-5" /> New Ticket + + + + + <%!-- Stats Cards --%> +
+ - <:actions> - <.link - navigate={PhoenixKit.Utils.Routes.path("/admin/customer-service/tickets/new")} - class="btn btn-primary" - > - <.icon name="hero-plus" class="h-5 w-5" /> New Ticket - - - + <:icon> + <.icon name="hero-list-bullet" class="w-5 h-5" /> + + - <%!-- Stats Cards --%> -
- - <:icon> - <.icon name="hero-list-bullet" class="w-5 h-5" /> - - + + <:icon> + <.icon name="hero-inbox" class="w-5 h-5" /> + + - - <:icon> - <.icon name="hero-inbox" class="w-5 h-5" /> - - + + <:icon> + <.icon name="hero-clock" class="w-5 h-5" /> + + - - <:icon> - <.icon name="hero-clock" class="w-5 h-5" /> - - + + <:icon> + <.icon name="hero-check-circle" class="w-5 h-5" /> + + - - <:icon> - <.icon name="hero-check-circle" class="w-5 h-5" /> - - + + <:icon> + <.icon name="hero-archive-box" class="w-5 h-5" /> + + +
- - <:icon> - <.icon name="hero-archive-box" class="w-5 h-5" /> - - -
+ <%!-- Filters --%> +
+
+
+ +
+
+ +
+
+ +
+ +
+
- <%!-- Filters --%> -
-
-
- -
-
- -
-
- -
- -
+ <%!-- Loading --%> + <%= if @loading do %> +
+
- - <%!-- Loading --%> - <%= if @loading do %> -
- + <% else %> + <%!-- Empty State --%> + <%= if Enum.empty?(@tickets) do %> +
+ <.icon name="hero-ticket" class="h-16 w-16 mx-auto text-base-content/30 mb-4" /> +

No tickets found

+

+ <%= if @status_filter || @search_query do %> + Try adjusting your filters or search query. + <% else %> + Create your first ticket to get started. + <% end %> +

<% else %> - <%!-- Empty State --%> - <%= if Enum.empty?(@tickets) do %> -
- <.icon name="hero-ticket" class="h-16 w-16 mx-auto text-base-content/30 mb-4" /> -

No tickets found

-

- <%= if @status_filter || @search_query do %> - Try adjusting your filters or search query. - <% else %> - Create your first ticket to get started. - <% end %> -

-
- <% else %> - <%!-- Desktop Table --%> - - - <%!-- Mobile Cards --%> -
-
+ <%!-- Desktop Table --%> +