<script type="text/ng-template" id="sendByEmailAttachmentsModal.html">
	<form name="form" class="form-horizontal" ng-submit="_send(message)" novalidate>
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true" ng-click="cancel()">
				<i class="ti ti-close"></i>
			</button>
			<h4 class="modal-title">Send By Email</h4>
		</div>
		<div class="modal-body">
			<p>Fields with <span style="color: #cc0000;">*</span> are required.</p>
			<div class="form-group">
				<label for="email" class="col-sm-2 control-label">Email <span style="color: #cc0000;">*</span></label>
				<div class="col-sm-9">
					<input type="email" class="form-control" name="email" id="email" ng-model="message.email" ng-required="true">
					<p class="help-block" ng-show="form.email.$touched && form.email.$error.required">Value is required.</p>
					<p class="help-block" ng-show="form.email.$touched && form.email.$error.email">Invalid email.</p>
				</div>
			</div>
			<div class="form-group">
				<label for="subject" class="col-sm-2 control-label">Subject <span style="color: #cc0000;">*</span></label>
				<div class="col-sm-9">
					<input type="text" class="form-control" name="subject" id="subject" ng-model="message.subject" ng-required="true" ng-minlength="3">
					<p class="help-block" ng-show="form.subject.$touched && form.subject.$error.required">Value is required.</p>
					<p class="help-block" ng-show="form.subject.$touched && form.subject.$error.minlength">Value is too short.</p>
				</div>
			</div>
			<div class="form-group">
				<label for="description" class="col-sm-2 control-label">Message <span style="color: #cc0000;">*</span></label>
				<div class="col-sm-9">
					<textarea ck-editor-routely-directive name="description" id="description" ng-model="message.description" ng-required="true"></textarea>
					<p class="help-block" ng-show="form.description.$touched && form.description.$error.required">Value is required.</p>
					<p class="help-block" ng-show="form.description.$touched && form.description.$error.minlength">Value is too short.</p>
				</div>
			</div>
			<div class="form-group">
				<label for="attachments" class="col-sm-2 control-label"></label>
				<div class="col-sm-9">
					<a class="btn btn-sm btn-info" title="New Attachment" ngf-multiple="false" ngf-select="_uploadFile($file)" ngf-max-size="10MB" ngf-pattern="'image/*,.pdf,.doc,.docx,.xls,.xlsx'" ngf-accept="'image/*,.pdf,.doc,.docx,.xls,.xlsx'" ngf-model-invalid="invalidFiles">+ New Attachment</a>
					<p ng-if="invalidFiles" style="color: #cc0000">Invalid File. Only Files (Images, .PDF, .DOC, .DOCX, .XLS, .XLSX) up to 10MB.</p>
				</div>
			</div>
			<div class="form-group" ng-if="_attachments.length">
				<label for="attachments" class="col-sm-2 control-label">Attachments <span style="color: #cc0000;">*</span></label>
				<div class="col-sm-9">
					<table class="table table-bordered">
						<tbody>
							<tr ng-repeat="attachment in _attachments">
								<td><a href="{{attachment.url}}" target="_blank">{{attachment.name}}</a></td>
								<td class="text-center"><a class="btn btn-sm btn-danger" ng-click="_removeFile(attachment.name)" title="Remove">Remove</a></td>
							</tr>
						</tbody>
					</table>
				</div>
			</div>
		</div>
		<div class="modal-footer">
			<a class="btn btn-danger" ng-click="cancel()">
				<i class="ti ti-close" style="margin-right: 5px;"></i>
				Cancel
			</a>
			<button type="submit" ng-disabled="!form.$valid || !_attachments.length" class="btn-primary btn">
				<i class="ti ti-share" style="margin-right: 5px;"></i>
				Send
			</button>
		</div>
	</form>
</script>