<script type="text/template" id="folder_item_template_thumb">
	<div class="documentItem documentFolder">
		<div class="documentDetails">
			<div class="form-check">
				<input class="form-check-input position-static" type="checkbox" name="selected_doc" value="{{=type}} {{=obj_id}}" aria-label="{{-title}}"/>
			</div>
			<a href="#list/{{-id}}" title="${documents:docs_list_item:open_folder.title} - {{-title}}" class="documentLink documentTitle">
				<ion-icon class="m-auto" name="folder-outline"></ion-icon>
				{{- title }}{{=perm_string}}
			</a>
		</div>
	</div>
</script>


<script type="text/template" id="document_item_template_thumb">
	<div class="documentItem documentDoc">
		<div class="documentDetails">
			<div class="form-check">
				<input class="form-check-input position-static" type="checkbox" name="selected_doc" value="{{=type}} {{=obj_id}}" aria-label="{{-title}}"/>
			</div>

            {{ if (is_error) { }}
                <a rel="tooltip" data-original-title="${documents:docs_list_item:document_error.title}" data-placement="bottom" class="documentLink documentTitle text-danger">
			{{ } else if (dms_options.cfg_docs_list_opens_details) { }}
				<a href="{{-parent_id}}/{{-doc_id}}" title="${documents:docs_list_item:document_details.title} - {{-title}}" class="documentLink documentTitle">
			{{ } else { }}
				<a target="_blank" href="/intranet/documents/{{-parent_id}}/{{-doc_id}}/{{=encodeURIComponent(pc_title)}}" title="{{-title}}" class="documentLink documentTitle">
			{{ } }}

				{{ if (doc_type=='standard') { }}
				    <img src="/intranet/documents/{{-parent_id}}/{{-doc_id}}/{{=encodeURIComponent(pc_title)}}?format=thumb&amp;width=64&amp;height=64" alt="" />
				{{ } else if (doc_type=='gdoc_link') { }}
				    <img src="/intranet/documents/images/types_large/google.gif" alt="" />
				{{ } else if (doc_type=='onedrive_link') { }}
				<img src="/intranet/documents/images/types_large/onedrive.gif" alt="" />
                {{ } else if (doc_type=='link') { }}
                    <img src="/intranet/documents/images/types_large/link.gif" alt="" />
                {{ } else { }}
				    <img src="/intranet/documents/images/types_large/marker.gif" alt="" />
				{{ } }}
				{{-title}}{{=perm_string}}

            {{ if (is_error) { }}
                </a>
			{{ } else if (dms_options.cfg_docs_list_opens_details) { }}
				</a>
			{{ } else { }}
				</a>
			{{ } }}
		</div>
	</div>
</script>

<script type="text/template" id="folder_item_template">
	<div class="documentItem documentFolder">
		<div class="documentDetails d-flex justify-content-between align-items-center">
			<div class="documentContainer form-check">
				<input class="form-check-input mr-2" type="checkbox" name="selected_doc" value="{{=type}} {{=obj_id}}" aria-label="{{-title}}"/>
				<label class="form-check-label d-flex">
				  {{ if (is_bookmarked) { }}
				  <a href="#" onclick="bookmarks.removeBookmarkUI('{{=type}}', {{=id}}); return false" class="documentBookmark mr-1">
					<ion-icon class="documentBookmarked icon-md align-top" name="star"></ion-icon>
				  </a>
				  {{ } else { }}
				  <a href="#" onclick="bookmarks.addBookmarkUI('{{=type}}', {{=id}}); return false"  class="documentBookmark mr-1">
					<ion-icon class="icon-md align-top" name="star-outline"></ion-icon>
				  </a>
				  {{ } }}
			  
				  <a href="#list/{{-id}}" title="${documents:docs_list_item:open_folder.title} - {{-title}}" class="documentLink documentTitle text-truncate">
					<ion-icon class="icon-md align-top" name="folder-outline"></ion-icon>
					{{- title }}{{=perm_string}}
				  </a>
				</label>
			</div>

			<div class="documentMenu d-flex ml-auto">
				<button class="btn btn-secondary document-btn mx-1">
					<ion-icon name="ellipsis-vertical"></ion-icon>
				</button>

				<ul class="dropdown-menu dropdown-menu-right">
				</ul>
			</div>
		</div>

		<small>{{-(metadata.description!==undefined && metadata.description!==null ? metadata.description : '')}}</small>

		<ul class="documentData">
			<li class="ml-0">
				<span name="documents:item:last_modified">Last Modified:</span>
				{{-(date_last_modified ? date_last_modified.date_str : '')}}
			</li>
		</ul>
	</div>
