<form action="" method="post">
	<div class="card">
		<div class="card-body">
			<p>
				<textarea name="addComment" id="addComment" class="form-control" rows="4" cols="30"></textarea>
			</p>
			<button type="submit" name="btnAddComment" id="btnAddComment" class="btn btn-secondary"><loc name="documents:details:add_comment">Add Comment</loc></button>
		</div>
	</div>
</form>

<div class="all-comments"></div>

<script type="text/template" id="comments_template">
	<div class="media" data-comment-id="{{=id}}">
		<a href="/intranet/people/viewprofile.php?id={{=creator_id}}" class="float-left"><img src="{{- creator_avatar }}" width="45" class="media-object" /></a>
		<div class="media-body">
			<a href="/intranet/people/viewprofile.php?id={{=creator_id}}"><strong>{{-creator}}</strong></a> <loc name="common:cla_comments:wrote">__wrote</loc>...
			<div>
				{{=body_html}}
			</div>

			<p class="text-muted">
				<small>
					<txt name="documents:details:version">Version</txt> {{-version}}
					{{ if (can_edit) { }}
						&bull; <a href="#" class="edit-comment"  data-comment-id="{{=id}}" name="documents:comments:details:edit">edit</a>
						&bull; <a href="#" class="delete-comment"  data-comment-id="{{=id}}" name="documents:comments:details:delete">delete</a>
					{{ } }}
					&bull; {{-date}}
				</small>
			</p>
		</div>
	</div>
</script>

<script type="text/template" id="comments_edit_template">
	<div class="media">
		<div class="float-left"><img src="{{- creator_avatar }}" width="45" class="media-object" /></div>

		<div class="media-body">
			<a href="/intranet/people/viewprofile.php?id={{=creator_id}}"><strong>{{-creator}}</strong></a> <loc name="common:cla_comments:wrote">wrote</loc>...

			<p>
				<textarea name="edit_comment" id="edit_comment" rows="4" cols="30" class="form-control">{{=body}}</textarea>
			</p>
			<a href="#" class="btn btn-primary" id="btnUpdateComment" data-comment-id="{{=id}}" name="documents:comments:details:save">Save</a>
			<a href="#" class="btn btn-secondary" id="btnCancelComment" name="documents:comments:details:cancel">Cancel</a>

			<p class="text-muted">
				<small>
					<txt name="documents:details:version">Version</txt> {{-version}}
					&bull; <a href="#" class="edit-comment"  data-comment-id="{{=id}}" name="documents:comments:details:edit">edit</a>
					&bull; <a href="#" class="delete-comment"  data-comment-id="{{=id}}" name="documents:comments:details:delete">delete</a>
					&bull; {{-date}}
				</small>
			</p>

		</div>
	</div>
</script>
