no message
This commit is contained in:
parent
0fdf82728b
commit
1f9d07885f
|
@ -2,7 +2,7 @@
|
||||||
<form *ngIf="formGroup" (ngSubmit)="formSubmit()" [formGroup]="formGroup">
|
<form *ngIf="formGroup" (ngSubmit)="formSubmit()" [formGroup]="formGroup">
|
||||||
<mat-card>
|
<mat-card>
|
||||||
<mat-card-title *ngIf="isNew">{{'PROJECT-EDITOR.TITLE.NEW' | translate}}</mat-card-title>
|
<mat-card-title *ngIf="isNew">{{'PROJECT-EDITOR.TITLE.NEW' | translate}}</mat-card-title>
|
||||||
<mat-card-title *ngIf="!isNew">{{'PROJECT-EDITOR.TITLE.EDIT' | translate}} {{project.label}}</mat-card-title>
|
<mat-card-title *ngIf="!isNew">{{formGroup.get('label').value}}</mat-card-title>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
|
@ -51,7 +51,8 @@
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<mat-form-field class="full-width">
|
<mat-form-field class="full-width">
|
||||||
<textarea matInput class="description-area" placeholder="{{'PROJECT-EDITOR.FIELDS.DESCRIPTION' | translate}}" formControlName="description" required></textarea>
|
<textarea matInput class="description-area" placeholder="{{'PROJECT-EDITOR.FIELDS.DESCRIPTION' | translate}}" formControlName="description"
|
||||||
|
required></textarea>
|
||||||
<mat-error *ngIf="formGroup.get('description').errors?.backendError">{{errorModel.description}}</mat-error>
|
<mat-error *ngIf="formGroup.get('description').errors?.backendError">{{errorModel.description}}</mat-error>
|
||||||
<mat-error *ngIf="formGroup.get('description').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="formGroup.get('description').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
@ -59,7 +60,7 @@
|
||||||
<div layout="row" class="full-width text-right" align="end">
|
<div layout="row" class="full-width text-right" align="end">
|
||||||
<button mat-raised-button color="primary" (click)="cancel()" type="button">{{'PROJECT-EDITOR.ACTIONS.CANCEL' | translate}}</button>
|
<button mat-raised-button color="primary" (click)="cancel()" type="button">{{'PROJECT-EDITOR.ACTIONS.CANCEL' | translate}}</button>
|
||||||
<button mat-raised-button color="primary" type="submit">{{'PROJECT-EDITOR.ACTIONS.SAVE' | translate}}</button>
|
<button mat-raised-button color="primary" type="submit">{{'PROJECT-EDITOR.ACTIONS.SAVE' | translate}}</button>
|
||||||
<button *ngIf="!isNew" mat-raised-button color="primary" type="submit" (click)="delete()">{{'PROJECT-EDITOR.ACTIONS.DELETE' | translate}}</button>
|
<button *ngIf="!isNew" mat-raised-button color="primary" type="button" (click)="delete()">{{'PROJECT-EDITOR.ACTIONS.DELETE' | translate}}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
|
|
|
@ -11,6 +11,7 @@ import { JsonSerializer } from "../../utilities/JsonSerializer";
|
||||||
import { FormGroup } from "@angular/forms";
|
import { FormGroup } from "@angular/forms";
|
||||||
import { SnackBarNotificationComponent } from "../../shared/components/notificaiton/snack-bar-notification.component";
|
import { SnackBarNotificationComponent } from "../../shared/components/notificaiton/snack-bar-notification.component";
|
||||||
import { BaseErrorModel } from "../../models/error/BaseErrorModel";
|
import { BaseErrorModel } from "../../models/error/BaseErrorModel";
|
||||||
|
import { TdDialogService } from "@covalent/core";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,7 +33,8 @@ export class ProjectEditorComponent implements AfterViewInit {
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
public snackBar: MatSnackBar,
|
public snackBar: MatSnackBar,
|
||||||
public router: Router,
|
public router: Router,
|
||||||
public language: TranslateService
|
public language: TranslateService,
|
||||||
|
private dialogService: TdDialogService
|
||||||
) {
|
) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -97,4 +99,22 @@ export class ProjectEditorComponent implements AfterViewInit {
|
||||||
public cancel(): void {
|
public cancel(): void {
|
||||||
this.router.navigate(['/projects']);
|
this.router.navigate(['/projects']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public delete(): void {
|
||||||
|
this.language.get('GENERAL.DELETE-CONFIRMATION').subscribe((messages: any) => {
|
||||||
|
this.dialogService.openConfirm({
|
||||||
|
message: messages.MESSAGE,
|
||||||
|
title: messages.TITLE,
|
||||||
|
cancelButton: messages.NEGATIVE,
|
||||||
|
acceptButton: messages.POSITIVE
|
||||||
|
}).afterClosed().subscribe((accept: boolean) => {
|
||||||
|
if (accept) {
|
||||||
|
this.projectService.inactivate(this.project.id).subscribe(
|
||||||
|
complete => { this.router.navigate(['/projects']); },
|
||||||
|
error => this.onCallbackError(error)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -37,4 +37,8 @@ export class ProjectService {
|
||||||
createProject(projectModel: ProjectModel): Observable<ProjectModel> {
|
createProject(projectModel: ProjectModel): Observable<ProjectModel> {
|
||||||
return this.http.post<ProjectModel>(this.actionUrl + 'createOrUpdate', projectModel, { headers: this.headers });
|
return this.http.post<ProjectModel>(this.actionUrl + 'createOrUpdate', projectModel, { headers: this.headers });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inactivate(id: String): Observable<ProjectModel> {
|
||||||
|
return this.http.delete<ProjectModel>(this.actionUrl + 'inactivate' + id, { headers: this.headers });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ import {
|
||||||
} from '@angular/material';
|
} from '@angular/material';
|
||||||
import { CdkTableModule } from '@angular/cdk/table';
|
import { CdkTableModule } from '@angular/cdk/table';
|
||||||
import { SnackBarNotificationComponent } from '../components/notificaiton/snack-bar-notification.component';
|
import { SnackBarNotificationComponent } from '../components/notificaiton/snack-bar-notification.component';
|
||||||
import { CovalentLayoutModule, CovalentChipsModule } from '@covalent/core';
|
import { CovalentLayoutModule, CovalentChipsModule, CovalentDialogsModule } from '@covalent/core';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -59,7 +59,8 @@ import { CovalentLayoutModule, CovalentChipsModule } from '@covalent/core';
|
||||||
MatCheckboxModule,
|
MatCheckboxModule,
|
||||||
MatTabsModule,
|
MatTabsModule,
|
||||||
CovalentLayoutModule,
|
CovalentLayoutModule,
|
||||||
CovalentChipsModule
|
CovalentChipsModule,
|
||||||
|
CovalentDialogsModule
|
||||||
],
|
],
|
||||||
|
|
||||||
providers: [
|
providers: [
|
||||||
|
|
|
@ -2,6 +2,12 @@
|
||||||
"GENERAL": {
|
"GENERAL": {
|
||||||
"VALIDATION": {
|
"VALIDATION": {
|
||||||
"REQUIRED": "Required"
|
"REQUIRED": "Required"
|
||||||
|
},
|
||||||
|
"DELETE-CONFIRMATION": {
|
||||||
|
"TITLE": "Warning",
|
||||||
|
"MESSAGE": "Are you sure you want to delete this item?",
|
||||||
|
"POSITIVE": "Yes",
|
||||||
|
"NEGATIVE": "Cancel"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"NAV-BAR": {
|
"NAV-BAR": {
|
||||||
|
|
Loading…
Reference in New Issue