e5dc68a3d88f3931e88b35b3cf3df6b8bb856cc7
[motion-next.git] /
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">
4       <div
5         class="md-toolbar-tools"
6         layout="row"
7         layout-align="space-between center"
8       >
9         <span class="title">{{ vm.title | translate }}</span>
10         <md-button class="md-icon-button" ng-click="vm.closeDialog()">
11           <md-icon
12             md-font-icon="icon-close"
13             aria-label="Close dialog"
14           ></md-icon>
15         </md-button>
16       </div>
17     </md-toolbar>
18
19     <md-dialog-content ms-scroll>
20       <div class="error-list">
21         <div
22           ng-repeat="error in vm.errors"
23           class="error"
24           layout="row"
25           layout-align="space-between center"
26         >
27           <div>
28             <span class="message">{{error.message}}</span>
29             <span class="type">({{error.type}})</span>
30           </div>
31           <md-button class="md-icon-button">
32             <md-icon
33               md-font-icon="icon-alert-box"
34               aria-label="alert error"
35               class="s16"
36             ></md-icon>
37           </md-button>
38         </div>
39       </div>
40
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 -->
46         </div>
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>
54             </md-select>
55             <div
56               ng-messages="vtigerAccountItemForm.type.$error"
57               ng-show="vtigerAccountItemForm.type.$touched"
58               role="alert"
59             >
60               <div ng-message="required">
61                 <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED"
62                   >Type field is required</span
63                 >
64               </div>
65             </div>
66           </md-input-container>
67           <md-input-container class="md-block" ng-if="vm.item.type == 'string'">
68             <label translate="INTEGRATIONS.CONTENT">Content</label>
69             <input
70               type="text"
71               name="content"
72               ng-model="vm.item.content"
73               required
74               md-autofocus
75             />
76             <div
77               ng-messages="vtigerAccountItemForm.content.$error"
78               ng-show="vtigerAccountItemForm.content.$touched"
79               role="alert"
80             >
81               <div ng-message="required">
82                 <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED"
83                   >Content field is required</span
84                 >
85               </div>
86             </div>
87           </md-input-container>
88           <div ng-if="vm.item.type == 'keyValue'">
89             <md-input-container class="md-block">
90               <label translate="INTEGRATIONS.KEY">Key</label>
91               <input
92                 type="text"
93                 name="key"
94                 ng-model="vm.item.key"
95                 required
96                 md-autofocus
97               />
98               <div
99                 ng-messages="vtigerAccountItemForm.key.$error"
100                 ng-show="vtigerAccountItemForm.key.$touched"
101                 role="alert"
102               >
103                 <div ng-message="required">
104                   <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED"
105                     >Key field is required</span
106                   >
107                 </div>
108               </div>
109             </md-input-container>
110
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>
117               </md-select>
118               <div
119                 ng-messages="vtigerAccountItemForm.keyType.$error"
120                 ng-show="vtigerAccountItemForm.keyType.$touched"
121                 role="alert"
122               >
123                 <div ng-message="required">
124                   <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED"
125                     >Type field is required</span
126                   >
127                 </div>
128               </div>
129             </md-input-container>
130
131             <md-input-container
132               class="md-block"
133               ng-if="vm.item.keyType == 'string'"
134             >
135               <label translate="INTEGRATIONS.CONTENT">Content</label>
136               <input
137                 type="text"
138                 name="keyContent"
139                 ng-model="vm.item.keyContent"
140                 required
141                 md-autofocus
142               />
143               <div
144                 ng-messages="vtigerAccountItemForm.keyContent.$error"
145                 ng-show="vtigerAccountItemForm.keyContent.$touched"
146                 role="alert"
147               >
148                 <div ng-message="required">
149                   <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED"
150                     >Content field is required</span
151                   >
152                 </div>
153               </div>
154             </md-input-container>
155
156             <md-input-container
157               class="md-block"
158               ng-if="vm.item.keyType == 'variable'"
159             >
160               <label translate="INTEGRATIONS.VALUE">Value</label>
161               <md-select
162                 name="variableName"
163                 ng-model="vm.item.variableName"
164                 md-selected-text="vm.getSelectedVariable()"
165                 required
166               >
167                 <md-optgroup label="Voice: Queue">
168                   <md-option
169                     ng-value="agentColumn"
170                     ng-repeat="agentColumn in vm.voiceAgentReportColumns"
171                     >{{agentColumn}}
172                   </md-option>
173                 </md-optgroup>
174                 <md-optgroup label="Voice: Outbound">
175                   <md-option
176                     ng-value="dialColumn"
177                     ng-repeat="dialColumn in vm.voiceDialReportColumns"
178                     >{{dialColumn}}</md-option
179                   >
180                 </md-optgroup>
181               </md-select>
182               <div
183                 ng-messages="vtigerAccountItemForm.variableName.$error"
184                 ng-show="vtigerAccountItemForm.variableName.$touched"
185                 role="alert"
186               >
187                 <div ng-message="required">
188                   <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED"
189                     >Variable name field is required</span
190                   >
191                 </div>
192               </div>
193             </md-input-container>
194
195             <md-input-container
196               class="md-block"
197               ng-if="vm.item.keyType == 'customVariable'"
198             >
199               <label translate="INTEGRATIONS.VALUE">Value</label>
200               <md-select ng-model="vm.item.VariableId" required>
201                 <md-option
202                   ng-value="variable.id"
203                   ng-repeat="variable in vm.variables"
204                   >{{variable.name}}
205                 </md-option>
206               </md-select>
207             </md-input-container>
208           </div>
209           <!-- / DESCRIPTION SECTION -->
210         </div>
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 -->
217               <md-select
218                 name="customField"
219                 ng-model="vm.customField"
220                 required
221                 ng-change="vm.item.type = 'string'"
222               >
223                 <md-optgroup label="Standard">
224                   <md-option
225                     ng-value="standard"
226                     ng-repeat="standard in vm.fields | filter: {custom: false} "
227                     >{{standard.name}}
228                   </md-option>
229                 </md-optgroup>
230
231                 <md-optgroup label="Custom">
232                   <md-option
233                     ng-value="custom"
234                     ng-repeat="custom in vm.fields | filter: {custom: true} "
235                     >{{custom.name}}
236                   </md-option>
237                 </md-optgroup>
238               </md-select>
239               <div
240                 ng-messages="vtigerAccountItemForm.customField.$error"
241                 ng-show="vtigerAccountItemForm.customField.$touched"
242                 role="alert"
243               >
244                 <div ng-message="required">
245                   <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED"
246                     >Field is required</span
247                   >
248                 </div>
249               </div>
250             </md-input-container>
251
252             <!-- FIELDS -->
253             <div ng-if="vm.customField" ng-include="'/fields.html'"></div>
254             <!-- FIELDS -->
255           </div>
256           <div ng-if="!vm.accountConnected">
257             <p>Account is not connected. Please check your configurations!</p>
258           </div>
259           <!-- / FIELD SECTION -->
260         </div>
261         <div ng-switch-default>
262           <p>No Item</p>
263         </div>
264       </div>
265       <div class="error-list">
266         <div
267           ng-repeat="error in vm.errors"
268           class="error"
269           layout="row"
270           layout-align="space-between center"
271         >
272           <div>
273             <span class="message">{{error.message}}</span>
274             <span class="type">({{error.type}})</span>
275           </div>
276           <md-button class="md-icon-button">
277             <md-icon
278               md-font-icon="icon-alert-box"
279               aria-label="alert error"
280               class="s16"
281             ></md-icon>
282           </md-button>
283         </div>
284       </div>
285     </md-dialog-content>
286
287     <md-dialog-actions
288       layout="row"
289       layout-align="space-between center"
290       ng-if="!vm.crudPermissions.readOnly"
291     >
292       <div layout="row" layout-align="start center">
293         <md-button
294           type="submit"
295           ng-if="vm.crudPermissions.canEdit && !vm.newItem"
296           ng-click="vm.saveItem()"
297           class="send-button md-accent md-raised"
298           ng-disabled="vtigerAccountItemForm.$invalid || vtigerAccountItemForm.$pristine"
299           aria-label="SAVE"
300           translate="INTEGRATIONS.SAVE"
301           translate-attr-aria-label="INTEGRATIONS.SAVE"
302         >
303           SAVE
304         </md-button>
305
306         <md-button
307           type="submit"
308           ng-if="vm.crudPermissions.canEdit && vm.newItem"
309           ng-click="vm.addNewItem()"
310           class="send-button md-accent md-raised"
311           ng-disabled="vtigerAccountItemForm.$invalid || vtigerAccountItemForm.$pristine"
312           aria-label="ADD"
313           translate="INTEGRATIONS.ADD"
314           translate-attr-aria-label="INTEGRATIONS.ADD"
315         >
316           ADD
317         </md-button>
318       </div>
319       <div layout="row">
320         <md-button
321           class="md-icon-button"
322           ng-if="vm.crudPermissions.canDelete && !vm.newItem"
323           ng-click="vm.deleteItem($event)"
324           aria-label="DELETE"
325           translate
326           translate-attr-aria-label="INTEGRATIONS.DELETE"
327         >
328           <md-icon md-font-icon="icon-delete"></md-icon>
329           <md-tooltip
330             ><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip
331           >
332         </md-button>
333       </div>
334     </md-dialog-actions>
335   </form>
336 </md-dialog>
337
338 <script type="text/ng-template" id="/fields.html">
339
340   <!-- type -->
341   <md-input-container class="md-block" ng-if="!vm.customField.options.length">
342
343       <label translate="INTEGRATIONS.TYPE">Type</label>
344       <md-select name="type" ng-model="vm.item.type" required>
345
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>
349       </md-select>
350       <div ng-messages="vtigerAccountItemForm.type.$error" ng-show="vtigerAccountItemForm.type.$touched"
351           role="alert">
352           <div ng-message="required">
353               <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>
354           </div>
355       </div>
356   </md-input-container>
357
358   <!--/ type -->
359
360   <!-- value -->
361
362   <md-input-container class="md-block" ng-if="vm.item.type == 'string' && vm.customField.options.length">
363       <!-- options -->
364       <label translate="INTEGRATIONS.CONTENT">Content</label>
365
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>
368       </md-select>
369
370       <div ng-messages="vtigerAccountItemForm.option.$error"
371           ng-show="vtigerAccountItemForm.option.$touched" role="alert">
372           <div ng-message="required">
373               <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>
374           </div>
375       </div>
376   </md-input-container>
377
378   <md-input-container class="md-block" ng-if="vm.item.type == 'string' && !vm.customField.options.length">
379       <label translate="INTEGRATIONS.CONTENT">Content</label>
380
381       <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>
382
383       <div ng-messages="vtigerAccountItemForm.content.$error"
384           ng-show="vtigerAccountItemForm.content.$touched" role="alert">
385           <div ng-message="required">
386               <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is
387                   required</span>
388           </div>
389       </div>
390   </md-input-container>
391
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()"
395           required>
396           <md-optgroup label="Voice: Queue">
397               <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}
398               </md-option>
399           </md-optgroup>
400           <md-optgroup label="Voice: Outbound">
401               <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}
402               </md-option>
403           </md-optgroup>
404       </md-select>
405       <div ng-messages="vtigerAccountItemForm.variableName.$error"
406           ng-show="vtigerAccountItemForm.variableName.$touched" role="alert">
407           <div ng-message="required">
408               <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is
409                   required</span>
410           </div>
411       </div>
412   </md-input-container>
413
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>
418       </md-select>
419   </md-input-container>
420
421   <!--/ value -->
422 </script>
423
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>
431             </md-select>
432         <div ng-messages="vtigerAccountItemForm.type.$error" ng-show="vtigerAccountItemForm.type.$touched" role="alert">
433             <div ng-message="required">
434                 <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>
435              </div>
436         </div>
437   </md-input-container>
438
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="vtigerAccountItemForm.content.$error"
443           ng-show="vtigerAccountItemForm.content.$touched" role="alert">
444           <div ng-message="required">
445               <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>
446           </div>
447       </div>
448   </md-input-container>
449
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()"
453           required>
454           <md-optgroup label="Voice: Queue">
455               <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}
456               </md-option>
457           </md-optgroup>
458           <md-optgroup label="Voice: Outbound">
459               <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}
460               </md-option>
461           </md-optgroup>
462       </md-select>
463       <div ng-messages="vtigerAccountItemForm.variableName.$error"
464           ng-show="vtigerAccountItemForm.variableName.$touched" role="alert">
465           <div ng-message="required">
466               <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is
467                   required</span>
468           </div>
469       </div>
470   </md-input-container>
471
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>
476       </md-select>
477   </md-input-container>
478 </script>