mirror of https://github.com/Ombi-app/Ombi
parent
10f503ae2c
commit
1ec5c1859c
@ -0,0 +1,29 @@
|
||||
<h1 mat-dialog-title>{{ 'Issues.IssueDialog.Title' | translate}}</h1>
|
||||
<div mat-dialog-content>
|
||||
|
||||
<div class="col-12">
|
||||
<mat-form-field class="col-12">
|
||||
<mat-label>{{'Issues.IssueDialog.SelectCategory' | translate}}</mat-label>
|
||||
<mat-select [(ngModel)]="issue.issueCategoryId">
|
||||
<mat-option *ngFor="let cat of issueCategories" [value]="cat.id">
|
||||
{{cat.value}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="col-12">
|
||||
<input matInput placeholder="{{ 'Issues.IssueDialog.TitlePlaceholder' | translate}}" [(ngModel)]="issue.subject">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="col-12">
|
||||
<textarea matInput placeholder="{{ 'Issues.IssueDialog.DescriptionPlaceholder' | translate}}"
|
||||
[(ngModel)]="issue.description"></textarea>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div mat-dialog-actions>
|
||||
<button mat-button (click)="onNoClick()">{{ 'Common.Cancel' | translate}}</button>
|
||||
<button mat-button (click)="createIssue()" [mat-dialog-close]="data"
|
||||
cdkFocusInitial>{{ 'Common.Submit' | translate}}</button>
|
||||
</div>
|
@ -0,0 +1,56 @@
|
||||
import { Component, Inject, OnInit } from "@angular/core";
|
||||
import { IDenyDialogData, IIssueDialogData } from "../interfaces/interfaces";
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
|
||||
import { MessageService, IssuesService } from "../../../../services";
|
||||
import { IIssues, IIssueCategory, IssueStatus, RequestType } from "../../../../interfaces";
|
||||
import { TranslateService } from "@ngx-translate/core";
|
||||
|
||||
@Component({
|
||||
selector: "new-issue",
|
||||
templateUrl: "./new-issue.component.html",
|
||||
})
|
||||
export class NewIssueComponent implements OnInit {
|
||||
|
||||
public issue: IIssues;
|
||||
public issueCategories: IIssueCategory[];
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<NewIssueComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: IIssueDialogData,
|
||||
private issueService: IssuesService,
|
||||
public messageService: MessageService,
|
||||
private translate: TranslateService) {
|
||||
this.issue = {
|
||||
subject: "",
|
||||
description: "",
|
||||
issueCategory: { value: "", id: 0 },
|
||||
status: IssueStatus.Pending,
|
||||
resolvedDate: undefined,
|
||||
id: undefined,
|
||||
issueCategoryId: 0,
|
||||
comments: [],
|
||||
requestId: data.requestId,
|
||||
requestType: data.requestType,
|
||||
title: "",
|
||||
providerId: data.imdbId,
|
||||
userReported: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
public async ngOnInit(): Promise<void> {
|
||||
this.issueCategories = await this.issueService.getCategories().toPromise();
|
||||
}
|
||||
|
||||
|
||||
public async createIssue() {
|
||||
const result = await this.issueService.createIssue(this.issue).toPromise();
|
||||
if(result) {
|
||||
this.messageService.send(this.translate.instant("Issues.IssueDialog.IssueCreated"));
|
||||
}
|
||||
}
|
||||
|
||||
public onNoClick(): void {
|
||||
this.dialogRef.close();
|
||||
delete this.issue;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue