salix/modules/client/front/sample/create/index.html

134 lines
4.2 KiB
HTML

<vn-crud-model
auto-load="true"
url="Companies"
data="companiesData"
order="code">
</vn-crud-model>
<vn-crud-model
auto-load="true"
url="Samples/visible"
fields="[
'id',
'code',
'description',
'model',
'hasCompany',
'hasAddress',
'hasPreview',
'datepickerEnabled'
]"
data="samplesVisible"
order="description">
</vn-crud-model>
<vn-watcher
vn-id="watcher"
url="ClientSamples"
data="$ctrl.clientSample"
insert-mode="true"
form="form">
</vn-watcher>
<vn-crud-model
auto-load="true"
url="Companies"
data="companiesData"
order="code">
</vn-crud-model>
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
<vn-card class="vn-pa-lg">
<vn-horizontal>
<vn-autocomplete
vn-id="sampleType"
ng-model="$ctrl.clientSample.typeFk"
model="ClientSample.typeFk"
data="samplesVisible"
show-field="description"
label="Sample"
required="true">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-textfield
label="Recipient"
ng-model="$ctrl.clientSample.recipient"
info="Its only used when sample is sent"
required="true">
</vn-textfield>
<vn-textfield
label="Reply to"
ng-model="$ctrl.clientSample.replyTo"
info="To who should the recipient reply?"
required="true">
</vn-textfield>
</vn-horizontal>
<vn-horizontal ng-if="sampleType.selection.hasCompany || sampleType.selection.datepickerEnabled">
<vn-autocomplete
ng-model="$ctrl.companyId"
model="ClientSample.companyFk"
data="companiesData"
show-field="code"
label="Company"
ng-if="sampleType.selection.hasCompany"
required="true">
</vn-autocomplete>
<vn-autocomplete
ng-if="sampleType.selection.id == 20"
vn-one
required="true"
data="$ctrl.addresses"
label="Address"
show-field="nickname"
value-field="id"
ng-model="$ctrl.addressId"
model="ClientSample.addressFk"
order="isActive DESC">
<tpl-item class="address" ng-class="::{inactive: !isActive}">
<span class="inactive" translate>{{::!isActive ? '(Inactive)' : ''}}</span>
{{::nickname}}
<span ng-show="city || province || street">
, {{::street}}, {{::city}}, {{::province.name}} - {{::agencyMode.name}}
</span>
</tpl-item>
<append>
<vn-icon-button
ui-sref="client.card.address.edit({id: $ctrl.clientId, addressId: $ctrl.addressId})"
icon="edit"
vn-tooltip="Edit address">
</vn-icon-button>
</append>
</vn-autocomplete>
<vn-date-picker
vn-one
label="From"
ng-model="$ctrl.clientSample.from"
ng-if="sampleType.selection.datepickerEnabled"
required="true">
</vn-date-picker>
</vn-horizontal>
</vn-card>
<vn-button-bar>
<vn-submit
disabled="!sampleType.selection"
label="Send">
</vn-submit>
<vn-button
disabled="!sampleType.selection.hasPreview"
label="Preview"
ng-click="$ctrl.preview()">
</vn-button>
<vn-button
class="cancel"
label="Cancel"
ui-sref="client.card.sample.index">
</vn-button>
</vn-button-bar>
</form>
<vn-dialog
vn-id="show-preview"
on-open="$ctrl.onPreviewOpen()">
<tpl-body class="client-sample-dialog">
<div class="loading">
<vn-spinner enable="true"></vn-spinner>
</div>
</tpl-body>
</vn-dialog>