<?php $__env->startSection('content'); ?>
<div class="panel panel-default">
    <div class="panel-heading">Billing services</div>
    

    <div class="panel-body">
    	<a target="_blank" class="btn btn-primary" href="<?php echo e(route('billing-services.create')); ?>">Add new billing service</a>
       	<form method="post" action="<?php echo e(route('billing-services.search')); ?>"  >
	    <input type="hidden" value="<?php echo e(csrf_token()); ?>" name="_token" />
	        <div class="form-group">
	            <label for="title">Search billing service by description, reference or customer:</label>
	            <input type="text" class="form-control" name="search" v/>
	        </div>
	         <button type="submit" class="btn btn-primary">search</button>
	     </form>

        <table class="table">
        <thead>
        	<tr>
        		<th>customer</th>
        		<th>reference</th>
        		<th>service</th>
        		<th>fee</th>
        		<th>billing period</th>
        		<th>next billed</th>        		
        		<th></th>
        	</tr>
        </thead>
			<?php $__currentLoopData = $billingServices; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $service): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
				<tr <?php if( $service->canseled_date != null ): ?> style="background-color: #f8d7da;"  <?php elseif( $service->do_not_bill == 1 ): ?> style="background-color: #b8daff;"  <?php endif; ?>>
					<td>
						<?php if( $service->customer_id == 0 ): ?>
						<div style="color: red">Not linked to customer</div>
						<?php else: ?>
						<div style="color: green"><?php echo e($service->customer->xero_name); ?></div>
						<?php endif; ?>
					</td>
					<td>
						<?php echo e($service->service_ref); ?>

					</td>
					<td>
						<a target="_blank" href="<?php echo e(route('billing-services.show',$service->id)); ?>"><?php echo e($service->description); ?></a>
					</td>
					<td>
						<?php echo e($service->fee); ?>

					</td>
					<td>
						<?php if( $service->renew == 1 ): ?> Monthly  <?php endif; ?>
						<?php if( $service->renew == 2 ): ?> Quarterly  <?php endif; ?>
						<?php if( $service->renew == 3 ): ?> Annually  <?php endif; ?>
					</td>
					<td>
						<?php echo e($service->next_billed); ?>

					</td>
					
					
					
					<td>
						<a  class="btn btn-primary" href="<?php echo e(route('billing-services.edit',$service->id)); ?>">Edit</a>
					</td>
					
				</tr>
			<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
		</table>

		<?php echo $billingServices->render(); ?>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Users/joraleqyan/PhpstormProjects/xero/resources/views/billing_services/index.blade.php ENDPATH**/ ?>