add licence report service
This commit is contained in:
parent
65b2f25844
commit
09cf5b795a
@ -42,6 +42,7 @@ import { TrashScreenComponent } from './screens/trash/trash-screen.component';
|
|||||||
import { AuditService } from './services/audit.service';
|
import { AuditService } from './services/audit.service';
|
||||||
import { DigitalSignatureService } from './services/digital-signature.service';
|
import { DigitalSignatureService } from './services/digital-signature.service';
|
||||||
import { BaseAdminScreenComponent } from './base-admin-screen/base-admin-screen.component';
|
import { BaseAdminScreenComponent } from './base-admin-screen/base-admin-screen.component';
|
||||||
|
import { LicenseReportService } from './services/licence-report.service';
|
||||||
|
|
||||||
const dialogs = [
|
const dialogs = [
|
||||||
AddEditDossierTemplateDialogComponent,
|
AddEditDossierTemplateDialogComponent,
|
||||||
@ -92,7 +93,7 @@ const components = [
|
|||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [...components],
|
declarations: [...components],
|
||||||
providers: [AdminDialogService, AuditService, DigitalSignatureService],
|
providers: [AdminDialogService, AuditService, DigitalSignatureService, LicenseReportService],
|
||||||
imports: [CommonModule, SharedModule, AdminRoutingModule, NgxChartsModule, ColorPickerModule, MonacoEditorModule],
|
imports: [CommonModule, SharedModule, AdminRoutingModule, NgxChartsModule, ColorPickerModule, MonacoEditorModule],
|
||||||
})
|
})
|
||||||
export class AdminModule {}
|
export class AdminModule {}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { LicenseReport, LicenseReportControllerService } from '@redaction/red-ui-http';
|
import { LicenseReport } from '@redaction/red-ui-http';
|
||||||
import { ConfigService } from '@services/config.service';
|
import { ConfigService } from '@services/config.service';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
@ -7,6 +7,7 @@ import { ButtonConfig, IconButtonTypes, LoadingService } from '@iqser/common-ui'
|
|||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { UserService } from '@services/user.service';
|
import { UserService } from '@services/user.service';
|
||||||
import { RouterHistoryService } from '@services/router-history.service';
|
import { RouterHistoryService } from '@services/router-history.service';
|
||||||
|
import { LicenseReportService } from '../../services/licence-report.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-license-information-screen',
|
selector: 'redaction-license-information-screen',
|
||||||
@ -47,7 +48,7 @@ export class LicenseInformationScreenComponent implements OnInit {
|
|||||||
private readonly _loadingService: LoadingService,
|
private readonly _loadingService: LoadingService,
|
||||||
readonly routerHistoryService: RouterHistoryService,
|
readonly routerHistoryService: RouterHistoryService,
|
||||||
private readonly _translateService: TranslateService,
|
private readonly _translateService: TranslateService,
|
||||||
private readonly _licenseReportController: LicenseReportControllerService,
|
private readonly _licenseReportService: LicenseReportService,
|
||||||
) {
|
) {
|
||||||
_loadingService.start();
|
_loadingService.start();
|
||||||
}
|
}
|
||||||
@ -68,15 +69,15 @@ export class LicenseInformationScreenComponent implements OnInit {
|
|||||||
endDate: endDate.toDate(),
|
endDate: endDate.toDate(),
|
||||||
};
|
};
|
||||||
const promises = [
|
const promises = [
|
||||||
this._licenseReportController.licenseReport(currentConfig).toPromise(),
|
this._licenseReportService.licenseReport(currentConfig).toPromise(),
|
||||||
this._licenseReportController.licenseReport({}).toPromise(),
|
this._licenseReportService.licenseReport({}).toPromise(),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (endDate.isBefore(moment())) {
|
if (endDate.isBefore(moment())) {
|
||||||
const unlicensedConfig = {
|
const unlicensedConfig = {
|
||||||
startDate: endDate.toDate(),
|
startDate: endDate.toDate(),
|
||||||
};
|
};
|
||||||
promises.push(this._licenseReportController.licenseReport(unlicensedConfig).toPromise());
|
promises.push(this._licenseReportService.licenseReport(unlicensedConfig).toPromise());
|
||||||
}
|
}
|
||||||
|
|
||||||
Promise.all(promises).then(reports => {
|
Promise.all(promises).then(reports => {
|
||||||
@ -131,7 +132,7 @@ export class LicenseInformationScreenComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
promises.push(
|
promises.push(
|
||||||
this._licenseReportController
|
this._licenseReportService
|
||||||
.licenseReport({
|
.licenseReport({
|
||||||
startDate: moment(`01-${m + 1}-${y}`, 'DD-MM-YYYY').toDate(),
|
startDate: moment(`01-${m + 1}-${y}`, 'DD-MM-YYYY').toDate(),
|
||||||
endDate: moment(`01-${nm + 1}-${ny}`, 'DD-MM-YYYY').toDate(),
|
endDate: moment(`01-${nm + 1}-${ny}`, 'DD-MM-YYYY').toDate(),
|
||||||
|
|||||||
@ -0,0 +1,24 @@
|
|||||||
|
import { Injectable, Injector } from '@angular/core';
|
||||||
|
import { GenericService, QueryParam, RequiredParam, Validate } from '@iqser/common-ui';
|
||||||
|
import { LicenseReport, LicenseReportRequest } from '@redaction/red-ui-http';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class LicenseReportService extends GenericService<LicenseReport> {
|
||||||
|
constructor(protected readonly _injector: Injector) {
|
||||||
|
super(_injector, 'report');
|
||||||
|
}
|
||||||
|
|
||||||
|
@Validate()
|
||||||
|
licenseReport(@RequiredParam() body: LicenseReportRequest, limit?: number, offset?: number) {
|
||||||
|
const queryParams: QueryParam[] = [];
|
||||||
|
if (limit) {
|
||||||
|
queryParams.push({ key: 'limit', value: limit });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (offset) {
|
||||||
|
queryParams.push({ key: 'offset', value: offset });
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._post(body, `${this._defaultModelPath}/license`, queryParams);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,7 +1,6 @@
|
|||||||
import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
|
import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
|
||||||
import { Configuration } from './configuration';
|
import { Configuration } from './configuration';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { LicenseReportControllerService } from './api/licenseReportController.service';
|
|
||||||
import { ManualRedactionControllerService } from './api/manualRedactionController.service';
|
import { ManualRedactionControllerService } from './api/manualRedactionController.service';
|
||||||
import { ReanalysisControllerService } from './api/reanalysisController.service';
|
import { ReanalysisControllerService } from './api/reanalysisController.service';
|
||||||
import { RedactionLogControllerService } from './api/redactionLogController.service';
|
import { RedactionLogControllerService } from './api/redactionLogController.service';
|
||||||
@ -19,7 +18,6 @@ import { NotificationControllerService } from './api/notificationController.serv
|
|||||||
declarations: [],
|
declarations: [],
|
||||||
exports: [],
|
exports: [],
|
||||||
providers: [
|
providers: [
|
||||||
LicenseReportControllerService,
|
|
||||||
ManualRedactionControllerService,
|
ManualRedactionControllerService,
|
||||||
ReanalysisControllerService,
|
ReanalysisControllerService,
|
||||||
RedactionLogControllerService,
|
RedactionLogControllerService,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user