Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added new filter input in reservation list #103

Merged
merged 2 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/app/auth/services/reservation.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ export class ReservationService {
}
getReservationData(searchData: any, pagenumber: number): Observable<any> {
let searchUrl = `${this.url}buyer-reservation/my?pagenumber=` + pagenumber;

if (
!(
typeof searchData.name === 'undefined' ||
searchData.name === '' ||
searchData.name === null
)
) {
searchUrl += `&name=${searchData.name}`;
}
if (
!(
typeof searchData.countryCode === 'undefined' ||
Expand Down Expand Up @@ -126,6 +134,15 @@ export class ReservationService {
) {
searchUrl += `&organizationId=${searchData.organizationId}`;
}
if (
!(
typeof searchData.name === 'undefined' ||
searchData.name === '' ||
searchData.name === null
)
) {
searchUrl += `&name=${searchData.name}`;
}
if (
!(
typeof searchData.countryCode === 'undefined' ||
Expand Down
9 changes: 9 additions & 0 deletions src/app/view/myreservation/myreservation.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ <h2 class="pb-0 mb-0 fw-bold text-capitalize ps-2">My Reservation List
<mat-error *ngIf="showorgerror" style="margin-top: -15px;"> Invalid Organization
Selected </mat-error>
</div>
<div class="col-md-3">
<input type="hidden" formControlName='countryCode' #input>
<mat-form-field appearance="outline">
<mat-label class="text-capitalize">Reservation Name </mat-label>

<input type="text" aria-label="text" matInput formControlName="name" (ngModelChange)="checkFormValidity()">
</mat-form-field>

</div>
<div class="col-md-3">
<input type="hidden" formControlName='countryCode' #input>
<mat-form-field appearance="outline">
Expand Down
5 changes: 5 additions & 0 deletions src/app/view/myreservation/myreservation.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export class MyreservationComponent implements OnInit {

ngOnInit() {
this.FilterForm = this.formBuilder.group({
name: [],
countryCode: [],
countryname: [],
fuelCode: [],
Expand Down Expand Up @@ -245,6 +246,10 @@ export class MyreservationComponent implements OnInit {
)
.subscribe((formValues) => {
if (isUserInteraction) {
const reservationname = formValues.countryname;
if (reservationname === undefined || reservationname === '') {
this.FilterForm.controls['name'].setValue(null);
}
const countryValue = formValues.countryname;
if (countryValue === undefined || countryValue === '') {
this.FilterForm.controls['countryname'].setValue(null);
Expand Down
Loading