ngx-techlify-core 11.3.4 → 11.3.8

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.
Files changed (35) hide show
  1. package/bundles/ngx-techlify-core.umd.js +646 -104
  2. package/bundles/ngx-techlify-core.umd.js.map +1 -1
  3. package/bundles/ngx-techlify-core.umd.min.js +2 -2
  4. package/bundles/ngx-techlify-core.umd.min.js.map +1 -1
  5. package/esm2015/lib/email-subscription/email-subscription-type/email-subscription-type-list/email-subscription-type-list.component.js +2 -2
  6. package/esm2015/lib/email-subscription/email-subscription-user/email-subscription-user-list-filter/email-subscription-user-list-filter.component.js +2 -2
  7. package/esm2015/lib/login-history-for-user/login-history-for-user.component.js +11 -2
  8. package/esm2015/lib/note/index.js +2 -1
  9. package/esm2015/lib/note/note-list/note-list.component.js +2 -2
  10. package/esm2015/lib/techlify-feature/on-off-switch/on-off-switch.component.js +27 -0
  11. package/esm2015/lib/techlify-feature/techlify-feature-enabled.directive.js +77 -0
  12. package/esm2015/lib/techlify-feature/techlify-feature-listing.component.js +174 -0
  13. package/esm2015/lib/techlify-feature/techlify-feature.module.js +30 -0
  14. package/esm2015/lib/techlify-feature/techlify-feature.routing.js +12 -0
  15. package/esm2015/lib/techlify-feature/techlify-feature.service.js +28 -0
  16. package/esm2015/lib/timeline-filter/calculate-timeline.js +2 -2
  17. package/esm2015/lib/timeline-filter/timeline-filter.component.js +146 -16
  18. package/esm2015/ngx-techlify-core.js +4 -1
  19. package/esm2015/public-api.js +5 -1
  20. package/fesm2015/ngx-techlify-core.js +537 -88
  21. package/fesm2015/ngx-techlify-core.js.map +1 -1
  22. package/lib/login-history-for-user/login-history-for-user.component.d.ts +2 -0
  23. package/lib/note/index.d.ts +1 -0
  24. package/lib/techlify-feature/on-off-switch/on-off-switch.component.d.ts +9 -0
  25. package/lib/techlify-feature/techlify-feature-enabled.directive.d.ts +16 -0
  26. package/lib/techlify-feature/techlify-feature-listing.component.d.ts +34 -0
  27. package/lib/techlify-feature/techlify-feature.module.d.ts +2 -0
  28. package/lib/techlify-feature/techlify-feature.routing.d.ts +2 -0
  29. package/lib/techlify-feature/techlify-feature.service.d.ts +8 -0
  30. package/lib/timeline-filter/calculate-timeline.d.ts +5 -0
  31. package/lib/timeline-filter/timeline-filter.component.d.ts +47 -6
  32. package/ngx-techlify-core.d.ts +3 -0
  33. package/ngx-techlify-core.metadata.json +1 -1
  34. package/package.json +1 -1
  35. package/public-api.d.ts +4 -0
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/material/dialog'), require('@angular/material/table'), require('@angular/material/sort'), require('@ngneat/until-destroy'), require('@angular/common'), require('@angular/forms'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('@angular/material/snack-bar'), require('@angular/cdk/a11y'), require('@angular/cdk/coercion'), require('@angular/material/form-field'), require('@angular/material/select'), require('@angular/material/icon'), require('@angular/router'), require('@angular/material/tooltip'), require('@angular/material/core'), require('@angular/material/button'), require('@angular/material/checkbox'), require('@angular/material/input'), require('@angular/material/menu'), require('@angular/material/progress-spinner'), require('@angular/material/card'), require('@angular/material/divider'), require('@angular/material/chips'), require('@angular/material/datepicker'), require('@angular/material/list'), require('@angular/flex-layout'), require('ngx-infinite-scroll'), require('ngx-doc-viewer'), require('ngx-editor'), require('xlsx'), require('@angular/platform-browser'), require('jsondiffpatch'), require('@angular/cdk/keycodes'), require('@angular/material/autocomplete'), require('@angular/material/button-toggle')) :
3
- typeof define === 'function' && define.amd ? define('ngx-techlify-core', ['exports', '@angular/core', '@angular/material/dialog', '@angular/material/table', '@angular/material/sort', '@ngneat/until-destroy', '@angular/common', '@angular/forms', '@angular/common/http', 'rxjs', 'rxjs/operators', '@angular/material/snack-bar', '@angular/cdk/a11y', '@angular/cdk/coercion', '@angular/material/form-field', '@angular/material/select', '@angular/material/icon', '@angular/router', '@angular/material/tooltip', '@angular/material/core', '@angular/material/button', '@angular/material/checkbox', '@angular/material/input', '@angular/material/menu', '@angular/material/progress-spinner', '@angular/material/card', '@angular/material/divider', '@angular/material/chips', '@angular/material/datepicker', '@angular/material/list', '@angular/flex-layout', 'ngx-infinite-scroll', 'ngx-doc-viewer', 'ngx-editor', 'xlsx', '@angular/platform-browser', 'jsondiffpatch', '@angular/cdk/keycodes', '@angular/material/autocomplete', '@angular/material/button-toggle'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['ngx-techlify-core'] = {}, global.ng.core, global.ng.material.dialog, global.ng.material.table, global.ng.material.sort, global['@ngneat/until-destroy'], global.ng.common, global.ng.forms, global.ng.common.http, global.rxjs, global.rxjs.operators, global.ng.material.snackBar, global.ng.cdk.a11y, global.ng.cdk.coercion, global.ng.material.formField, global.ng.material.select, global.ng.material.icon, global.ng.router, global.ng.material.tooltip, global.ng.material.core, global.ng.material.button, global.ng.material.checkbox, global.ng.material.input, global.ng.material.menu, global.ng.material.progressSpinner, global.ng.material.card, global.ng.material.divider, global.ng.material.chips, global.ng.material.datepicker, global.ng.material.list, global.ng.flexLayout, global['ngx-infinite-scroll'], global['ngx-doc-viewer'], global['ngx-editor'], global.xlsx, global.ng.platformBrowser, global.jsondiffpatch, global.ng.cdk.keycodes, global.ng.material.autocomplete, global.ng.material.buttonToggle));
5
- }(this, (function (exports, i0, dialog, table, sort, untilDestroy, common, forms, i1$1, rxjs, operators, i1, a11y, coercion, formField, select, icon, i1$2, tooltip, core, button, checkbox, input, menu, progressSpinner, card, divider, chips, datepicker, list, flexLayout, ngxInfiniteScroll, ngxDocViewer, ngxEditor, XLSX, platformBrowser, jsondiffpatch, keycodes, autocomplete, buttonToggle) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/material/dialog'), require('@angular/material/table'), require('@angular/material/sort'), require('@ngneat/until-destroy'), require('@angular/common'), require('@angular/forms'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('@angular/material/snack-bar'), require('@angular/cdk/a11y'), require('@angular/cdk/coercion'), require('@angular/material/form-field'), require('@angular/material/select'), require('@angular/material/icon'), require('@angular/router'), require('@angular/material/tooltip'), require('@angular/material/core'), require('@angular/material/button'), require('@angular/material/checkbox'), require('@angular/material/input'), require('@angular/material/menu'), require('@angular/material/progress-spinner'), require('@angular/material/card'), require('@angular/material/divider'), require('@angular/material/chips'), require('@angular/material/datepicker'), require('@angular/material/list'), require('@angular/flex-layout'), require('ngx-infinite-scroll'), require('ngx-doc-viewer'), require('ngx-editor'), require('xlsx'), require('@angular/platform-browser'), require('jsondiffpatch'), require('@angular/cdk/keycodes'), require('@angular/material/autocomplete'), require('@angular/material/button-toggle'), require('@angular/material/slide-toggle')) :
3
+ typeof define === 'function' && define.amd ? define('ngx-techlify-core', ['exports', '@angular/core', '@angular/material/dialog', '@angular/material/table', '@angular/material/sort', '@ngneat/until-destroy', '@angular/common', '@angular/forms', '@angular/common/http', 'rxjs', 'rxjs/operators', '@angular/material/snack-bar', '@angular/cdk/a11y', '@angular/cdk/coercion', '@angular/material/form-field', '@angular/material/select', '@angular/material/icon', '@angular/router', '@angular/material/tooltip', '@angular/material/core', '@angular/material/button', '@angular/material/checkbox', '@angular/material/input', '@angular/material/menu', '@angular/material/progress-spinner', '@angular/material/card', '@angular/material/divider', '@angular/material/chips', '@angular/material/datepicker', '@angular/material/list', '@angular/flex-layout', 'ngx-infinite-scroll', 'ngx-doc-viewer', 'ngx-editor', 'xlsx', '@angular/platform-browser', 'jsondiffpatch', '@angular/cdk/keycodes', '@angular/material/autocomplete', '@angular/material/button-toggle', '@angular/material/slide-toggle'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['ngx-techlify-core'] = {}, global.ng.core, global.ng.material.dialog, global.ng.material.table, global.ng.material.sort, global['@ngneat/until-destroy'], global.ng.common, global.ng.forms, global.ng.common.http, global.rxjs, global.rxjs.operators, global.ng.material.snackBar, global.ng.cdk.a11y, global.ng.cdk.coercion, global.ng.material.formField, global.ng.material.select, global.ng.material.icon, global.ng.router, global.ng.material.tooltip, global.ng.material.core, global.ng.material.button, global.ng.material.checkbox, global.ng.material.input, global.ng.material.menu, global.ng.material.progressSpinner, global.ng.material.card, global.ng.material.divider, global.ng.material.chips, global.ng.material.datepicker, global.ng.material.list, global.ng.flexLayout, global['ngx-infinite-scroll'], global['ngx-doc-viewer'], global['ngx-editor'], global.xlsx, global.ng.platformBrowser, global.jsondiffpatch, global.ng.cdk.keycodes, global.ng.material.autocomplete, global.ng.material.buttonToggle, global.ng.material.slideToggle));
5
+ }(this, (function (exports, i0, dialog, table, sort, untilDestroy, common, forms, i1$1, rxjs, operators, i1, a11y, coercion, formField, select, icon, i1$2, tooltip, core, button, checkbox, input, menu, progressSpinner, card, divider, chips, datepicker, list, flexLayout, ngxInfiniteScroll, ngxDocViewer, ngxEditor, XLSX, platformBrowser, jsondiffpatch, keycodes, autocomplete, buttonToggle, slideToggle) { 'use strict';
6
6
 
7
7
  var ActionPopup = /** @class */ (function () {
8
8
  function ActionPopup() {
@@ -2164,7 +2164,7 @@
2164
2164
  NoteListComponent.decorators = [
2165
2165
  { type: i0.Component, args: [{
2166
2166
  selector: 'app-note-list',
2167
- template: "<div fxLayout=\"column\" fxLayoutGap=\"1.5rem\" class=\"m-4\" *ngIf=\"!commentsView\">\n\n <div fxLayout fxLayoutAlign=\"center center\" fxLayoutGap=\"1rem\">\n <h3 class=\"m-0 font-weight-bold mr-3\">{{labelText}}s</h3>\n <button class=\"d-print-none\" *ngIf=\"!readonly\" mat-raised-button color=\"primary\" type=\"button\"\n (click)=\"addNote()\">+ Add</button>\n </div>\n\n <div class=\"w-100 scroll-container\" infiniteScroll [infiniteScrollDistance]=\"1\" [infiniteScrollThrottle]=\"50\"\n (scrolled)=\"onScroll()\" [scrollWindow]=\"false\">\n <table mat-table [dataSource]=\"notes\" class=\"w-100\" multiTemplateDataRows>\n\n <!-- Index Column -->\n <ng-container matColumnDef=\"index\">\n <th mat-header-cell *matHeaderCellDef> # </th>\n <td mat-cell *matCellDef=\"let note; let i = dataIndex\"> {{ i+1 }} </td>\n </ng-container>\n\n\n <ng-container matColumnDef=\"note\">\n <th mat-header-cell *matHeaderCellDef> {{labelText}} </th>\n <td mat-cell *matCellDef=\"let note\">\n {{note?.note}}\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"actions\">\n <th mat-header-cell *matHeaderCellDef class=\"d-print-none\"> Actions </th>\n <td mat-cell *matCellDef=\"let note\" class=\"d-print-none\">\n <button type=\"button\" mat-icon-button (click)=\"editNote(note)\">\n <mat-icon>edit</mat-icon>\n </button>\n <button type=\"button\" mat-icon-button (click)=\"deleteNote(note)\">\n <mat-icon>delete</mat-icon>\n </button>\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n </table>\n </div>\n\n</div>\n\n<div fxLayout=\"column\" fxLayoutGap=\"1.5rem\" class=\"m-4\" *ngIf=\"commentsView\">\n <div fxLayout fxLayoutAlign=\"center center\" fxLayoutGap=\"1rem\">\n <h3 class=\"m-0 font-weight-bold mr-3\">{{labelText}}s</h3>\n </div>\n\n <div fxLayout=\"column\" class=\"w-100 scroll-container jumbotron p-4\" infiniteScroll [infiniteScrollDistance]=\"1\"\n [infiniteScrollThrottle]=\"50\" (scrolled)=\"onScroll()\" [scrollWindow]=\"false\" fxLayoutAlign=\"start\"\n fxFlex=\"100%\">\n <app-comment-form [commentData]=\"comment\" (action)=\"commentAction($event)\" *ngFor=\"let comment of notes\">\n </app-comment-form>\n <app-comment-form (action)=\"commentAction($event)\"></app-comment-form>\n </div>\n</div>",
2167
+ template: "<div fxLayout=\"column\" fxLayoutGap=\"1.5rem\" class=\"m-4\" *ngIf=\"!commentsView\">\n\n <div fxLayout fxLayoutAlign=\"center center\" fxLayoutGap=\"1rem\">\n <h3 class=\"m-0 font-weight-bold mr-3\">{{labelText}}s</h3>\n <button class=\"d-print-none\" *ngIf=\"!readonly\" mat-raised-button color=\"primary\" type=\"button\" (click)=\"addNote()\">+\n Add</button>\n </div>\n\n <div class=\"w-100 scroll-container\" infiniteScroll [infiniteScrollDistance]=\"1\" [infiniteScrollThrottle]=\"50\"\n (scrolled)=\"onScroll()\" [scrollWindow]=\"false\">\n <table mat-table [dataSource]=\"notes\" class=\"w-100\" multiTemplateDataRows>\n\n <!-- Index Column -->\n <ng-container matColumnDef=\"index\">\n <th mat-header-cell *matHeaderCellDef> # </th>\n <td mat-cell *matCellDef=\"let note; let i = dataIndex\"> {{ i+1 }} </td>\n </ng-container>\n\n\n <ng-container matColumnDef=\"note\">\n <th mat-header-cell *matHeaderCellDef> {{labelText}} </th>\n <td mat-cell *matCellDef=\"let note\">\n {{note?.note}}\n </td>\n </ng-container>\n\n <ng-container matColumnDef=\"actions\">\n <th mat-header-cell *matHeaderCellDef class=\"d-print-none\"> Actions </th>\n <td mat-cell *matCellDef=\"let note\" class=\"d-print-none\">\n <button type=\"button\" mat-icon-button (click)=\"editNote(note)\">\n <mat-icon>edit</mat-icon>\n </button>\n <button type=\"button\" mat-icon-button (click)=\"deleteNote(note)\">\n <mat-icon>delete</mat-icon>\n </button>\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n </table>\n </div>\n\n</div>\n\n<div fxLayout=\"column\" fxLayoutGap=\"1.5rem\" *ngIf=\"commentsView\">\n <div fxLayout fxLayoutAlign=\"center center\" fxLayoutGap=\"1rem\">\n <h3 class=\"m-0 font-weight-bold mr-3\">{{labelText}}s</h3>\n </div>\n\n <div fxLayout=\"column\" fxLayoutAlign=\"start\" fxFlex=\"100%\">\n <div class=\"w-100 scroll-container jumbotron\" infiniteScroll [infiniteScrollDistance]=\"1\"\n [infiniteScrollThrottle]=\"50\" (scrolled)=\"onScroll()\" [scrollWindow]=\"false\">\n <app-comment-form [commentData]=\"comment\" (action)=\"commentAction($event)\" *ngFor=\"let comment of notes\">\n </app-comment-form>\n <app-comment-form (action)=\"commentAction($event)\"></app-comment-form>\n </div>\n </div>\n</div>\n",
2168
2168
  styles: [".scroll-container{max-height:400px;overflow-y:auto}"]
2169
2169
  },] }
2170
2170
  ];
@@ -2180,6 +2180,89 @@
2180
2180
  commentsView: [{ type: i0.Input }]
2181
2181
  };
2182
2182
 
2183
+ var CommentFormComponent = /** @class */ (function () {
2184
+ function CommentFormComponent(fb, credentialService) {
2185
+ this.fb = fb;
2186
+ this.credentialService = credentialService;
2187
+ this.action = new i0.EventEmitter();
2188
+ this.createForm();
2189
+ }
2190
+ Object.defineProperty(CommentFormComponent.prototype, "commentData", {
2191
+ set: function (data) {
2192
+ this.view = !!data;
2193
+ this._commentData = data;
2194
+ this.commentFormGroup.patchValue(data);
2195
+ },
2196
+ enumerable: false,
2197
+ configurable: true
2198
+ });
2199
+ CommentFormComponent.prototype.ngOnInit = function () { };
2200
+ Object.defineProperty(CommentFormComponent.prototype, "isLoggedIn", {
2201
+ get: function () {
2202
+ return this.credentialService.isAuthenticated;
2203
+ },
2204
+ enumerable: false,
2205
+ configurable: true
2206
+ });
2207
+ Object.defineProperty(CommentFormComponent.prototype, "currentUser", {
2208
+ get: function () {
2209
+ return this.credentialService.credentials.user;
2210
+ },
2211
+ enumerable: false,
2212
+ configurable: true
2213
+ });
2214
+ CommentFormComponent.prototype.createForm = function () {
2215
+ //TODO: Finialize and add more validations.
2216
+ this.commentFormGroup = this.fb.group({
2217
+ id: [""],
2218
+ note: [""],
2219
+ model_type: [""],
2220
+ related_model_id: [""],
2221
+ });
2222
+ };
2223
+ CommentFormComponent.prototype.submit = function () {
2224
+ if (this.commentFormGroup.get("note").value) {
2225
+ if (this._commentData) {
2226
+ this.view = !this.view;
2227
+ }
2228
+ this.action.emit({ type: "save", value: this.commentFormGroup.value });
2229
+ this.commentFormGroup.reset();
2230
+ }
2231
+ else if (this.commentFormGroup.get("id").value) {
2232
+ this.deleteComment();
2233
+ }
2234
+ };
2235
+ CommentFormComponent.prototype.hideEdit = function () {
2236
+ if (this.commentFormGroup.get("id").value) {
2237
+ this.view = !this.view;
2238
+ }
2239
+ };
2240
+ CommentFormComponent.prototype.editComment = function () {
2241
+ this.view = !this.view;
2242
+ this.commentFormGroup.patchValue(this._commentData);
2243
+ };
2244
+ CommentFormComponent.prototype.deleteComment = function () {
2245
+ this.action.emit({ type: "delete", value: this.commentFormGroup.value });
2246
+ };
2247
+ CommentFormComponent.prototype.ngOnDestroy = function () { };
2248
+ return CommentFormComponent;
2249
+ }());
2250
+ CommentFormComponent.decorators = [
2251
+ { type: i0.Component, args: [{
2252
+ selector: "app-comment-form",
2253
+ template: "<form (ngSubmit)=\"submit()\" [formGroup]=\"commentFormGroup\">\n <div fxLayout=\"column\" class=\"my-2\" [ngClass]=\"{ 'border border-primary shadow rounded ': view}\">\n <div *ngIf=\"!view\" fxLayout=\"column\">\n <mat-form-field appearance=\"outline\" style=\"background-color:white;\">\n <mat-label>Comment</mat-label>\n <textarea matInput rows=\"5\" placeholder=\"Add a comment...\" formControlName=\"note\" autocomplete=\"off\"></textarea>\n </mat-form-field>\n\n <div fxLayout fxLayoutGap=\"1rem\" class=\"mt-2\">\n <span fxFlex></span>\n <button *ngIf=\"_commentData\" mat-button type=\"button\" (click)=\"view = !view\">\n Cancel\n </button>\n <button mat-raised-button color=\"primary\" type=\"submit\">\n {{ _commentData ? \"Update\" : \"Post comment\" }}\n </button>\n </div>\n </div>\n\n <div fxLayout=\"column\" *ngIf=\"view\" class=\"p-2 m-2\">\n <div fxLayout=\"row wrap\" fxLayoutGap=\".5rem\">\n <div fxFlex=\"20%\" fxLayoutAlign=\"start\">\n <button mat-icon-button type=\"button\" style=\"color:grey\">\n <mat-icon style=\"font-size:60px\">account_circle</mat-icon>\n </button>\n </div>\n <div fxFlex=\"75%\">\n <div fxLayout=\"column\" fxLayoutGap=\".5rem\">\n <div class=\"font-weight-bold\">{{ _commentData?.creator?.name }}</div>\n <div class=\"text-muted\">{{ _commentData.updated_at | date:'medium' }}</div>\n </div>\n </div>\n </div>\n <app-read-more class=\"mt-2\" [text]=\"_commentData.note\"></app-read-more>\n <div fxLayout class=\"mt-1\" fxLayoutGap=\"1rem\" *ngIf=\"isLoggedIn && currentUser.id === _commentData.creator_id\">\n <a href=\"javascript:;\" (click)=\"editComment()\">\n Edit\n </a>\n <a href=\"javascript:;\" (click)=\"deleteComment()\">\n Delete\n </a>\n </div>\n </div>\n </div>\n</form>",
2254
+ styles: [":host ::ng-deep .mat-form-field-wrapper{margin:0!important;padding-bottom:0!important}"]
2255
+ },] }
2256
+ ];
2257
+ CommentFormComponent.ctorParameters = function () { return [
2258
+ { type: forms.FormBuilder },
2259
+ { type: CredentialsService }
2260
+ ]; };
2261
+ CommentFormComponent.propDecorators = {
2262
+ commentData: [{ type: i0.Input }],
2263
+ action: [{ type: i0.Output }]
2264
+ };
2265
+
2183
2266
  var SearchableSelectorComponent_1;
2184
2267
  exports.ɵx = SearchableSelectorComponent_1 = /** @class */ (function () {
2185
2268
  function SearchableSelectorComponent(formBuilder, _focusMonitor, http, _elementRef, dialog, ngControl) {
@@ -2703,7 +2786,7 @@
2703
2786
  }
2704
2787
  case 4: { // This Week
2705
2788
  var first = date.getDate() - date.getDay() + 1; // First day is the day of the month - the day of the week
2706
- var last = first + 6; // last day is the first day + 6
2789
+ var last = first + 6; // last day is the first day + 6
2707
2790
  data.date_from = new Date(date.setDate(first));
2708
2791
  data.date_to = new Date(date.setDate(last));
2709
2792
  break;
@@ -2785,8 +2868,11 @@
2785
2868
  Timeline.LAST_YEAR = 11;
2786
2869
  Timeline.ALL = 12;
2787
2870
 
2788
- exports.ɵbb = /** @class */ (function () {
2789
- function TimelineFilterComponent() {
2871
+ var TimelineFilterComponent_1;
2872
+ exports.ɵbb = TimelineFilterComponent_1 = /** @class */ (function () {
2873
+ function TimelineFilterComponent(formBuilder, ngControl, datePipe) {
2874
+ this.ngControl = ngControl;
2875
+ this.datePipe = datePipe;
2790
2876
  this.timelineValue = new forms.FormControl('');
2791
2877
  this.timelines = [
2792
2878
  { value: 1, viewValue: 'Custom' },
@@ -2802,12 +2888,33 @@
2802
2888
  { value: 11, viewValue: 'Last Year' },
2803
2889
  { value: 12, viewValue: 'All dates' },
2804
2890
  ];
2805
- this.labelText = 'Select Timeline';
2806
2891
  this.dateFrom = 'date_from';
2807
2892
  this.dateTo = 'date_to';
2808
2893
  this.appearance = "legacy";
2809
2894
  this.showClearbutton = false;
2895
+ /**
2896
+ * @deprecated The form input is deprated
2897
+ */
2898
+ this.form = null;
2899
+ this.labelText = 'Select Timeline';
2900
+ this.touchUi = true;
2901
+ this.selectedValueChange = new i0.EventEmitter();
2902
+ this.selectionChange = new i0.EventEmitter();
2903
+ this.onChange = function () { };
2904
+ this.onTouched = function () { };
2905
+ this.stateChanges = new rxjs.Subject();
2906
+ this.controlType = 'timeline-filter';
2907
+ this.id = "timeline-filter-" + TimelineFilterComponent_1.nextId++;
2908
+ this.describedBy = '';
2810
2909
  this.showCustomDateFields = false;
2910
+ this._required = false;
2911
+ this._disabled = false;
2912
+ this.selectorForm = formBuilder.group({
2913
+ select_value: [null],
2914
+ });
2915
+ if (this.ngControl != null) {
2916
+ this.ngControl.valueAccessor = this;
2917
+ }
2811
2918
  }
2812
2919
  Object.defineProperty(TimelineFilterComponent.prototype, "defaultValue", {
2813
2920
  set: function (value) {
@@ -2817,10 +2924,53 @@
2817
2924
  enumerable: false,
2818
2925
  configurable: true
2819
2926
  });
2820
- TimelineFilterComponent.prototype.ngOnInit = function () {
2821
- var _this = this;
2822
- this.timelineValue.valueChanges.
2823
- pipe(operators.debounceTime(100), operators.distinctUntilChanged(), untilDestroy.untilDestroyed(this)).subscribe(function (value) { return _this.changeTimeline(value); });
2927
+ Object.defineProperty(TimelineFilterComponent.prototype, "required", {
2928
+ get: function () { return this._required; },
2929
+ set: function (value) {
2930
+ this.selectorForm.get('select_value').setValidators(forms.Validators.required);
2931
+ this._required = coercion.coerceBooleanProperty(value);
2932
+ this.stateChanges.next();
2933
+ },
2934
+ enumerable: false,
2935
+ configurable: true
2936
+ });
2937
+ Object.defineProperty(TimelineFilterComponent.prototype, "disabled", {
2938
+ get: function () { return this._disabled; },
2939
+ set: function (value) {
2940
+ this._disabled = coercion.coerceBooleanProperty(value);
2941
+ this._disabled ? this.selectorForm.disable() : this.selectorForm.enable();
2942
+ this.stateChanges.next();
2943
+ },
2944
+ enumerable: false,
2945
+ configurable: true
2946
+ });
2947
+ Object.defineProperty(TimelineFilterComponent.prototype, "value", {
2948
+ get: function () {
2949
+ if (this.selectorForm.valid) {
2950
+ return this.selectorForm.value.select_value;
2951
+ }
2952
+ return '';
2953
+ },
2954
+ set: function (data) {
2955
+ this.selectorForm.patchValue({ select_value: data || '' });
2956
+ this._handleInput();
2957
+ this.stateChanges.next();
2958
+ },
2959
+ enumerable: false,
2960
+ configurable: true
2961
+ });
2962
+ TimelineFilterComponent.prototype.getDateRangeString = function () {
2963
+ var _a, _b, _c, _d, _e, _f, _g;
2964
+ var str = "";
2965
+ if ((_a = this.selectedRange) === null || _a === void 0 ? void 0 : _a.show_custom_field) {
2966
+ if (((_b = this.selectedRange) === null || _b === void 0 ? void 0 : _b.date_from.toUTCString()) != 'Invalid Date') {
2967
+ str += ' - ' + this.datePipe.transform((_d = (_c = this.selectedRange) === null || _c === void 0 ? void 0 : _c.date_from) === null || _d === void 0 ? void 0 : _d.toUTCString());
2968
+ }
2969
+ if (((_e = this.selectedRange) === null || _e === void 0 ? void 0 : _e.date_to.toUTCString()) != 'Invalid Date') {
2970
+ str += ' - ' + this.datePipe.transform((_g = (_f = this.selectedRange) === null || _f === void 0 ? void 0 : _f.date_to) === null || _g === void 0 ? void 0 : _g.toUTCString());
2971
+ }
2972
+ }
2973
+ return str;
2824
2974
  };
2825
2975
  TimelineFilterComponent.prototype.resetFieldValue = function (field) {
2826
2976
  this.form.get(field).setValue('');
@@ -2839,28 +2989,99 @@
2839
2989
  this.showCustomDateFields = timeline.show_custom_field;
2840
2990
  }
2841
2991
  };
2992
+ TimelineFilterComponent.prototype._handleInput = function () {
2993
+ if (this.value == 1) {
2994
+ this.picker.open();
2995
+ return;
2996
+ }
2997
+ var range = calculateTimeline(this.value);
2998
+ this.selectedRange = range;
2999
+ this.onChange(this.value);
3000
+ this.selectedValueChange.emit(this.selectedValue);
3001
+ this.selectionChange.emit(range);
3002
+ };
3003
+ TimelineFilterComponent.prototype.dateRangeChange = function (dateRangeStart, dateRangeEnd) {
3004
+ var range = {
3005
+ date_from: new Date(dateRangeStart.value),
3006
+ date_to: new Date(dateRangeEnd.value),
3007
+ show_custom_field: true
3008
+ };
3009
+ this.selectedRange = range;
3010
+ this.onChange(this.value);
3011
+ this.selectedValueChange.emit(this.selectedValue);
3012
+ this.selectionChange.emit(range);
3013
+ };
3014
+ TimelineFilterComponent.prototype.onCustomDateChange = function (event) {
3015
+ console.log(event);
3016
+ };
3017
+ TimelineFilterComponent.prototype.setDescribedByIds = function (ids) {
3018
+ this.describedBy = ids.join(' ');
3019
+ };
3020
+ TimelineFilterComponent.prototype.onContainerClick = function (event) {
3021
+ event.stopPropagation();
3022
+ };
3023
+ TimelineFilterComponent.prototype.writeValue = function (data) {
3024
+ this.value = data;
3025
+ };
3026
+ TimelineFilterComponent.prototype.registerOnChange = function (fn) {
3027
+ this.onChange = fn;
3028
+ };
3029
+ TimelineFilterComponent.prototype.registerOnTouched = function (fn) {
3030
+ this.onTouched = fn;
3031
+ };
3032
+ TimelineFilterComponent.prototype.setDisabledState = function (isDisabled) {
3033
+ this.disabled = isDisabled;
3034
+ };
3035
+ TimelineFilterComponent.prototype.ngOnInit = function () {
3036
+ var _this = this;
3037
+ console.log(this.form);
3038
+ this.timelineValue.valueChanges.
3039
+ pipe(operators.debounceTime(100), operators.distinctUntilChanged(), untilDestroy.untilDestroyed(this)).subscribe(function (value) { return _this.changeTimeline(value); });
3040
+ };
3041
+ TimelineFilterComponent.prototype.ngOnDestroy = function () {
3042
+ this.stateChanges.complete();
3043
+ };
2842
3044
  return TimelineFilterComponent;
2843
3045
  }());
3046
+ exports.ɵbb.nextId = 0;
2844
3047
  exports.ɵbb.decorators = [
2845
3048
  { type: i0.Component, args: [{
2846
3049
  selector: 'app-timeline-filter',
2847
- template: "<ng-container [formGroup]=\"form\">\n <mat-form-field [appearance]=\"appearance\">\n <mat-label>{{labelText}}</mat-label>\n <mat-select [formControl]=\"timelineValue\">\n <mat-option *ngFor=\"let timeline of timelines\" [value]=\"timeline.value\">\n {{timeline.viewValue}}\n </mat-option>\n </mat-select>\n <button mat-button *ngIf=\"showClearbutton && timelineValue.value\" matSuffix mat-icon-button\n (click)=\"timelineValue.setValue('')\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n\n <ng-container *ngIf=\"showCustomDateFields\">\n <mat-form-field [appearance]=\"appearance\">\n <mat-label>From Date</mat-label>\n <input matInput formControlName=\"{{dateFrom}}\" [matDatepicker]=\"fromPicker\" (click)=\"fromPicker.open()\"\n placeholder=\"From Date\" readonly />\n <mat-datepicker-toggle matSuffix [for]=\"fromPicker\"></mat-datepicker-toggle>\n <mat-datepicker #fromPicker></mat-datepicker>\n <button mat-button *ngIf=\"getFieldValue(dateFrom)\" matSuffix mat-icon-button\n (click)=\"resetFieldValue(dateFrom)\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n\n <mat-form-field [appearance]=\"appearance\">\n <mat-label>To Date</mat-label>\n <input matInput formControlName=\"{{dateTo}}\" [matDatepicker]=\"toPicker\" (click)=\"toPicker.open()\"\n placeholder=\"To Date\" readonly />\n <mat-datepicker-toggle matSuffix [for]=\"\"></mat-datepicker-toggle>\n <mat-datepicker #toPicker></mat-datepicker>\n <button mat-button *ngIf=\"getFieldValue(dateTo)\" matSuffix mat-icon-button\n (click)=\"resetFieldValue(dateTo)\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n\n </ng-container>\n</ng-container>",
3050
+ template: "<ng-container *ngIf=\"form\" [formGroup]=\"form\">\n <mat-form-field [appearance]=\"appearance\">\n <mat-label>{{labelText}}</mat-label>\n <mat-select [formControl]=\"timelineValue\">\n <mat-option *ngFor=\"let timeline of timelines\" [value]=\"timeline.value\">\n {{timeline.viewValue}}\n </mat-option>\n </mat-select>\n <button mat-button *ngIf=\"showClearbutton && timelineValue.value\" matSuffix mat-icon-button\n (click)=\"timelineValue.setValue('')\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n\n <ng-container *ngIf=\"showCustomDateFields\">\n <mat-form-field [appearance]=\"appearance\">\n <mat-label>From Date</mat-label>\n <input matInput formControlName=\"{{dateFrom}}\" [matDatepicker]=\"fromPicker\" (click)=\"fromPicker.open()\"\n placeholder=\"From Date\" readonly />\n <mat-datepicker-toggle matSuffix [for]=\"fromPicker\"></mat-datepicker-toggle>\n <mat-datepicker #fromPicker></mat-datepicker>\n <button mat-button *ngIf=\"getFieldValue(dateFrom)\" matSuffix mat-icon-button\n (click)=\"resetFieldValue(dateFrom)\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n\n <mat-form-field [appearance]=\"appearance\">\n <mat-label>To Date</mat-label>\n <input matInput formControlName=\"{{dateTo}}\" [matDatepicker]=\"toPicker\" (click)=\"toPicker.open()\"\n placeholder=\"To Date\" readonly />\n <mat-datepicker-toggle matSuffix [for]=\"\"></mat-datepicker-toggle>\n <mat-datepicker #toPicker></mat-datepicker>\n <button mat-button *ngIf=\"getFieldValue(dateTo)\" matSuffix mat-icon-button\n (click)=\"resetFieldValue(dateTo)\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n\n </ng-container>\n</ng-container>\n<div *ngIf=\"!form\" [formGroup]=\"selectorForm\">\n <mat-select formControlName=\"select_value\" focused=\"false\" [required]=\"required\"\n autocomplete=\"off\" (selectionChange)=\"_handleInput()\">\n <mat-option *ngFor=\"let timeline of timelines\" [value]=\"timeline?.value\">\n {{ timeline?.viewValue }} {{ selectedRange?.show_custom_field && timeline?.value == 1 ? getDateRangeString() : '' }}\n </mat-option>\n </mat-select>\n <mat-date-range-input hidden (dateChange)=\"onCustomDateChange($event)\" [rangePicker]=\"picker\">\n <input matStartDate #customStartDate>\n <input matEndDate (dateChange)=\"dateRangeChange(customStartDate, customEndDate)\" #customEndDate>\n </mat-date-range-input>\n <mat-date-range-picker #picker [touchUi]=\"touchUi\"></mat-date-range-picker>\n</div>\n",
3051
+ providers: [
3052
+ {
3053
+ provide: formField.MatFormFieldControl,
3054
+ useExisting: TimelineFilterComponent_1
3055
+ }
3056
+ ],
2848
3057
  styles: [""]
2849
3058
  },] }
2850
3059
  ];
2851
- exports.ɵbb.ctorParameters = function () { return []; };
3060
+ exports.ɵbb.ctorParameters = function () { return [
3061
+ { type: forms.FormBuilder },
3062
+ { type: forms.NgControl, decorators: [{ type: i0.Optional }, { type: i0.Self }] },
3063
+ { type: common.DatePipe }
3064
+ ]; };
2852
3065
  exports.ɵbb.propDecorators = {
3066
+ picker: [{ type: i0.ViewChild, args: ['picker',] }],
2853
3067
  timelineValue: [{ type: i0.Input }],
2854
3068
  timelines: [{ type: i0.Input }],
2855
- labelText: [{ type: i0.Input }],
2856
3069
  dateFrom: [{ type: i0.Input }],
2857
3070
  dateTo: [{ type: i0.Input }],
2858
3071
  appearance: [{ type: i0.Input }],
2859
3072
  showClearbutton: [{ type: i0.Input }],
2860
3073
  form: [{ type: i0.Input }],
2861
- defaultValue: [{ type: i0.Input }]
3074
+ labelText: [{ type: i0.Input }],
3075
+ selectedValue: [{ type: i0.Input }],
3076
+ touchUi: [{ type: i0.Input }],
3077
+ selectedValueChange: [{ type: i0.Output }],
3078
+ selectionChange: [{ type: i0.Output }],
3079
+ defaultValue: [{ type: i0.Input }],
3080
+ required: [{ type: i0.Input }],
3081
+ disabled: [{ type: i0.Input }],
3082
+ value: [{ type: i0.Input }]
2862
3083
  };
2863
- exports.ɵbb = __decorate([
3084
+ exports.ɵbb = TimelineFilterComponent_1 = __decorate([
2864
3085
  untilDestroy.UntilDestroy()
2865
3086
  ], exports.ɵbb);
2866
3087
 
@@ -3377,89 +3598,6 @@
3377
3598
  },] }
3378
3599
  ];
3379
3600
 
3380
- var CommentFormComponent = /** @class */ (function () {
3381
- function CommentFormComponent(fb, credentialService) {
3382
- this.fb = fb;
3383
- this.credentialService = credentialService;
3384
- this.action = new i0.EventEmitter();
3385
- this.createForm();
3386
- }
3387
- Object.defineProperty(CommentFormComponent.prototype, "commentData", {
3388
- set: function (data) {
3389
- this.view = !!data;
3390
- this._commentData = data;
3391
- this.commentFormGroup.patchValue(data);
3392
- },
3393
- enumerable: false,
3394
- configurable: true
3395
- });
3396
- CommentFormComponent.prototype.ngOnInit = function () { };
3397
- Object.defineProperty(CommentFormComponent.prototype, "isLoggedIn", {
3398
- get: function () {
3399
- return this.credentialService.isAuthenticated;
3400
- },
3401
- enumerable: false,
3402
- configurable: true
3403
- });
3404
- Object.defineProperty(CommentFormComponent.prototype, "currentUser", {
3405
- get: function () {
3406
- return this.credentialService.credentials.user;
3407
- },
3408
- enumerable: false,
3409
- configurable: true
3410
- });
3411
- CommentFormComponent.prototype.createForm = function () {
3412
- //TODO: Finialize and add more validations.
3413
- this.commentFormGroup = this.fb.group({
3414
- id: [""],
3415
- note: [""],
3416
- model_type: [""],
3417
- related_model_id: [""],
3418
- });
3419
- };
3420
- CommentFormComponent.prototype.submit = function () {
3421
- if (this.commentFormGroup.get("note").value) {
3422
- if (this._commentData) {
3423
- this.view = !this.view;
3424
- }
3425
- this.action.emit({ type: "save", value: this.commentFormGroup.value });
3426
- this.commentFormGroup.reset();
3427
- }
3428
- else if (this.commentFormGroup.get("id").value) {
3429
- this.deleteComment();
3430
- }
3431
- };
3432
- CommentFormComponent.prototype.hideEdit = function () {
3433
- if (this.commentFormGroup.get("id").value) {
3434
- this.view = !this.view;
3435
- }
3436
- };
3437
- CommentFormComponent.prototype.editComment = function () {
3438
- this.view = !this.view;
3439
- this.commentFormGroup.patchValue(this._commentData);
3440
- };
3441
- CommentFormComponent.prototype.deleteComment = function () {
3442
- this.action.emit({ type: "delete", value: this.commentFormGroup.value });
3443
- };
3444
- CommentFormComponent.prototype.ngOnDestroy = function () { };
3445
- return CommentFormComponent;
3446
- }());
3447
- CommentFormComponent.decorators = [
3448
- { type: i0.Component, args: [{
3449
- selector: "app-comment-form",
3450
- template: "<form (ngSubmit)=\"submit()\" [formGroup]=\"commentFormGroup\">\n <div fxLayout=\"column\" class=\"my-2\" [ngClass]=\"{ 'border border-primary shadow rounded ': view}\">\n <div *ngIf=\"!view\" fxLayout=\"column\">\n <mat-form-field appearance=\"outline\" style=\"background-color:white;\">\n <mat-label>Comment</mat-label>\n <textarea matInput rows=\"5\" placeholder=\"Add a comment...\" formControlName=\"note\" autocomplete=\"off\"></textarea>\n </mat-form-field>\n\n <div fxLayout fxLayoutGap=\"1rem\" class=\"mt-2\">\n <span fxFlex></span>\n <button *ngIf=\"_commentData\" mat-button type=\"button\" (click)=\"view = !view\">\n Cancel\n </button>\n <button mat-raised-button color=\"primary\" type=\"submit\">\n {{ _commentData ? \"Update\" : \"Post comment\" }}\n </button>\n </div>\n </div>\n\n <div fxLayout=\"column\" *ngIf=\"view\" class=\"p-2 m-2\">\n <div fxLayout=\"row wrap\" fxLayoutGap=\".5rem\">\n <div fxFlex=\"20%\" fxLayoutAlign=\"start\">\n <button mat-icon-button type=\"button\" style=\"color:grey\">\n <mat-icon style=\"font-size:60px\">account_circle</mat-icon>\n </button>\n </div>\n <div fxFlex=\"75%\">\n <div fxLayout=\"column\" fxLayoutGap=\".5rem\">\n <div class=\"font-weight-bold\">{{ _commentData?.creator?.name }}</div>\n <div class=\"text-muted\">{{ _commentData.updated_at | date:'medium' }}</div>\n </div>\n </div>\n </div>\n <app-read-more class=\"mt-2\" [text]=\"_commentData.note\"></app-read-more>\n <div fxLayout class=\"mt-1\" fxLayoutGap=\"1rem\" *ngIf=\"isLoggedIn && currentUser.id === _commentData.creator_id\">\n <a href=\"javascript:;\" (click)=\"editComment()\">\n Edit\n </a>\n <a href=\"javascript:;\" (click)=\"deleteComment()\">\n Delete\n </a>\n </div>\n </div>\n </div>\n</form>",
3451
- styles: [":host ::ng-deep .mat-form-field-wrapper{margin:0!important;padding-bottom:0!important}"]
3452
- },] }
3453
- ];
3454
- CommentFormComponent.ctorParameters = function () { return [
3455
- { type: forms.FormBuilder },
3456
- { type: CredentialsService }
3457
- ]; };
3458
- CommentFormComponent.propDecorators = {
3459
- commentData: [{ type: i0.Input }],
3460
- action: [{ type: i0.Output }]
3461
- };
3462
-
3463
3601
  var ReadMoreComponent = /** @class */ (function () {
3464
3602
  function ReadMoreComponent() {
3465
3603
  this.maxLength = 100;
@@ -4050,7 +4188,7 @@
4050
4188
  exports.ɵbh.decorators = [
4051
4189
  { type: i0.Component, args: [{
4052
4190
  selector: 'app-email-subscription-user-list-filter',
4053
- template: "<form [formGroup]=\"esUserFilterForm\" fxLayout=\"row wrap\" fxLayoutGap=\"1rem\" fxLayoutAlign=\"start center\">\n <mat-form-field class=\"ml-3\">\n <mat-label>User</mat-label>\n <app-searchable-selector formControlName=\"user_id\" apiUrl=\"api/users\" titleField=\"name\">\n </app-searchable-selector>\n <button mat-button *ngIf=\"getFieldValue('user_id')\" matSuffix mat-icon-button\n (click)=\"resetFieldValue('user_id')\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n\n <mat-form-field class=\"ml-3\">\n <mat-label>Email Type</mat-label>\n <app-searchable-selector formControlName=\"email_type_id\" apiUrl=\"api/email-subscription-types\">\n </app-searchable-selector>\n <button mat-button *ngIf=\"getFieldValue('user_id')\" matSuffix mat-icon-button\n (click)=\"resetFieldValue('user_id')\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n</form>",
4191
+ template: "<form [formGroup]=\"esUserFilterForm\" fxLayout=\"row wrap\" fxLayoutGap=\"1rem\" fxLayoutAlign=\"start center\">\n <mat-form-field class=\"ml-3\">\n <mat-label>User</mat-label>\n <app-searchable-selector formControlName=\"user_id\" apiUrl=\"api/users\" titleField=\"name\">\n </app-searchable-selector>\n <button mat-button *ngIf=\"getFieldValue('user_id')\" matSuffix mat-icon-button\n (click)=\"resetFieldValue('user_id')\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n\n <mat-form-field class=\"ml-3\">\n <mat-label>Email Type</mat-label>\n <app-searchable-selector formControlName=\"email_type_id\" apiUrl=\"api/email-subscription-types\">\n </app-searchable-selector>\n <button mat-button *ngIf=\"getFieldValue('email_type_id')\" matSuffix mat-icon-button\n (click)=\"resetFieldValue('email_type_id')\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n</form>",
4054
4192
  styles: [""]
4055
4193
  },] }
4056
4194
  ];
@@ -4401,7 +4539,7 @@
4401
4539
  exports.ɵbj.decorators = [
4402
4540
  { type: i0.Component, args: [{
4403
4541
  selector: 'app-email-subscription-type-list',
4404
- template: "<div class=\"mat-typography m-4\">\n <div fxLayout=\"row wrap\" fxLayoutAlign=\"start center\">\n <mat-form-field>\n <input matInput [formControl]=\"search\" placeholder=\"Email Type\" autocomplete=\"off\" />\n <button mat-button matSuffix mat-icon-button>\n <mat-icon>search</mat-icon>\n </button>\n <button mat-button *ngIf=\"search.value\" matSuffix mat-icon-button (click)=\"search.setValue('')\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n <div class=\"ml-2\">\n <button mat-raised-button color=\"primary\" type=\"button\" (click)=\"addEmailSubscriptionType()\">+ Email\n Type</button>\n </div>\n <span fxFlex></span>\n <mat-form-field appearance=\"outline\" class=\"no-padding\">\n <mat-label>Columns</mat-label>\n <mat-select [formControl]=\"displayColumns\" multiple (selectionChange)=\"columnsChange()\">\n <mat-option *ngFor=\"let column of availableDisplayColumns\" [value]=\"column.value\">{{column.name}}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n\n <section>\n <div class=\"scroll-container\" infiniteScroll [infiniteScrollDistance]=\"2\" [infiniteScrollThrottle]=\"50\"\n (scrolled)=\"onScroll()\" [scrollWindow]=\"false\">\n <table mat-table [dataSource]=\"emailSubscriptionTypeList\" matSort class=\"w-100 mt-1\" multiTemplateDataRows\n id=\"email-subscription-type-table\">\n\n <!-- Index Column -->\n <ng-container matColumnDef=\"index\">\n <th mat-header-cell *matHeaderCellDef> # </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType; let i = dataIndex\"> {{ i+1 }} </td>\n </ng-container>\n <ng-container matColumnDef=\"title\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Title </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType;\"> {{ emailSubscriptionType?.title }} </td>\n </ng-container>\n <ng-container matColumnDef=\"code\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Code </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType;\"> {{ emailSubscriptionType?.code }}\n </td>\n </ng-container>\n <ng-container matColumnDef=\"frequency.title\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Code </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType;\"> {{ emailSubscriptionType?.frequency?.title }}\n </td>\n </ng-container>\n <ng-container matColumnDef=\"description\">\n <th mat-header-cell *matHeaderCellDef> Description </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType;\"> {{ emailSubscriptionType?.description }}\n </td>\n </ng-container>\n\n <!-- Actions Column -->\n <ng-container matColumnDef=\"actions\">\n <th mat-header-cell *matHeaderCellDef> Actions </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType\">\n <button type=\"button\" mat-icon-button\n (click)=\"deleteEmailSubscriptionType($event,emailSubscriptionType)\">\n <mat-icon>delete</mat-icon>\n </button>\n <button type=\"button\" mat-icon-button\n (click)=\"editEmailSubscriptionType($event,emailSubscriptionType)\">\n <mat-icon>edit</mat-icon>\n </button>\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns; sticky:true\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n </table>\n </div>\n </section>\n</div>",
4542
+ template: "<div class=\"mat-typography m-4\">\n <div fxLayout=\"row wrap\" fxLayoutAlign=\"start center\">\n <mat-form-field>\n <input matInput [formControl]=\"search\" placeholder=\"Email Type\" autocomplete=\"off\" />\n <button mat-button matSuffix mat-icon-button>\n <mat-icon>search</mat-icon>\n </button>\n <button mat-button *ngIf=\"search.value\" matSuffix mat-icon-button (click)=\"search.setValue('')\">\n <mat-icon>close</mat-icon>\n </button>\n </mat-form-field>\n <div class=\"ml-2\">\n <button mat-raised-button color=\"primary\" type=\"button\" (click)=\"addEmailSubscriptionType()\">+ Email\n Type</button>\n </div>\n <span fxFlex></span>\n <mat-form-field appearance=\"outline\" class=\"no-padding\">\n <mat-label>Columns</mat-label>\n <mat-select [formControl]=\"displayColumns\" multiple (selectionChange)=\"columnsChange()\">\n <mat-option *ngFor=\"let column of availableDisplayColumns\" [value]=\"column.value\">{{column.name}}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n\n <section>\n <div class=\"scroll-container\" infiniteScroll [infiniteScrollDistance]=\"2\" [infiniteScrollThrottle]=\"50\"\n (scrolled)=\"onScroll()\" [scrollWindow]=\"false\">\n <table mat-table [dataSource]=\"emailSubscriptionTypeList\" matSort class=\"w-100 mt-1\" multiTemplateDataRows\n id=\"email-subscription-type-table\">\n\n <!-- Index Column -->\n <ng-container matColumnDef=\"index\">\n <th mat-header-cell *matHeaderCellDef> # </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType; let i = dataIndex\"> {{ i+1 }} </td>\n </ng-container>\n <ng-container matColumnDef=\"title\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Title </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType;\"> {{ emailSubscriptionType?.title }} </td>\n </ng-container>\n <ng-container matColumnDef=\"code\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Code </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType;\"> {{ emailSubscriptionType?.code }}\n </td>\n </ng-container>\n <ng-container matColumnDef=\"frequency.title\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Frequency </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType;\"> {{ emailSubscriptionType?.frequency?.title }}\n </td>\n </ng-container>\n <ng-container matColumnDef=\"description\">\n <th mat-header-cell *matHeaderCellDef> Description </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType;\"> {{ emailSubscriptionType?.description }}\n </td>\n </ng-container>\n\n <!-- Actions Column -->\n <ng-container matColumnDef=\"actions\">\n <th mat-header-cell *matHeaderCellDef> Actions </th>\n <td mat-cell *matCellDef=\"let emailSubscriptionType\">\n <button type=\"button\" mat-icon-button\n (click)=\"deleteEmailSubscriptionType($event,emailSubscriptionType)\">\n <mat-icon>delete</mat-icon>\n </button>\n <button type=\"button\" mat-icon-button\n (click)=\"editEmailSubscriptionType($event,emailSubscriptionType)\">\n <mat-icon>edit</mat-icon>\n </button>\n </td>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns; sticky:true\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n </table>\n </div>\n </section>\n</div>",
4405
4543
  styles: [".scroll-container{max-height:800px;overflow-y:auto}"]
4406
4544
  },] }
4407
4545
  ];
@@ -6492,6 +6630,7 @@
6492
6630
  };
6493
6631
  this.displayedColumns = ['index', 'created_at'];
6494
6632
  this.historyFilterForm = this.fb.group({
6633
+ 'duration': [''],
6495
6634
  'date_from': [''],
6496
6635
  'date_to': ['']
6497
6636
  });
@@ -6508,6 +6647,14 @@
6508
6647
  });
6509
6648
  this.initializeData();
6510
6649
  };
6650
+ LoginHistoryForUserComponent.prototype.onTimelineChange = function (range) {
6651
+ var date_from = (range === null || range === void 0 ? void 0 : range.date_from) ? new Date(range.date_from) : '';
6652
+ var date_to = (range === null || range === void 0 ? void 0 : range.date_to) ? new Date(range.date_to) : '';
6653
+ this.historyFilterForm.patchValue({
6654
+ date_from: date_from,
6655
+ date_to: date_to
6656
+ });
6657
+ };
6511
6658
  LoginHistoryForUserComponent.prototype.initializeData = function () {
6512
6659
  var _this = this;
6513
6660
  this.http.get("api/user-login-history", { params: Object.assign(Object.assign({}, this.filters), this.pageEvent) })
@@ -6541,7 +6688,7 @@
6541
6688
  exports.LoginHistoryForUserComponent.decorators = [
6542
6689
  { type: i0.Component, args: [{
6543
6690
  selector: 'app-login-history-for-user',
6544
- template: "<div class=\"mat-typography m-4\">\n <form fxLayoutAlign=\" start center\">\n <app-timeline-filter [form]=\"historyFilterForm\"></app-timeline-filter>\n </form>\n\n\n\n <section>\n <div class=\"scroll-container\" infiniteScroll [infiniteScrollDistance]=\"2\" [infiniteScrollThrottle]=\"50\"\n (scrolled)=\"onScroll()\" [scrollWindow]=\"false\">\n <table mat-table [dataSource]=\"loginHistoryList\" matSort class=\"w-100 mt-1\" multiTemplateDataRows\n id=\"login-history-table\">\n\n <!-- Index Column -->\n <ng-container matColumnDef=\"index\">\n <th mat-header-cell *matHeaderCellDef> # </th>\n <td mat-cell *matCellDef=\"let loginHistory; let i = dataIndex\"> {{ i+1 }} </td>\n </ng-container>\n\n <ng-container matColumnDef=\"created_at\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Last Login</th>\n <td mat-cell *matCellDef=\"let loginHistory;\">\n {{loginHistory?.created_at | date:'medium' }}\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns;\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n </table>\n </div>\n\n </section>\n</div>",
6691
+ template: "<div class=\"mat-typography m-4\">\n <form [formGroup]=\"historyFilterForm\" fxLayoutAlign=\" start center\">\n <app-timeline-filter formControlName=\"duration\" (selectionChange)=\"onTimelineChange($event)\"></app-timeline-filter>\n </form>\n\n <section>\n <div class=\"scroll-container\" infiniteScroll [infiniteScrollDistance]=\"2\" [infiniteScrollThrottle]=\"50\"\n (scrolled)=\"onScroll()\" [scrollWindow]=\"false\">\n <table mat-table [dataSource]=\"loginHistoryList\" matSort class=\"w-100 mt-1\" multiTemplateDataRows\n id=\"login-history-table\">\n\n <!-- Index Column -->\n <ng-container matColumnDef=\"index\">\n <th mat-header-cell *matHeaderCellDef> # </th>\n <td mat-cell *matCellDef=\"let loginHistory; let i = dataIndex\"> {{ i+1 }} </td>\n </ng-container>\n\n <ng-container matColumnDef=\"created_at\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header> Last Login</th>\n <td mat-cell *matCellDef=\"let loginHistory;\">\n {{loginHistory?.created_at | date:'medium' }}\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns;\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n </table>\n </div>\n\n </section>\n</div>\n",
6545
6692
  styles: [".scroll-container{max-height:800px;overflow-y:auto}"]
6546
6693
  },] }
6547
6694
  ];
@@ -7161,6 +7308,390 @@
7161
7308
  },] }
7162
7309
  ];
7163
7310
 
7311
+ var TechlifyFeatureService = /** @class */ (function () {
7312
+ function TechlifyFeatureService(dataManager) {
7313
+ this.dataManager = dataManager;
7314
+ }
7315
+ TechlifyFeatureService.prototype.getFeatures = function () {
7316
+ return this.dataManager.GET("api/features");
7317
+ };
7318
+ TechlifyFeatureService.prototype.disableFeature = function (id) {
7319
+ return this.dataManager.GET("api/feature/" + id + "/disable");
7320
+ };
7321
+ TechlifyFeatureService.prototype.enableFeature = function (id) {
7322
+ return this.dataManager.GET("api/feature/" + id + "/enable");
7323
+ };
7324
+ return TechlifyFeatureService;
7325
+ }());
7326
+ TechlifyFeatureService.ɵprov = i0.ɵɵdefineInjectable({ factory: function TechlifyFeatureService_Factory() { return new TechlifyFeatureService(i0.ɵɵinject(DataManager)); }, token: TechlifyFeatureService, providedIn: "root" });
7327
+ TechlifyFeatureService.decorators = [
7328
+ { type: i0.Injectable, args: [{
7329
+ providedIn: 'root'
7330
+ },] }
7331
+ ];
7332
+ TechlifyFeatureService.ctorParameters = function () { return [
7333
+ { type: DataManager }
7334
+ ]; };
7335
+
7336
+ exports.TechlifyFeatureListingComponent = /** @class */ (function () {
7337
+ function TechlifyFeatureListingComponent(dataManager, errorHandler, fb, alertService, dialog, storage, featureService) {
7338
+ this.dataManager = dataManager;
7339
+ this.errorHandler = errorHandler;
7340
+ this.fb = fb;
7341
+ this.alertService = alertService;
7342
+ this.dialog = dialog;
7343
+ this.storage = storage;
7344
+ this.featureService = featureService;
7345
+ this.features = [];
7346
+ this.displayedColumns = [
7347
+ 'index',
7348
+ 'feature',
7349
+ 'description',
7350
+ 'actions',
7351
+ ];
7352
+ this.dataSource = new table.MatTableDataSource();
7353
+ this.page = 1;
7354
+ this.perPage = 25;
7355
+ this.isWorking = false;
7356
+ this.filterFormGroup = this.fb.group({
7357
+ num_items: [""]
7358
+ });
7359
+ }
7360
+ TechlifyFeatureListingComponent.prototype.ngOnInit = function () {
7361
+ this.loadData();
7362
+ this.listenForChanges();
7363
+ };
7364
+ TechlifyFeatureListingComponent.prototype.listenForChanges = function () {
7365
+ var _this = this;
7366
+ this.filterFormGroup.valueChanges
7367
+ .pipe(operators.debounceTime(500), untilDestroy.untilDestroyed(this))
7368
+ .subscribe(function (changes) {
7369
+ _this.reload();
7370
+ });
7371
+ };
7372
+ TechlifyFeatureListingComponent.prototype.loadData = function () {
7373
+ return __awaiter(this, void 0, void 0, function () {
7374
+ var result, filter, error_1;
7375
+ return __generator(this, function (_a) {
7376
+ switch (_a.label) {
7377
+ case 0:
7378
+ _a.trys.push([0, 2, 3, 4]);
7379
+ this.isWorking = true;
7380
+ filter = this.filterFormGroup.value;
7381
+ filter.page = this.page;
7382
+ filter.perPage = this.perPage;
7383
+ return [4 /*yield*/, this.dataManager.GET("api/features", filter)];
7384
+ case 1:
7385
+ result = _a.sent();
7386
+ this.features = this.features.concat(result.data);
7387
+ this.dataSource = new table.MatTableDataSource(this.features);
7388
+ if (!this.storage.getItem('features')) {
7389
+ this.setStorage(this.features);
7390
+ }
7391
+ this.isWorking = false;
7392
+ return [3 /*break*/, 4];
7393
+ case 2:
7394
+ error_1 = _a.sent();
7395
+ this.errorHandler.handleError(error_1);
7396
+ return [3 /*break*/, 4];
7397
+ case 3:
7398
+ this.isWorking = false;
7399
+ return [7 /*endfinally*/];
7400
+ case 4: return [2 /*return*/];
7401
+ }
7402
+ });
7403
+ });
7404
+ };
7405
+ TechlifyFeatureListingComponent.prototype.toggeleFeature = function (element, feature) {
7406
+ return __awaiter(this, void 0, void 0, function () {
7407
+ var status, data, dialogRef;
7408
+ var _this = this;
7409
+ return __generator(this, function (_a) {
7410
+ status = element ? 'Off' : "On";
7411
+ dialogRef = this.dialog.open(ActionPopupComponent, {
7412
+ width: "400px",
7413
+ data: {
7414
+ title: "Turn this feature " + status + "?",
7415
+ message: "Would you like to turn " + feature.title + " feature " + status
7416
+ }
7417
+ });
7418
+ dialogRef.afterClosed().subscribe(function (result) { return __awaiter(_this, void 0, void 0, function () {
7419
+ var _a, error_2;
7420
+ return __generator(this, function (_b) {
7421
+ switch (_b.label) {
7422
+ case 0:
7423
+ if (!result) return [3 /*break*/, 9];
7424
+ _b.label = 1;
7425
+ case 1:
7426
+ _b.trys.push([1, 6, 7, 8]);
7427
+ if (!element) return [3 /*break*/, 3];
7428
+ return [4 /*yield*/, this.featureService.disableFeature(feature.id)];
7429
+ case 2:
7430
+ _a = _b.sent();
7431
+ return [3 /*break*/, 5];
7432
+ case 3: return [4 /*yield*/, this.featureService.enableFeature(feature.id)];
7433
+ case 4:
7434
+ _a = _b.sent();
7435
+ _b.label = 5;
7436
+ case 5:
7437
+ data = _a;
7438
+ return [3 /*break*/, 8];
7439
+ case 6:
7440
+ error_2 = _b.sent();
7441
+ this.errorHandler.handleError(error_2);
7442
+ return [3 /*break*/, 8];
7443
+ case 7:
7444
+ this.alertService.addAlert("You have just turned " + status + " the feature " + feature.title, 'success');
7445
+ this.reload();
7446
+ this.storage.removeItem('features');
7447
+ this.setStorage(this.features);
7448
+ this.isWorking = false;
7449
+ return [7 /*endfinally*/];
7450
+ case 8: return [3 /*break*/, 10];
7451
+ case 9:
7452
+ this.reload();
7453
+ _b.label = 10;
7454
+ case 10: return [2 /*return*/];
7455
+ }
7456
+ });
7457
+ }); });
7458
+ return [2 /*return*/];
7459
+ });
7460
+ });
7461
+ };
7462
+ TechlifyFeatureListingComponent.prototype.setStorage = function (features) {
7463
+ var e_1, _a;
7464
+ var localFeatures = [];
7465
+ try {
7466
+ for (var features_1 = __values(features), features_1_1 = features_1.next(); !features_1_1.done; features_1_1 = features_1.next()) {
7467
+ var feature = features_1_1.value;
7468
+ if (!feature.client_feature) {
7469
+ if (feature.is_enabled_default) {
7470
+ localFeatures.push(feature.code);
7471
+ }
7472
+ }
7473
+ else {
7474
+ if (feature.client_feature.is_enabled) {
7475
+ localFeatures.push(feature.code);
7476
+ }
7477
+ }
7478
+ }
7479
+ }
7480
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
7481
+ finally {
7482
+ try {
7483
+ if (features_1_1 && !features_1_1.done && (_a = features_1.return)) _a.call(features_1);
7484
+ }
7485
+ finally { if (e_1) throw e_1.error; }
7486
+ }
7487
+ this.storage.setItem("features", localFeatures);
7488
+ };
7489
+ TechlifyFeatureListingComponent.prototype.reload = function () {
7490
+ this.features = [];
7491
+ this.page = 1;
7492
+ if (!this.isWorking) {
7493
+ this.loadData();
7494
+ }
7495
+ };
7496
+ TechlifyFeatureListingComponent.prototype.onScroll = function () {
7497
+ if (!this.isWorking && this.page < this.lastPage) {
7498
+ this.page += 1;
7499
+ this.loadData();
7500
+ }
7501
+ };
7502
+ TechlifyFeatureListingComponent.prototype.sortColumn = function (event) {
7503
+ var direction = event.direction.toString().toUpperCase();
7504
+ this.assignFilter(event.active, direction);
7505
+ this.reload();
7506
+ };
7507
+ TechlifyFeatureListingComponent.prototype.assignFilter = function (column, direction) {
7508
+ switch (column) {
7509
+ case 'name': {
7510
+ return this.filterFormGroup
7511
+ .get('sort_by')
7512
+ .setValue('first_name|' + direction);
7513
+ }
7514
+ case 'added_on': {
7515
+ return this.filterFormGroup
7516
+ .get('sort_by')
7517
+ .setValue('created_at|' + direction);
7518
+ }
7519
+ }
7520
+ };
7521
+ return TechlifyFeatureListingComponent;
7522
+ }());
7523
+ exports.TechlifyFeatureListingComponent.decorators = [
7524
+ { type: i0.Component, args: [{
7525
+ selector: 'app-techlify-listing-feature',
7526
+ template: "<div fxLayout=\"column\" fxLayoutGap=\"3rem\" class=\"p-3\">\n <div fxLayout=\"column\" fxLayoutAlign=\"center center\" class=\"primary-color mt-3\">\n <h3>Features Configuration</h3>\n <mat-hint>\n <i> Here you can specify which optional features you'd like to have available to your team </i>\n </mat-hint>\n </div>\n\n\n <div>\n <mat-card>\n <mat-card-content fxlayout=\"column\" style=\"overflow: auto; height: 700px\" class=\"classifications-card\">\n <table mat-table [dataSource]=\"dataSource\" class=\"mat-elevation-z8 w-100\" matSort multiTemplateDataRows\n (matSortChange)=\"sortColumn($event)\" infiniteScroll [infiniteScrollDistance]=\"2\" [infiniteScrollThrottle]=\"50\"\n (scrolled)=\"onScroll()\" [fromRoot]=\"true\" [infiniteScrollContainer]=\"'.classifications-card'\">\n <!-- Index Column -->\n <ng-container matColumnDef=\"index\">\n <th mat-header-cell *matHeaderCellDef>#</th>\n <td mat-cell *matCellDef=\"let element; let i = dataIndex\">\n {{ i + 1 }}\n </td>\n </ng-container>\n\n <!-- Title Column -->\n <ng-container matColumnDef=\"feature\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header disableClear>\n Feature\n </th>\n <td mat-cell *matCellDef=\"let element\">{{ element?.title }}</td>\n </ng-container>\n\n <!-- Description Column -->\n <ng-container matColumnDef=\"description\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header disableClear>\n Descriptions\n </th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element?.description }}\n </td>\n </ng-container>\n\n <!-- Actions Column -->\n <ng-container matColumnDef=\"actions\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header disableClear>\n Actions\n </th>\n <td mat-cell *matCellDef=\"let element\">\n <div *ngIf=\"!element?.client_feature\">\n <app-on-off-switch [value]=\"element?.is_enabled_default\"\n (click)=\"toggeleFeature(element?.is_enabled_default, element)\"></app-on-off-switch>\n </div>\n <div *ngIf=\"element?.client_feature\">\n <app-on-off-switch [value]=\"element?.client_feature?.is_enabled\"\n (click)=\"toggeleFeature(element?.client_feature?.is_enabled, element)\"></app-on-off-switch>\n </div>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns\"></tr>\n </table>\n </mat-card-content>\n </mat-card>\n </div>\n</div>\n",
7527
+ styles: [""]
7528
+ },] }
7529
+ ];
7530
+ exports.TechlifyFeatureListingComponent.ctorParameters = function () { return [
7531
+ { type: DataManager },
7532
+ { type: ErrorHandlerService },
7533
+ { type: forms.FormBuilder },
7534
+ { type: AlertService },
7535
+ { type: dialog.MatDialog },
7536
+ { type: StorageService },
7537
+ { type: TechlifyFeatureService }
7538
+ ]; };
7539
+ exports.TechlifyFeatureListingComponent = __decorate([
7540
+ untilDestroy.UntilDestroy()
7541
+ ], exports.TechlifyFeatureListingComponent);
7542
+
7543
+ var routes$n = [
7544
+ {
7545
+ path: '',
7546
+ component: exports.TechlifyFeatureListingComponent,
7547
+ canActivate: [AuthenticationGuard]
7548
+ },
7549
+ ];
7550
+ var TechlifyFeatureRoutes = i1$2.RouterModule.forChild(routes$n);
7551
+
7552
+ var OnOffSwitchComponent = /** @class */ (function () {
7553
+ function OnOffSwitchComponent(fb) {
7554
+ this.fb = fb;
7555
+ this.slideToggle = this.fb.group({
7556
+ toggle: [""]
7557
+ });
7558
+ }
7559
+ OnOffSwitchComponent.prototype.ngOnInit = function () {
7560
+ this.slideToggle.get('toggle').setValue(this.value);
7561
+ };
7562
+ return OnOffSwitchComponent;
7563
+ }());
7564
+ OnOffSwitchComponent.decorators = [
7565
+ { type: i0.Component, args: [{
7566
+ selector: 'app-on-off-switch',
7567
+ template: "<form [formGroup]=\"slideToggle\">\n <mat-slide-toggle formControlName=\"toggle\">On / Off\n </mat-slide-toggle>\n</form>\n",
7568
+ styles: [""]
7569
+ },] }
7570
+ ];
7571
+ OnOffSwitchComponent.ctorParameters = function () { return [
7572
+ { type: forms.FormBuilder }
7573
+ ]; };
7574
+ OnOffSwitchComponent.propDecorators = {
7575
+ value: [{ type: i0.Input }]
7576
+ };
7577
+
7578
+ var TechlifyFeatureEnabledDirective = /** @class */ (function () {
7579
+ function TechlifyFeatureEnabledDirective(el, featureService, errorHandler, storage) {
7580
+ this.el = el;
7581
+ this.featureService = featureService;
7582
+ this.errorHandler = errorHandler;
7583
+ this.storage = storage;
7584
+ this.localFeatures = [];
7585
+ }
7586
+ TechlifyFeatureEnabledDirective.prototype.ngOnInit = function () {
7587
+ if (!this.storage.getItem('features')) {
7588
+ this.getFeatures();
7589
+ }
7590
+ else {
7591
+ this.checkForFeatureEnabled();
7592
+ }
7593
+ };
7594
+ TechlifyFeatureEnabledDirective.prototype.getFeatures = function () {
7595
+ return __awaiter(this, void 0, void 0, function () {
7596
+ var features, _a, _b, feature, error_1;
7597
+ var e_1, _c;
7598
+ return __generator(this, function (_d) {
7599
+ switch (_d.label) {
7600
+ case 0:
7601
+ _d.trys.push([0, 2, 3, 4]);
7602
+ return [4 /*yield*/, this.featureService.getFeatures()];
7603
+ case 1:
7604
+ features = _d.sent();
7605
+ try {
7606
+ for (_a = __values(features.data), _b = _a.next(); !_b.done; _b = _a.next()) {
7607
+ feature = _b.value;
7608
+ if (!feature.client_feature) {
7609
+ if (feature.is_enabled_default) {
7610
+ this.localFeatures.push(feature.code);
7611
+ }
7612
+ }
7613
+ else {
7614
+ if (feature.client_feature.is_enabled) {
7615
+ this.localFeatures.push(feature.code);
7616
+ }
7617
+ }
7618
+ }
7619
+ }
7620
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
7621
+ finally {
7622
+ try {
7623
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
7624
+ }
7625
+ finally { if (e_1) throw e_1.error; }
7626
+ }
7627
+ this.storage.setItem("features", this.localFeatures);
7628
+ return [3 /*break*/, 4];
7629
+ case 2:
7630
+ error_1 = _d.sent();
7631
+ this.errorHandler.handleError(error_1);
7632
+ return [3 /*break*/, 4];
7633
+ case 3:
7634
+ this.checkForFeatureEnabled();
7635
+ return [7 /*endfinally*/];
7636
+ case 4: return [2 /*return*/];
7637
+ }
7638
+ });
7639
+ });
7640
+ };
7641
+ TechlifyFeatureEnabledDirective.prototype.checkForFeatureEnabled = function () {
7642
+ try {
7643
+ var features = this.storage.getItem('features');
7644
+ var features_split = features.split(',');
7645
+ if (features_split.includes(this.enabledFeature)) {
7646
+ this.el.nativeElement.style.display = "show";
7647
+ }
7648
+ else {
7649
+ this.el.nativeElement.remove();
7650
+ }
7651
+ }
7652
+ catch (error) {
7653
+ this.errorHandler.handleError(error);
7654
+ }
7655
+ };
7656
+ return TechlifyFeatureEnabledDirective;
7657
+ }());
7658
+ TechlifyFeatureEnabledDirective.decorators = [
7659
+ { type: i0.Directive, args: [{
7660
+ selector: '[techlifyFeatureEnabled]'
7661
+ },] }
7662
+ ];
7663
+ TechlifyFeatureEnabledDirective.ctorParameters = function () { return [
7664
+ { type: i0.ElementRef },
7665
+ { type: TechlifyFeatureService },
7666
+ { type: ErrorHandlerService },
7667
+ { type: StorageService }
7668
+ ]; };
7669
+ TechlifyFeatureEnabledDirective.propDecorators = {
7670
+ enabledFeature: [{ type: i0.Input, args: ['techlifyFeatureEnabled',] }]
7671
+ };
7672
+
7673
+ var TechlifyFeatureModule = /** @class */ (function () {
7674
+ function TechlifyFeatureModule() {
7675
+ }
7676
+ return TechlifyFeatureModule;
7677
+ }());
7678
+ TechlifyFeatureModule.decorators = [
7679
+ { type: i0.NgModule, args: [{
7680
+ imports: [
7681
+ common.CommonModule,
7682
+ MaterialModule,
7683
+ flexLayout.FlexLayoutModule,
7684
+ TechlifyFeatureRoutes,
7685
+ slideToggle.MatSlideToggleModule,
7686
+ forms.FormsModule,
7687
+ forms.ReactiveFormsModule,
7688
+ ngxInfiniteScroll.InfiniteScrollModule
7689
+ ],
7690
+ declarations: [exports.TechlifyFeatureListingComponent, OnOffSwitchComponent, TechlifyFeatureEnabledDirective],
7691
+ exports: [exports.TechlifyFeatureListingComponent, TechlifyFeatureEnabledDirective]
7692
+ },] }
7693
+ ];
7694
+
7164
7695
  /*
7165
7696
  * Public API Surface of ngx-techlify-core
7166
7697
  */
@@ -7193,6 +7724,7 @@
7193
7724
  exports.AuthenticationGuard = AuthenticationGuard;
7194
7725
  exports.AuthenticationService = AuthenticationService;
7195
7726
  exports.CacheInterceptor = CacheInterceptor;
7727
+ exports.CommentFormComponent = CommentFormComponent;
7196
7728
  exports.ConfigService = ConfigService;
7197
7729
  exports.CoreModule = CoreModule;
7198
7730
  exports.CredentialsService = CredentialsService;
@@ -7274,6 +7806,9 @@
7274
7806
  exports.StorageService = StorageService;
7275
7807
  exports.SuccessSnackComponent = SuccessSnackComponent;
7276
7808
  exports.TechlifyConfig = TechlifyConfig;
7809
+ exports.TechlifyFeatureEnabledDirective = TechlifyFeatureEnabledDirective;
7810
+ exports.TechlifyFeatureModule = TechlifyFeatureModule;
7811
+ exports.TechlifyFeatureRoutes = TechlifyFeatureRoutes;
7277
7812
  exports.TechlifyTaggerTagFormConfigModel = TechlifyTaggerTagFormConfigModel;
7278
7813
  exports.TechlifyTaggerTagFormFieldModule = TechlifyTaggerTagFormFieldModule;
7279
7814
  exports.TechlifyTaggerTagSelectorModule = TechlifyTaggerTagSelectorModule;
@@ -7306,7 +7841,14 @@
7306
7841
  exports.ɵbt = UpdateViewModule;
7307
7842
  exports.ɵbu = UpdateViewComponent;
7308
7843
  exports.ɵbv = DataManager;
7844
+ exports.ɵbw = DataManager;
7845
+ exports.ɵbx = ErrorHandlerService;
7846
+ exports.ɵby = AlertService;
7847
+ exports.ɵbz = StorageService;
7309
7848
  exports.ɵc = ErrorSnackComponent;
7849
+ exports.ɵca = TechlifyFeatureService;
7850
+ exports.ɵcb = AuthenticationGuard;
7851
+ exports.ɵcc = OnOffSwitchComponent;
7310
7852
  exports.ɵd = HTTP_DYNAMIC_INTERCEPTORS;
7311
7853
  exports.ɵe = HttpService;
7312
7854
  exports.ɵf = RouteReusableStrategy;