<mg-ajax path="/ticket/api/TicketRequests" options="vnPost"></mg-ajax>
<vn-watcher
    vn-id="watcher"
    data="$ctrl.ticketRequest"
    form="form"
    save="post">
</vn-watcher>
<form name="form" ng-submit="$ctrl.onSubmit()" margin-medium>
    <div compact>
        <vn-card pad-large>
            <vn-horizontal>
                <vn-textfield vn-one label="Description" field="$ctrl.ticketRequest.description" vn-focus></vn-textfield>
                <vn-autocomplete 
                    vn-one
                    field="$ctrl.ticketRequest.atenderFk"
                    url="/client/api/Clients/activeWorkersWithRole"
                    show-field="nickname"
                    search-function="{firstName: $search}"
                    value-field="id"
                    where="{role: 'buyer'}"
                    label="Buyer">
                </vn-autocomplete>
            </vn-horizontal>
            <vn-horizontal>
                <vn-input-number vn-one min="1" 
                    label="Quantity" 
                    field="$ctrl.ticketRequest.quantity">
                </vn-input-number>
                <vn-input-number vn-one min="0" 
                    label="Price"
                    step="0.01"
                    field="$ctrl.ticketRequest.price">
                </vn-input-number>
            </vn-horizontal>
        </vn-card>
        <vn-button-bar>
            <vn-submit label="Create"></vn-submit>
            <vn-button ui-sref="ticket.card.request.index" label="Cancel"></vn-button>
        </vn-button-bar>
    </div>
</form>