mirror of
https://github.com/akveo/ngx-admin.git
synced 2026-01-08 18:48:50 +01:00
add detail promotion
This commit is contained in:
parent
65221ecbea
commit
7c825ed491
10 changed files with 380 additions and 28 deletions
|
|
@ -1,7 +1,85 @@
|
|||
<form class="form">
|
||||
<label for="subject">Subject:</label>
|
||||
<input nbInput id="subject" type="text">
|
||||
|
||||
<label class="text-label" for="text">Text:</label>
|
||||
<textarea nbInput id="text"></textarea>
|
||||
</form>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1" class="label">Partner Code</label>
|
||||
<input nbInput fullWidth id="exampleInputEmail1" value="{{data.customerID}}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">User Id</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" value="{{data.customerID}}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1" class="label">Promo Type</label>
|
||||
<input nbInput fullWidth id="exampleInputEmail1" value="{{data.promotionType}}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Periode </label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" value="{{data.validDay}}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1" class="label">Coupon Code</label>
|
||||
<input nbInput fullWidth id="exampleInputEmail1" value="{{data.code}}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Valid Start</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" value="{{data.validFrom}}">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Valid End</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" value="{{data.validTo}}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Promo</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" value="{{data.value}}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1" class="label">Max. Promo</label>
|
||||
<input nbInput fullWidth id="exampleInputEmail1" value="{{data.maximumDiscount}}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1" class="label">Quota per User</label>
|
||||
<input nbInput fullWidth id="exampleInputEmail1" value="{{data.maximumPerUser}}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">User Type</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" value="{{data.customerType}}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Coverage Pickup</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" value="{{data.coverage}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Product</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" value="{{data.product}}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Promo (IDR)</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" value="{{data.value}}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Promo (%)</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" value="{{data.value}}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Max. Promo</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" value="{{data.maximumDiscountValue}}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Budget</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" value="{{data.maximumDiscount}}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Quota</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" value="{{data.quota}}">
|
||||
</div>
|
||||
<button type="submit" nbButton status="primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,12 +1,15 @@
|
|||
@import '../../../@theme/styles/themes';
|
||||
|
||||
@include nb-install-component() {
|
||||
::ng-deep .form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.text-label {
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { NbWindowRef } from '@nebular/theme';
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { NbWindowRef, NB_WINDOW_CONTEXT } from '@nebular/theme';
|
||||
import { PromotionList } from '../../../@core/data/promotion';
|
||||
|
||||
@Component({
|
||||
selector: 'ngx-promotion-detail',
|
||||
|
|
@ -7,7 +8,14 @@ import { NbWindowRef } from '@nebular/theme';
|
|||
styleUrls: ['promotion-detail.component.scss'],
|
||||
})
|
||||
export class PromotionDetailComponent {
|
||||
constructor(public windowRef: NbWindowRef) {}
|
||||
|
||||
data: PromotionList;
|
||||
|
||||
constructor(public windowRef: NbWindowRef, @Inject(NB_WINDOW_CONTEXT) context) {
|
||||
if(context != null){
|
||||
this.data = Object.assign({}, context.data);
|
||||
}
|
||||
}
|
||||
|
||||
close() {
|
||||
this.windowRef.close();
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<nb-card-body>
|
||||
<ng2-smart-table [settings]="settings" [source]="source" (deleteConfirm)="onDeleteConfirm($event)"
|
||||
(userRowSelect)="openWindowForm()">
|
||||
(userRowSelect)="openWindowForm($event)" (createConfirm)="onCreateConfirm($event)">
|
||||
</ng2-smart-table>
|
||||
</nb-card-body>
|
||||
</nb-card>
|
||||
|
|
@ -11,10 +11,12 @@ import { NbWindowService } from '@nebular/theme';
|
|||
})
|
||||
export class PromotionComponent implements OnInit {
|
||||
settings = {
|
||||
mode: 'inline',
|
||||
add: {
|
||||
addButtonContent: '<i class="nb-plus"></i>',
|
||||
createButtonContent: '<i class="nb-checkmark"></i>',
|
||||
cancelButtonContent: '<i class="nb-close"></i>',
|
||||
createConfirm: true,
|
||||
},
|
||||
edit: {
|
||||
editButtonContent: '<i class="nb-edit"></i>',
|
||||
|
|
@ -36,11 +38,11 @@ export class PromotionComponent implements OnInit {
|
|||
},
|
||||
validFrom: {
|
||||
title: 'Valid Start',
|
||||
type: 'date',
|
||||
type: 'string',
|
||||
},
|
||||
validTo: {
|
||||
title: 'Valid End',
|
||||
type: 'date',
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
@ -57,6 +59,15 @@ export class PromotionComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
|
||||
onCreateConfirm(event): void {
|
||||
if (window.confirm('Are you sure you want to save?')) {
|
||||
event.confirm.resolve();
|
||||
console.log('hooray ' + event.newData.code);
|
||||
} else {
|
||||
event.confirm.reject();
|
||||
}
|
||||
}
|
||||
|
||||
onDeleteConfirm(event): void {
|
||||
if (window.confirm('Are you sure you want to delete?')) {
|
||||
event.confirm.resolve();
|
||||
|
|
@ -65,7 +76,12 @@ export class PromotionComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
openWindowForm() {
|
||||
this.windowService.open(PromotionDetailComponent, { title: `Promotion Detail` });
|
||||
openWindowForm(event) {
|
||||
this.windowService.open(PromotionDetailComponent, {
|
||||
title: 'Promotion Detail',
|
||||
context: {
|
||||
data: event.data,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { NbCardModule, NbIconModule, NbInputModule, NbTreeGridModule } from '@nebular/theme';
|
||||
import { NbCardModule, NbIconModule, NbInputModule, NbTreeGridModule, NbButtonModule, NbCheckboxModule, NbRadioModule } from '@nebular/theme';
|
||||
import { Ng2SmartTableModule } from 'ng2-smart-table';
|
||||
|
||||
import { ThemeModule } from '../../@theme/theme.module';
|
||||
|
|
@ -14,6 +14,9 @@ import { PromotionDetailComponent } from './promotion-detail/promotion-detail.co
|
|||
NbIconModule,
|
||||
NbInputModule,
|
||||
ThemeModule,
|
||||
NbButtonModule,
|
||||
NbRadioModule,
|
||||
NbCheckboxModule,
|
||||
Ng2SmartTableModule,
|
||||
],
|
||||
declarations: [
|
||||
|
|
@ -22,6 +25,7 @@ import { PromotionDetailComponent } from './promotion-detail/promotion-detail.co
|
|||
],
|
||||
providers: [
|
||||
PromotionService,
|
||||
PromotionDetailComponent,
|
||||
],
|
||||
entryComponents: [
|
||||
PromotionDetailComponent,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export class PromotionService {
|
|||
}
|
||||
|
||||
getPromotion(): Observable<any> {
|
||||
const url = 'http://localhost:8011/api/promotions/all';
|
||||
const url = 'http://34.87.6.140:8011/api/promotions/all';
|
||||
return this.http.get(url).pipe(
|
||||
map(this.extractData),
|
||||
catchError(this.handleError),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue