1 <md-dialog class="cm-contact-dialog" aria-label="New Contact">
2 <form name="contactForm" class="md-inline-form" novalidate>
3 <md-toolbar class="md-accent md-hue-2">
5 class="md-toolbar-tools"
7 layout-align="space-between center"
9 <span class="title">{{ vm.title | translate }}</span>
10 <md-button class="md-icon-button" ng-click="vm.closeDialog()">
12 md-font-icon="icon-close"
13 aria-label="Close dialog"
19 <md-dialog-content ms-scroll>
20 <div class="error-list">
22 ng-repeat="error in vm.errors"
25 layout-align="space-between center"
28 <span class="message">{{error.message}}</span>
29 <span class="type">({{error.type}})</span>
31 <md-button class="md-icon-button">
33 md-font-icon="icon-alert-box"
34 aria-label="alert error"
41 <md-input-container class="md-block">
42 <label translate="CONTACTMANAGER.FIRSTNAME">First name</label>
45 ng-model="vm.contact.firstName"
51 ng-messages="contactForm.firstName.$error"
52 ng-show="contactForm.firstName.$touched"
55 <div ng-message="required">
56 <span translate="CONTACTMANAGER.ERRORS.FIRSTNAME_REQUIRED"
57 >First name field is required</span
63 <md-input-container class="md-block">
64 <label translate="CONTACTMANAGER.LASTNAME">Last name</label>
65 <input name="lastName" ng-model="vm.contact.lastName" />
68 <md-input-container class="md-block">
69 <label translate="CONTACTMANAGER.PHONE">Phone</label>
70 <input name="phone" ng-model="vm.contact.phone" />
73 <md-input-container class="md-block">
74 <label translate="CONTACTMANAGER.EMAIL">Email</label>
75 <input name="email" type="email" ng-model="vm.contact.email" />
78 <md-input-container class="md-block">
79 <label translate="CONTACTMANAGER.MOBILE">Mobile</label>
80 <input name="mobile" ng-model="vm.contact.mobile" />
83 <md-input-container class="md-block">
84 <label translate="CONTACTMANAGER.FAX">Fax</label>
85 <input name="fax" ng-model="vm.contact.fax" />
88 <md-input-container class="md-block">
89 <label translate="CONTACTMANAGER.LIST">List</label>
92 ng-model="vm.contact.ListId"
93 ng-disabled="vm.contact.id && vm.contact.ListId"
94 ng-init="vm.getCustomFields(vm.contact.ListId)"
95 ng-change="vm.getCustomFields(vm.contact.ListId)"
98 <md-optgroup label="Lists">
99 <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows"
100 >{{list.name}}</md-option
102 <md-option ng-value="null"
103 ><em translate="CONTACTMANAGER.NONE">None</em></md-option
109 ng-messages="contactForm.list.$error"
110 ng-show="contactForm.list.$touched"
113 <div ng-message="required">
114 <span translate="CONTACTMANAGER.ERRORS.LIST_REQUIRED"
115 >List field is required</span
119 </md-input-container>
122 ng-repeat="customField in vm.customFields.rows"
124 ng-switch="customField.type"
126 <div ng-switch-when="datetime">
127 <label>{{customField.alias}}</label>
130 ng-init="vm.contact['cf_' + customField.id] = vm.getDateFromString(vm.contact['cf_' + customField.id])"
134 ng-required="customField.required"
135 mdp-format="YYYY-MM-DD"
136 ng-model="vm.contact['cf_' + customField.id]"
140 mdp-placeholder="Time"
141 ng-required="customField.required"
142 mdp-format="HH:mm:ss"
143 mdp-auto-switch="true"
144 ng-model="vm.contact['cf_' + customField.id]"
149 <div ng-switch-when="select">
150 <label>{{customField.alias}}</label>
153 ng-model="vm.contact['cf_' + customField.id]"
154 ng-required="customField.required"
157 ng-repeat="value in customField.values"
158 ng-value="value.value"
159 >{{value.value}}</md-option
161 <md-option ng-value="null"
162 ><em translate="CONTACTMANAGER.NONE">None</em></md-option
167 <div ng-switch-when="switch">
169 aria-label="{{customField.alias}}"
170 ng-model="vm.contact['cf_' + customField.id]"
174 {{customField.alias}}
178 <md-input-container ng-switch-default>
179 <label>{{customField.alias}}</label>
182 type="{{customField.type}}"
183 ng-model="vm.contact['cf_' + customField.id]"
184 ng-required="customField.required"
186 </md-input-container>
189 <md-input-container class="md-block">
190 <label translate="CONTACTMANAGER.COMPANY">Company</label>
191 <md-select name="company" ng-model="vm.contact.CompanyId">
193 ng-value="company.id"
194 ng-repeat="company in vm.companies.rows"
195 ng-hide="!vm.contact.CompanyId && company.canSelect === false"
196 ng-disabled="company.canSelect === false"
197 >{{company.name}}</md-option
200 </md-input-container>
202 <div ng-if="!vm.allFields" layout="row" layout-align="center center">
205 ng-click="vm.allFields = true"
206 translate="CONTACTMANAGER.SHOW_ALL_FIELDS"
207 >Show All Fields</md-button
215 ng-init="vm.contact.dateOfBirth = vm.getDateFromString(vm.contact.dateOfBirth)"
217 <label translate="CONTACTMANAGER.DATE_OF_BIRTH">Date of Birth</label>
220 mdp-format="YYYY-MM-DD"
222 ng-model="vm.contact.dateOfBirth"
224 </md-input-container>
226 <md-input-container class="md-block" ng-if="vm.allFields">
227 <label translate="CONTACTMANAGER.COUNTRY">Country</label>
228 <input type="text" name="country" ng-model="vm.contact.country" />
229 </md-input-container>
231 <md-input-container class="md-block" ng-if="vm.allFields">
232 <label translate="CONTACTMANAGER.CITY">City</label>
233 <input type="text" name="city" ng-model="vm.contact.city" />
234 </md-input-container>
236 <md-input-container class="md-block" ng-if="vm.allFields">
237 <label translate="CONTACTMANAGER.STREET">Street</label>
238 <input type="text" name="street" ng-model="vm.contact.street" />
239 </md-input-container>
241 <md-input-container class="md-block" ng-if="vm.allFields">
242 <label translate="CONTACTMANAGER.POSTAL_CODE">Postal Code</label>
243 <input type="text" name="postalCode" ng-model="vm.contact.postalCode" />
244 </md-input-container>
246 <md-input-container class="md-block" ng-if="vm.allFields">
247 <label translate="CONTACTMANAGER.NOTES">Notes</label>
251 ng-model="vm.contact.description"
253 </md-input-container>
255 <div ng-if="vm.allFields" layout="row" layout-align="center center">
258 ng-click="vm.allFields = false"
259 translate="CONTACTMANAGER.FEWER_FIELDS"
260 >Fewer Fields</md-button
264 <div class="error-list">
266 ng-repeat="error in vm.errors"
269 layout-align="space-between center"
272 <span class="message">{{error.message}}</span>
273 <span class="type">({{error.type}})</span>
275 <md-button class="md-icon-button">
277 md-font-icon="icon-alert-box"
278 aria-label="alert error"
286 <md-dialog-actions layout="row" layout-align="space-between center">
289 layout-align="start center"
290 ng-if="vm.crudPermissions.canEdit"
294 ng-if="!vm.newContact"
295 ng-click="vm.saveContact()"
296 class="send-button md-accent md-raised"
297 ng-disabled="contactForm.$invalid || contactForm.$pristine"
299 translate="CONTACTMANAGER.SAVE"
300 translate-attr-aria-label="CONTACTMANAGER.SAVE"
307 ng-if="vm.newContact"
308 ng-click="vm.addNewContact()"
309 class="send-button md-accent md-raised"
310 ng-disabled="contactForm.$invalid || contactForm.$pristine"
312 translate="CONTACTMANAGER.ADD_CONTACT"
313 translate-attr-aria-label="CONTACTMANAGER.ADD_CONTACT"
320 class="md-icon-button"
321 ng-if="vm.crudPermissions.canDelete && !vm.newContact"
322 ng-click="vm.deleteContact($event)"
325 translate-attr-aria-label="CONTACTMANAGER.DELETE"
327 <md-icon md-font-icon="icon-delete"></md-icon>
329 ><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip