@extends('layouts.app')

@section('content')
<div class="panel panel-default">
    <div class="panel-heading">create Billing service</div>


    <div class="panel-body">
        @if ($errors->any())
            <div class="alert alert-danger">
                <ul>
                    @foreach ($errors->all() as $error)
                        <li>{{ $error }}</li>
                    @endforeach
                </ul>
            </div><br />
        @endif
           <form method="post" class="create_billing_form" action="{{ route('billing-services.store')}}" >
            <input type="hidden" value="{{csrf_token()}}" name="_token" />
            <button type="submit" class="btn btn-primary">Save</button>
                <div class="form-group">
                    <label for="title">Customer:</label>
                    <select data-live-search="true" class="form-control" name="customer_id">
                        <option value="0">None</option>
                        @foreach($customers as $customer)
                            <option data-tokens="{{$customer->xero_name}}" value="{{$customer->id}}">{{$customer->xero_name}}</option>
                        @endforeach
                    </select>
                </div>
                 <div class="form-group">
                    <label for="title">Tax rate type :</label>
                    <select data-live-search="true" class="form-control" name="tax_type">
                         @foreach($xeroTaxes as $key => $rate)
                            <option <?php if( $key == 'OUTPUT2' ) { ?> selected <?php } ?> data-tokens="{{$rate}}" value="{{$key}}">{{$rate}}</option>
                        @endforeach
                    </select>
                </div>
                <div class="form-group">
                    <label for="title">service type (needed to generate reference number) :</label>
                    <select class="form-control" name="service_ref">
                        <option value="HS">Website Hosting Service</option>
                        <option value="ES">Email service</option>
                        <option value="AS" >Other</option>
                    </select>
                </div>

                <div class="form-group">
                    <label for="title">setup date (format yyyy-mm-dd) :</label>
                    <input type="text" class="form-control" name="setup_date" value="<?php echo date('Y-m-d') ?>"/>
                </div>
                <div class="form-group">
                    <label for="title">last billed date  (format yyyy-mm-dd) :</label>
                    <input type="text" class="form-control" name="last_billed" value=""/>
                </div>

                <div class="form-group">
                    <label for="title">next billed date  (format yyyy-mm-dd) :</label>
                    <input type="text" class="form-control" name="next_billed" value="<?php echo date('Y-m-d') ?>"/>
                </div>

                <div class="form-group">
                    <label for="title">cancelled date  (format yyyy-mm-dd) :</label>
                    <input type="text" class="form-control" name="canseled_date" value=""/>
                </div>

                <div class="form-group">
                    <label for="title">description :</label><br>
                    <input type="text" class="form-control" name="description" value=""/>
                </div>
                <div class="form-group">
                    <label for="title">do not bill :</label>
                    <input type="checkbox" value="1" class="" name="do_not_bill" />
                </div>
                <div class="form-group">
                    <label for="title">fee :</label>
                    <input type="text" class="form-control" name="fee" value=""/>
                </div>
                <div class="form-group">
                    <label for="title">renew :</label>
                    <select class="form-control" name="renew">
                        <option value="1">Monthly</option>
                        <option value="2">Quarterly</option>
                        <option value="3" >Annually</option>
                    </select>
                   
                </div>
                 <div class="form-group">
                    <label for="title">username :</label>
                    <input type="text" class="form-control" name="username" value=""/>
                </div>
                <div class="form-group">
                    <label for="title">password :</label>
                    <input type="text" class="form-control" name="password" value=""/>
                </div>
                <div class="form-group">
                    <label for="title">agreement :</label>
                    <textarea style="width:100%;height: 75px" name="agreement"></textarea>
                </div>
                 <div class="form-group">
                    <label for="title">notes :</label><br>
                    <textarea style="width:100%;height: 75px" name="notes"></textarea>
                </div>
               
                 <button type="submit" class="btn btn-primary">Save</button>
             </form>
    </div>
</div>
@endsection