add edit json v1 WIP, testing

This commit is contained in:
pakintada@gmail.com 2023-10-20 14:32:16 +07:00
parent e5eee656d5
commit ea92145350
11 changed files with 216 additions and 67 deletions

View file

@ -182,6 +182,14 @@ export class RecipeDetailsComponent implements OnInit {
message: 'Do you want to save changes?',
confirmCallBack: () => {
console.log('confirm save');
// TODO: update value in targeted recipe
this._recipeService.editChanges(
this._recipeService.getCurrentVersion(),
{
...this.recipeDetail
}
);
console.log("Sending changes")
this._router.navigate(['/recipes']);
},
};

View file

@ -191,4 +191,6 @@
</div>
</div>
</div>
<button class="btn btn-circle fixed z-100 bottom-5 right-1" (click)="scrollToTop()">^</button>
</main>

View file

@ -43,7 +43,12 @@ export class DashboardComponent implements OnInit {
private searchStr = '';
private oldSearchStr = '';
tableCtx?: ElementRef;
@ViewChild('table', { static: false }) set content(table: ElementRef) {
// expose element ref for other fn
this.tableCtx = table;
table.nativeElement.addEventListener(
'scroll',
() => {
@ -202,4 +207,8 @@ export class DashboardComponent implements OnInit {
'_blank'
);
}
scrollToTop() {
this.tableCtx!.nativeElement.scroll;
}
}