Skip to content

Commit d5b1061

Browse files
committed
Updates
1 parent 0788f7f commit d5b1061

File tree

94 files changed

+17456
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+17456
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<!-- ====== Nav Bar ======-->
2+
<div class="full-width NavBar">
3+
<div class="full-width text-semi-bold NavBar-logo">
4+
<a href="/">
5+
<img src="assets/img/LogoAPP.png" alt="Wallypop Corporation"/>
6+
</a>
7+
<!-- Company -->
8+
</div>
9+
<nav class=" full-width NavBar-Nav">
10+
<ul class="list-unstyled full-width">
11+
<li>
12+
<a href="/">
13+
INICIO
14+
</a>
15+
</li>
16+
<li>
17+
<a href="/commercial">
18+
ANUNCIOS
19+
</a>
20+
</li>
21+
<li>
22+
<a href="/sold">
23+
ANUNCIOS VENDIDOS
24+
</a>
25+
</li>
26+
<span *ngIf="loginService.isLogged()">
27+
<li>
28+
<a href="/adcommercial">
29+
PON TU ANUNCIO
30+
</a>
31+
</li>
32+
<li>
33+
<a href="/favorites">
34+
FAVORITOS
35+
</a>
36+
</li>
37+
<li>
38+
<a href="/profile">
39+
{{loginService.currentUser().full_NAME}} <i aria-hidden="true" class="fa fa-user NavBar-Nav-icon"></i>
40+
</a>
41+
</li>
42+
</span>
43+
<span *ngIf="!loginService.isLogged()">
44+
<li>
45+
<a href="/newaccount">
46+
CREAR CUENTA
47+
</a>
48+
</li>
49+
<li>
50+
<a href="/login">
51+
INICIAR SESIÓN
52+
</a>
53+
</li>
54+
<li>
55+
<a href="/login">
56+
<i aria-hidden="true" class="fa fa-user NavBar-Nav-icon"></i>
57+
</a>
58+
</li>
59+
</span>
60+
<span *ngIf="loginService.isLogged()">
61+
<li>
62+
<button (click)="logOut()" class="btn btn-default navbar-btn" type="submit">Log Out</button>
63+
</li>
64+
</span>
65+
</ul>
66+
</nav>
67+
</div>
68+
<section>
69+
<router-outlet></router-outlet>
70+
</section>
71+
<!-- <div *ngIf="loginService.isLogged()" style="text-align: center">
72+
Current user: {{loginService.currentUser().name}}
73+
</div>
74+
<div *ngIf="loginService.isLogged() && loginService.isAdmin()" style="text-align: center">
75+
ROLE: ADMIN
76+
</div>
77+
<div *ngIf="loginService.isLogged() && !loginService.isAdmin()" style="text-align: center">
78+
ROLE: USER
79+
</div>
80+
<div *ngIf="!loginService.isLogged()" style="text-align: center">
81+
Current user: NULL
82+
</div> -->
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {Component, OnInit} from '@angular/core';
2+
import { LoginService } from './services/login.service';
3+
import {User} from './models/user.model';
4+
5+
@Component({
6+
selector: 'app-root',
7+
templateUrl: './app.component.html'
8+
})
9+
export class AppComponent {
10+
constructor(public loginService: LoginService) { }
11+
12+
logOut(): void {
13+
this.loginService.logOut();
14+
}
15+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { BrowserModule } from '@angular/platform-browser';
2+
import { FormsModule } from '@angular/forms';
3+
import { NgModule } from '@angular/core';
4+
import { HttpClientModule } from '@angular/common/http';
5+
6+
import { AppComponent } from './app.component';
7+
import { IndexComponent } from './components/index/index.component';
8+
import { routing } from './app.routing';
9+
import { LoginComponent } from './components/login/login.component';
10+
import {SearchComponent} from './components/search/search.component';
11+
import {NotFoundComponent} from './components/404/NotFound.component';
12+
import {NewaccountComponent} from './components/login/newaccount.component';
13+
import { ProfileComponent } from './components/profile/profile.component';
14+
import { CategoryComponent } from './components/category/category.component';
15+
16+
import { FormReportComponent } from './components/report/formReport.component';
17+
import { ReportsComponent } from './components/report/reports.component';
18+
import { ShowReportComponent } from './components/report/showReport.component';
19+
import { CategoryListComponent } from './components/category/categoryList.component';
20+
import { FavoritesComponent } from './components/favorites/favorites.component';
21+
import {CommercialComponent} from './components/articles/commercial.component';
22+
import {PostComponent} from './components/articles/post.component';
23+
import {YourcommercialComponent} from './components/articles/yourcommercial.component';
24+
import {YourcommercialSoldComponent} from './components/articles/yourcommercialsold.component';
25+
import {SoldComponent} from './components/articles/sold.component';
26+
import {AddcommercialComponent} from './components/articles/addcommercial.component';
27+
import {GraphicComponent} from './components/graphic/graphic.component';
28+
import {HighchartsChartModule} from "highcharts-angular";
29+
30+
@NgModule({
31+
// tslint:disable-next-line:max-line-length
32+
declarations: [AppComponent, IndexComponent, LoginComponent, SearchComponent, NotFoundComponent, NewaccountComponent, ProfileComponent, CategoryComponent, CategoryListComponent, CommercialComponent, PostComponent, FormReportComponent, ReportsComponent, ShowReportComponent, FavoritesComponent, YourcommercialComponent, YourcommercialSoldComponent, SoldComponent, AddcommercialComponent, GraphicComponent],
33+
imports: [BrowserModule, FormsModule, HttpClientModule, routing, HighchartsChartModule],
34+
bootstrap: [AppComponent]
35+
})
36+
export class AppModule { }
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { Routes, RouterModule } from '@angular/router';
2+
3+
import {IndexComponent} from './components/index/index.component';
4+
import {LoginComponent} from './components/login/login.component';
5+
import {NotFoundComponent} from './components/404/NotFound.component';
6+
import {NewaccountComponent} from './components/login/newaccount.component';
7+
import {ProfileComponent} from './components/profile/profile.component';
8+
import { CategoryComponent } from './components/category/category.component';
9+
import { FormReportComponent } from './components/report/formReport.component';
10+
import { ReportsComponent } from './components/report/reports.component';
11+
import { ShowReportComponent } from './components/report/showReport.component';
12+
import { CategoryListComponent } from './components/category/categoryList.component';
13+
import { FavoritesComponent } from './components/favorites/favorites.component';
14+
import {CommercialComponent} from './components/articles/commercial.component';
15+
import {PostComponent} from './components/articles/post.component';
16+
import {YourcommercialComponent} from './components/articles/yourcommercial.component';
17+
import {YourcommercialSoldComponent} from './components/articles/yourcommercialsold.component';
18+
import {SoldComponent} from './components/articles/sold.component';
19+
import {AddcommercialComponent} from './components/articles/addcommercial.component';
20+
21+
const appRoutes = [
22+
{ path: '', component: IndexComponent },
23+
{ path: 'login', component: LoginComponent },
24+
{ path: 'newaccount', component: NewaccountComponent },
25+
{ path: 'profile', component: ProfileComponent },
26+
{ path: 'category', component: CategoryComponent},
27+
{ path: 'formReport/:id', component: FormReportComponent},
28+
{ path: 'reports', component: ReportsComponent},
29+
{ path: 'showReport', component: ShowReportComponent},
30+
{ path: 'categoryList', component: CategoryListComponent},
31+
{ path: 'favorites', component: FavoritesComponent},
32+
{ path: 'commercial', component: CommercialComponent },
33+
{ path: 'showReport/:id', component: ShowReportComponent},
34+
{ path: 'commercial/:id', component: CommercialComponent },
35+
{ path: 'post', component: PostComponent },
36+
{ path: 'post/:id', component: PostComponent },
37+
{ path: 'yourcommercial', component: YourcommercialComponent },
38+
{ path: 'yourcommercialsold', component: YourcommercialSoldComponent },
39+
{ path: 'sold', component: SoldComponent },
40+
{ path: 'sold/:id', component: SoldComponent },
41+
{ path: 'adcommercial', component: AddcommercialComponent },
42+
{ path: '**', component: NotFoundComponent}
43+
];
44+
45+
export const routing = RouterModule.forRoot(appRoutes);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<div style="text-align: center">
2+
<a href="/"><img height="auto" src="/assets/img/404.png" width="20%"/></a>
3+
<br>
4+
<b><a href="/" style="font-size: 36px;">Ir al inicio</a></b>
5+
</div>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import {Component} from '@angular/core';
2+
3+
@Component({
4+
selector: 'NotFound',
5+
templateUrl: './NotFound.component.html'
6+
})
7+
export class NotFoundComponent {
8+
9+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<!-- ====== Page content ======-->
2+
<section class="section">
3+
<h2 class="text-center text-light">Pon tu anuncio gratis</h2>
4+
<div class="container">
5+
<div class="row">
6+
<div class="col-xs-12 col-sm-10 col-sm-offset-1" style="border: 1px solid #E1E1E1;">
7+
<h3 class="text-info">Busca la categoría donde verán tu anuncio</h3>
8+
<div class="form-group">
9+
<div class="col-sm-3 control-label">
10+
<label>¿Qué anuncias?<small>Pulsando Ctrl puedes seleccionar varias
11+
catgorías</small></label>
12+
</div>
13+
<div class="col-sm-7">
14+
<div class="form-group">
15+
<select #categories class="form-control" multiple name="CATEGORYS">
16+
<option *ngFor="let category of categorys" name="CATEGORY" value="{{category.id_CATEGORY}}">{{category.title}}</option>
17+
</select>
18+
</div>
19+
</div>
20+
</div>
21+
<br><br><br><br><br><br>
22+
<h3 class="text-info">Detalles de tu anuncio</h3>
23+
<div class="form-group">
24+
<label class="col-sm-3 control-label">Título del anuncio</label>
25+
<div class="col-sm-7">
26+
<input #title class="form-control" name="tITLE" placeholder="Título del anuncio" required=""
27+
type="text">
28+
</div>
29+
</div>
30+
<div class="form-group">
31+
<label class="col-sm-3 control-label">Descripción</label>
32+
<div class="col-sm-7">
33+
<textarea #description NAME="dESCRIPTION" class="form-control" placeholder="Descripción" required=""
34+
rows="3"></textarea>
35+
</div>
36+
</div>
37+
<div class="form-group">
38+
<label class="col-sm-3 control-label">Precio</label>
39+
<div class="col-sm-7">
40+
<input #price class="form-control" name="pRICE" placeholder="Precio" required="" type="text">
41+
</div>
42+
</div>
43+
<div class="form-group">
44+
<label class="col-sm-3 control-label">Ciudad</label>
45+
<div class="col-sm-7">
46+
<input #city class="form-control" name="cITY" placeholder="Ciudad" required="" type="text">
47+
</div>
48+
</div>
49+
<div class="form-group">
50+
<label class="col-sm-3 control-label">Código postal</label>
51+
<div class="col-sm-7">
52+
<input #postal_CODE class="form-control" name="pOSTAL_CODE" placeholder="Código postal" required=""
53+
type="text">
54+
</div>
55+
</div>
56+
<br><br><br><br><br><br><br><br><br>
57+
<h3 class="text-info">Foto</h3>
58+
<p>¡los anuncios con fotos reciben 7 veces más contactos!</p>
59+
<div class="form-group">
60+
<div class="custom-input-file">
61+
<input #file accept=".jpg, .jpeg" class="input-file" name="imageField" size="1" type="file"/>
62+
<i aria-hidden="true" class="fa fa-picture-o"></i>
63+
</div>
64+
<br>
65+
<p class="text-muted text-center archivo">Archivo...</p>
66+
</div>
67+
<p class="text-center">
68+
Al publicar un anuncio, aceptas las <a href="#!">condiciones de uso y la Política de
69+
Privacidad</a>
70+
</p>
71+
<p class="text-center">
72+
<input (click)="save($event, title.value, description.value, city.value, price.value, postal_CODE.value, categories.selectedOptions)" class="btn btn-info" type="submit" value="Guardar" />
73+
</p>
74+
</div>
75+
</div>
76+
</div>
77+
78+
</section>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import {Component, OnInit, ViewChild} from '@angular/core';
2+
import {Category} from '../../models/category.model';
3+
import {CategoryService} from '../../services/category.service';
4+
import {ArticleService} from '../../services/article.service';
5+
import {Router} from '@angular/router';
6+
import {Article} from '../../models/article.model';
7+
8+
@Component({
9+
selector: 'addcommercial',
10+
templateUrl: './addcommercial.component.html'
11+
})
12+
export class AddcommercialComponent implements OnInit {
13+
categorys: Category[];
14+
@ViewChild("file")
15+
file: any;
16+
17+
ngOnInit(): void {
18+
this.categoryService.getCategories().subscribe(
19+
response => this.categorys = response,
20+
error => console.log(error)
21+
);
22+
}
23+
24+
constructor(private categoryService: CategoryService, private articleService: ArticleService, private router: Router) {
25+
}
26+
27+
// tslint:disable-next-line:variable-name
28+
save($event: any, TITLE: string, DESCRIPTION: string, CITY: string, PRICE: string, POSTAL_CODE: string, categories: any): void {
29+
const c = [1, 2, 3];
30+
this.articleService.addArticle(TITLE, DESCRIPTION, CITY, PRICE, POSTAL_CODE, c).subscribe(
31+
response => this.uploadImage(response as Article),
32+
error => console.log(error)
33+
);
34+
}
35+
36+
uploadImage(articleImage: Article): void {
37+
38+
const image = this.file.nativeElement.files[0];
39+
if (image) {
40+
const formData = new FormData();
41+
formData.append('imageFile', image);
42+
this.articleService.setArticleImage(articleImage, formData).subscribe(
43+
_ => this.afterUploadImage(articleImage),
44+
error => alert('Error uploading category image: ' + error)
45+
);
46+
} else {
47+
this.afterUploadImage(articleImage);
48+
}
49+
}
50+
51+
private afterUploadImage(afterArticleImage: Article): void {
52+
this.router.navigate(['/commercial']);
53+
}
54+
}

0 commit comments

Comments
 (0)