{{ $model := . }}


<div class="flex flex-row grow">
	<!--
	<div class="mr-4 text-6xl">{{ $model.Letter }}</div>
	-->
	<div class="pt-0.5">
		<div class="flex flex-row">
			<div class="italic">{{ $model.Earliest.Text -}}</div>
			<div class="flex flex-row gap-x-1.5 ml-3">
				{{- if $model.IsDraft.IsTrue -}}
					<tool-tip position="top">
						<div class="text-gray-500 align-middle"><i class="ri-draft-line"></i></div>
						<div class="data-tip">Entwurf</div>
					</tool-tip>
				{{- end -}}
				{{- if $model.HasOriginal.IsTrue -}}
					<tool-tip position="top">
						<div class="text-gray-500 align-middle"><i class="ri-file-list-2-line"></i></div>
						<div class="data-tip">Der Brieftext wurde anhand des Originals kritisch geprüft.</div>
					</tool-tip>
				{{- else -}}
					<tool-tip position="top">
						<div class="text-gray-500 align-middle"><i class="ri-file-copy-2-line"></i></div>
						<div class="data-tip">Der Brieftext wurde sekundär überliefert.</div>
					</tool-tip>
				{{- end -}}
			</div>
		</div>
		{{- range $sr := $model.SendReceivedPairs -}}
			<div class="flex flex-row">
				<div>
					{{- range $i, $p := $sr.Sent.Persons -}}
						{{ if and $i (eq $i (Minus (len $sr.Sent.Persons) 1)) }}
							und
						{{ else if $i -}}
							,
						{{ end }}
						{{- $person := Person $p.Reference }}
						{{ $person.Name -}}
					{{- end -}}
				</div>
				<div class="mx-3">
					{{- if $model.IsDraft.IsTrue -}}
						<i class="ri-arrow-right-long-line"></i>
					{{- else -}}
						<i class="ri-arrow-right-long-line"></i>
					{{- end -}}
				</div>
				{{- if $sr.Received -}}
					<div>
						{{- range $i, $p := $sr.Received.Persons -}}
							{{- if and $i (eq $i (Minus (len $sr.Received.Persons) 1)) }}
								und
							{{- else if $i -}}
								,
							{{- end -}}
							{{- $person := Person $p.Reference }}
							{{ $person.Name -}}
						{{- end -}}
						{{ if and $sr.Received.Places (len $sr.Received.Places) }}
							{{- range $i, $p := $sr.Received.Places -}}
								{{- $place := Place $p.Reference }}
								{{- if and $i (eq $i (Minus (len $sr.Received.Places) 1)) }}
									und
								{{ else if $i -}}
									,
								{{- end -}}
								{{- if eq $i 0 -}}
									&nbsp;({{- $place.Name -}}
								{{- else -}}
									{{ $place.Name -}}
								{{- end -}}
							{{- end -}}
							)
						{{- end -}}
					</div>
				{{- else -}}
					<div>Unbekannt</div>
				{{- end -}}
			</div>
		{{- end -}}
	</div>
</div>
