786edfdef8a14e7c29b4d490295d192684d2c9eb
[motion-next.git] /
1 <md-dialog class="globalCustomField-dialog" aria-label="New GlobalCustomField">
2   <form name="globalCustomFieldForm" 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.globalCustomField.alias"
46           ng-required="true"
47           autofocus
48         />
49
50         <div
51           ng-messages="globalCustomFieldForm['alias'].$error"
52           ng-show="globalCustomFieldForm['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.globalCustomField.type"
67           required
68           ng-disabled="!vm.newGlobalCustomField"
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="globalCustomFieldForm['type'].$error"
78           ng-show="globalCustomFieldForm['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.globalCustomField.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.globalCustomField.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.globalCustomField.values.length"
105               class="md-fab md-mini md-warn md-secondary"
106               ng-click="vm.removeItems(vm.globalCustomField.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.globalCustomField.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.globalCustomField.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.globalCustomField.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
165           ng-model="vm.globalCustomField.required"
166           aria-label="Required"
167           ><span translate="CONTACTMANAGER.REQUIRED">Required</span></md-switch
168         >
169       </md-input-container>
170       <md-input-container
171         ng-if="vm.globalCustomField.type == 'text'"
172         class="md-block"
173       >
174         <md-switch
175           ng-model="vm.globalCustomField.clickToAction"
176           aria-label="ClickToAction"
177           ><span translate="CONTACTMANAGER.CLICKTOACTION"
178             >ClickToAction</span
179           ></md-switch
180         >
181       </md-input-container>
182       <md-input-container
183         ng-if="vm.globalCustomField.clickToAction"
184         class="md-block"
185       >
186         <label translate="CONTACTMANAGER.ACTIONTYPE">ActionType</label>
187         <md-select name="actionType" ng-model="vm.globalCustomField.actionType">
188           <md-option ng-value="'voice'">Voice</md-option>
189         </md-select>
190         <div
191           ng-messages="globalCustomFieldForm['actionType'].$error"
192           ng-show="globalCustomFieldForm['actionType'].$touched"
193           role="alert"
194         >
195           <div ng-message="required">
196             <span translate="CONTACTMANAGER.ERRORS.ACTIONTYPE_REQUIRED"
197               >ActionType field is required</span
198             >
199           </div>
200         </div>
201       </md-input-container>
202
203       <div class="error-list">
204         <div
205           ng-repeat="error in vm.errors"
206           class="error"
207           layout="row"
208           layout-align="space-between center"
209         >
210           <div>
211             <span class="message">{{error.message}}</span>
212             <span class="type">({{error.type}})</span>
213           </div>
214           <md-button class="md-icon-button">
215             <md-icon
216               md-font-icon="icon-alert-box"
217               aria-label="alert error"
218               class="s16"
219             ></md-icon>
220           </md-button>
221         </div>
222       </div>
223     </md-dialog-content>
224
225     <md-dialog-actions
226       layout="row"
227       layout-align="space-between center"
228       ng-if="!vm.crudPermissions.readOnly"
229     >
230       <div layout="row" layout-align="start center">
231         <md-button
232           type="submit"
233           ng-if="vm.crudPermissions.canEdit && !vm.newGlobalCustomField"
234           ng-click="vm.saveGlobalCustomField()"
235           class="send-button md-accent md-raised"
236           ng-disabled="globalCustomFieldForm.$invalid || globalCustomFieldForm.$pristine"
237           aria-label="SAVE"
238           translate="CONTACTMANAGER.SAVE"
239           translate-attr-aria-label="CONTACTMANAGER.SAVE"
240         >
241           SAVE
242         </md-button>
243
244         <md-button
245           type="submit"
246           ng-if="vm.crudPermissions.canEdit && vm.newGlobalCustomField"
247           ng-click="vm.addNewGlobalCustomField()"
248           class="send-button md-accent md-raised"
249           ng-disabled="globalCustomFieldForm.$invalid"
250           aria-label="ADD"
251           translate="CONTACTMANAGER.ADD_GLOBALCUSTOMFIELD"
252           translate-attr-aria-label="CONTACTMANAGER.ADD_GLOBALCUSTOMFIELD"
253         >
254           ADD GLOBALCUSTOMFIELD
255         </md-button>
256       </div>
257       <div layout="row">
258         <md-button
259           class="md-icon-button"
260           ng-if="vm.crudPermissions.canDelete && !vm.newGlobalCustomField"
261           ng-click="vm.deleteGlobalCustomField($event)"
262           aria-label="DELETE"
263           translate
264           translate-attr-aria-label="CONTACTMANAGER.DELETE"
265         >
266           <md-icon md-font-icon="icon-delete"></md-icon>
267           <md-tooltip
268             ><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip
269           >
270         </md-button>
271       </div>
272     </md-dialog-actions>
273   </form>
274 </md-dialog>