Skip to content

Commit

Permalink
Application changes
Browse files Browse the repository at this point in the history
  • Loading branch information
deep-mm committed Nov 8, 2022
1 parent 157518a commit 2e02a79
Show file tree
Hide file tree
Showing 14 changed files with 279 additions and 114 deletions.
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://127.0.0.1:4200",
"webRoot": "/workspaces/DBMS-Car-Service-Center/service-center-app"
}
]
}
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# AUTOR - Auto Repair and Service Management System

CSC540 Fall 2022 - DBMS [Team 15]
Team:
1. Deep Mehta - dmmehta2,

1. Deep Mehta - dmmehta2
2. Rohan Shiveshwarkar - rsshives
3. Yash Sonar - ysonar
4. Kunal Patil - kpatil5
Expand All @@ -18,3 +18,9 @@ To cofigure this in local, ensure you have JDK 11 installed on your machine. The
Run the spring boot application and you will be able to see all the APIs listed in the form of Swagger UI. This utilizes JDBC to run SQL queries and retrive results. This is connected with NCSU Oracle DB.

These APIs are then consumed by the Angular App which is present in the folder: `service-center-app`, which can be run by ng serve. Update the api url in environment.ts and environment.prod.ts file.

The GitHub Repository is hosted here: https://github.com/deep-mm/DBMS-Car-Service-Center

Application URL: https://yoururl.tech/svc

API URL: https://service-center-api.azurewebsites.net
Binary file added docs/ER_Diagram.pdf
Binary file not shown.
26 changes: 26 additions & 0 deletions docs/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# AUTOR - Auto Repair and Service Management System

CSC540 Fall 2022 - DBMS [Team 15]

1. Deep Mehta - dmmehta2
2. Rohan Shiveshwarkar - rsshives
3. Yash Sonar - ysonar
4. Kunal Patil - kpatil5

This is a Java 11 Spring Boot API and Angular 14 APP Project

To cofigure this in local, ensure you have JDK 11 installed on your machine. Then update the following values in application.properties (src > main > resources) file:

1. spring.datasource.username={NCSU Unity ID}
2. spring.datasource.password={NCSU Oracle DB Password}
3. ssh.password={NCSU Unity ID Password}

Run the spring boot application and you will be able to see all the APIs listed in the form of Swagger UI. This utilizes JDBC to run SQL queries and retrieve results. This is connected with NCSU Oracle DB.

These APIs are then consumed by the Angular App which is present in the folder: `service-center-app`, which can be run by ng serve. Update the api url in environment.ts and environment.prod.ts file.

The GitHub Repository is hosted here: https://github.com/deep-mm/DBMS-Car-Service-Center [*Currently this is private, will be made public past submission deadline.]

Application URL: https://yoururl.tech/svc [*It might take 2 minutes to load up if the application has been idle for a long time. Refresh it after 5 minutes if it still doesn't load.]

API URL: https://service-center-api.azurewebsites.net
166 changes: 87 additions & 79 deletions service-center-app/src/app/add-schedule/add-schedule.component.html
Original file line number Diff line number Diff line change
@@ -1,84 +1,92 @@
<ngx-loading [show]="loading" [config]="{fullScreenBackdrop: true}"></ngx-loading>
<div style="margin: 20px;">
<h2><strong>Create new service schedule</strong></h2>
<h2><strong>Create new service schedule</strong></h2>

<h3><strong>Cart</strong></h3>
<table class="styled-table">
<thead class="thead-light">
<tr class="header" style="background-color: #ffffff;">
<th scope="col">Service ID</th>
<th scope="col">Service Name</th>
<th scope="col">Service Time (hrs)</th>
<th scope="col">Service Price ($)</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let service of cartService" class="table-row-item">
<td>{{service.id}}</td>
<td>{{service.service_NAME}}</td>
<td>{{getServiceTime(service)}}</td>
<td>{{getServicePrice(service)}}</td>
</tr>
<tr>
<td><strong>Total</strong></td>
<td></td>
<td><strong>{{getTotalTime()}}</strong></td>
<td><strong>{{getTotalPrice()}}</strong></td>
</tr>
</tbody>
</table>
<div>
<mat-label>Preferred Date</mat-label><br>
<mat-form-field appearance="outline">
<input matInput #PreferredDate="ngModel" [(ngModel)]="preferredDate" name="PreferredDate" required min="{{date | date:'yyyy-MM-dd'}}"
type="date" [class.is-invalid]="PreferredDate.invalid && (PreferredDate.touched || PreferredDate.dirty)">
<mat-error *ngIf="PreferredDate.invalid && (PreferredDate.touched || PreferredDate.dirty)">
Enter a valid date
</mat-error>
</mat-form-field>
</div>
<div>
<mat-label>Preferred Start Time</mat-label><br>
<mat-form-field appearance="outline">
<select matNativeControl [(ngModel)]="preferredTime" name="time">
<option value="" selected></option>
<option *ngFor="let t of time" [value]="t">
{{t + ":00"}}
</option>
</select>
</mat-form-field>
</div>
<br>
<button mat-raised-button (click)="checkout()" *ngIf="cartService.length>0">Checkout</button>
<h3><strong>Cart</strong></h3>
<table class="styled-table">
<thead class="thead-light">
<tr class="header" style="background-color: #ffffff;">
<th scope="col">Service ID</th>
<th scope="col">Service Name</th>
<th scope="col">Service Time (hrs)</th>
<th scope="col">Service Price ($)</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let service of cartService" class="table-row-item">
<td>{{service.id}}</td>
<td>{{service.service_NAME}}</td>
<td>{{getServiceTime(service)}}</td>
<td>{{getServicePrice(service)}}</td>
</tr>
<tr>
<td><strong>Total</strong></td>
<td></td>
<td><strong>{{getTotalTime()}}</strong></td>
<td><strong>{{getTotalPrice()}}</strong></td>
</tr>
</tbody>
</table>
<div>
<mat-label>Preferred Date</mat-label><br>
<mat-form-field appearance="fill">
<input matInput [matDatepickerFilter]="myFilter" [matDatepicker]="picker" #PreferredDate="ngModel"
[(ngModel)]="preferredDate" name="PreferredDate" required
[class.is-invalid]="PreferredDate.invalid && (PreferredDate.touched || PreferredDate.dirty)"
(ngModelChange)="CheckDate()">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
<mat-error *ngIf="PreferredDate.invalid && (PreferredDate.touched || PreferredDate.dirty)">
Enter a valid date
</mat-error>
</mat-form-field>

<br><br>
<h3><strong>Repair Services</strong></h3>
<table class="styled-table">
<thead class="thead-light">
<tr class="header" style="background-color: #ffffff;">
<th scope="col">Service ID</th>
<th scope="col">Service Name</th>
<th scope="col">Service Time (hrs)</th>
<th scope="col">Service Price ($)</th>
<th scope="col">Add to cart</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let service of onlyRepairServices" class="table-row-item">
<td>{{service.id}}</td>
<td>{{service.service_NAME}}</td>
<td>{{getServiceTime(service)}}</td>
<td>{{getServicePrice(service)}}</td>
<td>
<button mat-raised-button (click)="addToCart(service)" *ngIf="!isServiceInCart(service)" [disabled]="getServiceTime(service) > remainingTime">Add to cart</button>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<mat-label>Preferred Start Time</mat-label><br>
<mat-form-field appearance="outline">
<select matNativeControl [(ngModel)]="preferredTime" name="time">
<option value="" selected></option>
<option *ngFor="let t of time" [value]="t">
{{t + ":00"}}
</option>
</select>
</mat-form-field>
</div>
<br>
<button mat-raised-button (click)="checkout()" *ngIf="cartService.length>0">Checkout</button>

