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

81 lines
2.6 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"
on-change="$ctrl.getAvailableAgencies()"
selection="$ctrl.selection"
fields="['defaultAddressFk']">
<tpl-item>{{::id}}: {{::name}}</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">
<tpl-item>{{::nickname}}</tpl-item>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-date-picker
vn-one
label="Landed"
ng-model="$ctrl.order.landed"
on-change="$ctrl.getAvailableAgencies()">
</vn-date-picker>
<vn-autocomplete
disabled="!$ctrl.order.clientFk || !$ctrl.order.landed"
data="$ctrl._availableAgencies"
label="Agency"
show-field="agencyMode"
value-field="agencyModeFk"
ng-model="$ctrl.order.agencyModeFk">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-textarea
vn-one
label="Notes"
ng-model="$ctrl.order.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>