Compare commits

...

3 Commits

Author SHA1 Message Date
Okandze-Diessy 17271cee11 messe 2024-08-19 18:17:37 +01:00
Okandze-Diessy f67b2e87d1 Diessy Okandze 2024-08-19 17:51:29 +01:00
Okandze-Diessy a1fb113129 Diessy Okandze 2024-08-19 17:49:51 +01:00
35 changed files with 5020 additions and 3696 deletions

8060
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,31 +10,31 @@
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@angular/animations": "^14.1.0", "@angular/animations": "^17.3.8",
"@angular/common": "^14.1.0", "@angular/common": "^17.3.8",
"@angular/compiler": "^14.1.0", "@angular/compiler": "^17.3.8",
"@angular/core": "^14.1.0", "@angular/core": "^17.3.8",
"@angular/forms": "^14.1.0", "@angular/forms": "^17.3.8",
"@angular/platform-browser": "^14.1.0", "@angular/platform-browser": "^17.3.8",
"@angular/platform-browser-dynamic": "^14.1.0", "@angular/platform-browser-dynamic": "^17.3.8",
"@angular/router": "^14.1.0", "@angular/router": "^17.3.8",
"primeicons": "^7.0.0", "primeicons": "^1.0.0",
"primeng": "^14.2.3", "primeng": "^17.18.9",
"rxjs": "~7.5.0", "rxjs": "~7.8.1",
"tslib": "^2.3.0", "tslib": "^2.3.0",
"zone.js": "~0.11.4" "zone.js": "~0.14.3"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "^14.1.2", "@angular-devkit/build-angular": "^17.3.8",
"@angular/cli": "~14.1.2", "@angular/cli": "~17.3.8",
"@angular/compiler-cli": "^14.1.0", "@angular/compiler-cli": "^17.3.0",
"@types/jasmine": "~4.0.0", "@types/jasmine": "~5.1.0",
"jasmine-core": "~4.2.0", "jasmine-core": "~5.1.0",
"karma": "~6.4.0", "karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.0", "karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.2.0", "karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0", "karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0", "karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~4.7.2" "typescript": "~5.4.2"
} }
} }

View File

