connect api to stock page for get, patch and delete
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import { Component } from '@angular/core';
|
||||
import {Component, inject, viewChild} from '@angular/core';
|
||||
import {StockTable} from "../../components/stock-table/stock-table";
|
||||
import {Search} from "../../components/search/search";
|
||||
import {ModalButton} from "../../components/modal-button/modal-button";
|
||||
import {PurchaseOrderForm} from "../../components/purchase-order-form/purchase-order-form";
|
||||
import {QuotationForm} from "../../components/quotation-form/quotation-form";
|
||||
import {ProductsService} from "../../services/api";
|
||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||
import {firstValueFrom} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'app-stock',
|
||||
@@ -19,10 +22,56 @@ import {QuotationForm} from "../../components/quotation-form/quotation-form";
|
||||
})
|
||||
|
||||
export class Stock {
|
||||
modal = viewChild.required<ModalButton>('modalButton');
|
||||
createQuotation = viewChild.required<QuotationForm>('quotationForm');
|
||||
createPurchaseOrder = viewChild.required<PurchaseOrderForm>('purchaseOrderForm');
|
||||
productTable = viewChild.required<StockTable>('stockTable');
|
||||
private productsService = inject(ProductsService);
|
||||
private notificationService = inject(NzNotificationService)
|
||||
|
||||
// async onModalOk() {
|
||||
// await this.addSupplier()
|
||||
// this.createSupplier().supplierForm.reset();
|
||||
// this.modal().isVisible = false;
|
||||
// await this.supplierTable().fetchSuppliers()
|
||||
// }
|
||||
//
|
||||
// onModalCancel() {
|
||||
// this.modal().isVisible = false;
|
||||
// }
|
||||
//
|
||||
// async addSupplier() {
|
||||
// if (this.createSupplier().supplierForm.invalid)
|
||||
// {
|
||||
// this.notificationService.error(
|
||||
// 'Erreur',
|
||||
// 'Erreur d\'écriture dans le formulaire'
|
||||
// )
|
||||
// }
|
||||
// try {
|
||||
// const suppliers = this.createSupplier().supplierForm.getRawValue();
|
||||
// await firstValueFrom(this.usersService.createSupplierEndpoint(suppliers))
|
||||
//
|
||||
// this.notificationService.success(
|
||||
// 'Success',
|
||||
// 'Fournisseur enregistré'
|
||||
// )
|
||||
// } catch (e) {
|
||||
// this.notificationService.error(
|
||||
// 'Erreur',
|
||||
// 'Erreur d\'enregistrement'
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
|
||||
hasSelection = false;
|
||||
|
||||
onSelectionChange(value: boolean) {
|
||||
this.hasSelection = value;
|
||||
}
|
||||
|
||||
test(){
|
||||
console.log(this.productTable().selectedIds);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user