myrtex-mf-competition 1.0.77 → 1.0.79
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/README.md +14 -14
- package/esm2020/lib/modules/competition-header/competition-header.module.mjs +79 -0
- package/esm2020/lib/modules/competition-header/components/competition-header.component.mjs +495 -0
- package/esm2020/lib/modules/competition-header/constants.mjs +2 -0
- package/esm2020/lib/modules/competition-header/directives/competition-header-custom-buttons.directive.mjs +16 -0
- package/esm2020/lib/modules/competition-header/directives/index.mjs +2 -0
- package/esm2020/lib/modules/competition-header/index.mjs +5 -0
- package/esm2020/lib/modules/competition-header/models/competition-header-version.model.mjs +2 -0
- package/esm2020/lib/modules/competition-header/models/competition-rejection.model.mjs +2 -0
- package/esm2020/lib/modules/competition-header/models/competition-status.model.mjs +2 -0
- package/esm2020/lib/modules/competition-header/models/competition-version.model.mjs +2 -0
- package/esm2020/lib/modules/competition-header/models/eb-links.model.mjs +2 -0
- package/esm2020/lib/modules/competition-header/models/index.mjs +2 -0
- package/esm2020/lib/modules/competition-header/services/competition-header.service.mjs +40 -0
- package/esm2020/lib/modules/competition-header/services/settings.service.mjs +20 -0
- package/esm2020/lib/modules/competition-header/store/competition-header.actions.mjs +37 -0
- package/esm2020/lib/modules/competition-header/store/competition-header.effects.mjs +96 -0
- package/esm2020/lib/modules/competition-header/store/competition-header.reducers.mjs +31 -0
- package/esm2020/lib/modules/competition-header/store/competition-header.selector.mjs +14 -0
- package/esm2020/lib/modules/competition-header/store/competition-header.state.mjs +9 -0
- package/esm2020/myrtex-mf-competition.mjs +5 -0
- package/esm2020/public-api.mjs +6 -0
- package/fesm2015/myrtex-mf-competition.mjs +814 -0
- package/fesm2015/myrtex-mf-competition.mjs.map +1 -0
- package/fesm2020/myrtex-mf-competition.mjs +807 -0
- package/fesm2020/myrtex-mf-competition.mjs.map +1 -0
- package/lib/modules/competition-header/competition-header.module.d.ts +16 -0
- package/lib/modules/competition-header/components/competition-header.component.d.ts +89 -0
- package/lib/modules/competition-header/constants.d.ts +1 -0
- package/lib/modules/competition-header/directives/competition-header-custom-buttons.directive.d.ts +8 -0
- package/lib/modules/competition-header/directives/index.d.ts +1 -0
- package/{src/lib/modules/competition-header/index.ts → lib/modules/competition-header/index.d.ts} +1 -1
- package/lib/modules/competition-header/models/competition-header-version.model.d.ts +11 -0
- package/lib/modules/competition-header/models/competition-rejection.model.d.ts +5 -0
- package/{src/lib/modules/competition-header/models/competition-status.model.ts → lib/modules/competition-header/models/competition-status.model.d.ts} +3 -4
- package/lib/modules/competition-header/models/competition-version.model.d.ts +11 -0
- package/{src/lib/modules/competition-header/models/eb-links.model.ts → lib/modules/competition-header/models/eb-links.model.d.ts} +1 -1
- package/lib/modules/competition-header/services/competition-header.service.d.ts +20 -0
- package/lib/modules/competition-header/services/settings.service.d.ts +14 -0
- package/lib/modules/competition-header/store/competition-header.actions.d.ts +78 -0
- package/lib/modules/competition-header/store/competition-header.effects.d.ts +42 -0
- package/lib/modules/competition-header/store/competition-header.reducers.d.ts +3 -0
- package/lib/modules/competition-header/store/competition-header.selector.d.ts +7 -0
- package/lib/modules/competition-header/store/competition-header.state.d.ts +12 -0
- package/myrtex-mf-competition.d.ts +5 -0
- package/package.json +33 -13
- package/{src/public-api.ts → public-api.d.ts} +0 -4
- package/.browserslistrc +0 -16
- package/karma.conf.js +0 -44
- package/ng-package.json +0 -7
- package/src/lib/modules/competition-header/competition-header.module.ts +0 -45
- package/src/lib/modules/competition-header/components/competition-header.component.html +0 -164
- package/src/lib/modules/competition-header/components/competition-header.component.ts +0 -584
- package/src/lib/modules/competition-header/constants.ts +0 -1
- package/src/lib/modules/competition-header/directives/competition-header-custom-buttons.directive.ts +0 -10
- package/src/lib/modules/competition-header/directives/index.ts +0 -1
- package/src/lib/modules/competition-header/models/competition-header-version.model.ts +0 -13
- package/src/lib/modules/competition-header/models/competition-rejection.model.ts +0 -5
- package/src/lib/modules/competition-header/models/competition-version.model.ts +0 -12
- package/src/lib/modules/competition-header/services/competition-header.service.ts +0 -47
- package/src/lib/modules/competition-header/services/settings.service.ts +0 -17
- package/src/lib/modules/competition-header/store/competition-header.actions.ts +0 -102
- package/src/lib/modules/competition-header/store/competition-header.effects.ts +0 -193
- package/src/lib/modules/competition-header/store/competition-header.reducers.ts +0 -39
- package/src/lib/modules/competition-header/store/competition-header.selector.ts +0 -45
- package/src/lib/modules/competition-header/store/competition-header.state.ts +0 -21
- package/src/test.ts +0 -27
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
- /package/{src/lib/modules/competition-header/models/index.ts → lib/modules/competition-header/models/index.d.ts} +0 -0
|
@@ -1,584 +0,0 @@
|
|
|
1
|
-
import { Component, ContentChild, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
|
|
2
|
-
import { select, Store } from '@ngrx/store';
|
|
3
|
-
import { CompetitionVersionModel } from '../models/competition-version.model';
|
|
4
|
-
import {
|
|
5
|
-
CompetitionModeEnum,
|
|
6
|
-
CompetitionStatusEnum,
|
|
7
|
-
CompetitionStatusEnumLabel,
|
|
8
|
-
DialogColor,
|
|
9
|
-
DialogType,
|
|
10
|
-
AlertService,
|
|
11
|
-
UnSubscriber,
|
|
12
|
-
selectCompetitionConfig,
|
|
13
|
-
selectCompetitionLabel,
|
|
14
|
-
CompetitionConfigModel,
|
|
15
|
-
CancelCompetitionTypeEnum,
|
|
16
|
-
CompetitionVersionStatusEnum,
|
|
17
|
-
CompetitionVersionStatusEnumLabel,
|
|
18
|
-
CompetitionVersionStatusGrouppingLabel,
|
|
19
|
-
CompetitionTypeEnum
|
|
20
|
-
} from 'myrtex-mf-ui-composite';
|
|
21
|
-
import {
|
|
22
|
-
activateCompetition,
|
|
23
|
-
cancelCompetition,
|
|
24
|
-
cancelCompetitionWithValidation,
|
|
25
|
-
competitionVersionChangeStatus,
|
|
26
|
-
completeCompetition,
|
|
27
|
-
createCompetitionVersion,
|
|
28
|
-
deleteCompetitionVersion,
|
|
29
|
-
loadCompetitionHeader,
|
|
30
|
-
pauseCompetition,
|
|
31
|
-
selectCompetitionVersion
|
|
32
|
-
} from '../store/competition-header.actions';
|
|
33
|
-
import { CompetitionStatusModel } from '../models/competition-status.model';
|
|
34
|
-
import {
|
|
35
|
-
selectActivityId,
|
|
36
|
-
selectCompetitionSelectedVersionId,
|
|
37
|
-
selectCompetitionStatus,
|
|
38
|
-
selectCompetitionType,
|
|
39
|
-
selectCompetitionVersions,
|
|
40
|
-
selectManualVersionStatusChanged
|
|
41
|
-
} from '../store/competition-header.selector';
|
|
42
|
-
import { CompetitionHeaderCustomButtonsDirective } from '../directives/competition-header-custom-buttons.directive';
|
|
43
|
-
import { CompetitionRejectionModel } from '../models';
|
|
44
|
-
import { SignService } from 'myrtex-mf-signer';
|
|
45
|
-
import { SettingsService } from '../services/settings.service';
|
|
46
|
-
import { EBLinksModel } from '../models/eb-links.model';
|
|
47
|
-
|
|
48
|
-
export declare type validateVersionFn = ((param: string, onValidated: () => void) => void);
|
|
49
|
-
|
|
50
|
-
declare global {
|
|
51
|
-
interface Window {
|
|
52
|
-
CryptoInterceptor: any;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
@Component({
|
|
57
|
-
selector: 'mrx-competition-header',
|
|
58
|
-
templateUrl: './competition-header.component.html'
|
|
59
|
-
})
|
|
60
|
-
export class CompetitionHeaderComponent extends UnSubscriber implements OnInit, OnDestroy {
|
|
61
|
-
|
|
62
|
-
@ContentChild(CompetitionHeaderCustomButtonsDirective)
|
|
63
|
-
public customButtonsTemplate!: CompetitionHeaderCustomButtonsDirective;
|
|
64
|
-
|
|
65
|
-
@Input()
|
|
66
|
-
public canChangeStatus = true;
|
|
67
|
-
|
|
68
|
-
@Input()
|
|
69
|
-
public canCreateVersionOnActivityPeriod = true;
|
|
70
|
-
|
|
71
|
-
@Input()
|
|
72
|
-
public canValidateVersionOnActivityPeriod = true;
|
|
73
|
-
|
|
74
|
-
@Input()
|
|
75
|
-
public canActivateVersionOnActivityPeriod = true;
|
|
76
|
-
|
|
77
|
-
@Input()
|
|
78
|
-
public validateVersionAction: undefined | validateVersionFn = undefined;
|
|
79
|
-
|
|
80
|
-
@Input()
|
|
81
|
-
public validateManagementAccess: ((() => boolean) | undefined) = undefined;
|
|
82
|
-
|
|
83
|
-
@Input()
|
|
84
|
-
public validatePiblicationAccess: ((() => boolean) | undefined) = undefined;
|
|
85
|
-
|
|
86
|
-
@Output()
|
|
87
|
-
public selectedCompetitionVersionInfo = new EventEmitter<CompetitionVersionModel>();
|
|
88
|
-
|
|
89
|
-
public competition: CompetitionStatusModel | undefined;
|
|
90
|
-
public versions: CompetitionVersionModel[] = [];
|
|
91
|
-
public selected: CompetitionVersionModel | undefined;
|
|
92
|
-
public selectedVersion = '';
|
|
93
|
-
public competitionStatusEnum = CompetitionStatusEnum;
|
|
94
|
-
public cancelCompetitionTypeEnum = CancelCompetitionTypeEnum;
|
|
95
|
-
public competitionVersionStatusEnum = CompetitionVersionStatusEnum;
|
|
96
|
-
public competitionLabel = '';
|
|
97
|
-
public showCancelCompetitionButton = false;
|
|
98
|
-
public cancelCompetitionButtonLabel = 'Отменить отбор';
|
|
99
|
-
public competitionConfig: CompetitionConfigModel | undefined;
|
|
100
|
-
public showCompleteCompetitionButton = false;
|
|
101
|
-
public restoreButtonName = 'Возобновить';
|
|
102
|
-
private _signCallback: any;
|
|
103
|
-
private _activityId: string | undefined;
|
|
104
|
-
private _ebLinksModel: EBLinksModel | undefined;
|
|
105
|
-
private _competitionType: CompetitionTypeEnum | undefined;
|
|
106
|
-
|
|
107
|
-
constructor(private signService: SignService,
|
|
108
|
-
private store: Store,
|
|
109
|
-
private alertService: AlertService,
|
|
110
|
-
private settingsService: SettingsService) {
|
|
111
|
-
super();
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
public get competitionAggregateStatusEnumLabel() {
|
|
115
|
-
if (this.versions && this.versions.length == 1 && this.selected
|
|
116
|
-
&& this.selected.status !== CompetitionVersionStatusEnum.Active) {
|
|
117
|
-
return CompetitionVersionStatusEnumLabel[this.selected.status];
|
|
118
|
-
}
|
|
119
|
-
return this.competition ? CompetitionStatusEnumLabel[this.competition.status] : '';
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
public get competitionAggregateStatusCssClass(): any {
|
|
123
|
-
if (this.versions && this.versions.length == 1 && this.selected
|
|
124
|
-
&& (this.competition?.status || CompetitionStatusEnum.New) <= CompetitionStatusEnum.Active) {
|
|
125
|
-
return {
|
|
126
|
-
'': this.selected?.status !== CompetitionVersionStatusEnum.Active,
|
|
127
|
-
'color-green': this.selected?.status === CompetitionVersionStatusEnum.Active,
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return {
|
|
131
|
-
'': this.competition?.status === CompetitionStatusEnum.New
|
|
132
|
-
|| this.competition?.status !== CompetitionStatusEnum.Completed,
|
|
133
|
-
'color-green': this.competition?.status === CompetitionStatusEnum.Active,
|
|
134
|
-
'color-orange': this.competition?.status === CompetitionStatusEnum.Staying,
|
|
135
|
-
'color-red': this.competition?.status === CompetitionStatusEnum.Canceled
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
public get canCreateVersion(): boolean {
|
|
140
|
-
if (!this.canCreateVersionOnActivityPeriod) {
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
if (this.validateManagementAccess === undefined) {
|
|
144
|
-
return this.isLastVersion && this.selected?.status === CompetitionVersionStatusEnum.Active &&
|
|
145
|
-
this.competition !== undefined && this.competition.mode > CompetitionModeEnum.Base
|
|
146
|
-
&& (
|
|
147
|
-
this.competition.status === CompetitionStatusEnum.Active ||
|
|
148
|
-
this.competition.status === CompetitionStatusEnum.Staying);
|
|
149
|
-
} else {
|
|
150
|
-
return this.isLastVersion && this.selected?.status === CompetitionVersionStatusEnum.Active &&
|
|
151
|
-
this.competition !== undefined && this.competition.mode > CompetitionModeEnum.Base
|
|
152
|
-
&& (
|
|
153
|
-
this.competition.status === CompetitionStatusEnum.Active ||
|
|
154
|
-
this.competition.status === CompetitionStatusEnum.Staying) &&
|
|
155
|
-
this.validateManagementAccess();
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
public get canDeleteVersion(): boolean {
|
|
160
|
-
if (this.validateManagementAccess === undefined) {
|
|
161
|
-
return this.selected?.status === this.competitionVersionStatusEnum.Draft
|
|
162
|
-
&& this.versions
|
|
163
|
-
&& this.versions.length > 1;
|
|
164
|
-
} else {
|
|
165
|
-
return this.selected?.status === this.competitionVersionStatusEnum.Draft
|
|
166
|
-
&& this.versions
|
|
167
|
-
&& this.versions.length > 1
|
|
168
|
-
&& this.validateManagementAccess();
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
public get canActivateVersion(): boolean {
|
|
173
|
-
if (!this.canActivateVersionOnActivityPeriod) {
|
|
174
|
-
return false;
|
|
175
|
-
}
|
|
176
|
-
if (this.validatePiblicationAccess === undefined) {
|
|
177
|
-
return (this.selected?.status === CompetitionVersionStatusEnum.Draft &&
|
|
178
|
-
this.competition?.mode !== CompetitionModeEnum.VersionedExtended) ||
|
|
179
|
-
((this.selected?.status === CompetitionVersionStatusEnum.Confirmed ||
|
|
180
|
-
this.selected?.status === CompetitionVersionStatusEnum.Validation) &&
|
|
181
|
-
this.competition?.mode === CompetitionModeEnum.VersionedExtended);
|
|
182
|
-
} else {
|
|
183
|
-
return (this.selected?.status === CompetitionVersionStatusEnum.Draft &&
|
|
184
|
-
this.competition?.mode !== CompetitionModeEnum.VersionedExtended) ||
|
|
185
|
-
((this.selected?.status === CompetitionVersionStatusEnum.Confirmed ||
|
|
186
|
-
this.selected?.status === CompetitionVersionStatusEnum.Validation) &&
|
|
187
|
-
this.competition?.mode === CompetitionModeEnum.VersionedExtended) &&
|
|
188
|
-
this.validatePiblicationAccess();
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
public get activateVersionDisabled(): boolean | undefined {
|
|
193
|
-
if (this.validatePiblicationAccess === undefined) {
|
|
194
|
-
return (!this.canChangeStatus ||
|
|
195
|
-
((this.selected?.status !== CompetitionVersionStatusEnum.Draft &&
|
|
196
|
-
this.competition?.mode !== CompetitionModeEnum.VersionedExtended) ||
|
|
197
|
-
(this.selected?.status !== CompetitionVersionStatusEnum.Confirmed &&
|
|
198
|
-
this.competition?.mode === CompetitionModeEnum.VersionedExtended)));
|
|
199
|
-
} else {
|
|
200
|
-
return (!this.canChangeStatus ||
|
|
201
|
-
((this.selected?.status !== CompetitionVersionStatusEnum.Draft &&
|
|
202
|
-
this.competition?.mode !== CompetitionModeEnum.VersionedExtended) ||
|
|
203
|
-
(this.selected?.status !== CompetitionVersionStatusEnum.Confirmed &&
|
|
204
|
-
this.competition?.mode === CompetitionModeEnum.VersionedExtended))) &&
|
|
205
|
-
this.validatePiblicationAccess();
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
public get validateVersionDisabled(): boolean {
|
|
210
|
-
if (this.validatePiblicationAccess === undefined) {
|
|
211
|
-
return !this.canChangeStatus;
|
|
212
|
-
} else {
|
|
213
|
-
return !this.canChangeStatus && !!this.validatePiblicationAccess();
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
public get createVersionDisabled(): boolean {
|
|
218
|
-
if (this.validateManagementAccess === undefined) {
|
|
219
|
-
return !this.canChangeStatus;
|
|
220
|
-
} else {
|
|
221
|
-
const validationRes = this.validateManagementAccess();
|
|
222
|
-
return !this.canChangeStatus && validationRes;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
public get backToEditDisabled(): boolean {
|
|
227
|
-
if (this.validateManagementAccess === undefined) {
|
|
228
|
-
return !this.canChangeStatus;
|
|
229
|
-
} else {
|
|
230
|
-
const validationRes = this.validateManagementAccess();
|
|
231
|
-
return !this.canChangeStatus && validationRes;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
public get canValidateVersion(): boolean {
|
|
236
|
-
if (!this.canValidateVersionOnActivityPeriod) {
|
|
237
|
-
return false;
|
|
238
|
-
}
|
|
239
|
-
if (this.validatePiblicationAccess === undefined) {
|
|
240
|
-
return this.selected?.status === CompetitionVersionStatusEnum.Draft &&
|
|
241
|
-
this.competition?.mode === CompetitionModeEnum.VersionedExtended &&
|
|
242
|
-
this.competition?.status !== CompetitionStatusEnum.Canceled;
|
|
243
|
-
} else {
|
|
244
|
-
return this.selected?.status === CompetitionVersionStatusEnum.Draft &&
|
|
245
|
-
this.competition?.mode === CompetitionModeEnum.VersionedExtended &&
|
|
246
|
-
this.validatePiblicationAccess() &&
|
|
247
|
-
this.competition?.status !== CompetitionStatusEnum.Canceled;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
public get isLastVersion(): boolean {
|
|
252
|
-
if (this.versions?.length > 0) {
|
|
253
|
-
const m = Math.max(...this.versions.map(x => x.num));
|
|
254
|
-
return m === this.selected?.num;
|
|
255
|
-
}
|
|
256
|
-
return false;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
public get showRejectionReason(): boolean {
|
|
260
|
-
return !!this.selected?.rejectionReason &&
|
|
261
|
-
(this.selected?.status === CompetitionVersionStatusEnum.Draft
|
|
262
|
-
|| this.selected?.status === CompetitionVersionStatusEnum.Rejected)
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
public get versionStatusClass(): any {
|
|
266
|
-
return {
|
|
267
|
-
'': this.selected?.status !== CompetitionVersionStatusEnum.Active,
|
|
268
|
-
'color-green': this.selected?.status === CompetitionVersionStatusEnum.Active
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/** Контекст для кастомных кнопок, может расширяться */
|
|
273
|
-
public get customButtonsTemplateContext(): any {
|
|
274
|
-
return {
|
|
275
|
-
activityId: this._activityId,
|
|
276
|
-
competitionId: this.competition?.id,
|
|
277
|
-
competitionVersionId: this.selected?.id
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
public get canReturnToEdit(): boolean {
|
|
282
|
-
if (this.validateManagementAccess === undefined) {
|
|
283
|
-
return this.selected?.status === CompetitionVersionStatusEnum.Rejected;
|
|
284
|
-
} else {
|
|
285
|
-
return this.selected?.status === CompetitionVersionStatusEnum.Rejected && this.validateManagementAccess();
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
public get canManageCompetition(): boolean {
|
|
290
|
-
if (this.validateManagementAccess === undefined) {
|
|
291
|
-
return false;
|
|
292
|
-
} else {
|
|
293
|
-
return this.validateManagementAccess() &&
|
|
294
|
-
this.competition?.status != this.competitionStatusEnum.New &&
|
|
295
|
-
this.competition?.status != this.competitionStatusEnum.Completed &&
|
|
296
|
-
this.competition?.status != this.competitionStatusEnum.NotPlace;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
public get showEbLink(): boolean {
|
|
301
|
-
return this.competition != undefined &&
|
|
302
|
-
this.versions.some(x => x.status != CompetitionVersionStatusEnum.Draft);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
public get canCompleteCompetition(): boolean {
|
|
306
|
-
return this.competition != undefined &&
|
|
307
|
-
(this.competition.status == CompetitionStatusEnum.Active ||
|
|
308
|
-
this.competition.status == CompetitionStatusEnum.Staying)
|
|
309
|
-
&& this.showCompleteCompetitionButton;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
public get canCancelCompetition(): boolean {
|
|
313
|
-
return this.competition != undefined &&
|
|
314
|
-
(this.competition.status == CompetitionStatusEnum.Active ||
|
|
315
|
-
this.competition.status == CompetitionStatusEnum.Staying ||
|
|
316
|
-
this.competition.status == CompetitionStatusEnum.Canceled)
|
|
317
|
-
&& this.showCancelCompetitionButton;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
public ngOnInit(): void {
|
|
321
|
-
this.store.dispatch(loadCompetitionHeader());
|
|
322
|
-
this.appendSubscription(this.store.pipe(select(selectCompetitionVersions)).subscribe(result => {
|
|
323
|
-
if (result) {
|
|
324
|
-
this.versions = result;
|
|
325
|
-
this.select();
|
|
326
|
-
}
|
|
327
|
-
}));
|
|
328
|
-
this.appendSubscription(this.store.pipe(select(selectCompetitionSelectedVersionId)).subscribe(result => {
|
|
329
|
-
if (result) {
|
|
330
|
-
this.selectedVersion = result;
|
|
331
|
-
this.select();
|
|
332
|
-
}
|
|
333
|
-
}));
|
|
334
|
-
|
|
335
|
-
this.appendSubscription(this.store.pipe(select(selectCompetitionStatus)).subscribe(result => {
|
|
336
|
-
if (result) {
|
|
337
|
-
this.competition = result;
|
|
338
|
-
}
|
|
339
|
-
}));
|
|
340
|
-
|
|
341
|
-
this.appendSubscription(this.store.pipe(select(selectCompetitionType)).subscribe(result => {
|
|
342
|
-
if (result !== null && result !== undefined) {
|
|
343
|
-
this._competitionType = result;
|
|
344
|
-
}
|
|
345
|
-
}));
|
|
346
|
-
|
|
347
|
-
this.appendSubscription(this.store.pipe(select(selectCompetitionLabel)).subscribe(result => {
|
|
348
|
-
this.competitionLabel = result;
|
|
349
|
-
}));
|
|
350
|
-
|
|
351
|
-
this.appendSubscription(this.store.pipe(select(selectActivityId)).subscribe(result => {
|
|
352
|
-
this._activityId = result;
|
|
353
|
-
}));
|
|
354
|
-
|
|
355
|
-
this.appendSubscription(this.store.pipe(select(selectCompetitionConfig)).subscribe(result => {
|
|
356
|
-
if (result) {
|
|
357
|
-
this.competitionConfig = result;
|
|
358
|
-
|
|
359
|
-
if (this.competitionConfig.cancelCompetitionLabel) {
|
|
360
|
-
this.cancelCompetitionButtonLabel = this.competitionConfig.cancelCompetitionLabel;
|
|
361
|
-
}
|
|
362
|
-
if (this.competitionConfig.cancelCompetitionType
|
|
363
|
-
&& this.competitionConfig.cancelCompetitionType > this.cancelCompetitionTypeEnum.Disabled) {
|
|
364
|
-
this.showCancelCompetitionButton = true;
|
|
365
|
-
}
|
|
366
|
-
this.showCompleteCompetitionButton = this.competitionConfig.showCompleteCompetitionButton;
|
|
367
|
-
if (this.competitionConfig.restoreButtonName) {
|
|
368
|
-
this.restoreButtonName = this.competitionConfig.restoreButtonName;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}));
|
|
372
|
-
|
|
373
|
-
this.appendSubscription(this.store.pipe(select(selectManualVersionStatusChanged)).subscribe(result => {
|
|
374
|
-
// произошло ручное изменение статуса, толкаем дальше по таймауту
|
|
375
|
-
if (result) {
|
|
376
|
-
setTimeout(() => {
|
|
377
|
-
const selectedItem = this.selected;
|
|
378
|
-
if (selectedItem) {
|
|
379
|
-
this.store.dispatch(competitionVersionChangeStatus({
|
|
380
|
-
versionId: selectedItem.id,
|
|
381
|
-
status: CompetitionVersionStatusEnum.Confirmed
|
|
382
|
-
}));
|
|
383
|
-
}
|
|
384
|
-
}, 10000);
|
|
385
|
-
}
|
|
386
|
-
}));
|
|
387
|
-
this.settingsService.getSelelectionEditEbLinks().subscribe(res => {
|
|
388
|
-
this._ebLinksModel = res;
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
public ngOnDestroy(): void {
|
|
393
|
-
super.ngOnDestroy();
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
public getCompetitionVersionStatusEnumLabel(value: any) {
|
|
397
|
-
return CompetitionVersionStatusEnumLabel[value as CompetitionVersionStatusEnum];
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
public getCompetitionVersionStatusGrouppingLabel(value: any) {
|
|
401
|
-
return CompetitionVersionStatusGrouppingLabel[value as CompetitionVersionStatusEnum];
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
public createVersion(): void {
|
|
405
|
-
this.alertService.showDialog({
|
|
406
|
-
title: `Формирование изменений`,
|
|
407
|
-
message:
|
|
408
|
-
`${this.getWarningMessageHtml('Внимание! Формирование изменений приведет к созданию новой версии отбора')}
|
|
409
|
-
<p>
|
|
410
|
-
Вы действительно хотите сформировать изменения?
|
|
411
|
-
</p>`,
|
|
412
|
-
color: DialogColor.yellow,
|
|
413
|
-
type: DialogType.confirm,
|
|
414
|
-
okLabel: 'Подтвердить',
|
|
415
|
-
cancelLabel: 'Отменить',
|
|
416
|
-
okCallback: () => {
|
|
417
|
-
this.store.dispatch(createCompetitionVersion());
|
|
418
|
-
}
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
public activateVersion(): void {
|
|
423
|
-
if (this.selected) {
|
|
424
|
-
const selectedItem = this.selected;
|
|
425
|
-
this.alertService.showDialog({
|
|
426
|
-
title: `Публикация ${this.competitionLabel}а`,
|
|
427
|
-
message: `${this.getWarningMessageHtml()}
|
|
428
|
-
<p>
|
|
429
|
-
Вы действительно хотите опубликовать ${this.competitionLabel}?
|
|
430
|
-
</p>`,
|
|
431
|
-
color: DialogColor.yellow,
|
|
432
|
-
type: DialogType.confirm,
|
|
433
|
-
okLabel: 'Подтвердить',
|
|
434
|
-
cancelLabel: 'Отменить',
|
|
435
|
-
okCallback: () => {
|
|
436
|
-
this.store.dispatch(competitionVersionChangeStatus({
|
|
437
|
-
versionId: selectedItem.id,
|
|
438
|
-
status: CompetitionVersionStatusEnum.Active
|
|
439
|
-
}));
|
|
440
|
-
}
|
|
441
|
-
});
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
public validateVersion(): void {
|
|
446
|
-
if (this.selected) {
|
|
447
|
-
const selectedItem = this.selected;
|
|
448
|
-
|
|
449
|
-
if (this.validateVersionAction) {
|
|
450
|
-
this.validateVersionAction(selectedItem.id, () => {
|
|
451
|
-
this.signService.sign({
|
|
452
|
-
title: 'Направление документа на согласование',
|
|
453
|
-
okLabel: 'Отправить',
|
|
454
|
-
cancelLabel: 'Отменить',
|
|
455
|
-
pdfUrl: `/m-data/minfin/pdf-competition/${selectedItem.id}`,
|
|
456
|
-
xmlUrl: `/m-data/minfin/xml-competition/${selectedItem.id}`,
|
|
457
|
-
provider: 'empty'
|
|
458
|
-
}, () => {
|
|
459
|
-
this.store.dispatch(competitionVersionChangeStatus({
|
|
460
|
-
versionId: selectedItem.id,
|
|
461
|
-
status: CompetitionVersionStatusEnum.Validation
|
|
462
|
-
}));
|
|
463
|
-
}, () => {
|
|
464
|
-
});
|
|
465
|
-
})
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
public removeVersion(): void {
|
|
471
|
-
if (this.selected) {
|
|
472
|
-
const selectedItem = this.selected;
|
|
473
|
-
this.alertService.showDialog(`Удалить версию ${this.competitionLabel}а?`,
|
|
474
|
-
`${this.getWarningMessageHtml()}
|
|
475
|
-
<p>
|
|
476
|
-
Вы действительно хотите удалить версию ${this.competitionLabel?.toLowerCase()}а?
|
|
477
|
-
</p>`,
|
|
478
|
-
DialogType.confirm, (ok) => {
|
|
479
|
-
this.store.dispatch(deleteCompetitionVersion({versionId: selectedItem.id}));
|
|
480
|
-
}, undefined, null, undefined, undefined, DialogColor.red);
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
public restore(): void {
|
|
485
|
-
this.alertService.showDialog(`Возобновить ${this.competitionLabel}?`, null, DialogType.confirm, (ok) => {
|
|
486
|
-
this.store.dispatch(activateCompetition());
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
public pause(): void {
|
|
491
|
-
this.alertService.showDialog(`Приостановить ${this.competitionLabel}?`, null, DialogType.confirm, (ok) => {
|
|
492
|
-
this.store.dispatch(pauseCompetition());
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
public cancel(): void {
|
|
497
|
-
if (this.competitionConfig && this.competitionConfig.cancelCompetitionType == this.cancelCompetitionTypeEnum.WithValidation) {
|
|
498
|
-
if (this.selected) {
|
|
499
|
-
const selectedItem = this.selected;
|
|
500
|
-
this.store.dispatch(cancelCompetitionWithValidation({versionId: selectedItem.id}));
|
|
501
|
-
}
|
|
502
|
-
} else {
|
|
503
|
-
this.alertService.showDialog(`Отменить ${this.competitionLabel}?`, null, DialogType.confirm, (ok) => {
|
|
504
|
-
this.store.dispatch(cancelCompetition());
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
public complete(): void {
|
|
510
|
-
this.alertService.showDialog(`Завершить ${this.competitionLabel}?`, null, DialogType.confirm, (ok) => {
|
|
511
|
-
this.store.dispatch(completeCompetition());
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
public selectVersion(id: string): void {
|
|
516
|
-
this.store.dispatch(selectCompetitionVersion({versionId: id}));
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
public backToEdit(): void {
|
|
520
|
-
this.alertService.showDialog(`редактирование текущей версии`,
|
|
521
|
-
`Вы действительно хотите редактировать текущую версию ${this.competitionLabel.toLowerCase()}a`,
|
|
522
|
-
DialogType.confirm,
|
|
523
|
-
(ok) => {
|
|
524
|
-
if (!!this.selected) {
|
|
525
|
-
this.store.dispatch(competitionVersionChangeStatus({
|
|
526
|
-
versionId: this.selected.id,
|
|
527
|
-
status: CompetitionVersionStatusEnum.Draft
|
|
528
|
-
}));
|
|
529
|
-
}
|
|
530
|
-
}, undefined, null, 'Подтвердить', undefined, DialogColor.yellow);
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
public showRejection(model: CompetitionRejectionModel): void {
|
|
534
|
-
this.alertService.showDialog(`Причина отклонения`,
|
|
535
|
-
` <div class="modal-body__author">
|
|
536
|
-
<span>${model.author}</span>
|
|
537
|
-
<span>${model.createdDate}</span>
|
|
538
|
-
</div>
|
|
539
|
-
<p class="modal-body__text">${model.reason}</p>
|
|
540
|
-
`, DialogType.confirm,
|
|
541
|
-
undefined, undefined, null, undefined, '', DialogColor.yellow);
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
public redirectToEb(): void {
|
|
545
|
-
if (this.competition != undefined && this._competitionType != undefined && this._ebLinksModel != undefined) {
|
|
546
|
-
let link = '';
|
|
547
|
-
|
|
548
|
-
if (this._competitionType == CompetitionTypeEnum.SocialOrder) {
|
|
549
|
-
link = `${this._ebLinksModel.socialOrder}/#SocialOrderAgreement`;
|
|
550
|
-
} else if (this._competitionType == CompetitionTypeEnum.Region) {
|
|
551
|
-
link = `${this._ebLinksModel.subsidy}/#AgreementSubsidyNonFederal`;
|
|
552
|
-
} else {
|
|
553
|
-
link = `${this._ebLinksModel.subsidy}/#AgreementSubsidyRegistry`;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
window.open(link, '_blank');
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
private select(): void {
|
|
561
|
-
if (this.versions && this.selectedVersion) {
|
|
562
|
-
this.selected = this.versions.find(s => s.id === this.selectedVersion);
|
|
563
|
-
this.selectedCompetitionVersionInfo.emit(this.selected);
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
private getWarningMessageHtml(customText: string | undefined = undefined): string {
|
|
568
|
-
if (!customText) {
|
|
569
|
-
customText = 'Внимание! Данное действие нельзя отменить';
|
|
570
|
-
}
|
|
571
|
-
return `<div class="bg-news px-3 py-2 radius-4 my-3 d-flex">
|
|
572
|
-
<div class="mr-3">
|
|
573
|
-
<svg width="16" height="16" fill="none">
|
|
574
|
-
<use href="#alert"></use>
|
|
575
|
-
</svg>
|
|
576
|
-
</div>
|
|
577
|
-
<div class="small m-0 bold">
|
|
578
|
-
<span class="color-orange">
|
|
579
|
-
${customText}
|
|
580
|
-
</span>
|
|
581
|
-
</div>
|
|
582
|
-
</div>`;
|
|
583
|
-
}
|
|
584
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const COMPETITION_HEADER_FEATURE_NAME = 'competition-header';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './competition-header-custom-buttons.directive';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import {CompetitionVersionModel} from './competition-version.model';
|
|
2
|
-
import { CompetitionModeEnum, CompetitionStatusEnum, CompetitionTypeEnum } from 'myrtex-mf-ui-composite';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export interface CompetitionHeaderVersionModel {
|
|
6
|
-
id: string;
|
|
7
|
-
status: CompetitionStatusEnum;
|
|
8
|
-
mode: CompetitionModeEnum;
|
|
9
|
-
versions: CompetitionVersionModel[];
|
|
10
|
-
selectedCompetitionVersionId: string;
|
|
11
|
-
activityId: string;
|
|
12
|
-
type: CompetitionTypeEnum;
|
|
13
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { CompetitionRejectionModel } from './competition-rejection.model';
|
|
2
|
-
import { CompetitionVersionStatusEnum } from 'myrtex-mf-ui-composite';
|
|
3
|
-
|
|
4
|
-
export interface CompetitionVersionModel {
|
|
5
|
-
id: string;
|
|
6
|
-
num: number;
|
|
7
|
-
name: string;
|
|
8
|
-
shortName: string;
|
|
9
|
-
status: CompetitionVersionStatusEnum;
|
|
10
|
-
createdDate: string;
|
|
11
|
-
rejectionReason: CompetitionRejectionModel
|
|
12
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { HttpClient } from '@angular/common/http';
|
|
2
|
-
import { Injectable, Injector } from '@angular/core';
|
|
3
|
-
import { Observable } from 'rxjs';
|
|
4
|
-
import { CompetitionHeaderVersionModel } from '../models/competition-header-version.model';
|
|
5
|
-
import { CompetitionVersionStatusEnum, EndpointBaseService } from 'myrtex-mf-ui-composite';
|
|
6
|
-
|
|
7
|
-
@Injectable()
|
|
8
|
-
export class CompetitionHeaderService extends EndpointBaseService {
|
|
9
|
-
|
|
10
|
-
private url = '/application' + this.restPath + '/competition';
|
|
11
|
-
|
|
12
|
-
constructor(http: HttpClient, injector: Injector) {
|
|
13
|
-
super(http, injector);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public getHeader(competitionId?: string): Observable<CompetitionHeaderVersionModel> {
|
|
17
|
-
return this.http.get<CompetitionHeaderVersionModel>(`${this.url}/${competitionId}/header`);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public createVersion(competitionId?: string): Observable<string> {
|
|
21
|
-
return this.http.post<string>(`${this.url}/${competitionId}/version`, {});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public deleteVersion(competitionId?: string, versionId?: string): Observable<boolean> {
|
|
25
|
-
return this.http.delete<boolean>(`${this.url}/${competitionId}/version/${versionId}`);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
public versionChangeStatus(competitionId?: string, versionId?: string, status?: CompetitionVersionStatusEnum): Observable<boolean> {
|
|
29
|
-
return this.http.post<boolean>(`${this.url}/${competitionId}/version/${versionId}/to-status/${status}`, {});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
public activate(competitionId?: string): Observable<any> {
|
|
33
|
-
return this.http.post<any>(`${this.url}/${competitionId}/activate`, {});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
public pause(competitionId?: string): Observable<any> {
|
|
37
|
-
return this.http.post<any>(`${this.url}/${competitionId}/pause`, {});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
public complete(competitionId?: string): Observable<any> {
|
|
41
|
-
return this.http.post<any>(`${this.url}/${competitionId}/complete`, {});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
public cancel(competitionId?: string): Observable<any> {
|
|
45
|
-
return this.http.post<any>(`${this.url}/${competitionId}/cancel`, {});
|
|
46
|
-
}
|
|
47
|
-
}
|