-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from teamq-ec/DM2-2758-implementar-boton-de-pa…
…go-con-ventana-emergente Dm2 2758 implementar boton de pago con ventana emergente
- Loading branch information
Showing
17 changed files
with
261 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
export interface ServiceRequest { | ||
user_id: number; | ||
first_name: string; | ||
last_name: string; | ||
email: string; | ||
phone_number: string; | ||
export interface Product { | ||
id: number; | ||
appliance_type: string; | ||
application_date: string; | ||
brand: string; | ||
collection_address: string; | ||
created_at: string; | ||
damaged_appliance_image: string; | ||
preferred_contact_method: string; | ||
problem_details: string; | ||
address: string; | ||
service_type: string; | ||
preferred_contact_method: string; | ||
damaged_appliance_image: string; | ||
state: string; | ||
application_date: string; | ||
updated_at: string; | ||
user: { | ||
id: number; | ||
first_name: string; | ||
last_name: string; | ||
email: string; | ||
phone_number: string; | ||
address: string; | ||
}; | ||
} | ||
|
20 changes: 16 additions & 4 deletions
20
src/app/pages/components/alert-confirmation/alert-confirmation.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
import { Component, EventEmitter, Input, Output } from '@angular/core'; | ||
import { ActivatedRoute, Router } from '@angular/router'; | ||
|
||
@Component({ | ||
selector: 'app-alert-confirmation', | ||
templateUrl: './alert-confirmation.component.html', | ||
styleUrls: ['./alert-confirmation.component.css'], | ||
}) | ||
export class AlertConfirmationComponent { | ||
@Output() alertClosed = new EventEmitter<void>(); | ||
isOpen = true; | ||
private userId?: number; | ||
|
||
closeAlert() { | ||
this.alertClosed.emit(); | ||
constructor( | ||
private activatedRoute: ActivatedRoute, | ||
private router: Router | ||
) { | ||
const userId = this.activatedRoute.snapshot.paramMap.get('userId'); | ||
if (userId) { | ||
this.userId = +userId; | ||
} | ||
} | ||
|
||
closeAlert(): void { | ||
if (this.userId) { | ||
this.router.navigate(['/pages', this.userId, 'product']); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/app/pages/components/modal-product/modal-product-routing.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule, Routes } from '@angular/router'; | ||
|
||
const routes: Routes = []; | ||
|
||
@NgModule({ | ||
imports: [RouterModule.forChild(routes)], | ||
exports: [RouterModule] | ||
}) | ||
export class ModalProductRoutingModule { } |
7 changes: 7 additions & 0 deletions
7
src/app/pages/components/modal-product/modal-product.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.hidden { | ||
display: none; | ||
} | ||
|
||
.block { | ||
display: block; | ||
} |
61 changes: 61 additions & 0 deletions
61
src/app/pages/components/modal-product/modal-product.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<div [ngClass]="{'hidden': !isOpenModal, 'block': isOpenModal}" class="fixed inset-0 z-10 overflow-y-auto"> | ||
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" aria-hidden="true"></div> | ||
|
||
<div class="flex items-center justify-center min-h-full text-center"> | ||
<div class="relative bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all my-8 w-full max-w-lg"> | ||
<div class="bg-white p-6"> | ||
<div class="absolute right-4 top-4 text-gray-400 hover:text-gray-500"> | ||
<button type="button" (click)="closeModal()"> | ||
<span class="sr-only">{{ 'close' | translate }}</span> | ||
<svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true"> | ||
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" /> | ||
</svg> | ||
</button> | ||
</div> | ||
|
||
<div *ngIf="product" class="grid grid-cols-1 gap-4"> | ||
<div class="aspect-w-2 aspect-h-3 bg-gray-100 rounded-lg overflow-hidden"> | ||
<img [src]="product.damaged_appliance_image" [alt]="'damagedApplianceImageAlt' | translate" class="object-cover"> | ||
</div> | ||
<div> | ||
<h2 class="text-2xl font-bold text-gray-900">{{ product.appliance_type }}</h2> | ||
<section aria-labelledby="information-heading" class="mt-2"> | ||
<h3 id="information-heading" class="text-lg font-bold text-gray-900">{{ 'productInformation' | translate }}</h3> | ||
<p class="mt-1 text-gray-700"><strong>{{ 'brand' | translate }}:</strong> {{ product.brand }}</p> | ||
<p class="mt-1 text-gray-700"><strong>{{ 'problemDetails' | translate }}:</strong> {{ product.problem_details }}</p> | ||
<p class="mt-1 text-gray-700"><strong>{{ 'serviceType' | translate }}:</strong> {{ product.service_type }}</p> | ||
<p class="mt-1 text-gray-700"><strong>{{ 'preferredContactMethod' | translate }}:</strong> {{ product.preferred_contact_method }}</p> | ||
<p class="mt-1 text-gray-700"><strong>{{ 'applicationDate' | translate }}:</strong> {{ product.application_date }}</p> | ||
</section> | ||
</div> | ||
</div> | ||
|
||
<section *ngIf="user" aria-labelledby="user-information-heading" class="mt-10"> | ||
<h3 id="user-information-heading" class="text-lg font-bold text-gray-900">{{ 'userInformation' | translate }}</h3> | ||
<div class="grid grid-cols-1 gap-y-4 sm:grid-cols-2 sm:gap-x-4"> | ||
<div> | ||
<label class="block text-sm font-medium text-gray-700">{{ 'name' | translate }}</label> | ||
<p class="mt-1 text-gray-700"><strong>{{ user.first_name }} {{ user.last_name }}</strong></p> | ||
</div> | ||
<div> | ||
<label class="block text-sm font-medium text-gray-700">{{ 'email' | translate }}</label> | ||
<p class="mt-1 text-gray-700"><strong>{{ user.email }}</strong></p> | ||
</div> | ||
<div> | ||
<label class="block text-sm font-medium text-gray-700">{{ 'phone' | translate }}</label> | ||
<p class="mt-1 text-gray-700"><strong>{{ user.phone_number }}</strong></p> | ||
</div> | ||
<div> | ||
<label class="block text-sm font-medium text-gray-700">{{ 'address' | translate }}</label> | ||
<p class="mt-1 text-gray-700"><strong>{{ user.address }}</strong></p> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<button type="button" class="mt-6 w-full bg-indigo-600 text-white rounded-md py-3 font-medium hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2"> | ||
{{ 'PAY_NOW' | translate }} | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
36 changes: 36 additions & 0 deletions
36
src/app/pages/components/modal-product/modal-product.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Component, EventEmitter, OnInit, Output } from '@angular/core'; | ||
import { Product } from 'src/app/models/product'; | ||
import { ProductModalService } from '../../services/product-modal.service'; | ||
import { User } from 'src/app/models/user'; | ||
|
||
@Component({ | ||
selector: 'app-modal-product', | ||
templateUrl: './modal-product.component.html', | ||
styleUrls: ['./modal-product.component.css'] | ||
}) | ||
export class ModalProductComponent implements OnInit { | ||
@Output() alertClosed = new EventEmitter<void>(); | ||
product: Product | null = null; | ||
user: User | null = null; | ||
isOpenModal = false; | ||
|
||
constructor(private productModalService: ProductModalService) {} | ||
|
||
ngOnInit(): void { | ||
this.productModalService.currentProduct.subscribe(product => { | ||
this.product = product; | ||
}); | ||
this.productModalService.currentUser.subscribe(user => { | ||
this.user = user; | ||
if (this.user && this.product) { | ||
this.isOpenModal = true; | ||
} | ||
}); | ||
} | ||
|
||
closeModal(): void { | ||
this.alertClosed.emit(); | ||
this.isOpenModal = false; | ||
this.productModalService.closeModal(); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/app/pages/components/modal-product/modal-product.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
|
||
import { ModalProductRoutingModule } from './modal-product-routing.module'; | ||
import { ModalProductComponent } from './modal-product.component'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
|
||
|
||
@NgModule({ | ||
declarations: [ModalProductComponent], | ||
imports: [ | ||
CommonModule, | ||
ModalProductRoutingModule, | ||
TranslateModule | ||
], | ||
exports: [ModalProductComponent] | ||
}) | ||
export class ModalProductModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { BehaviorSubject } from 'rxjs'; | ||
import { Product } from 'src/app/models/product'; | ||
import { User } from 'src/app/models/user'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class ProductModalService { | ||
private productSubject = new BehaviorSubject<Product | null>(null); | ||
private userSource = new BehaviorSubject<User | null>(null); | ||
|
||
currentProduct = this.productSubject.asObservable(); | ||
currentUser = this.userSource.asObservable(); | ||
|
||
|
||
openModal(product: Product, user: User): void { | ||
this.productSubject.next(product); | ||
this.userSource.next(user); | ||
} | ||
|
||
closeModal(): void { | ||
this.productSubject.next(null); | ||
this.userSource.next(null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.