f59670a4f3dcdaa4fc334131f0187cb5da7ff42a
[motion-next.git] /
1 <md-dialog class="cannedAnswer-dialog" aria-label="New CannedAnswer">
2   <form name="cannedAnswerForm" 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.KEY">Key</label>
42         <input
43           type="text"
44           name="key"
45           ng-model="vm.cannedAnswer.key"
46           md-maxlength="255"
47           ng-required="true"
48           autofocus
49         />
50
51         <div
52           ng-messages="cannedAnswerForm['key'].$error"
53           ng-show="cannedAnswerForm['key'].$touched"
54           role="alert"
55         >
56           <div ng-message="required">
57             <span translate="TOOLS.ERRORS.KEY_REQUIRED"
58               >Key field is required</span
59             >
60           </div>
61           <div ng-message="md-maxlength">
62             <span
63               translate="TOOLS.ERRORS.KEY_MAX_LENGTH"
64               translate-values="{max: 255}"
65               >Key must have a maximum length equal to 255</span
66             >
67           </div>
68         </div>
69       </md-input-container>
70       <md-input-container class="md-block">
71         <label translate="TOOLS.VALUE">Value</label>
72         <textarea
73           name="value"
74           ng-model="vm.cannedAnswer.value"
75           required
76         ></textarea>
77
78         <div
79           ng-messages="cannedAnswerForm['value'].$error"
80           ng-show="cannedAnswerForm['value'].$touched"
81           role="alert"
82         >
83           <div ng-message="required">
84             <span translate="TOOLS.ERRORS.VALUE_REQUIRED"
85               >Value field is required</span
86             >
87           </div>
88         </div>
89       </md-input-container>
90       <md-input-container class="md-block">
91         <label translate="TOOLS.DESCRIPTION">Description</label>
92         <input
93           type="text"
94           name="description"
95           ng-model="vm.cannedAnswer.description"
96         />
97
98         <div
99           ng-messages="cannedAnswerForm['description'].$error"
100           ng-show="cannedAnswerForm['description'].$touched"
101           role="alert"
102         >
103           <div ng-message="required">
104             <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED"
105               >Description field is required</span
106             >
107           </div>
108         </div>
109       </md-input-container>
110
111       <div class="error-list">
112         <div
113           ng-repeat="error in vm.errors"
114           class="error"
115           layout="row"
116           layout-align="space-between center"
117         >
118           <div>
119             <span class="message">{{error.message}}</span>
120             <span class="type">({{error.type}})</span>
121           </div>
122           <md-button class="md-icon-button">
123             <md-icon
124               md-font-icon="icon-alert-box"
125               aria-label="alert error"
126               class="s16"
127             ></md-icon>
128           </md-button>
129         </div>
130       </div>
131     </md-dialog-content>
132
133     <md-dialog-actions
134       layout="row"
135       layout-align="space-between center"
136       ng-if="!vm.crudPermissions.readOnly"
137     >
138       <div layout="row" layout-align="start center">
139         <md-button
140           type="submit"
141           ng-if="vm.crudPermissions.canEdit && !vm.newCannedAnswer"
142           ng-click="vm.saveCannedAnswer()"
143           class="send-button md-accent md-raised"
144           ng-disabled="cannedAnswerForm.$invalid || cannedAnswerForm.$pristine"
145           aria-label="SAVE"
146           translate="TOOLS.SAVE"
147           translate-attr-aria-label="TOOLS.SAVE"
148         >
149           SAVE
150         </md-button>
151
152         <md-button
153           type="submit"
154           ng-if="vm.crudPermissions.canEdit && vm.newCannedAnswer"
155           ng-click="vm.addNewCannedAnswer()"
156           class="send-button md-accent md-raised"
157           ng-disabled="cannedAnswerForm.$invalid"
158           aria-label="ADD"
159           translate="TOOLS.ADD_CANNEDANSWER"
160           translate-attr-aria-label="TOOLS.ADD_CANNEDANSWER"
161         >
162           ADD CANNEDANSWER
163         </md-button>
164       </div>
165       <div layout="row">
166         <md-button
167           class="md-icon-button"
168           ng-if="vm.crudPermissions.canDelete && !vm.newCannedAnswer"
169           ng-click="vm.deleteCannedAnswer($event)"
170           aria-label="DELETE"
171           translate
172           translate-attr-aria-label="TOOLS.DELETE"
173         >
174           <md-icon md-font-icon="icon-delete"></md-icon>
175           <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>
176         </md-button>
177       </div>
178     </md-dialog-actions>
179   </form>
180 </md-dialog>