created new sprint form component draft
This commit is contained in:
parent
39e403a8a7
commit
7c26e91b2a
@ -11,6 +11,7 @@ import { TaskListComponent } from './task-list/task-list.component';
|
||||
import { TaskFormComponent } from './task-form/task-form.component';
|
||||
import { UserstoryListComponent } from './userstory-list/userstory-list.component';
|
||||
import { UserstoryFormComponent } from './userstory-form/userstory-form.component';
|
||||
import { SprintFormComponent } from './sprint-form/sprint-form.component';
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
|
||||
@NgModule({
|
||||
@ -19,7 +20,8 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
TaskListComponent,
|
||||
TaskFormComponent,
|
||||
UserstoryListComponent,
|
||||
UserstoryFormComponent
|
||||
UserstoryFormComponent,
|
||||
SprintFormComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
@ -232,7 +232,7 @@ export interface ScrumUserstory {
|
||||
export interface ScrumSprint{
|
||||
id?: number;
|
||||
title: string;
|
||||
description: string;
|
||||
description?: string;
|
||||
startDate: Date;
|
||||
endDate: Date;
|
||||
project: number;
|
||||
|
0
src/app/sprint-component/sprint.component.css
Normal file
0
src/app/sprint-component/sprint.component.css
Normal file
1
src/app/sprint-component/sprint.component.html
Normal file
1
src/app/sprint-component/sprint.component.html
Normal file
@ -0,0 +1 @@
|
||||
<button class="btn btn-dark m-3" (click)="openUserstoryForm(null)">Neuer Sprint</button>
|
54
src/app/sprint-component/sprint.component.ts
Normal file
54
src/app/sprint-component/sprint.component.ts
Normal file
@ -0,0 +1,54 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { BackendService, ScrumSprint } from '../services/backend.service';
|
||||
import { SprintFormComponent } from '../sprint-form/sprint-form.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-sprint',
|
||||
templateUrl: './sprint.component.html',
|
||||
styleUrls: ['./sprint.component.css']
|
||||
})
|
||||
export class SprintComponent implements OnInit {
|
||||
|
||||
public sprints: ScrumSprint[] = [];
|
||||
|
||||
constructor(private backendService: BackendService, private modalService: NgbModal) {
|
||||
backendService.getSprints().subscribe(response => {
|
||||
if (response.status > 399) {
|
||||
alert('Fehler');
|
||||
}
|
||||
else {
|
||||
this.sprints.push(...response.body);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
public deleteSprint(sprint: ScrumSprint) {
|
||||
this.backendService.deleteSprint(sprint).subscribe(response => {
|
||||
if (response.status > 399) {
|
||||
alert('Fehler');
|
||||
}
|
||||
});
|
||||
const index = this.sprints.indexOf(sprint);
|
||||
if (index !== -1) {
|
||||
this.sprints.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public openSprintForm(editSprint: ScrumSprint) {
|
||||
const modalRef = this.modalService.open(SprintFormComponent, {
|
||||
backdrop: 'static',
|
||||
keyboard: true,
|
||||
});
|
||||
if (editSprint === null) {
|
||||
modalRef.result.then(result => {
|
||||
this.sprints.push(result);
|
||||
});
|
||||
}
|
||||
modalRef.componentInstance.userstory = editSprint;
|
||||
}
|
||||
|
||||
}
|
4
src/app/sprint-form/sprint-form.component.css
Normal file
4
src/app/sprint-form/sprint-form.component.css
Normal file
@ -0,0 +1,4 @@
|
||||
.modal-footer {
|
||||
border-top: 0px solid;
|
||||
padding-top: 5%;
|
||||
}
|
33
src/app/sprint-form/sprint-form.component.html
Normal file
33
src/app/sprint-form/sprint-form.component.html
Normal file
@ -0,0 +1,33 @@
|
||||
<div class="modal-content p-3">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Neuen Sprint anlegen</h4>
|
||||
<button (click)="onClose()" type="button" class="close" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form (ngSubmit)="onSubmit()">
|
||||
<div class="form-group">
|
||||
<label for="Title">Titel</label>
|
||||
<input type="text" class="form-control" id="Title" required name="title" [(ngModel)]="sprint.title"
|
||||
id="titleField">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="Title">Startdatum</label>
|
||||
<input type="date" class="form-control" id="Title" required name="title" [(ngModel)]="sprint.startDate"
|
||||
id="titleField">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="Title">Enddatum</label>
|
||||
<input type="date" class="form-control" id="Title" required name="title" [(ngModel)]="sprint.endDate"
|
||||
id="titleField">
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button (click)="onClose()" type="dismiss" class="btn btn-secondary"
|
||||
data-dismiss="modal">Abbrechen</button>
|
||||
<button type="submit" class="btn btn-primary">Sprint starten</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
62
src/app/sprint-form/sprint-form.component.ts
Normal file
62
src/app/sprint-form/sprint-form.component.ts
Normal file
@ -0,0 +1,62 @@
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import {
|
||||
BackendService,
|
||||
ScrumTask,
|
||||
Priority,
|
||||
ScrumStatus,
|
||||
ScrumCategory,
|
||||
ScrumUser,
|
||||
ScrumProject,
|
||||
ScrumUserstory,
|
||||
ScrumSprint
|
||||
} from '../services/backend.service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { HttpResponse } from '@angular/common/http';
|
||||
|
||||
@Component({
|
||||
selector: 'app-task-form',
|
||||
templateUrl: './sprint-form.component.html',
|
||||
styleUrls: ['./sprint-form.component.css'],
|
||||
})
|
||||
export class SprintFormComponent implements OnInit {
|
||||
@Input() public sprint: ScrumSprint;
|
||||
public editing: Boolean;
|
||||
public sprintid: string;
|
||||
|
||||
constructor(
|
||||
private backendService: BackendService,
|
||||
private activeModalService: NgbActiveModal
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.sprint === null || this.sprint === undefined) {
|
||||
this.sprint = { title: '', startDate: new Date(), endDate: new Date(), project: 0 }; //project id: static counter?
|
||||
this.editing = false;
|
||||
} else {
|
||||
this.editing = true;
|
||||
}
|
||||
document.getElementById('titleField').focus();
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
if (this.editing) {
|
||||
this.backendService.putSprint(this.sprint).subscribe((response) => {
|
||||
if (response.status > 399) {
|
||||
alert('Fehler');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.backendService.postSprint(this.sprint).subscribe((response) => {
|
||||
if (response.status > 399) {
|
||||
alert('Fehler');
|
||||
}
|
||||
});
|
||||
}
|
||||
this.activeModalService.close(this.sprint);
|
||||
}
|
||||
|
||||
onClose() {
|
||||
this.activeModalService.dismiss(this.sprint);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user