<div class="view-document">
	<div class="document-customfields">

	     <div class="row {{if (eq selectedCategories.length 0) 'd-print-none'}}">
			<div class="col-12 col-sm-3 heading">Categories</div>
			<div class="col-12 col-sm-9 value">
				{{#each selectedCategories as |cat|}}
					{{#link-to 'folder' folder.id folder.slug (query-params category=cat.id)}}
						{{cat.category}}
					{{/link-to}}
					&nbsp;
				{{else}}
					{{#if canAddCategory}}
						{{#if canSelectCategory}}
							<a href="#" class="d-print-none" {{action 'onShowCategoryModal'}}>&lt;select&gt;</a>
						{{else}}
							{{#link-to 'folder.category' folder.id folder.slug class='d-print-none'}}&lt;manage&gt;{{/link-to}}
						{{/if}}
					{{/if}}
				{{/each}}
				{{#if canSelectCategory}}
					<div class="action-button button-icon-gray button-icon-small align-middle d-print-none" {{action 'onShowCategoryModal'}}>
						<i class="material-icons align-middle">edit</i>
					</div>
				{{/if}}
			</div>
		</div>

		<div class="row {{if (eq tagz.length 0) 'd-print-none'}}">
			<div class="col-12 col-sm-3 heading">Tags</div>
			<div class="col-12 col-sm-9 value">
				{{#each tagz as |t index|}}
					{{#link-to 'search' (query-params filter=t matchTag=true matchDoc=false matchContent=false matchFile=false)}}
						{{concat '#' t}}
					{{/link-to}}&nbsp;&nbsp;
				{{/each}}
				{{#if permissions.documentEdit}}
					<div class="action-button button-icon-gray button-icon-small align-middle d-print-none" data-toggle="modal" data-target="#document-tags-modal" data-backdrop="static">
						<i class="material-icons align-middle">edit</i>
					</div>
				{{/if}}
			</div>
		</div>

		<div class="row d-print-none">
			<div class="col-12 col-sm-3 heading">Change Control</div>
			<div class="col-12 col-sm-9 value-static">
				<span>{{changeControlMsg}}</span>
			</div>
		</div>

		{{#if (eq document.protection constants.ProtectionType.Review)}}
			<div class="row d-print-none">
				<div class="col-12 col-sm-3 heading">Approval Process</div>
				<div class="col-12 col-sm-9 value-static">
					<span>{{approvalMsg}}</span>
				</div>
			</div>

			{{#if userChanges}}
				<div class="row d-print-none">
					<div class="col-12 col-sm-3 heading">Your Contributions</div>
					<div class="col-12 col-sm-9 value-static">
						<span>{{contributorMsg}}</span>
					</div>
				</div>
			{{/if}}

			{{#if isApprover}}
				<div class="row d-print-none">
					<div class="col-12 col-sm-3 heading">Approver Status</div>
					<div class="col-12 col-sm-9 value-static">
						<span>{{approverMsg}}</span>
					</div>
				</div>
			{{/if}}
		{{/if}}
	</div>
</div>

{{#if permissions.documentEdit}}
	{{#ui/ui-dialog title="Document Categories" confirmCaption="Select" buttonType="btn-success" show=showCategoryModal onAction=(action 'onSaveCategory')}}
		<p>Select who can view documents within category</p>
		{{ui/ui-list-picker items=categories nameField='category' singleSelect=false}}
	{{/ui/ui-dialog}}

	<div id="document-tags-modal" class="modal" tabindex="-1" role="dialog">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">Document Tags</div>
				<div class="modal-body">
					<form onsubmit={{action 'onAddTag'}}>
						<div class="form-group">
							<label for="add-tag-field">Specify up to three tags per document</label>
							{{#each tagzEdit as |t|}}
								<div class="m-3 text-secondary">
									<div class="button-icon-danger button-icon-small align-middle" {{action 'onRemoveTag' t}}>
										<i class="material-icons">clear</i>
									</div>
									{{concat '#' t}}
								</div>
							{{/each}}
							{{focus-input type='text' id="add-tag-field" class="form-control mousetrap" placeholder="Tag name" value=newTag}}
							<small class="form-text text-success">Press ENTER to add tag</small>
							<small class="form-text text-muted">Lowercase, characters, numbers, hyphens only</small>
						</div>
					</form>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
					<button type="button" class="btn btn-success" onclick={{action 'onSaveTags'}}>Save</button>
				</div>
			</div>
		</div>
	</div>
{{/if}}
