1{extends "layout_view.tpl"}
2
3{block name="title"}
4	{title}{$title}{/title}
5{/block}
6
7{block name="navigation"}
8	<div class="t_navbar mb-4">
9		{permission name=admin_trackers}
10			<a class="btn btn-link" href="{service controller=tabular action=create}">{icon name=create} {tr}New{/tr}</a>
11			<a class="btn btn-link" href="{service controller=tabular action=manage}">{icon name=list} {tr}Manage{/tr}</a>
12		{/permission}
13	</div>
14{/block}
15
16{block name="content"}
17	<div class="table-responsive">
18		<form class="edit-tabular" method="post" action="{service controller=tabular action=edit tabularId=$tabularId}">
19			<div class="form-group row">
20				<label class="col-form-label col-sm-2">{tr}Name{/tr}</label>
21				<div class="col-sm-10">
22					<input class="form-control" type="text" name="name" value="{$name|escape}" required>
23				</div>
24			</div>
25			<div class="form-group row">
26				<label class="col-form-label col-sm-2">{tr}Fields{/tr}</label>
27				<div class="col-sm-10">
28					<table class="table fields">
29						<thead>
30							<tr>
31								<th>{tr}Field{/tr}</th>
32								<th>{tr}Mode{/tr}</th>
33								<th><abbr title="{tr}Primary Key{/tr}">{tr}PK{/tr}</abbr></th>
34								<th><abbr title="{tr}Unique Key{/tr}">{tr}UK{/tr}</abbr></th>
35								<th><abbr title="{tr}Read-Only{/tr}">{tr}RO{/tr}</abbr></th>
36								<th><abbr title="{tr}Export-Only{/tr}">{tr}EO{/tr}</abbr></th>
37								<th></th>
38							</tr>
39						</thead>
40						<tbody>
41							<tr class="d-none">
42								<td>
43									<div class="input-group input-group-sm">
44										<div class="input-group-prepend">
45											<span class="input-group-text">{icon name=sort}</span>
46										</div>
47										<input type="text" class="field-label form-control">
48										<div class="input-group-append">
49											<button type="button" class="btn btn-light dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
50												<span class="align">{tr}Left{/tr}</span>
51												<input class="display-align" type="hidden" value="left">
52											</button>
53											<div class="dropdown-menu dropdown-menu-right" role="menu">
54												<a class="dropdown-item align-option" href="#left">{tr}Left{/tr}</a>
55												<a class="dropdown-item align-option" href="#center">{tr}Center{/tr}</a>
56												<a class="dropdown-item align-option" href="#right">{tr}Right{/tr}</a>
57												<a class="dropdown-item align-option" href="#justify">{tr}Justify{/tr}</a>
58											</div>
59										</div>
60									</div>
61								</td>
62								<td><span class="field">Field Name</span>:<span class="mode">Mode</span></td>
63								<td><input class="primary" type="radio" name="pk"></td>
64								<td><input class="unique-key" type="checkbox"></td>
65								<td><input class="read-only" type="checkbox"></td>
66								<td><input class="export-only" type="checkbox"></td>
67								<td class="text-right"><button class="remove btn-sm btn-outline-warning">{icon name=remove}</button></td>
68							</tr>
69							{foreach $schema->getColumns() as $column}
70								<tr>
71									<td>
72										<div class="input-group input-group-sm">
73											<div class="input-group-prepend">
74												<span class="input-group-text">{icon name=sort}</span>
75											</div>
76											<input type="text" class="field-label form-control" value="{$column->getLabel()|escape}">
77											<div class="input-group-append">
78												<button type="button" class="btn btn-light dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
79													<span class="align">{$column->getDisplayAlign()|ucfirst|tra}</span>
80													<input class="display-align" type="hidden" value="{$column->getDisplayAlign()|escape}">
81												</button>
82												<div class="dropdown-menu dropdown-menu-right" role="menu">
83													<a class="dropdown-item align-option" href="#left">{tr}Left{/tr}</a>
84													<a class="dropdown-item align-option" href="#center">{tr}Center{/tr}</a>
85													<a class="dropdown-item align-option" href="#right">{tr}Right{/tr}</a>
86													<a class="dropdown-item align-option" href="#justify">{tr}Justify{/tr}</a>
87												</div>
88											</div>
89										</div>
90									</td>
91									<td>
92										<a href="{service controller=tabular action=select trackerId=$trackerId permName=$column->getField()
93												columnIndex=$column@index mode=$column->getMode()}"
94										   		class="btn btn-sm btn-secondary add-field tips"
95												title="{tr}Field{/tr} {$column->getField()|escape}|{tr}Mode:{/tr} {$column->getMode()|escape}">
96											<span class="field d-none">{$column->getField()|escape}</span>:
97											<span class="mode">{$column->getMode()|escape}</span>
98										</a>
99									</td>
100									<td><input class="primary" type="radio" name="pk" {if $column->isPrimaryKey()} checked {/if}></td>
101									<td><input class="unique-key" type="checkbox" {if $column->isUniqueKey()} checked {/if}></td>
102									<td><input class="read-only" type="checkbox" {if $column->isReadOnly()} checked {/if}></td>
103									<td><input class="export-only" type="checkbox" {if $column->isExportOnly()} checked {/if}></td>
104									<td class="text-right"><button class="remove btn-sm btn-outline-warning">{icon name=remove}</button></td>
105								</tr>
106							{/foreach}
107						</tbody>
108						<tfoot>
109							<tr>
110								<td>
111									<select class="selection form-control">
112										<option disabled="disabled" selected="selected">{tr}Select a field...{/tr}</option>
113										{foreach $schema->getAvailableFields() as $permName => $label}
114											<option value="{$permName|escape}">{$label|escape}</option>
115										{/foreach}
116									</select>
117								</td>
118								<td>
119									<a href="{service controller=tabular action=select trackerId=$trackerId}" class="btn btn-secondary add-field">{tr}Select Mode{/tr}</a>
120									<textarea name="fields" class="d-none">{$schema->getFormatDescriptor()|json_encode}</textarea>
121								</td>
122								<td colspan="3">
123									<div class="radio">
124										<label>
125											<input class="primary" type="radio" name="pk" {if ! $schema->getPrimaryKey()} checked {/if}>
126											{tr}No primary key{/tr}
127										</label>
128									</div>
129								</td>
130							</tr>
131						</tfoot>
132					</table>
133					<div class="form-text">
134						<p><strong>{tr}Primary Key:{/tr}</strong> {tr}Required to import data. Can be any field as long as it is unique.{/tr}</p>
135						<p><strong>{tr}Unique Key:{/tr}</strong> {tr}Impose unique value requirement for the target column. This only works with Transactional Import feature.{/tr}</p>
136						<p><strong>{tr}Read-only:{/tr}</strong> {tr}When importing a file, read-only fields will be skipped, preventing them from being modified, but also speeding-up the process.{/tr}</p>
137						<p>{tr}When two fields affecting the same value are included in the format, such as the ID and the text value for an Item Link field, one of the two fields must be marked as read-only to prevent a conflict.{/tr}</p>
138					</div>
139				</div>
140			</div>
141			<div class="form-group row submit">
142				<div class="col-sm-10 offset-sm-2">
143					<input type="submit" class="btn btn-primary" value="{tr}Update{/tr}">
144				</div>
145			</div>
146			<div class="form-group row">
147				<label class="col-form-label col-sm-2">{tr}Filters{/tr}</label>
148				<div class="col-sm-10">
149					<table class="table filters">
150						<thead>
151							<tr>
152								<th>{tr}Field{/tr}</th>
153								<th>{tr}Mode{/tr}</th>
154								<th></th>
155							</tr>
156						</thead>
157						<tbody>
158							<tr class="d-none">
159								<td>
160									<div class="input-group input-group-sm">
161										<div class="input-group-prepend">
162											<span class="input-group-text">{icon name=sort}</span>
163										</div>
164										<input type="text" class="filter-label form-control" value="Label">
165										<div class="input-group-append">
166											<button type="button" class="btn btn-light dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
167												<span class="position-label">{tr}Default{/tr}</span>
168												<input class="position" type="hidden" value="default">
169											</button>
170											<div class="dropdown-menu dropdown-menu-right" role="menu">
171												<a class="dropdown-item position-option" href="#default">{tr}Default{/tr}</a>
172												<a class="dropdown-item position-option" href="#primary">{tr}Primary{/tr}</a>
173												<a class="dropdown-item position-option" href="#side">{tr}Side{/tr}</a>
174											</div>
175										</div>
176									</div>
177								</td>
178								<td><span class="field">Field Name</span>:<span class="mode">Mode</span></td>
179								<td class="text-right"><button class="remove btn-sm btn-outline-warning">{icon name=remove}</button></td>
180							</tr>
181							{foreach $filterCollection->getFilters() as $filter}
182								<tr>
183									<td>
184										<div class="input-group input-group-sm">
185											<div class="input-group-prepend">
186												<span class="input-group-text">{icon name=sort}</span>
187											</div>
188											<input type="text" class="field-label form-control" value="{$filter->getLabel()|escape}">
189											<div class="input-group-append">
190												<button type="button" class="btn btn-light dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
191													<span class="position-label">{$filter->getPosition()|ucfirst|tra}</span>
192													<input class="position" type="hidden" value="{$filter->getPosition()|escape}">
193												</button>
194												<div class="dropdown-menu dropdown-menu-right" role="menu">
195													<a class="dropdown-item position-option" href="#default">{tr}Default{/tr}</a>
196													<a class="dropdown-item position-option" href="#primary">{tr}Primary{/tr}</a>
197													<a class="dropdown-item position-option" href="#side">{tr}Side{/tr}</a>
198												</div>
199											</div>
200										</div>
201									</td>
202									<td><span class="field">{$filter->getField()|escape}</span>:<span class="mode">{$filter->getMode()|escape}</td>
203									<td class="text-right"><button class="remove btn-sm btn-outline-warning">{icon name=remove}</button></td>
204								</tr>
205							{/foreach}
206						</tbody>
207						<tfoot>
208							<tr>
209								<td>
210									<select class="selection form-control">
211										<option disabled="disabled" selected="selected">{tr}Select a field...{/tr}</option>
212										{foreach $filterCollection->getAvailableFields() as $permName => $label}
213											<option value="{$permName|escape}">{$label|escape}</option>
214										{/foreach}
215									</select>
216								</td>
217								<td>
218									<a href="{service controller=tabular action=select_filter trackerId=$trackerId}" class="btn btn-secondary add-filter">{tr}Select Mode{/tr}</a>
219									<textarea name="filters" class="d-none">{$filterCollection->getFilterDescriptor()|json_encode}</textarea>
220								</td>
221							</tr>
222						</tfoot>
223					</table>
224					<div class="form-text">
225						<p>{tr}Filters will be available in partial export menus.{/tr}</p>
226					</div>
227				</div>
228			</div>
229			<div class="form-group row submit">
230				<div class="col-sm-10 offset-sm-2">
231					<input type="submit" class="btn btn-primary" value="{tr}Update{/tr}">
232				</div>
233			</div>
234			<div class="form-group row mb-4">
235				<label class="col-form-label col-sm-2">{tr}Options{/tr}</label>
236				<div class="col-sm-5">
237					<div class="form-check">
238						<input type="checkbox" class="form-check-input" name="config[simple_headers]" value="1" {if $config['simple_headers']} checked {/if}>
239						<label class="form-check-label">{tr}Simple headers{/tr}</label>
240						<a class="tikihelp text-info" title="{tr}Simple headers{/tr}: {tr}Allow using field labels only as a header row when importing rather than the full &quot;Field [permName:type]&quot; format.{/tr}">
241							{icon name=information}
242						</a>
243					</div>
244					<div class="form-check">
245						<input type="checkbox" class="form-check-input" name="config[import_update]" value="1" {if $config['import_update']} checked {/if}>
246						<label class="form-check-label">{tr}Import updates{/tr}</label>
247						<a class="tikihelp text-info" title="{tr}Import update{/tr}: {tr}Allow updating existing entries matched by PK when importing. If this is disabled, only new items will be imported.{/tr}">
248							{icon name=information}
249						</a>
250					</div>
251					<div class="form-check">
252						<input type="checkbox" class="form-check-input" name="config[ignore_blanks]" value="1" {if $config['ignore_blanks']} checked {/if}>
253						<label class="form-check-label">{tr}Ignore blanks{/tr}</label>
254						<a class="tikihelp text-info" title="{tr}Ignore blanks{/tr}: {tr}Ignore blank values when import is updating existing items. Only non-blank values will be updated this way.{/tr}">
255							{icon name=information}
256						</a>
257					</div>
258				</div>
259				<div class="col-sm-5">
260					<div class="form-check">
261						<input type="checkbox" class="form-check-input" name="config[import_transaction]" value="1" {if $config['import_transaction']} checked {/if}>
262						<label class="form-check-label">{tr}Transactional import{/tr}</label>
263						<a class="tikihelp text-info" title="{tr}Import transaction{/tr}: {tr}Import in a single transaction. If any of the items fails validation, the whole import is rejected and nothing is saved.{/tr}">
264							{icon name=information}
265						</a>
266					</div>
267					<div class="form-check">
268						<input type="checkbox" class="form-check-input" name="config[bulk_import]" value="1" {if $config['bulk_import']} checked {/if}>
269						<label class="form-check-label">{tr}Bulk import{/tr}</label>
270						<a class="tikihelp text-info" title="{tr}Bulk Import{/tr}: {tr}Import in 'bulk' mode so the search index is not updated for each item and no notifications should be sent.{/tr}">
271							{icon name=information}
272						</a>
273					</div>
274					<div class="form-check">
275						<input type="checkbox" class="form-check-input" name="config[skip_unmodified]" value="1" {if $config['skip_unmodified']} checked {/if}>
276						<label class="form-check-label">{tr}Skip Unmodified{/tr}</label>
277						<a class="tikihelp text-info" title="{tr}Skip Unmodified{/tr}: {tr}Will not re-import items that have not changed.{/tr}">
278							{icon name=information}
279						</a>
280					</div>
281				</div>
282			</div>
283			<div class="form-group row submit">
284				<div class="col-sm-10 offset-sm-2">
285					<input type="submit" class="btn btn-primary" value="{tr}Update{/tr}">
286				</div>
287			</div>
288		</form>
289	</div>
290{/block}
291