3 changed files with 34 additions and 10 deletions
|
|
@ -93,11 +93,11 @@ defmodule MvWeb.ImportLive do
|
||||||
<%= if Authorization.can?(@current_user, :create, Mv.Membership.Member) do %>
|
<%= if Authorization.can?(@current_user, :create, Mv.Membership.Member) do %>
|
||||||
<%!-- CSV Import Section --%>
|
<%!-- CSV Import Section --%>
|
||||||
<.header>
|
<.header>
|
||||||
{gettext("Import Members (CSV)")}
|
{gettext("Import Members (CSV)")}
|
||||||
<:subtitle>
|
<:subtitle>
|
||||||
{gettext("Import members from CSV files.")}
|
{gettext("Import members from CSV files.")}
|
||||||
</:subtitle>
|
</:subtitle>
|
||||||
</.header>
|
</.header>
|
||||||
<.form_section title={gettext("Datei auswählen")}>
|
<.form_section title={gettext("Datei auswählen")}>
|
||||||
<Components.custom_fields_notice {assigns} />
|
<Components.custom_fields_notice {assigns} />
|
||||||
<Components.template_links {assigns} />
|
<Components.template_links {assigns} />
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ defmodule MvWeb.ImportLive.Components do
|
||||||
<div>
|
<div>
|
||||||
<p class="text-sm mb-2">
|
<p class="text-sm mb-2">
|
||||||
{gettext(
|
{gettext(
|
||||||
"Use the data field name as the CSV column header in your file. Data fields must exist in Mila before importing, because unknown data field columns will be ignored. Groups and membership fees are not supported for import."
|
"Use the data field name as the CSV column header in your file. Data fields must exist in Mila before importing, because unknown data field columns will be ignored with a warning. Groups and membership fees are not supported for import."
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
<p class="text-sm">
|
<p class="text-sm">
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,13 @@
|
||||||
#set page(
|
#set page(
|
||||||
paper: "a4",
|
paper: "a4",
|
||||||
flipped: true,
|
flipped: true,
|
||||||
margin: (top: 1.2cm, bottom: 1.2cm, left: 1.0cm, right: 1.0cm)
|
margin: (top: 1.2cm, bottom: 1.2cm, left: 1.0cm, right: 1.0cm),
|
||||||
|
numbering: "1",
|
||||||
|
footer: context [
|
||||||
|
#set text(size: 8pt)
|
||||||
|
#set align(center)
|
||||||
|
#counter(page).display("1 / 1", both: true)
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
#set text(size: 9pt, hyphenate: true)
|
#set text(size: 9pt, hyphenate: true)
|
||||||
|
|
@ -58,7 +64,6 @@
|
||||||
#let start = fixed_count + chunk_index * max_dynamic_cols
|
#let start = fixed_count + chunk_index * max_dynamic_cols
|
||||||
|
|
||||||
#let page_cols = fixed_cols + dyn_cols_chunk
|
#let page_cols = fixed_cols + dyn_cols_chunk
|
||||||
#let headers = page_cols.map(c => c.at("label", default: ""))
|
|
||||||
|
|
||||||
// widths: first two columns fixed (32mm, 42mm), rest distributed as 1fr
|
// widths: first two columns fixed (32mm, 42mm), rest distributed as 1fr
|
||||||
#let widths = (
|
#let widths = (
|
||||||
|
|
@ -67,9 +72,9 @@
|
||||||
..((1fr,) * dyn_count)
|
..((1fr,) * dyn_count)
|
||||||
)
|
)
|
||||||
|
|
||||||
#let header_cells = headers.map(h => text(weight: "bold", size: 9pt)[#h])
|
#let header_cells = page_cols.map(c => text(weight: "bold", size: 9pt)[#c.at("label", default: "")])
|
||||||
|
|
||||||
// Body cells (row-major), nur die Spalten dieses Chunks
|
// Body cells (row-major), only columns of this chunk
|
||||||
#let body_cells = (
|
#let body_cells = (
|
||||||
rows
|
rows
|
||||||
.map(row => row.slice(0, fixed_count) + row.slice(start, start + dyn_count))
|
.map(row => row.slice(0, fixed_count) + row.slice(start, start + dyn_count))
|
||||||
|
|
@ -77,8 +82,27 @@
|
||||||
.flatten()
|
.flatten()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Thinner grid for body; thicker vertical line between column 2 and 3; header and outer borders thick
|
||||||
|
#let thin_stroke = 0.3pt + black
|
||||||
|
#let thick_sep = 1.5pt + black
|
||||||
|
#let thick_stroke = 1pt + black
|
||||||
|
#let last_x = fixed_count + dyn_count - 1
|
||||||
|
#let last_y = rows.len()
|
||||||
|
#let stroke_fn = (x, y) => {
|
||||||
|
let top = if y == 0 or y == 1 { thick_stroke } else { thin_stroke }
|
||||||
|
let bottom = if y == 0 or y == last_y { thick_stroke } else { thin_stroke }
|
||||||
|
let left = if x == 0 { thick_stroke } else if x == 2 { thick_sep } else { thin_stroke }
|
||||||
|
let right = if x == last_x { thick_stroke } else { thin_stroke }
|
||||||
|
(top: top, bottom: bottom, left: left, right: right)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Light gray background for first two columns (first_name, last_name)
|
||||||
|
#let fill_fn = (x, y) => if x < 2 { rgb("f2f2f2") } else { none }
|
||||||
|
|
||||||
#table(
|
#table(
|
||||||
columns: widths,
|
columns: widths,
|
||||||
|
stroke: stroke_fn,
|
||||||
|
fill: fill_fn,
|
||||||
table.header(..header_cells),
|
table.header(..header_cells),
|
||||||
..body_cells,
|
..body_cells,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue