From fa1148c6e1531b34ba021d7681ea0f02e97a70bd Mon Sep 17 00:00:00 2001
From: Fernanda Andrade <119636766+fe222004@users.noreply.github.com>
Date: Wed, 7 Aug 2024 09:13:54 -0500
Subject: [PATCH 1/3]
DM2-2821-actualizar-diseno-de-formulario-y-carrusel-en-la-pagina-de-inicio
---
src/app/app.module.ts | 5 -
.../alert-confirmation.component.spec.ts | 21 --
.../carrusel/carrusel.component.html | 65 ++--
.../form-product-routing.module.ts | 10 -
.../form-product/form-product.component.css | 83 -----
.../form-product/form-product.component.html | 283 ------------------
.../form-product/form-product.component.ts | 171 -----------
.../form-product/form-product.module.ts | 26 --
.../pages/components/menu/menu.component.html | 29 +-
.../pages/components/menu/menu.component.ts | 1 -
.../mobil-menu/mobil-menu.component.html | 3 -
.../modal-product-routing.module.ts | 10 -
.../modal-product/modal-product.component.css | 7 -
.../modal-product.component.html | 77 -----
.../modal-product/modal-product.component.ts | 39 ---
.../modal-product/modal-product.module.ts | 18 --
src/app/pages/dashboard/dashboard.module.ts | 2 -
src/app/pages/home/home.component.html | 90 +-----
src/app/pages/home/home.component.ts | 1 -
src/app/pages/home/home.module.ts | 7 +-
src/app/pages/pages-routing.module.ts | 6 -
src/app/pages/pages.module.ts | 11 +-
.../pages/product/product-routing.module.ts | 10 -
src/app/pages/product/product.component.css | 34 ---
src/app/pages/product/product.component.html | 217 --------------
src/app/pages/product/product.component.ts | 203 -------------
src/app/pages/product/product.module.ts | 24 --
.../pages/register/register.component.html | 19 +-
src/app/pages/register/register.component.ts | 7 +-
.../pages/services/product-modal.service.ts | 9 +-
src/app/pages/services/translation.service.ts | 3 +-
31 files changed, 73 insertions(+), 1418 deletions(-)
delete mode 100644 src/app/pages/components/alert-confirmation/alert-confirmation.component.spec.ts
delete mode 100644 src/app/pages/components/form-product/form-product-routing.module.ts
delete mode 100644 src/app/pages/components/form-product/form-product.component.css
delete mode 100644 src/app/pages/components/form-product/form-product.component.html
delete mode 100644 src/app/pages/components/form-product/form-product.component.ts
delete mode 100644 src/app/pages/components/form-product/form-product.module.ts
delete mode 100644 src/app/pages/components/modal-product/modal-product-routing.module.ts
delete mode 100644 src/app/pages/components/modal-product/modal-product.component.css
delete mode 100644 src/app/pages/components/modal-product/modal-product.component.html
delete mode 100644 src/app/pages/components/modal-product/modal-product.component.ts
delete mode 100644 src/app/pages/components/modal-product/modal-product.module.ts
delete mode 100644 src/app/pages/product/product-routing.module.ts
delete mode 100644 src/app/pages/product/product.component.css
delete mode 100644 src/app/pages/product/product.component.html
delete mode 100644 src/app/pages/product/product.component.ts
delete mode 100644 src/app/pages/product/product.module.ts
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 4b99dc2..2255f8c 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -15,10 +15,6 @@ import { FooterModule } from './pages/components/footer/footer.module';
import { HomeModule } from './pages/home/home.module';
import { DashboardModule } from './pages/dashboard/dashboard.module';
-import { ApplianceRegistrationModule } from './pages/appliance-registration/appliance-registration.module';
-import { AlertConfirmationModule } from './pages/components/alert-confirmation/alert-confirmation.module';
-import { ProductModule } from './pages/product/product.module';
-import { ModalProductModule } from './pages/components/modal-product/modal-product.module';
import { PaymentModule } from './pages/payment/payment.module';
export function HttpLoaderFactory(http: HttpClient) {
@@ -33,7 +29,6 @@ export function HttpLoaderFactory(http: HttpClient) {
AppRoutingModule,
HomeModule,
DashboardModule,
- ProductModule,
PaymentModule,
ReactiveFormsModule,
HttpClientModule,
diff --git a/src/app/pages/components/alert-confirmation/alert-confirmation.component.spec.ts b/src/app/pages/components/alert-confirmation/alert-confirmation.component.spec.ts
deleted file mode 100644
index e6bd387..0000000
--- a/src/app/pages/components/alert-confirmation/alert-confirmation.component.spec.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { AlertConfirmationComponent } from './alert-confirmation.component';
-
-describe('AlertConfirmationComponent', () => {
- let component: AlertConfirmationComponent;
- let fixture: ComponentFixture;
-
- beforeEach(() => {
- TestBed.configureTestingModule({
- declarations: [AlertConfirmationComponent]
- });
- fixture = TestBed.createComponent(AlertConfirmationComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-});
diff --git a/src/app/pages/components/carrusel/carrusel.component.html b/src/app/pages/components/carrusel/carrusel.component.html
index cc1cdf2..0da3ea2 100644
--- a/src/app/pages/components/carrusel/carrusel.component.html
+++ b/src/app/pages/components/carrusel/carrusel.component.html
@@ -1,42 +1,27 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ 'home.title' | translate }}
-
-
- {{ 'home.description' | translate }}
-
-
-
+
+
+
+
+
+
+
+
+
+
+ {{ 'home.title' | translate }}
+
+
+ {{ 'home.description' | translate }}
+
+
+
diff --git a/src/app/pages/components/form-product/form-product-routing.module.ts b/src/app/pages/components/form-product/form-product-routing.module.ts
deleted file mode 100644
index fb009f9..0000000
--- a/src/app/pages/components/form-product/form-product-routing.module.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { NgModule } from '@angular/core';
-import { RouterModule, Routes } from '@angular/router';
-
-const routes: Routes = [];
-
-@NgModule({
- imports: [RouterModule.forChild(routes)],
- exports: [RouterModule]
-})
-export class FormProductRoutingModule { }
diff --git a/src/app/pages/components/form-product/form-product.component.css b/src/app/pages/components/form-product/form-product.component.css
deleted file mode 100644
index f20dd06..0000000
--- a/src/app/pages/components/form-product/form-product.component.css
+++ /dev/null
@@ -1,83 +0,0 @@
-.image-upload {
- display: flex;
- flex-direction: column;
- align-items: center;
- margin-top: 20px;
-}
-
-.upload-area {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
-}
-
-.image-upload-label {
- cursor: pointer;
- border: 2px dashed #cccccc;
- border-radius: 8px;
- padding: 20px;
- text-align: center;
- transition: border-color 0.3s;
-}
-
-.image-upload-label:hover {
- border-color: #888888;
-}
-
-.image-upload-placeholder {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
-}
-
-.upload-icon {
- width: 40px;
- height: 40px;
- color: #888888;
-}
-
-.upload-text {
- margin-top: 10px;
- color: #666666;
-}
-
-input[type="file"] {
- display: none;
-}
-
-.image-preview {
- position: relative;
- margin-top: 20px;
- display: flex;
- justify-content: center;
- align-items: center;
-}
-
-.image-preview img {
- max-width: 100%;
- max-height: 300px;
- border-radius: 8px;
-}
-
-.remove-image {
- position: absolute;
- top: 5px;
- right: 5px;
- background: rgba(0, 0, 0, 0.5);
- color: #ffffff;
- border: none;
- border-radius: 50%;
- width: 24px;
- height: 24px;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 16px;
- cursor: pointer;
-}
-
-.remove-image:hover {
- background: rgba(0, 0, 0, 0.7);
-}
diff --git a/src/app/pages/components/form-product/form-product.component.html b/src/app/pages/components/form-product/form-product.component.html
deleted file mode 100644
index 645d639..0000000
--- a/src/app/pages/components/form-product/form-product.component.html
+++ /dev/null
@@ -1,283 +0,0 @@
-
-
-
-
- {{ 'formProduct.CONTACT_US_TITLE' | translate }}
-
-
- {{ 'formProduct.CONTACT_US_DESCRIPTION' | translate }}
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/app/pages/components/form-product/form-product.component.ts b/src/app/pages/components/form-product/form-product.component.ts
deleted file mode 100644
index 173f589..0000000
--- a/src/app/pages/components/form-product/form-product.component.ts
+++ /dev/null
@@ -1,171 +0,0 @@
-import { Component, inject } from '@angular/core';
-import { FormBuilder, FormGroup, Validators } from '@angular/forms';
-import { DataTransferServiceService } from '../../services/data-transfer-service.service';
-import { Router } from '@angular/router';
-import { PROVINCES_ECUADOR } from 'src/app/constants/constants';
-import { ProductConstants } from 'src/app/constants/product.constants';
-import { ValidationConstants } from 'src/app/constants/validation.constants';
-import { AuthService } from 'src/app/components/service/auth.service';
-
-@Component({
- selector: 'app-form-product',
- templateUrl: './form-product.component.html',
- styleUrls: ['./form-product.component.css'],
-})
-export class FormProductComponent {
- private readonly formBuilder: FormBuilder = inject(FormBuilder);
- private readonly router: Router = inject(Router);
- private readonly dataTransferService: DataTransferServiceService = inject(
- DataTransferServiceService
- );
-
- urls = ProductConstants;
- public form: FormGroup;
- public imageSrc: string | ArrayBuffer | null = null;
- public files: File[] = [];
- public showAlert: boolean = false;
- public showAlertForm: boolean = false;
- isLoggedIn: boolean = false;
-
- provinces = PROVINCES_ECUADOR;
-
- constructor(private authService: AuthService) {
- this.form = this.buildForm();
- this.isLoggedIn = this.authService.isLoggedIn();
- this.form.patchValue(JSON.parse(localStorage.getItem('user') || '{}'));
- }
-
- private buildForm(): FormGroup {
- return this.formBuilder.group({
- first_name: ['', [Validators.required]],
- last_name: ['', [Validators.required]],
- email: ['', [Validators.required]],
- appliance_type: ['', [Validators.required]],
- brand: [
- '',
- [
- Validators.required,
- Validators.minLength(ValidationConstants.BRAND_MIN_LENGTH),
- Validators.maxLength(ValidationConstants.BRAND_MAX_LENGTH),
- ],
- ],
- problem_details: [
- '',
- [
- Validators.required,
- Validators.minLength(ValidationConstants.BRAND_MIN_LENGTH),
- ],
- ],
- address: [
- '',
- [
- Validators.required,
- Validators.minLength(ValidationConstants.BRAND_MIN_LENGTH),
- Validators.maxLength(ValidationConstants.ADDRESSS_MAX_LENGTH),
- ],
- ],
- preferred_contact_method: ['', [Validators.required]],
- phone_number: [],
- damaged_appliance_image: [null, Validators.required],
- state: [
- '',
- [
- Validators.required,
- Validators.minLength(ValidationConstants.BRAND_MIN_LENGTH),
- Validators.maxLength(ValidationConstants.ADDRESSS_MAX_LENGTH),
- ],
- ],
- });
- }
-
- isFieldInvalid(field: string): boolean {
- const control = this.form.get(field) ?? {
- invalid: false,
- dirty: false,
- touched: false,
- };
- return control.invalid && (control.dirty || control.touched);
- }
-
- public onSubmit(): void {
- if (this.form.invalid) {
- this.showAlertForm = true;
- Object.keys(this.form.controls).forEach((key) => {
- this.form.get(key)?.markAsTouched();
- });
- return;
- }
-
- const file = this.files[0];
- const formValueWithFile = {
- ...this.form.value,
- damaged_appliance_image: file ? file.name : null,
- };
-
- this.dataTransferService.setData(formValueWithFile);
- this.showAlert = true;
- }
-
- public onFileChange(event: any): void {
- const file = event.target.files[0];
- if (file) {
- this.files = [file];
- const reader = new FileReader();
- reader.onload = () => {
- this.imageSrc = reader.result as string;
- };
- reader.readAsDataURL(file);
- this.form.patchValue({ damaged_appliance_image: file });
- this.form.get('damaged_appliance_image')?.updateValueAndValidity();
- }
- }
-
- public getFile(event: Event): void {
- const input = event.target as HTMLInputElement;
- if (input.files && input.files.length > 0) {
- const file = input.files[0];
- this.handleFile(file);
- }
- }
-
- onAlertClosed() {
- this.showAlertForm = false;
- }
-
- public chooseFile(): void {
- const inputElement = document.getElementById(
- 'damaged-appliance-image'
- ) as HTMLInputElement;
- inputElement?.click();
- }
-
- public onDrop(event: DragEvent): void {
- event.preventDefault();
- event.stopPropagation();
- if (event.dataTransfer?.files && event.dataTransfer.files.length > 0) {
- const file = event.dataTransfer.files[0];
- this.handleFile(file);
- }
- }
-
- public onDragOver(event: DragEvent): void {
- event.preventDefault();
- }
-
- private handleFile(file: File): void {
- const reader = new FileReader();
- reader.onload = () => {
- this.imageSrc = reader.result || null;
- };
- reader.readAsDataURL(file);
- this.files = [file];
- this.form.patchValue({ damaged_appliance_image: file.name });
- this.form.get('damaged_appliance_image')?.updateValueAndValidity();
- }
-
- public removeImage(): void {
- this.imageSrc = null;
- this.files = [];
- this.form.get('damaged_appliance_image')?.reset();
- }
-}
diff --git a/src/app/pages/components/form-product/form-product.module.ts b/src/app/pages/components/form-product/form-product.module.ts
deleted file mode 100644
index 63de438..0000000
--- a/src/app/pages/components/form-product/form-product.module.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { NgModule } from '@angular/core';
-import { CommonModule } from '@angular/common';
-
-import { FormProductRoutingModule } from './form-product-routing.module';
-import { FormProductComponent } from './form-product.component';
-import { ReactiveFormsModule } from '@angular/forms';
-import { AlertLoginRegisterModule } from 'src/app/components/auth/components/alert-login-register/alert-login-register.module';
-import { AlertFormModule } from '../alert-form/alert-form.module';
-import { TranslateModule } from '@ngx-translate/core';
-import { AlertConfirmationModule } from '../alert-confirmation/alert-confirmation.module';
-
-
-@NgModule({
- declarations: [FormProductComponent],
- imports: [
- CommonModule,
- FormProductRoutingModule,
- ReactiveFormsModule,
- AlertLoginRegisterModule,
- AlertFormModule,
- TranslateModule,
- AlertConfirmationModule,
- ],
- exports: [FormProductComponent]
-})
-export class FormProductModule { }
diff --git a/src/app/pages/components/menu/menu.component.html b/src/app/pages/components/menu/menu.component.html
index f52ffb4..4f895c0 100644
--- a/src/app/pages/components/menu/menu.component.html
+++ b/src/app/pages/components/menu/menu.component.html
@@ -27,12 +27,13 @@
-
+ class="flex items-center text-gray-700 hover:text-gray-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-800">
+
+
{{ currentLanguage.toUpperCase() }}
+
+
-
\ No newline at end of file
+
diff --git a/src/app/pages/components/menu/menu.component.ts b/src/app/pages/components/menu/menu.component.ts
index 403f15a..1cb5e32 100644
--- a/src/app/pages/components/menu/menu.component.ts
+++ b/src/app/pages/components/menu/menu.component.ts
@@ -90,7 +90,6 @@ export class MenuComponent {
}
}
-
goToPerfil(): string[] {
if (this.userId) {
return [RoutesConstants.dashboard.replace(':userId', this.userId)];
diff --git a/src/app/pages/components/mobil-menu/mobil-menu.component.html b/src/app/pages/components/mobil-menu/mobil-menu.component.html
index 9c8d48f..9d11c7c 100644
--- a/src/app/pages/components/mobil-menu/mobil-menu.component.html
+++ b/src/app/pages/components/mobil-menu/mobil-menu.component.html
@@ -1,6 +1,4 @@
diff --git a/src/app/pages/components/modal-product/modal-product-routing.module.ts b/src/app/pages/components/modal-product/modal-product-routing.module.ts
deleted file mode 100644
index 9cc2a6d..0000000
--- a/src/app/pages/components/modal-product/modal-product-routing.module.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { NgModule } from '@angular/core';
-import { RouterModule, Routes } from '@angular/router';
-
-const routes: Routes = [];
-
-@NgModule({
- imports: [RouterModule.forChild(routes)],
- exports: [RouterModule]
-})
-export class ModalProductRoutingModule { }
diff --git a/src/app/pages/components/modal-product/modal-product.component.css b/src/app/pages/components/modal-product/modal-product.component.css
deleted file mode 100644
index c0c271a..0000000
--- a/src/app/pages/components/modal-product/modal-product.component.css
+++ /dev/null
@@ -1,7 +0,0 @@
-.hidden {
- display: none;
-}
-
-.block {
- display: block;
-}
diff --git a/src/app/pages/components/modal-product/modal-product.component.html b/src/app/pages/components/modal-product/modal-product.component.html
deleted file mode 100644
index ae524d3..0000000
--- a/src/app/pages/components/modal-product/modal-product.component.html
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ product.appliance_type }}
-
- {{ 'productInformation' | translate
- }}
- {{ 'brand' | translate }}: {{ product.brand }}
- {{ 'problemDetails' | translate }}: {{
- product.problem_details }}
- {{ 'serviceType' | translate }}: {{ product.service_type
- }}
- {{ 'preferredContactMethod' | translate }}: {{
- product.preferred_contact_method }}
- {{ 'applicationDate' | translate }}: {{
- product.application_date }}
-
-
-
- {{ 'userInformation' |
- translate }}
-
-
-
-
{{ product.user.first_name }} {{ product.user.last_name
- }}
-
-
-
-
{{ product.user.email }}
-
-
-
-
{{ product.user.phone_number }}
-
-
-
-
{{ product.user.address }}
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/app/pages/components/modal-product/modal-product.component.ts b/src/app/pages/components/modal-product/modal-product.component.ts
deleted file mode 100644
index 63576f8..0000000
--- a/src/app/pages/components/modal-product/modal-product.component.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import { Component, EventEmitter, inject, 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';
-import { Router } from '@angular/router';
-
-@Component({
- selector: 'app-modal-product',
- templateUrl: './modal-product.component.html',
- styleUrls: ['./modal-product.component.css'],
-})
-export class ModalProductComponent implements OnInit {
- private readonly router: Router = inject(Router);
- @Output() alertClosed = new EventEmitter
();
- product: Product | null = null;
- user: User | null = null;
- isOpenModal = false;
-
- constructor(private productModalService: ProductModalService) {}
-
- ngOnInit(): void {
- this.productModalService.currentProduct.subscribe((product) => {
- this.product = product;
- if (this.product) {
- localStorage.setItem('currentProduct', JSON.stringify(this.product));
- }
- });
- }
-
- closeModal(): void {
- this.alertClosed.emit();
- this.isOpenModal = false;
- this.productModalService.closeModal();
- }
-
- navigateToPayment(userId: number, productId: number): void {
- this.router.navigate([`/pages/${userId}/payment/${productId}`]);
- }
-}
diff --git a/src/app/pages/components/modal-product/modal-product.module.ts b/src/app/pages/components/modal-product/modal-product.module.ts
deleted file mode 100644
index 1616564..0000000
--- a/src/app/pages/components/modal-product/modal-product.module.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-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 { }
diff --git a/src/app/pages/dashboard/dashboard.module.ts b/src/app/pages/dashboard/dashboard.module.ts
index c8cec3c..9294bbc 100644
--- a/src/app/pages/dashboard/dashboard.module.ts
+++ b/src/app/pages/dashboard/dashboard.module.ts
@@ -4,7 +4,6 @@ import { CommonModule } from '@angular/common';
import { DashboardRoutingModule } from './dashboard-routing.module';
import { DashboardComponent } from './dashboard.component';
import { FooterModule } from '../components/footer/footer.module';
-import { FormProductModule } from '../components/form-product/form-product.module';
import { HeaderModule } from '../components/header/header.module';
import { TranslateModule } from '@ngx-translate/core';
import { CarruselModule } from "../components/carrusel/carrusel.module";
@@ -17,7 +16,6 @@ import { ApplianceRegistrationModule } from '../appliance-registration/appliance
CommonModule,
DashboardRoutingModule,
FooterModule,
- FormProductModule,
HeaderModule,
TranslateModule,
CarruselModule,
diff --git a/src/app/pages/home/home.component.html b/src/app/pages/home/home.component.html
index 91c03e6..2dcc257 100644
--- a/src/app/pages/home/home.component.html
+++ b/src/app/pages/home/home.component.html
@@ -10,14 +10,15 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
{{ 'WELCOME_TITLE' | translate }}
-
{{ 'WELCOME_DESCRIPTION' | translate }}
-
-
-
-
-
-
-
-
- {{ 'APPLIANCE_MAINTENANCE_REPAIR' | translate }}
-
-
-
- {{ 'TRUSTED_APPLIANCES' | translate }}
-
-
-
-
-
-
-
-
-
-
-
-
- {{ timerMessage }} {{ 'LETFTOVER' | translate }}
-
-
- {{ 'TIMER_MESSAGE' | translate }}
-
-
-
- -
-
-
-
-
-
-
-
{{ appliance.brand }}
-
-
{{ appliance.problem_details }}
-
-
{{ appliance.application_date }}
-
-
-
-
-
-
-
-
-
-
-
{{ 'NO_APPLIANCES_FOUND' | translate }}
-
-
-
-
-
-
-
-
-
-
- {{ 'SHOWING_RESULTS' | translate }}
- {{ (currentPage - 1) * 10 + 1 }}
- {{ 'TO' | translate }}
- {{ currentPage * 10 }}
- {{ 'OF' | translate }}
- {{ totalItems }}
- {{ 'RESULTS' | translate }}
-
-
-
-
-
-
-
-
-
-
-
-
-