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">
4 <div class="md-toolbar-tools" layout="row" layout-align="space-between center">
5 <span class="title">{{ vm.title | translate }}</span>
6 <md-button class="md-icon-button" ng-click="vm.closeDialog()">
7 <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>
12 <md-dialog-content ms-scroll>
13 <div class="error-list">
14 <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">
16 <span class="message">{{error.message}}</span>
17 <span class="type">({{error.type}})</span>
19 <md-button class="md-icon-button">
20 <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>
25 <div ng-switch="vm.type">
26 <div ng-switch-when="subject">
27 <!-- SUBJECT SECTION -->
28 <div ng-include="'/subject.html'"></div>
29 <!-- / SUBJECT SECTION -->
31 <div ng-switch-when="description">
32 <!-- DESCRIPTION SECTION -->
33 <md-input-container class="md-block">
34 <label translate="INTEGRATIONS.TYPE">Type</label>
35 <md-select name="type" ng-model="vm.item.type" required>
36 <md-option value="string">String</md-option>
37 <md-option value="keyValue">Key Value</md-option>
39 <div ng-messages="sugarcrmAccountItemForm.type.$error" ng-show="sugarcrmAccountItemForm.type.$touched" role="alert">
40 <div ng-message="required">
41 <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>
45 <md-input-container class="md-block" ng-if="vm.item.type == 'string'">
46 <label translate="INTEGRATIONS.CONTENT">Content</label>
47 <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>
48 <div ng-messages="sugarcrmAccountItemForm.content.$error" ng-show="sugarcrmAccountItemForm.content.$touched" role="alert">
49 <div ng-message="required">
50 <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>
54 <div ng-if="vm.item.type == 'keyValue'">
55 <md-input-container class="md-block">
56 <label translate="INTEGRATIONS.KEY">Key</label>
57 <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>
58 <div ng-messages="sugarcrmAccountItemForm.key.$error" ng-show="sugarcrmAccountItemForm.key.$touched" role="alert">
59 <div ng-message="required">
60 <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is required</span>
65 <md-input-container class="md-block">
66 <label translate="INTEGRATIONS.TYPE">Type</label>
67 <md-select name="keyType" ng-model="vm.item.keyType" required>
68 <md-option value="string">String</md-option>
69 <md-option value="variable">Variable</md-option>
70 <md-option value="customVariable">Custom Variable</md-option>
72 <div ng-messages="sugarcrmAccountItemForm.keyType.$error" ng-show="sugarcrmAccountItemForm.keyType.$touched" role="alert">
73 <div ng-message="required">
74 <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>
79 <md-input-container class="md-block" ng-if="vm.item.keyType == 'string'">
80 <label translate="INTEGRATIONS.CONTENT">Content</label>
81 <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>
82 <div ng-messages="sugarcrmAccountItemForm.keyContent.$error" ng-show="sugarcrmAccountItemForm.keyContent.$touched" role="alert">
83 <div ng-message="required">
84 <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>
89 <md-input-container class="md-block" ng-if="vm.item.keyType == 'variable'">
90 <label translate="INTEGRATIONS.VALUE">Value</label>
91 <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>
92 <md-optgroup label="Voice: Queue">
93 <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}</md-option>
95 <md-optgroup label="Voice: Outbound">
96 <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>
99 <div ng-messages="sugarcrmAccountItemForm.variableName.$error" ng-show="sugarcrmAccountItemForm.variableName.$touched" role="alert">
100 <div ng-message="required">
101 <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is required</span>
104 </md-input-container>
106 <md-input-container class="md-block" ng-if="vm.item.keyType == 'customVariable'">
107 <label translate="INTEGRATIONS.VALUE">Value</label>
108 <md-select ng-model="vm.item.VariableId" required>
109 <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>
111 </md-input-container>
113 <!-- / DESCRIPTION SECTION -->
115 <div ng-switch-when="field">
116 <!-- FIELD SECTION -->
117 <div ng-if="vm.accountConnected">
118 <md-input-container class="md-block">
119 <label translate="INTEGRATIONS.FIELD">FIELD</label>
120 <md-select name="customField" ng-model="vm.customField" required>
121 <md-optgroup label="Standard">
122 <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}</md-option>
124 <md-optgroup label="Custom">
125 <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}</md-option>
128 <div ng-messages="sugarcrmAccountItemForm.customField.$error" ng-show="sugarcrmAccountItemForm.customField.$touched" role="alert">
129 <div ng-message="required">
130 <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is required</span>
133 </md-input-container>
134 <!-- CUSTOM FIELD -->
135 <div ng-if="vm.customField && vm.customField.custom" ng-include="'/subject.html'"></div>
136 <!-- / CUSTOM FIELD -->
137 <!-- STANDARD FIELD -->
138 <md-input-container class="md-block" ng-if="vm.customField && !vm.customField.custom && vm.customField.options.length">
139 <label translate="INTEGRATIONS.VALUE">Value</label>
140 <md-select name="option" ng-model="vm.item.content" required>
141 <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>
143 <div ng-messages="sugarcrmAccountItemForm.option.$error" ng-show="sugarcrmAccountItemForm.option.$touched" role="alert">
144 <div ng-message="required">
145 <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>
148 </md-input-container>
149 <md-input-container class="md-block" ng-if="vm.customField && !vm.customField.custom && !vm.customField.options.length">
150 <label translate="INTEGRATIONS.VALUE">Value</label>
151 <input type="text" name="option" ng-model="vm.item.content" required>
152 <div ng-messages="sugarcrmAccountItemForm.option.$error" ng-show="sugarcrmAccountItemForm.option.$touched" role="alert">
153 <div ng-message="required">
154 <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>
157 </md-input-container>
158 <!-- / STANDARD FIELD -->
160 <div ng-if="!vm.accountConnected">
161 <p>Account is not connected. Please check your configurations!</p>
163 <!-- / FIELD SECTION -->
165 <div ng-switch-default>
169 <div class="error-list">
170 <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">
172 <span class="message">{{error.message}}</span>
173 <span class="type">({{error.type}})</span>
175 <md-button class="md-icon-button">
176 <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>
182 <md-dialog-actions layout="row" layout-align="space-between center">
183 <div layout="row" layout-align="start center">
184 <md-button type="submit" ng-if="!vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="sugarcrmAccountItemForm.$invalid || sugarcrmAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">
188 <md-button type="submit" ng-if="vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="sugarcrmAccountItemForm.$invalid || sugarcrmAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">
193 <md-button class="md-icon-button" ng-if="!vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">
194 <md-icon md-font-icon="icon-delete"></md-icon>
195 <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>
202 <script type="text/ng-template" id="/subject.html">
203 <md-input-container class="md-block">
204 <label translate="INTEGRATIONS.TYPE">Type</label>
205 <md-select name="type" ng-model="vm.item.type" required>
206 <md-option value="string">String</md-option>
207 <md-option value="variable">Variable</md-option>
208 <md-option value="customVariable">Custom Variable</md-option>
210 <div ng-messages="sugarcrmAccountItemForm.type.$error" ng-show="sugarcrmAccountItemForm.type.$touched" role="alert">
211 <div ng-message="required">
212 <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>
215 </md-input-container>
217 <md-input-container class="md-block" ng-if="vm.item.type == 'string'">
218 <label translate="INTEGRATIONS.CONTENT">Content</label>
219 <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>
220 <div ng-messages="sugarcrmAccountItemForm.content.$error" ng-show="sugarcrmAccountItemForm.content.$touched" role="alert">
221 <div ng-message="required">
222 <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>
225 </md-input-container>
227 <md-input-container class="md-block" ng-if="vm.item.type == 'variable'">
228 <label translate="INTEGRATIONS.VALUE">Value</label>
229 <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>
230 <md-optgroup label="Voice: Queue">
231 <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}</md-option>
233 <md-optgroup label="Voice: Outbound">
234 <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>
237 <div ng-messages="sugarcrmAccountItemForm.variableName.$error" ng-show="sugarcrmAccountItemForm.variableName.$touched" role="alert">
238 <div ng-message="required">
239 <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is required</span>
242 </md-input-container>
244 <md-input-container class="md-block" ng-if="vm.item.type == 'customVariable'">
245 <label translate="INTEGRATIONS.VALUE">Value</label>
246 <md-select ng-model="vm.item.VariableId" required>
247 <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>
249 </md-input-container>