Skip to content

Commit

Permalink
Merge pull request #7 from SlaySayto/dev-branch
Browse files Browse the repository at this point in the history
Add profile, store and catalog
  • Loading branch information
AhmedBenyahia authored Feb 3, 2021
2 parents 4ecbc9e + be92e24 commit c0f8a00
Show file tree
Hide file tree
Showing 58 changed files with 25,211 additions and 112 deletions.
33 changes: 10 additions & 23 deletions README.md
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.
6 changes: 4 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@
],
"styles": [
"src/styles.scss",
"src/assets/scss/argon.scss"
"src/assets/scss/argon.scss",
"src/assets/css/argon-design-system.scss"
],
"scripts": [
"node_modules/chart.js/dist/Chart.min.js",
"node_modules/clipboard/dist/clipboard.min.js"
"node_modules/clipboard/dist/clipboard.min.js",
"src/assets/css/argon-design-system.min.js"
]
},
"configurations": {
Expand Down
19 changes: 17 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
"@angular-devkit/build-angular": "~0.1002.0",
"@angular/cli": "~10.2.0",
"@angular/compiler-cli": "~10.2.0",
"@types/node": "^12.11.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"@types/nouislider": "^9.0.8",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
Expand Down
13 changes: 8 additions & 5 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,29 @@ import { AppComponent } from './app.component';
import { AdminLayoutComponent } from './layouts/admin-layout/admin-layout.component';
import { AuthLayoutComponent } from './layouts/auth-layout/auth-layout.component';

import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import {NgbDatepickerModule, NgbModule} from '@ng-bootstrap/ng-bootstrap';

import { AppRoutingModule } from './app.routing';
import { ComponentsModule } from './components/components.module';
import {SharedModule} from './shared/shared.module';
import {ProductCatalogComponent} from './layouts/product-catalog/product-catalog/product-catalog.component';


@NgModule({
imports: [
BrowserAnimationsModule,
FormsModule,
HttpClientModule,
ComponentsModule,
SharedModule,
NgbModule,
RouterModule,
AppRoutingModule
AppRoutingModule,
NgbDatepickerModule
],
declarations: [
ProductCatalogComponent,
AppComponent,
AdminLayoutComponent,
AuthLayoutComponent
AuthLayoutComponent,
],
providers: [],
bootstrap: [AppComponent]
Expand Down
11 changes: 11 additions & 0 deletions src/app/app.routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {Routes, RouterModule} from '@angular/router';

import {AdminLayoutComponent} from './layouts/admin-layout/admin-layout.component';
import {AuthLayoutComponent} from './layouts/auth-layout/auth-layout.component';
import {ProductCatalogComponent} from './layouts/product-catalog/product-catalog/product-catalog.component';

const routes: Routes = [
{
Expand All @@ -20,6 +21,16 @@ const routes: Routes = [
loadChildren: () => import('./layouts/admin-layout/admin-layout.module').then(mod => mod.AdminLayoutModule)
}
]
},
{
path: '',
component: ProductCatalogComponent,
children: [
{
path: '',
loadChildren: () => import('./layouts/product-catalog/product-catalog.module').then(mod => mod.ProductCatalogModule)
}
]
}, {
path: '',
component: AuthLayoutComponent,
Expand Down
33 changes: 33 additions & 0 deletions src/app/components/abstract-search/abstract-search.component.ts
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 src/app/components/abstract-table/abstract-table.component.ts
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.
Loading

0 comments on commit c0f8a00

Please sign in to comment.