@memberjunction/ng-explorer-settings 0.9.10 → 0.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/entity-form-dialog/entity-form-dialog.component.d.ts +33 -0
- package/dist/lib/entity-form-dialog/entity-form-dialog.component.js +183 -0
- package/dist/lib/entity-form-window/entity-form-window.component.d.ts +17 -0
- package/dist/lib/entity-form-window/entity-form-window.component.js +99 -0
- package/dist/lib/module.d.ts +19 -14
- package/dist/lib/module.js +40 -8
- package/dist/lib/record-list/record-list.component.d.ts +41 -0
- package/dist/lib/record-list/record-list.component.js +324 -0
- package/dist/lib/roles-list/roles-list.component.d.ts +11 -1
- package/dist/lib/roles-list/roles-list.component.js +125 -26
- package/dist/lib/settings/settings.component.d.ts +6 -2
- package/dist/lib/settings/settings.component.js +52 -41
- package/dist/lib/single-role/single-role.component.d.ts +16 -13
- package/dist/lib/single-role/single-role.component.js +110 -182
- package/dist/lib/single-user/single-user.component.d.ts +24 -0
- package/dist/lib/single-user/single-user.component.js +191 -0
- package/dist/lib/user-roles-grid/user-roles-grid.component.d.ts +41 -0
- package/dist/lib/user-roles-grid/user-roles-grid.component.js +320 -0
- package/dist/public-api.d.ts +2 -1
- package/dist/public-api.js +2 -1
- package/package.json +9 -4
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Component, Input, EventEmitter, Output } from '@angular/core';
|
|
11
|
+
import { Metadata, RunView } from '@memberjunction/core';
|
|
12
|
+
import { SharedService, kendoSVGIcon } from '@memberjunction/ng-shared';
|
|
13
|
+
import * as i0 from "@angular/core";
|
|
14
|
+
import * as i1 from "@angular/router";
|
|
15
|
+
import * as i2 from "@angular/common";
|
|
16
|
+
import * as i3 from "@progress/kendo-angular-dialog";
|
|
17
|
+
import * as i4 from "@memberjunction/ng-container-directives";
|
|
18
|
+
import * as i5 from "@progress/kendo-angular-buttons";
|
|
19
|
+
import * as i6 from "@progress/kendo-angular-icons";
|
|
20
|
+
import * as i7 from "@memberjunction/ng-entity-form-dialog";
|
|
21
|
+
import * as i8 from "@progress/kendo-angular-indicators";
|
|
22
|
+
function RecordListComponent_div_3_Template(rf, ctx) { if (rf & 1) {
|
|
23
|
+
i0.ɵɵelementStart(0, "div");
|
|
24
|
+
i0.ɵɵelement(1, "kendo-loader");
|
|
25
|
+
i0.ɵɵelementEnd();
|
|
26
|
+
} }
|
|
27
|
+
function RecordListComponent_table_4_th_3_Template(rf, ctx) { if (rf & 1) {
|
|
28
|
+
i0.ɵɵelementStart(0, "th");
|
|
29
|
+
i0.ɵɵtext(1);
|
|
30
|
+
i0.ɵɵelementEnd();
|
|
31
|
+
} if (rf & 2) {
|
|
32
|
+
const c_r6 = ctx.$implicit;
|
|
33
|
+
i0.ɵɵadvance();
|
|
34
|
+
i0.ɵɵtextInterpolate1(" ", c_r6, " ");
|
|
35
|
+
} }
|
|
36
|
+
function RecordListComponent_table_4_tr_5_td_1_span_3_kendo_svgicon_1_Template(rf, ctx) { if (rf & 1) {
|
|
37
|
+
const _r16 = i0.ɵɵgetCurrentView();
|
|
38
|
+
i0.ɵɵelementStart(0, "kendo-svgicon", 12);
|
|
39
|
+
i0.ɵɵlistener("click", function RecordListComponent_table_4_tr_5_td_1_span_3_kendo_svgicon_1_Template_kendo_svgicon_click_0_listener($event) { i0.ɵɵrestoreView(_r16); const r_r7 = i0.ɵɵnextContext(3).$implicit; const ctx_r14 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r14.editRecord($event, r_r7)); });
|
|
40
|
+
i0.ɵɵelementEnd();
|
|
41
|
+
} if (rf & 2) {
|
|
42
|
+
const ctx_r12 = i0.ɵɵnextContext(5);
|
|
43
|
+
i0.ɵɵproperty("icon", ctx_r12.kendoSVGIcon("pencil"));
|
|
44
|
+
} }
|
|
45
|
+
function RecordListComponent_table_4_tr_5_td_1_span_3_kendo_svgicon_2_Template(rf, ctx) { if (rf & 1) {
|
|
46
|
+
const _r19 = i0.ɵɵgetCurrentView();
|
|
47
|
+
i0.ɵɵelementStart(0, "kendo-svgicon", 12);
|
|
48
|
+
i0.ɵɵlistener("click", function RecordListComponent_table_4_tr_5_td_1_span_3_kendo_svgicon_2_Template_kendo_svgicon_click_0_listener($event) { i0.ɵɵrestoreView(_r19); const r_r7 = i0.ɵɵnextContext(3).$implicit; const ctx_r17 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r17.deleteRecord($event, r_r7)); });
|
|
49
|
+
i0.ɵɵelementEnd();
|
|
50
|
+
} if (rf & 2) {
|
|
51
|
+
const ctx_r13 = i0.ɵɵnextContext(5);
|
|
52
|
+
i0.ɵɵproperty("icon", ctx_r13.kendoSVGIcon("trash"));
|
|
53
|
+
} }
|
|
54
|
+
function RecordListComponent_table_4_tr_5_td_1_span_3_Template(rf, ctx) { if (rf & 1) {
|
|
55
|
+
i0.ɵɵelementStart(0, "span");
|
|
56
|
+
i0.ɵɵtemplate(1, RecordListComponent_table_4_tr_5_td_1_span_3_kendo_svgicon_1_Template, 1, 1, "kendo-svgicon", 11)(2, RecordListComponent_table_4_tr_5_td_1_span_3_kendo_svgicon_2_Template, 1, 1, "kendo-svgicon", 11);
|
|
57
|
+
i0.ɵɵelementEnd();
|
|
58
|
+
} if (rf & 2) {
|
|
59
|
+
const ctx_r11 = i0.ɵɵnextContext(4);
|
|
60
|
+
i0.ɵɵadvance();
|
|
61
|
+
i0.ɵɵproperty("ngIf", ctx_r11.AllowEdit);
|
|
62
|
+
i0.ɵɵadvance();
|
|
63
|
+
i0.ɵɵproperty("ngIf", ctx_r11.AllowEdit);
|
|
64
|
+
} }
|
|
65
|
+
function RecordListComponent_table_4_tr_5_td_1_Template(rf, ctx) { if (rf & 1) {
|
|
66
|
+
i0.ɵɵelementStart(0, "td")(1, "span");
|
|
67
|
+
i0.ɵɵtext(2);
|
|
68
|
+
i0.ɵɵelementEnd();
|
|
69
|
+
i0.ɵɵtemplate(3, RecordListComponent_table_4_tr_5_td_1_span_3_Template, 3, 2, "span", 2);
|
|
70
|
+
i0.ɵɵelementEnd();
|
|
71
|
+
} if (rf & 2) {
|
|
72
|
+
const c_r9 = ctx.$implicit;
|
|
73
|
+
const i_r10 = ctx.index;
|
|
74
|
+
const r_r7 = i0.ɵɵnextContext().$implicit;
|
|
75
|
+
const ctx_r8 = i0.ɵɵnextContext(2);
|
|
76
|
+
i0.ɵɵadvance(2);
|
|
77
|
+
i0.ɵɵtextInterpolate(r_r7.Get(c_r9));
|
|
78
|
+
i0.ɵɵadvance();
|
|
79
|
+
i0.ɵɵproperty("ngIf", i_r10 === 0 && (ctx_r8.AllowDelete || ctx_r8.AllowEdit));
|
|
80
|
+
} }
|
|
81
|
+
function RecordListComponent_table_4_tr_5_Template(rf, ctx) { if (rf & 1) {
|
|
82
|
+
const _r22 = i0.ɵɵgetCurrentView();
|
|
83
|
+
i0.ɵɵelementStart(0, "tr", 10);
|
|
84
|
+
i0.ɵɵlistener("click", function RecordListComponent_table_4_tr_5_Template_tr_click_0_listener() { const restoredCtx = i0.ɵɵrestoreView(_r22); const r_r7 = restoredCtx.$implicit; const ctx_r21 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r21.selectRecord(undefined, r_r7)); });
|
|
85
|
+
i0.ɵɵtemplate(1, RecordListComponent_table_4_tr_5_td_1_Template, 4, 2, "td", 8);
|
|
86
|
+
i0.ɵɵelementEnd();
|
|
87
|
+
} if (rf & 2) {
|
|
88
|
+
const ctx_r5 = i0.ɵɵnextContext(2);
|
|
89
|
+
i0.ɵɵadvance();
|
|
90
|
+
i0.ɵɵproperty("ngForOf", ctx_r5.Columns);
|
|
91
|
+
} }
|
|
92
|
+
function RecordListComponent_table_4_Template(rf, ctx) { if (rf & 1) {
|
|
93
|
+
i0.ɵɵelementStart(0, "table", 7)(1, "thead")(2, "tr");
|
|
94
|
+
i0.ɵɵtemplate(3, RecordListComponent_table_4_th_3_Template, 2, 1, "th", 8);
|
|
95
|
+
i0.ɵɵelementEnd()();
|
|
96
|
+
i0.ɵɵelementStart(4, "tbody");
|
|
97
|
+
i0.ɵɵtemplate(5, RecordListComponent_table_4_tr_5_Template, 2, 1, "tr", 9);
|
|
98
|
+
i0.ɵɵelementEnd()();
|
|
99
|
+
} if (rf & 2) {
|
|
100
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
101
|
+
i0.ɵɵadvance(3);
|
|
102
|
+
i0.ɵɵproperty("ngForOf", ctx_r1.Columns);
|
|
103
|
+
i0.ɵɵadvance(2);
|
|
104
|
+
i0.ɵɵproperty("ngForOf", ctx_r1.records);
|
|
105
|
+
} }
|
|
106
|
+
function RecordListComponent_kendo_dialog_7_Template(rf, ctx) { if (rf & 1) {
|
|
107
|
+
const _r24 = i0.ɵɵgetCurrentView();
|
|
108
|
+
i0.ɵɵelementStart(0, "kendo-dialog", 13);
|
|
109
|
+
i0.ɵɵlistener("close", function RecordListComponent_kendo_dialog_7_Template_kendo_dialog_close_0_listener() { i0.ɵɵrestoreView(_r24); const ctx_r23 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r23.closeDeleteDialog("No")); });
|
|
110
|
+
i0.ɵɵelementStart(1, "div");
|
|
111
|
+
i0.ɵɵtext(2);
|
|
112
|
+
i0.ɵɵelementEnd();
|
|
113
|
+
i0.ɵɵelementStart(3, "kendo-dialog-actions")(4, "button", 14);
|
|
114
|
+
i0.ɵɵlistener("click", function RecordListComponent_kendo_dialog_7_Template_button_click_4_listener() { i0.ɵɵrestoreView(_r24); const ctx_r25 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r25.closeDeleteDialog("Yes")); });
|
|
115
|
+
i0.ɵɵtext(5, "Yes");
|
|
116
|
+
i0.ɵɵelementEnd();
|
|
117
|
+
i0.ɵɵelementStart(6, "button", 1);
|
|
118
|
+
i0.ɵɵlistener("click", function RecordListComponent_kendo_dialog_7_Template_button_click_6_listener() { i0.ɵɵrestoreView(_r24); const ctx_r26 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r26.closeDeleteDialog("No")); });
|
|
119
|
+
i0.ɵɵtext(7, "No");
|
|
120
|
+
i0.ɵɵelementEnd()()();
|
|
121
|
+
} if (rf & 2) {
|
|
122
|
+
const ctx_r3 = i0.ɵɵnextContext();
|
|
123
|
+
i0.ɵɵproperty("title", "Delete " + ctx_r3.EntityName + "?")("width", 450)("height", 200);
|
|
124
|
+
i0.ɵɵadvance(2);
|
|
125
|
+
i0.ɵɵtextInterpolate1(" Are you sure you want to delete '", ctx_r3.getRecordName(ctx_r3.deleteRecordItem), "'? ");
|
|
126
|
+
} }
|
|
127
|
+
export class RecordListComponent {
|
|
128
|
+
constructor(router) {
|
|
129
|
+
this.router = router;
|
|
130
|
+
this.EntityName = '';
|
|
131
|
+
this.Columns = [];
|
|
132
|
+
this.SortBy = '';
|
|
133
|
+
this.AllowDelete = true;
|
|
134
|
+
this.AllowNew = true;
|
|
135
|
+
this.AllowEdit = true;
|
|
136
|
+
/**
|
|
137
|
+
* If AllowEdit or AllowNew is true, this is the section name to display for editing a new or existing record.
|
|
138
|
+
*/
|
|
139
|
+
this.EditSectionName = 'details';
|
|
140
|
+
this.RecordSelected = new EventEmitter();
|
|
141
|
+
this.RecordEdited = new EventEmitter();
|
|
142
|
+
this.RecordCreated = new EventEmitter();
|
|
143
|
+
this.isLoading = false;
|
|
144
|
+
this.records = [];
|
|
145
|
+
this.kendoSVGIcon = kendoSVGIcon;
|
|
146
|
+
this.deleteRecordDialogVisible = false;
|
|
147
|
+
this.showEditOrNewRecordForm = false;
|
|
148
|
+
this.recordMode = 'new';
|
|
149
|
+
}
|
|
150
|
+
ngOnInit() {
|
|
151
|
+
this.Refresh();
|
|
152
|
+
}
|
|
153
|
+
Refresh() {
|
|
154
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
155
|
+
this.isLoading = true;
|
|
156
|
+
const md = new Metadata();
|
|
157
|
+
if (this.Columns.length === 0) {
|
|
158
|
+
// populate this by default by taking all columns if entity has < 10 columns, otherwise include columns that have DefaultInView=1, and if we have no columns with DefaultInView=1, then include the first 10 columns
|
|
159
|
+
const e = md.Entities.find(e => e.Name === this.EntityName);
|
|
160
|
+
if (e) {
|
|
161
|
+
if (e.Fields.length < 10)
|
|
162
|
+
this.Columns = e.Fields.map(f => f.Name);
|
|
163
|
+
else {
|
|
164
|
+
const defaultInViewColumns = e.Fields.filter(c => c.DefaultInView);
|
|
165
|
+
if (defaultInViewColumns.length > 0)
|
|
166
|
+
this.Columns = defaultInViewColumns.map(f => f.Name);
|
|
167
|
+
else
|
|
168
|
+
this.Columns = e.Fields.slice(0, 10).map(f => f.Name);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
const rv = new RunView();
|
|
173
|
+
const result = yield rv.RunView({
|
|
174
|
+
EntityName: this.EntityName,
|
|
175
|
+
ResultType: 'entity_object'
|
|
176
|
+
});
|
|
177
|
+
if (result.Success) {
|
|
178
|
+
this.records = result.Results;
|
|
179
|
+
if (this.SortBy && this.SortBy.trim().length > 0) {
|
|
180
|
+
this.records.sort((a, b) => a.Get(this.SortBy).localeCompare(b.Get(this.SortBy)));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
throw new Error("Error loading records: " + result.ErrorMessage);
|
|
185
|
+
}
|
|
186
|
+
this.isLoading = false;
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
selectRecord(event, r) {
|
|
190
|
+
if (event)
|
|
191
|
+
event.stopPropagation(); // prevent row from getting click
|
|
192
|
+
this.RecordSelected.emit(r);
|
|
193
|
+
}
|
|
194
|
+
deleteRecord(event, r) {
|
|
195
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
196
|
+
// confirm with the user first
|
|
197
|
+
this.deleteRecordItem = r;
|
|
198
|
+
this.deleteRecordDialogVisible = true;
|
|
199
|
+
if (event)
|
|
200
|
+
event.stopPropagation(); // prevent row from getting click
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
closeDeleteDialog(result) {
|
|
204
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
205
|
+
// if the user confirms, delete the record
|
|
206
|
+
this.deleteRecordDialogVisible = false;
|
|
207
|
+
if (result === 'Yes') {
|
|
208
|
+
if (!(yield this.deleteRecordItem.Delete())) {
|
|
209
|
+
// show an error message
|
|
210
|
+
SharedService.Instance.CreateSimpleNotification('Error deleting record', 'error', 3000);
|
|
211
|
+
}
|
|
212
|
+
else
|
|
213
|
+
this.Refresh(); // refresh the list
|
|
214
|
+
}
|
|
215
|
+
this.deleteRecordItem = null;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
createNewRecord() {
|
|
219
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
220
|
+
// attempt to create a new record and if success, navigate to the new record
|
|
221
|
+
const md = new Metadata();
|
|
222
|
+
this.editOrNewRecord = yield md.GetEntityObject(this.EntityName);
|
|
223
|
+
if (this.editOrNewRecord) {
|
|
224
|
+
this.editOrNewRecord.NewRecord();
|
|
225
|
+
this.recordMode = 'new';
|
|
226
|
+
this.showEditOrNewRecordForm = true;
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
editRecord(event, r) {
|
|
231
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
232
|
+
this.editOrNewRecord = r;
|
|
233
|
+
this.recordMode = 'edit';
|
|
234
|
+
this.showEditOrNewRecordForm = true;
|
|
235
|
+
if (event)
|
|
236
|
+
event.stopPropagation(); // prevent row from getting click
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
onEditOrNewRecordFormClosed(result) {
|
|
240
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
241
|
+
this.showEditOrNewRecordForm = false;
|
|
242
|
+
if (result === 'Save') {
|
|
243
|
+
// the dialog already saved the record, just check to make sure it was saved and if so, navigate
|
|
244
|
+
if (this.editOrNewRecord.IsSaved) {
|
|
245
|
+
if (this.recordMode === 'edit')
|
|
246
|
+
this.RecordEdited.emit(this.editOrNewRecord);
|
|
247
|
+
else
|
|
248
|
+
this.RecordCreated.emit(this.editOrNewRecord);
|
|
249
|
+
// refresh our grid now
|
|
250
|
+
yield this.Refresh();
|
|
251
|
+
}
|
|
252
|
+
else
|
|
253
|
+
throw new Error('Record was not saved');
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
getRecordName(r) {
|
|
258
|
+
// check to see if we have any columns in the entity that have IsNameField = 1, the fall back from there is to look for a column named "Name", and if that doesn't work we return the primary key(s)
|
|
259
|
+
const md = new Metadata();
|
|
260
|
+
const e = md.Entities.find(e => e.Name === this.EntityName);
|
|
261
|
+
if (!e)
|
|
262
|
+
throw new Error('Entity not found: ' + this.EntityName);
|
|
263
|
+
const nameField = e.Fields.find(c => c.IsNameField);
|
|
264
|
+
if (nameField)
|
|
265
|
+
return r.Get(nameField.Name);
|
|
266
|
+
else {
|
|
267
|
+
const nameField = e.Fields.find(c => c.Name === 'Name');
|
|
268
|
+
if (nameField)
|
|
269
|
+
return r.Get("Name");
|
|
270
|
+
else {
|
|
271
|
+
// iterate through all primary keys and form a comma separated list
|
|
272
|
+
const pkString = r.PrimaryKeys.map(pk => r.Get(pk.Name)).join(', ');
|
|
273
|
+
return "Record: " + pkString;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
RecordListComponent.ɵfac = function RecordListComponent_Factory(t) { return new (t || RecordListComponent)(i0.ɵɵdirectiveInject(i1.Router)); };
|
|
279
|
+
RecordListComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: RecordListComponent, selectors: [["mj-record-list"]], inputs: { EntityName: "EntityName", Columns: "Columns", SortBy: "SortBy", AllowDelete: "AllowDelete", AllowNew: "AllowNew", AllowEdit: "AllowEdit", EditSectionName: "EditSectionName" }, outputs: { RecordSelected: "RecordSelected", RecordEdited: "RecordEdited", RecordCreated: "RecordCreated" }, decls: 8, vars: 10, consts: [["mjFillContainer", "", 1, "wrapper"], ["kendoButton", "", 3, "click"], [4, "ngIf"], ["class", "grid", 4, "ngIf"], ["Mode", "section", 3, "Record", "SectionName", "Visible", "AutoRevertOnCancel", "HandleSave", "Width", "Height", "close"], ["entityForm", ""], [3, "title", "width", "height", "close", 4, "ngIf"], [1, "grid"], [4, "ngFor", "ngForOf"], [3, "click", 4, "ngFor", "ngForOf"], [3, "click"], ["class", "icon", 3, "icon", "click", 4, "ngIf"], [1, "icon", 3, "icon", "click"], [3, "title", "width", "height", "close"], ["kendoButton", "", "themeColor", "primary", 3, "click"]], template: function RecordListComponent_Template(rf, ctx) { if (rf & 1) {
|
|
280
|
+
i0.ɵɵelementStart(0, "div", 0)(1, "button", 1);
|
|
281
|
+
i0.ɵɵlistener("click", function RecordListComponent_Template_button_click_1_listener() { return ctx.createNewRecord(); });
|
|
282
|
+
i0.ɵɵtext(2, "New Record");
|
|
283
|
+
i0.ɵɵelementEnd();
|
|
284
|
+
i0.ɵɵtemplate(3, RecordListComponent_div_3_Template, 2, 0, "div", 2)(4, RecordListComponent_table_4_Template, 6, 2, "table", 3);
|
|
285
|
+
i0.ɵɵelementEnd();
|
|
286
|
+
i0.ɵɵelementStart(5, "mj-entity-form-dialog", 4, 5);
|
|
287
|
+
i0.ɵɵlistener("close", function RecordListComponent_Template_mj_entity_form_dialog_close_5_listener($event) { return ctx.onEditOrNewRecordFormClosed($event); });
|
|
288
|
+
i0.ɵɵelementEnd();
|
|
289
|
+
i0.ɵɵtemplate(7, RecordListComponent_kendo_dialog_7_Template, 8, 4, "kendo-dialog", 6);
|
|
290
|
+
} if (rf & 2) {
|
|
291
|
+
i0.ɵɵadvance(3);
|
|
292
|
+
i0.ɵɵproperty("ngIf", ctx.isLoading);
|
|
293
|
+
i0.ɵɵadvance();
|
|
294
|
+
i0.ɵɵproperty("ngIf", !ctx.isLoading);
|
|
295
|
+
i0.ɵɵadvance();
|
|
296
|
+
i0.ɵɵproperty("Record", ctx.editOrNewRecord)("SectionName", ctx.EditSectionName)("Visible", ctx.showEditOrNewRecordForm)("AutoRevertOnCancel", true)("HandleSave", true)("Width", 550)("Height", 450);
|
|
297
|
+
i0.ɵɵadvance(2);
|
|
298
|
+
i0.ɵɵproperty("ngIf", ctx.deleteRecordDialogVisible && ctx.deleteRecord);
|
|
299
|
+
} }, dependencies: [i2.NgForOf, i2.NgIf, i3.DialogComponent, i3.DialogActionsComponent, i4.FillContainer, i5.ButtonComponent, i6.SVGIconComponent, i7.EntityFormDialog, i8.LoaderComponent], styles: ["button[_ngcontent-%COMP%] {\r\n margin-left: 5px;\r\n margin-top: 5px;\r\n width: 125px;\r\n}\r\n\r\n.wrapper[_ngcontent-%COMP%] {\r\n padding-right: 10px;\r\n}\r\n\r\n\n\r\ntable[_ngcontent-%COMP%] {\r\n margin-left: 5px;\r\n margin-top: 10px;\r\n margin-right: 5px;\r\n border-collapse: collapse; \n\r\n width: 100%;\r\n}\r\n \r\ntable[_ngcontent-%COMP%] th[_ngcontent-%COMP%] {\r\n background-color: #f2f2f2; \n\r\n color: black; \n\r\n font-weight: bold; \n\r\n text-align: left;\r\n}\r\n\r\n\n\r\ntable[_ngcontent-%COMP%] th[_ngcontent-%COMP%], table[_ngcontent-%COMP%] td[_ngcontent-%COMP%] {\r\n height: 36px; \n\r\n padding: 0 8px; \n\r\n}\r\n\r\n\n\r\ntable[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:first-child {\r\n display: flex; \n\r\n justify-content: space-between; \n\r\n align-items: center; \n\r\n padding-right: 8px; \n\r\n}\r\n\r\n\n\r\ntd[_ngcontent-%COMP%]:first-child span[_ngcontent-%COMP%]:first-child {\r\n border: none; \n\r\n}\r\n\r\n\n\r\ntd[_ngcontent-%COMP%]:first-child span[_ngcontent-%COMP%]:last-child {\r\n border: none; \n\r\n}\r\n\r\n\n\r\ntd[_ngcontent-%COMP%]:first-child .icon[_ngcontent-%COMP%] {\r\n margin-left: 10px; \n\r\n cursor: pointer; \n\r\n}\r\n\r\ntable[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] {\r\n cursor: pointer;\r\n}\r\n\r\ntable[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover {\r\n background-color: #e7f4ff; \n\r\n}"] });
|
|
300
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RecordListComponent, [{
|
|
301
|
+
type: Component,
|
|
302
|
+
args: [{ selector: 'mj-record-list', template: "<div mjFillContainer class=\"wrapper\">\r\n <button kendoButton (click)=\"createNewRecord()\">New Record</button>\r\n <div *ngIf=\"isLoading\"><kendo-loader></kendo-loader></div>\r\n <table *ngIf=\"!isLoading\" class=\"grid\">\r\n <thead>\r\n <tr>\r\n <th *ngFor=\"let c of Columns\">\r\n {{ c }}\r\n </th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let r of records\" (click)=\"selectRecord(undefined, r)\">\r\n <td *ngFor=\"let c of Columns; let i = index\">\r\n <span>{{ r.Get(c) }}</span>\r\n <span *ngIf=\"i === 0 && (this.AllowDelete || this.AllowEdit)\">\r\n <kendo-svgicon *ngIf=\"this.AllowEdit\" class='icon' [icon]=\"kendoSVGIcon('pencil')\" (click)=\"editRecord($event, r)\"></kendo-svgicon> \r\n <kendo-svgicon *ngIf=\"this.AllowEdit\" class='icon' [icon]=\"kendoSVGIcon('trash')\" (click)=\"deleteRecord($event, r)\"></kendo-svgicon>\r\n </span>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n</div>\r\n \r\n<mj-entity-form-dialog #entityForm \r\n [Record]=\"editOrNewRecord\" \r\n [SectionName]=\"EditSectionName\"\r\n Mode=\"section\" \r\n [Visible]=\"showEditOrNewRecordForm\" \r\n [AutoRevertOnCancel]=\"true\"\r\n [HandleSave]=\"true\"\r\n [Width]=\"550\"\r\n [Height]=\"450\"\r\n (close)=\"onEditOrNewRecordFormClosed($event)\">\r\n</mj-entity-form-dialog>\r\n\r\n<kendo-dialog\r\n *ngIf=\"deleteRecordDialogVisible && deleteRecord\" \r\n [title]=\"'Delete ' + EntityName + '?'\" \r\n [width]=\"450\"\r\n [height]=\"200\"\r\n (close)=\"closeDeleteDialog('No')\" >\r\n <div>\r\n Are you sure you want to delete '{{getRecordName(deleteRecordItem!)}}'?\r\n </div>\r\n <kendo-dialog-actions>\r\n <button kendoButton (click)=\"closeDeleteDialog('Yes')\" themeColor=\"primary\">Yes</button>\r\n <button kendoButton (click)=\"closeDeleteDialog('No')\">No</button>\r\n </kendo-dialog-actions>\r\n</kendo-dialog>", styles: ["button {\r\n margin-left: 5px;\r\n margin-top: 5px;\r\n width: 125px;\r\n}\r\n\r\n.wrapper {\r\n padding-right: 10px;\r\n}\r\n\r\n/* Style for the whole table */\r\ntable {\r\n margin-left: 5px;\r\n margin-top: 10px;\r\n margin-right: 5px;\r\n border-collapse: collapse; /* Ensures border collapse for a cleaner look */\r\n width: 100%;\r\n}\r\n \r\ntable th {\r\n background-color: #f2f2f2; /* Light gray background for headers */\r\n color: black; /* Black text color for headers */\r\n font-weight: bold; /* Bold font weight for headers */\r\n text-align: left;\r\n}\r\n\r\n/* Style for all table cells */\r\ntable th, table td {\r\n height: 36px; /* Fixed height for all rows */\r\n padding: 0 8px; /* Add some padding inside cells */\r\n}\r\n\r\n/* Style for the first column cells */\r\ntable td:first-child {\r\n display: flex; /* Make the cell a flex container */\r\n justify-content: space-between; /* Space out the text and icons */\r\n align-items: center; /* Center items vertically */\r\n padding-right: 8px; /* Ensure there is some padding on the right */\r\n}\r\n\r\n/* Style for the text span within the first column */\r\ntd:first-child span:first-child {\r\n border: none; /* Ensures no border is applied to the span */\r\n}\r\n\r\n/* Style for the icons container span within the first column */\r\ntd:first-child span:last-child {\r\n border: none; /* Ensures no border is applied to the span */\r\n}\r\n\r\n/* Style for the icons within the first column */\r\ntd:first-child .icon {\r\n margin-left: 10px; /* Space between icons if needed */\r\n cursor: pointer; /* Change cursor to pointer on hover */\r\n}\r\n\r\ntable tr {\r\n cursor: pointer;\r\n}\r\n\r\ntable tr:hover {\r\n background-color: #e7f4ff; /* Light blue for even rows */\r\n}\r\n "] }]
|
|
303
|
+
}], () => [{ type: i1.Router }], { EntityName: [{
|
|
304
|
+
type: Input
|
|
305
|
+
}], Columns: [{
|
|
306
|
+
type: Input
|
|
307
|
+
}], SortBy: [{
|
|
308
|
+
type: Input
|
|
309
|
+
}], AllowDelete: [{
|
|
310
|
+
type: Input
|
|
311
|
+
}], AllowNew: [{
|
|
312
|
+
type: Input
|
|
313
|
+
}], AllowEdit: [{
|
|
314
|
+
type: Input
|
|
315
|
+
}], EditSectionName: [{
|
|
316
|
+
type: Input
|
|
317
|
+
}], RecordSelected: [{
|
|
318
|
+
type: Output
|
|
319
|
+
}], RecordEdited: [{
|
|
320
|
+
type: Output
|
|
321
|
+
}], RecordCreated: [{
|
|
322
|
+
type: Output
|
|
323
|
+
}] }); })();
|
|
324
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(RecordListComponent, { className: "RecordListComponent", filePath: "src\\lib\\record-list\\record-list.component.ts", lineNumber: 13 }); })();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OnInit } from '@angular/core';
|
|
2
|
+
import { kendoSVGIcon } from '@memberjunction/ng-shared';
|
|
2
3
|
import { RoleEntity } from '@memberjunction/core-entities';
|
|
3
4
|
import { Router } from '@angular/router';
|
|
4
5
|
import * as i0 from "@angular/core";
|
|
@@ -6,10 +7,19 @@ export declare class RolesListComponent implements OnInit {
|
|
|
6
7
|
private router;
|
|
7
8
|
isLoading: boolean;
|
|
8
9
|
roles: RoleEntity[];
|
|
10
|
+
kendoSVGIcon: typeof kendoSVGIcon;
|
|
9
11
|
constructor(router: Router);
|
|
10
12
|
ngOnInit(): void;
|
|
11
13
|
Refresh(): Promise<void>;
|
|
12
|
-
selectRole(r: RoleEntity): void;
|
|
14
|
+
selectRole(event: MouseEvent | undefined, r: RoleEntity): void;
|
|
15
|
+
deleteRoleDialogVisible: boolean;
|
|
16
|
+
deleteRoleRecord: RoleEntity | null;
|
|
17
|
+
deleteRole(event: MouseEvent, r: RoleEntity): Promise<void>;
|
|
18
|
+
closeDeleteRoleDialog(result: 'Yes' | 'No'): Promise<void>;
|
|
19
|
+
newRoleRecord: RoleEntity;
|
|
20
|
+
showNewRoleForm: boolean;
|
|
21
|
+
createNewRole(): Promise<void>;
|
|
22
|
+
onNewRoleFormClosed(result: 'Save' | 'Cancel'): Promise<void>;
|
|
13
23
|
static ɵfac: i0.ɵɵFactoryDeclaration<RolesListComponent, never>;
|
|
14
24
|
static ɵcmp: i0.ɵɵComponentDeclaration<RolesListComponent, "mj-roles-list", never, {}, {}, never, never, false, never>;
|
|
15
25
|
}
|
|
@@ -9,52 +9,88 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { Component } from '@angular/core';
|
|
11
11
|
import { Metadata, RunView } from '@memberjunction/core';
|
|
12
|
+
import { SharedService, kendoSVGIcon } from '@memberjunction/ng-shared';
|
|
12
13
|
import * as i0 from "@angular/core";
|
|
13
14
|
import * as i1 from "@angular/router";
|
|
14
15
|
import * as i2 from "@angular/common";
|
|
15
|
-
import * as i3 from "@
|
|
16
|
-
|
|
16
|
+
import * as i3 from "@progress/kendo-angular-dialog";
|
|
17
|
+
import * as i4 from "@memberjunction/ng-container-directives";
|
|
18
|
+
import * as i5 from "@progress/kendo-angular-buttons";
|
|
19
|
+
import * as i6 from "@progress/kendo-angular-icons";
|
|
20
|
+
import * as i7 from "@memberjunction/ng-entity-form-dialog";
|
|
21
|
+
import * as i8 from "@progress/kendo-angular-indicators";
|
|
22
|
+
function RolesListComponent_div_3_Template(rf, ctx) { if (rf & 1) {
|
|
17
23
|
i0.ɵɵelementStart(0, "div");
|
|
18
|
-
i0.ɵɵ
|
|
24
|
+
i0.ɵɵelement(1, "kendo-loader");
|
|
19
25
|
i0.ɵɵelementEnd();
|
|
20
26
|
} }
|
|
21
|
-
function
|
|
22
|
-
const
|
|
23
|
-
i0.ɵɵelementStart(0, "tr",
|
|
24
|
-
i0.ɵɵlistener("click", function
|
|
25
|
-
i0.ɵɵelementStart(1, "td");
|
|
26
|
-
i0.ɵɵtext(
|
|
27
|
+
function RolesListComponent_table_4_tr_8_Template(rf, ctx) { if (rf & 1) {
|
|
28
|
+
const _r7 = i0.ɵɵgetCurrentView();
|
|
29
|
+
i0.ɵɵelementStart(0, "tr", 9);
|
|
30
|
+
i0.ɵɵlistener("click", function RolesListComponent_table_4_tr_8_Template_tr_click_0_listener() { const restoredCtx = i0.ɵɵrestoreView(_r7); const r_r5 = restoredCtx.$implicit; const ctx_r6 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r6.selectRole(undefined, r_r5)); });
|
|
31
|
+
i0.ɵɵelementStart(1, "td")(2, "span");
|
|
32
|
+
i0.ɵɵtext(3);
|
|
27
33
|
i0.ɵɵelementEnd();
|
|
28
|
-
i0.ɵɵelementStart(
|
|
29
|
-
i0.ɵɵ
|
|
30
|
-
i0.ɵɵelementEnd()();
|
|
34
|
+
i0.ɵɵelementStart(4, "span")(5, "kendo-svgicon", 10);
|
|
35
|
+
i0.ɵɵlistener("click", function RolesListComponent_table_4_tr_8_Template_kendo_svgicon_click_5_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r7); const r_r5 = restoredCtx.$implicit; const ctx_r8 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r8.deleteRole($event, r_r5)); });
|
|
36
|
+
i0.ɵɵelementEnd()()();
|
|
37
|
+
i0.ɵɵelementStart(6, "td")(7, "span");
|
|
38
|
+
i0.ɵɵtext(8);
|
|
39
|
+
i0.ɵɵelementEnd()()();
|
|
31
40
|
} if (rf & 2) {
|
|
32
|
-
const
|
|
41
|
+
const r_r5 = ctx.$implicit;
|
|
42
|
+
const ctx_r4 = i0.ɵɵnextContext(2);
|
|
43
|
+
i0.ɵɵadvance(3);
|
|
44
|
+
i0.ɵɵtextInterpolate(r_r5.Name);
|
|
33
45
|
i0.ɵɵadvance(2);
|
|
34
|
-
i0.ɵɵ
|
|
35
|
-
i0.ɵɵadvance(
|
|
36
|
-
i0.ɵɵtextInterpolate(
|
|
46
|
+
i0.ɵɵproperty("icon", ctx_r4.kendoSVGIcon("trash"));
|
|
47
|
+
i0.ɵɵadvance(3);
|
|
48
|
+
i0.ɵɵtextInterpolate(r_r5.Description);
|
|
37
49
|
} }
|
|
38
|
-
function
|
|
39
|
-
i0.ɵɵelementStart(0, "table",
|
|
50
|
+
function RolesListComponent_table_4_Template(rf, ctx) { if (rf & 1) {
|
|
51
|
+
i0.ɵɵelementStart(0, "table", 7)(1, "thead")(2, "tr")(3, "th");
|
|
40
52
|
i0.ɵɵtext(4, "Role");
|
|
41
53
|
i0.ɵɵelementEnd();
|
|
42
54
|
i0.ɵɵelementStart(5, "th");
|
|
43
55
|
i0.ɵɵtext(6, "Description");
|
|
44
56
|
i0.ɵɵelementEnd()()();
|
|
45
57
|
i0.ɵɵelementStart(7, "tbody");
|
|
46
|
-
i0.ɵɵtemplate(8,
|
|
58
|
+
i0.ɵɵtemplate(8, RolesListComponent_table_4_tr_8_Template, 9, 3, "tr", 8);
|
|
47
59
|
i0.ɵɵelementEnd()();
|
|
48
60
|
} if (rf & 2) {
|
|
49
61
|
const ctx_r1 = i0.ɵɵnextContext();
|
|
50
62
|
i0.ɵɵadvance(8);
|
|
51
63
|
i0.ɵɵproperty("ngForOf", ctx_r1.roles);
|
|
52
64
|
} }
|
|
65
|
+
function RolesListComponent_kendo_dialog_7_Template(rf, ctx) { if (rf & 1) {
|
|
66
|
+
const _r10 = i0.ɵɵgetCurrentView();
|
|
67
|
+
i0.ɵɵelementStart(0, "kendo-dialog", 11);
|
|
68
|
+
i0.ɵɵlistener("close", function RolesListComponent_kendo_dialog_7_Template_kendo_dialog_close_0_listener() { i0.ɵɵrestoreView(_r10); const ctx_r9 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r9.closeDeleteRoleDialog("No")); });
|
|
69
|
+
i0.ɵɵelementStart(1, "div");
|
|
70
|
+
i0.ɵɵtext(2);
|
|
71
|
+
i0.ɵɵelementEnd();
|
|
72
|
+
i0.ɵɵelementStart(3, "kendo-dialog-actions")(4, "button", 12);
|
|
73
|
+
i0.ɵɵlistener("click", function RolesListComponent_kendo_dialog_7_Template_button_click_4_listener() { i0.ɵɵrestoreView(_r10); const ctx_r11 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r11.closeDeleteRoleDialog("Yes")); });
|
|
74
|
+
i0.ɵɵtext(5, "Yes");
|
|
75
|
+
i0.ɵɵelementEnd();
|
|
76
|
+
i0.ɵɵelementStart(6, "button", 1);
|
|
77
|
+
i0.ɵɵlistener("click", function RolesListComponent_kendo_dialog_7_Template_button_click_6_listener() { i0.ɵɵrestoreView(_r10); const ctx_r12 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r12.closeDeleteRoleDialog("No")); });
|
|
78
|
+
i0.ɵɵtext(7, "No");
|
|
79
|
+
i0.ɵɵelementEnd()()();
|
|
80
|
+
} if (rf & 2) {
|
|
81
|
+
const ctx_r3 = i0.ɵɵnextContext();
|
|
82
|
+
i0.ɵɵproperty("width", 300)("height", 200);
|
|
83
|
+
i0.ɵɵadvance(2);
|
|
84
|
+
i0.ɵɵtextInterpolate1(" Are you sure you want to delete the role '", ctx_r3.deleteRoleRecord.Name, "'? ");
|
|
85
|
+
} }
|
|
53
86
|
export class RolesListComponent {
|
|
54
87
|
constructor(router) {
|
|
55
88
|
this.router = router;
|
|
56
89
|
this.isLoading = false;
|
|
57
90
|
this.roles = [];
|
|
91
|
+
this.kendoSVGIcon = kendoSVGIcon;
|
|
92
|
+
this.deleteRoleDialogVisible = false;
|
|
93
|
+
this.showNewRoleForm = false;
|
|
58
94
|
}
|
|
59
95
|
ngOnInit() {
|
|
60
96
|
this.Refresh();
|
|
@@ -79,24 +115,87 @@ export class RolesListComponent {
|
|
|
79
115
|
this.isLoading = false;
|
|
80
116
|
});
|
|
81
117
|
}
|
|
82
|
-
selectRole(r) {
|
|
118
|
+
selectRole(event, r) {
|
|
119
|
+
if (event)
|
|
120
|
+
event.stopPropagation(); // prevent row from getting click
|
|
83
121
|
// change the route to point to the /settings/role/{r.Name} route
|
|
84
122
|
this.router.navigate(['/settings/role', r.Name]);
|
|
85
123
|
}
|
|
124
|
+
deleteRole(event, r) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
// confirm with the user first
|
|
127
|
+
this.deleteRoleRecord = r;
|
|
128
|
+
this.deleteRoleDialogVisible = true;
|
|
129
|
+
event.stopPropagation(); // prevent row from getting click
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
closeDeleteRoleDialog(result) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
// if the user confirms, delete the role
|
|
135
|
+
this.deleteRoleDialogVisible = false;
|
|
136
|
+
if (result === 'Yes') {
|
|
137
|
+
if (!(yield this.deleteRoleRecord.Delete())) {
|
|
138
|
+
// show an error message
|
|
139
|
+
SharedService.Instance.CreateSimpleNotification('Error deleting role', 'error', 3000);
|
|
140
|
+
}
|
|
141
|
+
else
|
|
142
|
+
this.Refresh(); // refresh the list
|
|
143
|
+
}
|
|
144
|
+
this.deleteRoleRecord = null;
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
createNewRole() {
|
|
148
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
149
|
+
// attempt to create a new role and if success, navigate to the new role
|
|
150
|
+
const md = new Metadata();
|
|
151
|
+
this.newRoleRecord = yield md.GetEntityObject('Roles');
|
|
152
|
+
if (this.newRoleRecord) {
|
|
153
|
+
this.newRoleRecord.NewRecord();
|
|
154
|
+
this.showNewRoleForm = true;
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
onNewRoleFormClosed(result) {
|
|
159
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
+
this.showNewRoleForm = false;
|
|
161
|
+
if (result === 'Save') {
|
|
162
|
+
// the dialog already saved the record, just check to make sure it was saved and if so, navigate
|
|
163
|
+
if (this.newRoleRecord.ID) {
|
|
164
|
+
const md = new Metadata();
|
|
165
|
+
// force a refresh since we have a new role
|
|
166
|
+
SharedService.Instance.CreateSimpleNotification('Role created successfully, refreshing metadata...', 'info', 3000);
|
|
167
|
+
this.router.navigate(['/settings/role', this.newRoleRecord.Name]);
|
|
168
|
+
}
|
|
169
|
+
else
|
|
170
|
+
throw new Error('New role record was not saved');
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
86
174
|
}
|
|
87
175
|
RolesListComponent.ɵfac = function RolesListComponent_Factory(t) { return new (t || RolesListComponent)(i0.ɵɵdirectiveInject(i1.Router)); };
|
|
88
|
-
RolesListComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: RolesListComponent, selectors: [["mj-roles-list"]], decls:
|
|
89
|
-
i0.ɵɵelementStart(0, "div", 0);
|
|
90
|
-
i0.ɵɵ
|
|
176
|
+
RolesListComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: RolesListComponent, selectors: [["mj-roles-list"]], decls: 8, vars: 9, consts: [["mjFillContainer", "", 1, "wrapper"], ["kendoButton", "", 3, "click"], [4, "ngIf"], ["class", "grid", 4, "ngIf"], ["SectionName", "details", "Mode", "section", 3, "Record", "Visible", "AutoRevertOnCancel", "HandleSave", "Width", "Height", "close"], ["entityForm", ""], ["title", "Delete Role?", 3, "width", "height", "close", 4, "ngIf"], [1, "grid"], [3, "click", 4, "ngFor", "ngForOf"], [3, "click"], [1, "icon", 3, "icon", "click"], ["title", "Delete Role?", 3, "width", "height", "close"], ["kendoButton", "", "themeColor", "primary", 3, "click"]], template: function RolesListComponent_Template(rf, ctx) { if (rf & 1) {
|
|
177
|
+
i0.ɵɵelementStart(0, "div", 0)(1, "button", 1);
|
|
178
|
+
i0.ɵɵlistener("click", function RolesListComponent_Template_button_click_1_listener() { return ctx.createNewRole(); });
|
|
179
|
+
i0.ɵɵtext(2, "New Role");
|
|
91
180
|
i0.ɵɵelementEnd();
|
|
181
|
+
i0.ɵɵtemplate(3, RolesListComponent_div_3_Template, 2, 0, "div", 2)(4, RolesListComponent_table_4_Template, 9, 1, "table", 3);
|
|
182
|
+
i0.ɵɵelementEnd();
|
|
183
|
+
i0.ɵɵelementStart(5, "mj-entity-form-dialog", 4, 5);
|
|
184
|
+
i0.ɵɵlistener("close", function RolesListComponent_Template_mj_entity_form_dialog_close_5_listener($event) { return ctx.onNewRoleFormClosed($event); });
|
|
185
|
+
i0.ɵɵelementEnd();
|
|
186
|
+
i0.ɵɵtemplate(7, RolesListComponent_kendo_dialog_7_Template, 8, 3, "kendo-dialog", 6);
|
|
92
187
|
} if (rf & 2) {
|
|
93
|
-
i0.ɵɵadvance();
|
|
188
|
+
i0.ɵɵadvance(3);
|
|
94
189
|
i0.ɵɵproperty("ngIf", ctx.isLoading);
|
|
95
190
|
i0.ɵɵadvance();
|
|
96
191
|
i0.ɵɵproperty("ngIf", !ctx.isLoading);
|
|
97
|
-
|
|
192
|
+
i0.ɵɵadvance();
|
|
193
|
+
i0.ɵɵproperty("Record", ctx.newRoleRecord)("Visible", ctx.showNewRoleForm)("AutoRevertOnCancel", true)("HandleSave", true)("Width", 550)("Height", 450);
|
|
194
|
+
i0.ɵɵadvance(2);
|
|
195
|
+
i0.ɵɵproperty("ngIf", ctx.deleteRoleDialogVisible && ctx.deleteRoleRecord);
|
|
196
|
+
} }, dependencies: [i2.NgForOf, i2.NgIf, i3.DialogComponent, i3.DialogActionsComponent, i4.FillContainer, i5.ButtonComponent, i6.SVGIconComponent, i7.EntityFormDialog, i8.LoaderComponent], styles: ["button[_ngcontent-%COMP%] {\r\n margin-left: 5px;\r\n margin-top: 5px;\r\n width: 125px;\r\n}\r\n\r\n.wrapper[_ngcontent-%COMP%] {\r\n padding-right: 10px;\r\n}\r\n\r\n\n\r\ntable[_ngcontent-%COMP%] {\r\n margin-left: 5px;\r\n margin-top: 10px;\r\n margin-right: 5px;\r\n border-collapse: collapse; \n\r\n width: 100%;\r\n}\r\n \r\ntable[_ngcontent-%COMP%] th[_ngcontent-%COMP%] {\r\n background-color: #f2f2f2; \n\r\n color: black; \n\r\n font-weight: bold; \n\r\n text-align: left;\r\n}\r\n\r\n\n\r\ntable[_ngcontent-%COMP%] th[_ngcontent-%COMP%], table[_ngcontent-%COMP%] td[_ngcontent-%COMP%] {\r\n height: 36px; \n\r\n padding: 0 8px; \n\r\n}\r\n\r\n\n\r\ntable[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:first-child {\r\n display: flex; \n\r\n justify-content: space-between; \n\r\n align-items: center; \n\r\n padding-right: 8px; \n\r\n}\r\n\r\n\n\r\ntd[_ngcontent-%COMP%]:first-child span[_ngcontent-%COMP%]:first-child {\r\n border: none; \n\r\n}\r\n\r\n\n\r\ntd[_ngcontent-%COMP%]:first-child span[_ngcontent-%COMP%]:last-child {\r\n border: none; \n\r\n}\r\n\r\n\n\r\ntd[_ngcontent-%COMP%]:first-child .icon[_ngcontent-%COMP%] {\r\n margin-left: 10px; \n\r\n cursor: pointer; \n\r\n}\r\n\r\ntable[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] {\r\n cursor: pointer;\r\n}\r\n\r\ntable[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover {\r\n background-color: #e7f4ff; \n\r\n}"] });
|
|
98
197
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RolesListComponent, [{
|
|
99
198
|
type: Component,
|
|
100
|
-
args: [{ selector: 'mj-roles-list', template: "<div mjFillContainer>\r\n <div *ngIf=\"isLoading\"
|
|
199
|
+
args: [{ selector: 'mj-roles-list', template: "<div mjFillContainer class=\"wrapper\">\r\n <button kendoButton (click)=\"createNewRole()\">New Role</button>\r\n <div *ngIf=\"isLoading\"><kendo-loader></kendo-loader></div>\r\n <table *ngIf=\"!isLoading\" class=\"grid\">\r\n <thead>\r\n <tr>\r\n <th>Role</th>\r\n <th>Description</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let r of roles\" (click)=\"selectRole(undefined, r)\">\r\n <td>\r\n <span>{{ r.Name }}</span> \r\n <span>\r\n <!-- <kendo-svgicon class='icon' [icon]=\"kendoSVGIcon('pencil')\" (click)=\"selectRole($event, r)\"></kendo-svgicon> -->\r\n <kendo-svgicon class='icon' [icon]=\"kendoSVGIcon('trash')\" (click)=\"deleteRole($event, r)\"></kendo-svgicon>\r\n </span>\r\n </td>\r\n <td><span>{{ r.Description }}</span></td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n</div>\r\n \r\n<mj-entity-form-dialog #entityForm \r\n [Record]=\"newRoleRecord\" \r\n SectionName=\"details\" \r\n Mode=\"section\" \r\n [Visible]=\"showNewRoleForm\" \r\n [AutoRevertOnCancel]=\"true\"\r\n [HandleSave]=\"true\"\r\n [Width]=\"550\"\r\n [Height]=\"450\"\r\n (close)=\"onNewRoleFormClosed($event)\">\r\n</mj-entity-form-dialog>\r\n\r\n<kendo-dialog\r\n *ngIf=\"deleteRoleDialogVisible && deleteRoleRecord\" \r\n title=\"Delete Role?\" \r\n [width]=\"300\"\r\n [height]=\"200\"\r\n (close)=\"closeDeleteRoleDialog('No')\" >\r\n <div>\r\n Are you sure you want to delete the role '{{deleteRoleRecord.Name}}'?\r\n </div>\r\n <kendo-dialog-actions>\r\n <button kendoButton (click)=\"closeDeleteRoleDialog('Yes')\" themeColor=\"primary\">Yes</button>\r\n <button kendoButton (click)=\"closeDeleteRoleDialog('No')\">No</button>\r\n </kendo-dialog-actions>\r\n</kendo-dialog>", styles: ["button {\r\n margin-left: 5px;\r\n margin-top: 5px;\r\n width: 125px;\r\n}\r\n\r\n.wrapper {\r\n padding-right: 10px;\r\n}\r\n\r\n/* Style for the whole table */\r\ntable {\r\n margin-left: 5px;\r\n margin-top: 10px;\r\n margin-right: 5px;\r\n border-collapse: collapse; /* Ensures border collapse for a cleaner look */\r\n width: 100%;\r\n}\r\n \r\ntable th {\r\n background-color: #f2f2f2; /* Light gray background for headers */\r\n color: black; /* Black text color for headers */\r\n font-weight: bold; /* Bold font weight for headers */\r\n text-align: left;\r\n}\r\n\r\n/* Style for all table cells */\r\ntable th, table td {\r\n height: 36px; /* Fixed height for all rows */\r\n padding: 0 8px; /* Add some padding inside cells */\r\n}\r\n\r\n/* Style for the first column cells */\r\ntable td:first-child {\r\n display: flex; /* Make the cell a flex container */\r\n justify-content: space-between; /* Space out the text and icons */\r\n align-items: center; /* Center items vertically */\r\n padding-right: 8px; /* Ensure there is some padding on the right */\r\n}\r\n\r\n/* Style for the text span within the first column */\r\ntd:first-child span:first-child {\r\n border: none; /* Ensures no border is applied to the span */\r\n}\r\n\r\n/* Style for the icons container span within the first column */\r\ntd:first-child span:last-child {\r\n border: none; /* Ensures no border is applied to the span */\r\n}\r\n\r\n/* Style for the icons within the first column */\r\ntd:first-child .icon {\r\n margin-left: 10px; /* Space between icons if needed */\r\n cursor: pointer; /* Change cursor to pointer on hover */\r\n}\r\n\r\ntable tr {\r\n cursor: pointer;\r\n}\r\n\r\ntable tr:hover {\r\n background-color: #e7f4ff; /* Light blue for even rows */\r\n}\r\n "] }]
|
|
101
200
|
}], () => [{ type: i1.Router }], null); })();
|
|
102
201
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(RolesListComponent, { className: "RolesListComponent", filePath: "src\\lib\\roles-list\\roles-list.component.ts", lineNumber: 15 }); })();
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { OnInit } from '@angular/core';
|
|
2
2
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
3
|
+
import { BaseEntity } from '@memberjunction/core';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
export declare class SettingsComponent implements OnInit {
|
|
5
6
|
private router;
|
|
6
7
|
private activatedRoute;
|
|
7
|
-
currentItem: 'EntityPermissions' | 'Users' | 'Roles' | 'Role';
|
|
8
|
+
currentItem: 'EntityPermissions' | 'Users' | 'User' | 'Roles' | 'Role';
|
|
8
9
|
baseRoute: string;
|
|
9
10
|
selectedRoleName: string;
|
|
10
|
-
|
|
11
|
+
selectedUserID: number;
|
|
12
|
+
selectItem(item: 'EntityPermissions' | 'Users' | 'User' | 'Roles' | 'Role', changeRoute?: boolean): void;
|
|
11
13
|
changeRoute(subPath: string): void;
|
|
12
14
|
constructor(router: Router, activatedRoute: ActivatedRoute);
|
|
13
15
|
ngOnInit(): void;
|
|
14
16
|
updateComponentStateBasedOnPath(): void;
|
|
17
|
+
selectRole(r: BaseEntity): void;
|
|
18
|
+
selectUser(r: BaseEntity): void;
|
|
15
19
|
static ɵfac: i0.ɵɵFactoryDeclaration<SettingsComponent, never>;
|
|
16
20
|
static ɵcmp: i0.ɵɵComponentDeclaration<SettingsComponent, "mj-settings", never, {}, {}, never, never, false, never>;
|
|
17
21
|
}
|