add partner price new

This commit is contained in:
Zuhdan Ubay 2020-05-22 13:09:28 +07:00
parent 16280a1d04
commit cdf458488a
8 changed files with 83 additions and 3 deletions

View file

@ -0,0 +1 @@
export interface PartnerPriceNew { lovCode: string, lovName: string }

View file

@ -0,0 +1,13 @@
<div class="form-group row">
<label for="inputEmail1" class="label col-sm-3 col-form-label">Partner</label>
<nb-select *ngIf="items">
<ng-container *ngFor="let item of items">
<nb-option>{{ item }}</nb-option>
</ng-container>
</nb-select>
</div>
<div class="form-group row">
<div class="offset-sm-3 col-sm-9">
<button type="submit" nbButton status="primary">Submit</button>
</div>
</div>

View file

@ -0,0 +1,16 @@
nb-checkbox {
margin-bottom: 1rem;
}
.form-inline [fullWidth] {
flex: 1;
}
.form-inline > * {
margin: 0 1.5rem 1.5rem 0;
}
nb-card.inline-form-card nb-card-body {
padding-bottom: 0;
}

View file

@ -0,0 +1,28 @@
import { Component, OnInit } from '@angular/core';
import { PartnerPriceService } from '../partner-price.service';
import { PartnerPriceNew } from '../../../@core/data/partner-price-new';
import { NbWindowRef } from '@nebular/theme';
@Component({
selector: 'ngx-partner-price-new',
styleUrls: ['./partner-price-new.component.scss'],
templateUrl: './partner-price-new.component.html',
})
export class PartnerPriceNewComponent implements OnInit {
items: PartnerPriceNew[] = []
constructor(private service: PartnerPriceService, public windowRef: NbWindowRef ) {
}
ngOnInit(): void {
this.getData();
}
getData() {
this.service.getNewPrtnerPriceParam().subscribe((result) => {
this.items = Object.assign([], result);
});
}
}

View file

@ -3,6 +3,7 @@ import { PartnerPriceService } from './partner-price.service';
import { PartnerPriceDetailComponent } from './partner-price-detail/partner-price-detail.component';
import { NbWindowService } from '@nebular/theme';
import { PartnerPrice } from '../../@core/data/partner-price';
import { PartnerPriceNewComponent } from './partner-price-new/partner-price-new.component';
@Component({
selector: 'ngx-partner-price',
@ -97,8 +98,9 @@ export class PartnerPriceComponent implements OnInit {
}
openCreateDialog(event) {
//logic
this.windowService.open(PartnerPriceNewComponent, {
title: 'Add Partner Price',
});
}
openWindowForm(event) {

View file

@ -6,7 +6,8 @@ import {
NbTreeGridModule,
NbButtonModule,
NbCheckboxModule,
NbRadioModule} from '@nebular/theme';
NbRadioModule,
NbSelectModule} from '@nebular/theme';
import { Ng2SmartTableModule } from 'ng2-smart-table';
import { ThemeModule } from '../../@theme/theme.module';
@ -14,6 +15,7 @@ import { PartnerPriceComponent } from './partner-price.component';
import { PartnerPriceService } from './partner-price.service';
import { PartnerPriceDetailComponent } from './partner-price-detail/partner-price-detail.component';
import { FormsModule } from '@angular/forms';
import { PartnerPriceNewComponent } from './partner-price-new/partner-price-new.component';
@NgModule({
imports: [
@ -27,17 +29,21 @@ import { FormsModule } from '@angular/forms';
NbCheckboxModule,
Ng2SmartTableModule,
FormsModule,
NbSelectModule,
],
declarations: [
PartnerPriceComponent,
PartnerPriceDetailComponent,
PartnerPriceNewComponent,
],
providers: [
PartnerPriceService,
PartnerPriceDetailComponent,
PartnerPriceNewComponent,
],
entryComponents: [
PartnerPriceDetailComponent,
PartnerPriceNewComponent,
],
})
export class PromotionModule { }

View file

@ -6,6 +6,7 @@ import { HttpErrorResponse } from '@angular/common/http';
import { PromotionList } from '../../@core/data/promotion';
import { PartnerPrice } from '../../@core/data/partner-price';
import { PartnerPriceDetail } from '../../@core/data/partner-price-detail';
import { PartnerPriceNew } from '../../@core/data/partner-price-new';
@Injectable({
providedIn: 'root',
@ -30,6 +31,14 @@ export class PartnerPriceService {
);
}
getNewPrtnerPriceParam(): Observable<any>{
const url = 'http://34.87.6.140:8011/api/lov/getCustomerInput';
return this.http.post(url, null).pipe(
map(this.extractData),
catchError(this.handleError),
);
}
// postPromotion(data: PromotionList): Observable<any> {
// const headers = new HttpHeaders({
// 'Content-Type': 'application/json',
@ -50,6 +59,11 @@ export class PartnerPriceService {
return Object.assign(body.content);
}
private extractDataParamNew(body: any): PartnerPriceNew[] {
return Object.assign(body.content);
}
private handleError(error: HttpErrorResponse | any) {
let errMsg: string;
let errObj: any;