1 <md-dialog class="vtigerAccount-item-dialog" aria-label="New Item">
2 <form name="vtigerAccountItemForm" class="md-inline-form" novalidate>
3 <md-toolbar class="md-accent md-hue-2">
5 class="md-toolbar-tools"
7 layout-align="space-between center"
9 <span class="title">{{ vm.title | translate }}</span>
10 <md-button class="md-icon-button" ng-click="vm.closeDialog()">
12 md-font-icon="icon-close"
13 aria-label="Close dialog"
19 <md-dialog-content ms-scroll>
20 <div class="error-list">
22 ng-repeat="error in vm.errors"
25 layout-align="space-between center"
28 <span class="message">{{error.message}}</span>
29 <span class="type">({{error.type}})</span>
31 <md-button class="md-icon-button">
33 md-font-icon="icon-alert-box"
34 aria-label="alert error"
41 <div ng-switch="vm.type">
42 <div ng-switch-when="subject">
43 <!-- SUBJECT SECTION -->
44 <div ng-include="'/subject.html'"></div>
45 <!-- / SUBJECT SECTION -->
47 <div ng-switch-when="description">
48 <!-- DESCRIPTION SECTION -->
49 <md-input-container class="md-block">
50 <label translate="APP.TYPE">Type</label>
51 <md-select name="type" ng-model="vm.item.type" required>
52 <md-option value="string">String</md-option>
53 <md-option value="keyValue">Key Value</md-option>
56 ng-messages="vtigerAccountItemForm.type.$error"
57 ng-show="vtigerAccountItemForm.type.$touched"
60 <div ng-message="required">
61 <span translate="APP.ERRORS.TYPE_REQUIRED"
62 >Type field is required</span
67 <md-input-container class="md-block" ng-if="vm.item.type == 'string'">
68 <label translate="APP.CONTENT">Content</label>
72 ng-model="vm.item.content"
77 ng-messages="vtigerAccountItemForm.content.$error"
78 ng-show="vtigerAccountItemForm.content.$touched"
81 <div ng-message="required">
82 <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED"
83 >Content field is required</span
88 <div ng-if="vm.item.type == 'keyValue'">
89 <md-input-container class="md-block">
90 <label translate="APP.KEY">Key</label>
94 ng-model="vm.item.key"
99 ng-messages="vtigerAccountItemForm.key.$error"
100 ng-show="vtigerAccountItemForm.key.$touched"
103 <div ng-message="required">
104 <span translate="APP.ERRORS.KEY_REQUIRED"
105 >Key field is required</span
109 </md-input-container>
111 <md-input-container class="md-block">
112 <label translate="APP.TYPE">Type</label>
113 <md-select name="keyType" ng-model="vm.item.keyType" required>
114 <md-option value="string">String</md-option>
115 <md-option value="variable">Variable</md-option>
116 <md-option value="customVariable">Custom Variable</md-option>
119 ng-messages="vtigerAccountItemForm.keyType.$error"
120 ng-show="vtigerAccountItemForm.keyType.$touched"
123 <div ng-message="required">
124 <span translate="APP.ERRORS.TYPE_REQUIRED"
125 >Type field is required</span
129 </md-input-container>
133 ng-if="vm.item.keyType == 'string'"
135 <label translate="APP.CONTENT">Content</label>
139 ng-model="vm.item.keyContent"
144 ng-messages="vtigerAccountItemForm.keyContent.$error"
145 ng-show="vtigerAccountItemForm.keyContent.$touched"
148 <div ng-message="required">
149 <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED"
150 >Content field is required</span
154 </md-input-container>
158 ng-if="vm.item.keyType == 'variable'"
160 <label translate="APP.VALUE">Value</label>
163 ng-model="vm.item.variableName"
164 md-selected-text="vm.getSelectedVariable()"
167 <md-optgroup label="Voice: Queue">
169 ng-value="agentColumn"
170 ng-repeat="agentColumn in vm.voiceAgentReportColumns"
175 <md-optgroup label="Voice: Outbound">
177 ng-value="dialColumn"
178 ng-repeat="dialColumn in vm.voiceDialReportColumns"
184 ng-messages="vtigerAccountItemForm.variableName.$error"
185 ng-show="vtigerAccountItemForm.variableName.$touched"
188 <div ng-message="required">
189 <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED"
190 >Variable name field is required</span
194 </md-input-container>
198 ng-if="vm.item.keyType == 'customVariable'"
200 <label translate="APP.VALUE">Value</label>
201 <md-select ng-model="vm.item.VariableId" required>
203 ng-value="variable.id"
204 ng-repeat="variable in vm.variables"
208 </md-input-container>
210 <!-- / DESCRIPTION SECTION -->
212 <div ng-switch-when="field">
213 <!-- FIELD SECTION -->
214 <div ng-if="vm.accountConnected">
215 <md-input-container class="md-block">
216 <label translate="APP.FIELD">FIELD</label>
217 <!-- ITEM TYPE DEFAULT VALUE is STRING -->
220 ng-model="vm.customField"
222 ng-change="vm.item.type = 'string'"
224 <md-optgroup label="Standard">
227 ng-repeat="standard in vm.fields | filter: {custom: false} "
233 <md-optgroup label="Custom">
236 ng-repeat="custom in vm.fields | filter: {custom: true} "
242 ng-messages="vtigerAccountItemForm.customField.$error"
243 ng-show="vtigerAccountItemForm.customField.$touched"
246 <div ng-message="required">
247 <span translate="APP.ERRORS.FIELD_REQUIRED"
248 >Field is required</span
252 </md-input-container>
255 <div ng-if="vm.customField" ng-include="'/fields.html'"></div>
258 <div ng-if="!vm.accountConnected">
259 <p>Account is not connected. Please check your configurations!</p>
261 <!-- / FIELD SECTION -->
263 <div ng-switch-default>
267 <div class="error-list">
269 ng-repeat="error in vm.errors"
272 layout-align="space-between center"
275 <span class="message">{{error.message}}</span>
276 <span class="type">({{error.type}})</span>
278 <md-button class="md-icon-button">
280 md-font-icon="icon-alert-box"
281 aria-label="alert error"
291 layout-align="space-between center"
292 ng-if="!vm.crudPermissions.readOnly"
294 <div layout="row" layout-align="start center">
297 ng-if="vm.crudPermissions.canEdit && !vm.newItem"
298 ng-click="vm.saveItem()"
299 class="send-button md-accent md-raised"
300 ng-disabled="vtigerAccountItemForm.$invalid || vtigerAccountItemForm.$pristine"
303 translate-attr-aria-label="APP.SAVE"
310 ng-if="vm.crudPermissions.canEdit && vm.newItem"
311 ng-click="vm.addNewItem()"
312 class="send-button md-accent md-raised"
313 ng-disabled="vtigerAccountItemForm.$invalid || vtigerAccountItemForm.$pristine"
316 translate-attr-aria-label="APP.ADD"
323 class="md-icon-button"
324 ng-if="vm.crudPermissions.canDelete && !vm.newItem"
325 ng-click="vm.deleteItem($event)"
328 translate-attr-aria-label="APP.DELETE"
330 <md-icon md-font-icon="icon-delete"></md-icon>
331 <md-tooltip><span translate="APP.DELETE">DELETE</span></md-tooltip>
338 <script type="text/ng-template" id="/fields.html">
341 <md-input-container class="md-block" ng-if="!vm.customField.options.length">
343 <label translate="APP.TYPE">Type</label>
344 <md-select name="type" ng-model="vm.item.type" required>
346 <md-option value="string">String</md-option>
347 <md-option value="variable">Variable</md-option>
348 <md-option value="customVariable">Custom Variable</md-option>
350 <div ng-messages="vtigerAccountItemForm.type.$error" ng-show="vtigerAccountItemForm.type.$touched" role="alert">
351 <div ng-message="required">
352 <span translate="APP.ERRORS.TYPE_REQUIRED">Type field is required</span>
355 </md-input-container>
361 <md-input-container class="md-block" ng-if="vm.item.type == 'string' && vm.customField.options.length">
363 <label translate="APP.CONTENT">Content</label>
365 <md-select name="option" ng-model="vm.item.content" required>
366 <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>
369 <div ng-messages="vtigerAccountItemForm.option.$error" ng-show="vtigerAccountItemForm.option.$touched" role="alert">
370 <div ng-message="required">
371 <span translate="APP.ERRORS.VALUE_REQUIRED">Value field is required</span>
374 </md-input-container>
376 <md-input-container class="md-block" ng-if="vm.item.type == 'string' && !vm.customField.options.length">
377 <label translate="APP.CONTENT">Content</label>
379 <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>
381 <div ng-messages="vtigerAccountItemForm.content.$error" ng-show="vtigerAccountItemForm.content.$touched" role="alert">
382 <div ng-message="required">
383 <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is
387 </md-input-container>
389 <md-input-container class="md-block" ng-if="vm.item.type == 'variable'">
390 <label translate="APP.VALUE">Value</label>
391 <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>
392 <md-optgroup label="Voice: Queue">
393 <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}
396 <md-optgroup label="Voice: Outbound">
397 <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}
401 <div ng-messages="vtigerAccountItemForm.variableName.$error" ng-show="vtigerAccountItemForm.variableName.$touched"
403 <div ng-message="required">
404 <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is
408 </md-input-container>
410 <md-input-container class="md-block" ng-if="vm.item.type == 'customVariable'">
411 <label translate="APP.VALUE">Value</label>
412 <md-select ng-model="vm.item.VariableId" required>
413 <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>
415 </md-input-container>
420 <script type="text/ng-template" id="/subject.html">
421 <md-input-container class="md-block">
422 <label translate="APP.TYPE">Type</label>
423 <md-select name="type" ng-model="vm.item.type" required>
424 <md-option value="string">String</md-option>
425 <md-option value="variable">Variable</md-option>
426 <md-option value="customVariable">Custom Variable</md-option>
428 <div ng-messages="vtigerAccountItemForm.type.$error" ng-show="vtigerAccountItemForm.type.$touched" role="alert">
429 <div ng-message="required">
430 <span translate="APP.ERRORS.TYPE_REQUIRED">Type field is required</span>
433 </md-input-container>
435 <md-input-container class="md-block" ng-if="vm.item.type == 'string'">
436 <label translate="APP.CONTENT">Content</label>
437 <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>
438 <div ng-messages="vtigerAccountItemForm.content.$error"
439 ng-show="vtigerAccountItemForm.content.$touched" role="alert">
440 <div ng-message="required">
441 <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>
444 </md-input-container>
446 <md-input-container class="md-block" ng-if="vm.item.type == 'variable'">
447 <label translate="APP.VALUE">Value</label>
448 <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"
450 <md-optgroup label="Voice: Queue">
451 <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}
454 <md-optgroup label="Voice: Outbound">
455 <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}
459 <div ng-messages="vtigerAccountItemForm.variableName.$error"
460 ng-show="vtigerAccountItemForm.variableName.$touched" role="alert">
461 <div ng-message="required">
462 <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is
466 </md-input-container>
468 <md-input-container class="md-block" ng-if="vm.item.type == 'customVariable'">
469 <label translate="APP.VALUE">Value</label>
470 <md-select ng-model="vm.item.VariableId" required>
471 <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>
473 </md-input-container>