<vn-crud-model
    vn-id="model"
    url="/item/api/ItemBarcodes"
    fields="['id', 'itemFk', 'code']"
    link="{itemFk: $ctrl.$stateParams.id}"
    data="barcodes"
    auto-load="true">
</vn-crud-model>
<vn-watcher
    vn-id="watcher"
    data="barcodes"
    form="form">
</vn-watcher>
<form name="form" ng-submit="$ctrl.onSubmit()" compact>
    <vn-card pad-large>
        <vn-horizontal ng-repeat="barcode in barcodes track by $index">
            <vn-textfield
                vn-three
                label="Code"
                model="barcode.code"
                vn-acl="buyer, replenisher"
                vn-focus>
            </vn-textfield>
            <vn-none>
                <vn-icon-button
                    vn-acl="buyer,replenisher"
                    pointer
                    vn-tooltip="Remove barcode"
                    icon="delete"
                    ng-click="model.remove($index)">
                </vn-icon-button>
            </vn-none>
        </vn-horizontal>
        <vn-one>
            <vn-icon-button
                vn-acl="buyer, replenisher"
                vn-tooltip="Add barcode"
                vn-bind="+"
                icon="add_circle"
                ng-click="model.insert()">
            </vn-icon-button>
        </vn-one>
    </vn-card>
    <vn-button-bar>
        <vn-submit label="Save"></vn-submit>
    </vn-button-bar>
</form>