Skip to content

Commit

Permalink
feat: minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammad-haji committed Aug 15, 2018
1 parent 007ff2d commit a4b262e
Show file tree
Hide file tree
Showing 8 changed files with 334 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/app/config/env/development.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const DevelopmentConfigConst = {
server: {
host: 'http://localhost',
port: '3000',
host: 'http://5b7403bca583740014190859.mockapi.io',
port: '80',
baseApi: '/api',
get serverBaseURL() {
return `${this.host}:${this.port}${this.baseApi}`
Expand Down
10 changes: 6 additions & 4 deletions src/app/pages/users/list/list-user.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {LocalDataSource} from 'ng2-smart-table';

import {TABLE_CONFIG} from './table.config';
import {UsersService} from '../users.service';
import {ApiDataProviderService} from "../../../@core/services/api/api-data-provider.service";

@Component({
selector: 'ngx-list-user-component',
Expand All @@ -13,13 +14,14 @@ export class ListUserComponent implements OnInit {
settings = TABLE_CONFIG;
source: LocalDataSource = new LocalDataSource();

constructor(private userService: UsersService) {
constructor(private userService: UsersService,
private apiDataProviderService: ApiDataProviderService) {
}

ngOnInit() {
this.userService.getUsersList().subscribe(res => {
this.source = res.data;
})
this.apiDataProviderService.createApi('users').getAll().subscribe(res => {
this.source = res;
});
}

// onDeleteConfirm(event): void {
Expand Down
22 changes: 5 additions & 17 deletions src/app/pages/users/list/table.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,17 @@ export const TABLE_CONFIG = {
delete: false,
},
columns: {
username: {
title: 'نام کاربری',
id: {
title: 'id',
type: 'string',
},
firstName: {
name: {
title: 'نام',
type: 'string',
},
lastName: {
title: 'نام خانوادگی',
type: 'string',
},
provider: {
title: 'نحوه ورود',
type: 'string',
},
created: {
createdAt: {
title: 'تاریخ ثبت نام',
type: 'date',
},
email: {
title: 'ایمیل',
type: 'string',
},
}
},
};
107 changes: 107 additions & 0 deletions src/assets/api_samples/DiscountRequest_response_example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"response": {
"body": {
"data": [
{
"_id": {
"$oid": "55b5c7629f760097d4c7a296"
},
"discount": {
"code": "D1345",
"description": "discount for bill",
"descriptionInOtherLanguages": {
"descriptionInOtherLanguage": [
{
"description": "OFFERING l01",
"language": {
"code": "en"
},
"channel": {
"code": "Direct Sales"
}
},
{
"description": "OFFl01",
"language": {
"code": "sp"
},
"channel": {
"code": "Self-care"
}
}
]
},
"currency": {
"code": "USD"
},
"discountCriteria": {
"code": "Comparison"
},
"considerDuration": true,
"discountArticle": {
"code": "Discount13424"
},
"lineOfBusiness": {
"code": "Mobile Telephony"
},
"discountCriteriaOn": {
"code": "MultiArticle"
},
"criteriaValue": 100,
"criteriaOnArticles": {
"commercialArticle": [
{
"code": "comAr1"
},
{
"code": "comAr2"
}
]
},
"discountByMaster": {
"code": "Percentage"
},
"discountOn": {
"code": "MultiArticle"
},
"discountOnArticles": {
"commercialArticle": [
{
"code": "comAr1"
},
{
"code": "comAr2"
}
]
},
"discountSlabOption": {
"code": "Tierd"
},
"discountSlabs": {
"discountSlab": [
{
"startSlabAmount": "1",
"endSlabAmount": "2",
"discountPercentage": "30"
},
{
"startSlabAmount": "2",
"endSlabAmount": "3",
"discountPercentage": "40"
}
]
},
"discountSlabBase": {
"code": "Amount"
},
"discountValue": 12,
"status": {
"code": "Active"
}
}
}
],
"totalRecordsCount": 1
}
}
}
197 changes: 197 additions & 0 deletions src/assets/api_samples/RegionRequest_response_example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
[
{
"_id": {
"$oid": "54e201648ad433cd80bb68b3"
},
"regions": {
"region": [
{
"countriesMasterData": {
"language": "en",
"countries": {
"country": [
{
"name": "India",
"code": "IND"
},
{
"name": "USA",
"code": "USA"
}
]
}
}
},
{
"stateMasterData": {
"language": "en",
"country": "IND",
"states": {
"state": [
{
"name": "Karnataka",
"code": "KA",
"country": "IND"
},
{
"name": "Maharashtra",
"code": "MH",
"country": "IND"
},
{
"name": "Tamilnadu",
"code": "TN",
"country": "IND"
},
{
"name": "Uttar Pradesh",
"code": "UP",
"country": "IND"
},
{
"name": "West Bengal",
"code": "WB",
"country": "IND"
},
{
"name": "Kerala",
"code": "KL",
"country": "IND"
}
]
}
}
},
{
"citiesMasterData": {
"cityMasterData": [
{
"language": "en",
"state": "MH",
"country": "IND",
"cities": {
"city": [
{
"name": "Mumbai",
"code": "MUM",
"state": "MH",
"country": "IND"
},
{
"name": "Pune",
"code": "PUNE",
"state": "MH",
"country": "IND"
},
{
"name": "Nagpur",
"code": "NGP",
"state": "MH",
"country": "IND"
}
]
}
},
{
"language": "en",
"state": "KA",
"country": "IND",
"cities": {
"city": [
{
"name": "Bangalore",
"code": "BNG",
"state": "KA",
"country": "IND"
},
{
"name": "Pune",
"code": "PUNE",
"state": "MH",
"country": "IND"
},
{
"name": "Nagpur",
"code": "NGP",
"state": "MH",
"country": "IND"
}
]
}
},
{
"language": "en",
"state": "TN",
"country": "IND",
"cities": {
"city": [
{
"name": "Chennai",
"code": "CHE",
"state": "TN",
"country": "IND"
},
{
"name": "Madurai",
"code": "MAD",
"state": "TN",
"country": "IND"
}
]
}
},
{
"language": "en",
"state": "UP",
"country": "IND",
"cities": {
"city": [
{
"name": "Kanpur",
"code": "KNP",
"state": "UP",
"country": "IND"
},
{
"name": "Lucknow",
"code": "LKO",
"state": "UP",
"country": "IND"
},
{
"name": "Varanasi",
"code": "VNS",
"state": "UP",
"country": "IND"
},
{
"name": "Gorakhpur",
"code": "GKP",
"state": "UP",
"country": "IND"
}
]
}
},
{
"language": "en",
"state": "WB",
"country": "IND",
"cities": {
"city": [
{
"name": "Kolkata",
"code": "KLKT",
"state": "WB",
"country": "IND"
}
]
}
}
]
}
}
]
}
}
]
15 changes: 15 additions & 0 deletions src/assets/api_samples/TagRequest_response_example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"response": {
"body": [
{
"_id": {
"$oid": "554cdc6f8ad433cd80bb68fa"
},
"tag": {
"type": "sdlfkj",
"name": "aasdfasdfasdf"
}
}
]
}
}

0 comments on commit a4b262e

Please sign in to comment.