<div>


	{{-- this widget is re-used on tasks page and projects overview page --}}
	{{-- task is not in scope/ doesn't exist on the projects page --}}
	{{-- 2 ng-if statenenst looking at the task scope variable --}}


	{{-- tasks --}}
	<h3 ng-if="task != undefined"><i class="fa fa-flag ng-scope flagged" ng-if="ClientsManager.client.flagged == '1'"></i> <a href="{!! URL::to('clients') !!}#/{[{ task.client_type }]}/{[{ task.client_id }]}" ng-class="{ 'flagged' : ClientsManager.client.flagged == '1', 'not-flagged' : !(ClientsManager.client.flagged == '1')  }" title="Click to go to the customer page">{[{ ClientsManager.client.name || task.client.name }]} <small><i class="fa fa-external-link"></i></small></a></h3>

	{{-- projects  --}}
	<h3 ng-if="task == undefined"><i class="fa fa-flag ng-scope flagged" ng-if="ClientsManager.client.flagged == '1'"></i> <a href="{!! URL::to('clients') !!}#/{[{ ClientsManager.client.type }]}/{[{ ClientsManager.client.id }]}" ng-class="{ 'flagged' : ClientsManager.client.flagged == '1', 'not-flagged' : !(ClientsManager.client.flagged == '1')  }" title="Click to go to the customer page">{[{ ClientsManager.client.name }]}<small><i class="fa fa-external-link"></i></small></a></h3>
	<div class="buttons">
		<a href="https://maps.google.com/maps?saddr=OX42EA&daddr={[{ ClientsManager.getAddress(site).replace(' ', '+') }]}" target="_blank">
			<span class="btn btn-default"><i class="fa fa-map-marker"></i> Directions</span>
		</a>
		<span class="btn-group">
			<a class="btn btn-default dropdown-toggle" data-toggle="dropdown" href="#">
				<i class="fa fa-cog"></i> Tools <span class="caret"></span>
			</a>
			<ul class="dropdown-menu">
				<li><a href="#" tabindex="-1" ng-click="keychain()" data-eat-click>Passwords</a></li>
				<li><a href="#" tabindex="-1" ng-click="licenses()" data-eat-click>Licenses</a></li>
				@if(App\Models\Setting::get('integrations.twilio.enabled', false))
				<li><a href="#" tabindex="-1" ng-click="sms()" data-eat-click>Send Text</a></li>
				@endif
			</ul>
		</span>
		<a class="btn btn-default" ng-if="showNewBooking == 'true'" href="{!! URL::to('/bookings') !!}/#/bookings/customer/{[{ task != undefined ? task.client_id : ClientsManager.client.id }]}"><i class="fa fa-plus"></i> New booking</a>
		<span class="btn-group">
			<a href="#" class="btn btn-warning" ng-click="edit()" eat-click><i class="fa fa-pencil"></i> Edit</a>
			<button class="btn btn-warning dropdown-toggle" data-toggle="dropdown">
				<span class="caret"></span>
			</button>
			<ul class="dropdown-menu pull-right">
				<li ng-hide="ClientsManager.client.follow.id"><a href="#" tabindex="-1" ng-click="follow()" data-eat-click><i class="fa-fw fa fa-flag"></i> Follow</a></li>
				<li ng-show="ClientsManager.client.follow.id"><a href="#" tabindex="-1" ng-click="unfollow()" data-eat-click><i class="fa-fw fa fa-times"></i> Un-follow</a></li>
				<li ng-show="task.id"><a href="#" tabindex="-1" ng-click="changeClient()" eat-click><i class="fa-fw fa fa-exchange"></i> Change Client</a></li>
			</ul>
		</span>
	</div>
	<br>
	{{-- safe before edit --}}

	{{--<div class="row">--}}
		{{--<div ng-class="{'col-sm-7': site.id, 'col-sm-12': !site.id}">--}}
			{{--<ul class="list-unstyled" style="margin-left: 10px;">--}}
				{{--<li><strong>Address:</strong> {[{ ClientsManager.getAddress(site) }]}</li>--}}
				{{--<li ng-if="ClientsManager.data.phone.length > 0"><strong>Phone:</strong> <a href="#" ng-click="dial(ClientsManager.data.phone, 'phone')" ng-show="ClientsManager.data.phone" eat-click><i ng-class="{'fa fa-spinner fa-spin': dialer.animations['phone']}"></i> {[{ ClientsManager.data.phone }]}</a></li>--}}
				{{--<li ng-if="ClientsManager.data.phone2.length > 0"><strong>Work Phone:</strong> <a href="#" ng-click="ClientsManager.data.phone2, 'phone2')" eat-click><i ng-class="{'fa fa-spinner fa-spin': dialer.animations['phone2']}"></i> {[{ ClientsManager.data.phone2 }]}</a></li>--}}
				{{--<li ng-if="ClientsManager.data.mobile > 0"><strong>Mobile:</strong> <a href="#" ng-click="ClientsManager.data.mobile, 'mobile')" eat-click><i ng-class="{'fa fa-spinner fa-spin': dialer.animations['mobile']}"></i> {[{ ClientsManager.data.mobile }]}</a></li>--}}
				{{--<li><strong>E-mail:</strong> <a href="mailto:{[{ ClientsManager.data.email }]}">{[{ ClientsManager.data.email }]}</a></li>--}}
				{{--<li class="blind" ng-show="ClientsManager.client.blind_notes"><strong>Blind notes:</strong>  {[{ ClientsManager.client.blind_notes }]}</li>--}}
			{{--</ul>--}}

		{{--</div>--}}
		{{--<div ng-class="{'col-sm-5': site.id, 'col-sm-12': !site.id}" data-ng-show="site.id">--}}
			{{--<ul class="list-unstyled">--}}
				{{--<li><strong>Site:</strong> {[{ site.name }]}</li>--}}
				{{--<li><strong>User:</strong> {[{ site_user.name }]}</li>--}}
			{{--</ul>--}}
		{{--</div>--}}
	{{--</div>--}}
	{{----}}

	{{-- nadeem edit = fix blind notes half width when assigned without site.id --}}
	<div class="row">
		<div ng-class="{'col-sm-9': site.id, 'col-sm-12': !site.id}">
			<ul class="list-unstyled" style="margin-left: 10px;">
				<li><strong>Address:</strong> {[{ ClientsManager.getAddress(site) }]}</li>
				<li ng-if="ClientsManager.data.phone.length > 0"><strong>Phone:</strong> {[{ ClientsManager.data.phone }]} <button type="button" class="btn btn-success btn-xs" ng-click="makeCall(ClientsManager.data.phone, 'phone')" ng-disabled="callInProgress.phone"><i class="fa" ng-class="{'fa-spinner fa-spin': callInProgress.phone, 'fa-phone': !callInProgress.phone}"></i> Call</button> <button type="button" class="btn btn-info btn-xs" ng-if="task.status.name === 'Work Completed'" ng-click="sendCompletionSMS('phone')" ng-disabled="sendingSMS"><i class="fa" ng-class="{'fa-spinner fa-spin': sendingSMS, 'fa-comment': !sendingSMS}"></i> Send SMS</button></li>
				<li ng-if="ClientsManager.data.phone2.length > 0"><strong>Work Phone:</strong> {[{ ClientsManager.data.phone2 }]} <button type="button" class="btn btn-success btn-xs" ng-click="makeCall(ClientsManager.data.phone2, 'phone2')" ng-disabled="callInProgress.phone2"><i class="fa" ng-class="{'fa-spinner fa-spin': callInProgress.phone2, 'fa-phone': !callInProgress.phone2}"></i> Call</button> <button type="button" class="btn btn-info btn-xs" ng-if="task.status.name === 'Work Completed'" ng-click="sendCompletionSMS('phone2')" ng-disabled="sendingSMS"><i class="fa" ng-class="{'fa-spinner fa-spin': sendingSMS, 'fa-comment': !sendingSMS}"></i> Send SMS</button></li>
				<li ng-if="ClientsManager.data.mobile > 0"><strong>Mobile:</strong> {[{ ClientsManager.data.mobile }]} <button type="button" class="btn btn-info btn-xs" ng-click="makeCall(ClientsManager.data.mobile, 'mobile')" ng-disabled="callInProgress.mobile"><i class="fa" ng-class="{'fa-spinner fa-spin': callInProgress.mobile, 'fa-mobile': !callInProgress.mobile}"></i> Call</button> <button type="button" class="btn btn-info btn-xs" ng-if="task.status.name === 'Work Completed'" ng-click="sendCompletionSMS('mobile')" ng-disabled="sendingSMS"><i class="fa" ng-class="{'fa-spinner fa-spin': sendingSMS, 'fa-comment': !sendingSMS}"></i> Send SMS</button></li>
				<li><strong>E-mail:</strong> <a href="mailto:{[{ ClientsManager.data.email }]}">{[{ ClientsManager.data.email }]}</a> <button type="button" class="btn btn-primary btn-xs" ng-if="task.status.name === 'Work Completed'" ng-click="sendNotification()" ng-disabled="sendingNotification"><i class="fa" ng-class="{'fa-spinner fa-spin': sendingNotification, 'fa-envelope': !sendingNotification}"></i> Send Email</button></li>
				<li ng-if="task.points > 0"><strong>Points:</strong> {[{ task.points }]}</li>
			</ul>
		</div>
		<div ng-class="{'col-sm-3': site.id, 'col-sm-12': !site.id}" data-ng-show="site.id">
			<ul class="list-unstyled">
				<li><strong>Site:</strong> {[{ site.name }]}</li>
				<li><strong>User:</strong> {[{ site_user.name }]}</li>
			</ul>
		</div>
		<div class="col-sm-12">
			<ul class="list-unstyled">
				<li class="blind" ng-show="ClientsManager.client.blind_notes"><strong>Blind notes:</strong>  {[{ ClientsManager.client.blind_notes }]}</li>
			</ul>
		</div>

	</div>




	{{-- Templates --}}
	<script type="text/ng-template" id="bookings/modals/sms.html">
		@include('clients::templates.modals.sms')
	</script>
	<script type="text/ng-template" id="clients/modals/keychain.html">
		@include('clients::templates.modals.keychain')
	</script>
	<script type="text/ng-template" id="clients/modals/licenses.html">
		@include('clients::templates.modals.licenses')
	</script>
	<script type="text/ng-template" id="bookings/modals/email-customer.html">
		@include('bookings::templates.modals.email-customer')
	</script>

	@include('clients::change-client')
	@include('clients::edit-customer')
	@include('clients::edit-client')
</div>