bb1b0d3119468e186ad6db883271f6f8b7fe18e5
[motion-next.git] /
1 <md-dialog class="customField-dialog" aria-label="New CustomField">
2   <form name="customFieldForm" 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="CONTACTMANAGER.ALIAS">Alias</label>
42         <input
43           type=""
44           name="alias"
45           ng-model="vm.customField.alias"
46           ng-required="true"
47           autofocus
48         />
49
50         <div
51           ng-messages="customFieldForm['alias'].$error"
52           ng-show="customFieldForm['alias'].$touched"
53           role="alert"
54         >
55           <div ng-message="required">
56             <span translate="CONTACTMANAGER.ERRORS.ALIAS_REQUIRED"
57               >Alias field is required</span
58             >
59           </div>
60         </div>
61       </md-input-container>
62       <md-input-container class="md-block">
63         <label translate="CONTACTMANAGER.TYPE">Type</label>
64         <md-select
65           name="type"
66           ng-model="vm.customField.type"
67           required
68           ng-disabled="!vm.newCustomField"
69         >
70           <md-option ng-value="'text'">Text</md-option>
71           <md-option ng-value="'select'">Select</md-option>
72           <md-option ng-value="'number'">Number</md-option>
73           <md-option ng-value="'switch'">Switch</md-option>
74           <md-option ng-value="'datetime'">Datetime</md-option>
75         </md-select>
76         <div
77           ng-messages="customFieldForm['type'].$error"
78           ng-show="customFieldForm['type'].$touched"
79           role="alert"
80         >
81           <div ng-message="required">
82             <span translate="CONTACTMANAGER.ERRORS.TYPE_REQUIRED"
83               >Type field is required</span
84             >
85           </div>
86         </div>
87       </md-input-container>
88       <div ng-if="vm.customField.type == 'select'" class="md-block">
89         <md-list>
90           <md-list-item layout-margin>
91             <md-button
92               class="md-fab md-mini md-secondary"
93               ng-click="vm.addItem(vm.customField.values);"
94             >
95               <md-tooltip
96                 ><span translate="CONTACTMANAGER.ADD">ADD</span></md-tooltip
97               >
98               <md-icon
99                 md-font-icon="icon-plus"
100                 aria-label="alert error"
101               ></md-icon>
102             </md-button>
103             <md-button
104               ng-if="vm.customField.values.length"
105               class="md-fab md-mini md-warn md-secondary"
106               ng-click="vm.removeItems(vm.customField.values);"
107             >
108               <md-tooltip
109                 ><span translate="CONTACTMANAGER.DELETE_ALL"
110                   >Delete All</span
111                 ></md-tooltip
112               >
113               <md-icon
114                 md-font-icon="icon-delete"
115                 aria-label="alert error"
116               ></md-icon>
117             </md-button>
118           </md-list-item>
119         </md-list>
120         <md-list ng-sortable="vm.sortable">
121           <md-list-item
122             ng-repeat="item in vm.customField.values"
123             style="border: 1px solid #ccc !important; border-radius: 7px"
124             layout-margin
125           >
126             <div>
127               <md-icon
128                 class="s24"
129                 style="cursor: move"
130                 md-font-icon="icon-drag"
131                 aria-label="drag"
132               ></md-icon>
133               <input type="text" ng-model="item.value" flex />
134             </div>
135             <md-button
136               class="md-fab md-mini md-warn md-secondary"
137               ng-click="vm.removeItem(vm.customField.values, $index);"
138             >
139               <md-tooltip
140                 ><span translate="CONTACTMANAGER.DELETE"
141                   >DELETE</span
142                 ></md-tooltip
143               >
144               <md-icon
145                 md-font-icon="icon-delete"
146                 aria-label="alert error"
147               ></md-icon>
148             </md-button>
149           </md-list-item>
150         </md-list>
151         <md-list>
152           <md-list-item
153             ng-if="!vm.customField.values.length"
154             layout="row"
155             layout-align="center center"
156           >
157             <em translate="CONTACTMANAGER.NO_AVAILABLE_ITEMS"
158               >No Available Items</em
159             >
160           </md-list-item>
161         </md-list>
162       </div>
163       <md-input-container class="md-block">
164         <md-switch ng-model="vm.customField.required" aria-label="Required"
165           ><span translate="CONTACTMANAGER.REQUIRED">Required</span></md-switch
166         >
167       </md-input-container>
168       <md-input-container
169         ng-if="vm.customField.type == 'text'"
170         class="md-block"
171       >
172         <md-switch
173           ng-model="vm.customField.clickToAction"
174           aria-label="clickToAction"
175           ><span translate="CONTACTMANAGER.CLICKTOACTION"
176             >clickToAction</span
177           ></md-switch
178         >
179       </md-input-container>
180       <md-input-container ng-if="vm.customField.clickToAction" class="md-block">
181         <label translate="CONTACTMANAGER.ACTIONTYPE">actionType</label>
182         <md-select name="actionType" ng-model="vm.customField.actionType">
183           <md-option ng-value="'voice'">Voice</md-option>
184         </md-select>
185         <div
186           ng-messages="customFieldForm['actionType'].$error"
187           ng-show="customFieldForm['actionType'].$touched"
188           role="alert"
189         >
190           <div ng-message="required">
191             <span translate="CONTACTMANAGER.ERRORS.ACTIONTYPE_REQUIRED"
192               >actionType field is required</span
193             >
194           </div>
195         </div>
196       </md-input-container>
197
198       <div class="error-list">
199         <div
200           ng-repeat="error in vm.errors"
201           class="error"
202           layout="row"
203           layout-align="space-between center"
204         >
205           <div>
206             <span class="message">{{error.message}}</span>
207             <span class="type">({{error.type}})</span>
208           </div>
209           <md-button class="md-icon-button">
210             <md-icon
211               md-font-icon="icon-alert-box"
212               aria-label="alert error"
213               class="s16"
214             ></md-icon>
215           </md-button>
216         </div>
217       </div>
218     </md-dialog-content>
219
220     <md-dialog-actions
221       layout="row"
222       layout-align="space-between center"
223       ng-if="!vm.crudPermissions.readOnly"
224     >
225       <div layout="row" layout-align="start center">
226         <md-button
227           type="submit"
228           ng-if="vm.crudPermissions.canEdit && !vm.newCustomField"
229           ng-click="vm.saveCustomField()"
230           class="send-button md-accent md-raised"
231           ng-disabled="customFieldForm.$invalid || customFieldForm.$pristine"
232           aria-label="SAVE"
233           translate="CONTACTMANAGER.SAVE"
234           translate-attr-aria-label="CONTACTMANAGER.SAVE"
235         >
236           SAVE
237         </md-button>
238
239         <md-button
240           type="submit"
241           ng-if="vm.crudPermissions.canEdit && vm.newCustomField"
242           ng-click="vm.addNewCustomField()"
243           class="send-button md-accent md-raised"
244           ng-disabled="customFieldForm.$invalid"
245           aria-label="ADD"
246           translate="CONTACTMANAGER.ADD_CUSTOMFIELD"
247           translate-attr-aria-label="CONTACTMANAGER.ADD_CUSTOMFIELD"
248         >
249           ADD CUSTOMFIELD
250         </md-button>
251       </div>
252       <div layout="row">
253         <md-button
254           class="md-icon-button"
255           ng-if="vm.crudPermissions.canDelete && !vm.newCustomField"
256           ng-click="vm.deleteCustomField($event)"
257           aria-label="DELETE"
258           translate
259           translate-attr-aria-label="CONTACTMANAGER.DELETE"
260         >
261           <md-icon md-font-icon="icon-delete"></md-icon>
262           <md-tooltip
263             ><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip
264           >
265         </md-button>
266       </div>
267     </md-dialog-actions>
268   </form>
269 </md-dialog>