<div style="margin-bottom: 50px;">
<h3><strong>Maintenance Service</strong></h3>
<h4>Your next scheduled maintenance is: <strong>Schedule {{this.nextScheduledService}}</strong> <button mat-raised-button (click)="addMaintenanceServicesToCart()" *ngIf="!maintenanceServiceAdded" style="margin-left: 10px;">Add to cart</button></h4>
</div>
<br><br>
</div>
<br><br>
<h3><strong>Repair Services</strong></h3>
<table class="styled-table">
<thead class="thead-light">
<tr class="header" style="background-color: #ffffff;">
<th scope="col">Service ID</th>
<th scope="col">Service Name</th>
<th scope="col">Service Time (hrs)</th>
<th scope="col">Service Price ($)</th>
<th scope="col">Add to cart</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let service of onlyRepairServices" class="table-row-item">
<td>{{service.id}}</td>
<td>{{service.service_NAME}}</td>
<td>{{getServiceTime(service)}}</td>
<td>{{getServicePrice(service)}}</td>
<td>
<button mat-raised-button (click)="addToCart(service)" *ngIf="!isServiceInCart(service)"
[disabled]="getServiceTime(service) > remainingTime">Add to cart</button>
</td>
</tr>
</tbody>
</table>

<div style="margin-bottom: 50px;">
<h3><strong>Maintenance Service</strong></h3>
<h4>Your next scheduled maintenance is: <strong>Schedule {{this.nextScheduledService}}</strong> <button
mat-raised-button (click)="addMaintenanceServicesToCart()" *ngIf="!maintenanceServiceAdded"
style="margin-left: 10px;">Add to cart</button></h4>
</div>
<br><br>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export class AddScheduleComponent implements OnInit {
checkout() {
this.loading = true;
let datePipe = new DatePipe('en-US');
let dateString = datePipe.transform(this.preferredDate, 'dd-MMM-yyyy')!.toString();
let dateString = datePipe.transform(this.preferredDate, 'yyyy-MM-dd')!.toString();
let currentStartTime = this.preferredTime;
this._apiService.getAvailableMechanic(this.customer.service_CENTER_ID, dateString).subscribe(
(res: any) => {
Expand All @@ -208,6 +208,9 @@ export class AddScheduleComponent implements OnInit {
this.cartService.forEach(element => {
let start_TIME = currentStartTime > 12 ? currentStartTime - 12 : currentStartTime;
let end_TIME = +currentStartTime + this.getServiceTime(element);
if (currentStartTime <= 12 && end_TIME >= 1) {
end_TIME = end_TIME + 1;
}
end_TIME = end_TIME > 12 ? end_TIME - 12 : end_TIME;
currentStartTime = end_TIME;
let serviceEvent = new ServiceEvent({
Expand Down Expand Up @@ -248,8 +251,35 @@ export class AddScheduleComponent implements OnInit {
},
(err: any) => {
this.loading = false;
this._snackBar.open('No mechanic available. Please select a different date', 'Close', {
duration: 2000,
});
console.log(err);
}
)
}

myFilter = (d: Date | null): boolean => {
const day = (d || new Date()).getDay();
// Prevent Sunday from being selected.
return day !== 0;
};

CheckDate() {
let day = this.preferredDate.getFullYear();
if (this.preferredDate.getDay() == 0){
this.preferredDate.setDate(this.preferredDate.getDate() + 1);
this._snackBar.open('Service center is closed on Sunday.', 'Close', {
duration: 2000,
});
}

if (this.preferredDate.getDay() == 6){
this.remainingTime = 4;
this.time = this.time.slice(0, this.remainingTime + 1);
this._snackBar.open('Service center works from 8am - 1pm on Saturday.', 'Close', {
duration: 2000,
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ <h2>{{update?'Update':'New'}} Service Center</h2>
<mat-label>Email</mat-label><br>
<mat-form-field appearance="outline">
<input matInput #Email="ngModel" [(ngModel)]="employee.email" name="Email" required type="email"
maxlength="250" [class.is-invalid]="Email.invalid && (Email.touched || Email.dirty)">
maxlength="250" [class.is-invalid]="Email.invalid && (Email.touched || Email.dirty)" email>
<mat-error *ngIf="Email.invalid && (Email.touched || Email.dirty)">
Enter a valid Email
</mat-error>
Expand All @@ -127,7 +127,7 @@ <h2>{{update?'Update':'New'}} Service Center</h2>
<mat-label>Phone</mat-label><br>
<mat-form-field appearance="outline">
<input matInput #Phone="ngModel" [(ngModel)]="employee.phone" name="Phone" required type="text"
maxlength="250" [class.is-invalid]="Phone.invalid && (Phone.touched || Phone.dirty)">
maxlength="10" minlength="10" [class.is-invalid]="Phone.invalid && (Phone.touched || Phone.dirty)">
<mat-error *ngIf="Phone.invalid && (Phone.touched || Phone.dirty)">
Enter a valid Phone
</mat-error>
Expand All @@ -138,7 +138,7 @@ <h2>{{update?'Update':'New'}} Service Center</h2>
<mat-label>Username</mat-label><br>
<mat-form-field appearance="outline">
<input matInput #Username="ngModel" [(ngModel)]="employee.username" name="Username" required type="text"
maxlength="250" [class.is-invalid]="Username.invalid && (Username.touched || Username.dirty)">
maxlength="50" [class.is-invalid]="Username.invalid && (Username.touched || Username.dirty)">
<mat-error *ngIf="Username.invalid && (Username.touched || Username.dirty)">
Enter a valid Username
</mat-error>
Expand All @@ -149,7 +149,7 @@ <h2>{{update?'Update':'New'}} Service Center</h2>
<mat-label>Password</mat-label><br>
<mat-form-field appearance="outline">
<input matInput #Password="ngModel" [(ngModel)]="employee.password" name="Password" required type="text"
maxlength="250" [class.is-invalid]="Password.invalid && (Password.touched || Password.dirty)">
maxlength="50" [class.is-invalid]="Password.invalid && (Password.touched || Password.dirty)">
<mat-error *ngIf="Password.invalid && (Password.touched || Password.dirty)">
Enter a valid Password
</mat-error>
Expand All @@ -159,7 +159,7 @@ <h2>{{update?'Update':'New'}} Service Center</h2>
<div style="margin-top: 10px;">
<mat-label>Salary</mat-label><br>
<mat-form-field appearance="outline">
<input matInput #Compensation="ngModel" [(ngModel)]="compensation" name="Compensation" required type="number"
<input matInput #Compensation="ngModel" [(ngModel)]="compensation" name="Compensation" required type="number" [min]="serviceCenter.min_WAGE"
[class.is-invalid]="Compensation.invalid && (Compensation.touched || Compensation.dirty)">
<mat-error *ngIf="Compensation.invalid && (Compensation.touched || Compensation.dirty)">
Enter a valid salary amount
Expand Down
4 changes: 4 additions & 0 deletions service-center-app/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

<h1 style="margin: 20px;">AUTOR 🚘 - Auto Repair and Service Management System</h1>

<div style="margin: 20px;">
<a href="/login">[Log out 🚪🚶]</a>
</div>

<div class="flex-fill bg-wild-sand">
<router-outlet></router-outlet>
</div>
Expand Down
6 changes: 5 additions & 1 deletion service-center-app/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import { AddLeaveComponent } from './add-leave/add-leave.component';
import { AddSwapComponent } from './add-swap/add-swap.component';
import { AddServiceComponent } from './add-service/add-service.component';
import { AddScheduleComponent } from './add-schedule/add-schedule.component';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatNativeDateModule } from '@angular/material/core';

@NgModule({
declarations: [
Expand Down Expand Up @@ -76,7 +78,9 @@ import { AddScheduleComponent } from './add-schedule/add-schedule.component';
MatSnackBarModule,
MatCheckboxModule,
MatSelectModule,
MatSlideToggleModule
MatSlideToggleModule,
MatDatepickerModule,
MatNativeDateModule
],
providers: [HttpClient],
bootstrap: [AppComponent]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ export class CustomerHomeComponent implements OnInit {
this.customerCarService.deleteCustomerCar(customerCar.vin).subscribe((res: any) => {
this.loading = false;
this.customerCars = this.customerCars.filter((car: CustomerCar) => car.vin !== customerCar.vin);
if (this.customerCars.length === 0) {
this.customer.status = 0;
this._apiService.updateCustomer(this.customer).subscribe((res: any) => {
this.customer = res;
}
);
}
this._snackBar.open('Customer car deleted successfully!', 'Close', {
duration: 3000,
});
Expand Down
Loading

0 comments on commit 2e02a79

Please sign in to comment.