Built motion from commit e497c3d.|2.0.12
[motion2.git] / public / app / main / apps / integrations / views / sugarcrmAccounts / edit / item / dialog.html
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>
8                 </md-button>
9             </div>
10         </md-toolbar>
11
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">
15                     <div>
16                         <span class="message">{{error.message}}</span>
17                         <span class="type">({{error.type}})</span>
18                     </div>
19                     <md-button class="md-icon-button">
20                         <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>
21                     </md-button>
22                 </div>
23             </div>
24
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 -->
30                 </div>
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>
38                         </md-select>
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>
42                             </div>
43                         </div>
44                     </md-input-container>
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>
51                             </div>
52                         </div>
53                     </md-input-container>
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>
61                                 </div>
62                             </div>
63                         </md-input-container>
64
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>
71                             </md-select>
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>
75                                 </div>
76                             </div>
77                         </md-input-container>
78
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>
85                                 </div>
86                             </div>
87                         </md-input-container>
88
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>
94                                 </md-optgroup>
95                                 <md-optgroup label="Voice: Outbound">
96                                     <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>
97                                 </md-optgroup>
98                             </md-select>
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>
102                                 </div>
103                             </div>
104                         </md-input-container>
105
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>
110                             </md-select>
111                         </md-input-container>
112                     </div>
113                     <!-- / DESCRIPTION SECTION -->
114                 </div>
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>
123                                 </md-optgroup>
124                                 <md-optgroup label="Custom">
125                                     <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}</md-option>
126                                 </md-optgroup>
127                             </md-select>
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>
131                                 </div>
132                             </div>
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>
142                             </md-select>
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>
146                                 </div>
147                             </div>
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>
155                                 </div>
156                             </div>
157                         </md-input-container>
158                         <!-- / STANDARD FIELD -->
159                     </div>
160                     <div ng-if="!vm.accountConnected">
161                         <p>Account is not connected. Please check your configurations!</p>
162                     </div>
163                     <!-- / FIELD SECTION -->
164                 </div>
165                 <div ng-switch-default>
166                     <p>No Item</p>
167                 </div>
168             </div>
169             <div class="error-list">
170                 <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">
171                     <div>
172                         <span class="message">{{error.message}}</span>
173                         <span class="type">({{error.type}})</span>
174                     </div>
175                     <md-button class="md-icon-button">
176                         <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>
177                     </md-button>
178                 </div>
179             </div>
180         </md-dialog-content>
181
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">
185                     SAVE
186                 </md-button>
187
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">
189                     ADD
190                 </md-button>
191             </div>
192             <div layout="row">
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>
196                 </md-button>
197             </div>
198         </md-dialog-actions>
199     </form>
200 </md-dialog>
201
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>
209         </md-select>
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>
213             </div>
214         </div>
215     </md-input-container>
216
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>
223             </div>
224         </div>
225     </md-input-container>
226
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>
232             </md-optgroup>
233             <md-optgroup label="Voice: Outbound">
234                 <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>
235             </md-optgroup>
236         </md-select>
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>
240             </div>
241         </div>
242     </md-input-container>
243
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>
248         </md-select>
249     </md-input-container>
250 </script>