diff --git a/.gitignore b/.gitignore
index 9006ab5..9e28ef2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,6 @@ static/
__pycache__/
env/
node_modules/
+
+# for theme viewing
+themes/
diff --git a/assets/package-lock.json b/assets/package-lock.json
index 9174aff..b4a4a0e 100644
--- a/assets/package-lock.json
+++ b/assets/package-lock.json
@@ -1,14 +1,45 @@
{
- "name": "swiftkind",
- "version": "2.0.0",
+ "name": "angular",
+ "version": "0.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
+ "@ng-bootstrap/ng-bootstrap": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/@ng-bootstrap/ng-bootstrap/-/ng-bootstrap-4.0.2.tgz",
+ "integrity": "sha512-SBsN8ORvj/WXpZGSyR2+CRkg6GCtax5+fsLKt9ImHKUVWwePVqRxiGlnxXqwNPHQ46vOdd7nDN9cwE7dfbGaAQ==",
+ "requires": {
+ "tslib": "^1.9.0"
+ },
+ "dependencies": {
+ "tslib": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz",
+ "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
+ }
+ }
+ },
"almond": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/almond/-/almond-0.3.3.tgz",
"integrity": "sha1-oOfJWsdiTWQXtElLHmi/9pMWiiA="
},
+ "angular-text-input-autocomplete": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/angular-text-input-autocomplete/-/angular-text-input-autocomplete-0.3.0.tgz",
+ "integrity": "sha512-0oZBc1YhPalu7gOHqW8nEnkslnR+hcpnB79qV63opZbga1c0pfL4/MeKjVxW6SBauLCFAVoO1Mka0kwT80DSyw==",
+ "requires": {
+ "textarea-caret": "^3.1.0",
+ "tslib": "^1.9.0"
+ },
+ "dependencies": {
+ "tslib": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz",
+ "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
+ }
+ }
+ },
"animate.css": {
"version": "3.7.0",
"resolved": "https://registry.npmjs.org/animate.css/-/animate.css-3.7.0.tgz",
@@ -34,6 +65,26 @@
"resolved": "https://registry.npmjs.org/jquery-mousewheel/-/jquery-mousewheel-3.1.13.tgz",
"integrity": "sha1-BvAzXxbjU6aV5yBr9QUDy1I6buU="
},
+ "keyboardevent-key-polyfill": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/keyboardevent-key-polyfill/-/keyboardevent-key-polyfill-1.1.0.tgz",
+ "integrity": "sha1-ijGdjkWhMXL8pWKGNy+QwdTHAUw="
+ },
+ "ng-select2": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/ng-select2/-/ng-select2-1.0.8.tgz",
+ "integrity": "sha512-cMonV4RMKmJGw4MSuTJumLDDaZao3r8slGu53GlrdyOSAEMsrjuHKeWQxMlcBFTAqiSwImugYPulfZSXPmlO2w==",
+ "requires": {
+ "tslib": "^1.9.0"
+ },
+ "dependencies": {
+ "tslib": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz",
+ "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
+ }
+ }
+ },
"popper.js": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.14.1.tgz",
@@ -49,16 +100,21 @@
"resolved": "https://registry.npmjs.org/select2/-/select2-4.0.6-rc.1.tgz",
"integrity": "sha1-qmwwOKfw8ukf+t448KIcFeGBMnY=",
"requires": {
- "almond": "0.3.3",
- "jquery-mousewheel": "3.1.13"
+ "almond": "~0.3.1",
+ "jquery-mousewheel": "~3.1.13"
}
},
+ "textarea-caret": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/textarea-caret/-/textarea-caret-3.1.0.tgz",
+ "integrity": "sha512-cXAvzO9pP5CGa6NKx0WYHl+8CHKZs8byMkt3PCJBCmq2a34YA9pO1NrQET5pzeqnBjBdToF5No4rrmkDUgQC2Q=="
+ },
"wowjs": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/wowjs/-/wowjs-1.1.3.tgz",
"integrity": "sha1-RA/Bu0x+iWhA7keXIpaitZB1rL0=",
"requires": {
- "animate.css": "3.7.0"
+ "animate.css": "^3.7.0"
},
"dependencies": {
"animate.css": {
diff --git a/assets/package.json b/assets/package.json
index f9bef8d..3071aab 100644
--- a/assets/package.json
+++ b/assets/package.json
@@ -12,20 +12,28 @@
"private": true,
"dependencies": {
"@angular/animations": "~7.1.0",
+ "@angular/cdk": "~7.2.2",
"@angular/common": "~7.1.0",
"@angular/compiler": "~7.1.0",
"@angular/core": "^7.0.0",
"@angular/forms": "~7.1.0",
+ "@angular/material": "~7.2.2",
"@angular/platform-browser": "~7.1.0",
"@angular/platform-browser-dynamic": "~7.1.0",
"@angular/router": "~7.1.0",
+ "@auth0/angular-jwt": "^2.1.0",
+ "@ng-bootstrap/ng-bootstrap": "^4.0.2",
"angular-jwt": "^0.1.10",
+ "angular-text-input-autocomplete": "^0.3.0",
"angular2-jwt": "^0.2.3",
"animate.css": "^3.7.0",
"bootstrap": "^4.0.0",
"core-js": "^2.5.4",
"ionicons": "^2.0.1",
"jquery": "^3.3.1",
+ "keyboardevent-key-polyfill": "^1.1.0",
+ "ng-select2": "^1.0.8",
+ "ng2-select2": "^1.0.0-beta.11",
"popper.js": "^1.14.1",
"retinajs": "^2.1.3",
"rxjs": "~6.3.3",
diff --git a/assets/src/app/app.component.html b/assets/src/app/app.component.html
index 2f1ea9b..fa87238 100644
--- a/assets/src/app/app.component.html
+++ b/assets/src/app/app.component.html
@@ -57,7 +57,6 @@
- {{ rememberMe }}
diff --git a/assets/src/app/app.component.ts b/assets/src/app/app.component.ts
index 763d4c3..5ac9619 100644
--- a/assets/src/app/app.component.ts
+++ b/assets/src/app/app.component.ts
@@ -1,8 +1,9 @@
-import { Component, HostListener, OnInit, OnDestroy} from '@angular/core';
+import { Component, OnInit } from '@angular/core';
import { AuthService} from './commons/services/auth/auth.service';
import { FormControl, FormBuilder, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { Location } from '@angular/common';
+import { Title } from '@angular/platform-browser';
@Component({
selector: 'app-root',
@@ -10,9 +11,7 @@ import { Location } from '@angular/common';
styleUrls: ['./app.component.css'],
providers: [AuthService]
})
-
-export class AppComponent implements OnInit{
- title = 'angular';
+export class AppComponent implements OnInit {
usersForm;
errors;
rememberMe:boolean = false;
@@ -21,7 +20,8 @@ export class AppComponent implements OnInit{
private authService: AuthService,
private fb: FormBuilder,
private router: Router,
- private location: Location
+ private location: Location,
+ private title: Title,
){ }
ngOnInit(){
@@ -29,12 +29,7 @@ export class AppComponent implements OnInit{
email : new FormControl('', [Validators.required, Validators.email]),
password : new FormControl('', Validators.required)
});
- }
-
- ngOnDestroy(){
- if(this.rememberMe == false){
- this.authService.removeToken();
- }
+
}
get username(){
diff --git a/assets/src/app/app.module.ts b/assets/src/app/app.module.ts
index 4992a8a..a7827e1 100644
--- a/assets/src/app/app.module.ts
+++ b/assets/src/app/app.module.ts
@@ -1,9 +1,14 @@
import { BrowserModule } from '@angular/platform-browser';
-import { NgModule } from '@angular/core';
+import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { HttpClientModule,HTTP_INTERCEPTORS } from '@angular/common/http';
import { RouterModule, Routes } from "@angular/router";
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { AppRoutingModule } from './app-routing.module';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
+import { polyfill } from 'keyboardevent-key-polyfill';
+import { TextInputAutocompleteModule } from 'angular-text-input-autocomplete';
+import { NgbPaginationModule, NgbAlertModule } from '@ng-bootstrap/ng-bootstrap';
+import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
//Service
import { TokenService } from './commons/services/interceptors/token.service';
@@ -18,15 +23,20 @@ import { CartComponent } from './components/cart/cart.component';
import { DetailsComponent } from './components/details/details.component';
import { AccountComponent } from './components/account/account.component';
+//Pipes
+import { CategoryPipe } from './commons/pipes/category/category.pipe';
+
//Routes
const routes: Routes = [
{ path: '', component: HomeComponent },
- { path: 'details', component: DetailsComponent },
- { path: 'cart', component: CartComponent },
+ { path: 'details/:id', component: DetailsComponent },
+ { path: 'cart/:id', component: CartComponent },
{ path: 'account', component: AccountComponent }
]
+polyfill();
+
@NgModule({
declarations: [
AppComponent,
@@ -34,6 +44,7 @@ const routes: Routes = [
CartComponent,
DetailsComponent,
AccountComponent,
+ CategoryPipe,
],
imports: [
@@ -43,6 +54,10 @@ const routes: Routes = [
HttpClientModule,
FormsModule,
ReactiveFormsModule,
+ TextInputAutocompleteModule,
+ NgbPaginationModule,
+ NgbAlertModule,
+ NgbModule,
RouterModule.forRoot(routes, {onSameUrlNavigation: 'reload'}),
],
providers: [
@@ -52,7 +67,8 @@ const routes: Routes = [
multi: true
}
],
- bootstrap: [AppComponent]
+ bootstrap: [AppComponent],
+ schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule { }
diff --git a/assets/src/app/commons/pipes/category.pipe.ts b/assets/src/app/commons/pipes/category.pipe.ts
new file mode 100644
index 0000000..6472dd0
--- /dev/null
+++ b/assets/src/app/commons/pipes/category.pipe.ts
@@ -0,0 +1,19 @@
+import { Pipe, PipeTransform } from '@angular/core';
+
+@Pipe({
+ name: 'category'
+})
+export class CategoryPipe implements PipeTransform {
+
+ transform(category:any, args?: any): any {
+ if(args === undefined) return category;
+
+ return category.filter(
+ cat => {
+ console.log(cat.category__category.toLowerCase());
+ return cat.category__category.toLowerCase().includes(args.toLowerCase());
+ }
+ )
+ }
+
+}
diff --git a/assets/src/app/commons/pipes/category/category.pipe.spec.ts b/assets/src/app/commons/pipes/category/category.pipe.spec.ts
new file mode 100644
index 0000000..45b4d74
--- /dev/null
+++ b/assets/src/app/commons/pipes/category/category.pipe.spec.ts
@@ -0,0 +1,8 @@
+import { CategoryPipe } from './category.pipe';
+
+describe('CategoryPipe', () => {
+ it('create an instance', () => {
+ const pipe = new CategoryPipe();
+ expect(pipe).toBeTruthy();
+ });
+});
diff --git a/assets/src/app/commons/pipes/category/category.pipe.ts b/assets/src/app/commons/pipes/category/category.pipe.ts
new file mode 100644
index 0000000..10ce382
--- /dev/null
+++ b/assets/src/app/commons/pipes/category/category.pipe.ts
@@ -0,0 +1,18 @@
+import { Pipe, PipeTransform } from '@angular/core';
+
+@Pipe({
+ name: 'category'
+})
+export class CategoryPipe implements PipeTransform {
+
+ transform(category:any, args?: any): any {
+ if(args === undefined) return category;
+
+ return category.filter(
+ cat => {
+ return cat.category__category.toLowerCase().includes(args.toLowerCase());
+ }
+ )
+ }
+
+}
diff --git a/assets/src/app/commons/services/auth/auth.service.ts b/assets/src/app/commons/services/auth/auth.service.ts
index ce5ce18..792ca97 100644
--- a/assets/src/app/commons/services/auth/auth.service.ts
+++ b/assets/src/app/commons/services/auth/auth.service.ts
@@ -77,7 +77,8 @@ export class AuthService {
}
getSessionToken(){
- if(sessionStorage['token'] == null){
+ if(sessionStorage['token'] == null ||
+ sessionStorage['token'] == undefined){
return JSON.parse(null);
}
this.token = this.refreshToken(this.user);
diff --git a/assets/src/app/commons/services/cart/cart.service.spec.ts b/assets/src/app/commons/services/cart/cart.service.spec.ts
new file mode 100644
index 0000000..a686b44
--- /dev/null
+++ b/assets/src/app/commons/services/cart/cart.service.spec.ts
@@ -0,0 +1,12 @@
+import { TestBed } from '@angular/core/testing';
+
+import { CartService } from './cart.service';
+
+describe('CartService', () => {
+ beforeEach(() => TestBed.configureTestingModule({}));
+
+ it('should be created', () => {
+ const service: CartService = TestBed.get(CartService);
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/assets/src/app/commons/services/cart/cart.service.ts b/assets/src/app/commons/services/cart/cart.service.ts
new file mode 100644
index 0000000..f202955
--- /dev/null
+++ b/assets/src/app/commons/services/cart/cart.service.ts
@@ -0,0 +1,27 @@
+import { Injectable } from '@angular/core';
+import { HttpClient, HttpHeaders } from '@angular/common/http';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class CartService {
+
+ httpHeaders = new HttpHeaders({'Content-type':'application/json'});
+ constructor(
+ private http: HttpClient) { }
+
+ getThemeCart(id){
+ return this.http.get
('http://localhost:8000/home/theme/cart/'+id+'/', {headers: this.httpHeaders})
+ .toPromise()
+ .then(
+ response => {
+ return response;
+ }
+ )
+ .catch(
+ error => {
+ return error;
+ }
+ )
+ }
+}
diff --git a/assets/src/app/commons/services/details/details.service.spec.ts b/assets/src/app/commons/services/details/details.service.spec.ts
new file mode 100644
index 0000000..9587d83
--- /dev/null
+++ b/assets/src/app/commons/services/details/details.service.spec.ts
@@ -0,0 +1,12 @@
+import { TestBed } from '@angular/core/testing';
+
+import { DetailsService } from './details.service';
+
+describe('DetailsService', () => {
+ beforeEach(() => TestBed.configureTestingModule({}));
+
+ it('should be created', () => {
+ const service: DetailsService = TestBed.get(DetailsService);
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/assets/src/app/commons/services/details/details.service.ts b/assets/src/app/commons/services/details/details.service.ts
new file mode 100644
index 0000000..7762845
--- /dev/null
+++ b/assets/src/app/commons/services/details/details.service.ts
@@ -0,0 +1,42 @@
+import { Injectable } from '@angular/core';
+import { HttpClient, HttpHeaders } from '@angular/common/http';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class DetailsService {
+
+ httpHeaders = new HttpHeaders({'Content-type': 'application/json'});
+ constructor(
+ private http: HttpClient) { }
+
+ getThemeDetailsService(id){
+ return this.http.get('http://localhost:8000/home/theme/details/'+id+'/', {headers: this.httpHeaders})
+ .toPromise()
+ .then(
+ response =>{
+ return response;
+ }
+ )
+ .catch(
+ error => {
+ return error;
+ }
+ );
+ }
+
+ createReviewService(comment){
+ return this.http.post("http://localhost:8000/details/createReview/",comment)
+ .toPromise()
+ .then(
+ response => {
+ return response;
+ }
+ )
+ .catch(
+ error => {
+ return error;
+ }
+ );
+ }
+}
diff --git a/assets/src/app/commons/services/home/home.service.spec.ts b/assets/src/app/commons/services/home/home.service.spec.ts
new file mode 100644
index 0000000..2d073b4
--- /dev/null
+++ b/assets/src/app/commons/services/home/home.service.spec.ts
@@ -0,0 +1,12 @@
+import { TestBed } from '@angular/core/testing';
+
+import { HomeService } from './home.service';
+
+describe('HomeService', () => {
+ beforeEach(() => TestBed.configureTestingModule({}));
+
+ it('should be created', () => {
+ const service: HomeService = TestBed.get(HomeService);
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/assets/src/app/commons/services/home/home.service.ts b/assets/src/app/commons/services/home/home.service.ts
new file mode 100644
index 0000000..d9b62c2
--- /dev/null
+++ b/assets/src/app/commons/services/home/home.service.ts
@@ -0,0 +1,47 @@
+import { Injectable } from '@angular/core';
+import { HttpClient, HttpHeaders } from '@angular/common/http';
+import { Observable } from 'rxjs';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class HomeService {
+
+ httpHeaders = new HttpHeaders({'Content-type': 'application/json'});
+ public categories;
+ constructor(private http: HttpClient) {
+ this.categories = this.getCategory();
+ }
+
+ getThemes(){
+ return this.http.get("http://localhost:8000/home/theme/", {headers: this.httpHeaders})
+ .toPromise()
+ .then(
+ response => {
+ return response;
+ }
+ )
+ .catch(
+ error => {
+ return error;
+ }
+ )
+ }
+
+ getCategory(){
+ return this.http.get("http://localhost:8000/home/theme/category/", {headers: this.httpHeaders})
+ .toPromise()
+ .then(
+ response => {
+ return response;
+ }
+ )
+ .catch(
+ error => {
+ return error;
+ }
+ )
+ }
+
+
+}
diff --git a/assets/src/app/components/account/account.component.html b/assets/src/app/components/account/account.component.html
index 2980bf2..2ad48c1 100644
--- a/assets/src/app/components/account/account.component.html
+++ b/assets/src/app/components/account/account.component.html
@@ -16,7 +16,9 @@
- Field required!
+
+ Field required!
+
@@ -25,7 +27,9 @@
- Field required!
+
+ Field required!
+
@@ -34,9 +38,15 @@
- Field required!
- Invalid email format!
- Email already exists!
+
+ Field required!
+
+
+ Invalid email format!
+
+
+ Email already exists!
+
diff --git a/assets/src/app/components/account/account.component.ts b/assets/src/app/components/account/account.component.ts
index 65a5796..772fd14 100644
--- a/assets/src/app/components/account/account.component.ts
+++ b/assets/src/app/components/account/account.component.ts
@@ -1,7 +1,9 @@
import { Component, OnInit } from '@angular/core';
+
import { AuthService } from '../../commons/services/auth/auth.service';
import { Router } from '@angular/router';
import { Location } from '@angular/common';
+import { Title } from '@angular/platform-browser';
import { FormBuilder, FormsModule, FormGroup, FormControl, Validators } from '@angular/forms';
@@ -21,7 +23,8 @@ export class AccountComponent implements OnInit {
private authService: AuthService,
private router: Router,
private fb: FormBuilder,
- private location: Location
+ private location: Location,
+ private title: Title
) { }
ngOnInit() {
@@ -30,14 +33,17 @@ export class AccountComponent implements OnInit {
first_name: "",
last_name: "",
password: "",
- };
- this.registrationForm = this.fb.group({
- first_name : new FormControl('', Validators.required),
- last_name : new FormControl('', Validators.required),
- email : new FormControl('', [Validators.required, Validators.email]),
- password : new FormControl('', Validators.required),
- });
+ };
+
+ this.registrationForm = this.fb.group({
+ first_name : new FormControl('', Validators.required),
+ last_name : new FormControl('', Validators.required),
+ email : new FormControl('', [Validators.required, Validators.email]),
+ password : new FormControl('', Validators.required),
+ });
+
+ this.title.setTitle('Sign up - Marketplace')
}
get first_name(){
diff --git a/assets/src/app/components/cart/cart.component.html b/assets/src/app/components/cart/cart.component.html
index d9f17cd..e398c47 100644
--- a/assets/src/app/components/cart/cart.component.html
+++ b/assets/src/app/components/cart/cart.component.html
@@ -1,3 +1,42 @@
-
- cart works!
-
+
+
+
+
+

+
+
+
+
{{ theme.category.category }}
+
{{theme.name}}
+
{{theme.description}}
+
License Type:
+
+
{{ theme.license.license }}
+
Change
+
+
+
Unit Price:
+
+
+ ${{ dis_price }}
+ - Save {{ discount }}% from ${{ theme.price }}
+
+
+ ${{ theme.price }}
+
+
+
+
+
Payment:
+
+

+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/assets/src/app/components/cart/cart.component.ts b/assets/src/app/components/cart/cart.component.ts
index c9276d4..735e6cd 100644
--- a/assets/src/app/components/cart/cart.component.ts
+++ b/assets/src/app/components/cart/cart.component.ts
@@ -1,4 +1,7 @@
import { Component, OnInit } from '@angular/core';
+import { CartService } from '../../commons/services/cart/cart.service';
+import { ActivatedRoute } from '@angular/router';
+import { Title } from '@angular/platform-browser';
@Component({
selector: 'app-cart',
@@ -6,10 +9,48 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./cart.component.css']
})
export class CartComponent implements OnInit {
-
- constructor() { }
+ theme_id:number;
+ theme;
+ discount;
+ dis_price;
+ constructor(
+ private cartService: CartService,
+ private route: ActivatedRoute,
+ private title: Title) { }
ngOnInit() {
+ this.route.paramMap.subscribe(
+ paramMap =>{
+ this.theme_id = +paramMap.get('id');
+ }
+ );
+
+ this.themeCart();
+ }
+
+ themeCart(){
+ this.cartService.getThemeCart(this.theme_id)
+ .then(
+ response => {
+ this.theme = response;
+ this.title.setTitle('Cart - '+this.theme.name);
+ this.theme.price = this.theme.price.toFixed(2);
+
+ if(this.theme.discount != null){
+ this.dis_price = this.theme.price * this.theme.discount;
+ this.dis_price = this.theme.price - this.dis_price;
+ this.dis_price = this.dis_price.toFixed(2);
+ }
+ this.discount = +this.theme.discount * 100;
+ }
+ )
+ .catch(
+ error => {
+ return error;
+ }
+ )
}
-}
+
+
+}
diff --git a/assets/src/app/components/details/details.component.css b/assets/src/app/components/details/details.component.css
index e69de29..1e75ac0 100644
--- a/assets/src/app/components/details/details.component.css
+++ b/assets/src/app/components/details/details.component.css
@@ -0,0 +1,13 @@
+.star {
+ font-size: 1.5rem;
+ color: #b0c4de;
+}
+.filled {
+ color: #1e90ff;
+}
+.bad {
+ color: #deb0b0;
+}
+.filled.bad {
+ color: #ff1e1e;
+}
\ No newline at end of file
diff --git a/assets/src/app/components/details/details.component.html b/assets/src/app/components/details/details.component.html
index 2eea188..bcd60f4 100644
--- a/assets/src/app/components/details/details.component.html
+++ b/assets/src/app/components/details/details.component.html
@@ -1,3 +1,353 @@
-
- details works!
-
+
+
+
+
+
+

+
+
+
+
{{ theme.category.category }}
+
{{ theme.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
(20 Downloads)
+
+
+
+ ${{ theme.price }}
+
+
+
+ ${{ dis_price }}
+
+
+ ${{ theme.price }}
+
+
=
+
+
+
+
+
+
+
+
{{ theme.description }}
+
+
+ Documentation
+
+
+
+
+
+
+
+
+
Screenshots
+
+
+
+
+
+
Product Details
+
+
+
+
+
Compatible with {{ theme.bootstrap }}.x
+
+
+
+
+
+
+
+ {{ browsers.browser }}
+
+
+
+
+
+
+
+
+
+
+
{{ theme.category.category }}
+
+
+
+
+
+
{{ theme.topic.topic }}
+
+
+
+
+
+
+
+ {{ label.label }},
+
+
+
+
+
+
+
+
+
{{ theme.release_date }}
+
+
+
+
+
+
+
+
+
+
+
+
+ Write a Review
+
+
+
+
+
+ Reviews
+
+
+
+
\ No newline at end of file
diff --git a/assets/src/app/components/details/details.component.ts b/assets/src/app/components/details/details.component.ts
index fa1e5a4..6565c90 100644
--- a/assets/src/app/components/details/details.component.ts
+++ b/assets/src/app/components/details/details.component.ts
@@ -1,4 +1,8 @@
import { Component, OnInit } from '@angular/core';
+import { ActivatedRoute, Router } from '@angular/router';
+import { DetailsService } from '../../commons/services/details/details.service';
+import { Title } from '@angular/platform-browser';
+import { FormBuilder, FormGroup, FormControl, Validators } from '@angular/forms';
@Component({
selector: 'app-details',
@@ -6,10 +10,95 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./details.component.css']
})
export class DetailsComponent implements OnInit {
+ currentRate:number = 0;
+ maxRate:number = 5;
+ theme_id:number;
+ theme;
+ discount;
+ dis_price;
+ reviews;
+ content;
+ token;
- constructor() { }
+ constructor(
+ private route: ActivatedRoute,
+ private detailsService: DetailsService,
+ private title: Title,
+ private fb: FormBuilder) {}
ngOnInit() {
+ this.route.paramMap.subscribe(
+ params => {
+ this.theme_id = +params.get('id');
+ }
+ );
+ this.getThemeDetails();
+
+ //forms for creating a review
+ this.reviews = this.fb.group({
+ review : new FormControl('', Validators.required),
+ rating : new FormControl('')
+ });
+
+ }
+
+ get review(){
+ return this.reviews.get('review');
+ }
+
+ get rating(){
+ return this.review.get('rating');
}
+ // get details of the theme
+ getThemeDetails(){
+ this.detailsService.getThemeDetailsService(this.theme_id)
+ .then(
+ response => {
+ this.theme = response
+ this.theme.price = this.theme.price.toFixed(2);
+ this.title.setTitle('Details - '+this.theme.name);
+
+ if(this.theme.discount != null){
+ this.dis_price = this.theme.price * this.theme.discount;
+ this.dis_price = this.theme.price - this.dis_price;
+ this.dis_price = this.dis_price.toFixed(2);
+ }
+ }
+ )
+ .catch(
+ error => {
+ return error;
+ }
+ )
+ }
+
+ //create a review and rating for the theme
+ createReview(review){
+ this.token = JSON.parse(localStorage.getItem('token'));
+ this.content = {
+ theme_id : this.theme_id,
+ token : this.token.token,
+ comment : review,
+ rating : this.currentRate
+ }
+
+ console.log(this.content);
+ this.detailsService.createReviewService(this.content)
+ .then(
+ response => {
+ this.getThemeDetails();
+ this.review.reset();
+ this.currentRate =0
+ }
+ )
+ .catch(
+ error => {
+ return error;
+ }
+ )
+ }
+
+
+
}
diff --git a/assets/src/app/components/home/home.component.html b/assets/src/app/components/home/home.component.html
index 56ff427..e75a122 100644
--- a/assets/src/app/components/home/home.component.html
+++ b/assets/src/app/components/home/home.component.html
@@ -15,373 +15,120 @@ We created themes so everyone can finish projects on time ship
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $99.99
-
-
-
Appwork - Bootstrap 4 Template + UI Kit
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $99.99
-
-
-
Color Admin - Admin Template + Front End
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $99.99
-
-
-
Unify - Responsive Website Template
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $99.99
-
-
-
Appwork - Bootstrap 4 Template + UI Kit
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $99.99
-
-
-
Color Admin - Admin Template + Front End
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $99.99
-
-
-
Unify - Responsive Website Template
-
-
+
+
+
+
+
+

+
+
-
-
-

-
-

-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- $99.99
+ ${{ theme.price }}
-
Appwork - Bootstrap 4 Template + UI Kit
+
{{ theme.name }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $99.99
-
-
-
Color Admin - Admin Template + Front End
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $99.99
-
-
-
Unify - Responsive Website Template
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $99.99
-
-
-
Appwork - Bootstrap 4 Template + UI Kit
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $99.99
-
-
-
Color Admin - Admin Template + Front End
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $99.99
-
-
-
Unify - Responsive Website Template
-
-
-
-
-
+
+
+
+ {{ comments.comment }} +
+