f2085703abfc2adc5190cfe60ff2259ef7ba46fe
[motion-next.git] /
1 <md-dialog class="allCondition-dialog" aria-label="New AllCondition">
2   <form name="allConditionForm" 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"
10           >{{ vm.newAllCondition ? 'TOOLS.NEW_ALLCONDITION' :
11           'TOOLS.EDIT_ALLCONDITION' | translate }}</span
12         >
13         <md-button class="md-icon-button" ng-click="vm.closeDialog()">
14           <md-icon
15             md-font-icon="icon-close"
16             aria-label="Close dialog"
17           ></md-icon>
18         </md-button>
19       </div>
20     </md-toolbar>
21     <md-dialog-content ms-scroll>
22       <md-input-container class="md-block">
23         <label translate="TOOLS.FIELD">Field</label>
24         <md-select
25           name="field"
26           ng-model="vm.allCondition.field"
27           ng-change="vm.onFieldSelection()"
28           md-autofocus
29           required
30         >
31           <md-option ng-value="'queue'" ng-if="vm.trigger.channel == 'voice'">
32             {{ 'TOOLS.QUEUE' | translate }}
33           </md-option>
34           <md-option
35             ng-value="'lastevent'"
36             ng-if="vm.trigger.channel == 'voice'"
37           >
38             {{ 'TOOLS.CALL_STATUS' | translate }}
39           </md-option>
40           <md-option ng-value="'routeId'" ng-if="vm.trigger.channel == 'voice'">
41             {{ 'TOOLS.OUTBOUNDROUTE' | translate }}
42           </md-option>
43           <md-option ng-value="'agent'" ng-if="vm.trigger.channel == 'voice'">
44             {{ 'TOOLS.AGENT' | translate }}
45           </md-option>
46           <md-option ng-value="'account'" ng-if="vm.trigger.channel != 'voice'">
47             {{ 'TOOLS.ACCOUNT' | translate }}
48           </md-option>
49           <md-option
50             ng-value="'interaction'"
51             ng-if="vm.trigger.channel != 'voice'"
52           >
53             {{ 'TOOLS.INTERACTION' | translate }}
54           </md-option>
55           <md-option ng-value="'message'" ng-if="vm.trigger.channel != 'voice'">
56             {{ 'TOOLS.MESSAGE' | translate }}
57           </md-option>
58         </md-select>
59         <div
60           ng-messages="allConditionForm['field'].$error"
61           ng-show="allConditionForm['field'].$touched"
62           role="alert"
63         >
64           <div ng-message="required">
65             <span translate="TOOLS.ERRORS.FIELD_REQUIRED"
66               >Field field is required</span
67             >
68           </div>
69         </div>
70       </md-input-container>
71       <md-input-container class="md-block">
72         <label translate="TOOLS.OPERATOR">Operator</label>
73         <md-select name="operator" ng-model="vm.allCondition.operator" required>
74           <md-option ng-value="'equals'">
75             {{ 'TOOLS.EQUALS' | translate }}
76           </md-option>
77           <md-option ng-value="'not_equals'">
78             {{ 'TOOLS.NOT_EQUALS' | translate }}
79           </md-option>
80         </md-select>
81         <div
82           ng-messages="allConditionForm['operator'].$error"
83           ng-show="allConditionForm['operator'].$touched"
84           role="alert"
85         >
86           <div ng-message="required">
87             <span translate="TOOLS.ERRORS.OPERATOR_REQUIRED"
88               >Operator field is required</span
89             >
90           </div>
91         </div>
92       </md-input-container>
93       <md-input-container
94         ng-if="vm.allCondition.field == 'account'"
95         class="md-block"
96       >
97         <label translate="TOOLS.ACCOUNT">Account</label>
98         <md-select name="value" ng-model="vm.allCondition.value" required>
99           <md-option
100             ng-value="value.id"
101             ng-repeat="value in vm.accounts"
102             ng-disabled="value.canSelect === false"
103           >
104             {{ value.name }}</md-option
105           >
106         </md-select>
107         <div
108           ng-messages="allConditionForm['value'].$error"
109           ng-show="allConditionForm['value'].$touched"
110           role="alert"
111         >
112           <div ng-message="required">
113             <span translate="TOOLS.ERRORS.ACCOUNT_REQUIRED"
114               >Account field is required</span
115             >
116           </div>
117         </div>
118       </md-input-container>
119       <md-input-container
120         ng-if="vm.allCondition.field == 'queue' && vm.trigger.channel == 'voice'"
121         class="md-block"
122       >
123         <label translate="TOOLS.QUEUE">Queue</label>
124         <md-select name="value" ng-model="vm.allCondition.value" required>
125           <md-option
126             ng-value="value.name"
127             ng-repeat="value in vm.queues"
128             ng-disabled="value.canSelect === false"
129           >
130             {{ value.name }}</md-option
131           >
132         </md-select>
133         <div
134           ng-messages="allConditionForm['value'].$error"
135           ng-show="allConditionForm['value'].$touched"
136           role="alert"
137         >
138           <div ng-message="required">
139             <span translate="TOOLS.ERRORS.QUEUE_REQUIRED"
140               >Queue field is required</span
141             >
142           </div>
143         </div>
144       </md-input-container>
145       <md-input-container
146         ng-if="vm.allCondition.field == 'routeId' && vm.trigger.channel == 'voice'"
147         class="md-block"
148       >
149         <label translate="TOOLS.OUTBOUNDROUTE">OutboundRoute</label>
150         <md-select name="value" ng-model="vm.allCondition.value" required>
151           <md-option
152             ng-value="value.id"
153             ng-repeat="value in vm.outboundRoutes"
154             ng-disabled="value.canSelect === false"
155           >
156             {{ value.exten }}</md-option
157           >
158         </md-select>
159         <div
160           ng-messages="allConditionForm['value'].$error"
161           ng-show="allConditionForm['value'].$touched"
162           role="alert"
163         >
164           <div ng-message="required">
165             <span translate="TOOLS.ERRORS.OUTBOUNDROUTE_REQUIRED"
166               >OutboundRoute field is required</span
167             >
168           </div>
169         </div>
170       </md-input-container>
171       <md-input-container
172         ng-if="vm.allCondition.field == 'agent' && vm.trigger.channel == 'voice'"
173         class="md-block"
174       >
175         <label translate="TOOLS.AGENT">Agent</label>
176         <md-select name="value" ng-model="vm.allCondition.value" required>
177           <md-option
178             ng-value="value.name"
179             ng-repeat="value in vm.agents"
180             ng-disabled="value.canSelect === false"
181           >
182             {{ value.fullname }}</md-option
183           >
184         </md-select>
185         <div
186           ng-messages="allConditionForm['value'].$error"
187           ng-show="allConditionForm['value'].$touched"
188           role="alert"
189         >
190           <div ng-message="required">
191             <span translate="TOOLS.ERRORS.AGENT_REQUIRED"
192               >Agent field is required</span
193             >
194           </div>
195         </div>
196       </md-input-container>
197       <md-input-container
198         ng-if="vm.allCondition.field == 'lastevent'"
199         class="md-block"
200       >
201         <label translate="TOOLS.VALUE">Value</label>
202         <md-select name="value" ng-model="vm.allCondition.value" required>
203           <md-option
204             ng-value="status.value"
205             ng-repeat="status in vm.callStatuses"
206           >
207             {{ status.name }}</md-option
208           >
209         </md-select>
210         <div
211           ng-messages="allConditionForm['value'].$error"
212           ng-show="allConditionForm['value'].$touched"
213           role="alert"
214         >
215           <div ng-message="required">
216             <span translate="TOOLS.ERRORS.VALUE_REQUIRED"
217               >Value field is required</span
218             >
219           </div>
220         </div>
221       </md-input-container>
222       <md-input-container
223         ng-if="vm.allCondition.field == 'interaction' && vm.trigger.channel != 'voice'"
224         class="md-block"
225       >
226         <label translate="TOOLS.VALUE">Value</label>
227         <md-select name="value" ng-model="vm.allCondition.value" required>
228           <md-option ng-value="'opened'">Opened</md-option>
229           <md-option ng-value="'closed'">Closed</md-option>
230         </md-select>
231         <div
232           ng-messages="allConditionForm['value'].$error"
233           ng-show="allConditionForm['value'].$touched"
234           role="alert"
235         >
236           <div ng-message="required">
237             <span translate="TOOLS.ERRORS.VALUE_REQUIRED"
238               >Value field is required</span
239             >
240           </div>
241         </div>
242       </md-input-container>
243       <md-input-container
244         ng-if="vm.allCondition.field == 'message' && vm.trigger.channel != 'voice'"
245         class="md-block"
246       >
247         <label translate="TOOLS.VALUE">Value</label>
248         <md-select name="value" ng-model="vm.allCondition.value" required>
249           <md-option ng-value="'in'">Incoming</md-option>
250           <md-option ng-value="'out'">Outgoing</md-option>
251           <md-option ng-value="'accept'">Accepted</md-option>
252           <md-option ng-value="'reject'">Rejected</md-option>
253         </md-select>
254         <div
255           ng-messages="allConditionForm['value'].$error"
256           ng-show="allConditionForm['value'].$touched"
257           role="alert"
258         >
259           <div ng-message="required">
260             <span translate="TOOLS.ERRORS.VALUE_REQUIRED"
261               >Value field is required</span
262             >
263           </div>
264         </div>
265       </md-input-container>
266       <div class="error-list">
267         <div
268           ng-repeat="error in vm.errors"
269           class="error"
270           layout="row"
271           layout-align="space-between center"
272         >
273           <div>
274             <span class="message">{{error.message}}</span>
275             <span class="type">({{error.type}})</span>
276           </div>
277           <md-button class="md-icon-button">
278             <md-icon
279               md-font-icon="icon-alert-box"
280               aria-label="alert error"
281               class="s16"
282             ></md-icon>
283           </md-button>
284         </div>
285       </div>
286     </md-dialog-content>
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.newAllCondition"
296           ng-click="vm.saveAllCondition()"
297           class="send-button md-accent md-raised"
298           ng-disabled="allConditionForm.$invalid || allConditionForm.$pristine"
299           aria-label="SAVE"
300           translate="TOOLS.SAVE"
301           translate-attr-aria-label="TOOLS.SAVE"
302         >
303           SAVE
304         </md-button>
305         <md-button
306           type="submit"
307           ng-if="vm.crudPermissions.canEdit && vm.newAllCondition"
308           ng-click="vm.addNewAllCondition()"
309           class="send-button md-accent md-raised"
310           ng-disabled="allConditionForm.$invalid"
311           aria-label="ADD"
312           translate="TOOLS.ADD_ALLCONDITION"
313           translate-attr-aria-label="TOOLS.ADD_ALLCONDITION"
314         >
315           ADD ALLCONDITION
316         </md-button>
317       </div>
318       <div layout="row">
319         <md-button
320           class="md-icon-button"
321           ng-if="vm.crudPermissions.canDelete && !vm.newAllCondition"
322           ng-click="vm.deleteAllCondition($event)"
323           aria-label="DELETE"
324           translate
325           translate-attr-aria-label="TOOLS.DELETE"
326         >
327           <md-icon md-font-icon="icon-delete"></md-icon>
328           <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>
329         </md-button>
330       </div>
331     </md-dialog-actions>
332   </form>
333 </md-dialog>