Compare commits
9 Commits
feature/fi
...
8b7d48779e
| Author | SHA1 | Date | |
|---|---|---|---|
| 8b7d48779e | |||
| 9ebe8ab37e | |||
| 8124d83e79 | |||
| 22e50a8dea | |||
| 750a0da817 | |||
| a707a33a87 | |||
| 3c8abbb600 | |||
| d160a29a56 | |||
| 586c9458b1 |
29
package-lock.json
generated
29
package-lock.json
generated
@@ -500,6 +500,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@angular/common/-/common-20.3.11.tgz",
|
||||
"integrity": "sha512-zQ8xlyUBS+UDAUKk7z/hhWdTtQU2oc/Dwo7jXpyrYlz9y2X1A6sAZpUigdYpbrBkIaNs3MplJevgMiCm3kmN8g==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
},
|
||||
@@ -516,6 +517,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-20.3.11.tgz",
|
||||
"integrity": "sha512-3O0iMPttD8a4QQQrjVfIjboiZZ17ErkZuqK8BXJBTn2rplpkq1m3kVhgsmzN2OANRR05GF9Ed1dTf8ycTrO1yg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
},
|
||||
@@ -529,6 +531,7 @@
|
||||
"integrity": "sha512-u6T8kxj7LzK3btEln6Vd8y7p+O1eNXrLiGwqPuRF/QoyjBrRkTYufZ1I4TvzUxdd0ot6mPDRfdmiD15q//Y+oQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/core": "7.28.3",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.14",
|
||||
@@ -561,6 +564,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@angular/core/-/core-20.3.11.tgz",
|
||||
"integrity": "sha512-tOXlxG0SI9Yy1b/ntGyBahfffDpFg7vAbAt+9riOb5ZZ8GYyyOzg78Lqa/lrdBVEG0PXdDjEa0MV93qCyqwYlg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
},
|
||||
@@ -586,6 +590,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@angular/forms/-/forms-20.3.11.tgz",
|
||||
"integrity": "sha512-jXDvW6a9HUzmLmvgPE+hVoZzc6QJBtQ1kYNn/FZDhbtmjRThJtaMW9YfS0Vz/a9KT9cxBf+8O8Q+yspvgsh3fg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
},
|
||||
@@ -604,6 +609,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-20.3.11.tgz",
|
||||
"integrity": "sha512-hh+8O8m4QzYYlQr9WGew472P37GF1u64NF3HfHmUKJ0xSqqTOHfpni3utev8upJAFJXBKOUZETgeHu2JRcGavg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
},
|
||||
@@ -626,6 +632,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@angular/router/-/router-20.3.11.tgz",
|
||||
"integrity": "sha512-kuv7Yso7GY3tfRtQN0kW4v2Or4NUEBdjxTz5C8YuAhGDpiKXxDNkXzFliYTVWpJkr3EkTuR9mt9IAc+wxof3Pw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
},
|
||||
@@ -707,6 +714,7 @@
|
||||
"integrity": "sha512-yDBHV9kQNcr2/sUr9jghVyz9C3Y5G2zUM2H2lo+9mKv4sFgbA8s8Z9t8D1jiTkGoO/NoIfKMyKWr4s6CN23ZwQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@ampproject/remapping": "^2.2.0",
|
||||
"@babel/code-frame": "^7.27.1",
|
||||
@@ -1648,6 +1656,7 @@
|
||||
"integrity": "sha512-nqhDw2ZcAUrKNPwhjinJny903bRhI0rQhiDz1LksjeRxqa36i3l75+4iXbOy0rlDpLJGxqtgoPavQjmmyS5UJw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@inquirer/checkbox": "^4.2.1",
|
||||
"@inquirer/confirm": "^5.1.14",
|
||||
@@ -2507,6 +2516,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-11.1.9.tgz",
|
||||
"integrity": "sha512-zDntUTReRbAThIfSp3dQZ9kKqI+LjgLp5YZN5c1bgNRDuoeLySAoZg46Bg1a+uV8TMgIRziHocglKGNzr6l+bQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"file-type": "21.1.0",
|
||||
"iterare": "1.2.1",
|
||||
@@ -4270,6 +4280,7 @@
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.13.2.tgz",
|
||||
"integrity": "sha512-VPk9ebNqPcy5lRGuSlKx752IlDatOjT9paPlm8A7yOuW2Fbvp4X3JznJtT4f0GzGLLiWE9W8onz51SqLYwzGaA==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.6",
|
||||
"form-data": "^4.0.4",
|
||||
@@ -4437,6 +4448,7 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"baseline-browser-mapping": "^2.8.25",
|
||||
"caniuse-lite": "^1.0.30001754",
|
||||
@@ -5635,6 +5647,7 @@
|
||||
"integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"accepts": "^2.0.0",
|
||||
"body-parser": "^2.2.0",
|
||||
@@ -6890,6 +6903,7 @@
|
||||
"integrity": "sha512-j1n1IuTX1VQjIy3tT7cyGbX7nvQOsFLoIqobZv4ttI5axP923gA44zUj6miiA6R5Aoms4sEGVIIcucXUbRI14g==",
|
||||
"devOptional": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"copy-anything": "^2.0.1",
|
||||
"parse-node-version": "^1.0.1",
|
||||
@@ -7177,6 +7191,7 @@
|
||||
"integrity": "sha512-SL0JY3DaxylDuo/MecFeiC+7pedM0zia33zl0vcjgwcq1q1FWWF1To9EIauPbl8GbMCU0R2e0uJ8bZunhYKD2g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"cli-truncate": "^4.0.0",
|
||||
"colorette": "^2.0.20",
|
||||
@@ -8832,7 +8847,8 @@
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz",
|
||||
"integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==",
|
||||
"license": "Apache-2.0"
|
||||
"license": "Apache-2.0",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/require-directory": {
|
||||
"version": "2.1.1",
|
||||
@@ -8980,6 +8996,7 @@
|
||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz",
|
||||
"integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==",
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.1.0"
|
||||
}
|
||||
@@ -9016,6 +9033,7 @@
|
||||
"integrity": "sha512-9GUyuksjw70uNpb1MTYWsH9MQHOHY6kwfnkafC24+7aOMZn9+rVMBxRbLvw756mrBFbIsFg6Xw9IkR2Fnn3k+Q==",
|
||||
"devOptional": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"chokidar": "^4.0.0",
|
||||
"immutable": "^5.0.2",
|
||||
@@ -9764,7 +9782,8 @@
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||
"license": "0BSD"
|
||||
"license": "0BSD",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/tuf-js": {
|
||||
"version": "3.1.0",
|
||||
@@ -9814,6 +9833,7 @@
|
||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
@@ -9974,6 +9994,7 @@
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-7.1.11.tgz",
|
||||
"integrity": "sha512-uzcxnSDVjAopEUjljkWh8EIrg6tlzrjFUfMcR1EVsRDGwf/ccef0qQPRyOrROwhrTDaApueq+ja+KLPlzR/zdg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"esbuild": "^0.25.0",
|
||||
"fdir": "^6.5.0",
|
||||
@@ -10361,6 +10382,7 @@
|
||||
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/colinhacks"
|
||||
}
|
||||
@@ -10379,7 +10401,8 @@
|
||||
"version": "0.15.1",
|
||||
"resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.15.1.tgz",
|
||||
"integrity": "sha512-XE96n56IQpJM7NAoXswY3XRLcWFW83xe0BiAOeMD7K5k5xecOeul3Qcpx6GqEeeHNkW5DWL5zOyTbEfB4eti8w==",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)]]
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -79,20 +79,12 @@ export class DelivererTable implements OnInit {
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
const deliverers = updateDelivererComponent.delivererForm.getRawValue();
|
||||
await firstValueFrom(this.deliverersService.updateDelivererEndpoint(id, deliverers))
|
||||
|
||||
this.notificationService.success(
|
||||
'Success',
|
||||
'Transporteur modifié'
|
||||
)
|
||||
this.notificationService.success('Success', 'Transporteur modifié')
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur lors de la modification'
|
||||
)
|
||||
this.notificationService.error('Erreur', 'Erreur lors de la modification')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
</nz-form-label>
|
||||
|
||||
<nz-form-control nzSpan="9" nzErrorTip="Ce champ est requis">
|
||||
<nz-select formControlName="deliverer" [nzPlaceHolder]="'Choisir un transporteur'" nzShowSearch [nzFilterOption]="filter">
|
||||
<nz-select formControlName="delivererId" [nzPlaceHolder]="'Choisir un transporteur'" nzShowSearch [nzFilterOption]="filter">
|
||||
@for (deliverer of deliverers(); track deliverer.id) {
|
||||
<nz-option [nzValue]="deliverer.id" [nzLabel]="deliverer.transporter"></nz-option>
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ import {firstValueFrom} from "rxjs";
|
||||
})
|
||||
export class DelivereryNoteForm implements OnInit {
|
||||
deliveryNoteForm: FormGroup = new FormGroup({
|
||||
trackingNumber: new FormControl<string>("TRK-" + Date.now),
|
||||
deliverer: new FormControl<string>(null,[Validators.required]),
|
||||
trackingNumber: new FormControl<string>(null),
|
||||
delivererId: new FormControl<number>(null,[Validators.required]),
|
||||
expeditionDate: new FormControl(null,[Validators.required]),
|
||||
estimatedDate: new FormControl(null),
|
||||
realDeliveryDate: new FormControl(null)
|
||||
@@ -65,7 +65,7 @@ export class DelivereryNoteForm implements OnInit {
|
||||
expeditionDate: this.deliveryNote().expeditionDate,
|
||||
realDeliveryDate: this.deliveryNote().expeditionDate,
|
||||
estimatedDate: this.deliveryNote().expeditionDate,
|
||||
deliverer: this.deliveryNote().delivererId
|
||||
delivererId: this.deliveryNote().delivererId
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -116,6 +116,47 @@ export class DelivereryNoteTable implements OnInit {
|
||||
this.deliveryNotesLoading.set(false)
|
||||
}
|
||||
|
||||
async edit(id: number, updateDelivereryNoteComponent: DelivereryNoteForm) {
|
||||
if (updateDelivereryNoteComponent.deliveryNoteForm.invalid) {
|
||||
this.notificationService.error('Erreur', 'Formulaire invalide');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const raw = updateDelivereryNoteComponent.deliveryNoteForm.getRawValue();
|
||||
|
||||
// convertit proprement les dates (string OU Date)
|
||||
const toIso = (val: any) => {
|
||||
if (!val) return null;
|
||||
|
||||
// si c’est déjà un string ISO "yyyy-MM-dd", on renvoie tel quel
|
||||
if (typeof val === 'string' && /^\d{4}-\d{2}-\d{2}/.test(val)) {
|
||||
return val.substring(0, 10);
|
||||
}
|
||||
|
||||
// sinon on reconstruit une Date
|
||||
const d = new Date(val);
|
||||
if (isNaN(d.getTime())) return null;
|
||||
|
||||
return d.toISOString().substring(0, 10); // yyyy-MM-dd
|
||||
};
|
||||
|
||||
const deliveryNoteDto = {
|
||||
trackingNumber: raw.trackingNumber,
|
||||
delivererId: raw.delivererId,
|
||||
expeditionDate: toIso(raw.expeditionDate),
|
||||
estimatedDate: toIso(raw.estimatedDate),
|
||||
realDeliveryDate: toIso(raw.realDeliveryDate)
|
||||
};
|
||||
|
||||
await firstValueFrom(this.deliveryNotesService.updateDeliveryNoteEndpoint(id, deliveryNoteDto));
|
||||
this.notificationService.success('Success', 'Bon de livraison modifié');
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
this.notificationService.error('Erreur', 'Erreur lors de la modification');
|
||||
}
|
||||
}
|
||||
|
||||
selectedDeliveryNote: GetDeliveryNoteDto | null = null;
|
||||
openEditModal(deliveryNote: GetDeliveryNoteDto) {
|
||||
this.selectedDeliveryNote = { ...deliveryNote };
|
||||
@@ -134,32 +175,4 @@ export class DelivereryNoteTable implements OnInit {
|
||||
onModalCancel(modal: ModalNav) {
|
||||
modal.isVisible = false;
|
||||
}
|
||||
|
||||
async edit(id: number, updateDelivereryNoteComponent: DelivereryNoteForm) {
|
||||
if (updateDelivereryNoteComponent.deliveryNoteForm.invalid) {
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur d\'écriture dans le formulaire'
|
||||
)
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
const deliveryNotes = updateDelivereryNoteComponent.deliveryNoteForm.getRawValue();
|
||||
await firstValueFrom(this.deliveryNotesService.updateDeliveryNoteEndpoint(id, deliveryNotes))
|
||||
|
||||
this.notificationService.success(
|
||||
'Success',
|
||||
'Bon de livraison modifié'
|
||||
)
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Erreur lors de la modification'
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
</nz-form-label>
|
||||
|
||||
<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-item>
|
||||
</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 {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 {GetPurchaseOrderDto} from "../../services/api";
|
||||
|
||||
@Component({
|
||||
selector: 'app-purchase-order-form',
|
||||
@@ -23,6 +24,17 @@ import {NzInputDirective} from "ng-zorro-antd/input";
|
||||
})
|
||||
export class PurchaseOrderForm {
|
||||
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>
|
||||
</thead>
|
||||
<tbody class="text-center">
|
||||
@for (product of purchaseOrder.getPurchaseProductDto; track product.productId) {
|
||||
@for (product of purchaseOrder.products; track product.productId) {
|
||||
<tr>
|
||||
<td>{{product.productName}}</td>
|
||||
<td>{{product.productReferences}}</td>
|
||||
@@ -40,9 +40,9 @@
|
||||
<td>{{product.quantity}}</td>
|
||||
<td>
|
||||
<div style="justify-content: center; display: flex">
|
||||
<div>
|
||||
<nz-icon nzType="delete" nzTheme="outline" class="cursor-pointer text-red-700"/>
|
||||
</div>
|
||||
<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, purchaseOrder.id)"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -54,28 +54,30 @@
|
||||
</td>
|
||||
<td>
|
||||
<div style="justify-content: center; display: flex">
|
||||
<div>
|
||||
<nz-icon nzType="plus-circle" nzTheme="outline" (click)="delete(purchaseOrder.id)" class="cursor-pointer text-green-700"/>
|
||||
</div>
|
||||
<nz-icon nzType="plus-circle" nzTheme="outline" class="cursor-pointer text-green-700"/>
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
<app-modal-nav nameIcon="edit" name="Modification des conditions de vente" class="cursor-pointer">
|
||||
<app-purchase-order-form></app-purchase-order-form>
|
||||
</app-modal-nav>
|
||||
<nz-icon nzType="edit" nzTheme="outline" class="cursor-pointer" (click)="openEditModal(purchaseOrder)"></nz-icon>
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
<div>
|
||||
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(purchaseOrder.id)" class="cursor-pointer text-red-700"/>
|
||||
</div>
|
||||
<nz-icon nzType="delete" nzTheme="outline" (click)="delete(purchaseOrder.id)" class="cursor-pointer text-red-700"/>
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
<div>
|
||||
<nz-icon nzType="export" nzTheme="outline" (click)="export(purchaseOrder.id)" class="cursor-pointer text-green-700"/>
|
||||
</div>
|
||||
<nz-icon nzType="export" nzTheme="outline" (click)="export(purchaseOrder.id)" class="cursor-pointer text-green-700"/>
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
<div>
|
||||
<nz-icon nzType="interaction" nzTheme="outline" (click)="transfer()" class="cursor-pointer text-blue-700"/>
|
||||
</div>
|
||||
<nz-icon nzType="interaction" nzTheme="outline" (click)="transfer()" class="cursor-pointer text-blue-700"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</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,20 @@
|
||||
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 {NzDividerComponent} from "ng-zorro-antd/divider";
|
||||
import {NzIconDirective} from "ng-zorro-antd/icon";
|
||||
import {NzTableComponent} from "ng-zorro-antd/table";
|
||||
import {PurchaseOrderForm} from "../purchase-order-form/purchase-order-form";
|
||||
import {ModalButton} from "../modal-button/modal-button";
|
||||
import {GetPurchaseOrderDto, PurchaseordersService} from "../../services/api";
|
||||
import {
|
||||
GetPurchaseOrderDto,
|
||||
GetPurchaseProductDto,
|
||||
PurchaseordersService,
|
||||
PurchaseproductsService
|
||||
} from "../../services/api";
|
||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||
import {firstValueFrom} from "rxjs";
|
||||
import {FileService} from "../../services/file.service";
|
||||
import {QuantityForm} from "../quantity-form/quantity-form";
|
||||
|
||||
@Component({
|
||||
selector: 'app-purchase-order-table',
|
||||
@@ -19,6 +25,7 @@ import {FileService} from "../../services/file.service";
|
||||
NzTableComponent,
|
||||
PurchaseOrderForm,
|
||||
ModalButton,
|
||||
QuantityForm,
|
||||
],
|
||||
templateUrl: './purchase-order-table.html',
|
||||
styleUrl: './purchase-order-table.css',
|
||||
@@ -27,8 +34,11 @@ export class PurchaseOrderTable implements OnInit {
|
||||
private purchaseOrdersService = inject(PurchaseordersService);
|
||||
private notificationService = inject(NzNotificationService);
|
||||
private fileService = inject(FileService);
|
||||
private purchaseProductService = inject(PurchaseproductsService)
|
||||
purchaseOrders = signal<GetPurchaseOrderDto[]>([]);
|
||||
purchaseOrdersLoading = signal<boolean>(false);
|
||||
modal = viewChild.required<ModalNav>('modalNav');
|
||||
modalQuantity = viewChild.required<ModalNav>('modalQuantity');
|
||||
|
||||
async ngOnInit() {
|
||||
await this.fetchPurchaseOrder();
|
||||
@@ -75,7 +85,6 @@ export class PurchaseOrderTable implements OnInit {
|
||||
);
|
||||
this.fileService.downloadBlob(pdf)
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
this.notificationService.error(
|
||||
'Erreur',
|
||||
'Impossible de générer un PDF'
|
||||
@@ -87,4 +96,94 @@ export class PurchaseOrderTable implements OnInit {
|
||||
transfer() {
|
||||
return
|
||||
}
|
||||
|
||||
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
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
<form nz-form nzLayout="horizontal" [formGroup]="QuotationForm">
|
||||
<form nz-form nzLayout="horizontal" [formGroup]="quotationForm">
|
||||
<nz-form-item nz-flex>
|
||||
<nz-form-label nzSpan="9">
|
||||
Message du devis
|
||||
</nz-form-label>
|
||||
|
||||
<nz-form-control nzSpan="12">
|
||||
<input nz-input placeholder="Message du devis" formControlName="quotationMessage">
|
||||
<input nz-input placeholder="Message du devis" formControlName="message">
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</nz-form-label>
|
||||
|
||||
<nz-form-control nzSpan="12">
|
||||
<input nz-input placeholder="Conditions de vente" formControlName="quotationConditionsSale">
|
||||
<input nz-input placeholder="Conditions de vente" formControlName="conditionsSale">
|
||||
</nz-form-control>
|
||||
</nz-form-item>
|
||||
</form>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Component } from '@angular/core';
|
||||
import {Component, effect, input} from '@angular/core';
|
||||
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from "@angular/forms";
|
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
||||
import {NzInputDirective} from "ng-zorro-antd/input";
|
||||
import {NzColDirective} from "ng-zorro-antd/grid";
|
||||
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker";
|
||||
import {GetQuotationDto} from "../../services/api";
|
||||
|
||||
@Component({
|
||||
selector: 'app-quotation-form',
|
||||
@@ -22,8 +22,20 @@ import {NzDatePickerComponent} from "ng-zorro-antd/date-picker";
|
||||
styleUrl: './quotation-form.css',
|
||||
})
|
||||
export class QuotationForm {
|
||||
QuotationForm: FormGroup = new FormGroup({
|
||||
quotationMessage: new FormControl<string>(null),
|
||||
quotationConditionsSale: new FormControl<string>(null),
|
||||
quotationForm: FormGroup = new FormGroup({
|
||||
message: new FormControl<string>(null, [Validators.required]),
|
||||
conditionsSale: new FormControl<string>(null, [Validators.required]),
|
||||
})
|
||||
|
||||
quotation= input<GetQuotationDto>();
|
||||
constructor() {
|
||||
effect(() => {
|
||||
if (this.quotation()) {
|
||||
this.quotationForm.patchValue({
|
||||
message: this.quotation().message,
|
||||
conditionsSale: this.quotation().conditionsSale,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,15 +32,17 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-center">
|
||||
@for (product of quotation.getQuotationProductDto; track product.productId) {
|
||||
@for (product of quotation.products; track product.productId) {
|
||||
<tr>
|
||||
<td>{{ product.productReferences }}</td>
|
||||
<td>{{ product.productName }}</td>
|
||||
<td>Price ???</td>
|
||||
<td>Quantité ???</td>
|
||||
<td>{{ product.quantity }}</td>
|
||||
<td>
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -52,21 +54,13 @@
|
||||
</td>
|
||||
<td>
|
||||
<div style="justify-content: center; display: flex">
|
||||
<div>
|
||||
<nz-icon nzType="plus-circle" nzTheme="outline" class="cursor-pointer text-green-700" />
|
||||
</div>
|
||||
<nz-icon nzType="plus-circle" nzTheme="outline" class="cursor-pointer text-green-700" />
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
<app-modal-nav nameIcon="edit" name="Modification du devis" class="cursor-pointer">
|
||||
<app-quotation-form></app-quotation-form>
|
||||
</app-modal-nav>
|
||||
<nz-icon nzType="edit" nzTheme="outline" class="cursor-pointer" (click)="openEditModal(quotation)"></nz-icon>
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
<div>
|
||||
<nz-icon nzType="delete" nzTheme="outline" class="cursor-pointer text-red-700" (click)="delete(quotation.id)"/>
|
||||
</div>
|
||||
<nz-icon nzType="delete" nzTheme="outline" class="cursor-pointer text-red-700" (click)="delete(quotation.id)"/>
|
||||
<nz-divider nzType="vertical"></nz-divider>
|
||||
<div>
|
||||
<nz-icon nzType="export" (click)="export(quotation.id)" nzTheme="outline" class="cursor-pointer text-green-700"/>
|
||||
</div>
|
||||
<nz-icon nzType="export" (click)="export(quotation.id)" nzTheme="outline" class="cursor-pointer text-green-700"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -74,3 +68,14 @@
|
||||
</tbody>
|
||||
</nz-table>
|
||||
|
||||
<div class="hidden">
|
||||
<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-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>
|
||||
@@ -1,14 +1,20 @@
|
||||
import {Component, inject, OnInit, signal} from '@angular/core';
|
||||
import {Component, inject, OnInit, signal, viewChild} from '@angular/core';
|
||||
import {NzTableComponent} from "ng-zorro-antd/table";
|
||||
import {ModalButton} from "../modal-button/modal-button";
|
||||
import {ModalNav} from "../modal-nav/modal-nav";
|
||||
import {NzDividerComponent} from "ng-zorro-antd/divider";
|
||||
import {NzIconDirective} from "ng-zorro-antd/icon";
|
||||
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 {firstValueFrom} from "rxjs";
|
||||
import {FileService} from "../../services/file.service";
|
||||
import {QuantityForm} from "../quantity-form/quantity-form";
|
||||
|
||||
@Component({
|
||||
selector: 'app-quotation-table',
|
||||
@@ -19,6 +25,7 @@ import {FileService} from "../../services/file.service";
|
||||
NzIconDirective,
|
||||
NzTableComponent,
|
||||
QuotationForm,
|
||||
QuantityForm,
|
||||
],
|
||||
templateUrl: './quotation-table.html',
|
||||
styleUrl: './quotation-table.css',
|
||||
@@ -27,9 +34,12 @@ import {FileService} from "../../services/file.service";
|
||||
export class QuotationTable implements OnInit {
|
||||
private quotationsService = inject(QuotationsService);
|
||||
private notificationService = inject(NzNotificationService);
|
||||
private quotationProductsService = inject(QuotationproductsService)
|
||||
private fileService = inject(FileService);
|
||||
quotations = signal<GetQuotationDto[]>([]);
|
||||
quotationsLoading = signal<boolean>(false);
|
||||
modal = viewChild.required<ModalNav>('modalNav');
|
||||
modalQuantity = viewChild.required<ModalNav>('modalQuantity');
|
||||
|
||||
async ngOnInit() {
|
||||
await this.fetchQuotations();
|
||||
@@ -84,5 +94,92 @@ export class QuotationTable implements OnInit {
|
||||
}
|
||||
this.quotationsLoading.set(false)
|
||||
}
|
||||
|
||||
async edit(id: number, updateQuotationComponent: QuotationForm) {
|
||||
if (updateQuotationComponent.quotationForm.invalid) {
|
||||
this.notificationService.error('Erreur', 'Formulaire invalide');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const quotations = updateQuotationComponent.quotationForm.getRawValue();
|
||||
await firstValueFrom(this.quotationsService.updateQuotationEndpoint(id, quotations));
|
||||
this.notificationService.success('Success', 'Devis modifié')
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
this.notificationService.error('Erreur', 'Erreur lors de la modification')
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
openEditModal(quotation: GetQuotationDto) {
|
||||
this.selectedQuotation = { ...quotation };
|
||||
this.modal().showModal();
|
||||
}
|
||||
|
||||
async onModalOk(id: number, updateQuotationComponent: QuotationForm, modal: ModalNav) {
|
||||
if (!this.selectedQuotation) return;
|
||||
|
||||
await this.edit(id, updateQuotationComponent);
|
||||
updateQuotationComponent.quotationForm.reset();
|
||||
modal.isVisible = false;
|
||||
await this.fetchQuotations();
|
||||
}
|
||||
|
||||
onModalCancel(modal: ModalNav) {
|
||||
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,11 +1,25 @@
|
||||
<div class="flex mt-2">
|
||||
@if (hasSelection) {
|
||||
<app-modal-button #modalButton type="default" name="Créer un bon de commande" size="35%" class="ml-4">
|
||||
<app-purchase-order-form #purchaseOrderForm></app-purchase-order-form>
|
||||
<app-modal-button #modalButtonPurchaseOrder
|
||||
(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 #modalButton type="default" name="Créer un devis" size="35%" class="ml-4" (click)="test()">
|
||||
<app-quotation-form #quotationForm></app-quotation-form>
|
||||
<app-modal-button #modalButtonQuotation
|
||||
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>
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,12 @@ 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 {PurchaseordersService, QuotationsService} from "../../services/api";
|
||||
import {NzNotificationService} from "ng-zorro-antd/notification";
|
||||
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({
|
||||
selector: 'app-stock',
|
||||
@@ -14,58 +15,22 @@ import {firstValueFrom} from "rxjs";
|
||||
StockTable,
|
||||
Search,
|
||||
ModalButton,
|
||||
PurchaseOrderForm,
|
||||
QuotationForm,
|
||||
CreatePurchaseorderForm,
|
||||
CreateQuotationForm,
|
||||
],
|
||||
templateUrl: './stock.html',
|
||||
styleUrl: './stock.css',
|
||||
})
|
||||
|
||||
export class Stock {
|
||||
modal = viewChild.required<ModalButton>('modalButton');
|
||||
createQuotation = viewChild.required<QuotationForm>('quotationForm');
|
||||
createPurchaseOrder = viewChild.required<PurchaseOrderForm>('purchaseOrderForm');
|
||||
createPurchaseOrder = viewChild.required<CreatePurchaseorderForm>('purchaseOrderForm');
|
||||
createQuotation = viewChild.required<CreateQuotationForm>('quotationForm');
|
||||
productTable = viewChild.required<StockTable>('stockTable');
|
||||
private productsService = inject(ProductsService);
|
||||
private purchaseordersService = inject(PurchaseordersService)
|
||||
private quotationsService = inject(QuotationsService)
|
||||
private notificationService = inject(NzNotificationService)
|
||||
|
||||
onProductSearch(query: string) {
|
||||
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'
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
modalButtonPurchaseOrder = viewChild.required<ModalButton>('modalButtonPurchaseOrder');
|
||||
modalButtonQuotation = viewChild.required<ModalButton>('modalButtonQuotation');
|
||||
|
||||
hasSelection = false;
|
||||
|
||||
@@ -73,8 +38,101 @@ export class Stock {
|
||||
this.hasSelection = value;
|
||||
}
|
||||
|
||||
test(){
|
||||
console.log(this.productTable().selectedIds);
|
||||
onProductSearch(query: string) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
type="primary"
|
||||
name="Ajouter un utilisateur"
|
||||
(ok)="onModalOk()"
|
||||
(cancel)="onModalCancel()">
|
||||
(cancel)="onModalCancel()"
|
||||
size="35%">
|
||||
|
||||
<app-profil-form #profilForm></app-profil-form>
|
||||
</app-modal-button>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
.gitignore
|
||||
.openapi-generator-ignore
|
||||
README.md
|
||||
api.base.service.ts
|
||||
api.module.ts
|
||||
@@ -24,7 +23,11 @@ model/connect-user-dto.ts
|
||||
model/create-deliverer-dto.ts
|
||||
model/create-delivery-note-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-quotation-dto.ts
|
||||
model/create-quotation-product-dto.ts
|
||||
model/create-setting-dto.ts
|
||||
model/create-supplier-dto.ts
|
||||
@@ -58,7 +61,9 @@ model/patch-supplier-delivery-delay-dto.ts
|
||||
model/patch-user-password-dto.ts
|
||||
model/patch-ware-house-product-quantity-dto.ts
|
||||
model/update-deliverer-dto.ts
|
||||
model/update-delivery-note-dto.ts
|
||||
model/update-product-dto.ts
|
||||
model/update-quotation-dto.ts
|
||||
model/update-supplier-dto.ts
|
||||
model/update-user-dto.ts
|
||||
param.ts
|
||||
|
||||
@@ -12,7 +12,7 @@ import { CustomHttpParameterCodec } from './encoder';
|
||||
import { Configuration } from './configuration';
|
||||
|
||||
export class BaseService {
|
||||
protected basePath = 'http://localhost:5298';
|
||||
protected basePath = 'https://localhost:44379';
|
||||
public defaultHeaders = new HttpHeaders();
|
||||
public configuration: Configuration;
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
@@ -22,6 +22,8 @@ import { CreateDeliveryNoteDto } from '../model/create-delivery-note-dto';
|
||||
import { GetDeliveryNoteDto } from '../model/get-delivery-note-dto';
|
||||
// @ts-ignore
|
||||
import { PatchDeliveryNoteRealDeliveryDateDto } from '../model/patch-delivery-note-real-delivery-date-dto';
|
||||
// @ts-ignore
|
||||
import { UpdateDeliveryNoteDto } from '../model/update-delivery-note-dto';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
@@ -371,4 +373,72 @@ export class DeliverynotesService extends BaseService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @endpoint put /API/deliveryNotes/{id}
|
||||
* @param id
|
||||
* @param updateDeliveryNoteDto
|
||||
* @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 updateDeliveryNoteEndpoint(id: number, updateDeliveryNoteDto: UpdateDeliveryNoteDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<GetDeliveryNoteDto>;
|
||||
public updateDeliveryNoteEndpoint(id: number, updateDeliveryNoteDto: UpdateDeliveryNoteDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<GetDeliveryNoteDto>>;
|
||||
public updateDeliveryNoteEndpoint(id: number, updateDeliveryNoteDto: UpdateDeliveryNoteDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<GetDeliveryNoteDto>>;
|
||||
public updateDeliveryNoteEndpoint(id: number, updateDeliveryNoteDto: UpdateDeliveryNoteDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (id === null || id === undefined) {
|
||||
throw new Error('Required parameter id was null or undefined when calling updateDeliveryNoteEndpoint.');
|
||||
}
|
||||
if (updateDeliveryNoteDto === null || updateDeliveryNoteDto === undefined) {
|
||||
throw new Error('Required parameter updateDeliveryNoteDto was null or undefined when calling updateDeliveryNoteEndpoint.');
|
||||
}
|
||||
|
||||
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/deliveryNotes/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int32"})}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<GetDeliveryNoteDto>('put', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: updateDeliveryNoteDto,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ import { HttpClient, HttpHeaders, HttpParams,
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { CreatePurchaseOrderDto } from '../model/create-purchase-order-dto';
|
||||
// @ts-ignore
|
||||
import { GetPurchaseOrderDto } from '../model/get-purchase-order-dto';
|
||||
// @ts-ignore
|
||||
@@ -37,6 +39,70 @@ export class PurchaseordersService extends BaseService {
|
||||
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}
|
||||
* @param id
|
||||
|
||||
@@ -16,10 +16,14 @@ import { HttpClient, HttpHeaders, HttpParams,
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { CreateQuotationDto } from '../model/create-quotation-dto';
|
||||
// @ts-ignore
|
||||
import { GetQuotationDto } from '../model/get-quotation-dto';
|
||||
// @ts-ignore
|
||||
import { PatchQuotationConditionsSaleDto } from '../model/patch-quotation-conditions-sale-dto';
|
||||
// @ts-ignore
|
||||
import { UpdateQuotationDto } from '../model/update-quotation-dto';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
@@ -37,6 +41,70 @@ export class QuotationsService extends BaseService {
|
||||
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}
|
||||
* @param id
|
||||
@@ -305,4 +373,72 @@ export class QuotationsService extends BaseService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @endpoint put /API/quotations/{id}
|
||||
* @param id
|
||||
* @param updateQuotationDto
|
||||
* @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 updateQuotationEndpoint(id: number, updateQuotationDto: UpdateQuotationDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<GetQuotationDto>;
|
||||
public updateQuotationEndpoint(id: number, updateQuotationDto: UpdateQuotationDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<GetQuotationDto>>;
|
||||
public updateQuotationEndpoint(id: number, updateQuotationDto: UpdateQuotationDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<GetQuotationDto>>;
|
||||
public updateQuotationEndpoint(id: number, updateQuotationDto: UpdateQuotationDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (id === null || id === undefined) {
|
||||
throw new Error('Required parameter id was null or undefined when calling updateQuotationEndpoint.');
|
||||
}
|
||||
if (updateQuotationDto === null || updateQuotationDto === undefined) {
|
||||
throw new Error('Required parameter updateQuotationDto was null or undefined when calling updateQuotationEndpoint.');
|
||||
}
|
||||
|
||||
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/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int32"})}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<GetQuotationDto>('put', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: updateQuotationDto,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
productDuration?: number;
|
||||
productCaliber?: number;
|
||||
productApprovalNumber?: number;
|
||||
productApprovalNumber?: string | null;
|
||||
productWeight?: number;
|
||||
productNec?: number;
|
||||
productImage?: string | null;
|
||||
|
||||
@@ -13,6 +13,6 @@ import { GetPurchaseProductDto } from './get-purchase-product-dto';
|
||||
export interface GetPurchaseOrderDto {
|
||||
id?: number;
|
||||
purchaseConditions?: string | null;
|
||||
getPurchaseProductDto?: Array<GetPurchaseProductDto> | null;
|
||||
products?: Array<GetPurchaseProductDto> | null;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ export interface GetPurchaseProductDto {
|
||||
productName?: string | null;
|
||||
productDuration?: number;
|
||||
productCaliber?: number;
|
||||
productApprovalNumber?: number;
|
||||
productApprovalNumber?: string | null;
|
||||
productWeight?: number;
|
||||
productNec?: number;
|
||||
productImage?: string | null;
|
||||
|
||||
@@ -14,6 +14,6 @@ export interface GetQuotationDto {
|
||||
id?: number;
|
||||
message?: string | null;
|
||||
conditionsSale?: string | null;
|
||||
getQuotationProductDto?: Array<GetQuotationProductDto> | null;
|
||||
products?: Array<GetQuotationProductDto> | null;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ export interface GetQuotationProductDto {
|
||||
productName?: string | null;
|
||||
productDuration?: number;
|
||||
productCaliber?: number;
|
||||
productApprovalNumber?: number;
|
||||
productApprovalNumber?: string | null;
|
||||
productWeight?: number;
|
||||
productNec?: number;
|
||||
productImage?: string | null;
|
||||
|
||||
@@ -2,7 +2,11 @@ export * from './connect-user-dto';
|
||||
export * from './create-deliverer-dto';
|
||||
export * from './create-delivery-note-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-quotation-dto';
|
||||
export * from './create-quotation-product-dto';
|
||||
export * from './create-setting-dto';
|
||||
export * from './create-supplier-dto';
|
||||
@@ -35,6 +39,8 @@ export * from './patch-supplier-delivery-delay-dto';
|
||||
export * from './patch-user-password-dto';
|
||||
export * from './patch-ware-house-product-quantity-dto';
|
||||
export * from './update-deliverer-dto';
|
||||
export * from './update-delivery-note-dto';
|
||||
export * from './update-product-dto';
|
||||
export * from './update-quotation-dto';
|
||||
export * from './update-supplier-dto';
|
||||
export * from './update-user-dto';
|
||||
|
||||
19
src/app/services/api/model/update-delivery-note-dto.ts
Normal file
19
src/app/services/api/model/update-delivery-note-dto.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* 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 UpdateDeliveryNoteDto {
|
||||
trackingNumber?: string | null;
|
||||
estimateDeliveryDate?: string;
|
||||
expeditionDate?: string;
|
||||
realDeliveryDate?: string | null;
|
||||
delivererId?: number;
|
||||
}
|
||||
|
||||
16
src/app/services/api/model/update-quotation-dto.ts
Normal file
16
src/app/services/api/model/update-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 UpdateQuotationDto {
|
||||
message?: string | null;
|
||||
conditionsSale?: string | null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user