add load from select save

This commit is contained in:
pakintada@gmail.com 2023-12-27 08:38:14 +07:00
parent f721517f25
commit 17030c72ce
10 changed files with 229 additions and 53 deletions

View file

@ -122,40 +122,40 @@ export class RecipeDetailsComponent implements OnInit {
// get username
let username:string = ""
this._userService.currentUser.pipe(map((user) => {
if (user)
username = user.name;
let to_send = {
edit_by: username,
commit_msg: this.commit_msg,
productCode: this.productCode,
name: this.recipeDetailForm.getRawValue().name,
otherName: this.recipeDetailForm.getRawValue().otherName,
Description: this.recipeDetailForm.getRawValue().Description,
otherDescription: this.recipeDetailForm.getRawValue().otherDescription,
LastChange: this.recipeDetailForm.getRawValue().lastModified,
price: this.recipeDetailForm.getRawValue().price,
// isUse: this,
// isShow: null,
// disable: null,
recipes: [
...this.repl
],
username = this._userService.getCurrentUser()!.name;
let to_send = {
edit_by: username,
commit_msg: this.commit_msg,
productCode: this.productCode,
name: this.recipeDetailForm.getRawValue().name != this.recipeOriginalDetail.name ? this.recipeDetailForm.getRawValue().name : this.recipeOriginalDetail.name,
otherName: this.recipeDetailForm.getRawValue().otherName != this.recipeOriginalDetail.otherName ? this.recipeDetailForm.getRawValue().otherName : this.recipeOriginalDetail.otherName,
Description: this.recipeDetailForm.getRawValue().Description != this.recipeOriginalDetail.Description ? this.recipeDetailForm.getRawValue().Description : this.recipeOriginalDetail.Description,
otherDescription: this.recipeDetailForm.getRawValue().otherDescription != this.recipeOriginalDetail.otherDescription ? this.recipeDetailForm.getRawValue().otherDescription : this.recipeOriginalDetail.otherDescription,
LastChange: this.recipeDetailForm.getRawValue().lastModified != this.recipeOriginalDetail.lastModified ? this.recipeDetailForm.getRawValue().lastModified : this.recipeOriginalDetail.lastModified,
price: this.recipeDetailForm.getRawValue().price != this.recipeOriginalDetail.price ? this.recipeDetailForm.getRawValue().price : this.recipeOriginalDetail.price,
// isUse: this,
// isShow: null,
// disable: null,
recipes: [
...(this.repl.length <= 0 ? [] : this.repl)
],
}
// TODO: update value in targeted recipe
console.log('to_send', to_send);
this._recipeService.editChanges(
this._recipeService.getCurrentCountry(),
this._recipeService.getCurrentFile(),
{
...to_send,
}
// TODO: update value in targeted recipe
this._recipeService.editChanges(
this._recipeService.getCurrentCountry(),
this._recipeService.getCurrentFile(),
{
...to_send,
}
);
console.log('Sending changes');
void this._router.navigate(['/'+this.department+'/recipes']);
}))
);
console.log('Sending changes');
void this._router.navigate(['/'+this.department+'/recipes']);
@ -194,11 +194,11 @@ export class RecipeDetailsComponent implements OnInit {
isValueChanged: boolean = false;
onRecipeDetailFormChange(recipeDetail: typeof this.recipeDetailForm.value) {
console.log('Recipe Detail Form Changed', recipeDetail);
// console.log('Recipe Detail Form Changed', recipeDetail);
}
onRecipeListFormChange(repl: unknown[]) {
console.log('Recipe List Form Changed', repl);
// console.log('Recipe List Form Changed', repl);
this.repl = repl as never[];
this.isValueChanged ||= repl != undefined;
}