@ -1,6 +1,5 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router'; import { RouterModule, Routes } from '@angular/router';
import {VehicleListComponent} from "./features/vehicle/page/vehicle-list/vehicle-list.component";
import {LayoutComponent} from "./layout/layout.component"; import {LayoutComponent} from "./layout/layout.component";
import {VehicleViewComponent} from "./features/vehicle/page/vehicle-view/vehicle-view.component"; import {VehicleViewComponent} from "./features/vehicle/page/vehicle-view/vehicle-view.component";
@ -24,6 +23,14 @@ const routes: Routes = [
path:'vehicle', path:'vehicle',
loadChildren: () => import('./features/vehicle/vehicle.module').then(m => m.VehicleModule) loadChildren: () => import('./features/vehicle/vehicle.module').then(m => m.VehicleModule)
}, },
{
path:'contact',
loadChildren: () => import('./features/contact/contact.module').then(m => m.ContactModule)
},
{
path:'problem',
loadChildren: () => import('./features/problem/problem.module').then(m => m.ProblemModule)
},
{ {
path:'service', path:'service',
loadChildren: () => import('./features/service/service.module').then(m => m.ServiceModule) loadChildren: () => import('./features/service/service.module').then(m => m.ServiceModule)

View File

@ -0,0 +1,30 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import {RouterModule, Routes} from "@angular/router";
import {ContactListComponent} from "./page/contact-list/contact-list.component";
import {ContactEditComponent} from "./page/contact-edit/contact-edit.component";
import {ContactViewComponent} from "./page/contact-view/contact-view.component";
const routes: Routes=[
{
path: "",
component:ContactListComponent
},
{
path: "edit",
component: ContactEditComponent
},
{
path: "view",
component: ContactViewComponent
}
]
@NgModule({
declarations: [],
imports: [
CommonModule,
RouterModule.forChild(routes)
]
})
export class ContactModule { }

View File

@ -0,0 +1,18 @@
<div>
<div>
<label>Nom</label>
<input [(ngModel)]="contact.lastname" type="text" pInputText />
<br>
<label>Prénom</label>
<input [(ngModel)]="contact.firstname" type="text" pInputText />
<label>Téléphone</label>
<input [(ngModel)]="contact.phone" type="text" pInputText />
<label>Email</label>
<input [(ngModel)]="contact.mail" type="text" pInputText />
</div>
<button (click)="save()" pButton type="button" label="Enregistrer"></button>
</div>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ContactEditComponent } from './contact-edit.component';
describe('ContactEditComponent', () => {
let component: ContactEditComponent;
let fixture: ComponentFixture<ContactEditComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ContactEditComponent]
})
.compileComponents();
fixture = TestBed.createComponent(ContactEditComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,35 @@
import {Component, OnInit} from '@angular/core';
import {ButtonDirective} from "primeng/button";
import {FormsModule} from "@angular/forms";
import {InputTextModule} from "primeng/inputtext";
import {ContactServiceService} from "../../service/contact.service.service";
import {Router} from "@angular/router";
@Component({
selector: 'app-contact-edit',
standalone: true,
imports: [
ButtonDirective,
FormsModule,
InputTextModule
],
templateUrl: './contact-edit.component.html',
styleUrl: './contact-edit.component.scss'
})
export class ContactEditComponent implements OnInit{
contact:any={}
constructor(private contactService: ContactServiceService,private router: Router) {}
ngOnInit() {
}
save() {
this.contactService.create(this.contact).subscribe( {
next: (res)=>{
if(res.success){
this.router.navigateByUrl("/app/contact").then();
}
}
})
}
}

View File

@ -0,0 +1,30 @@
<div style="text-align: right; margin-bottom :10px">
<button (click)="edit()" pButton type="button" label="Ajouter un contact"></button>
</div>
<p-table [value]="contacts" [tableStyle]="{'min-width': '50rem'}">
<ng-template pTemplate="header">
<tr>
<th>Nom</th>
<th>Prénom</th>
<th>Téléphone</th>
<th>Email</th>
<th>Actions</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-contact>
<tr>
<td>{{contact.lastname}}</td>
<td>{{contact.firstname}}</td>
<td>{{contact.phone}}</td>
<td>{{contact.mail}}</td>
<td>
<i class="pi pi-pencil" style="margin-right: 10px"></i>
<i class="pi pi-trash" style="margin-right: 10px"></i>
<i class="pi pi-eye" style="margin-right: 10px"></i>
</td>
</tr>
</ng-template>
</p-table>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ContactListComponent } from './contact-list.component';
describe('ContactListComponent', () => {
let component: ContactListComponent;
let fixture: ComponentFixture<ContactListComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ContactListComponent]
})
.compileComponents();
fixture = TestBed.createComponent(ContactListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,41 @@
import {Component, OnInit} from '@angular/core';
import {ButtonDirective} from "primeng/button";
import {PrimeTemplate} from "primeng/api";
import {TableModule} from "primeng/table";
import {ContactServiceService} from "../../service/contact.service.service";
import {Router} from "@angular/router";
@Component({
selector: 'app-contact-list',
standalone: true,
imports: [
ButtonDirective,
PrimeTemplate,
TableModule
],
templateUrl: './contact-list.component.html',
styleUrl: './contact-list.component.scss'
})
export class ContactListComponent implements OnInit{
contacts: any[]=[]
constructor(private contactService: ContactServiceService,private router: Router) {
}
ngOnInit() {
this.getServices()
}
getServices() {
this.contactService.getAll().subscribe({
next: (res) => {
if (res.success) {
this.contacts = res.data;
}
}
})
}
edit(): void{
this.router.navigateByUrl('/app/contact/edit').then()
}
}

View File

@ -0,0 +1 @@
<p>contact-view works!</p>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ContactViewComponent } from './contact-view.component';
describe('ContactViewComponent', () => {
let component: ContactViewComponent;
let fixture: ComponentFixture<ContactViewComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ContactViewComponent]
})
.compileComponents();
fixture = TestBed.createComponent(ContactViewComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,12 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-contact-view',
standalone: true,
imports: [],
templateUrl: './contact-view.component.html',
styleUrl: './contact-view.component.scss'
})
export class ContactViewComponent {
}

View File

@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { ContactServiceService } from './contact.service.service';
describe('ContactServiceService', () => {
let service: ContactServiceService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ContactServiceService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,45 @@
import { Injectable } from '@angular/core';
import {HttpClient} from "@angular/common/http";
import {Observable} from "rxjs";
import {apiRoute} from "../../../core/routes/api.route";
@Injectable({
providedIn: 'root'
})
export class ContactServiceService {
url:string="contact";
constructor(private http: HttpClient) { }
//getAll :
getAll():Observable<any>{
return this.http.get<any>(apiRoute+this.url);
}
//getById :
getById(id:string):Observable<any>{
return this.http.get<any>(apiRoute+this.url+"/"+id)
}
//create :
create(contact: any):Observable<any>{
return this.http.post<any>(apiRoute+this.url,contact)
}
//update :
update(contact: any):Observable<any>{
return this.http.put<any>(apiRoute+this.url+"/"+contact.id,contact)
}
//delete :
delete(id:string):Observable<any>{
return this.http.delete<any>(apiRoute+this.url+"/"+id)
}
}

View File

@ -0,0 +1,15 @@
<div>
<div>
<label>Description</label>
<input [(ngModel)]="problem.description" type="text" pInputText />
<br>
<label>Date</label>
<input [(ngModel)]="problem.date" type="text" pInputText />
<label>Statut</label>
<input [(ngModel)]="problem.status" type="text" pInputText />
</div>
<button (click)="save()" pButton type="button" label="Enregistrer"></button>
</div>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ProblemEditComponent } from './problem-edit.component';
describe('ProblemEditComponent', () => {
let component: ProblemEditComponent;
let fixture: ComponentFixture<ProblemEditComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ProblemEditComponent]
})
.compileComponents();
fixture = TestBed.createComponent(ProblemEditComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,38 @@
import {Component, OnInit} from '@angular/core';
import {ButtonDirective} from "primeng/button";
import {PrimeTemplate} from "primeng/api";
import {TableModule} from "primeng/table";
import {InputTextModule} from "primeng/inputtext";
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
import {ProblemServiceService} from "../../service/problem.service.service";
import {Router} from "@angular/router";
@Component({
selector: 'app-problem-edit',
standalone: true,
imports: [
ButtonDirective,
PrimeTemplate,
TableModule,
InputTextModule,
ReactiveFormsModule,
FormsModule
],
templateUrl: './problem-edit.component.html',
styleUrl: './problem-edit.component.scss'
})
export class ProblemEditComponent implements OnInit{
problem:any={}
constructor(private problemService: ProblemServiceService, private router: Router) {
}
ngOnInit() {
}
save():void{
this.problemService.create(this.problem).subscribe({
next: (res)=>{
this.router.navigateByUrl("app/problem").then();
}
})
}
}

View File

@ -0,0 +1,28 @@
<div style="text-align: right; margin-bottom :10px">
<button (click)="edit()" pButton type="button" label="Ajouter un problème"></button>
</div>
<p-table [value]="problems" [tableStyle]="{'min-width': '50rem'}">
<ng-template pTemplate="header">
<tr>
<th>Description</th>
<th>Date</th>
<th>Statut</th>
<th>Actions</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-problems>
<tr>
<td>{{problems.description}}</td>
<td>{{problems.date}}</td>
<td>{{problems.status}}</td>
<td>
<i class="pi pi-pencil" style="margin-right: 10px"></i>
<i class="pi pi-trash" style="margin-right: 10px"></i>
<i class="pi pi-eye" style="margin-right: 10px"></i>
</td>
</tr>
</ng-template>
</p-table>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ProblemListComponent } from './problem-list.component';
describe('ProblemListComponent', () => {
let component: ProblemListComponent;
let fixture: ComponentFixture<ProblemListComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ProblemListComponent]
})
.compileComponents();
fixture = TestBed.createComponent(ProblemListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,39 @@
import {Component, OnInit} from '@angular/core';
import {ButtonDirective} from "primeng/button";
import {PrimeTemplate} from "primeng/api";
import {TableModule} from "primeng/table";
import {ProblemServiceService} from "../../service/problem.service.service";
import {Router} from "@angular/router";
@Component({
selector: 'app-problem-list',
standalone: true,
imports: [
ButtonDirective,
PrimeTemplate,
TableModule
],
templateUrl: './problem-list.component.html',
styleUrl: './problem-list.component.scss'
})
export class ProblemListComponent implements OnInit{
problems:any[]=[]
constructor(private problemService: ProblemServiceService,private router: Router) {
}
ngOnInit() {
this.getProblems()
}
getProblems():void{
this.problemService.getAll().subscribe({
next: (res)=>{
if(res.success){
this.problems=res.data
}
}
})
}
edit():void{
this.router.navigateByUrl("app/problem/edit").then()
}
}

View File

@ -0,0 +1 @@
<p>problem-view works!</p>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ProblemViewComponent } from './problem-view.component';
describe('ProblemViewComponent', () => {
let component: ProblemViewComponent;
let fixture: ComponentFixture<ProblemViewComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ProblemViewComponent]
})
.compileComponents();
fixture = TestBed.createComponent(ProblemViewComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,12 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-problem-view',
standalone: true,
imports: [],
templateUrl: './problem-view.component.html',
styleUrl: './problem-view.component.scss'
})
export class ProblemViewComponent {
}

View File

@ -0,0 +1,31 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import {ProblemListComponent} from "./page/problem-list/problem-list.component";
import {ProblemEditComponent} from "./page/problem-edit/problem-edit.component";
import {ProblemViewComponent} from "./page/problem-view/problem-view.component";
import {RouterModule, Routes} from "@angular/router";
const routes : Routes=[
{
path: '',
component: ProblemListComponent
},
{
path: 'edit',
component: ProblemEditComponent
},
{
path: 'view',
component: ProblemViewComponent
}
]
@NgModule({
declarations: [],
imports: [
CommonModule,
RouterModule.forChild(routes)
]
})
export class ProblemModule { }

View File

@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { ProblemServiceService } from './problem.service.service';
describe('ProblemServiceService', () => {
let service: ProblemServiceService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ProblemServiceService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,49 @@
import { Injectable } from '@angular/core';
import {Observable} from "rxjs";
import {apiRoute} from "../../../core/routes/api.route";
import {HttpClient} from "@angular/common/http";
@Injectable({
providedIn: 'root'
})
export class ProblemServiceService {
url="problem"
constructor(private http: HttpClient) { }
//getAll :
getAll(): Observable<any>{
return this.http.get<any>(apiRoute+this.url);
}
//getById :
getById(id: string): Observable<any>{
return this.http.get<any>(apiRoute+this.url+"/"+id);
}
//create :
create(problem: any): Observable<any>{
return this.http.post<any>(apiRoute+this.url,problem);
}
//update :
update(problem: any): Observable<any>{
return this.http.put<any>(apiRoute+this.url+"/"+problem.id,problem);
}
//delete :
delete(id: string): Observable<any>{
return this.http.delete<any>(apiRoute+this.url+"/"+id);
}
}

View File

@ -9,14 +9,14 @@
<th>Marque</th> <th>Marque</th>
<th>Modèle</th> <th>Modèle</th>
<th>Matricule</th> <th>Matricule</th>
<th></th> <th>Actions</th>
</tr> </tr>
</ng-template> </ng-template>
<ng-template pTemplate="body" let-product> <ng-template pTemplate="body" let-vehicle>
<tr> <tr>
<td>{{product.mark}}</td> <td>{{vehicle.mark}}</td>
<td>{{product.model}}</td> <td>{{vehicle.model}}</td>
<td>{{product.matricule}}</td> <td>{{vehicle.matricule}}</td>
<td> <td>
<i class="pi pi-pencil" style="margin-right: 10px"></i> <i class="pi pi-pencil" style="margin-right: 10px"></i>
<i class="pi pi-trash" style="margin-right: 10px"></i> <i class="pi pi-trash" style="margin-right: 10px"></i>

View File

@ -15,7 +15,7 @@
<span>Carburant</span> <span>Carburant</span>
<div class="spacer"></div> <div class="spacer"></div>
<span>Problème</span> <span><a routerLink="/app/problem">Problème</a></span>
<div class="spacer"></div> <div class="spacer"></div>
<span>Bon de travaux</span> <span>Bon de travaux</span>
<div class="spacer"></div> <div class="spacer"></div>
@ -23,7 +23,7 @@
<div class="spacer"></div> <div class="spacer"></div>
<span>Calendrier</span> <span>Calendrier</span>
<div class="spacer"></div> <div class="spacer"></div>
<span>Contact</span> <span><a routerLink="/app/contact">Contact</a></span>
<div class="spacer"></div> <div class="spacer"></div>
<span>Utilisateur</span> <span>Utilisateur</span>
<div class="spacer"></div> <div class="spacer"></div>