From 256bdedac968eda4e4dae194427f4eac072d77b1 Mon Sep 17 00:00:00 2001 From: NisanurBulut Date: Mon, 27 Jul 2020 13:34:14 +0300 Subject: [PATCH] =?UTF-8?q?G=C3=BCncelleme=20i=C5=9Flemi=20tamamland=C4=B1?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PratikForumClient/angular.json | 5 ++- PratikForumClient/package-lock.json | 33 ++++++++----------- PratikForumClient/package.json | 7 ++-- PratikForumClient/src/app/app.module.ts | 9 ++++- .../add-item-form.component.html | 3 +- .../budget-item-card.component.html | 4 ++- .../budget-item-card.component.ts | 5 +++ .../budget-item-list.component.html | 2 ++ .../budget-item-list.component.ts | 19 ++++++++++- .../app/budget-main/budget-main.component.ts | 1 - .../edit-item-modal.component.html | 3 +- .../edit-item-modal.component.ts | 12 ++++--- PratikForumClient/src/index.html | 2 ++ PratikForumClient/src/main.ts | 1 + PratikForumClient/src/styles.css | 5 ++- 15 files changed, 75 insertions(+), 36 deletions(-) diff --git a/PratikForumClient/angular.json b/PratikForumClient/angular.json index e47c8df..0508ca7 100644 --- a/PratikForumClient/angular.json +++ b/PratikForumClient/angular.json @@ -46,6 +46,7 @@ "src/assets" ], "styles": [ + "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css", "src/styles.css", "src/main-style.scss", "./node_modules/@fortawesome/fontawesome-free/css/all.min.css" @@ -113,6 +114,7 @@ "src/assets" ], "styles": [ + "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css", "src/styles.css" ], "scripts": [] @@ -144,6 +146,7 @@ } } } - }}, + } + }, "defaultProject": "PratikForumClient" } \ No newline at end of file diff --git a/PratikForumClient/package-lock.json b/PratikForumClient/package-lock.json index b174038..59fee00 100644 --- a/PratikForumClient/package-lock.json +++ b/PratikForumClient/package-lock.json @@ -142,12 +142,12 @@ } }, "@angular/cdk": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-10.1.0.tgz", - "integrity": "sha512-zSZcpsfhRWdNAzNXnKZIlaX1uAWY+8W2zV7ktQNJoNypo9X02rY0YtmPBzlPjT0ITjM4EqohZ07nfd+5bLUw4A==", + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-8.2.3.tgz", + "integrity": "sha512-ZwO5Sn720RA2YvBqud0JAHkZXjmjxM0yNzCO8RVtRE9i8Gl26Wk0j0nQeJkVm4zwv2QO8MwbKUKGTMt8evsokA==", "requires": { "parse5": "^5.0.0", - "tslib": "^2.0.0" + "tslib": "^1.7.1" }, "dependencies": { "parse5": { @@ -155,11 +155,6 @@ "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz", "integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==", "optional": true - }, - "tslib": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.0.tgz", - "integrity": "sha512-lTqkx847PI7xEDYJntxZH89L2/aXInsyF2luSafe/+0fHOMjlBNXdH6th7f70qxLDhul7KZK0zC8V5ZIyHl0/g==" } } }, @@ -575,18 +570,11 @@ "dev": true }, "@angular/material": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/@angular/material/-/material-10.1.0.tgz", - "integrity": "sha512-zHJxMHYAyfJbhXGhsWUFTABBBQVzWNexuJGWh19MQx0jQn7aLek5nYQ0oLG00+ArISVAg/XMOtnbdRaemFWVzw==", + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/@angular/material/-/material-8.2.3.tgz", + "integrity": "sha512-SOczkIaqes+r+9XF/UUiokidfFKBpHkOPIaFK857sFD0FBNPvPEpOr5oHKCG3feERRwAFqHS7Wo2ohVEWypb5A==", "requires": { - "tslib": "^2.0.0" - }, - "dependencies": { - "tslib": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.0.tgz", - "integrity": "sha512-lTqkx847PI7xEDYJntxZH89L2/aXInsyF2luSafe/+0fHOMjlBNXdH6th7f70qxLDhul7KZK0zC8V5ZIyHl0/g==" - } + "tslib": "^1.7.1" } }, "@angular/platform-browser": { @@ -5001,6 +4989,11 @@ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", "dev": true }, + "hammerjs": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/hammerjs/-/hammerjs-2.0.8.tgz", + "integrity": "sha1-BO93hiz/K7edMPdpIJWTAiK/YPE=" + }, "handle-thing": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz", diff --git a/PratikForumClient/package.json b/PratikForumClient/package.json index 6620b87..58a795e 100644 --- a/PratikForumClient/package.json +++ b/PratikForumClient/package.json @@ -11,18 +11,19 @@ }, "private": true, "dependencies": { - "@angular/animations": "^8.2.14", - "@angular/cdk": "^10.1.0", + "@angular/animations": "~8.2.8", + "@angular/cdk": "~8.2.3", "@angular/common": "~8.2.8", "@angular/compiler": "~8.2.8", "@angular/core": "~8.2.8", "@angular/forms": "~8.2.8", - "@angular/material": "^10.1.0", + "@angular/material": "^8.2.3", "@angular/platform-browser": "~8.2.8", "@angular/platform-browser-dynamic": "~8.2.8", "@angular/router": "~8.2.8", "@fortawesome/fontawesome-free": "^5.14.0", "bulma": "^0.9.0", + "hammerjs": "^2.0.8", "rxjs": "~6.4.0", "tslib": "^1.10.0", "zone.js": "~0.9.1" diff --git a/PratikForumClient/src/app/app.module.ts b/PratikForumClient/src/app/app.module.ts index c45496f..0ace9d9 100644 --- a/PratikForumClient/src/app/app.module.ts +++ b/PratikForumClient/src/app/app.module.ts @@ -1,6 +1,9 @@ import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; +import {MatDialogModule} from '@angular/material/dialog'; + import { AppComponent } from './app.component'; import { BankAccountComponent } from './bank-account/bank-account.component'; import { HttpClientModule } from '@angular/common/http'; @@ -24,6 +27,7 @@ import { BudgetItemCardComponent } from './budget-main/budget-item-list/budget-i import { EditItemModalComponent } from './budget-main/edit-item-modal/edit-item-modal.component'; + @NgModule({ declarations: [ AppComponent, @@ -51,9 +55,12 @@ import { EditItemModalComponent } from './budget-main/edit-item-modal/edit-item- FormsModule, ReactiveFormsModule, HttpClientModule, - AppRoutingModule + AppRoutingModule, + BrowserAnimationsModule, + MatDialogModule ], providers: [], + entryComponents:[EditItemModalComponent], bootstrap: [AppComponent] }) export class AppModule { } diff --git a/PratikForumClient/src/app/budget-main/add-item-form/add-item-form.component.html b/PratikForumClient/src/app/budget-main/add-item-form/add-item-form.component.html index 6d28497..12038f8 100644 --- a/PratikForumClient/src/app/budget-main/add-item-form/add-item-form.component.html +++ b/PratikForumClient/src/app/budget-main/add-item-form/add-item-form.component.html @@ -27,7 +27,8 @@