</script>

<script type="text/template" id="document_item_template">
	<div class="documentItem documentDoc">
		<div class="documentDetails d-flex justify-content-between align-items-center">
			<input class="mr-2" type="checkbox" name="selected_doc" value="{{=type}} {{=obj_id}}" aria-label="{{-title}}"/>

			{{ if (is_bookmarked) { }}
			<a href="#" onclick="bookmarks.removeBookmarkUI('{{=type}}', {{=doc_id}}); return false" class="documentBookmark">
				<ion-icon class="documentBookmarked align-middle" name="star"></ion-icon>
			</a>
			{{ } else { }}
			<a href="#" onclick="bookmarks.addBookmarkUI('{{=type}}', {{=doc_id}}); return false" class="documentBookmark mr-1">
				<ion-icon class="align-middle" name="star-outline"></ion-icon>
			</a>
			{{ } }}

			{{ if (is_error) { }}
			<a rel="tooltip" data-original-title="${documents:docs_list_item:document_error.title}" data-placement="top" class="documentLink documentTitle text-danger"><span class="{{- icon }}"></span>
				{{-title}}{{=perm_string}}</a>
			{{ } else if (dms_options.cfg_docs_list_opens_details) { }}
			<a href="{{-parent_id}}/{{-doc_id}}" title="${documents:docs_list_item:document_details.title} - {{-title}}" class="text-truncate">
				<span class="{{- icon }}"></span>
				{{-title}}{{=perm_string}}</a>
			{{ } else { }}
			<a target="_blank" href="/intranet/documents/{{-parent_id}}/{{-doc_id}}/{{=encodeURIComponent(pc_title)}}" title="{{-title}}" class="documentLink documentTitle">
				<span class="{{- icon }}"></span>
				{{-title}}{{=perm_string}}</a>
			{{ } }}

			<div class="documentMenu d-flex ml-auto">
				<button class="btn btn-secondary document-btn mx-1">
					<ion-icon name="ellipsis-vertical"></ion-icon>
				</button>

				<ul class="dropdown-menu dropdown-menu-right">
				</ul>
			</div>
		</div>

		<div>
			{{ if (!dms_options.cfg_docs_metadata_list_view_is_text || dms_options.cfg_docs_metadata_list_view === '')  { }}
			<small>{{-(metadata.description!==undefined && metadata.description!==null ? metadata.description : '')}}</small>
			{{ } else { }}
			<small> {{-(metadata[dms_options.cfg_docs_metadata_list_view] !== '' ? metadata[dms_options.cfg_docs_metadata_list_view] : metadata.description)}}</small>
			{{ } }}
		</div>

		<ul class="documentData">
			<li class="ml-0">
				<span name="documents:data:last_modified">Last Modified:</span>
				{{-(date_last_modified ? date_last_modified.date_str : '')}}
			</li>
			{{ if (!is_doc_type_link && doc_type != 'gdoc_link' && doc_type != 'marker') { }}
			{{ if (fsize) { }}
			<li>
				<span name="documents:details:filesize">Filesize:</span>
				{{-fsize}}
			</li>
			{{ } }}
			<li>
				<span name="documents:details:version">Version:</span>
				{{=version_num}}
			</li>
			{{ } }}
		</ul>
	</div>
</script>

<script type="text/template" id="empty_item_template">
	<div class="documentItem documentFolder">
		<div class="documentDetails">
			<input type="checkbox" disabled="1" aria-label="{{-title}}"/>

			<a href="#" onclick="return false" class="documentBookmark">
				<ion-icon name="star-outline"></ion-icon>
			</a>

			<a href="#" onclick="return false" title="{{-title}}" class="documentLink documentTitle">
				<ion-icon class="m-auto" name="folder-outline"></ion-icon>
				{{- title }}
			</a>
			<small>{{-metadata.description}}</small>
		</div>
	</div>
</script>
