salix/modules/order/front/basic-data/index.html

89 lines
2.9 KiB
HTML

<mg-ajax path="Orders/{{patch.params.id}}/updateBasicData" options="vnPatch"></mg-ajax>
<vn-crud-model
autoload="true"
url="Addresses"
data="address"
order="nickname"
vn-id="address-model">
</vn-crud-model>
<vn-watcher
vn-id="watcher"
data="$ctrl.order"
form="form"
save="patch">
</vn-watcher>
<form name="form" ng-submit="watcher.submit()" class="vn-w-md">
<vn-card class="vn-pa-lg">
<vn-horizontal>
<vn-autocomplete
vn-one
url="Clients"
label="Client"
search-function="{or: [{id: $search}, {name: {like: '%'+ $search +'%'}}]}"
show-field="name"
value-field="id"
ng-model="$ctrl.order.clientFk"
vn-name="client"
selection="$ctrl.selection"
fields="['defaultAddressFk']">
<tpl-item>
<div>{{::name}}</div>
<div class="text-secondary text-caption">#{{::id}}</div>
</tpl-item>
</vn-autocomplete>
<vn-autocomplete
vn-one
fields="['id', 'nickname']"
data="address"
label="Address"
search-function="$search"
show-field="nickname"
value-field="id"
ng-model="$ctrl.order.addressFk"
vn-name="address"
on-change="$ctrl.getAvailableAgencies()">
<tpl-item>{{::nickname}}</tpl-item>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-date-picker
vn-one
label="Landed"
ng-model="$ctrl.order.landed"
vn-name="landed"
on-change="$ctrl.getAvailableAgencies()">
</vn-date-picker>
<vn-autocomplete
disabled="!$ctrl.order.addressFk || !$ctrl.order.landed"
data="$ctrl._availableAgencies"
label="Agency"
show-field="agencyMode"
value-field="agencyModeFk"
ng-model="$ctrl.order.agencyModeFk"
vn-name="agencyMode">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-textarea
vn-one
label="Notes"
ng-model="$ctrl.order.note"
vn-name="note"
rule>
</vn-textarea>
</vn-horizontal>
</vn-card>
<vn-button-bar>
<vn-submit
disabled="!watcher.dataChanged()"
label="Save">
</vn-submit>
<vn-button
class="cancel"
label="Undo changes"
disabled="!watcher.dataChanged()"
ng-click="watcher.loadOriginalData()">
</vn-button>
</vn-button-bar>
</form>