Skip to content
Snippets Groups Projects
Commit 98954d38 authored by hanane elmeskine's avatar hanane elmeskine
Browse files

commit

parent 2e724405
No related branches found
No related tags found
No related merge requests found
Showing
with 650 additions and 103 deletions
# Default ignored files
/workspace.xml
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/projet.iml" filepath="$PROJECT_DIR$/.idea/projet.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/back" vcs="Git" />
</component>
</project>
\ No newline at end of file
back @ b5dcb727
Subproject commit c5b2285e955509a0f7fcead0deba65fb71c74ef4
Subproject commit b5dcb7278d6cc614efb696d520f56362d05f20ad
......@@ -6,7 +6,7 @@ import { AppComponent } from './app.component';
import { PageOneComponent } from './page-one/page-one.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { PageDataComponent } from './page-data/page-data.component';
import {MatFormFieldModule, MatSelectModule, MatButtonModule, MatCardModule, MatGridListModule, MatTableModule} from '@angular/material';
import { MatFormFieldModule,MatInputModule, MatSelectModule, MatButtonModule, MatCardModule, MatGridListModule, MatTableModule} from '@angular/material';
import { PageChiffrageComponent } from './page-chiffrage/page-chiffrage.component';
import { FormsModule } from '@angular/forms';
import {ReactiveFormsModule} from '@angular/forms';
......@@ -34,6 +34,7 @@ import { PageVisualiserComponent } from './page-visualiser/page-visualiser.compo
BrowserAnimationsModule,
MatButtonModule,
MatFormFieldModule,
MatInputModule,
MatSelectModule,
MatCardModule,
MatGridListModule,
......
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { observable, Observable } from 'rxjs';
import { EventEmitter } from 'events';
@Injectable({
providedIn: 'root'
......@@ -61,25 +62,33 @@ export class AppService {
}
async createDevisProjet(p: number){
createDevisProjet(nomProjet, commentaire, numContrat, clientNom, clientId,
adresse, identTva, refClient, telephone, siret){
const url = `${this.rootURL+'/devisProjet'}`;
await (await this.getProjetById(p)).subscribe(project => {
this.project = project;
});
return await this.http.post<any>(url, {
nomProjet: this.project.nomProjet,
commentaire: this.project.commentaire,
numContrat: this.project.numContrat
return this.http.post<any>(url, {
nomProjet: nomProjet,
commentaire: commentaire,
numContrat: numContrat,
clientId: clientId,
clientNom: clientNom,
adresse: adresse,
identTva:identTva,
refClient:refClient,
telephone:telephone,
siret:siret
});
}
async createDevis(p: number) {
createDevis(p: number, nom: string, date: Date) {
const url = `${this.rootURL+'/devis'}`;
return await this.http.post<any>(url, {
libelle: "devis 1",
dataCreation: new Date(),
dateValidation: new Date(),
return this.http.post<any>(url, {
libelle: nom,
//total montant
//nb jour
dateCreation: new Date(),
dateValidation: date, //
devisProjet:{
devisProjetId: p
}
......@@ -126,5 +135,144 @@ export class AppService {
return this.http.get(url);
}
createDevisItem(devisId, num, ev, fo){
const url = `${this.rootURL+'/devisItem'}`;
return this.http.post<any>(url, {
evolution: ev,
fonction: fo,
devis:{
devisId: devisId
}
});
}
createDevisComplexiteItem(devisItemId ){
const url = `${this.rootURL+'/devisComplexiteItem'}`;
return this.http.post<any>(url, {
devisItem: {
devisItemId: devisItemId
}
});
}
createDevisComplexite(libelle,nom ,valeur,devisComplexiteItemId ,categorieDescription ,categorieId ,categorieName ,domaineId ,domaineDescription,domaineName){
const url = `${this.rootURL+'/devisComplexite'}`;
return this.http.post<any>(url, {
date : new Date(),
libelle :libelle,
nom :nom,
valeur:valeur,
categorieDescription :categorieDescription,
categorieId :categorieId,
categorieName :categorieName,
domaineId :domaineId,
domaineDesciption:domaineDescription,
domaineName: domaineName,
devisComplexiteItem :{
devisComplexiteItemId: devisComplexiteItemId
}
});
}
createDevisRatioItem(devisItemId){
const url = `${this.rootURL+'/devisRatioItem'}`;
return this.http.post<any>(url, {
devisItem: {
devisItemId: devisItemId
}
});
}
createDevisRatio(activiteId, activiteLibelle,activiteIdCourt,activiteIdLong,deliveryId, deliveryNom,deliveryLibelle, pourcentage, ordreAffichage, devisRatioItemId){
const url = `${this.rootURL+'/devisRatio'}`;
return this.http.post<any>(url, {
date: new Date(),
activiteId: activiteId,
activiteLibelle: activiteLibelle,
activiteIdCourt: activiteIdCourt,
activiteIdLong: activiteIdLong,
deliveryId: deliveryId,
deliveryNom: deliveryNom,
deliveryLibelle:deliveryLibelle,
pourcentage:pourcentage,
ordreAffichage:ordreAffichage,
devisRatioItem:{
devisRatioItemId: devisRatioItemId
}
});
}
createDevisTjItem(devisItemId){
const url = `${this.rootURL+'/devisTjItem'}`;
return this.http.post<any>(url, {
devisItem: {
devisItemId: devisItemId
}
});
}
createDevisTj(devisTjItemId,deliveryId2,deliveryLibelle2, deliveryNom2, profilId, profilLibelle, tjCout){
const url = `${this.rootURL+'/devisTj'}`;
return this.http.post<any>(url, {
date: new Date(),
cout: tjCout,
deliveryId: deliveryId2,
libelle: deliveryLibelle2,
nom: deliveryNom2,
profilId: profilId,
profilLibelle: profilLibelle,
devisTjItem:{
devisTjItemId: devisTjItemId
}
});
}
createDevisEcheancierItem(devisItemId){
const url = `${this.rootURL+'/devisEchancierItem'}`;
return this.http.post<any>(url, {
devisItem: {
devisItemId: devisItemId
}
});
}
createDevisEcheancier(deliveryId,deliveryNom,deliveryLibelle,etapeEchancierId,etapeEchancierEtape,pourcentage2,devisEchancierItemId){
const url = `${this.rootURL+'/devisEchancier'}`;
return this.http.post<any>(url, {
date: new Date(),
deliveryId : deliveryId,
etapeEchancierId: etapeEchancierId,
etapeEchancierEtape: etapeEchancierEtape,
pourcentage: pourcentage2,
deliveryNom: deliveryNom,
deliveryLibelle: deliveryLibelle,
devisEchancierItem:{
devisEchancierItemId: devisEchancierItemId,
}
});
}
getAllDevis(){
const url = `${this.rootURL+'/devis'}`;
return this.http.get(url);
}
getByDevisId(id: number){
const url = `${this.rootURL+'/devis'}/${id}`;
return this.http.get(url);
}
putMontantDevis(montant){
}
}
......@@ -10,6 +10,12 @@ import { AppService } from '../app.service';
templateUrl: './page-chiffrage.component.html',
styleUrls: ['./page-chiffrage.component.css']
})
export class PageChiffrageComponent implements OnInit {
constructor(private appService: AppService,private route: ActivatedRoute, private router: Router) { }
......@@ -29,6 +35,8 @@ export class PageChiffrageComponent implements OnInit {
row: Array<number>;
AllComplexite: number[] = []
AllComplexiteValue: number[] = []
devisItemId: number;
devisComplexiteItemId;
//information of rows
num: any[] = [];
......@@ -39,6 +47,19 @@ export class PageChiffrageComponent implements OnInit {
countColumn: number = 0;
total: number [] = [];
index: number = -1;
devisId;
//--------------------------------------
libelle: any[] = [];
nomP : any[] = [];
valeur: any[] = [];
devisComplexiteItemIdP ;
categorieDescription: any[] = [];categorieId: any[] = []; categorieName: any[] = [];
complexiteId ;complexiteLibelle;complexiteNom ;complexiteValeur;
domaineId ;
domaineDescription;
domaineName;
//--------------------------------------
ngOnInit() {
this.route.queryParamMap.subscribe(params => {
......@@ -47,6 +68,9 @@ export class PageChiffrageComponent implements OnInit {
this.categories = params.getAll('listCategorie');
this.domaines = params.getAll('listDomaine');
this.projetId = Number(params.get('projetId'));
this.devisId = Number(params.get('devisId'));
console.log(this.domaines)
//getAllComplexite
this.appService.getAllComplexite().subscribe((AllComplexite: any[]) => {
......@@ -57,6 +81,7 @@ export class PageChiffrageComponent implements OnInit {
for (let index = 0; index < this.domaines.length; index++) {
this.appService.getDomaineById(this.domaines[index]).subscribe((domaineNames: any[]) => {
this.domaineNames = this.domaineNames.concat(domaineNames['nom']);
});
}
......@@ -65,7 +90,12 @@ export class PageChiffrageComponent implements OnInit {
this.appService.getComplexiteByDomaine(this.domaines[index]).subscribe((complexite: any[]) => {
this.count[index] = complexite.length;
this.complexite = complexite;
this.tableau = this.tableau.concat(complexite)
});
}
......@@ -133,9 +163,6 @@ export class PageChiffrageComponent implements OnInit {
this.AllComplexiteValue[id] = column
console.log(this.AllComplexiteValue)
//Le calcul du total
this.total[this.index] = 0;
......@@ -145,16 +172,62 @@ export class PageChiffrageComponent implements OnInit {
}
//chaque ligne est un item devis (evolution, fonction)
//devis complexite contient les complexites
//complexite_tem = liste des devis complexite
//on Submit
onSave(){
console.log("Num = ", this.num);
console.log("Ev = ", this.evolution);
console.log("Fu = ", this.function);
console.log("Com = ", this.complexites);
//code répéter
//create devis item + num devis
for(let index = 1; index < this.evolution.length ; index ++){
this.appService.createDevisItem(this.devisId, this.num[index], this.evolution[index], this.function[index]).subscribe((data: any[]) => {
this.devisItemId = data['devisItemId'];
//create devis_complexite_item
this.appService.createDevisComplexiteItem(this.devisItemId).subscribe(data => {
this.devisComplexiteItemId = data['devisComplexiteItemId'];
//get domaine by name
for (let index = 0; index < this.domaines.length; index++) {
this.appService.getDomaineById(this.domaines[index]).subscribe((domaineName: any[]) => {
this.domaineName = domaineName['nom'];
this.domaineId = (domaineName['domaineId']);
this.domaineDescription = (domaineName['libelle']);
this.appService.getComplexiteByDomaine(this.domaines[index]).subscribe(complexite => {
//get complexite information
for (let index = 0; index < Object.entries(complexite).length; index++) {
this.libelle = this.libelle.concat((complexite[index])['libelle'])
this.nomP = this.nomP.concat((complexite[index])['nom'])
this.valeur = this.valeur.concat((complexite[index])['valeur'])
this.categorieDescription = ((((complexite[index])['domaine'])['categorie'])['libelle'])
this.categorieId = ((((complexite[index])['domaine'])['categorie'])['categorieId'])
this.categorieName = ((((complexite[index])['domaine'])['categorie'])['nom'])
//create devis_complexite
this.appService.createDevisComplexite(
this.libelle[index], this.nomP[index], this.valeur[index],
this.devisComplexiteItemId,
this.categorieDescription, this.categorieId, this.categorieName,
this.domaineId, this.domaineDescription, this.domaineName).subscribe(data => {
console.log()
});
}
});
});
}
});
});
}
console.log(this.devisItemId)
this.router.navigate(['/pageDelivery'],
{queryParams:
{
......@@ -165,12 +238,17 @@ export class PageChiffrageComponent implements OnInit {
projetId: this.projetId,
totals: this.total,
client: this.client,
projet: this.projet
projet: this.projet,
devisId: this.devisId
}
}).then(()=>{
window.location.reload();
});
}
}
......@@ -16,6 +16,20 @@
<form [formGroup]="myGroup" (ngSubmit)="onSubmit(formGroup)">
<mat-card-content>
<h3></h3>
<mat-form-field appearance="legacy">
<mat-label>Donner un nom pour devis:</mat-label>
<input matInput type="text" formControlName="nomDevis" >
</mat-form-field>
<h3></h3>
<mat-form-field appearance="legacy">
<mat-label>Date de validation</mat-label>
<input matInput type="date" formControlName="date" >
</mat-form-field>
<h3></h3>
<mat-form-field appearance="legacy">
......@@ -57,6 +71,11 @@
</mat-select>
</mat-form-field>
</mat-card-content>
<button mat-raised-button color="primary" style="margin-right:100px;">Valider</button>
</form>
......
......@@ -2,6 +2,9 @@ import { Component, OnInit } from '@angular/core';
import { AppService } from '../app.service';
import {FormControl, FormGroup, FormBuilder, Validators} from '@angular/forms';
import { Router } from '@angular/router';
import {MatFormFieldModule, MatInputModule} from '@angular/material';
......@@ -26,17 +29,27 @@ export class PageDataComponent implements OnInit {
myGroup: FormGroup;
cat = [];
dom = [];
date;
nomDevis;
projetId: number
clientId: number
data;
devisProjetId;
nomProjet;
commentaire;
numContrat;
devisId: number;
clientId2;clientNom;adresse;identTva;refClient;telephone;siret;
ngOnInit() {
this.myGroup = this.formBuilder.group({
nomDevis: ['', Validators.required],
date: ['', Validators.required],
nom: ['', Validators.required],
projet: ['', Validators.required],
dom: [[], Validators.required],
cat: [[], Validators.required]
});
this.appService.getClient().subscribe((users: any[]) => {
......@@ -55,10 +68,33 @@ export class PageDataComponent implements OnInit {
}
//récupérer le nom du projet selon le client choisit
changeProject(selectedProject){
async changeProject(selectedProject){
this.projetId = selectedProject;
this.appService.getCategorieByProjectId(selectedProject).subscribe((categories: any[]) => {
await this.appService.getCategorieByProjectId(selectedProject).subscribe((categories: any[]) => {
this.categories = categories;
this.appService.getProjetById(this.projetId).subscribe(project => {
this.nomProjet= project['nomProjet'],
this.commentaire= project['commentaire'],
this.numContrat= project['numContrat']
this.clientId2 = (project['client'])['clientId']
this.clientNom = (project['client'])['nom']
this.adresse = (project['client'])['adresse']
this.identTva = (project['client'])['identTva']
this.refClient = (project['client'])['refClient']
this.telephone = (project['client'])['telephone']
this.siret = (project['client'])['siret']
//create devis project
this.appService.createDevisProjet(this.nomProjet, this.commentaire, this.numContrat, this.clientNom, this.clientId,
this.adresse, this.identTva, this.refClient, this.telephone, this.siret).subscribe(data => {
this.devisProjetId = data['devisProjetId'];
});
});
});
}
......@@ -70,7 +106,6 @@ export class PageDataComponent implements OnInit {
this.domaines = []
this.myGroup.value.cat = this.selectedCat.value
for(let i=0; i<this.selectedCat.value.length;i++){
console.log(this.selectedCat.value[i])
this.appService.getDomainesByCategorieId(this.selectedCat.value[i]).subscribe((domaines: any[]) => {
this.domaines = this.domaines.concat(domaines);
});
......@@ -84,24 +119,18 @@ export class PageDataComponent implements OnInit {
if(!selectedDomaines) {
this.isClose = true;
this.myGroup.value.dom = this.selectedDom.value
for(let i=0; i<this.selectedDom.value.length;i++)
console.log(this.selectedDom.value[i])
}
}
//create devis
//create devis project
onSubmit() {
async onSubmit() {
await (await this.appService.createDevisProjet(this.projetId)).subscribe(data => {
this.data = data;
});
await this.appService.createDevis(this.data.devisProjetId);
//create devis
(this.appService.createDevis(this.devisProjetId, this.myGroup.value.nomDevis, this.myGroup.value.date)).subscribe(data => {
this.devisId = data['devisId']
console.log()
this.router.navigate(['/pageChiffrage'],
{queryParams:
{
......@@ -109,17 +138,21 @@ export class PageDataComponent implements OnInit {
nomProjet: this.myGroup.value.projet,
listCategorie: this.myGroup.value.cat,
listDomaine: this.myGroup.value.dom,
projetId: this.projetId
projetId: this.projetId,
devisId: data['devisId']
},
}
).then(()=>{
window.location.reload();
});
);
})
}
//devis item
}
}
......@@ -42,6 +42,17 @@ export class PageDeliveryComponent implements OnInit {
totalTj: number = 0;
checked = false;
modelDelivery: string;
devisRatioItemId;
//----------------------------------------------
devisRatioId;activiteLibelle;activiteIdCourt;activiteIdLong;
deliveryId;deliveryNom;deliveryLibelle;
pourcentage;ordreAffichage;
//----------------------------------------------
devisTjItemId;
deliveryId2;deliveryNom2;deliveryLibelle2;
profilId;profilLibelle;profilCout;
tjCout;
devisId;
......@@ -55,6 +66,10 @@ export class PageDeliveryComponent implements OnInit {
this.totalsString = (params.getAll('totals'));
this.client = params.get('client');
this.projet = params.get('projet');
this.devisId = Number(params.get('devisId'));
console.log(this.devisId)
for (let index = 0; index < this.totalsString.length; index++) {
this.totals[index] = Number(this.totalsString[index]);
}
......@@ -68,7 +83,9 @@ export class PageDeliveryComponent implements OnInit {
}
//appeler lors du choix du modele de delivery
changeModele(selectedModele){
async changeModele(selectedModele){
this.activite = []
this.pourcentages = []
this.indexp = 0;
......@@ -83,16 +100,33 @@ export class PageDeliveryComponent implements OnInit {
this.appService.getProfilByProfilId((Object.entries(tjs)[index])[1].id.profilId).subscribe((profils: any[]) => {
this.profils = this.profils.concat(profils);
//create devis_tj_item
this.appService.createDevisTjItem(this.devisId).subscribe(data => {
this.devisTjItemId = data['devisTjItemId'];
this.deliveryId2 = ((tjs[index])['delivery'])['deliveryId'];
this.deliveryLibelle2 = ((tjs[index])['delivery'])['libelle'];
this.deliveryNom2 = ((tjs[index])['delivery'])['nom'];
this.profilId = profils['profilId']
this.profilLibelle = profils['libelle']
this.tjCout = (tjs[index])['cout'];
//create devis-tj
this.appService.createDevisTj(this.devisId,this.deliveryId2,this.deliveryLibelle2, this.deliveryNom2, this.profilId, this.profilLibelle, this.tjCout ).subscribe(data => {
//console.log(data)
});
});
});
}
});
//1- get ratio (idActivite, idDelivery, ....)
this.appService.getRatioByDeliveryId(selectedModele).subscribe((ratios: any[]) => {
await this.appService.getRatioByDeliveryId(selectedModele).subscribe((ratios: any[]) => {
for (let index = 0; index < Object.entries(ratios).length; index++) {
//pour chaque ratio, je récupere le pourcentage et je stock tout dans une table pourcentages
this.pourcentages[this.indexp] = (Object.entries(ratios)[index])[1].pourcentage
this.indexp++;
......@@ -102,7 +136,8 @@ export class PageDeliveryComponent implements OnInit {
});
}
//matrice [ratio][ligne] : pour garder tout les valeurs calculer de chaque ligne, matrice est un bon choix
//matrice [ratio][ligne] : pour enregistrer les valeurs calculer de chaque ligne,
//une matrice est un bon choix
this.calculs = new Array(Object.entries(ratios).length);
for (let index = 0; index < Object.entries(ratios).length; index++) {
this.calculs[index] = new Array(this.totals.length)
......@@ -125,18 +160,52 @@ export class PageDeliveryComponent implements OnInit {
this.totalsRatio[index1] = this.totalsRatio[index1] + this.totals[index1]
this.totalTotals = this.totalTotals + this.totalsRatio[index1];
}
for(let i =0;i<Object.entries(ratios).length; i++){
this.appService.getActiviteByActiviteId( ((ratios[i])['id'])['activiteId']).subscribe((activite: any[]) => {
//create devis-ratio-item
this.appService.createDevisRatioItem(this.devisId).subscribe(data => {
this.activiteId = activite['activiteId'];
this.devisRatioItemId = data['devisRatioItemId'];
//info activite
this.activiteLibelle = activite['libelle']
this.activiteIdCourt = activite['idCourt']
this.activiteIdLong = activite['idLong']
this.deliveryId = ((ratios[i])['delivery'])['deliveryId'];
//info delivery
this.deliveryNom = ((ratios[i])['delivery'])['nom'];
this.deliveryLibelle = ((ratios[i])['delivery'])['libelle'];
this.pourcentage = (ratios[i])['pourcentage']
this.ordreAffichage = (ratios[i])['ordreAffichage']
//create devis-ratio
this.appService.createDevisRatio(this.activiteId, this.activiteLibelle,this.activiteIdCourt,this.activiteIdLong,this.deliveryId, this.deliveryNom,
this.deliveryLibelle, this.pourcentage, this.ordreAffichage, this.devisRatioItemId).subscribe(data => {
//console.log(data)
});
});
});
}
});
}
//fonction appeler dans chaque changement de profil
changeProfil(selectedP){
console.log(selectedP)
if(this.checked == false){
console.log(this.checked)
if(this.checked == true){
this.totalTj = 0
this.totalCout = 0
for (let index1 = 0; index1 < this.totals.length; index1++) {
this.calculTj[index1] = 0
}
}
this.cout = this.ListCout[selectedP - 1]
this.selectedProfil[this.indexProfil] = this.cout;
......@@ -151,11 +220,7 @@ export class PageDeliveryComponent implements OnInit {
//calcul Total TJ
this.totalTj = this.totalTj + this.calculTj[this.indexProfil]
this.indexProfil++;
}
else{
this.selectedProfil[this.indexProfil] = 0
//this.indexProfil++;
}
}
//appeler si je coche la case du tarif unique
......@@ -186,11 +251,13 @@ export class PageDeliveryComponent implements OnInit {
}
}
//create devis-ratio et devis-ratio-item
//create devis-tj et devis-tj-item
//onSubmit
onSave(){
this.router.navigate(['/pageEchancier'],
{queryParams:
{
......@@ -198,7 +265,14 @@ export class PageDeliveryComponent implements OnInit {
projetId: this.projetId,
client: this.client ,
projet: this.projet,
model: this.modelDelivery
model: this.modelDelivery,
devisId: this.devisId,
evolution: this.evolution,
function: this.function,
ptu: this.totals,
charge: this.totalsRatio,
montant: this.calculTj,
}
});
......
......@@ -27,6 +27,12 @@ export class PageEchancierComponent implements OnInit {
Montant: number[] = []
indexMontant: number = 0;
tableDates: Date[] = [];
devisId;
evolution;function;ptu;charge;montant
//---------------------------
deliveryId; deliveryNom;deliveryLibelle;
etapeEchancierId;etapeEchancierEtape;
pourcentage2;devisEchancierItemId;
ngOnInit() {
......@@ -36,11 +42,16 @@ export class PageEchancierComponent implements OnInit {
this.client = params.get('client');
this.projet = params.get('projet');
this.model = params.get('model');
this.devisId = Number(params.get('devisId'));
this.evolution = params.getAll('evolution');
this.function = params.getAll('function');
this.ptu = params.getAll('ptu');
this.charge = params.getAll('charge');
this.montant = params.getAll('montant');
});
//get modele de delivery par projet
this.appService.getDeliveryByProjectId(this.projetId).subscribe((delivery: any[]) => {
this.delivery = delivery;
console.log(this.delivery)
});
}
......@@ -55,8 +66,10 @@ export class PageEchancierComponent implements OnInit {
//get etapes d'echéancier par delivery id
this.appService.getEchancierByDeliveryId(selectedModel).subscribe((tjs: any[]) => {
this.totalP = 0
for (let index = 0; index < Object.entries(tjs).length; index++) {
//récupérer le pourcentage de chaque étape
this.pourcentage[this.indexP] = (Object.entries(tjs)[index])[1].pourcentage
......@@ -67,10 +80,29 @@ export class PageEchancierComponent implements OnInit {
this.Montant[this.indexP] = this.total * (this.pourcentage[this.indexP]/100);
this.indexP++;
this.appService.getEtapeByEtapeId((Object.entries(tjs)[index])[1].echancierId.etapeEchancierId)
.subscribe((etapes: any[]) => {
this.appService.getEtapeByEtapeId((Object.entries(tjs)[index])[1].echancierId.etapeEchancierId).subscribe((etapes: any[]) => {
//Devis item echéancier
this.appService.createDevisEcheancierItem(this.devisId).subscribe(data => {
this.devisEchancierItemId = data['devisEchancierItemId'];
this.etapes = this.etapes.concat(etapes);
this.NomEtapes = this.NomEtapes.concat(etapes['etape'])
console.log(etapes)
this.deliveryId = ((tjs[index])['delivery'])['deliveryId']
this.deliveryNom = ((tjs[index])['delivery'])['nom']
this.deliveryLibelle= ((tjs[index])['delivery'])['libelle']
this.etapeEchancierId = etapes['etapeEchancierId']
this.etapeEchancierEtape = etapes['etape']
this.pourcentage2 = (tjs[index])['pourcentage']
//Devis echéancier
this.appService.createDevisEcheancier(this.deliveryId,this.deliveryNom,this.deliveryLibelle,
this.etapeEchancierId,this.etapeEchancierEtape,this.pourcentage2,this.devisEchancierItemId).subscribe(data => {
console.log(data)
});
});
});
}
});
......@@ -98,11 +130,9 @@ export class PageEchancierComponent implements OnInit {
this.tableDates[index] = event.target.value;
}
}
console.log(this.tableDates)
}
//Devis echéancier
//Devis item echéancier
onSave(){
this.router.navigate(['/pageSynthese'],
......@@ -115,7 +145,13 @@ export class PageEchancierComponent implements OnInit {
etapes: this.NomEtapes,
montant: this.Montant,
dates: this.tableDates,
delivery: this.modelDelivery
delivery: this.modelDelivery,
devisId: this.devisId,
evolution: this.evolution ,
function: this.function,
ptu: this.ptu ,
charge: this.charge ,
montantTotal: this.montant,
}
});
}
......
<div class="center2">
<h1>BIENVENU</h1>
<h1>BIENVENUE</h1>
</div>
<div class="center">
......
......@@ -13,27 +13,55 @@
<mat-card-title>Synthèse:</mat-card-title>
</mat-card-title>
<mat-card-content>
<div id="all">
<div id="bold">Nom client: </div>{{NomClient}}
<div id="bold">Nom Projet: </div>{{NomProjet}}
<div id="bold">Modéle de delivery: </div>{{model}}
<div>
<div>Nom client: {{NomClient}}</div>
<div>Nom Projet: {{NomProjet}}</div>
<div>Devis: {{nomdevis}}</div>
</div>
<div>
<div>Date Création:{{dateCreation}}</div>
<div>Date Validation: {{dateValidation}}</div>
</div>
<table>
<tr>
<th>Fonction</th>
<th>Evolution</th>
<th>Total PTU</th>
<th>charge total </th>
<th>Montant total HT </th>
</tr>
<tr *ngFor ="let e of this.ptu; let i = index">
<td>{{function[i]}}</td>
<td>{{evolution[i]}}</td>
<td>{{ptu[i]}}</td>
<td>{{charge[i]}}</td>
<td>{{montant[i]}}</td>
</tr>
<tfoot>
<tr>
<td></td>
<td></td>
<td> </td>
<td></td>
<td>{{montantTotal}}</td>
</tr>
</tfoot>
</table>
<p></p>
<h4>Echeancier:</h4>
<table>
<tr>
<th>Etape</th>
<th>Montant à payer</th>
<th>Date </th>
</tr>
<tr *ngFor ="let e of etapes; let i = index">
<td>{{e}}</td>
<td>{{Montant[i]}}</td>
<td>{{dates[i]}}</td>
</tr>
<tfoot>
<tr>
<td></td>
<td>Total:</td>
<td>{{total}} </td>
<td></td>
</tr>
</tfoot>
</table>
......
......@@ -20,7 +20,13 @@ export class PageSyntheseComponent implements OnInit {
etapes;
Montant;
dates;
devis;
devisId;
delivery;
evolution;function;ptu;charge;montant;
montantTotal: number = 0
dateCreation; dateValidation;
nomdevis;
ngOnInit() {
......@@ -32,8 +38,29 @@ export class PageSyntheseComponent implements OnInit {
this.Montant = params.getAll('montant');
this.dates = params.getAll('dates');
this.model = params.get('delivery');
this.evolution = params.getAll('evolution');
this.function = params.getAll('function');
this.ptu = params.getAll('ptu');
this.charge = params.getAll('charge');
this.montant = params.getAll('montantTotal');
this.devisId = Number(params.get('devisId'));
for (let index = 0; index < this.montant.length; index++){
this.montantTotal = this.montantTotal + Number(this.montant[index]);
}
});
this.appService.putMontantDevis(this.montantTotal);
//get date
this.appService.getByDevisId(this.devisId).subscribe(devis => {
this.dateCreation = devis['dateCreation'];
this.dateValidation = devis['dateValidation']
this.nomdevis = devis['libelle']
})
//get client by id
this.appService.getClientById(this.client).subscribe(Client => {
......@@ -41,7 +68,7 @@ export class PageSyntheseComponent implements OnInit {
});
//get Projet by id
( this.appService.getProjetById(this.projet)).subscribe(Projet => {
this.appService.getProjetById(this.projet).subscribe(Projet => {
this.NomProjet = Projet['nomProjet'];
});
......
......@@ -9,17 +9,29 @@
<mat-card-content>
<table>
<tr>
<th>Etape</th>
<th>Montant à payer</th>
<th>Date </th>
<th>DevisId</th>
<th>Client</th>
<th>Projet</th>
<th>Nom devis</th>
<th>Date de validation de devis</th>
<th>Date de creation de devis</th>
<th>Nombre de jours</th>
</tr>
<tr *ngFor="let d of devisId; let i = index">
<td>{{devisId[i]}}</td>
<td>{{client[i]}}</td>
<td>{{projet[i]}}</td>
<td>{{devisNom[i]}}</td>
<td>{{dateValidation[i]}}</td>
<td>{{dateCreation[i]}}</td>
<td>{{nbJours[i]}}</td>
</tr>
<tfoot>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tfoot>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
......@@ -27,5 +39,6 @@
</tfoot>
</table>
</mat-card-content>
<button mat-raised-button color="primary" (click)="onRetour()" style="margin-right:100px;">Retour</button>
</mat-card>
</div>
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute, ParamMap } from '@angular/router';
import { AppService } from '../app.service';
@Component({
selector: 'app-page-visualiser',
......@@ -7,9 +9,65 @@ import { Component, OnInit } from '@angular/core';
})
export class PageVisualiserComponent implements OnInit {
constructor() { }
constructor(private appService: AppService,private route: ActivatedRoute, private router: Router) { }
devisId: any[] = [];
client: any[] = [];
categorie: any[] = [];
projet: any[] = [];
date:any[] = [];
contrat: any[]=[];
adresse: any[]=[];
identTva: any[]=[];
refClient: any[]=[];
telephone: any[]=[];
siret: any[]=[];
dateValidation: Date[]=[];
dateCreation: Date[]=[];
devisNom: any[]=[];
nbJours: any[] = [];
ngOnInit() {
//get devis
this.appService.getAllDevis().subscribe(devis => {
for(let i =0;i<Object.entries(devis).length; i++){
this.devisId = this.devisId.concat((devis[i])['devisId'])
this.dateCreation = this.dateCreation.concat((devis[i])['dateCreation'])
this.dateValidation = this.dateValidation.concat((devis[i])['dateValidation'])
this.devisNom = this.devisNom.concat((devis[i])['libelle'])
this.client = this.client.concat(((devis[i])['devisProjet'])['clientNom'])
this.categorie = this.categorie.concat(((devis[i])['devisProjet'])['categorieNom'])
this.projet = this.projet.concat(((devis[i])['devisProjet'])['nomProjet'])
this.contrat = this.contrat.concat(((devis[i])['devisProjet'])['numContrat'])
this.adresse = this.adresse.concat(((devis[i])['devisProjet'])['adresse'])
this.identTva = this.identTva.concat(((devis[i])['devisProjet'])['identTva'])
this.refClient = this.refClient.concat(((devis[i])['devisProjet'])['refClient'])
this.telephone = this.telephone.concat(((devis[i])['devisProjet'])['telephone'])
this.siret = this.siret.concat(((devis[i])['devisProjet'])['siret'])
this.date = this.date.concat((devis[i])['dateValidation'])
}
for(let i=0;i<this.dateCreation.length; i++){
var time_diff = new Date(this.dateValidation[i]).getTime() - new Date(this.dateCreation[i]).getTime()
var days_Diff : number = time_diff / (1000 * 3600 * 24);
this.nbJours = this.nbJours.concat(Math.round(days_Diff));
}
});
}
onRetour(){
this.router.navigate(['/appOne'])
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment