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

@section('content')
	<div class="row" ng-controller="AdminGamificationCtrl" 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">
						Gamification 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="{'fa fa-check': !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="{'fa fa-times': !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="fa fa-check-circle"></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">Pound to point ratio:</label>
							<div class="col-sm-9">
								<input type="text" ng-model="data.ratio" name="ratio" class="form-control" placeholder="How much is a pound worth in points?" required>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label label-required">Points awarded per minute:</label>
							<div class="col-sm-9">
								<input type="text" ng-model="data.points_per_minute" name="points_per_minute" class="form-control" placeholder="How much is a minute worth in points?" required>
							</div>
						</div>


						<div class="text-right form-actions">
							<span ng-init="post_url = '{!! URL::route('admin.settings.gamification.store') !!}'"></span>
							<button type="submit" class="btn btn-primary" ng-disabled="saving"><i ng-class="{'fa fa-spinner fa-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="fa fa-info-circle"></i> Help</p>
					<p style="text-align: justify;">Here you can setup the Gamification options. Gamification allows users to receive points for the tasks they complete within the system.</p>
					<p>This module can be disabled completely if not required.</p>
				</div>
			</div>
		</div>
	</div>
@stop