-
diff --git a/PratikForumClient/src/app/budget-main/budget-item-list/budget-item-card/budget-item-card.component.html b/PratikForumClient/src/app/budget-main/budget-item-list/budget-item-card/budget-item-card.component.html index b9aa3fe..4fa60f6 100644 --- a/PratikForumClient/src/app/budget-main/budget-item-list/budget-item-card/budget-item-card.component.html +++ b/PratikForumClient/src/app/budget-main/budget-item-list/budget-item-card/budget-item-card.component.html @@ -1,5 +1,7 @@
-
+

{{item.description}}

diff --git a/PratikForumClient/src/app/budget-main/budget-item-list/budget-item-card/budget-item-card.component.ts b/PratikForumClient/src/app/budget-main/budget-item-list/budget-item-card/budget-item-card.component.ts index 2f3e2b0..c979230 100644 --- a/PratikForumClient/src/app/budget-main/budget-item-list/budget-item-card/budget-item-card.component.ts +++ b/PratikForumClient/src/app/budget-main/budget-item-list/budget-item-card/budget-item-card.component.ts @@ -9,6 +9,7 @@ import { BudgetItem } from 'src/app/models/budget-item.model'; export class BudgetItemCardComponent implements OnInit { @Input() item: BudgetItem; @Output() removeItem: EventEmitter = new EventEmitter(); + @Output() selectItem: EventEmitter = new EventEmitter(); constructor() { } ngOnInit() { @@ -17,4 +18,8 @@ export class BudgetItemCardComponent implements OnInit { // emit etmeli parentine this.removeItem.emit(rItem); } + onCardclick(sItem: BudgetItem) { + // emit etmeli parentine + this.selectItem.emit(sItem); + } } diff --git a/PratikForumClient/src/app/budget-main/budget-item-list/budget-item-list.component.html b/PratikForumClient/src/app/budget-main/budget-item-list/budget-item-list.component.html index 681da19..80bfde1 100644 --- a/PratikForumClient/src/app/budget-main/budget-item-list/budget-item-list.component.html +++ b/PratikForumClient/src/app/budget-main/budget-item-list/budget-item-list.component.html @@ -9,6 +9,7 @@

GELİR

[item]="item" style="display: block; margin-bottom: 20px;" (removeItem)="deleteBudgetItem(item)" + (selectItem)="editBudgetItem(item)" >
@@ -22,6 +23,7 @@

GİDER

[item]="item" style="display: block; margin-bottom: 20px;" (removeItem)="deleteBudgetItem(item)" + (selectItem)="editBudgetItem(item)" >
diff --git a/PratikForumClient/src/app/budget-main/budget-item-list/budget-item-list.component.ts b/PratikForumClient/src/app/budget-main/budget-item-list/budget-item-list.component.ts index 7277c17..821772c 100644 --- a/PratikForumClient/src/app/budget-main/budget-item-list/budget-item-list.component.ts +++ b/PratikForumClient/src/app/budget-main/budget-item-list/budget-item-list.component.ts @@ -1,5 +1,7 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import { BudgetItem } from 'src/app/models/budget-item.model'; +import { MatDialog } from '@angular/material/dialog'; +import { EditItemModalComponent } from '../edit-item-modal/edit-item-modal.component'; @Component({ @@ -11,12 +13,27 @@ export class BudgetItemListComponent implements OnInit { @Input() budgetItems: BudgetItem[]; // tslint:disable-next-line: no-output-on-prefix @Output() onDeleteBudgetItem: EventEmitter = new EventEmitter(); - constructor() { } + constructor(private dialog: MatDialog) { } ngOnInit() { } + deleteBudgetItem(delBudgetItem: BudgetItem) { // burada da parentine emit etmeli this.onDeleteBudgetItem.emit(delBudgetItem); } + editBudgetItem(edBudgetItem: BudgetItem) { + console.log(edBudgetItem); + const dialogRef = this.dialog.open(EditItemModalComponent, { + width: '500px', + data: edBudgetItem + }); + + dialogRef.afterClosed().subscribe(result => { + if (result) { + // güncelleme + this.budgetItems[this.budgetItems.indexOf(edBudgetItem)] = result; + } + }); + } } diff --git a/PratikForumClient/src/app/budget-main/budget-main.component.ts b/PratikForumClient/src/app/budget-main/budget-main.component.ts index 82df446..0fb3978 100644 --- a/PratikForumClient/src/app/budget-main/budget-main.component.ts +++ b/PratikForumClient/src/app/budget-main/budget-main.component.ts @@ -17,7 +17,6 @@ export class BudgetMainComponent implements OnInit { this.budgetItems.push(newItem); } deleteItem(delItem: BudgetItem) { - console.log('budgetMain', delItem); const index = this.budgetItems.indexOf(delItem); this.budgetItems.splice(index, 1); } diff --git a/PratikForumClient/src/app/budget-main/edit-item-modal/edit-item-modal.component.html b/PratikForumClient/src/app/budget-main/edit-item-modal/edit-item-modal.component.html index 87144bb..fd59821 100644 --- a/PratikForumClient/src/app/budget-main/edit-item-modal/edit-item-modal.component.html +++ b/PratikForumClient/src/app/budget-main/edit-item-modal/edit-item-modal.component.html @@ -1,2 +1,3 @@

Düzenle

- \ No newline at end of file + \ No newline at end of file diff --git a/PratikForumClient/src/app/budget-main/edit-item-modal/edit-item-modal.component.ts b/PratikForumClient/src/app/budget-main/edit-item-modal/edit-item-modal.component.ts index 917e638..3d6bdfe 100644 --- a/PratikForumClient/src/app/budget-main/edit-item-modal/edit-item-modal.component.ts +++ b/PratikForumClient/src/app/budget-main/edit-item-modal/edit-item-modal.component.ts @@ -1,5 +1,6 @@ -import { Component, OnInit, Input } from '@angular/core'; +import { Component, OnInit, Input, Inject } from '@angular/core'; import { BudgetItem } from 'src/app/models/budget-item.model'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; @Component({ selector: 'app-edit-item-modal', @@ -7,12 +8,13 @@ import { BudgetItem } from 'src/app/models/budget-item.model'; styleUrls: ['./edit-item-modal.component.css'] }) export class EditItemModalComponent implements OnInit { - @Input() item: BudgetItem; - constructor() { } + constructor(public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public item: BudgetItem + ) { } ngOnInit() { } - onsubmitted(updatedItem: BudgetItem) { - + onSubmitted(updatedItem: BudgetItem) { + this.dialogRef.close(updatedItem); } } diff --git a/PratikForumClient/src/index.html b/PratikForumClient/src/index.html index 75e3e22..38c74c6 100644 --- a/PratikForumClient/src/index.html +++ b/PratikForumClient/src/index.html @@ -7,6 +7,8 @@ + + diff --git a/PratikForumClient/src/main.ts b/PratikForumClient/src/main.ts index c7b673c..3b2b7d0 100644 --- a/PratikForumClient/src/main.ts +++ b/PratikForumClient/src/main.ts @@ -1,3 +1,4 @@ +import 'hammerjs'; import { enableProdMode } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; diff --git a/PratikForumClient/src/styles.css b/PratikForumClient/src/styles.css index bea7b07..7eb6468 100644 --- a/PratikForumClient/src/styles.css +++ b/PratikForumClient/src/styles.css @@ -1,3 +1,4 @@ + .grid-table { display:table; @@ -47,4 +48,6 @@ input.ng-invalid.ng-touched,select.ng-invalid.ng-touched{ @keyframes fadeinout { 50% { opacity: 1; } -} \ No newline at end of file +} +html, body { height: 100%; } +body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }