@extends('layouts.master')

@section('header')
	@include('common.header')
@stop

@section('content')
	<div class="row" ng-controller="AdminCalendarCtrl" ng-init="data = {{{ json_encode($settings) }}}" ng-cloak>
		<div class="col-sm-8">
			<div class="widget widget-classic">
				<div class="widget-content">

					<!-- Page title -->
					<p class="lead">
						Exchange Calendar Settings

						<!-- Enabled button -->
						<span ng-if="data.enabled" ng-click="disable()" class="btn pull-right" ng-class="{'btn-danger': show_disable_text, 'btn-success': !show_disable_text}" ng-mouseenter="show_disable_text = true" ng-mouseleave="show_disable_text = false"><i ng-class="{'icon-ok': !show_disable_text}"></i> {[{ show_disable_text ? 'Click to disable' : 'Enabled' }]}</span>

						<!-- Disabled button -->
						<span ng-if="!data.enabled" ng-click="enable()" class="btn pull-right" ng-class="{'btn-success': show_enable_text, 'btn-danger': !show_enable_text}" ng-mouseenter="show_enable_text = true" ng-mouseleave="show_enable_text = false"><i ng-class="{'icon-remove': !show_enable_text}"></i> {[{ show_enable_text ? 'Click to enable' : 'Disabled' }]}</span>
					</p>


					<!-- Alerts and error messages -->
					<div class="alert alert-success" ng-if="success">
						<i class="icon-ok-sign"></i> Your changes were saved successfully.
					</div>
					<div class="alert alert-danger" ng-if="error_message">
						Ooops, something went wrong. {[{ error_message }]}
					</div>

					<form name="SettingsForm" class="form-horizontal form-edit" ng-submit="save()">

						<!-- Include form fields -->
						<div class="form-group">
							<label class="col-sm-3 control-label label-required">Server Address:</label>
							<div class="col-sm-9">
								<input type="text" ng-model="data.server" name="server" class="form-control" placeholder="IP Address or Hostname" required>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label label-required">Username:</label>
							<div class="col-sm-9">
								<input type="text" ng-model="data.username" name="username" class="form-control" placeholder="Example: administrator" required>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label label-required">Password:</label>
							<div class="col-sm-9">
								<input type="password" ng-model="data.password" name="password" class="form-control" required>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label label-required">Version:</label>
							<div class="col-sm-9">
								<select name="version" class="form-control" ng-model="data.version">
									<option value="Exchange2007">Exchange 2007</option>
									<option value="Exchange2007_SP1">Exchange2007 SP1</option>
									<option value="Exchange2007_SP2">Exchange2007 SP2</option>
									<option value="Exchange2007_SP3">Exchange2007 SP3</option>
									<option value="Exchange2010">Exchange 2010</option>
									<option value="Exchange2010_SP1">Exchange2010 SP1</option>
								</select>
							</div>
						</div>

						<div class="text-right form-actions">
							<span ng-init="post_url = '{{ URL::route('admin.settings.calendar.store') }}'"></span>
							<button type="submit" class="btn btn-primary" ng-disabled="saving"><i ng-class="{'icon-spinner icon-spin': saving}"></i> Save changes</button>
							<a href="{{ URL::to('admin') }}" class="btn btn-default">Cancel</a>
						</div>
					</form>

				</div>
			</div>
		</div>
		<div class="col-sm-4">
			<div class="widget widget-classic">
				<div class="widget-content">
					<p class="lead"><i class="icon-info-sign"></i> Help</p>
					<p style="text-align: justify;">This module allows you to connect to an exchange mailbox and use the calendar throughout the application. It can automatically sync Onsite jobs to the exchange calendar.</p>
				</div>
			</div>
		</div>
	</div>
@stop