851a32511abb6f4bd9a6e256be95939df6eb531a
[motion-next.git] /
1 <md-dialog class="anyCondition-dialog" aria-label="New AnyCondition">
2   <form name="anyConditionForm" 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       <md-input-container class="md-block">
41         <label translate="TOOLS.FIELD">Field</label>
42         <md-select
43           name="field"
44           ng-model="vm.anyCondition.field"
45           autofocus
46           required
47         >
48           <md-option ng-value="'queue'" ng-if="vm.trigger.channel == 'voice'">
49             {{ 'TOOLS.QUEUE' | translate }}
50           </md-option>
51
52           <md-option
53             ng-value="'lastevent'"
54             ng-if="vm.trigger.channel == 'voice'"
55           >
56             {{ 'TOOLS.CALL_STATUS' | translate }}
57           </md-option>
58
59           <md-option ng-value="'routeId'" ng-if="vm.trigger.channel == 'voice'">
60             {{ 'TOOLS.OUTBOUNDROUTE' | translate }}
61           </md-option>
62
63           <md-option ng-value="'agent'" ng-if="vm.trigger.channel == 'voice'">
64             {{ 'TOOLS.AGENT' | translate }}
65           </md-option>
66
67           <md-option ng-value="'account'" ng-if="vm.trigger.channel != 'voice'">
68             {{ 'TOOLS.ACCOUNT' | translate }}
69           </md-option>
70
71           <md-option
72             ng-value="'interaction'"
73             ng-if="vm.trigger.channel != 'voice'"
74           >
75             {{ 'TOOLS.INTERACTION' | translate }}
76           </md-option>
77
78           <md-option ng-value="'message'" ng-if="vm.trigger.channel != 'voice'">
79             {{ 'TOOLS.MESSAGE' | translate }}
80           </md-option>
81         </md-select>
82         <div
83           ng-messages="anyConditionForm['field'].$error"
84           ng-show="anyConditionForm['field'].$touched"
85           role="alert"
86         >
87           <div ng-message="required">
88             <span translate="TOOLS.ERRORS.FIELD_REQUIRED"
89               >Field field is required</span
90             >
91           </div>
92         </div>
93       </md-input-container>
94       <md-input-container class="md-block">
95         <label translate="TOOLS.OPERATOR">Operator</label>
96         <md-select name="operator" ng-model="vm.anyCondition.operator" required>
97           <md-option ng-value="'equals'">
98             {{ 'TOOLS.EQUALS' | translate }}
99           </md-option>
100
101           <md-option ng-value="'not_equals'">
102             {{ 'TOOLS.NOT_EQUALS' | translate }}
103           </md-option>
104         </md-select>
105         <div
106           ng-messages="anyConditionForm['operator'].$error"
107           ng-show="anyConditionForm['operator'].$touched"
108           role="alert"
109         >
110           <div ng-message="required">
111             <span translate="TOOLS.ERRORS.OPERATOR_REQUIRED"
112               >Operator field is required</span
113             >
114           </div>
115         </div>
116       </md-input-container>
117       <md-input-container
118         ng-if="vm.anyCondition.field == 'account' && vm.trigger.channel == 'chat'"
119         class="md-block"
120       >
121         <label translate="TOOLS.ACCOUNT">Account</label>
122         <md-select name="value" ng-model="vm.anyCondition.value" required>
123           <md-option
124             ng-value="value.id"
125             ng-repeat="value in vm.chatAccounts"
126             ng-disabled="value.canSelect === false"
127             >{{ value.name }}</md-option
128           >
129         </md-select>
130         <div
131           ng-messages="anyConditionForm['value'].$error"
132           ng-show="anyConditionForm['value'].$touched"
133           role="alert"
134         >
135           <div ng-message="required">
136             <span translate="TOOLS.ERRORS.ACCOUNT_REQUIRED"
137               >Account field is required</span
138             >
139           </div>
140         </div>
141       </md-input-container>
142       <md-input-container
143         ng-if="vm.anyCondition.field == 'account' && vm.trigger.channel == 'mail'"
144         class="md-block"
145       >
146         <label translate="TOOLS.ACCOUNT">Account</label>
147         <md-select name="value" ng-model="vm.anyCondition.value" required>
148           <md-option
149             ng-value="value.id"
150             ng-repeat="value in vm.mailAccounts"
151             ng-disabled="value.canSelect === false"
152             >{{ value.name }}</md-option
153           >
154         </md-select>
155         <div
156           ng-messages="anyConditionForm['value'].$error"
157           ng-show="anyConditionForm['value'].$touched"
158           role="alert"
159         >
160           <div ng-message="required">
161             <span translate="TOOLS.ERRORS.ACCOUNT_REQUIRED"
162               >Account field is required</span
163             >
164           </div>
165         </div>
166       </md-input-container>
167       <md-input-container
168         ng-if="vm.anyCondition.field == 'account' && vm.trigger.channel == 'sms'"
169         class="md-block"
170       >
171         <label translate="TOOLS.ACCOUNT">Account</label>
172         <md-select name="value" ng-model="vm.anyCondition.value" required>
173           <md-option
174             ng-value="value.id"
175             ng-repeat="value in vm.smsAccounts"
176             ng-disabled="value.canSelect === false"
177             >{{ value.name }}</md-option
178           >
179         </md-select>
180         <div
181           ng-messages="anyConditionForm['value'].$error"
182           ng-show="anyConditionForm['value'].$touched"
183           role="alert"
184         >
185           <div ng-message="required">
186             <span translate="TOOLS.ERRORS.ACCOUNT_REQUIRED"
187               >Account field is required</span
188             >
189           </div>
190         </div>
191       </md-input-container>
192       <md-input-container
193         ng-if="vm.anyCondition.field == 'account' && vm.trigger.channel == 'fax'"
194         class="md-block"
195       >
196         <label translate="TOOLS.ACCOUNT">Account</label>
197         <md-select name="value" ng-model="vm.anyCondition.value" required>
198           <md-option
199             ng-value="value.id"
200             ng-repeat="value in vm.faxAccounts"
201             ng-disabled="value.canSelect === false"
202             >{{ value.name }}</md-option
203           >
204         </md-select>
205         <div
206           ng-messages="anyConditionForm['value'].$error"
207           ng-show="anyConditionForm['value'].$touched"
208           role="alert"
209         >
210           <div ng-message="required">
211             <span translate="TOOLS.ERRORS.ACCOUNT_REQUIRED"
212               >Account field is required</span
213             >
214           </div>
215         </div>
216       </md-input-container>
217       <md-input-container
218         ng-if="vm.anyCondition.field == 'account' && vm.trigger.channel == 'openchannel'"
219         class="md-block"
220       >
221         <label translate="TOOLS.ACCOUNT">Account</label>
222         <md-select name="value" ng-model="vm.anyCondition.value" required>
223           <md-option
224             ng-value="value.id"
225             ng-repeat="value in vm.openchannelAccounts"
226             ng-disabled="value.canSelect === false"
227             >{{ value.name }}</md-option
228           >
229         </md-select>
230         <div
231           ng-messages="anyConditionForm['value'].$error"
232           ng-show="anyConditionForm['value'].$touched"
233           role="alert"
234         >
235           <div ng-message="required">
236             <span translate="TOOLS.ERRORS.ACCOUNT_REQUIRED"
237               >Account field is required</span
238             >
239           </div>
240         </div>
241       </md-input-container>
242       <md-input-container
243         ng-if="vm.anyCondition.field == 'queue' && vm.trigger.channel == 'voice'"
244         class="md-block"
245       >
246         <label translate="TOOLS.QUEUE">Queue</label>
247         <md-select name="value" ng-model="vm.anyCondition.value" required>
248           <md-option
249             ng-value="value.name"
250             ng-repeat="value in vm.queues"
251             ng-disabled="value.canSelect === false"
252             >{{ value.name }}</md-option
253           >
254         </md-select>
255         <div
256           ng-messages="anyConditionForm['value'].$error"
257           ng-show="anyConditionForm['value'].$touched"
258           role="alert"
259         >
260           <div ng-message="required">
261             <span translate="TOOLS.ERRORS.QUEUE_REQUIRED"
262               >Queue field is required</span
263             >
264           </div>
265         </div>
266       </md-input-container>
267       <md-input-container
268         ng-if="vm.anyCondition.field == 'routeId' && vm.trigger.channel == 'voice'"
269         class="md-block"
270       >
271         <label translate="TOOLS.OUTBOUNDROUTE">OutboundRoute</label>
272         <md-select name="value" ng-model="vm.anyCondition.value" required>
273           <md-option
274             ng-value="value.id"
275             ng-repeat="value in vm.outboundRoutes"
276             ng-disabled="value.canSelect === false"
277             >{{ value.exten }}</md-option
278           >
279         </md-select>
280         <div
281           ng-messages="anyConditionForm['value'].$error"
282           ng-show="anyConditionForm['value'].$touched"
283           role="alert"
284         >
285           <div ng-message="required">
286             <span translate="TOOLS.ERRORS.OUTBOUNDROUTE_REQUIRED"
287               >OutboundRoute field is required</span
288             >
289           </div>
290         </div>
291       </md-input-container>
292       <md-input-container
293         ng-if="vm.anyCondition.field == 'agent' && vm.trigger.channel == 'voice'"
294         class="md-block"
295       >
296         <label translate="TOOLS.AGENT">Agent</label>
297         <md-select name="value" ng-model="vm.anyCondition.value" required>
298           <md-option
299             ng-value="value.name"
300             ng-repeat="value in vm.agents"
301             ng-disabled="value.canSelect === false"
302             >{{ value.fullname }}</md-option
303           >
304         </md-select>
305         <div
306           ng-messages="anyConditionForm['value'].$error"
307           ng-show="anyConditionForm['value'].$touched"
308           role="alert"
309         >
310           <div ng-message="required">
311             <span translate="TOOLS.ERRORS.AGENT_REQUIRED"
312               >Agent field is required</span
313             >
314           </div>
315         </div>
316       </md-input-container>
317       <md-input-container
318         ng-if="vm.anyCondition.field == 'lastevent'"
319         class="md-block"
320       >
321         <label translate="TOOLS.VALUE">Value</label>
322         <md-select name="value" ng-model="vm.anyCondition.value" required>
323           <md-option ng-value="'abandoned'">Abandon</md-option>
324           <md-option ng-value="'timeout'">Timeout</md-option>
325           <md-option ng-value="'complete'">Hangup</md-option>
326           <md-option ng-value="'rejected'">Reject</md-option>
327           <md-option ng-value="'called'">Ring</md-option>
328           <md-option ng-value="'connect'">Answer</md-option>
329           <md-option ng-value="'nosuchnumber'">NoSuchNumber</md-option>
330           <md-option ng-value="'busy'">Busy</md-option>
331           <md-option ng-value="'noanswer'">NoAnswer</md-option>
332           <md-option ng-value="'congestion'">Congestion</md-option>
333           <md-option ng-value="'agentreject'">AgentReject</md-option>
334         </md-select>
335         <div
336           ng-messages="anyConditionForm['value'].$error"
337           ng-show="anyConditionForm['value'].$touched"
338           role="alert"
339         >
340           <div ng-message="required">
341             <span translate="TOOLS.ERRORS.VALUE_REQUIRED"
342               >Value field is required</span
343             >
344           </div>
345         </div>
346       </md-input-container>
347       <md-input-container
348         ng-if="vm.anyCondition.field == 'interaction' && vm.trigger.channel != 'voice'"
349         class="md-block"
350       >
351         <label translate="TOOLS.VALUE">Value</label>
352         <md-select name="value" ng-model="vm.anyCondition.value" required>
353           <md-option ng-value="'opened'">Opened</md-option>
354           <md-option ng-value="'closed'">Closed</md-option>
355         </md-select>
356         <div
357           ng-messages="anyConditionForm['value'].$error"
358           ng-show="anyConditionForm['value'].$touched"
359           role="alert"
360         >
361           <div ng-message="required">
362             <span translate="TOOLS.ERRORS.VALUE_REQUIRED"
363               >Value field is required</span
364             >
365           </div>
366         </div>
367       </md-input-container>
368       <md-input-container
369         ng-if="vm.anyCondition.field == 'message' && vm.trigger.channel != 'voice'"
370         class="md-block"
371       >
372         <label translate="TOOLS.VALUE">Value</label>
373         <md-select name="value" ng-model="vm.anyCondition.value" required>
374           <md-option ng-value="'in'">Incoming</md-option>
375           <md-option ng-value="'out'">Outgoing</md-option>
376           <md-option ng-value="'accept'">Accepted</md-option>
377           <md-option ng-value="'reject'">Rejected</md-option>
378         </md-select>
379         <div
380           ng-messages="anyConditionForm['value'].$error"
381           ng-show="anyConditionForm['value'].$touched"
382           role="alert"
383         >
384           <div ng-message="required">
385             <span translate="TOOLS.ERRORS.VALUE_REQUIRED"
386               >Value field is required</span
387             >
388           </div>
389         </div>
390       </md-input-container>
391
392       <div class="error-list">
393         <div
394           ng-repeat="error in vm.errors"
395           class="error"
396           layout="row"
397           layout-align="space-between center"
398         >
399           <div>
400             <span class="message">{{error.message}}</span>
401             <span class="type">({{error.type}})</span>
402           </div>
403           <md-button class="md-icon-button">
404             <md-icon
405               md-font-icon="icon-alert-box"
406               aria-label="alert error"
407               class="s16"
408             ></md-icon>
409           </md-button>
410         </div>
411       </div>
412     </md-dialog-content>
413
414     <md-dialog-actions
415       layout="row"
416       layout-align="space-between center"
417       ng-if="!vm.crudPermissions.readOnly"
418     >
419       <div layout="row" layout-align="start center">
420         <md-button
421           type="submit"
422           ng-if="vm.crudPermissions.canEdit && !vm.newAnyCondition"
423           ng-click="vm.saveAnyCondition()"
424           class="send-button md-accent md-raised"
425           ng-disabled="anyConditionForm.$invalid || anyConditionForm.$pristine"
426           aria-label="SAVE"
427           translate="TOOLS.SAVE"
428           translate-attr-aria-label="TOOLS.SAVE"
429         >
430           SAVE
431         </md-button>
432
433         <md-button
434           type="submit"
435           ng-if="vm.crudPermissions.canEdit && vm.newAnyCondition"
436           ng-click="vm.addNewAnyCondition()"
437           class="send-button md-accent md-raised"
438           ng-disabled="anyConditionForm.$invalid"
439           aria-label="ADD"
440           translate="TOOLS.ADD_ANYCONDITION"
441           translate-attr-aria-label="TOOLS.ADD_ANYCONDITION"
442         >
443           ADD ANYCONDITION
444         </md-button>
445       </div>
446       <div layout="row">
447         <md-button
448           class="md-icon-button"
449           ng-if="vm.crudPermissions.canDelete && !vm.newAnyCondition"
450           ng-click="vm.deleteAnyCondition($event)"
451           aria-label="DELETE"
452           translate
453           translate-attr-aria-label="TOOLS.DELETE"
454         >
455           <md-icon md-font-icon="icon-delete"></md-icon>
456           <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>
457         </md-button>
458       </div>
459     </md-dialog-actions>
460   </form>
461 </md-dialog>