mirror of
https://github.com/valitydev/koffing.git
synced 2024-11-06 09:15:20 +00:00
parent
893b3c46f0
commit
1231f4c773
@ -1,17 +1,15 @@
|
||||
.row
|
||||
.col-xs-12
|
||||
.x_panel.tile
|
||||
.x_content
|
||||
form.form-horizontal
|
||||
.form-group
|
||||
.col-xs-12.col-sm-1
|
||||
label.control-label Магазин
|
||||
.col-xs-12.col-sm-6
|
||||
kof-select(*ngIf="selectItems.length", [(ngModel)]="selectedShopID", [items]="selectItems", (onChange)="navigateToShop()", [modelOptions]="{standalone: true}", name='shopId')
|
||||
ul.nav.nav-tabs.bar_tabs(*ngIf="selectedShopID")
|
||||
li.hand-cursor([routerLink]="['dashboard']", [routerLinkActive]="['active']")
|
||||
a Статистика
|
||||
li.hand-cursor([routerLink]="['finance']", [routerLinkActive]="['active']")
|
||||
a Финансы
|
||||
.tab-content
|
||||
router-outlet
|
||||
.x_panel.tile
|
||||
.x_content
|
||||
form.form-horizontal
|
||||
.form-group
|
||||
.col-xs-12.col-sm-1
|
||||
label.control-label Магазин
|
||||
.col-xs-12.col-sm-6
|
||||
kof-select(*ngIf="selectItems.length", [(ngModel)]="selectedShopID", [items]="selectItems", (onChange)="navigateToShop()", [modelOptions]="{standalone: true}", name='shopId')
|
||||
ul.nav.nav-tabs.bar_tabs(*ngIf="selectedShopID")
|
||||
li.hand-cursor([routerLink]="['dashboard']", [routerLinkActive]="['active']")
|
||||
a Статистика
|
||||
li.hand-cursor([routerLink]="['finance']", [routerLinkActive]="['active']")
|
||||
a Финансы
|
||||
.tab-content
|
||||
router-outlet
|
||||
|
@ -1,8 +1,5 @@
|
||||
export class Category {
|
||||
|
||||
public categoryRef: number;
|
||||
|
||||
public description: string;
|
||||
|
||||
public name: string;
|
||||
}
|
||||
|
@ -1,9 +1,6 @@
|
||||
export class Claim {
|
||||
|
||||
public id: number;
|
||||
|
||||
public changeset: any[];
|
||||
|
||||
public status: {
|
||||
status: string;
|
||||
};
|
||||
|
@ -1,8 +1,10 @@
|
||||
import { Contractor } from './contractor.class';
|
||||
import { PayoutAccount } from './payout-account.class';
|
||||
|
||||
export class Contract {
|
||||
public id: number;
|
||||
public contractor: Contractor;
|
||||
public concludedAt: string;
|
||||
public terminatedAt: string;
|
||||
public payoutAccouts: PayoutAccount[];
|
||||
}
|
||||
|
@ -1,10 +1,6 @@
|
||||
export class Conversion {
|
||||
|
||||
public conversion: number;
|
||||
|
||||
public offset: number;
|
||||
|
||||
public successfulCount: number;
|
||||
|
||||
public totalCount: number;
|
||||
}
|
||||
|
@ -1,12 +1,7 @@
|
||||
export class GeoData {
|
||||
|
||||
public cityName: string;
|
||||
|
||||
public currency: string;
|
||||
|
||||
public offset: number;
|
||||
|
||||
public profit: number;
|
||||
|
||||
public revenue: number;
|
||||
}
|
||||
|
@ -1,18 +1,10 @@
|
||||
export class Invoice {
|
||||
|
||||
public id: number;
|
||||
|
||||
public shopID: number;
|
||||
|
||||
public amount: number;
|
||||
|
||||
public currency: string;
|
||||
|
||||
public description: string;
|
||||
|
||||
public dueDate: string;
|
||||
|
||||
public product: string;
|
||||
|
||||
public status: string;
|
||||
}
|
||||
|
@ -1,13 +1,8 @@
|
||||
export class RequestParams {
|
||||
|
||||
public fromTime: string;
|
||||
|
||||
public toTime: string;
|
||||
|
||||
public splitUnit: string = 'minute';
|
||||
|
||||
public splitSize: string = '1';
|
||||
|
||||
public paymentMethod: string = 'bank_card';
|
||||
|
||||
constructor(fromTime: string, toTime: string, splitUnit?: string, splitSize?: string, paymentMethod?: string) {
|
||||
|
@ -1,10 +1,6 @@
|
||||
export class Revenue {
|
||||
|
||||
public currency: string;
|
||||
|
||||
public offset: number;
|
||||
|
||||
public profit: number;
|
||||
|
||||
public revenue: number;
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
import { Shop } from './shop.class';
|
||||
|
||||
export class ShopCreation {
|
||||
|
||||
public modificationType: string;
|
||||
|
||||
public shop: Shop;
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
export class ShopDetail {
|
||||
|
||||
public name: string;
|
||||
|
||||
public description: string;
|
||||
|
||||
public location: string;
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
export class ShopItem {
|
||||
|
||||
public value: string;
|
||||
|
||||
public label: string;
|
||||
|
||||
constructor(value: string, label: string) {
|
||||
|
@ -1,7 +1,5 @@
|
||||
export class ShopModification {
|
||||
|
||||
public modificationType: string;
|
||||
|
||||
public shopID: string;
|
||||
|
||||
public details: {
|
||||
|
@ -5,6 +5,7 @@ import 'rxjs/add/operator/toPromise';
|
||||
import { ConfigService } from './config.service';
|
||||
import { Contract } from '../classes/contract.class';
|
||||
import { Contractor } from '../classes/contractor.class';
|
||||
import { PayoutAccount } from '../classes/payout-account.class';
|
||||
|
||||
@Injectable()
|
||||
export class ContractService {
|
||||
@ -30,4 +31,14 @@ export class ContractService {
|
||||
.toPromise()
|
||||
.then(response => response.json());
|
||||
}
|
||||
|
||||
public createPayoutAccount(contractID: number, payoutAccount: PayoutAccount): Promise<any> {
|
||||
const params = {
|
||||
currency: payoutAccount.currency,
|
||||
tool: payoutAccount.tool
|
||||
};
|
||||
return this.http.post(`${this.contractsUrl}/${contractID}/accounts`, params)
|
||||
.toPromise()
|
||||
.then(response => response.json());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
.x_panel.tile(*ngIf="showClaimInfo")
|
||||
.x_title
|
||||
h4 Активная заявка
|
||||
.x_content
|
||||
.row(*ngFor="let set of changeset")
|
||||
kof-shop-creation(*ngIf="set.modificationType == 'ShopCreation'", [changeset]="set")
|
||||
kof-shop-modification(*ngIf="set.modificationType == 'ShopModificationUnit' && set.details.modificationType !== 'ShopAccountCreated'", [changeset]="set")
|
||||
button.btn.btn-danger.pull-right(data-toggle="modal" data-target=".revoke-modal" data-backdrop="false") Отмена заявки
|
||||
|
||||
.modal.fade.revoke-modal(tabindex="-1" role="dialog")
|
||||
.modal-dialog.modal-sm
|
||||
.modal-content
|
||||
.modal-header
|
||||
h5.modal-title Подтверждение отмены заявки
|
||||
.modal-body Введите причину отмены
|
||||
textarea.form-control(required, [(ngModel)]="revokeReason", #reason="ngModel")
|
||||
.modal-footer
|
||||
.btn-toolbar.pull-left
|
||||
.btn-group.btn-group-sm
|
||||
button.btn.btn-default(type="button", data-dismiss="modal") Назад
|
||||
.btn-toolbar.pull-right
|
||||
.btn-group.btn-group-sm
|
||||
button.btn.btn-danger(*ngIf="reason.valid", type="button", data-dismiss="modal",(click)="revoke(reason)") Отменить заявку
|
@ -0,0 +1,49 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
import { Claim } from 'koffing/backend/backend.module';
|
||||
import { ClaimService } from 'koffing/backend/backend.module';
|
||||
|
||||
@Component({
|
||||
selector: 'kof-claims',
|
||||
templateUrl: 'claims.component.pug'
|
||||
})
|
||||
export class ClaimsComponent implements OnInit {
|
||||
|
||||
public claim: Claim;
|
||||
public changeset: any[];
|
||||
public showClaimInfo: boolean = false;
|
||||
public revokeReason: string;
|
||||
|
||||
private currentClaimStatus: string;
|
||||
|
||||
constructor(private claimService: ClaimService) { }
|
||||
|
||||
public revoke(reasonControl: any) {
|
||||
if (!reasonControl.valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
let revokeDetails = {
|
||||
reason: this.revokeReason
|
||||
};
|
||||
|
||||
this.claimService.revokeClaim(this.claim.id, revokeDetails).then(() => {
|
||||
this.showClaimInfo = false;
|
||||
});
|
||||
}
|
||||
|
||||
public ngOnInit() {
|
||||
this.currentClaimStatus = 'pending';
|
||||
|
||||
this.getClaim();
|
||||
}
|
||||
|
||||
private getClaim() {
|
||||
this.claimService.getClaim({status: this.currentClaimStatus}).then((aClaim: Claim) => {
|
||||
this.claim = aClaim;
|
||||
this.changeset = aClaim.changeset;
|
||||
this.showClaimInfo = true;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
dl(*ngIf="value")
|
||||
dt {{displayName}}
|
||||
dd {{value}}
|
@ -0,0 +1,14 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'kof-modification-detail',
|
||||
templateUrl: 'modification-detail.component.pug'
|
||||
})
|
||||
export class ModificationDetailComponent {
|
||||
|
||||
@Input()
|
||||
public displayName: string;
|
||||
|
||||
@Input()
|
||||
public value: string;
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
.panel.panel-default
|
||||
.panel-heading((click)="show()")
|
||||
a Создание магазина: {{shop.shopDetails.name}}
|
||||
i.fa.pull-right.custom-chevron([ngClass]="{'fa-chevron-down': showPanel, 'fa-chevron-right': !showPanel}")
|
||||
.panel-body(*ngIf="showPanel")
|
||||
div(*ngIf="shop.shopDetails")
|
||||
kof-modification-detail([displayName]="'Название магазина'", [value]="shop.shopDetails.name")
|
||||
kof-modification-detail([displayName]="'Описание'", [value]="shop.shopDetails.description")
|
||||
kof-modification-detail([displayName]="'Месторасположение'", [value]="shop.shopDetails.location")
|
||||
div(*ngIf="shop.contractor")
|
||||
kof-modification-detail([displayName]="'Наименование организации'", [value]="shop.contractor.registeredName")
|
||||
kof-modification-detail([displayName]="'Тип юридического лица'", [value]="shop.contractor.legalEntity")
|
@ -0,0 +1,25 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
|
||||
import { ShopCreation } from 'koffing/backend/backend.module';
|
||||
|
||||
@Component({
|
||||
selector: 'kof-shop-creation',
|
||||
templateUrl: 'shop-creation.component.pug'
|
||||
})
|
||||
export class ShopCreationComponent implements OnInit {
|
||||
|
||||
@Input()
|
||||
public changeset: ShopCreation;
|
||||
|
||||
public showPanel: boolean = false;
|
||||
|
||||
public shop: any;
|
||||
|
||||
public ngOnInit() {
|
||||
this.shop = this.changeset.shop;
|
||||
}
|
||||
|
||||
public show() {
|
||||
this.showPanel = !this.showPanel;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
.panel.panel-default
|
||||
.panel-heading((click)="show()")
|
||||
a Изменение магазина
|
||||
i.fa.pull-right.custom-chevron([ngClass]="{'fa-chevron-down': showPanel, 'fa-chevron-right': !showPanel}")
|
||||
.panel-body(*ngIf="showPanel")
|
||||
div(*ngIf="details.shopDetails")
|
||||
kof-modification-detail([displayName]="'Название магазина'", [value]="details.shopDetails.name")
|
||||
kof-modification-detail([displayName]="'Описание'", [value]="details.shopDetails.description")
|
||||
kof-modification-detail([displayName]="'Месторасположение'", [value]="details.shopDetails.location")
|
||||
div(*ngIf="details.contractor")
|
||||
kof-modification-detail([displayName]="'Наименование организации'", [value]="details.contractor.registeredName")
|
||||
kof-modification-detail([displayName]="'Тип юридического лица'", [value]="details.contractor.legalEntity")
|
@ -0,0 +1,28 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
|
||||
import { ShopModification } from 'koffing/backend/backend.module';
|
||||
|
||||
@Component({
|
||||
selector: 'kof-shop-modification',
|
||||
templateUrl: 'shop-modification.component.pug'
|
||||
})
|
||||
export class ShopModificationComponent implements OnInit {
|
||||
|
||||
@Input()
|
||||
public changeset: ShopModification;
|
||||
|
||||
public showPanel: boolean = false;
|
||||
|
||||
public isModification: boolean = false;
|
||||
|
||||
public details: any;
|
||||
|
||||
public ngOnInit() {
|
||||
this.details = this.changeset.details.details;
|
||||
this.isModification = this.changeset.details.modificationType === 'ShopModification';
|
||||
}
|
||||
|
||||
public show() {
|
||||
this.showPanel = !this.showPanel;
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
div contracts
|
@ -0,0 +1,11 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
templateUrl: 'contracts.component.pug'
|
||||
})
|
||||
export class ContractsComponent implements OnInit {
|
||||
|
||||
public ngOnInit() {
|
||||
console.log('ContractsComponent');
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
kof-claims
|
||||
.x_panel.tile
|
||||
.x_content
|
||||
ul.nav.nav-tabs.bar_tabs
|
||||
li.hand-cursor([routerLink]="['shops']", [routerLinkActive]="['active']")
|
||||
a Магазины
|
||||
li.hand-cursor([routerLink]="['contracts']", [routerLinkActive]="['active']")
|
||||
a Контракты
|
||||
.tab-content
|
||||
router-outlet
|
@ -0,0 +1,6 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
templateUrl: 'management.component.pug'
|
||||
})
|
||||
export class ManagementComponent {}
|
@ -0,0 +1,29 @@
|
||||
.x_title
|
||||
h4 Магазины
|
||||
.x_content
|
||||
kof-loading([isLoading]="isLoading")
|
||||
table(*ngIf="shops.length").table.table-hover.table-striped
|
||||
thead
|
||||
tr
|
||||
th ID магазина
|
||||
th Название магазина
|
||||
th.hidden-xs Описание
|
||||
th.hidden-xs Месторасположение
|
||||
th Категория
|
||||
th
|
||||
tbody
|
||||
tr(*ngFor="let shop of shops",[ngClass]="{'success': shop.isSuspended, 'danger': shop.isBlocked}")
|
||||
td {{shop.shopID}}
|
||||
td {{shop.shopDetails.name}}
|
||||
td.hidden-xs {{shop.shopDetails.description}}
|
||||
td.hidden-xs {{shop.shopDetails.location}}
|
||||
td {{getCategory(shop.categoryRef).name}}
|
||||
td(*ngIf="shop.isSuspended && !shop.isBlocked")
|
||||
button.btn.btn-success.btn-xs.pull-right((click)="activateShop(shop)") Активировать
|
||||
td(*ngIf="!shop.isSuspended && !shop.isBlocked")
|
||||
a.btn.btn-default.btn-xs.pull-right([routerLink]="['edit', shop.shopID]") Изменить данные
|
||||
td(*ngIf="shop.isBlocked")
|
||||
span.pull-right Заблокирован
|
||||
span(*ngIf="!shops.length") Список магазинов пуст
|
||||
a.btn.btn-primary.pull-right([routerLink]="['/management/contracts']") Добавить новый магазин
|
||||
//a.btn.btn-primary.pull-right([routerLink]="['add']") Добавить новый магазин
|
@ -0,0 +1,71 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { Category } from 'koffing/backend/backend.module';
|
||||
import { CategoryService } from 'koffing/backend/backend.module';
|
||||
import { Shop } from 'koffing/backend/backend.module';
|
||||
import { ShopService } from 'koffing/backend/backend.module';
|
||||
|
||||
@Component({
|
||||
templateUrl: 'shops.component.pug'
|
||||
})
|
||||
export class ShopsComponent implements OnInit {
|
||||
|
||||
public shops: Shop[] = [];
|
||||
public categories: Category[] = [];
|
||||
|
||||
private isLoading: boolean;
|
||||
|
||||
constructor(
|
||||
private shopService: ShopService,
|
||||
private categoryService: CategoryService
|
||||
) {}
|
||||
|
||||
public activateShop(shop: any) {
|
||||
this.isLoading = true;
|
||||
|
||||
this.shopService.activateShop(shop.shopID).then(() => {
|
||||
this.loadShops().then(() => {
|
||||
this.isLoading = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public loadShops() {
|
||||
return new Promise((resolve) => {
|
||||
this.shopService.getShops().then(aShops => {
|
||||
this.shops = aShops;
|
||||
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public loadCategories() {
|
||||
return new Promise((resolve) => {
|
||||
this.categoryService.getCategories().then(aCategories => {
|
||||
this.categories = aCategories;
|
||||
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public getCategory(categoryRef: number): Category {
|
||||
let result = new Category();
|
||||
if (this.categories.length > 0) {
|
||||
result = _.find(this.categories, (category: Category) => category.categoryRef === categoryRef);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public ngOnInit() {
|
||||
this.isLoading = true;
|
||||
Promise.all([
|
||||
this.loadShops(),
|
||||
this.loadCategories()
|
||||
]).then(() => {
|
||||
this.isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
36
src/app/management/management-routing.module.ts
Normal file
36
src/app/management/management-routing.module.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { ManagementComponent } from './components/management-container/management.component';
|
||||
import { ShopsComponent } from './components/management-container/shops/shops.component';
|
||||
import { ContractsComponent } from './components/management-container/contracts/contracts.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{
|
||||
path: 'management',
|
||||
component: ManagementComponent,
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
redirectTo: '/management/shops',
|
||||
pathMatch: 'full'
|
||||
},
|
||||
{
|
||||
path: 'shops',
|
||||
component: ShopsComponent
|
||||
},
|
||||
{
|
||||
path: 'contracts',
|
||||
component: ContractsComponent
|
||||
}
|
||||
]
|
||||
}
|
||||
])
|
||||
],
|
||||
exports: [
|
||||
RouterModule
|
||||
]
|
||||
})
|
||||
export class ManagementRoutingModule {}
|
34
src/app/management/management.module.ts
Normal file
34
src/app/management/management.module.ts
Normal file
@ -0,0 +1,34 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { ManagementRoutingModule } from './management-routing.module';
|
||||
import { CommonModule } from 'koffing/common/common.module';
|
||||
import { BackendModule } from 'koffing/backend/backend.module';
|
||||
import { ManagementComponent } from './components/management-container/management.component';
|
||||
import { ClaimsComponent } from './components/management-container/claims/claims.component';
|
||||
import { ModificationDetailComponent } from './components/management-container/claims/modification-detail/modification-detail.component';
|
||||
import { ShopModificationComponent } from './components/management-container/claims/shop-modification/shop-modification.component';
|
||||
import { ShopCreationComponent } from './components/management-container/claims/shop-creation/shop-creation.component';
|
||||
import { ShopsComponent } from './components/management-container/shops/shops.component';
|
||||
import { ContractsComponent } from './components/management-container/contracts/contracts.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
ManagementRoutingModule,
|
||||
BrowserModule,
|
||||
FormsModule,
|
||||
CommonModule,
|
||||
BackendModule
|
||||
],
|
||||
declarations: [
|
||||
ManagementComponent,
|
||||
ClaimsComponent,
|
||||
ShopCreationComponent,
|
||||
ShopModificationComponent,
|
||||
ModificationDetailComponent,
|
||||
ShopsComponent,
|
||||
ContractsComponent
|
||||
]
|
||||
})
|
||||
export class ManagementModule {}
|
@ -15,6 +15,10 @@
|
||||
a(routerLink="/shops")
|
||||
i.fa.fa-shopping-cart
|
||||
| Мои магазины
|
||||
li([routerLinkActive]="['active']")
|
||||
a(routerLink="/management")
|
||||
i.fa.fa-user
|
||||
| Мои<br />данные
|
||||
li([routerLinkActive]="['active']")
|
||||
a(routerLink="/tokenization")
|
||||
i.fa.fa-key
|
||||
|
@ -2,25 +2,27 @@ import { NgModule } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { GrowlModule } from 'primeng/primeng';
|
||||
|
||||
import { SidebarComponent } from './components/sidebar/sidebar.component';
|
||||
import { TopPanelComponent } from './components/top-panel/top-panel.component';
|
||||
import { RootRoutingModule } from './root-routing.module';
|
||||
import { ContainerComponent } from './components/container/container.component';
|
||||
import { BroadcasterModule } from '../broadcaster/broadcaster.module';
|
||||
import { TokenizationModule } from '../tokenization/tokenization.module';
|
||||
import { AnalyticsModule } from '../analytics/analytics.module';
|
||||
import { ShopsModule } from '../shops/shops.module';
|
||||
import { BroadcasterModule } from '../broadcaster/broadcaster.module';
|
||||
import { ManagementModule } from '../management/management.module';
|
||||
import { SidebarComponent } from './components/sidebar/sidebar.component';
|
||||
import { TopPanelComponent } from './components/top-panel/top-panel.component';
|
||||
import { ContainerComponent } from './components/container/container.component';
|
||||
import { HttpErrorHandleComponent } from './components/http-error-handle/http-error-handle.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
BrowserModule,
|
||||
GrowlModule,
|
||||
RootRoutingModule,
|
||||
BroadcasterModule,
|
||||
TokenizationModule,
|
||||
AnalyticsModule,
|
||||
ShopsModule,
|
||||
TokenizationModule,
|
||||
BrowserModule,
|
||||
BroadcasterModule,
|
||||
GrowlModule
|
||||
ManagementModule
|
||||
],
|
||||
declarations: [
|
||||
ContainerComponent,
|
||||
|
@ -6,6 +6,7 @@ import { CategoryService } from 'koffing/backend/backend.module';
|
||||
import { ShopService } from 'koffing/backend/backend.module';
|
||||
import { SelectItem } from 'koffing/common/common.module';
|
||||
import { ShopArgs } from 'koffing/shops/shops.module';
|
||||
import { Shop } from 'koffing/backend/classes/shop.class';
|
||||
|
||||
@Component({
|
||||
selector: 'kof-edit-shop',
|
||||
@ -14,7 +15,7 @@ import { ShopArgs } from 'koffing/shops/shops.module';
|
||||
export class EditShopComponent implements OnInit {
|
||||
|
||||
public categories: SelectItem[] = [];
|
||||
public currentShopId: string;
|
||||
public currentShopId: number = Number(this.route.snapshot.params['shopID']);
|
||||
public args: ShopArgs = {
|
||||
shopDetails: {},
|
||||
contractor: {},
|
||||
@ -31,10 +32,10 @@ export class EditShopComponent implements OnInit {
|
||||
public loadShops() {
|
||||
return new Promise((resolve) => {
|
||||
this.shopService.getShops().then((shops: any) => {
|
||||
const found: any = _.find(shops, (shop: any) => shop.shopID === this.currentShopId);
|
||||
this.args.shopDetails = found.shopDetails ? found.shopDetails : {};
|
||||
this.args.contractor = found.contractor ? found.contractor : {};
|
||||
this.args.categoryRef = found.categoryRef;
|
||||
const currentShop: Shop = _.find(shops, (shop: any) => shop.shopID === this.currentShopId);
|
||||
this.args.shopDetails = currentShop.shopDetails ? currentShop.shopDetails : {};
|
||||
// this.args.contractor = currentShop.contractor ? currentShop.contractor : {};
|
||||
this.args.categoryRef = currentShop.categoryRef;
|
||||
|
||||
resolve();
|
||||
});
|
||||
@ -72,8 +73,6 @@ export class EditShopComponent implements OnInit {
|
||||
}
|
||||
|
||||
public ngOnInit() {
|
||||
this.currentShopId = this.route.snapshot.params['shopID'];
|
||||
|
||||
this.isLoading = true;
|
||||
Promise.all([
|
||||
this.loadShops(),
|
||||
|
@ -27,4 +27,4 @@ kof-claims
|
||||
td(*ngIf="shop.isBlocked")
|
||||
span.pull-right Заблокирован
|
||||
span(*ngIf="!shops.length") Список магазинов пуст
|
||||
a.btn.btn-primary.pull-right(routerLink="/shops/add") Добавить новый магазин
|
||||
a.btn.btn-primary.pull-right([routerLink]="['add']") Добавить новый магазин
|
Loading…
Reference in New Issue
Block a user