-
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 #7 from SlaySayto/dev-branch
Add profile, store and catalog
- Loading branch information
Showing
58 changed files
with
25,211 additions
and
112 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,19 @@ | ||
![Deployment](https://github.com/SlaySayto/elbetta-web/workflows/Deployment/badge.svg) ![Build](https://github.com/SlaySayto/elbetta-web/workflows/Node.js%20CI/badge.svg) | ||
|
||
|
||
# Front | ||
|
||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.2.0. | ||
|
||
## Development server | ||
|
||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. | ||
# Elbeta Web App Front | ||
|
||
## Code scaffolding | ||
|
||
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. | ||
|
||
## Build | ||
|
||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. | ||
![Deployment](https://github.com/SlaySayto/elbetta-web/workflows/Deployment/badge.svg) ![Build](https://github.com/SlaySayto/elbetta-web/workflows/Node.js%20CI/badge.svg) | ||
|
||
## Running unit tests | ||
# Front | ||
|
||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). | ||
|
||
## Running end-to-end tests | ||
|
||
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). | ||
## What can be improved | ||
|
||
## Further help | ||
+ Replace console.log with a logger | ||
+ User Jwt instead of basic authentication | ||
+ Add global error handling | ||
+ Add data validation in frontend & backend | ||
|
||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. | ||
## Development server | ||
|
||
Auto Generate | ||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
33 changes: 33 additions & 0 deletions
33
src/app/components/abstract-search/abstract-search.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,33 @@ | ||
import {Component, EventEmitter, Injectable, Input, OnInit, Output} from '@angular/core'; | ||
|
||
@Injectable() | ||
export abstract class AbstractSearchComponent { | ||
|
||
@Input() set itemPagination(value: any) { | ||
// Execute a search only in the page has been changed | ||
if (value.page !== this._itemPagination.page) { | ||
this._itemPagination = {...value}; | ||
this.search(); | ||
} else { | ||
this._itemPagination = {...value}; | ||
} | ||
} | ||
|
||
// tslint:disable-next-line:variable-name | ||
_itemPagination: any; | ||
|
||
// tslint:disable-next-line:no-output-on-prefix | ||
@Output() onSearch = new EventEmitter(); | ||
|
||
@Output() tabCols = new EventEmitter(); | ||
|
||
protected constructor() { | ||
} | ||
|
||
abstract search(); | ||
abstract createFormControls(); | ||
abstract createForm(); | ||
abstract initCols(); | ||
|
||
} | ||
|
112 changes: 112 additions & 0 deletions
112
src/app/components/abstract-table/abstract-table.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,112 @@ | ||
import {Component, Injectable, OnInit} from '@angular/core'; | ||
// @ts-ignore | ||
import {PaginationModel} from '../../_models/pagination.model'; | ||
|
||
@Injectable() | ||
export abstract class AbstractTableComponent implements OnInit { | ||
|
||
itemPagination = new PaginationModel(); | ||
dateFormat = 'dd/MM/yyyy'; | ||
currencyCode = 'DTN'; | ||
// tslint:disable-next-line:max-line-length | ||
cols: { field: string, header: string, date: boolean, currency: boolean, hasSubField?: boolean, link?: boolean, subfield?: string, img?: boolean, recursive?: boolean, groupRow?: boolean}[]; | ||
|
||
|
||
// Boolean | ||
showBefore = false; | ||
showAfter = false; | ||
|
||
// Other | ||
pageCursor = 0; | ||
Arr = Array; | ||
|
||
protected constructor() { } | ||
|
||
// tslint:disable-next-line:contextual-lifecycle | ||
ngOnInit() { | ||
this.itemPagination = new PaginationModel(); | ||
} | ||
|
||
/** show or not page number in pagintation. */ | ||
shouldShowPageNumber(page) { | ||
this.pageCursor = page; | ||
return page === 0 || (page - this.itemPagination.page > -3 && page - this.itemPagination.page < 3) || | ||
this.itemPagination.totalPages - page < 2; | ||
} | ||
|
||
/** show after ...u */ | ||
showAfterPonctuation(page) { | ||
if (!this.showAfter) { | ||
if (this.itemPagination.page - page < -3 && page !== this.itemPagination.totalPages) { | ||
this.showAfter = true; | ||
return true; | ||
} | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
/** Before ... */ | ||
showBeforePonctuation(page) { | ||
if (!this.showBefore) { | ||
if (this.itemPagination.page - page > 2 && page !== 0) { | ||
this.showBefore = true; | ||
return true; | ||
} | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
/** get next page. */ | ||
next() { | ||
if (this.itemPagination.page >= this.itemPagination.totalPages - 1) { | ||
return; | ||
} | ||
this.itemPagination.page++; | ||
this.updatePagination(); | ||
} | ||
|
||
/** get previous page. */ | ||
previous() { | ||
if (this.itemPagination.page <= 0) { | ||
return; | ||
} | ||
this.itemPagination.page--; | ||
this.updatePagination(); | ||
} | ||
|
||
/** get specific page. */ | ||
getPage(page) { | ||
if (this.itemPagination.page === page) { | ||
this.showBefore = false; | ||
this.showAfter = false; | ||
return; | ||
} | ||
this.itemPagination.page = page; | ||
this.updatePagination(); | ||
} | ||
|
||
/** | ||
* find value in object. | ||
* @param object | ||
* @param key | ||
*/ | ||
findVal(object, key) { | ||
const keys = key.split('.'); | ||
let obj = object; | ||
keys.forEach((k) => { | ||
if (obj) { | ||
obj = obj[k]; | ||
} else { | ||
obj = null; | ||
} | ||
}); | ||
return obj; | ||
} | ||
|
||
itemClicked(item) {} | ||
|
||
abstract updatePagination(); | ||
|
||
} |
File renamed without changes.
Oops, something went wrong.