mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-16 15:40:11 +01:00
Merge branch 'master' of https://github.com/Zuhdan/ngx-admin
This commit is contained in:
commit
ddd17c56e6
18 changed files with 864 additions and 0 deletions
85
src/app/@core/data/billing.ts
Normal file
85
src/app/@core/data/billing.ts
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
export interface BillingList {
|
||||
ebCustomerId: number;
|
||||
customerCode: string;
|
||||
customerCodeParent: string;
|
||||
customerFullname: string;
|
||||
customerShortname: string;
|
||||
customerCoprName: string;
|
||||
customerCoprAdd: string;
|
||||
customerBusiness: string;
|
||||
reconciliationName: string;
|
||||
reconciliationHp: string;
|
||||
reconciliationTel: string;
|
||||
reconciliationEmail: string;
|
||||
reconciliationAdd: string;
|
||||
startTime: string;
|
||||
endTime: string;
|
||||
billTitle: number;
|
||||
lastBillTm: string;
|
||||
nextBillTm: string;
|
||||
billCode: string;
|
||||
payCycle?: number;
|
||||
modifyTm: string;
|
||||
isActive: number;
|
||||
tax: number;
|
||||
vat: number;
|
||||
tipe: number;
|
||||
price: number;
|
||||
percentage: number;
|
||||
state: string;
|
||||
startTimeString: string;
|
||||
endTimeString: string;
|
||||
nextBillTimeString: string;
|
||||
saNo: string;
|
||||
requestType: string;
|
||||
partnerBillCode: string;
|
||||
itemType: string;
|
||||
itemTypeOthers: string;
|
||||
compName: number;
|
||||
compIdNumber: string;
|
||||
compIndustry: string;
|
||||
compAddress: string;
|
||||
compPhone: string;
|
||||
compNoHp: string;
|
||||
personalName: string;
|
||||
personalJobTitle: string;
|
||||
personalSiupNo: string;
|
||||
personalNpwp: string;
|
||||
personalEmail: string;
|
||||
personalFaxNo: string;
|
||||
personalAddress: string;
|
||||
csName: string;
|
||||
csAddress: string;
|
||||
csContactName: string;
|
||||
csHp: string;
|
||||
csEmail: string;
|
||||
financeName: string;
|
||||
financeAddress: string;
|
||||
financeContactName: string;
|
||||
financeHp: string;
|
||||
financeEmail: string;
|
||||
serviceProfile: string;
|
||||
pickupAddress: string;
|
||||
paymentSurcharge: string;
|
||||
paymentBillingCycle: string;
|
||||
paymentTermOfPayment: string;
|
||||
docCompany: string;
|
||||
docPersonel: string;
|
||||
signSalesName: string;
|
||||
signSalesDate: string;
|
||||
signVpSalesName: string;
|
||||
signVpSalesDate: string;
|
||||
signFinanceName: string;
|
||||
signFinanceDate: string;
|
||||
signVpFinanceName: string;
|
||||
signVpFinanceDate: string;
|
||||
partnerSignDate: string;
|
||||
status: string;
|
||||
ecmUrl: string;
|
||||
|
||||
}
|
||||
|
||||
export interface RootObject {
|
||||
billingList: BillingList[];
|
||||
}
|
||||
|
||||
83
src/app/@core/data/service-agreement.ts
Normal file
83
src/app/@core/data/service-agreement.ts
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
export interface ServiceAgreementList {
|
||||
ebCustomerId: number;
|
||||
customerCode: string;
|
||||
customerCodeParent: string;
|
||||
customerFullname: string;
|
||||
customerShortname: string;
|
||||
customerCoprName: string;
|
||||
customerCoprAdd: string;
|
||||
customerBusiness: string;
|
||||
reconciliationName: string;
|
||||
reconciliationHp: string;
|
||||
reconciliationTel: string;
|
||||
reconciliationEmail: string;
|
||||
reconciliationAdd: string;
|
||||
startTime: string;
|
||||
endTime: string;
|
||||
lastBillTm: string;
|
||||
nextBillTm: string;
|
||||
billCode: string;
|
||||
payCycle: number;
|
||||
modifyTm: string;
|
||||
isActive: number;
|
||||
tax: number;
|
||||
tipe: number;
|
||||
price?: number;
|
||||
percentage: number;
|
||||
state: string;
|
||||
startTimeString: string;
|
||||
endTimeString: string;
|
||||
nextBillTimeString: string;
|
||||
saNo: string;
|
||||
requestType: string;
|
||||
partnerBillCode: string;
|
||||
itemType: string;
|
||||
itemTypeOthers: string;
|
||||
compName: number;
|
||||
compIdNumber: string;
|
||||
compIndustry: string;
|
||||
compAddress: string;
|
||||
compPhone: string;
|
||||
compNoHp: string;
|
||||
personalName: string;
|
||||
personalJobTitle: string;
|
||||
personalSiupNo: string;
|
||||
personalNpwp: string;
|
||||
personalEmail: string;
|
||||
personalFaxNo: string;
|
||||
personalAddress: string;
|
||||
csName: string;
|
||||
csAddress: string;
|
||||
csContactName: string;
|
||||
csHp: string;
|
||||
csEmail: string;
|
||||
financeName: string;
|
||||
financeAddress: string;
|
||||
financeContactName: string;
|
||||
financeHp: string;
|
||||
financeEmail: string;
|
||||
serviceProfile: string;
|
||||
pickupAddress: string;
|
||||
paymentSurcharge: string;
|
||||
paymentBillingCycle: string;
|
||||
paymentTermOfPayment: string;
|
||||
docCompany: string;
|
||||
docPersonel: string;
|
||||
signSalesName: string;
|
||||
signSalesDate: string;
|
||||
signVpSalesName: string;
|
||||
signVpSalesDate: string;
|
||||
signFinanceName: string;
|
||||
signFinanceDate: string;
|
||||
signVpFinanceName: string;
|
||||
signVpFinanceDate: string;
|
||||
partnerSignDate: string;
|
||||
status: string;
|
||||
ecmUrl: string;
|
||||
|
||||
}
|
||||
|
||||
export interface RootObject {
|
||||
serviceAgreementList: ServiceAgreementList[];
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label class="label">Client</label>
|
||||
<input nbInput fullWidth [(ngModel)]="data.customerCode" disabled>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="label">Partner Code</label>
|
||||
<input nbInput fullWidth [(ngModel)]="data.customerCode" disabled>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="label">Partner Name</label>
|
||||
<input nbInput fullWidth [(ngModel)]="data.customerFullname">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="label">Partner Short Name </label>
|
||||
<input nbInput fullWidth [(ngModel)]="data.customerShortname">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="label">Start Time</label>
|
||||
<input nbInput
|
||||
placeholder="Select Date"
|
||||
[nbDatepicker]="formpickerstart"
|
||||
[(ngModel)]="data.startTime">
|
||||
<nb-datepicker #formpickerstart></nb-datepicker>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="label">End Time</label>
|
||||
<input nbInput
|
||||
placeholder="Select Date"
|
||||
[nbDatepicker]="formpickerend"
|
||||
[(ngModel)]="data.endTime">
|
||||
<nb-datepicker #formpickerend></nb-datepicker>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label class="label">Bill Title</label>
|
||||
<nb-card-body>
|
||||
<nb-select [(selected)]="data.billTitle">
|
||||
<nb-option value="1">Invoice</nb-option>
|
||||
<nb-option value="2">Debit Note</nb-option>
|
||||
<nb-option value="3">Surat Perintah Penagihan</nb-option>
|
||||
</nb-select>
|
||||
</nb-card-body>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="label">Bill Code</label>
|
||||
<input nbInput fullWidth [(ngModel)]="data.billCode">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="label">Next Billing Time</label>
|
||||
<input nbInput
|
||||
placeholder="Select Date"
|
||||
[nbDatepicker]="formpickernextbilling"
|
||||
[(ngModel)]="data.nextBillTm">
|
||||
<nb-datepicker #formpickernextbilling></nb-datepicker>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="label">Tax</label>
|
||||
<nb-radio-group [(value)]="data.tax">
|
||||
<nb-radio
|
||||
[value]="1">
|
||||
Exclude
|
||||
</nb-radio>
|
||||
<nb-radio
|
||||
[value]="2">
|
||||
Include
|
||||
</nb-radio>
|
||||
</nb-radio-group>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="label">VAT</label>
|
||||
<input nbInput [(ngModel)]="data.vat"> %
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="label">Insurance</label>
|
||||
Rp.<input nbInput [(ngModel)]="data.price">
|
||||
<input nbInput fullWidth [(ngModel)]="data.percentage">%
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-md-4">
|
||||
<button (click)="onSubmit()" type="submit" nbButton status="primary">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
@import '../../../@theme/styles/themes';
|
||||
|
||||
@include nb-install-component() {
|
||||
::ng-deep .form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.text-label {
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
import { Component, Inject, Input } from '@angular/core';
|
||||
import { NbWindowRef, NB_WINDOW_CONTEXT } from '@nebular/theme';
|
||||
import { BillingList } from '../../../@core/data/billing';
|
||||
import { BillingService } from '../billing.service';
|
||||
|
||||
@Component({
|
||||
selector: 'ngx-billing-detail',
|
||||
templateUrl: './billing-detail.component.html',
|
||||
styleUrls: ['billing-detail.component.scss'],
|
||||
})
|
||||
export class BillingDetailComponent {
|
||||
|
||||
@Input() data: BillingList;
|
||||
constructor(private service: BillingService, public windowRef: NbWindowRef, @Inject(NB_WINDOW_CONTEXT) context) {
|
||||
if (context != null) {
|
||||
this.data = Object.assign({}, context.data);
|
||||
}
|
||||
}
|
||||
|
||||
onSubmit(){
|
||||
console.log('isi json',this.data.billTitle)
|
||||
let temp = this.data.billTitle
|
||||
this.data.state = 'updated'
|
||||
this.data.billTitle = Math.floor(temp)
|
||||
console.log('after', this.data)
|
||||
this.service.postBilling(this.data).subscribe((value) => {
|
||||
this.close();
|
||||
});
|
||||
}
|
||||
|
||||
close() {
|
||||
this.windowRef.close();
|
||||
}
|
||||
|
||||
numberOnly(event): boolean {
|
||||
const charCode = (event.which) ? event.which : event.keyCode;
|
||||
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
12
src/app/pages/billing/billing.component.html
Normal file
12
src/app/pages/billing/billing.component.html
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<nb-card>
|
||||
<nb-card-header>
|
||||
Billing - 90%
|
||||
</nb-card-header>
|
||||
|
||||
<nb-card-body>
|
||||
<ng2-smart-table [settings]="settings" [source]="source" (deleteConfirm)="onDeleteConfirm($event)"
|
||||
(createConfirm)="onCreateConfirm($event)" (editConfirm)="onCreateConfirm($event)"
|
||||
(userRowSelect)="openWindowForm($event)">
|
||||
</ng2-smart-table>
|
||||
</nb-card-body>
|
||||
</nb-card>
|
||||
7
src/app/pages/billing/billing.component.scss
Normal file
7
src/app/pages/billing/billing.component.scss
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
@import '../../@theme/styles/themes';
|
||||
|
||||
@include nb-install-component() {
|
||||
nb-card {
|
||||
transform: translate3d(0, 0, 0);
|
||||
}
|
||||
}
|
||||
95
src/app/pages/billing/billing.component.ts
Normal file
95
src/app/pages/billing/billing.component.ts
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { BillingList } from '../../@core/data/billing';
|
||||
import { BillingService } from './billing.service';
|
||||
import { BillingDetailComponent } from './billing-detail/billing-detail.component';
|
||||
import { NbWindowService } from '@nebular/theme';
|
||||
|
||||
@Component({
|
||||
selector: 'ngx-billing',
|
||||
templateUrl: './billing.component.html',
|
||||
styleUrls: ['./billing.component.scss'],
|
||||
})
|
||||
export class BillingComponent implements OnInit {
|
||||
|
||||
settings = {
|
||||
mode: 'inline',
|
||||
add: {
|
||||
addButtonContent: '<i class="nb-plus"></i>',
|
||||
createButtonContent: '<i class="nb-checkmark"></i>',
|
||||
cancelButtonContent: '<i class="nb-close"></i>',
|
||||
},
|
||||
edit: {
|
||||
editButtonContent: '<i class="nb-edit"></i>',
|
||||
saveButtonContent: '<i class="nb-checkmark"></i>',
|
||||
cancelButtonContent: '<i class="nb-close"></i>',
|
||||
},
|
||||
delete: {
|
||||
deleteButtonContent: '<i class="nb-trash"></i>',
|
||||
confirmDelete: true,
|
||||
},
|
||||
columns: {
|
||||
customerCode: {
|
||||
title: 'Partner Code',
|
||||
type: 'string',
|
||||
},
|
||||
customerFullname: {
|
||||
title: 'Partner Name',
|
||||
type: 'string',
|
||||
},
|
||||
nextBillTimeString: {
|
||||
title: 'Next Billing',
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
source: BillingList[] = [];
|
||||
|
||||
constructor(private service: BillingService, private windowService: NbWindowService) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.initData();
|
||||
}
|
||||
initData(){
|
||||
this.service.getBilling().subscribe((result) => {
|
||||
this.source = Object.assign([], result);
|
||||
console.log('test', result);
|
||||
});
|
||||
}
|
||||
onCreateConfirm(event) {
|
||||
if (window.confirm('Are you sure you want to save?')) {
|
||||
event.newData.status = 1;
|
||||
this.service.postBilling(event.newData).subscribe((value) => {
|
||||
this.initData();
|
||||
});
|
||||
event.confirm.resolve(event.newData);
|
||||
} else {
|
||||
event.confirm.reject();
|
||||
}
|
||||
}
|
||||
|
||||
onDeleteConfirm(event): void {
|
||||
if (window.confirm('Are you sure you want to delete?')) {
|
||||
this.service.deleteBilling(event.data).subscribe((value) => {
|
||||
this.initData();
|
||||
});
|
||||
event.confirm.resolve();
|
||||
} else {
|
||||
event.confirm.reject();
|
||||
}
|
||||
}
|
||||
|
||||
openWindowForm(event) {
|
||||
|
||||
let temp = event.data.billTitle.toString()
|
||||
event.data.billTitle = temp
|
||||
console.log('data kirim', event.data)
|
||||
this.windowService.open(BillingDetailComponent, {
|
||||
title: 'Billing Detail',
|
||||
context: {
|
||||
data: event.data,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
45
src/app/pages/billing/billing.module.ts
Normal file
45
src/app/pages/billing/billing.module.ts
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { NbCardModule,
|
||||
NbIconModule,
|
||||
NbInputModule,
|
||||
NbTreeGridModule,
|
||||
NbButtonModule,
|
||||
NbCheckboxModule,
|
||||
NbRadioModule,
|
||||
NbSelectModule,
|
||||
NbDatepickerModule} from '@nebular/theme';
|
||||
import { Ng2SmartTableModule } from 'ng2-smart-table';
|
||||
|
||||
import { ThemeModule } from '../../@theme/theme.module';
|
||||
import { BillingComponent } from './billing.component';
|
||||
import { BillingService } from './billing.service';
|
||||
import { BillingDetailComponent } from './billing-detail/billing-detail.component';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
@NgModule({
|
||||
imports: [
|
||||
NbCardModule,
|
||||
NbTreeGridModule,
|
||||
NbIconModule,
|
||||
NbInputModule,
|
||||
ThemeModule,
|
||||
NbButtonModule,
|
||||
NbRadioModule,
|
||||
NbCheckboxModule,
|
||||
Ng2SmartTableModule,
|
||||
FormsModule,
|
||||
NbSelectModule,
|
||||
NbDatepickerModule,
|
||||
],
|
||||
declarations: [
|
||||
BillingComponent,
|
||||
BillingDetailComponent,
|
||||
],
|
||||
providers: [
|
||||
BillingService,
|
||||
BillingDetailComponent,
|
||||
],
|
||||
entryComponents: [
|
||||
BillingDetailComponent,
|
||||
],
|
||||
})
|
||||
export class BillingModule { }
|
||||
104
src/app/pages/billing/billing.service.ts
Normal file
104
src/app/pages/billing/billing.service.ts
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {HttpClient, HttpHeaders} from '@angular/common/http';
|
||||
import {Observable, throwError} from 'rxjs';
|
||||
import {map, catchError} from 'rxjs/operators';
|
||||
import {HttpErrorResponse} from '@angular/common/http';
|
||||
import { BillingList } from '../../@core/data/billing';
|
||||
import { DatePipe } from '@angular/common'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class BillingService {
|
||||
constructor(private http: HttpClient, public datepipe: DatePipe) {
|
||||
}
|
||||
|
||||
postData = {
|
||||
start: 0,
|
||||
sort: '',
|
||||
length: 20,
|
||||
column: 'startTime',
|
||||
customerCode: '',
|
||||
customerFullname: '',
|
||||
customerBusiness: '',
|
||||
payCycle: '',
|
||||
nextBillTmFirst: '',
|
||||
nextBillTmLast: '',
|
||||
isActive: '1'
|
||||
};
|
||||
|
||||
json;
|
||||
getBilling(): Observable<any> {
|
||||
const url = 'http://34.87.6.140:8011/api/customerStatic/pagingSearchParamBilling?start=0&sort=desc&length=20&column=startTime&customerCode=&customerFullname=&customerBusiness=&payCycle=&nextBillTmFirst=&nextBillTmLast=&isActive=1';
|
||||
// const options = { headers: headers};
|
||||
return this.http.post(url, null).pipe(
|
||||
map(this.extractData),
|
||||
catchError(this.handleError),
|
||||
);
|
||||
// '?start=' + this.postData.start + '&sort='+ this.postData.sort +
|
||||
// '&length=' + this.postData.length + '&column=' + this.postData.column + '&customerCode=' +
|
||||
// this.postData.customerCode + '&customerFullname=' + this.postData.customerFullname +
|
||||
// '&customerBusiness=' + this.postData.customerBusiness + '&payCycle=' + this.postData.payCycle +
|
||||
// '&nextBillTmFirst=' + this.postData.nextBillTmFirst + '&nextBillTmLast='+ this.postData.nextBillTmLast +
|
||||
// '&isActive=' + this.postData.isActive
|
||||
}
|
||||
// params: [{ start: 0, sort: '', length: 20, column: 'startTime', customerCode: '', customerFullname: ''
|
||||
// , customerBusiness: '', payCycle: '', nextBillTmFirst: '', nextBillTmLast: '', isActive: '1'}]
|
||||
private extractData(body: any): BillingList[] {
|
||||
console.log('coba', body.content)
|
||||
return Object.assign(body.content);
|
||||
}
|
||||
|
||||
postBilling(data: BillingList): Observable<any> {
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'X-Requested-Method': 'POST',
|
||||
});
|
||||
console.log('isiiii', data.ebCustomerId)
|
||||
const id = data.ebCustomerId
|
||||
let nextBill_date =this.datepipe.transform(data.nextBillTm, 'yyyy-MM-dd'+'T'+'HH:mm:ss.SSS');
|
||||
let endTime_date =this.datepipe.transform(data.endTime, 'yyyy-MM-dd'+'T'+'HH:mm:ss.SSS');
|
||||
let startTime_date =this.datepipe.transform(data.startTime, 'yyyy-MM-dd'+'T'+'HH:mm:ss.SSS');
|
||||
let modifyTm_date =this.datepipe.transform(data.modifyTm, 'yyyy-MM-dd'+'T'+'HH:mm:ss.SSS');
|
||||
data.nextBillTm = nextBill_date
|
||||
data.endTime = endTime_date
|
||||
data.startTime = startTime_date
|
||||
data.modifyTm = modifyTm_date
|
||||
console.log('isi tanggal' ,data)
|
||||
const options = { headers: headers };
|
||||
const url = 'http://34.87.6.140:8011/api/customerStatic/insertData';
|
||||
return this.http.post(url, JSON.stringify(data) , options).pipe(
|
||||
catchError(this.handleError),
|
||||
);
|
||||
}
|
||||
|
||||
deleteBilling(data: BillingList): Observable<any> {
|
||||
const id = data.ebCustomerId;
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'X-Requested-Method': 'PUT',
|
||||
});
|
||||
const options = { headers: headers };
|
||||
const url = 'http://34.87.6.140:8011/api/customerStatic/delete';
|
||||
return this.http.put(url, id, options).pipe(
|
||||
catchError(this.handleError),
|
||||
);
|
||||
}
|
||||
|
||||
private handleError(error: HttpErrorResponse | any) {
|
||||
let errMsg: string;
|
||||
let errObj: any;
|
||||
|
||||
if (error instanceof HttpErrorResponse) {
|
||||
const err = error.message || JSON.stringify(error);
|
||||
errMsg = `${error.status} - ${error.statusText || ''} ${err}`;
|
||||
errObj = error.error.message;
|
||||
} else {
|
||||
errMsg = error.message ? error.message : error.toString();
|
||||
const body = error.message || '';
|
||||
errObj = body;
|
||||
}
|
||||
|
||||
return throwError(errObj);
|
||||
}
|
||||
}
|
||||
13
src/app/pages/service-agreement/sa.component.html
Normal file
13
src/app/pages/service-agreement/sa.component.html
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<button type="button" class=".btn" data-toggle="modal" data-target="#myModal">
|
||||
Launch demo modal
|
||||
</button>
|
||||
<nb-card>
|
||||
<nb-card-header>
|
||||
Service Agreement
|
||||
</nb-card-header>
|
||||
|
||||
<nb-card-body>
|
||||
<ng2-smart-table [settings]="settings" [source]="source" (deleteConfirm)="onDeleteConfirm($event)">
|
||||
</ng2-smart-table>
|
||||
</nb-card-body>
|
||||
</nb-card>
|
||||
7
src/app/pages/service-agreement/sa.component.scss
Normal file
7
src/app/pages/service-agreement/sa.component.scss
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
@import '../../@theme/styles/themes';
|
||||
|
||||
@include nb-install-component() {
|
||||
nb-card {
|
||||
transform: translate3d(0, 0, 0);
|
||||
}
|
||||
}
|
||||
75
src/app/pages/service-agreement/sa.component.ts
Normal file
75
src/app/pages/service-agreement/sa.component.ts
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { LocalDataSource } from 'ng2-smart-table';
|
||||
import { NbWindowService } from '@nebular/theme';
|
||||
|
||||
import { SmartTableData } from '../../@core/data/smart-table';
|
||||
import { ServiceAgreementList } from '../../@core/data/service-agreement';
|
||||
import { ServiceAgreementService } from './sa.service';
|
||||
import { ServiceAgreementDetailComponent } from './service-agreement-detail/service-agreement-detail.component';
|
||||
|
||||
@Component({
|
||||
selector: 'ngx-sa',
|
||||
templateUrl: './sa.component.html',
|
||||
styleUrls: ['./sa.component.scss'],
|
||||
})
|
||||
export class ServiceAgreementComponent implements OnInit{
|
||||
|
||||
settings = {
|
||||
add: {
|
||||
addButtonContent: '<i class="nb-plus"></i>',
|
||||
createButtonContent: '<i class="nb-checkmark"></i>',
|
||||
cancelButtonContent: '<i class="nb-close"></i>',
|
||||
},
|
||||
edit: {
|
||||
editButtonContent: '<i class="nb-edit"></i>',
|
||||
saveButtonContent: '<i class="nb-checkmark"></i>',
|
||||
cancelButtonContent: '<i class="nb-close"></i>',
|
||||
},
|
||||
delete: {
|
||||
deleteButtonContent: '<i class="nb-trash"></i>',
|
||||
confirmDelete: true,
|
||||
},
|
||||
columns: {
|
||||
customerCode: {
|
||||
title: 'Partner Code',
|
||||
type: 'string',
|
||||
},
|
||||
customerFullname: {
|
||||
title: 'Partner Name',
|
||||
type: 'string',
|
||||
},
|
||||
customerBusiness: {
|
||||
title: 'Business',
|
||||
type: 'string',
|
||||
},
|
||||
status: {
|
||||
title: 'Status',
|
||||
type: 'string',
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
source: ServiceAgreementList[] = [];
|
||||
|
||||
constructor(private service: ServiceAgreementService, private windowService: NbWindowService) {
|
||||
console.log('test', this.source);
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.service.getServiceAgreement().subscribe((result) => {
|
||||
this.source = Object.assign([], result);
|
||||
});
|
||||
}
|
||||
|
||||
onDeleteConfirm(event): void {
|
||||
if (window.confirm('Are you sure you want to delete?')) {
|
||||
event.confirm.resolve();
|
||||
} else {
|
||||
event.confirm.reject();
|
||||
}
|
||||
}
|
||||
|
||||
openWindowForm() {
|
||||
this.windowService.open(ServiceAgreementDetailComponent, { title: `Service Agreement Detail` });
|
||||
}
|
||||
}
|
||||
30
src/app/pages/service-agreement/sa.module.ts
Normal file
30
src/app/pages/service-agreement/sa.module.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { NbCardModule, NbIconModule, NbInputModule, NbTreeGridModule } from '@nebular/theme';
|
||||
import { Ng2SmartTableModule } from 'ng2-smart-table';
|
||||
|
||||
import { ThemeModule } from '../../@theme/theme.module';
|
||||
import { ServiceAgreementComponent } from './sa.component';
|
||||
import { ServiceAgreementService } from './sa.service';
|
||||
import { ServiceAgreementDetailComponent } from './service-agreement-detail/service-agreement-detail.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
NbCardModule,
|
||||
NbTreeGridModule,
|
||||
NbIconModule,
|
||||
NbInputModule,
|
||||
ThemeModule,
|
||||
Ng2SmartTableModule,
|
||||
],
|
||||
declarations: [
|
||||
ServiceAgreementComponent,
|
||||
ServiceAgreementDetailComponent,
|
||||
],
|
||||
providers: [
|
||||
ServiceAgreementService,
|
||||
],
|
||||
entryComponents: [
|
||||
ServiceAgreementDetailComponent,
|
||||
],
|
||||
})
|
||||
export class ServiceAgreementModule { }
|
||||
51
src/app/pages/service-agreement/sa.service.ts
Normal file
51
src/app/pages/service-agreement/sa.service.ts
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {HttpClient, HttpHeaders} from '@angular/common/http';
|
||||
import {Observable, throwError} from 'rxjs';
|
||||
import {map, catchError} from 'rxjs/operators';
|
||||
import {HttpErrorResponse} from '@angular/common/http';
|
||||
import { ServiceAgreementList } from '../../@core/data/service-agreement';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ServiceAgreementService {
|
||||
constructor(private http: HttpClient) {
|
||||
}
|
||||
url = 'http://localhost:8011/api/customerStatic/pagingSearchParam?start=0&sort=desc&length=20&column=startTime&customerCode=&customerFullname=&customerBusiness=&payCycle=&isActive=';
|
||||
json;
|
||||
getServiceAgreement(): Observable<any> {
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
'X-Requested-Method': 'POST',
|
||||
});
|
||||
const options = { headers: headers };
|
||||
return this.http.post(this.url, null).pipe(
|
||||
map(this.extractData),
|
||||
catchError(this.handleError),
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private extractData(body: any): ServiceAgreementList[] {
|
||||
// console.log('test', body.serviceAgreementList);
|
||||
return Object.assign(body.content);
|
||||
}
|
||||
|
||||
private handleError(error: HttpErrorResponse | any) {
|
||||
let errMsg: string;
|
||||
let errObj: any;
|
||||
|
||||
if (error instanceof HttpErrorResponse) {
|
||||
const err = error.message || JSON.stringify(error);
|
||||
errMsg = `${error.status} - ${error.statusText || ''} ${err}`;
|
||||
errObj = error.error.message;
|
||||
} else {
|
||||
errMsg = error.message ? error.message : error.toString();
|
||||
const body = error.message || '';
|
||||
errObj = body;
|
||||
}
|
||||
|
||||
return throwError(errObj);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1" class="label">Partner Code</label>
|
||||
<input nbInput fullWidth id="exampleInputEmail1" [(ngModel)]="data.customerID">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">User Id</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" [(ngModel)]="data.customerID">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1" class="label">Promo Type</label>
|
||||
<input nbInput fullWidth id="exampleInputEmail1" [(ngModel)]="data.promotionType">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Periode </label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" [(ngModel)]="data.validDay">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1" class="label">Coupon Code</label>
|
||||
<input nbInput fullWidth id="exampleInputEmail1" [(ngModel)]="data.code">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Valid Start</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" [(ngModel)]="data.validFrom">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Valid End</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" [(ngModel)]="data.validTo">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Promo</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" [(ngModel)]="data.value">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1" class="label">Max. Promo</label>
|
||||
<input nbInput fullWidth id="exampleInputEmail1" [(ngModel)]="data.maximumDiscount">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1" class="label">Quota per User</label>
|
||||
<input nbInput fullWidth id="exampleInputEmail1" [(ngModel)]="data.maximumPerUser">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">User Type</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" [(ngModel)]="data.customerType">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Coverage Pickup</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" [(ngModel)]="data.coverage">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Product</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" [(ngModel)]="data.product">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Promo (IDR)</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" [(ngModel)]="data.value">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Promo (%)</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" [(ngModel)]="data.value">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Max. Promo</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" [(ngModel)]="data.maximumDiscountValue">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Budget</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" [(ngModel)]="data.maximumDiscount">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleInputPassword1" class="label">Quota</label>
|
||||
<input nbInput fullWidth id="exampleInputPassword1" [(ngModel)]="data.quota">
|
||||
</div>
|
||||
<button (click)="onSubmit()" type="submit" nbButton status="primary">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
@import '../../../@theme/styles/themes';
|
||||
|
||||
@include nb-install-component() {
|
||||
::ng-deep .form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.text-label {
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { NbWindowRef } from '@nebular/theme';
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
<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>
|
||||
`,
|
||||
styleUrls: ['service-agreement-detail.component.scss'],
|
||||
})
|
||||
export class ServiceAgreementDetailComponent {
|
||||
constructor(public windowRef: NbWindowRef) {}
|
||||
|
||||
close() {
|
||||
this.windowRef.close();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue