|
@@ -12,7 +12,6 @@ import { Food } from 'src/interfaces/food';
|
|
|
import { SimpleItemDetailsComponent } from './simple-item-details/simple-item-details.component';
|
|
|
import { ModalService } from 'src/services/modal/modal.service';
|
|
|
import { SimpleItemModalComponent } from './simple-item-modal/simple-item-modal.component';
|
|
|
-import { FoodDetailsComponent } from './food-details/food-details.component';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-journal-inventory',
|
|
@@ -100,25 +99,6 @@ export class JournalInventoryComponent {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- public openFoodDetails(index: number): void {
|
|
|
- this.detailsAccessor.openPanel(FoodDetailsComponent, {
|
|
|
- item: this.food[index],
|
|
|
- });
|
|
|
- const resultSubscription = this.detailsAccessor.result$.subscribe(
|
|
|
- (result) => {
|
|
|
- if (result.state === 'delete') {
|
|
|
- this.food.splice(index, 1);
|
|
|
- this.dataAccessor.food = this.food;
|
|
|
- } else if (result.state === 'update') {
|
|
|
- this.openFoodModal(true, index);
|
|
|
- } else if (result.state === 'cancel') {
|
|
|
- // Do nothing
|
|
|
- }
|
|
|
- resultSubscription.unsubscribe();
|
|
|
- }
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
public openFoodModal(isUpdate: boolean, index?: number): void {
|
|
|
this.modalAccessor.openModal(SimpleItemModalComponent, {
|
|
|
item:
|
|
@@ -198,6 +178,8 @@ export class JournalInventoryComponent {
|
|
|
this.dataAccessor.consumables = this.consumables;
|
|
|
} else if (listname === 'miscellaneous') {
|
|
|
this.dataAccessor.miscellaneous = this.miscellaneous;
|
|
|
+ } else if (listname === 'food') {
|
|
|
+ this.dataAccessor.food = this.food;
|
|
|
}
|
|
|
this.updateWeight();
|
|
|
}
|