Compare commits
6 Commits
750a0da817
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| cb4686765b | |||
| 5e039281de | |||
| 8b7d48779e | |||
| 9ebe8ab37e | |||
| 8124d83e79 | |||
| 22e50a8dea |
@@ -0,0 +1,36 @@
|
|||||||
|
<form [formGroup]="createPurchaseOrderForm">
|
||||||
|
<nz-form-item nz-flex>
|
||||||
|
<nz-form-label nzSpan="12" nzRequired>
|
||||||
|
Conditions générales de vente
|
||||||
|
</nz-form-label>
|
||||||
|
|
||||||
|
<nz-form-control nzSpan="12" nzErrorTip="Ce champ est requis">
|
||||||
|
<input nz-input placeholder="Conditions générales de vente" formControlName="purchaseConditions">
|
||||||
|
</nz-form-control>
|
||||||
|
</nz-form-item>
|
||||||
|
|
||||||
|
<div class="overflow-x-auto">
|
||||||
|
<nz-table [nzBordered]="true" class="mx-auto text-center">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="text-center">Produit</th>
|
||||||
|
<th class="text-center">Quantité</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody formArrayName="lines">
|
||||||
|
@for (line of lines.controls.slice(); let i = $index; track i) {
|
||||||
|
<tr [formGroupName]="i" class="text-center">
|
||||||
|
<td class="text-center">{{ line.value.name }}</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<nz-input-number
|
||||||
|
formControlName="quantity"
|
||||||
|
[nzMin]="1"
|
||||||
|
[nzStep]="1">
|
||||||
|
</nz-input-number>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</nz-table>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import {FormBuilder, FormGroup, FormArray, Validators, ReactiveFormsModule, FormControl} from '@angular/forms';
|
||||||
|
import { GetProductDto } from '../../services/api';
|
||||||
|
import {NzTableComponent} from "ng-zorro-antd/table";
|
||||||
|
import {NzInputNumberComponent} from "ng-zorro-antd/input-number";
|
||||||
|
import {NzColDirective} from "ng-zorro-antd/grid";
|
||||||
|
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
||||||
|
import {NzFormControlComponent, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
||||||
|
import {NzInputDirective} from "ng-zorro-antd/input";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-create-purchaseorder-form',
|
||||||
|
templateUrl: './create-purchaseorder-form.html',
|
||||||
|
styleUrl: './create-purchaseorder-form.css',
|
||||||
|
imports: [
|
||||||
|
ReactiveFormsModule,
|
||||||
|
NzTableComponent,
|
||||||
|
NzInputNumberComponent,
|
||||||
|
NzColDirective,
|
||||||
|
NzFlexDirective,
|
||||||
|
NzFormControlComponent,
|
||||||
|
NzFormItemComponent,
|
||||||
|
NzFormLabelComponent,
|
||||||
|
NzInputDirective,
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class CreatePurchaseorderForm {
|
||||||
|
createPurchaseOrderForm: FormGroup
|
||||||
|
|
||||||
|
constructor(private fb: FormBuilder) {
|
||||||
|
this.createPurchaseOrderForm = this.fb.group({
|
||||||
|
purchaseConditions: new FormControl<string | null>(null, Validators.required),
|
||||||
|
lines: this.fb.array([])
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get lines(): FormArray {
|
||||||
|
return this.createPurchaseOrderForm.get('lines') as FormArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ajouter des produits sélectionnés dans le formulaire
|
||||||
|
syncSelectedProducts(selectedProducts: GetProductDto[]) {
|
||||||
|
this.lines.clear();
|
||||||
|
selectedProducts.forEach(p => {
|
||||||
|
this.lines.push(this.fb.group({
|
||||||
|
productId: [p.id],
|
||||||
|
name: [p.name],
|
||||||
|
quantity: [1, [Validators.required, Validators.min(1)]]
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<form [formGroup]="createQuotationForm">
|
||||||
|
<nz-form-item nz-flex>
|
||||||
|
<nz-form-label nzSpan="12" nzRequired>
|
||||||
|
Message
|
||||||
|
</nz-form-label>
|
||||||
|
|
||||||
|
<nz-form-control nzSpan="12" nzErrorTip="Ce champ est requis">
|
||||||
|
<input nz-input placeholder="Message" formControlName="message">
|
||||||
|
</nz-form-control>
|
||||||
|
</nz-form-item>
|
||||||
|
|
||||||
|
<nz-form-item nz-flex>
|
||||||
|
<nz-form-label nzSpan="12" nzRequired>
|
||||||
|
Conditions générales
|
||||||
|
</nz-form-label>
|
||||||
|
|
||||||
|
<nz-form-control nzSpan="12" nzErrorTip="Ce champ est requis">
|
||||||
|
<input nz-input placeholder="Conditions générales de vente" formControlName="purchaseConditions">
|
||||||
|
</nz-form-control>
|
||||||
|
</nz-form-item>
|
||||||
|
|
||||||
|
<div class="overflow-x-auto">
|
||||||
|
<nz-table [nzBordered]="true" class="mx-auto text-center">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="text-center">Produit</th>
|
||||||
|
<th class="text-center">Quantité</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody formArrayName="lines">
|
||||||
|
@for (line of lines.controls.slice(); let i = $index; track i) {
|
||||||
|
<tr [formGroupName]="i" class="text-center">
|
||||||
|
<td class="text-center">{{ line.value.name }}</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<nz-input-number
|
||||||
|
formControlName="quantity"
|
||||||
|
[nzMin]="1"
|
||||||
|
[nzStep]="1">
|
||||||
|
</nz-input-number>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</nz-table>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import {
|
||||||
|
FormArray,
|
||||||
|
FormBuilder,
|
||||||
|
FormControl,
|
||||||
|
FormGroup,
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
Validators
|
||||||
|
} from "@angular/forms";
|
||||||
|
import {NzColDirective} from "ng-zorro-antd/grid";
|
||||||
|
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
||||||
|
import {NzFormControlComponent, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
||||||
|
import {NzInputDirective} from "ng-zorro-antd/input";
|
||||||
|
import {NzInputNumberComponent} from "ng-zorro-antd/input-number";
|
||||||
|
import {NzTableComponent} from "ng-zorro-antd/table";
|
||||||
|
import {GetProductDto} from "../../services/api";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-create-quotation-form',
|
||||||
|
imports: [
|
||||||
|
FormsModule,
|
||||||
|
NzColDirective,
|
||||||
|
NzFlexDirective,
|
||||||
|
NzFormControlComponent,
|
||||||
|
NzFormItemComponent,
|
||||||
|
NzFormLabelComponent,
|
||||||
|
NzInputDirective,
|
||||||
|
NzInputNumberComponent,
|
||||||
|
NzTableComponent,
|
||||||
|
ReactiveFormsModule
|
||||||
|
],
|
||||||
|
templateUrl: './create-quotation-form.html',
|
||||||
|
styleUrl: './create-quotation-form.css',
|
||||||
|
})
|
||||||
|
export class CreateQuotationForm {
|
||||||
|
createQuotationForm: FormGroup
|
||||||
|
|
||||||
|
constructor(private fb: FormBuilder) {
|
||||||
|
this.createQuotationForm = this.fb.group({
|
||||||
|
message: new FormControl<string>(null, Validators.required),
|
||||||
|
purchaseConditions: new FormControl<string>(null, Validators.required),
|
||||||
|
lines: this.fb.array([])
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get lines(): FormArray {
|
||||||
|
return this.createQuotationForm.get('lines') as FormArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ajouter des produits sélectionnés dans le formulaire
|
||||||
|
syncSelectedProducts(selectedProducts: GetProductDto[]) {
|
||||||
|
this.lines.clear();
|
||||||
|
selectedProducts.forEach(p => {
|
||||||
|
this.lines.push(this.fb.group({
|
||||||
|
productId: [p.id],
|
||||||
|
name: [p.name],
|
||||||
|
quantity: [1, [Validators.required, Validators.min(1)]]
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -63,8 +63,8 @@ export class DelivereryNoteForm implements OnInit {
|
|||||||
this.deliveryNoteForm.patchValue({
|
this.deliveryNoteForm.patchValue({
|
||||||
trackingNumber: this.deliveryNote().trackingNumber,
|
trackingNumber: this.deliveryNote().trackingNumber,
|
||||||
expeditionDate: this.deliveryNote().expeditionDate,
|
expeditionDate: this.deliveryNote().expeditionDate,
|
||||||
realDeliveryDate: this.deliveryNote().expeditionDate,
|
realDeliveryDate: this.deliveryNote().realDeliveryDate,
|
||||||
estimatedDate: this.deliveryNote().expeditionDate,
|
estimatedDate: this.deliveryNote().estimateDeliveryDate,
|
||||||
delivererId: this.deliveryNote().delivererId
|
delivererId: this.deliveryNote().delivererId
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
<th>Date d'expédition</th>
|
<th>Date d'expédition</th>
|
||||||
<th>Date de livraison estimée</th>
|
<th>Date de livraison estimée</th>
|
||||||
<th>Date de livraison réelle</th>
|
<th>Date de livraison réelle</th>
|
||||||
<th>Produits</th>
|
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead >
|
</thead >
|
||||||
@@ -21,31 +20,6 @@
|
|||||||
<td>{{deliveryNote.expeditionDate | date: 'dd/MM/yyyy'}}</td>
|
<td>{{deliveryNote.expeditionDate | date: 'dd/MM/yyyy'}}</td>
|
||||||
<td>{{deliveryNote.estimateDeliveryDate | date: 'dd/MM/yyyy'}}</td>
|
<td>{{deliveryNote.estimateDeliveryDate | date: 'dd/MM/yyyy'}}</td>
|
||||||
<td>{{deliveryNote.realDeliveryDate | date: 'dd/MM/yyyy'}}</td>
|
<td>{{deliveryNote.realDeliveryDate | date: 'dd/MM/yyyy'}}</td>
|
||||||
<td>
|
|
||||||
<app-modal-button type="link" name="Voir les produits" size="40%">
|
|
||||||
<div style="max-height: 400px; overflow-y: auto;">
|
|
||||||
<nz-table [nzData]="deliveryNotes()"
|
|
||||||
[nzFrontPagination]="false">
|
|
||||||
<thead>
|
|
||||||
<tr class="text-center">
|
|
||||||
<th>Réference</th>
|
|
||||||
<th>Nom</th>
|
|
||||||
<th>Quantité</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody class="text-center">
|
|
||||||
@for (product of deliveryNote.products; track product.productId) {
|
|
||||||
<tr>
|
|
||||||
<td>{{product.productReference}}</td>
|
|
||||||
<td>{{product.productName}}</td>
|
|
||||||
<td>{{product.quantity}}</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</nz-table>
|
|
||||||
</div>
|
|
||||||
</app-modal-button>
|
|
||||||
</td>
|
|
||||||
<td>
|
<td>
|
||||||
<div style="justify-content: center; display: flex">
|
<div style="justify-content: center; display: flex">
|
||||||
<nz-icon nzType="check" nzTheme="outline" (click)="validate(deliveryNote.id)" class="cursor-pointer text-green-700"/>
|
<nz-icon nzType="check" nzTheme="outline" (click)="validate(deliveryNote.id)" class="cursor-pointer text-green-700"/>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import {Component, inject, OnInit, signal, viewChild} from '@angular/core';
|
import {Component, inject, OnInit, signal, viewChild} from '@angular/core';
|
||||||
import {DatePipe} from "@angular/common";
|
import {DatePipe} from "@angular/common";
|
||||||
import {ModalButton} from "../modal-button/modal-button";
|
|
||||||
import {ModalNav} from "../modal-nav/modal-nav";
|
import {ModalNav} from "../modal-nav/modal-nav";
|
||||||
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
||||||
import {NzIconDirective} from "ng-zorro-antd/icon";
|
import {NzIconDirective} from "ng-zorro-antd/icon";
|
||||||
@@ -15,7 +14,6 @@ import {FileService} from "../../services/file.service";
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-deliverery-note-table',
|
selector: 'app-deliverery-note-table',
|
||||||
imports: [
|
imports: [
|
||||||
ModalButton,
|
|
||||||
ModalNav,
|
ModalNav,
|
||||||
NzDividerComponent,
|
NzDividerComponent,
|
||||||
NzIconDirective,
|
NzIconDirective,
|
||||||
@@ -41,7 +39,7 @@ export class DelivereryNoteTable implements OnInit {
|
|||||||
async fetchDeliveryNotes() {
|
async fetchDeliveryNotes() {
|
||||||
this.deliveryNotesLoading.set(true)
|
this.deliveryNotesLoading.set(true)
|
||||||
try {
|
try {
|
||||||
const deliveryNotes = await firstValueFrom(this.deliveryNotesService.getAllDeliveryNoteEndpoint())
|
const deliveryNotes = await firstValueFrom(this.deliveryNotesService.getAllDeliveryNoteEndpoint());
|
||||||
this.deliveryNotes.set(deliveryNotes);
|
this.deliveryNotes.set(deliveryNotes);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.notificationService.error(
|
this.notificationService.error(
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
</nz-form-label>
|
</nz-form-label>
|
||||||
|
|
||||||
<nz-form-control nzSpan="12" nzErrorTip="Ce champ est requis">
|
<nz-form-control nzSpan="12" nzErrorTip="Ce champ est requis">
|
||||||
<input nz-input placeholder="Conditions générales de vente" formControlName="purchaseCondition">
|
<input nz-input placeholder="Conditions générales de vente" formControlName="purchaseConditions">
|
||||||
</nz-form-control>
|
</nz-form-control>
|
||||||
</nz-form-item>
|
</nz-form-item>
|
||||||
</form>
|
</form>
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
import { Component } from '@angular/core';
|
import {Component, effect, input} from '@angular/core';
|
||||||
import {FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators} from "@angular/forms";
|
import {FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators} from "@angular/forms";
|
||||||
import {NzColDirective} from "ng-zorro-antd/grid";
|
import {NzColDirective} from "ng-zorro-antd/grid";
|
||||||
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
||||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
||||||
import {NzInputDirective} from "ng-zorro-antd/input";
|
import {NzInputDirective} from "ng-zorro-antd/input";
|
||||||
|
import {GetPurchaseOrderDto} from "../../services/api";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-purchase-order-form',
|
selector: 'app-purchase-order-form',
|
||||||
@@ -23,6 +24,17 @@ import {NzInputDirective} from "ng-zorro-antd/input";
|
|||||||
})
|
})
|
||||||
export class PurchaseOrderForm {
|
export class PurchaseOrderForm {
|
||||||
purchaseOrderForm: FormGroup = new FormGroup({
|
purchaseOrderForm: FormGroup = new FormGroup({
|
||||||
purchaseCondition: new FormControl<string>(null,[Validators.required])
|
purchaseConditions: new FormControl<string>(null,[Validators.required])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
purchaseOrder= input<GetPurchaseOrderDto>();
|
||||||
|
constructor() {
|
||||||
|
effect(() => {
|
||||||
|
if (this.purchaseOrder()) {
|
||||||
|
this.purchaseOrderForm.patchValue({
|
||||||
|
purchaseConditions: this.purchaseOrder().purchaseConditions,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="text-center">
|
<tbody class="text-center">
|
||||||
@for (product of purchaseOrder.getPurchaseProductDto; track product.productId) {
|
@for (product of purchaseOrder.products; track product.productId) {
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{product.productName}}</td>
|
<td>{{product.productName}}</td>
|
||||||
<td>{{product.productReferences}}</td>
|
<td>{{product.productReferences}}</td>
|
||||||
@@ -40,9 +40,9 @@
|
|||||||
<td>{{product.quantity}}</td>
|
<td>{{product.quantity}}</td>
|
||||||
<td>
|
<td>
|
||||||
<div style="justify-content: center; display: flex">
|
<div style="justify-content: center; display: flex">
|
||||||
<div>
|
<nz-icon nzType="edit" nzTheme="outline" class="cursor-pointer" (click)="openEditQuantityModal(product)"></nz-icon>
|
||||||
<nz-icon nzType="delete" nzTheme="outline" class="cursor-pointer text-red-700"/>
|
<nz-divider nzType="vertical"></nz-divider>
|
||||||
</div>
|
<nz-icon nzType="delete" nzTheme="outline" class="cursor-pointer text-red-700" (click)="deleteProduct(product.productId, purchaseOrder.id)"/>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -54,28 +54,30 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div style="justify-content: center; display: flex">
|
<div style="justify-content: center; display: flex">
|
||||||
<div>
|
<nz-icon nzType="plus-circle" nzTheme="outline" class="cursor-pointer text-green-700"/>
|
||||||
<nz-icon nzType="plus-circle" nzTheme="outline" (click)="delete(purchaseOrder.id)" class="cursor-pointer text-green-700"/>
|
|
||||||
</div>
|
|
||||||
<nz-divider nzType="vertical"></nz-divider>
|
<nz-divider nzType="vertical"></nz-divider>
|
||||||
<app-modal-nav nameIcon="edit" name="Modification des conditions de vente" class="cursor-pointer">
|
<nz-icon nzType="edit" nzTheme="outline" class="cursor-pointer" (click)="openEditModal(purchaseOrder)"></nz-icon>
|
||||||
<app-purchase-order-form></app-purchase-order-form>
|
|
||||||
</app-modal-nav>
|
|
||||||
<nz-divider nzType="vertical"></nz-divider>
|
<nz-divider nzType="vertical"></nz-divider>
|
||||||
<div>
|
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(purchaseOrder.id)" class="cursor-pointer text-red-700"/>
|
||||||
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(purchaseOrder.id)" class="cursor-pointer text-red-700"/>
|
|
||||||
</div>
|
|
||||||
<nz-divider nzType="vertical"></nz-divider>
|
<nz-divider nzType="vertical"></nz-divider>
|
||||||
<div>
|
<nz-icon nzType="export" nzTheme="outline" (click)="export(purchaseOrder.id)" class="cursor-pointer text-green-700"/>
|
||||||
<nz-icon nzType="export" nzTheme="outline" (click)="export(purchaseOrder.id)" class="cursor-pointer text-green-700"/>
|
|
||||||
</div>
|
|
||||||
<nz-divider nzType="vertical"></nz-divider>
|
<nz-divider nzType="vertical"></nz-divider>
|
||||||
<div>
|
<nz-icon nzType="interaction" nzTheme="outline" (click)="transfer(purchaseOrder)" class="cursor-pointer text-blue-700"/>
|
||||||
<nz-icon nzType="interaction" nzTheme="outline" (click)="transfer()" class="cursor-pointer text-blue-700"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
</nz-table>
|
</nz-table>
|
||||||
|
|
||||||
|
<div class="hidden">
|
||||||
|
<app-modal-nav #modalNav nameIcon="edit" [name]="'Modification des conditions de vente'" (ok)="onModalOk(selectedPurchaseOrder.id, purchaseOrderForm, modalNav)" (cancel)="onModalCancel(modalNav)">
|
||||||
|
<app-purchase-order-form #purchaseOrderForm [purchaseOrder]="selectedPurchaseOrder"></app-purchase-order-form>
|
||||||
|
</app-modal-nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="hidden">
|
||||||
|
<app-modal-nav #modalQuantity nameIcon="edit" [name]="'Modification de la quantité'" (ok)="onModalQuantityOk(selectedQuantity.productId, selectedQuantity.purchaseOrderId, quantityForm, modalQuantity)" (cancel)="onModalCancel(modalQuantity)">
|
||||||
|
<app-quantity-form #quantityForm [quantity]="selectedQuantity"></app-quantity-form>
|
||||||
|
</app-modal-nav>
|
||||||
|
</div>
|
||||||
@@ -1,14 +1,24 @@
|
|||||||
import {Component, inject, OnInit, signal} from '@angular/core';
|
import {Component, inject, OnInit, signal, viewChild} from '@angular/core';
|
||||||
import {ModalNav} from "../modal-nav/modal-nav";
|
import {ModalNav} from "../modal-nav/modal-nav";
|
||||||
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
||||||
import {NzIconDirective} from "ng-zorro-antd/icon";
|
import {NzIconDirective} from "ng-zorro-antd/icon";
|
||||||
import {NzTableComponent} from "ng-zorro-antd/table";
|
import {NzTableComponent} from "ng-zorro-antd/table";
|
||||||
import {PurchaseOrderForm} from "../purchase-order-form/purchase-order-form";
|
import {PurchaseOrderForm} from "../purchase-order-form/purchase-order-form";
|
||||||
import {ModalButton} from "../modal-button/modal-button";
|
import {ModalButton} from "../modal-button/modal-button";
|
||||||
import {GetPurchaseOrderDto, PurchaseordersService} from "../../services/api";
|
import {
|
||||||
|
CreateDeliveryNoteDto,
|
||||||
|
DeliverynotesService,
|
||||||
|
GetDeliveryNoteDto, GetProductDeliveryDto,
|
||||||
|
GetPurchaseOrderDto,
|
||||||
|
GetPurchaseProductDto,
|
||||||
|
PurchaseordersService,
|
||||||
|
PurchaseproductsService
|
||||||
|
} from "../../services/api";
|
||||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||||
import {firstValueFrom} from "rxjs";
|
import {firstValueFrom} from "rxjs";
|
||||||
import {FileService} from "../../services/file.service";
|
import {FileService} from "../../services/file.service";
|
||||||
|
import {QuantityForm} from "../quantity-form/quantity-form";
|
||||||
|
import {PurchaseOrder} from "../../pages/purchase-order/purchase-order";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-purchase-order-table',
|
selector: 'app-purchase-order-table',
|
||||||
@@ -19,6 +29,7 @@ import {FileService} from "../../services/file.service";
|
|||||||
NzTableComponent,
|
NzTableComponent,
|
||||||
PurchaseOrderForm,
|
PurchaseOrderForm,
|
||||||
ModalButton,
|
ModalButton,
|
||||||
|
QuantityForm,
|
||||||
],
|
],
|
||||||
templateUrl: './purchase-order-table.html',
|
templateUrl: './purchase-order-table.html',
|
||||||
styleUrl: './purchase-order-table.css',
|
styleUrl: './purchase-order-table.css',
|
||||||
@@ -27,8 +38,12 @@ export class PurchaseOrderTable implements OnInit {
|
|||||||
private purchaseOrdersService = inject(PurchaseordersService);
|
private purchaseOrdersService = inject(PurchaseordersService);
|
||||||
private notificationService = inject(NzNotificationService);
|
private notificationService = inject(NzNotificationService);
|
||||||
private fileService = inject(FileService);
|
private fileService = inject(FileService);
|
||||||
|
private purchaseProductService = inject(PurchaseproductsService);
|
||||||
|
private deliveryNoteService = inject(DeliverynotesService);
|
||||||
purchaseOrders = signal<GetPurchaseOrderDto[]>([]);
|
purchaseOrders = signal<GetPurchaseOrderDto[]>([]);
|
||||||
purchaseOrdersLoading = signal<boolean>(false);
|
purchaseOrdersLoading = signal<boolean>(false);
|
||||||
|
modal = viewChild.required<ModalNav>('modalNav');
|
||||||
|
modalQuantity = viewChild.required<ModalNav>('modalQuantity');
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
await this.fetchPurchaseOrder();
|
await this.fetchPurchaseOrder();
|
||||||
@@ -75,7 +90,6 @@ export class PurchaseOrderTable implements OnInit {
|
|||||||
);
|
);
|
||||||
this.fileService.downloadBlob(pdf)
|
this.fileService.downloadBlob(pdf)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
|
||||||
this.notificationService.error(
|
this.notificationService.error(
|
||||||
'Erreur',
|
'Erreur',
|
||||||
'Impossible de générer un PDF'
|
'Impossible de générer un PDF'
|
||||||
@@ -84,7 +98,137 @@ export class PurchaseOrderTable implements OnInit {
|
|||||||
this.purchaseOrdersLoading.set(false)
|
this.purchaseOrdersLoading.set(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
transfer() {
|
async transfer(purchaseOrder: GetPurchaseOrderDto) {
|
||||||
return
|
this.purchaseOrdersLoading.set(true);
|
||||||
|
try {
|
||||||
|
const today = new Date();
|
||||||
|
const date = today.toISOString().split('T')[0]; // yyyy-mm-dd
|
||||||
|
|
||||||
|
const futureDate = new Date(today);
|
||||||
|
futureDate.setMonth(today.getMonth() + 2);
|
||||||
|
const yyyy = futureDate.getFullYear();
|
||||||
|
const mm = (futureDate.getMonth() + 1).toString().padStart(2, '0');
|
||||||
|
const dd = futureDate.getDate().toString().padStart(2, '0');
|
||||||
|
const estimateDate = `${yyyy}-${mm}-${dd}`;
|
||||||
|
|
||||||
|
let trackingValue = 'TRK-';
|
||||||
|
const idStr = purchaseOrder.id?.toString() ?? '';
|
||||||
|
if (idStr.length < 2) trackingValue += '00' + idStr + '-' + date;
|
||||||
|
else if (idStr.length < 3) trackingValue += '0' + idStr + '-' + date;
|
||||||
|
else trackingValue += idStr.substring(0, 3) + date.replace(/-/g, '');
|
||||||
|
|
||||||
|
const productQuantities: Record<number, number> = {};
|
||||||
|
purchaseOrder.products?.forEach(p => {
|
||||||
|
if(p.productId != null && p.quantity != null) {
|
||||||
|
productQuantities[p.productId] = p.quantity;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const deliveryNoteDto: CreateDeliveryNoteDto = {
|
||||||
|
trackingNumber: trackingValue,
|
||||||
|
expeditionDate: date,
|
||||||
|
estimateDeliveryDate: estimateDate,
|
||||||
|
delivererId: 1,
|
||||||
|
productQuantities: productQuantities
|
||||||
|
};
|
||||||
|
|
||||||
|
await firstValueFrom(this.deliveryNoteService.createDeliveryNoteEndpoint(deliveryNoteDto));
|
||||||
|
this.notificationService.success('Succès', 'Bon de livraison créé avec succès');
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
this.notificationService.error('Erreur', 'Erreur lors du transfert');
|
||||||
|
}
|
||||||
|
this.purchaseOrdersLoading.set(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async edit(id: number, updatePurchaseOrderComponent: PurchaseOrderForm) {
|
||||||
|
if (updatePurchaseOrderComponent.purchaseOrderForm.invalid) {
|
||||||
|
this.notificationService.error(
|
||||||
|
'Erreur',
|
||||||
|
'Erreur d\'écriture dans le formulaire'
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const purchaseOrders = updatePurchaseOrderComponent.purchaseOrderForm.getRawValue();
|
||||||
|
await firstValueFrom(this.purchaseOrdersService.patchPurchaseOrderPurchaseConditionsEndpoint(id, purchaseOrders))
|
||||||
|
|
||||||
|
this.notificationService.success('Success', 'Bon de commande modifié')
|
||||||
|
} catch (e) {
|
||||||
|
this.notificationService.error('Erreur', 'Erreur lors de la modification')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteProduct(productId: number, purchaseOrderId: number) {
|
||||||
|
this.purchaseOrdersLoading.set(true)
|
||||||
|
try {
|
||||||
|
await firstValueFrom(this.purchaseProductService.deletePurchaseProductEndpoint(productId, purchaseOrderId))
|
||||||
|
this.notificationService.success(
|
||||||
|
'Success',
|
||||||
|
'Suppression effectuée'
|
||||||
|
)
|
||||||
|
} catch (e) {
|
||||||
|
this.notificationService.error(
|
||||||
|
'Erreur',
|
||||||
|
'Impossible de supprimer la ligne'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
this.purchaseOrdersLoading.set(false)
|
||||||
|
await this.fetchPurchaseOrder();
|
||||||
|
}
|
||||||
|
|
||||||
|
async editQuantity(productId: number, purchaseOrderId: number, updateQuantityComponent: QuantityForm) {
|
||||||
|
if (updateQuantityComponent.quantityForm.invalid) {
|
||||||
|
this.notificationService.error(
|
||||||
|
'Erreur',
|
||||||
|
'Erreur d\'écriture dans le formulaire'
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const quantity = updateQuantityComponent.quantityForm.getRawValue();
|
||||||
|
await firstValueFrom(this.purchaseProductService.patchPurchaseProductQuantityEndpoint(productId, purchaseOrderId, quantity))
|
||||||
|
|
||||||
|
this.notificationService.success('Success', 'Quantité modifiée')
|
||||||
|
} catch (e) {
|
||||||
|
this.notificationService.error('Erreur', 'Erreur lors de la modification')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedPurchaseOrder: GetPurchaseOrderDto | null = null;
|
||||||
|
openEditModal(purchaseOrder: GetPurchaseOrderDto) {
|
||||||
|
this.selectedPurchaseOrder = { ...purchaseOrder };
|
||||||
|
this.modal().showModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
async onModalOk(id: number, updatePurchaseOrderComponent: PurchaseOrderForm, modal: ModalNav) {
|
||||||
|
if (!this.selectedPurchaseOrder) return;
|
||||||
|
|
||||||
|
await this.edit(id, updatePurchaseOrderComponent);
|
||||||
|
updatePurchaseOrderComponent.purchaseOrderForm.reset();
|
||||||
|
modal.isVisible = false;
|
||||||
|
await this.fetchPurchaseOrder();
|
||||||
|
}
|
||||||
|
|
||||||
|
onModalCancel(modal: ModalNav) {
|
||||||
|
modal.isVisible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedQuantity: GetPurchaseProductDto | null = null;
|
||||||
|
openEditQuantityModal(quantity: GetPurchaseProductDto) {
|
||||||
|
this.selectedQuantity = { ...quantity };
|
||||||
|
this.modalQuantity().showModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
async onModalQuantityOk(productId: number, purchaseOrderId: number, updateQuantityComponent: QuantityForm, modal: ModalNav) {
|
||||||
|
if (!this.selectedQuantity) return;
|
||||||
|
|
||||||
|
await this.editQuantity(productId, purchaseOrderId, updateQuantityComponent);
|
||||||
|
updateQuantityComponent.quantityForm.reset();
|
||||||
|
modal.isVisible = false;
|
||||||
|
await this.fetchPurchaseOrder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
0
src/app/components/quantity-form/quantity-form.css
Normal file
0
src/app/components/quantity-form/quantity-form.css
Normal file
11
src/app/components/quantity-form/quantity-form.html
Normal file
11
src/app/components/quantity-form/quantity-form.html
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<form nz-form nzLayout="horizontal" [formGroup]="quantityForm">
|
||||||
|
<nz-form-item nz-flex>
|
||||||
|
<nz-form-label nzSpan="9" nzRequired>
|
||||||
|
Quantité
|
||||||
|
</nz-form-label>
|
||||||
|
|
||||||
|
<nz-form-control nzSpan="12" nzErrorTip="Ce champ est requis">
|
||||||
|
<input nz-input type="number" placeholder="0" formControlName="quantity">
|
||||||
|
</nz-form-control>
|
||||||
|
</nz-form-item>
|
||||||
|
</form>
|
||||||
40
src/app/components/quantity-form/quantity-form.ts
Normal file
40
src/app/components/quantity-form/quantity-form.ts
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import {Component, effect, input} from '@angular/core';
|
||||||
|
import {FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators} from "@angular/forms";
|
||||||
|
import {NzColDirective} from "ng-zorro-antd/grid";
|
||||||
|
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
||||||
|
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
||||||
|
import {NzInputDirective} from "ng-zorro-antd/input";
|
||||||
|
import {GetDelivererDto, GetPurchaseProductDto} from "../../services/api";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-quantity-form',
|
||||||
|
imports: [
|
||||||
|
FormsModule,
|
||||||
|
NzColDirective,
|
||||||
|
NzFlexDirective,
|
||||||
|
NzFormControlComponent,
|
||||||
|
NzFormDirective,
|
||||||
|
NzFormItemComponent,
|
||||||
|
NzFormLabelComponent,
|
||||||
|
NzInputDirective,
|
||||||
|
ReactiveFormsModule
|
||||||
|
],
|
||||||
|
templateUrl: './quantity-form.html',
|
||||||
|
styleUrl: './quantity-form.css',
|
||||||
|
})
|
||||||
|
export class QuantityForm {
|
||||||
|
quantityForm: FormGroup = new FormGroup({
|
||||||
|
quantity: new FormControl<number>(null, [Validators.required])
|
||||||
|
})
|
||||||
|
|
||||||
|
quantity= input<GetPurchaseProductDto>();
|
||||||
|
constructor() {
|
||||||
|
effect(() => {
|
||||||
|
if (this.quantity()) {
|
||||||
|
this.quantityForm.patchValue({
|
||||||
|
quantity: this.quantity().quantity
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,15 +32,17 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="text-center">
|
<tbody class="text-center">
|
||||||
@for (product of quotation.getQuotationProductDto; track product.productId) {
|
@for (product of quotation.products; track product.productId) {
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ product.productReferences }}</td>
|
<td>{{ product.productReferences }}</td>
|
||||||
<td>{{ product.productName }}</td>
|
<td>{{ product.productName }}</td>
|
||||||
<td>Price ???</td>
|
<td>Price ???</td>
|
||||||
<td>Quantité ???</td>
|
<td>{{ product.quantity }}</td>
|
||||||
<td>
|
<td>
|
||||||
<div style="justify-content: center; display: flex">
|
<div style="justify-content: center; display: flex">
|
||||||
<nz-icon nzType="delete" nzTheme="outline" class="cursor-pointer text-red-700"/>
|
<nz-icon nzType="edit" nzTheme="outline" class="cursor-pointer" (click)="openEditQuantityModal(product)"></nz-icon>
|
||||||
|
<nz-divider nzType="vertical"></nz-divider>
|
||||||
|
<nz-icon nzType="delete" nzTheme="outline" class="cursor-pointer text-red-700" (click)="deleteProduct(product.productId, quotation.id)"/>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -70,4 +72,10 @@
|
|||||||
<app-modal-nav #modalNav nameIcon="edit" [name]="'Modification du devis'" (ok)="onModalOk(selectedQuotation.id, quotationForm, modalNav)" (cancel)="onModalCancel(modalNav)">
|
<app-modal-nav #modalNav nameIcon="edit" [name]="'Modification du devis'" (ok)="onModalOk(selectedQuotation.id, quotationForm, modalNav)" (cancel)="onModalCancel(modalNav)">
|
||||||
<app-quotation-form #quotationForm [quotation]="selectedQuotation"></app-quotation-form>
|
<app-quotation-form #quotationForm [quotation]="selectedQuotation"></app-quotation-form>
|
||||||
</app-modal-nav>
|
</app-modal-nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="hidden">
|
||||||
|
<app-modal-nav #modalQuantity nameIcon="edit" [name]="'Modification de la quantité'" (ok)="onModalQuantityOk(selectedQuantity.productId, selectedQuantity.quotationId, quantityForm, modalQuantity)" (cancel)="onModalCancel(modalQuantity)">
|
||||||
|
<app-quantity-form #quantityForm [quantity]="selectedQuantity"></app-quantity-form>
|
||||||
|
</app-modal-nav>
|
||||||
</div>
|
</div>
|
||||||
@@ -5,11 +5,16 @@ import {ModalNav} from "../modal-nav/modal-nav";
|
|||||||
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
||||||
import {NzIconDirective} from "ng-zorro-antd/icon";
|
import {NzIconDirective} from "ng-zorro-antd/icon";
|
||||||
import {QuotationForm} from "../quotation-form/quotation-form";
|
import {QuotationForm} from "../quotation-form/quotation-form";
|
||||||
import {GetQuotationDto, QuotationsService} from "../../services/api";
|
import {
|
||||||
|
GetQuotationDto,
|
||||||
|
GetQuotationProductDto,
|
||||||
|
QuotationproductsService,
|
||||||
|
QuotationsService
|
||||||
|
} from "../../services/api";
|
||||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||||
import {firstValueFrom} from "rxjs";
|
import {firstValueFrom} from "rxjs";
|
||||||
import {FileService} from "../../services/file.service";
|
import {FileService} from "../../services/file.service";
|
||||||
import {DelivereryNoteForm} from "../deliverery-note-form/deliverery-note-form";
|
import {QuantityForm} from "../quantity-form/quantity-form";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-quotation-table',
|
selector: 'app-quotation-table',
|
||||||
@@ -20,7 +25,7 @@ import {DelivereryNoteForm} from "../deliverery-note-form/deliverery-note-form";
|
|||||||
NzIconDirective,
|
NzIconDirective,
|
||||||
NzTableComponent,
|
NzTableComponent,
|
||||||
QuotationForm,
|
QuotationForm,
|
||||||
DelivereryNoteForm,
|
QuantityForm,
|
||||||
],
|
],
|
||||||
templateUrl: './quotation-table.html',
|
templateUrl: './quotation-table.html',
|
||||||
styleUrl: './quotation-table.css',
|
styleUrl: './quotation-table.css',
|
||||||
@@ -29,10 +34,12 @@ import {DelivereryNoteForm} from "../deliverery-note-form/deliverery-note-form";
|
|||||||
export class QuotationTable implements OnInit {
|
export class QuotationTable implements OnInit {
|
||||||
private quotationsService = inject(QuotationsService);
|
private quotationsService = inject(QuotationsService);
|
||||||
private notificationService = inject(NzNotificationService);
|
private notificationService = inject(NzNotificationService);
|
||||||
|
private quotationProductsService = inject(QuotationproductsService)
|
||||||
private fileService = inject(FileService);
|
private fileService = inject(FileService);
|
||||||
quotations = signal<GetQuotationDto[]>([]);
|
quotations = signal<GetQuotationDto[]>([]);
|
||||||
quotationsLoading = signal<boolean>(false);
|
quotationsLoading = signal<boolean>(false);
|
||||||
modal = viewChild.required<ModalNav>('modalNav');
|
modal = viewChild.required<ModalNav>('modalNav');
|
||||||
|
modalQuantity = viewChild.required<ModalNav>('modalQuantity');
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
await this.fetchQuotations();
|
await this.fetchQuotations();
|
||||||
@@ -104,6 +111,43 @@ export class QuotationTable implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async deleteProduct(productId: number, quotationId: number) {
|
||||||
|
this.quotationsLoading.set(true)
|
||||||
|
try {
|
||||||
|
await firstValueFrom(this.quotationProductsService.deleteQuotationProductEndpoint(productId, quotationId))
|
||||||
|
this.notificationService.success(
|
||||||
|
'Success',
|
||||||
|
'Suppression effectuée'
|
||||||
|
)
|
||||||
|
} catch (e) {
|
||||||
|
this.notificationService.error(
|
||||||
|
'Erreur',
|
||||||
|
'Impossible de supprimer la ligne'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
this.quotationsLoading.set(false)
|
||||||
|
await this.fetchQuotations();
|
||||||
|
}
|
||||||
|
|
||||||
|
async editQuantity(productId: number, quotationId: number, updateQuantityComponent: QuantityForm) {
|
||||||
|
if (updateQuantityComponent.quantityForm.invalid) {
|
||||||
|
this.notificationService.error(
|
||||||
|
'Erreur',
|
||||||
|
'Erreur d\'écriture dans le formulaire'
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const quantity = updateQuantityComponent.quantityForm.getRawValue();
|
||||||
|
await firstValueFrom(this.quotationProductsService.patchQuotationProductQuantityEndpoint(productId, quotationId, quantity))
|
||||||
|
|
||||||
|
this.notificationService.success('Success', 'Quantité modifiée')
|
||||||
|
} catch (e) {
|
||||||
|
this.notificationService.error('Erreur', 'Erreur lors de la modification')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
selectedQuotation: GetQuotationDto | null = null;
|
selectedQuotation: GetQuotationDto | null = null;
|
||||||
openEditModal(quotation: GetQuotationDto) {
|
openEditModal(quotation: GetQuotationDto) {
|
||||||
this.selectedQuotation = { ...quotation };
|
this.selectedQuotation = { ...quotation };
|
||||||
@@ -122,5 +166,20 @@ export class QuotationTable implements OnInit {
|
|||||||
onModalCancel(modal: ModalNav) {
|
onModalCancel(modal: ModalNav) {
|
||||||
modal.isVisible = false;
|
modal.isVisible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectedQuantity: GetQuotationProductDto | null = null;
|
||||||
|
openEditQuantityModal(quantity: GetQuotationProductDto) {
|
||||||
|
this.selectedQuantity = { ...quantity };
|
||||||
|
this.modalQuantity().showModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
async onModalQuantityOk(productId: number, quotationId: number, updateQuantityComponent: QuantityForm, modal: ModalNav) {
|
||||||
|
if (!this.selectedQuantity) return;
|
||||||
|
|
||||||
|
await this.editQuantity(productId, quotationId, updateQuantityComponent);
|
||||||
|
updateQuantityComponent.quantityForm.reset();
|
||||||
|
modal.isVisible = false;
|
||||||
|
await this.fetchQuotations();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
<div class="flex mt-2">
|
<div class="flex mt-2">
|
||||||
<app-modal-button type="primary" name="Créer un bon de livraison" size="32%">
|
|
||||||
<app-deliverery-note-form></app-deliverery-note-form>
|
|
||||||
</app-modal-button>
|
|
||||||
|
|
||||||
<div class="ml-95 w-150">
|
<div class="ml-95 w-150">
|
||||||
<app-search></app-search>
|
<app-search></app-search>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import {Search} from "../../components/search/search";
|
|||||||
selector: 'app-delivery-note',
|
selector: 'app-delivery-note',
|
||||||
imports: [
|
imports: [
|
||||||
DelivereryNoteTable,
|
DelivereryNoteTable,
|
||||||
ModalButton,
|
|
||||||
DelivereryNoteForm,
|
|
||||||
Search
|
Search
|
||||||
],
|
],
|
||||||
templateUrl: './delivery-note.html',
|
templateUrl: './delivery-note.html',
|
||||||
|
|||||||
@@ -1,11 +1,25 @@
|
|||||||
<div class="flex mt-2">
|
<div class="flex mt-2">
|
||||||
@if (hasSelection) {
|
@if (hasSelection) {
|
||||||
<app-modal-button #modalButton type="default" name="Créer un bon de commande" size="35%" class="ml-4">
|
<app-modal-button #modalButtonPurchaseOrder
|
||||||
<app-purchase-order-form #purchaseOrderForm></app-purchase-order-form>
|
(click)="openPurchaseOrderForm()"
|
||||||
|
(ok)="onModalOk()"
|
||||||
|
(cancel)="onModalCancel()"
|
||||||
|
type="default"
|
||||||
|
name="Créer un bon de commande"
|
||||||
|
size="35%"
|
||||||
|
class="ml-4">
|
||||||
|
<app-create-purchaseorder-form #purchaseOrderForm></app-create-purchaseorder-form>
|
||||||
</app-modal-button>
|
</app-modal-button>
|
||||||
|
|
||||||
<app-modal-button #modalButton type="default" name="Créer un devis" size="35%" class="ml-4" (click)="test()">
|
<app-modal-button #modalButtonQuotation
|
||||||
<app-quotation-form #quotationForm></app-quotation-form>
|
type="default"
|
||||||
|
name="Créer un devis"
|
||||||
|
size="35%"
|
||||||
|
class="ml-4"
|
||||||
|
(click)="openQuotationForm()"
|
||||||
|
(ok)="onModalQuotationOk()"
|
||||||
|
(cancel)="onModalQuotationCancel()">
|
||||||
|
<app-create-quotation-form #quotationForm></app-create-quotation-form>
|
||||||
</app-modal-button>
|
</app-modal-button>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,12 @@ import {Component, inject, viewChild} from '@angular/core';
|
|||||||
import {StockTable} from "../../components/stock-table/stock-table";
|
import {StockTable} from "../../components/stock-table/stock-table";
|
||||||
import {Search} from "../../components/search/search";
|
import {Search} from "../../components/search/search";
|
||||||
import {ModalButton} from "../../components/modal-button/modal-button";
|
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 {QuotationForm} from "../../components/quotation-form/quotation-form";
|
||||||
import {ProductsService} from "../../services/api";
|
import {PurchaseordersService, QuotationsService} from "../../services/api";
|
||||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||||
import {firstValueFrom} from "rxjs";
|
import {firstValueFrom} from "rxjs";
|
||||||
|
import {CreatePurchaseorderForm} from "../../components/create-purchaseorder-form/create-purchaseorder-form";
|
||||||
|
import {CreateQuotationForm} from "../../components/create-quotation-form/create-quotation-form";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-stock',
|
selector: 'app-stock',
|
||||||
@@ -14,58 +15,22 @@ import {firstValueFrom} from "rxjs";
|
|||||||
StockTable,
|
StockTable,
|
||||||
Search,
|
Search,
|
||||||
ModalButton,
|
ModalButton,
|
||||||
PurchaseOrderForm,
|
CreatePurchaseorderForm,
|
||||||
QuotationForm,
|
CreateQuotationForm,
|
||||||
],
|
],
|
||||||
templateUrl: './stock.html',
|
templateUrl: './stock.html',
|
||||||
styleUrl: './stock.css',
|
styleUrl: './stock.css',
|
||||||
})
|
})
|
||||||
|
|
||||||
export class Stock {
|
export class Stock {
|
||||||
modal = viewChild.required<ModalButton>('modalButton');
|
createPurchaseOrder = viewChild.required<CreatePurchaseorderForm>('purchaseOrderForm');
|
||||||
createQuotation = viewChild.required<QuotationForm>('quotationForm');
|
createQuotation = viewChild.required<CreateQuotationForm>('quotationForm');
|
||||||
createPurchaseOrder = viewChild.required<PurchaseOrderForm>('purchaseOrderForm');
|
|
||||||
productTable = viewChild.required<StockTable>('stockTable');
|
productTable = viewChild.required<StockTable>('stockTable');
|
||||||
private productsService = inject(ProductsService);
|
private purchaseordersService = inject(PurchaseordersService)
|
||||||
|
private quotationsService = inject(QuotationsService)
|
||||||
private notificationService = inject(NzNotificationService)
|
private notificationService = inject(NzNotificationService)
|
||||||
|
modalButtonPurchaseOrder = viewChild.required<ModalButton>('modalButtonPurchaseOrder');
|
||||||
onProductSearch(query: string) {
|
modalButtonQuotation = viewChild.required<ModalButton>('modalButtonQuotation');
|
||||||
this.productTable().applySearch(query);
|
|
||||||
}
|
|
||||||
// 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;
|
hasSelection = false;
|
||||||
|
|
||||||
@@ -73,8 +38,101 @@ export class Stock {
|
|||||||
this.hasSelection = value;
|
this.hasSelection = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
test(){
|
onProductSearch(query: string) {
|
||||||
console.log(this.productTable().selectedIds);
|
this.productTable().applySearch(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async addPurchaseOrder() {
|
||||||
|
const form = this.createPurchaseOrder().createPurchaseOrderForm;
|
||||||
|
if (form.invalid) {
|
||||||
|
this.notificationService.error('Erreur', 'Formulaire invalide');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const orderLines = this.createPurchaseOrder().lines.value.map(line => ({
|
||||||
|
productId: line.productId,
|
||||||
|
quantity: line.quantity
|
||||||
|
}));
|
||||||
|
if (orderLines.length === 0) {
|
||||||
|
this.notificationService.error('Erreur', 'Aucun produit sélectionné');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const purchaseOrder = {
|
||||||
|
purchaseConditions: form.get('purchaseConditions')!.value,
|
||||||
|
products: orderLines
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
await firstValueFrom(
|
||||||
|
this.purchaseordersService.createPurchaseOrder(purchaseOrder)
|
||||||
|
);
|
||||||
|
this.notificationService.success('Succès', 'Bon de commande créé');
|
||||||
|
} catch (e) {
|
||||||
|
this.notificationService.error('Erreur', 'Erreur lors de la création du bon de commande.');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async onModalOk() {
|
||||||
|
await this.addPurchaseOrder();
|
||||||
|
this.createPurchaseOrder().createPurchaseOrderForm.reset();
|
||||||
|
this.modalButtonPurchaseOrder().isVisible = false;
|
||||||
|
await this.productTable().fetchProducts();
|
||||||
|
}
|
||||||
|
|
||||||
|
onModalCancel() {
|
||||||
|
this.modalButtonPurchaseOrder().isVisible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
openPurchaseOrderForm() {
|
||||||
|
const selectedProducts = this.productTable().products().filter(p =>
|
||||||
|
this.productTable().selectedIds.includes(p.id)
|
||||||
|
);
|
||||||
|
this.createPurchaseOrder().syncSelectedProducts(selectedProducts);
|
||||||
|
}
|
||||||
|
|
||||||
|
async addQuotation() {
|
||||||
|
if (this.createQuotation().createQuotationForm.invalid) {
|
||||||
|
this.notificationService.error('Erreur', 'Formulaire invalide');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const orderLines = this.createQuotation().lines.value.map(line => ({
|
||||||
|
productId: line.productId,
|
||||||
|
quantity: line.quantity
|
||||||
|
}));
|
||||||
|
if (orderLines.length === 0) {
|
||||||
|
this.notificationService.error('Erreur', 'Aucun produit sélectionné');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const quotation = {
|
||||||
|
message: this.createQuotation().createQuotationForm.get('message')!.value,
|
||||||
|
purchaseConditions: this.createQuotation().createQuotationForm.get('purchaseConditions')!.value,
|
||||||
|
products: orderLines
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
await firstValueFrom(
|
||||||
|
this.quotationsService.createQuotationEndpoint(quotation)
|
||||||
|
);
|
||||||
|
this.notificationService.success('Succès', 'Devis créé');
|
||||||
|
} catch (e) {
|
||||||
|
this.notificationService.error('Erreur', 'Erreur lors de la création du devis.');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async onModalQuotationOk() {
|
||||||
|
await this.addQuotation();
|
||||||
|
this.createQuotation().createQuotationForm.reset();
|
||||||
|
this.modalButtonQuotation().isVisible = false;
|
||||||
|
await this.productTable().fetchProducts();
|
||||||
|
}
|
||||||
|
|
||||||
|
onModalQuotationCancel() {
|
||||||
|
this.modalButtonQuotation().isVisible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
openQuotationForm() {
|
||||||
|
const selectedProducts = this.productTable().products().filter(p =>
|
||||||
|
this.productTable().selectedIds.includes(p.id)
|
||||||
|
);
|
||||||
|
this.createQuotation().syncSelectedProducts(selectedProducts);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,11 @@ model/connect-user-dto.ts
|
|||||||
model/create-deliverer-dto.ts
|
model/create-deliverer-dto.ts
|
||||||
model/create-delivery-note-dto.ts
|
model/create-delivery-note-dto.ts
|
||||||
model/create-price-dto.ts
|
model/create-price-dto.ts
|
||||||
|
model/create-product-quotation-dto.ts
|
||||||
|
model/create-purchase-order-dto.ts
|
||||||
|
model/create-purchase-order-product-dto.ts
|
||||||
model/create-purchase-product-dto.ts
|
model/create-purchase-product-dto.ts
|
||||||
|
model/create-quotation-dto.ts
|
||||||
model/create-quotation-product-dto.ts
|
model/create-quotation-product-dto.ts
|
||||||
model/create-setting-dto.ts
|
model/create-setting-dto.ts
|
||||||
model/create-supplier-dto.ts
|
model/create-supplier-dto.ts
|
||||||
|
|||||||
@@ -142,6 +142,56 @@ export class ProductsService extends BaseService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @endpoint get /API/products/underLimit
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getAllProductsUnderLimitEndpoint(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Array<GetProductDto>>;
|
||||||
|
public getAllProductsUnderLimitEndpoint(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Array<GetProductDto>>>;
|
||||||
|
public getAllProductsUnderLimitEndpoint(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Array<GetProductDto>>>;
|
||||||
|
public getAllProductsUnderLimitEndpoint(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
|
'application/json'
|
||||||
|
]);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/API/products/underLimit`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<Array<GetProductDto>>('get', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @endpoint get /API/products/{id}
|
* @endpoint get /API/products/{id}
|
||||||
* @param id
|
* @param id
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ import { HttpClient, HttpHeaders, HttpParams,
|
|||||||
import { CustomHttpParameterCodec } from '../encoder';
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
import { CreatePurchaseOrderDto } from '../model/create-purchase-order-dto';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { GetPurchaseOrderDto } from '../model/get-purchase-order-dto';
|
import { GetPurchaseOrderDto } from '../model/get-purchase-order-dto';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@@ -37,6 +39,70 @@ export class PurchaseordersService extends BaseService {
|
|||||||
super(basePath, configuration);
|
super(basePath, configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @endpoint post /API/purchaseOrders
|
||||||
|
* @param createPurchaseOrderDto
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public createPurchaseOrder(createPurchaseOrderDto: CreatePurchaseOrderDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<GetPurchaseOrderDto>;
|
||||||
|
public createPurchaseOrder(createPurchaseOrderDto: CreatePurchaseOrderDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<GetPurchaseOrderDto>>;
|
||||||
|
public createPurchaseOrder(createPurchaseOrderDto: CreatePurchaseOrderDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<GetPurchaseOrderDto>>;
|
||||||
|
public createPurchaseOrder(createPurchaseOrderDto: CreatePurchaseOrderDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
if (createPurchaseOrderDto === null || createPurchaseOrderDto === undefined) {
|
||||||
|
throw new Error('Required parameter createPurchaseOrderDto was null or undefined when calling createPurchaseOrder.');
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
|
'application/json'
|
||||||
|
]);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
const consumes: string[] = [
|
||||||
|
'application/json'
|
||||||
|
];
|
||||||
|
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||||
|
if (httpContentTypeSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/API/purchaseOrders`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<GetPurchaseOrderDto>('post', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
body: createPurchaseOrderDto,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @endpoint delete /API/purchaseOrders/{id}
|
* @endpoint delete /API/purchaseOrders/{id}
|
||||||
* @param id
|
* @param id
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ import { HttpClient, HttpHeaders, HttpParams,
|
|||||||
import { CustomHttpParameterCodec } from '../encoder';
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
import { CreateQuotationDto } from '../model/create-quotation-dto';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { GetQuotationDto } from '../model/get-quotation-dto';
|
import { GetQuotationDto } from '../model/get-quotation-dto';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@@ -39,6 +41,70 @@ export class QuotationsService extends BaseService {
|
|||||||
super(basePath, configuration);
|
super(basePath, configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @endpoint post /API/quotations
|
||||||
|
* @param createQuotationDto
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public createQuotationEndpoint(createQuotationDto: CreateQuotationDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<GetQuotationDto>;
|
||||||
|
public createQuotationEndpoint(createQuotationDto: CreateQuotationDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<GetQuotationDto>>;
|
||||||
|
public createQuotationEndpoint(createQuotationDto: CreateQuotationDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<GetQuotationDto>>;
|
||||||
|
public createQuotationEndpoint(createQuotationDto: CreateQuotationDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
if (createQuotationDto === null || createQuotationDto === undefined) {
|
||||||
|
throw new Error('Required parameter createQuotationDto was null or undefined when calling createQuotationEndpoint.');
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
|
'application/json'
|
||||||
|
]);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
const consumes: string[] = [
|
||||||
|
'application/json'
|
||||||
|
];
|
||||||
|
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||||
|
if (httpContentTypeSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/API/quotations`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<GetQuotationDto>('post', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
body: createQuotationDto,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @endpoint delete /API/quotations/{id}
|
* @endpoint delete /API/quotations/{id}
|
||||||
* @param id
|
* @param id
|
||||||
|
|||||||
16
src/app/services/api/model/create-product-quotation-dto.ts
Normal file
16
src/app/services/api/model/create-product-quotation-dto.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* PyroFetes
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
export interface CreateProductQuotationDto {
|
||||||
|
productId?: number;
|
||||||
|
quantity?: number;
|
||||||
|
}
|
||||||
|
|
||||||
17
src/app/services/api/model/create-purchase-order-dto.ts
Normal file
17
src/app/services/api/model/create-purchase-order-dto.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* PyroFetes
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
import { CreatePurchaseOrderProductDto } from './create-purchase-order-product-dto';
|
||||||
|
|
||||||
|
|
||||||
|
export interface CreatePurchaseOrderDto {
|
||||||
|
purchaseConditions?: string | null;
|
||||||
|
products?: Array<CreatePurchaseOrderProductDto> | null;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* PyroFetes
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
export interface CreatePurchaseOrderProductDto {
|
||||||
|
productId?: number;
|
||||||
|
quantity?: number;
|
||||||
|
}
|
||||||
|
|
||||||
18
src/app/services/api/model/create-quotation-dto.ts
Normal file
18
src/app/services/api/model/create-quotation-dto.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* PyroFetes
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
import { CreateProductQuotationDto } from './create-product-quotation-dto';
|
||||||
|
|
||||||
|
|
||||||
|
export interface CreateQuotationDto {
|
||||||
|
message?: string | null;
|
||||||
|
conditionsSale?: string | null;
|
||||||
|
products?: Array<CreateProductQuotationDto> | null;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ export interface CreateQuotationProductDto {
|
|||||||
productName?: string | null;
|
productName?: string | null;
|
||||||
productDuration?: number;
|
productDuration?: number;
|
||||||
productCaliber?: number;
|
productCaliber?: number;
|
||||||
productApprovalNumber?: number;
|
productApprovalNumber?: string | null;
|
||||||
productWeight?: number;
|
productWeight?: number;
|
||||||
productNec?: number;
|
productNec?: number;
|
||||||
productImage?: string | null;
|
productImage?: string | null;
|
||||||
|
|||||||
@@ -11,11 +11,11 @@
|
|||||||
|
|
||||||
export interface GetProductDeliveryDto {
|
export interface GetProductDeliveryDto {
|
||||||
productId?: number;
|
productId?: number;
|
||||||
productReference?: number;
|
productReference?: string | null;
|
||||||
productName?: string | null;
|
productName?: string | null;
|
||||||
productDuration?: number;
|
productDuration?: number;
|
||||||
productCaliber?: number;
|
productCaliber?: number;
|
||||||
productApprovalNumber?: number;
|
productApprovalNumber?: string | null;
|
||||||
productWeight?: number;
|
productWeight?: number;
|
||||||
productNec?: number;
|
productNec?: number;
|
||||||
productImage?: string | null;
|
productImage?: string | null;
|
||||||
|
|||||||
@@ -13,6 +13,6 @@ import { GetPurchaseProductDto } from './get-purchase-product-dto';
|
|||||||
export interface GetPurchaseOrderDto {
|
export interface GetPurchaseOrderDto {
|
||||||
id?: number;
|
id?: number;
|
||||||
purchaseConditions?: string | null;
|
purchaseConditions?: string | null;
|
||||||
getPurchaseProductDto?: Array<GetPurchaseProductDto> | null;
|
products?: Array<GetPurchaseProductDto> | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export interface GetPurchaseProductDto {
|
|||||||
productName?: string | null;
|
productName?: string | null;
|
||||||
productDuration?: number;
|
productDuration?: number;
|
||||||
productCaliber?: number;
|
productCaliber?: number;
|
||||||
productApprovalNumber?: number;
|
productApprovalNumber?: string | null;
|
||||||
productWeight?: number;
|
productWeight?: number;
|
||||||
productNec?: number;
|
productNec?: number;
|
||||||
productImage?: string | null;
|
productImage?: string | null;
|
||||||
|
|||||||
@@ -14,6 +14,6 @@ export interface GetQuotationDto {
|
|||||||
id?: number;
|
id?: number;
|
||||||
message?: string | null;
|
message?: string | null;
|
||||||
conditionsSale?: string | null;
|
conditionsSale?: string | null;
|
||||||
getQuotationProductDto?: Array<GetQuotationProductDto> | null;
|
products?: Array<GetQuotationProductDto> | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export interface GetQuotationProductDto {
|
|||||||
productName?: string | null;
|
productName?: string | null;
|
||||||
productDuration?: number;
|
productDuration?: number;
|
||||||
productCaliber?: number;
|
productCaliber?: number;
|
||||||
productApprovalNumber?: number;
|
productApprovalNumber?: string | null;
|
||||||
productWeight?: number;
|
productWeight?: number;
|
||||||
productNec?: number;
|
productNec?: number;
|
||||||
productImage?: string | null;
|
productImage?: string | null;
|
||||||
|
|||||||
@@ -2,7 +2,11 @@ export * from './connect-user-dto';
|
|||||||
export * from './create-deliverer-dto';
|
export * from './create-deliverer-dto';
|
||||||
export * from './create-delivery-note-dto';
|
export * from './create-delivery-note-dto';
|
||||||
export * from './create-price-dto';
|
export * from './create-price-dto';
|
||||||
|
export * from './create-product-quotation-dto';
|
||||||
|
export * from './create-purchase-order-dto';
|
||||||
|
export * from './create-purchase-order-product-dto';
|
||||||
export * from './create-purchase-product-dto';
|
export * from './create-purchase-product-dto';
|
||||||
|
export * from './create-quotation-dto';
|
||||||
export * from './create-quotation-product-dto';
|
export * from './create-quotation-product-dto';
|
||||||
export * from './create-setting-dto';
|
export * from './create-setting-dto';
|
||||||
export * from './create-supplier-dto';
|
export * from './create-supplier-dto';
|
||||||
|
|||||||
Reference in New Issue
Block a user