<script type="text/ng-template" id="workflow/actions/send_email.html">
	<div class="row">
		<div class="col-sm-8">

			<div class="row">
				<div class="col-sm-5">
					<div>
						<label>Send to:</label>
						<input type="text" name="to" ng-model="action.settings.to" required>
					</div>

					<div>
						<label>CC:</label>
						<input type="text" name="cc" ng-model="action.settings.cc">
					</div>

					<div>
						<label>Subject</label>
						<input type="text" name="subject"  ng-model="action.settings.subject" required>
					</div>
				</div>

				<div class="col-sm-7">
					<label class="checkbox">
						<input type="checkbox" ng-model="action.settings.scheduled" ng-checked="action.settings.scheduled"> Schedule email for a date in the future
					</label>

					<div ng-show="action.settings.scheduled">
						<hr>
						<label>When would you like to send it?</label>
						<input type="text" ng-model="action.settings.scheduled_custom_date" datepicker-popup="dd-MM-yyyy" show-button-bar="false" show-weeks="false" ng-show="action.settings.scheduled_measurement == 'custom'">
						<select ng-model="action.settings.scheduled_unit" ng-options="o as o for o in [] | range:31:1" ng-hide="action.settings.scheduled_measurement == 'custom'"></select>
						<select ng-model="action.settings.scheduled_measurement" ng-options="o.v as o.t for o in [{v: 'days', t:' Days'}, {v: 'months', t: 'Months'}, {v: 'years', t: 'Years'}, {v: 'custom', t:'Custom Date'}]"></select>
						<br>
						<strong ng-show="action.settings.scheduled_measurement && action.settings.scheduled_unit && action.settings.scheduled_unit != 'custom'">Expected date: {[{ 0 | dateAddition:action.settings.scheduled_measurement:action.settings.scheduled_unit:"DD MMM YYYY" }]}</strong>
					</div>

				</div>
			</div>

			<div>
				<label>Email body</label>
				<textarea ng-model="action.settings.template" class="col-sm-12" rows="7" summernote summernote-height="200" required></textarea>
			</div>

		</div>

		<div class="col-sm-4">
			<div class="headline">
				<h4>Possible variables</h4>
			</div>
			<small>Note all variables must be placed within curly brackets, eg. <strong>{id}</strong></small>
			<ul class="inline">
				<li ng-repeat="attribute in attributes"><span class="label label-default">{[{attribute}]}</span></li>
				<li><span class="label label-danger">{client_email}</span></li>
				<li><span class="label label-danger">{client_name}</span></li>
			</ul>
		</div>
	</div>
</script>