1 <md-dialog class="sugarcrmAccount-item-dialog" aria-label="New Item">
2 <form name="sugarcrmAccountItemForm" 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="INTEGRATIONS.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="sugarcrmAccountItemForm.type.$error"
57 ng-show="sugarcrmAccountItemForm.type.$touched"
60 <div ng-message="required">
61 <span translate="INTEGRATIONS.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="INTEGRATIONS.CONTENT">Content</label>
72 ng-model="vm.item.content"
77 ng-messages="sugarcrmAccountItemForm.content.$error"
78 ng-show="sugarcrmAccountItemForm.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="INTEGRATIONS.KEY">Key</label>
94 ng-model="vm.item.key"
99 ng-messages="sugarcrmAccountItemForm.key.$error"
100 ng-show="sugarcrmAccountItemForm.key.$touched"
103 <div ng-message="required">
104 <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED"
105 >Key field is required</span
109 </md-input-container>
111 <md-input-container class="md-block">
112 <label translate="INTEGRATIONS.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="sugarcrmAccountItemForm.keyType.$error"
120 ng-show="sugarcrmAccountItemForm.keyType.$touched"
123 <div ng-message="required">
124 <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED"
125 >Type field is required</span
129 </md-input-container>
133 ng-if="vm.item.keyType == 'string'"
135 <label translate="INTEGRATIONS.CONTENT">Content</label>
139 ng-model="vm.item.keyContent"
144 ng-messages="sugarcrmAccountItemForm.keyContent.$error"
145 ng-show="sugarcrmAccountItemForm.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="INTEGRATIONS.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"
174 <md-optgroup label="Voice: Outbound">
176 ng-value="dialColumn"
177 ng-repeat="dialColumn in vm.voiceDialReportColumns"
178 >{{dialColumn}}</md-option
183 ng-messages="sugarcrmAccountItemForm.variableName.$error"
184 ng-show="sugarcrmAccountItemForm.variableName.$touched"
187 <div ng-message="required">
188 <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED"
189 >Variable name field is required</span
193 </md-input-container>
197 ng-if="vm.item.keyType == 'customVariable'"
199 <label translate="INTEGRATIONS.VALUE">Value</label>
200 <md-select ng-model="vm.item.VariableId" required>
202 ng-value="variable.id"
203 ng-repeat="variable in vm.variables"
207 </md-input-container>
209 <!-- / DESCRIPTION SECTION -->
211 <div ng-switch-when="field">
212 <!-- FIELD SECTION -->
213 <div ng-if="vm.accountConnected">
214 <md-input-container class="md-block">
215 <label translate="INTEGRATIONS.FIELD">FIELD</label>
216 <!-- ITEM TYPE DEFAULT VALUE is STRING -->
219 ng-model="vm.customField"
221 ng-change="vm.item.type = 'string'"
223 <md-optgroup label="Standard">
226 ng-repeat="standard in vm.fields | filter: {custom: false} "
231 <md-optgroup label="Custom">
234 ng-repeat="custom in vm.fields | filter: {custom: true} "
240 ng-messages="sugarcrmAccountItemForm.customField.$error"
241 ng-show="sugarcrmAccountItemForm.customField.$touched"
244 <div ng-message="required">
245 <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED"
246 >Field is required</span
250 </md-input-container>
253 <div ng-if="vm.customField" ng-include="'/fields.html'"></div>
256 <div ng-if="!vm.accountConnected">
257 <p>Account is not connected. Please check your configurations!</p>
259 <!-- / FIELD SECTION -->
261 <div ng-switch-default>
265 <div class="error-list">
267 ng-repeat="error in vm.errors"
270 layout-align="space-between center"
273 <span class="message">{{error.message}}</span>
274 <span class="type">({{error.type}})</span>
276 <md-button class="md-icon-button">
278 md-font-icon="icon-alert-box"
279 aria-label="alert error"
289 layout-align="space-between center"
290 ng-if="!vm.crudPermissions.readOnly"
292 <div layout="row" layout-align="start center">
295 ng-if="vm.crudPermissions.canEdit && !vm.newItem"
296 ng-click="vm.saveItem()"
297 class="send-button md-accent md-raised"
298 ng-disabled="sugarcrmAccountItemForm.$invalid || sugarcrmAccountItemForm.$pristine"
300 translate="INTEGRATIONS.SAVE"
301 translate-attr-aria-label="INTEGRATIONS.SAVE"
308 ng-if="vm.crudPermissions.canEdit && vm.newItem"
309 ng-click="vm.addNewItem()"
310 class="send-button md-accent md-raised"
311 ng-disabled="sugarcrmAccountItemForm.$invalid || sugarcrmAccountItemForm.$pristine"
313 translate="INTEGRATIONS.ADD"
314 translate-attr-aria-label="INTEGRATIONS.ADD"
321 class="md-icon-button"
322 ng-if="vm.crudPermissions.canDelete && !vm.newItem"
323 ng-click="vm.deleteItem($event)"
326 translate-attr-aria-label="INTEGRATIONS.DELETE"
328 <md-icon md-font-icon="icon-delete"></md-icon>
330 ><span translate="INTEGRATIONS.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="INTEGRATIONS.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="sugarcrmAccountItemForm.type.$error" ng-show="sugarcrmAccountItemForm.type.$touched"
352 <div ng-message="required">
353 <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>
356 </md-input-container>
362 <md-input-container class="md-block" ng-if="vm.item.type == 'string' && vm.customField.options.length">
364 <label translate="INTEGRATIONS.CONTENT">Content</label>
366 <md-select name="option" ng-model="vm.item.content" required>
367 <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>
370 <div ng-messages="sugarcrmAccountItemForm.option.$error"
371 ng-show="sugarcrmAccountItemForm.option.$touched" role="alert">
372 <div ng-message="required">
373 <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>
376 </md-input-container>
378 <md-input-container class="md-block" ng-if="vm.item.type == 'string' && !vm.customField.options.length">
379 <label translate="INTEGRATIONS.CONTENT">Content</label>
381 <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>
383 <div ng-messages="sugarcrmAccountItemForm.content.$error"
384 ng-show="sugarcrmAccountItemForm.content.$touched" role="alert">
385 <div ng-message="required">
386 <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is
390 </md-input-container>
392 <md-input-container class="md-block" ng-if="vm.item.type == 'variable'">
393 <label translate="INTEGRATIONS.VALUE">Value</label>
394 <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"
396 <md-optgroup label="Voice: Queue">
397 <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}
400 <md-optgroup label="Voice: Outbound">
401 <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}
405 <div ng-messages="sugarcrmAccountItemForm.variableName.$error"
406 ng-show="sugarcrmAccountItemForm.variableName.$touched" role="alert">
407 <div ng-message="required">
408 <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is
412 </md-input-container>
414 <md-input-container class="md-block" ng-if="vm.item.type == 'customVariable'">
415 <label translate="INTEGRATIONS.VALUE">Value</label>
416 <md-select ng-model="vm.item.VariableId" required>
417 <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>
419 </md-input-container>
424 <script type="text/ng-template" id="/subject.html">
425 <md-input-container class="md-block">
426 <label translate="INTEGRATIONS.TYPE">Type</label>
427 <md-select name="type" ng-model="vm.item.type" required>
428 <md-option value="string">String</md-option>
429 <md-option value="variable">Variable</md-option>
430 <md-option value="customVariable">Custom Variable</md-option>
432 <div ng-messages="sugarcrmAccountItemForm.type.$error" ng-show="sugarcrmAccountItemForm.type.$touched" role="alert">
433 <div ng-message="required">
434 <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>
437 </md-input-container>
439 <md-input-container class="md-block" ng-if="vm.item.type == 'string'">
440 <label translate="INTEGRATIONS.CONTENT">Content</label>
441 <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>
442 <div ng-messages="sugarcrmAccountItemForm.content.$error"
443 ng-show="sugarcrmAccountItemForm.content.$touched" role="alert">
444 <div ng-message="required">
445 <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>
448 </md-input-container>
450 <md-input-container class="md-block" ng-if="vm.item.type == 'variable'">
451 <label translate="INTEGRATIONS.VALUE">Value</label>
452 <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"
454 <md-optgroup label="Voice: Queue">
455 <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}
458 <md-optgroup label="Voice: Outbound">
459 <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}
463 <div ng-messages="sugarcrmAccountItemForm.variableName.$error"
464 ng-show="sugarcrmAccountItemForm.variableName.$touched" role="alert">
465 <div ng-message="required">
466 <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is
470 </md-input-container>
472 <md-input-container class="md-block" ng-if="vm.item.type == 'customVariable'">
473 <label translate="INTEGRATIONS.VALUE">Value</label>
474 <md-select ng-model="vm.item.VariableId" required>
475 <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>
477 </md-input-container>