Commit 7fd6134c authored by 伊藤雄大's avatar 伊藤雄大

2024/07/11

サービスの追加
parent ae65864c
// @ts-check
const eslint = require("@eslint/js");
const tseslint = require("typescript-eslint");
const angular = require("angular-eslint");
module.exports = tseslint.config(
{
files: ["**/*.ts"],
extends: [
eslint.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.stylistic,
...angular.configs.tsRecommended,
],
processor: angular.processInlineTemplates,
rules: {
"@angular-eslint/directive-selector": [
"error",
{
type: "attribute",
prefix: "app",
style: "camelCase",
},
],
"@angular-eslint/component-selector": [
"error",
{
type: "element",
prefix: "app",
style: "kebab-case",
},
],
},
},
{
files: ["**/*.html"],
extends: [
...angular.configs.templateRecommended,
...angular.configs.templateAccessibility,
],
rules: {},
}
);
<table style="margin-top:20px;">
<tr>
<td>
<span>利用者</span>
</td>
<td>
<span>{{model?.name}}</span>
</td>
</tr>
<tr>
<td colspan="2" align="center" style="padding-top:10px;">
<input type="button" class="btn common-button" value="削除依頼" (click)="onClickDel()">
</td>
</tr>
</table>
<ag-grid-angular class="ag-theme-quartz" style="height:500px;margin-top:20px;" [rowData]="denyList"
[columnDefs]="colDefs" [autoSizeStrategy]="autoSizeStrategy" [rowSelection]="rowSelection" [context]="context"
(gridReady)="onGridReady($event)" [pagination]=true></ag-grid-angular>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { DenyListComponent } from './deny-list.component';
describe('DenyListComponent', () => {
let component: DenyListComponent;
let fixture: ComponentFixture<DenyListComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [DenyListComponent]
})
.compileComponents();
fixture = TestBed.createComponent(DenyListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, Input, OnInit } from '@angular/core';
import { UserInfoModel } from '../../model/user-info.model';
import { DenyListModel } from '../../model/denylist.model';
import { ColDef, GridApi } from 'ag-grid-community';
import { SizeColumnsToFitGridStrategy, SizeColumnsToFitProvidedWidthStrategy, SizeColumnsToContentStrategy } from 'ag-grid-community'
import { DenyListService } from '../../service/deny-list.service';
@Component({
selector: 'app-deny-list',
templateUrl: './deny-list.component.html',
styleUrl: './deny-list.component.css'
})
export class DenyListComponent implements OnInit {
@Input() model?: UserInfoModel;
denyList: DenyListModel[] = [];
context?: any;
private gridApi!: GridApi<DenyListModel>;
rowSelection: "single" | "multiple" = "multiple";
colDefs: ColDef[] = [
{ headerName: '区間', field: "rideSection", width: 200, checkboxSelection: true, headerCheckboxSelection: true },
{ headerName: '乗車日時', field: "getonDt", width: 130 },
{ headerName: '降車日時', field: "getoffDt", width: 130 },
{ headerName: '請求金額', field: "billingAmount", width: 100 },
{ headerName: 'ステータス', field: "status", width: 100 },
{ field: "id", hide: true }
];
public autoSizeStrategy:
| SizeColumnsToFitGridStrategy
| SizeColumnsToFitProvidedWidthStrategy
| SizeColumnsToContentStrategy = {
type: "fitGridWidth",
defaultMinWidth: 100,
columnLimits: [
{
colId: "country",
minWidth: 900,
},
],
};
/**
* コンストラクタ
* @param denyListService 拒否リストサービス
*/
constructor(private denyListService: DenyListService) {
this.context = {
componentParent: this
}
}
/**
* 初期処理
*/
ngOnInit(): void {
if (this.model && this.model.customerId) {
this.denyList = this.denyListService.getList(this.model.customerId);
}
}
/**
* 拒否リスト削除依頼
*/
onClickDel(): void {
const list: DenyListModel[] = this.gridApi.getSelectedRows();
//拒否リスト削除依頼
this.denyListService.reqDelete(list);
//拒否リスト再取得
if (this.model && this.model.customerId) {
this.denyList = this.denyListService.getList(this.model.customerId);
}
//↓プロトタイプ
for (const deny of this.denyList) {
for (const model of list) {
if (model.id === deny.id) {
deny.status = "削除依頼済";
break;
}
}
}
//↑プロトタイプ
this.gridApi.setGridOption("rowData", this.denyList);
}
onGridReady(params: any): void {
this.gridApi = params.api;
}
}
<span>****&nbsp;****&nbsp;****&nbsp;</span><span>{{params.data.cardNumber}}</span>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CardRendererComponent } from './card-renderer.component';
describe('CardRendererComponent', () => {
let component: CardRendererComponent;
let fixture: ComponentFixture<CardRendererComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [CardRendererComponent]
})
.compileComponents();
fixture = TestBed.createComponent(CardRendererComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component } from '@angular/core';
import { ICellRendererParams } from 'ag-grid-community';
@Component({
selector: 'app-card-renderer',
templateUrl: './card-renderer.component.html',
styleUrl: './card-renderer.component.css'
})
export class CardRendererComponent {
//パラメータ
params: any;
/**
* 初期処理
* @param params パラメータ
*/
agInit(params: ICellRendererParams): void {
console.log(params);
this.params = params;
}
/**
* リフレッシュ
* @param params パラメータ
* @returns 正常かどうか
*/
refresh(params: ICellRendererParams) {
return true;
}
}
@if (params.data.delReq === "1") {
<span></span>
}
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { DelreqComponent } from './delreq.component';
describe('DelreqComponent', () => {
let component: DelreqComponent;
let fixture: ComponentFixture<DelreqComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [DelreqComponent]
})
.compileComponents();
fixture = TestBed.createComponent(DelreqComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component } from '@angular/core';
import { ICellRendererParams } from 'ag-grid-community';
@Component({
selector: 'app-delreq',
templateUrl: './delreq.component.html',
styleUrl: './delreq.component.css'
})
export class DelreqComponent {
//パラメータ
params: any;
/**
* 初期処理
* @param params パラメータ
*/
agInit(params: ICellRendererParams): void {
console.log(params);
this.params = params;
}
/**
* リフレッシュ
* @param params パラメータ
* @returns 正常かどうか
*/
refresh(params: ICellRendererParams) {
return true;
}
}
<span>{{year}}/{{month}}/{{day}}</span>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { EarningDateComponent } from './earning-date.component';
describe('EarningDateComponent', () => {
let component: EarningDateComponent;
let fixture: ComponentFixture<EarningDateComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [EarningDateComponent]
})
.compileComponents();
fixture = TestBed.createComponent(EarningDateComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component } from '@angular/core';
import { ICellRendererParams } from 'ag-grid-community';
@Component({
selector: 'app-earning-date',
templateUrl: './earning-date.component.html',
styleUrl: './earning-date.component.css'
})
export class EarningDateComponent {
//パラメータ
params: any;
year?: string;
month?: string;
day?: string;
/**
* 初期処理
* @param params パラメータ
*/
agInit(params: ICellRendererParams): void {
console.log(params);
this.params = params;
if (params.data.processDateTime) {
const dt: string = params.data.processDateTime;
this.year = dt.substring(0, 4);
this.month = dt.substring(4, 6);
this.day = dt.substring(6, 8);
}
}
/**
* リフレッシュ
* @param params パラメータ
* @returns 正常かどうか
*/
refresh(params: ICellRendererParams) {
return true;
}
}
<ag-grid-angular class="ag-theme-quartz" style="height:500px;margin-top:20px;" [rowData]="earningList"
[columnDefs]="colDefs" [autoSizeStrategy]="autoSizeStrategy" [context]="context" (gridReady)="onGridReady($event)"
[pagination]=true></ag-grid-angular>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { EarningListComponent } from './earning-list.component';
describe('EarningListComponent', () => {
let component: EarningListComponent;
let fixture: ComponentFixture<EarningListComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [EarningListComponent]
})
.compileComponents();
fixture = TestBed.createComponent(EarningListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { ColDef, GridApi } from 'ag-grid-community';
import { SizeColumnsToFitGridStrategy, SizeColumnsToFitProvidedWidthStrategy, SizeColumnsToContentStrategy } from 'ag-grid-community'
import { EarningModel } from '../../model/earning.model';
import { CardRendererComponent } from './card-renderer/card-renderer.component';
import { ProcessDatetimeComponent } from './processdatetime/processdatetime.component';
import { EarningDateComponent } from './earning-date/earning-date.component';
import { GetonDatetimeComponent } from './geton-datetime/geton-datetime.component';
import { GetoffDatetimeComponent } from './getoff-datetime/getoff-datetime.component';
import { StatusComponent } from './status/status.component';
import { NgComponent } from './ng/ng.component';
import { DelreqComponent } from './delreq/delreq.component';
import { EarningListService } from '../../service/earning-list.service';
@Component({
selector: 'app-earning-list',
templateUrl: './earning-list.component.html',
styleUrl: './earning-list.component.css'
})
export class EarningListComponent implements OnInit {
earningList?: EarningModel[];
context?: any;
private gridApi!: GridApi<EarningModel>;
colDefs: ColDef[] = [
{ headerName: '利用者名', field: "cutomerName", width: 100 },
{ headerName: 'カード番号', field: "cardNumber", width: 200, cellRenderer: CardRendererComponent },
{ headerName: '請求番号', field: "billingNumber", width: 200 },
{ headerName: '請求額', field: "billingAmount", width: 100 },
{ headerName: '処理日時', field: "processDateTime", width: 300, cellRenderer: ProcessDatetimeComponent },
{ headerName: '売上日', field: "earningDate", width: 200, cellRenderer: EarningDateComponent },
{ headerName: '乗車日時', field: "getonDateTime", width: 300, cellRenderer: GetonDatetimeComponent },
{ headerName: '降車日時', field: "getoffDateTime", width: 300, cellRenderer: GetoffDatetimeComponent },
{ headerName: '乗降明細', field: "getonoffDetail", width: 300 },
{ headerName: '新規', field: "status", width: 30, cellRenderer: StatusComponent },
{ headerName: 'NG', field: "ngFlag", width: 30, cellRenderer: NgComponent },
{ headerName: '削除依頼', field: "delReq", width: 30, cellRenderer: DelreqComponent }
];
public autoSizeStrategy:
| SizeColumnsToFitGridStrategy
| SizeColumnsToFitProvidedWidthStrategy
| SizeColumnsToContentStrategy = {
type: "fitGridWidth",
defaultMinWidth: 100,
columnLimits: [
{
colId: "country",
minWidth: 900,
},
],
};
/**
* コンストラクタ
* @param earningListService トークン売上サービス
*/
constructor(private earningListService: EarningListService) {
this.context = {
componentParent: this
}
}
/**
* 初期処理
*/
ngOnInit(): void {
this.earningList = this.earningListService.getList();
}
onGridReady(params: any): void {
this.gridApi = params.api;
}
}
<span>{{year}}/{{month}}/{{day}}&nbsp;{{hour}}:{{minute}}:{{second}}</span>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { GetoffDatetimeComponent } from './getoff-datetime.component';
describe('GetoffDatetimeComponent', () => {
let component: GetoffDatetimeComponent;
let fixture: ComponentFixture<GetoffDatetimeComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [GetoffDatetimeComponent]
})
.compileComponents();
fixture = TestBed.createComponent(GetoffDatetimeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component } from '@angular/core';
import { ICellRendererParams } from 'ag-grid-community';
@Component({
selector: 'app-getoff-datetime',
templateUrl: './getoff-datetime.component.html',
styleUrl: './getoff-datetime.component.css'
})
export class GetoffDatetimeComponent {
//パラメータ
params: any;
year?: string;
month?: string;
day?: string;
hour?: string;
minute?: string;
second?: string;
/**
* 初期処理
* @param params パラメータ
*/
agInit(params: ICellRendererParams): void {
console.log(params);
this.params = params;
if (params.data.processDateTime) {
const dt: string = params.data.processDateTime;
this.year = dt.substring(0, 4);
this.month = dt.substring(4, 6);
this.day = dt.substring(6, 8);
this.hour = dt.substring(8, 10);
this.minute = dt.substring(10, 12);
this.second = dt.substring(12);
}
}
/**
* リフレッシュ
* @param params パラメータ
* @returns 正常かどうか
*/
refresh(params: ICellRendererParams) {
return true;
}
}
<span>{{year}}/{{month}}/{{day}}&nbsp;{{hour}}:{{minute}}:{{second}}</span>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { GetonDatetimeComponent } from './geton-datetime.component';
describe('GetonDatetimeComponent', () => {
let component: GetonDatetimeComponent;
let fixture: ComponentFixture<GetonDatetimeComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [GetonDatetimeComponent]
})
.compileComponents();
fixture = TestBed.createComponent(GetonDatetimeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component } from '@angular/core';
import { ICellRendererParams } from 'ag-grid-community';
@Component({
selector: 'app-geton-datetime',
templateUrl: './geton-datetime.component.html',
styleUrl: './geton-datetime.component.css'
})
export class GetonDatetimeComponent {
//パラメータ
params: any;
year?: string;
month?: string;
day?: string;
hour?: string;
minute?: string;
second?: string;
/**
* 初期処理
* @param params パラメータ
*/
agInit(params: ICellRendererParams): void {
console.log(params);
this.params = params;
if (params.data.processDateTime) {
const dt: string = params.data.processDateTime;
this.year = dt.substring(0, 4);
this.month = dt.substring(4, 6);
this.day = dt.substring(6, 8);
this.hour = dt.substring(8, 10);
this.minute = dt.substring(10, 12);
this.second = dt.substring(12);
}
}
/**
* リフレッシュ
* @param params パラメータ
* @returns 正常かどうか
*/
refresh(params: ICellRendererParams) {
return true;
}
}
@if (params.data.ngFlag === "1") {
<span></span>
}
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NgComponent } from './ng.component';
describe('NgComponent', () => {
let component: NgComponent;
let fixture: ComponentFixture<NgComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [NgComponent]
})
.compileComponents();
fixture = TestBed.createComponent(NgComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component } from '@angular/core';
import { ICellRendererParams } from 'ag-grid-community';
@Component({
selector: 'app-ng',
templateUrl: './ng.component.html',
styleUrl: './ng.component.css'
})
export class NgComponent {
//パラメータ
params: any;
/**
* 初期処理
* @param params パラメータ
*/
agInit(params: ICellRendererParams): void {
console.log(params);
this.params = params;
}
/**
* リフレッシュ
* @param params パラメータ
* @returns 正常かどうか
*/
refresh(params: ICellRendererParams) {
return true;
}
}
<span>{{year}}/{{month}}/{{day}}&nbsp;{{hour}}:{{minute}}:{{second}}</span>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ProcessDatetimeComponent } from './processdatetime.component';
describe('ProcessDatetimeComponent', () => {
let component: ProcessDatetimeComponent;
let fixture: ComponentFixture<ProcessDatetimeComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ProcessDatetimeComponent]
})
.compileComponents();
fixture = TestBed.createComponent(ProcessDatetimeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component } from '@angular/core';
import { ICellRendererParams } from 'ag-grid-community';
@Component({
selector: 'app-processdatetime',
templateUrl: './processdatetime.component.html',
styleUrl: './processdatetime.component.css'
})
export class ProcessDatetimeComponent {
//パラメータ
params: any;
year?: string;
month?: string;
day?: string;
hour?: string;
minute?: string;
second?: string;
/**
* 初期処理
* @param params パラメータ
*/
agInit(params: ICellRendererParams): void {
console.log(params);
this.params = params;
if (params.data.processDateTime) {
const dt: string = params.data.processDateTime;
this.year = dt.substring(0, 4);
this.month = dt.substring(4, 6);
this.day = dt.substring(6, 8);
this.hour = dt.substring(8, 10);
this.minute = dt.substring(10, 12);
this.second = dt.substring(12);
}
}
/**
* リフレッシュ
* @param params パラメータ
* @returns 正常かどうか
*/
refresh(params: ICellRendererParams) {
return true;
}
}
@if (params.data.status === "0") {
<span></span>
}
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { StatusComponent } from './status.component';
describe('StatusComponent', () => {
let component: StatusComponent;
let fixture: ComponentFixture<StatusComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [StatusComponent]
})
.compileComponents();
fixture = TestBed.createComponent(StatusComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component } from '@angular/core';
import { ICellRendererParams } from 'ag-grid-community';
@Component({
selector: 'app-status',
templateUrl: './status.component.html',
styleUrl: './status.component.css'
})
export class StatusComponent {
//パラメータ
params: any;
/**
* 初期処理
* @param params パラメータ
*/
agInit(params: ICellRendererParams): void {
console.log(params);
this.params = params;
}
/**
* リフレッシュ
* @param params パラメータ
* @returns 正常かどうか
*/
refresh(params: ICellRendererParams) {
return true;
}
}
<table style="margin-top:20px;">
<tr>
<td>
<span>利用者</span>
</td>
<td>
<span>{{model?.name}}</span>
</td>
</tr>
</table>
<ag-grid-angular class="ag-theme-quartz" style="height:500px;margin-top:20px;" [rowData]="historyList"
[columnDefs]="colDefs" [autoSizeStrategy]="autoSizeStrategy" [context]="context" (gridReady)="onGridReady($event)"
[pagination]=true></ag-grid-angular>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HistoryListComponent } from './history-list.component';
describe('HistoryListComponent', () => {
let component: HistoryListComponent;
let fixture: ComponentFixture<HistoryListComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [HistoryListComponent]
})
.compileComponents();
fixture = TestBed.createComponent(HistoryListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, Input, OnInit } from '@angular/core';
import { HistoryModel } from '../../model/history.model';
import { UserInfoModel } from '../../model/user-info.model';
import { ColDef, GridApi } from 'ag-grid-community';
import { SizeColumnsToFitGridStrategy, SizeColumnsToFitProvidedWidthStrategy, SizeColumnsToContentStrategy } from 'ag-grid-community'
import { StatusLinkComponent } from './status-link/status-link.component';
import { StatusUpdateService } from '../../service/status-update.service';
import { HistoryService } from '../../service/history.service';
@Component({
selector: 'app-history-list',
templateUrl: './history-list.component.html',
styleUrl: './history-list.component.css'
})
export class HistoryListComponent implements OnInit {
//利用者情報
@Input() model?: UserInfoModel;
historyList: HistoryModel[] = [];
context?: any;
private gridApi!: GridApi<HistoryModel>;
colDefs: ColDef[] = [
{ headerName: '乗降日時', field: "getonoffDate", width: 400 },
{ headerName: '', field: "getonoff", width: 100 },
{ headerName: '乗降停留所', field: "stopName", width: 100 },
{ headerName: '支払金額', field: "payment", width: 100 },
{ headerName: 'ステータス', field: "status", width: 80, cellRenderer: StatusLinkComponent },
];
public autoSizeStrategy:
| SizeColumnsToFitGridStrategy
| SizeColumnsToFitProvidedWidthStrategy
| SizeColumnsToContentStrategy = {
type: "fitGridWidth",
defaultMinWidth: 100,
columnLimits: [
{
colId: "country",
minWidth: 900,
},
],
};
/**
* コンストラクタ
* @param statusUpdateService ステータス更新サービス
* @param historyService 乗降履歴サービス
*/
constructor(private statusUpdateService: StatusUpdateService, private historyService: HistoryService) {
this.context = {
componentParent: this
}
}
/**
* 初期処理
*/
ngOnInit(): void {
if (this.model && this.model.customerId) {
this.historyList = this.historyService.getList(this.model.customerId);
}
}
/**
* ステータスクリック
* @param model 乗車履歴情報
*/
onClickStatus(model: HistoryModel) {
if ((this.statusUpdateService.confirm(model)).valueOf()) {
this.historyService.changeStatus(model);
}
}
onGridReady(params: any): void {
this.gridApi = params.api;
}
}
@if (params.data.status !== "") {
<div role="button" class="common-link" (click)="onClickStatus()">{{params.data.status}}</div>
}
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { StatusLinkComponent } from './status-link.component';
describe('StatusLinkComponent', () => {
let component: StatusLinkComponent;
let fixture: ComponentFixture<StatusLinkComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [StatusLinkComponent]
})
.compileComponents();
fixture = TestBed.createComponent(StatusLinkComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { ICellRendererAngularComp } from 'ag-grid-angular';
import { ICellRendererParams } from 'ag-grid-community';
import { Component } from '@angular/core';
@Component({
selector: 'app-status-link',
templateUrl: './status-link.component.html',
styleUrl: './status-link.component.css'
})
export class StatusLinkComponent implements ICellRendererAngularComp {
//パラメータ
params: any;
//親コンポーネント
componentParent: any;
/**
* 初期処理
* @param params パラメータ
*/
agInit(params: ICellRendererParams): void {
console.log(params);
this.params = params;
this.componentParent = this.params.context.componentParent;
}
/**
* リフレッシュ
* @param params パラメータ
* @returns 正常かどうか
*/
refresh(params: ICellRendererParams) {
return true;
}
/**
* ボタンクリック
*/
onClickStatus(): void {
this.componentParent.onClickStatus(this.params.data);
}
}
<div class="modal-header">
<table width="100%">
<tr>
<td>
<span class="modal-title">ステータス更新</span>
</td>
<td align="right">
<button type="button" class="border-0" style="background-color: white;" aria-label="Close"
(click)="onClickClose()">
<span aria-hidden="true">&times;</span>
</button>
</td>
</tr>
</table>
</div>
<div class="modal-body border rounded">
<select class="form-select mx-auto" style="width:100px;" [(ngModel)]="status">
<option value="0">乗降中</option>
<option value="1">降車済</option>
</select>
</div>
<div class="modal-footer d-flex justify-conent-between align-items-center">
<table>
<tr>
<td>
<input type="button" class="btn form-control common-button" value="閉じる" (click)="onClickClose()">
</td>
<td>
<input type="button" class="btn form-control common-button" value="更新" (click)="onClickUpdate()">
</td>
</tr>
</table>
</div>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { StatusUpdateComponent } from './status-update.component';
describe('StatusUpdateComponent', () => {
let component: StatusUpdateComponent;
let fixture: ComponentFixture<StatusUpdateComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [StatusUpdateComponent]
})
.compileComponents();
fixture = TestBed.createComponent(StatusUpdateComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { HistoryModel } from '../../../model/history.model';
@Component({
selector: 'app-status-update',
templateUrl: './status-update.component.html',
styleUrl: './status-update.component.css'
})
export class StatusUpdateComponent implements OnInit {
model?: HistoryModel;
status?: string;
constructor(private activeModal: NgbActiveModal) { }
ngOnInit(): void {
this.status = "0";
}
onClickClose(): void {
this.activeModal.dismiss();
}
onClickUpdate(): void {
this.activeModal.close();
}
}
<table style="margin-top:20px;">
<tr>
<td>
<span>利用者</span>
</td>
<td>
<span>{{model?.name}}</span>
</td>
</tr>
</table>
<ag-grid-angular class="ag-theme-quartz" style="height:500px;margin-top:20px;" [rowData]="passList"
[columnDefs]="colDefs" [autoSizeStrategy]="autoSizeStrategy" [context]="context" (gridReady)="onGridReady($event)"
[pagination]=true></ag-grid-angular>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PassListComponent } from './pass-list.component';
describe('PassListComponent', () => {
let component: PassListComponent;
let fixture: ComponentFixture<PassListComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [PassListComponent]
})
.compileComponents();
fixture = TestBed.createComponent(PassListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, Input, OnInit } from '@angular/core';
import { PassModel } from '../../model/pass.model';
import { ColDef, GridApi } from 'ag-grid-community';
import { SizeColumnsToFitGridStrategy, SizeColumnsToFitProvidedWidthStrategy, SizeColumnsToContentStrategy } from 'ag-grid-community'
import { RefundButtonComponent } from './refund-button/refund-button.component';
import { UserInfoModel } from '../../model/user-info.model';
import { PassRefundService } from '../../service/pass-refund.service';
import { PassService } from '../../service/pass.service';
@Component({
selector: 'app-pass-list',
templateUrl: './pass-list.component.html',
styleUrl: './pass-list.component.css'
})
export class PassListComponent implements OnInit {
//利用者情報
@Input() model?: UserInfoModel;
//定期券一覧
passList: PassModel[] = [];
context?: any;
private gridApi!: GridApi<PassModel>;
colDefs: ColDef[] = [
{ headerName: '路線', field: "routeName", width: 400 },
{ headerName: '使用開始日', field: "startDate", width: 100 },
{ headerName: '使用期間', field: "useTerm", width: 100 },
{ headerName: '料金区分', field: "priceRange", width: 100 },
{ headerName: '乗車区間', field: "rideSection", width: 150 },
{ headerName: 'カード番号', field: "creditCardNumber", width: 150 },
{ headerName: '', field: "refund", width: 80, cellRenderer: RefundButtonComponent },
];
public autoSizeStrategy:
| SizeColumnsToFitGridStrategy
| SizeColumnsToFitProvidedWidthStrategy
| SizeColumnsToContentStrategy = {
type: "fitGridWidth",
defaultMinWidth: 100,
columnLimits: [
{
colId: "country",
minWidth: 900,
},
],
};
/**
* コンストラクタ
* @param passRefundService
* @param passService
*/
constructor(private passRefundService: PassRefundService, private passService: PassService) {
this.context = {
componentParent: this
}
}
/**
* 初期処理
*/
ngOnInit(): void {
if (this.model && this.model.customerId) {
this.passList = this.passService.getList(this.model.customerId);
}
}
/**
* 払い戻し
* @param model 定期券情報
*/
async onClickRefund(model: PassModel) {
if (await this.passRefundService.confirm().valueOf()) {
//払戻処理
this.passService.refund(model);
}
}
onGridReady(params: any): void {
this.gridApi = params.api;
}
}
<div class="modal-header">
<table width="100%">
<tr>
<td>
<span class="modal-title">定期券払戻</span>
</td>
<td align="right">
<button type="button" class="border-0" style="background-color: white;" aria-label="Close"
(click)="onClickClose()">
<span aria-hidden="true">&times;</span>
</button>
</td>
</tr>
</table>
</div>
<div class="modal-body border rounded">
<table width="250px" class=" mx-auto">
<tr>
<td>
<span>カード番号</span>
</td>
<td>
<span>****&nbsp;****&nbsp;****&nbsp;{{model?.creditCardNumber}}</span>
</td>
</tr>
<tr>
<td>
<span>乗車区間</span>
</td>
<td>
<span>{{model?.rideSection}}</span>
</td>
</tr>
<tr>
<td>
<span>購入金額</span>
</td>
<td align="right">
<span>{{purphaseAmount|number}}円</span>
</td>
</tr>
<tr>
<td>
<span>普通運賃</span>
</td>
<td align="right">
<span>{{standardFare|number}}円</span>
</td>
</tr>
<tr>
<td>
<span>使用日数</span>
</td>
<td align="right">
<span>{{useDays}}日</span>
</td>
</tr>
<tr>
<td>
<span>払戻手数料</span>
</td>
<td align="right">
<span>{{refundFee|number}}円</span>
</td>
</tr>
<tr>
<td>
<span>払戻金額</span>
</td>
<td align="right">
<span>{{refundAmount|number}}円</span>
</td>
</tr>
</table>
</div>
<div class="modal-footer d-flex justify-conent-between align-items-center">
<table>
<tr>
<td>
<input type="button" class="btn form-control common-button" value="閉じる" (click)="onClickClose()">
</td>
<td>
<input type="button" class="btn form-control common-button" value="払戻" (click)="onClickRefund()">
</td>
</tr>
</table>
</div>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PassRefundComponent } from './pass-refund.component';
describe('PassRefundComponent', () => {
let component: PassRefundComponent;
let fixture: ComponentFixture<PassRefundComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [PassRefundComponent]
})
.compileComponents();
fixture = TestBed.createComponent(PassRefundComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component } from '@angular/core';
import { PassModel } from '../../../model/pass.model';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'app-pass-refund',
templateUrl: './pass-refund.component.html',
styleUrl: './pass-refund.component.css'
})
export class PassRefundComponent {
model?: PassModel;
purphaseAmount = 0;
standardFare = 0;
useDays = 0;
refundFee = 0;
refundAmount = 0;
constructor(private activeModal: NgbActiveModal) { }
/**
* 払戻
*/
onClickRefund(): void {
if (confirm("選択されているクレジットカードで払い戻ししてよろしいですか?")) {
this.activeModal.close();
}
}
/**
* 閉じる
*/
onClickClose(): void {
this.activeModal.dismiss();
}
}
<input type="button" class="form-control" style="width:80px;height:38px;line-height: 38px;" data-row="row"
(click)="onClickRefund()" value="払戻">
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RefundButtonComponent } from './refund-button.component';
describe('RefundButtonComponent', () => {
let component: RefundButtonComponent;
let fixture: ComponentFixture<RefundButtonComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [RefundButtonComponent]
})
.compileComponents();
fixture = TestBed.createComponent(RefundButtonComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { ICellRendererAngularComp } from 'ag-grid-angular';
import { ICellRendererParams } from 'ag-grid-community';
import { Component } from '@angular/core';
@Component({
selector: 'app-refund-button',
templateUrl: './refund-button.component.html',
styleUrl: './refund-button.component.css'
})
export class RefundButtonComponent implements ICellRendererAngularComp {
//パラメータ
params: any;
//親コンポーネント
componentParent: any;
/**
* 初期処理
* @param params パラメータ
*/
agInit(params: ICellRendererParams): void {
console.log(params);
this.params = params;
this.componentParent = this.params.context.componentParent;
}
/**
* リフレッシュ
* @param params パラメータ
* @returns 正常かどうか
*/
refresh(params: ICellRendererParams) {
return true;
}
/**
* ボタンクリック
*/
onClickRefund(): void {
this.componentParent.onClickRefund(this.params.data);
}
}
<input type="button" class="form-control" style="width:60px;height:38px;line-height: 38px;" data-row="row"
(click)="onClickEdit()" value="編集">
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CustomButtonComponent } from './custom-button.component';
describe('CustomButtonComponent', () => {
let component: CustomButtonComponent;
let fixture: ComponentFixture<CustomButtonComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [CustomButtonComponent]
})
.compileComponents();
fixture = TestBed.createComponent(CustomButtonComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { ICellRendererAngularComp } from 'ag-grid-angular';
import { ICellRendererParams } from 'ag-grid-community';
import { Component } from '@angular/core';
/**
* ボタンレンダリング
*/
@Component({
selector: 'app-custom-button',
templateUrl: './custom-button.component.html',
styleUrl: './custom-button.component.css'
})
export class CustomButtonComponent implements ICellRendererAngularComp {
//パラメータ
params: any;
//親コンポーネント
componentParent: any;
/**
* 初期処理
* @param params パラメータ
*/
agInit(params: ICellRendererParams): void {
console.log(params);
this.params = params;
this.componentParent = this.params.context.componentParent;
}
/**
* リフレッシュ
* @param params パラメータ
* @returns 正常かどうか
*/
refresh(params: ICellRendererParams) {
return true;
}
/**
* ボタンクリック
*/
onClickEdit(): void {
this.componentParent.onClickEdit(this.params.data);
}
}
...@@ -3,6 +3,7 @@ import { StaffInfoModel } from '../../model/staff-info.model'; ...@@ -3,6 +3,7 @@ import { StaffInfoModel } from '../../model/staff-info.model';
import { CustomButtonComponent } from './custom-button/custom-button.component'; import { CustomButtonComponent } from './custom-button/custom-button.component';
import { ColDef, GridApi } from 'ag-grid-community'; import { ColDef, GridApi } from 'ag-grid-community';
import { SizeColumnsToFitGridStrategy, SizeColumnsToFitProvidedWidthStrategy, SizeColumnsToContentStrategy } from 'ag-grid-community' import { SizeColumnsToFitGridStrategy, SizeColumnsToFitProvidedWidthStrategy, SizeColumnsToContentStrategy } from 'ag-grid-community'
import { StaffService } from '../../service/staff.service';
/** /**
* 事業所担当者一覧 * 事業所担当者一覧
...@@ -55,7 +56,7 @@ export class StaffListComponent implements OnInit { ...@@ -55,7 +56,7 @@ export class StaffListComponent implements OnInit {
/** /**
* コンストラクタ * コンストラクタ
*/ */
constructor() { constructor(private staffService: StaffService) {
this.context = { this.context = {
componentParent: this componentParent: this
} }
...@@ -65,14 +66,8 @@ export class StaffListComponent implements OnInit { ...@@ -65,14 +66,8 @@ export class StaffListComponent implements OnInit {
* 初期処理 * 初期処理
*/ */
ngOnInit(): void { ngOnInit(): void {
this.agencyList = new Map(); this.agencyList = this.staffService.getAgencyList();
for (let i = 0; i < 5; i++) { this.agencyId = this.agencyList.keys().next().value;
const str = String(i + 1);
this.agencyList.set("000" + str, "事業所" + str);
if (i == 0) {
this.agencyId = "000" + str;
}
}
} }
/** /**
...@@ -80,19 +75,7 @@ export class StaffListComponent implements OnInit { ...@@ -80,19 +75,7 @@ export class StaffListComponent implements OnInit {
*/ */
onClickSearch(): void { onClickSearch(): void {
//担当者一覧取得 //担当者一覧取得
this.staffList = []; this.staffList = this.staffService.getList(this.agencyId);
for (let i = 0; i < 5; i++) {
const model = new StaffInfoModel();
model.agencyId = String(i + 1);
model.email = "test" + String(i + 1) + "@test.com";
model.name = "山田 太郎";
model.password = "00000000";
model.company = "テスト会社";
model.department = "テスト部";
model.roleId = "1";
model.roleName = "システム管理者";
this.staffList.push(model);
}
} }
/** /**
...@@ -114,6 +97,20 @@ export class StaffListComponent implements OnInit { ...@@ -114,6 +97,20 @@ export class StaffListComponent implements OnInit {
*/ */
onClickDel(): void { onClickDel(): void {
const list: StaffInfoModel[] = this.gridApi.getSelectedRows(); const list: StaffInfoModel[] = this.gridApi.getSelectedRows();
//選択担当者情報削除
const emailList: string[] = [];
for (const staff of list) {
if (staff.email) {
emailList.push(staff.email);
}
}
this.staffService.delete(emailList);
//一覧再取得
this.staffList = this.staffService.getList(this.agencyId);
//↓プロトタイプで行削除の動きを見せるため
const array = []; const array = [];
for (const staff of this.staffList) { for (const staff of this.staffList) {
let del = false; let del = false;
...@@ -128,6 +125,7 @@ export class StaffListComponent implements OnInit { ...@@ -128,6 +125,7 @@ export class StaffListComponent implements OnInit {
} }
} }
this.staffList = array; this.staffList = array;
//↑
this.gridApi.setGridOption("rowData", this.staffList); this.gridApi.setGridOption("rowData", this.staffList);
} }
......
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { StaffInfoModel } from '../../model/staff-info.model'; import { StaffInfoModel } from '../../model/staff-info.model';
import { StaffService } from '../../service/staff.service';
@Component({ @Component({
selector: 'app-staff-regist', selector: 'app-staff-regist',
...@@ -31,24 +32,17 @@ export class StaffRegistComponent implements OnInit { ...@@ -31,24 +32,17 @@ export class StaffRegistComponent implements OnInit {
/** /**
* コンストラクタ * コンストラクタ
*/ */
constructor() { } constructor(private staffService: StaffService) { }
/** /**
* 初期処理 * 初期処理
*/ */
ngOnInit(): void { ngOnInit(): void {
//事業所一覧 //事業所一覧
this.agencyList = new Map(); this.agencyList = this.staffService.getAgencyList();
for (let i = 0; i < 5; i++) {
const str = String(i + 1);
this.agencyList?.set(str, "事業所" + str)
}
//権限一覧 //権限一覧
this.roleList = new Map(); this.roleList = this.staffService.getRoleList();
for (let i = 0; i < 3; i++) {
const str = String(i + 1);
this.roleList?.set(str, "権限" + str)
}
if (this.staffInfoModel !== null) { if (this.staffInfoModel !== null) {
this.agencyId = this.staffInfoModel?.agencyId; this.agencyId = this.staffInfoModel?.agencyId;
...@@ -65,6 +59,14 @@ export class StaffRegistComponent implements OnInit { ...@@ -65,6 +59,14 @@ export class StaffRegistComponent implements OnInit {
*/ */
onClickRegist(): void { onClickRegist(): void {
//担当者登録 //担当者登録
const staffInfoModel = new StaffInfoModel();
staffInfoModel.email = this.email;
staffInfoModel.password = this.password;
staffInfoModel.name = this.name;
staffInfoModel.department = this.department;
staffInfoModel.roleId = this.roleId;
staffInfoModel.agencyId = this.agencyId;
this.staffService.regist(staffInfoModel);
this.clickBack.emit(); this.clickBack.emit();
} }
...@@ -74,6 +76,14 @@ export class StaffRegistComponent implements OnInit { ...@@ -74,6 +76,14 @@ export class StaffRegistComponent implements OnInit {
*/ */
onClickUpdate(): void { onClickUpdate(): void {
//担当者更新 //担当者更新
const staffInfoModel = new StaffInfoModel();
staffInfoModel.email = this.email;
staffInfoModel.password = this.password;
staffInfoModel.name = this.name;
staffInfoModel.department = this.department;
staffInfoModel.roleId = this.roleId;
staffInfoModel.agencyId = this.agencyId;
this.staffService.update(staffInfoModel);
this.clickBack.emit(); this.clickBack.emit();
} }
......
<input type="button" class="form-control" style="width:100px;height:38px;line-height: 38px;" data-row="row"
(click)="onClickDenyList()" value="拒否リスト">
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { DenylistButtonComponent } from './denylist-button.component';
describe('DenylistButtonComponent', () => {
let component: DenylistButtonComponent;
let fixture: ComponentFixture<DenylistButtonComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [DenylistButtonComponent]
})
.compileComponents();
fixture = TestBed.createComponent(DenylistButtonComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { ICellRendererAngularComp } from 'ag-grid-angular';
import { ICellRendererParams } from 'ag-grid-community';
import { Component } from '@angular/core';
/**
* 拒否リストボタン
*/
@Component({
selector: 'app-denylist-button',
templateUrl: './denylist-button.component.html',
styleUrl: './denylist-button.component.css'
})
export class DenylistButtonComponent implements ICellRendererAngularComp {
//パラメータ
params: any;
//親コンポーネント
componentParent: any;
/**
* 初期処理
* @param params パラメータ
*/
agInit(params: ICellRendererParams): void {
console.log(params);
this.params = params;
this.componentParent = this.params.context.componentParent;
}
/**
* リフレッシュ
* @param params パラメータ
* @returns 正常かどうか
*/
refresh(params: ICellRendererParams) {
return true;
}
/**
* ボタンクリック
*/
onClickDenyList(): void {
this.componentParent.onClickDenyList(this.params.data);
}
}
<input type="button" class="form-control" style="width:100px;height:38px;line-height: 38px;" data-row="row"
(click)="onClickHistory()" value="乗車履歴">
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HistoryButtonComponent } from './history-button.component';
describe('HistoryButtonComponent', () => {
let component: HistoryButtonComponent;
let fixture: ComponentFixture<HistoryButtonComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [HistoryButtonComponent]
})
.compileComponents();
fixture = TestBed.createComponent(HistoryButtonComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { ICellRendererAngularComp } from 'ag-grid-angular';
import { ICellRendererParams } from 'ag-grid-community';
import { Component } from '@angular/core';
/**
* 乗車履歴ボタン
*/
@Component({
selector: 'app-history-button',
templateUrl: './history-button.component.html',
styleUrl: './history-button.component.css'
})
export class HistoryButtonComponent implements ICellRendererAngularComp {
//パラメータ
params: any;
//親コンポーネント
componentParent: any;
/**
* 初期処理
* @param params パラメータ
*/
agInit(params: ICellRendererParams): void {
console.log(params);
this.params = params;
this.componentParent = this.params.context.componentParent;
}
/**
* リフレッシュ
* @param params パラメータ
* @returns 正常かどうか
*/
refresh(params: ICellRendererParams) {
return true;
}
/**
* ボタンクリック
*/
onClickHistory(): void {
this.componentParent.onClickHistory(this.params.data);
}
}
<input type="button" class="form-control" style="width:80px;height:38px;line-height: 38px;" data-row="row"
(click)="onClickPass()" value="定期券">
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PassButtonComponent } from './pass-button.component';
describe('PassButtonComponent', () => {
let component: PassButtonComponent;
let fixture: ComponentFixture<PassButtonComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [PassButtonComponent]
})
.compileComponents();
fixture = TestBed.createComponent(PassButtonComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { ICellRendererAngularComp } from 'ag-grid-angular';
import { ICellRendererParams } from 'ag-grid-community';
import { Component } from '@angular/core';
/**
* 定期券ボタン
*/
@Component({
selector: 'app-pass-button',
templateUrl: './pass-button.component.html',
styleUrl: './pass-button.component.css'
})
export class PassButtonComponent implements ICellRendererAngularComp {
//パラメータ
params: any;
//親コンポーネント
componentParent: any;
/**
* 初期処理
* @param params パラメータ
*/
agInit(params: ICellRendererParams): void {
console.log(params);
this.params = params;
this.componentParent = this.params.context.componentParent;
}
/**
* リフレッシュ
* @param params パラメータ
* @returns 正常かどうか
*/
refresh(params: ICellRendererParams) {
return true;
}
/**
* ボタンクリック
*/
onClickPass(): void {
this.componentParent.onClickPass(this.params.data);
}
}
...@@ -5,6 +5,8 @@ import { HistoryButtonComponent } from './history-button/history-button.componen ...@@ -5,6 +5,8 @@ import { HistoryButtonComponent } from './history-button/history-button.componen
import { DenylistButtonComponent } from './denylist-button/denylist-button.component'; import { DenylistButtonComponent } from './denylist-button/denylist-button.component';
import { SizeColumnsToFitGridStrategy, SizeColumnsToFitProvidedWidthStrategy, SizeColumnsToContentStrategy } from 'ag-grid-community' import { SizeColumnsToFitGridStrategy, SizeColumnsToFitProvidedWidthStrategy, SizeColumnsToContentStrategy } from 'ag-grid-community'
import { PassRefundService } from '../../service/pass-refund.service'; import { PassRefundService } from '../../service/pass-refund.service';
import { PassButtonComponent } from './pass-button/pass-button.component';
import { UserService } from '../../service/user.service';
/** /**
* 利用者検索画面 * 利用者検索画面
...@@ -31,7 +33,7 @@ export class UserListComponent { ...@@ -31,7 +33,7 @@ export class UserListComponent {
{ headerName: 'フリガナ', field: "nameKana", width: 200 }, { headerName: 'フリガナ', field: "nameKana", width: 200 },
{ headerName: 'メールアドレス', field: "email", width: 200 }, { headerName: 'メールアドレス', field: "email", width: 200 },
{ headerName: '電話番号', field: "phoneNumber", width: 200 }, { headerName: '電話番号', field: "phoneNumber", width: 200 },
//{ headerName: '', field: "pass", width: 80, cellRenderer: PassButtonComponent }, { headerName: '', field: "pass", width: 80, cellRenderer: PassButtonComponent },
{ headerName: '', field: "history", width: 80, cellRenderer: HistoryButtonComponent }, { headerName: '', field: "history", width: 80, cellRenderer: HistoryButtonComponent },
{ headerName: '', field: "denyList", width: 80, cellRenderer: DenylistButtonComponent }, { headerName: '', field: "denyList", width: 80, cellRenderer: DenylistButtonComponent },
]; ];
...@@ -53,7 +55,7 @@ export class UserListComponent { ...@@ -53,7 +55,7 @@ export class UserListComponent {
/** /**
* コンストラクタ * コンストラクタ
*/ */
constructor(private passRefundService: PassRefundService) { constructor(private userService: UserService, private passRefundService: PassRefundService) {
this.context = { this.context = {
componentParent: this componentParent: this
} }
...@@ -63,16 +65,7 @@ export class UserListComponent { ...@@ -63,16 +65,7 @@ export class UserListComponent {
* 検索 * 検索
*/ */
onClickSearch(): void { onClickSearch(): void {
this.userList = []; this.userList = this.userService.getList(this.userName);
for (let i = 0; i < 10; i++) {
const str = String(i + 1);
const model = new UserInfoModel();
model.name = "山田太郎" + str;
model.nameKana = "ヤマダタロウ" + str;
model.email = "tarou_yamada" + str + "@test.com";
model.phoneNumber = "09088882456";
this.userList.push(model);
}
} }
onGridReady(params: any): void { onGridReady(params: any): void {
......
export class DenyListModel {
id?: string;
//区間
rideSection?: string;
//乗車日時
getonDt?: string;
//降車日時
getoffDt?: string;
//請求金額
billingAmount = 0;
//ステータスID
statusId?: string;
//ステータス
status?: string;
}
\ No newline at end of file
export class EarningModel {
/**
* 利用者ID
*/
cutomerId?: string;
/**
* 利用者名
*/
cutomerName?: string;
/**
* カード番号(下4桁)
*/
cardNumber?: string;
/**
* 請求番号
*/
billingNumber?: string;
/**
* 請求額
*/
billingAmount?: number;
/**
* 処理日時
*/
processDateTime?: string;
/**
* 売上日
*/
earningDate?: string;
/**
* 乗車日時
*/
getonDateTime?: string;
/**
* 降車日時
*/
getoffDateTime?: string;
/**
* 乗降明細
*/
getonoffDetail?: string;
/**
* ステータス
*/
status?: string;
/**
* NGフラグ
*/
ngFlag?: string;
/**
* 拒否リスト削除依頼
*/
delReq?: string;
}
\ No newline at end of file
export class HistoryModel {
//乗降日時
getonoffDate?: string;
//乗車/降車
getonoff?: string;
//乗降停留所ID
stopId?: string;
//乗降停留所名
stopName?: string;
//支払い金額
payment = 0;
//ステータスID
statusId?: string;
//ステータス
status?: string;
}
\ No newline at end of file
/**
* 定期券情報
*/
export class PassModel {
/**
* ID
*/
id?: string;
/**
* 経路ID
*/
routeId?: string;
/**
* 経路名
*/
routeName?: string;
/**
* 使用開始日
*/
startDate?: string;
/**
* 使用期間ID
*/
useTermId?: string;
/**
* 使用期間
*/
useTerm?: string;
/**
* 料金区分ID
*/
priceRangeId?: string;
/**
* 料金区分
*/
priceRange?: string;
/**
* 乗車区間
*/
rideSection?: string;
/**
* 乗車停留所ID
*/
getonStopId?: string;
/**
* 乗車停留所名
*/
getonStopName?: string;
/**
* 降車停留所ID
*/
getoffStopId?: string;
/**
* 降車停留所名
*/
getoffStopName?: string;
/**
* クレジットカード番号
*/
creditCardNumber?: string;
}
\ No newline at end of file
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
* 利用者情報 * 利用者情報
*/ */
export class UserInfoModel { export class UserInfoModel {
//利用者ID
customerId?: string;
//氏名 //氏名
name?: string; name?: string;
//フリガナ //フリガナ
......
import { TestBed } from '@angular/core/testing';
import { DenyListService } from './deny-list.service';
describe('DenyListService', () => {
let service: DenyListService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(DenyListService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
import { DenyListModel } from '../model/denylist.model';
@Injectable({
providedIn: 'root'
})
export class DenyListService {
/**
* 拒否リスト取得
* @param customerId 利用者ID
* @returns 拒否リスト
*/
getList(customerId: string): DenyListModel[] {
const denyList: DenyListModel[] = [];
if (customerId) {
for (let i = 0; i < 5; i++) {
const model: DenyListModel = new DenyListModel();
const str = String(i + 1);
model.id = str;
model.rideSection = "A停留所→B停留所";
model.getonDt = "2024/07/01 10:10:10";
model.getoffDt = "2024/07/01 10:20:20";
model.billingAmount = 100;
model.status = "";
denyList.push(model);
}
}
return denyList;
}
/**
* 拒否リスト削除依頼
* @param list 選択拒否リスト
*/
reqDelete(list: DenyListModel[]): void {
if (list) {
return;
}
}
}
import { TestBed } from '@angular/core/testing';
import { EarningListService } from './earning-list.service';
describe('EarningListService', () => {
let service: EarningListService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(EarningListService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
import { EarningModel } from '../model/earning.model';
@Injectable({
providedIn: 'root'
})
export class EarningListService {
/**
* トークン売上一覧取得
*/
getList(): EarningModel[] {
const earningList: EarningModel[] = [];
for (let i = 0; i < 10; i++) {
const model: EarningModel = new EarningModel();
model.cutomerName = "山田太郎";
model.cardNumber = "1234";
model.billingNumber = "1234567890";
model.billingAmount = 300;
model.processDateTime = "20240710172800";
model.earningDate = "20240710";
model.getonDateTime = "20240710070000";
model.getoffDateTime = "20240710073000";
model.getonoffDetail = "A停留所→B停留所";
if (i !== 4) {
model.status = "0";
model.ngFlag = "0";
} else {
model.status = "1";
model.ngFlag = "1";
}
if (i !== 6) {
model.status = "0";
model.delReq = "0";
} else {
model.status = "1";
model.delReq = "1";
}
earningList.push(model);
}
return earningList;
}
}
import { TestBed } from '@angular/core/testing';
import { HistoryService } from './history.service';
describe('HistoryService', () => {
let service: HistoryService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(HistoryService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
import { HistoryModel } from '../model/history.model';
@Injectable({
providedIn: 'root'
})
export class HistoryService {
/**
* 乗降一覧取得
* @param customerId 利用者ID
* @returns 乗降一覧
*/
getList(customerId: string): HistoryModel[] {
const historyList: HistoryModel[] = [];
if (customerId) {
for (let i = 0; i < 10; i++) {
const model: HistoryModel = new HistoryModel();
model.getonoffDate = "2024/07/01";
if (i % 2 === 0) {
model.getonoff = "乗車";
model.stopName = "A停留所";
} else {
model.getonoff = "降車";
model.stopName = "B停留所";
}
model.payment = 100;
model.statusId = "";
model.status = "";
historyList.push(model);
}
const model: HistoryModel = new HistoryModel();
model.getonoffDate = "2024/07/01";
model.getonoff = "乗車";
model.stopName = "A停留所";
model.payment = 100;
model.statusId = "0";
model.status = "乗車中";
historyList.push(model);
}
return historyList;
}
/**
* 乗降ステータス変更
* @param model 乗降履歴情報
*/
changeStatus(model: HistoryModel): void {
if (model) {
return;
}
}
}
import { TestBed } from '@angular/core/testing';
import { LoginService } from './login.service';
describe('LoginService', () => {
let service: LoginService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(LoginService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class LoginService {
/**
* ログイン処理
* @param email メールアドレス
* @param password パスワード
* @returns 認証成功(true)/失敗(false)
*/
login(email?: string, password?: string): boolean {
if (!email) {
alert("メールアドレスが入力されていません");
return false;
}
if (!password) {
alert("パスワードが入力されていません");
return false;
}
return true;
}
}
import { TestBed } from '@angular/core/testing';
import { PassRefundService } from './pass-refund.service';
describe('PassRefundService', () => {
let service: PassRefundService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(PassRefundService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { PassRefundComponent } from '../menu/pass-list/pass-refund/pass-refund.component';
@Injectable({
providedIn: 'root'
})
export class PassRefundService {
constructor(private modalService: NgbModal) { }
confirm(): Promise<boolean> {
const modalRef = this.modalService.open(PassRefundComponent);
return modalRef.result.then(() => {
return true;
}, () => {
return false;
});
}
}
import { TestBed } from '@angular/core/testing';
import { PassService } from './pass.service';
describe('PassService', () => {
let service: PassService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(PassService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
import { PassModel } from '../model/pass.model';
@Injectable({
providedIn: 'root'
})
export class PassService {
getList(customerId: string): PassModel[] {
const passList: PassModel[] = [];
if (customerId) {
for (let i = 0; i < 3; i++) {
const model: PassModel = new PassModel();
const str = String(i + 1);
model.id = str;
model.routeName = "【○○○系統】XXXXXX→XXXXXX行き";
model.startDate = "2024/07/01";
model.useTerm = "3ヶ月";
model.priceRange = "大人";
model.rideSection = "A停留所~B停留所";
model.getonStopName = "A停留所";
model.getoffStopName = "B停留所";
model.creditCardNumber = "**** **** **** 1234";
passList.push(model);
}
}
return passList;
}
/**
* 定期券払戻
* @param model 定期券情報
*/
refund(model: PassModel): void {
if (model) {
return;
}
}
}
import { TestBed } from '@angular/core/testing';
import { StaffService } from './staff.service';
describe('StaffService', () => {
let service: StaffService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(StaffService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
import { StaffInfoModel } from '../model/staff-info.model';
@Injectable({
providedIn: 'root'
})
export class StaffService {
/**
* 担当者一覧取得
* @param agencyId 事業者ID
* @returns 担当者情報一覧
*/
getList(agencyId?: string): StaffInfoModel[] {
const staffList: StaffInfoModel[] = [];
if (agencyId) {
for (let i = 0; i < 5; i++) {
const model = new StaffInfoModel();
model.agencyId = String(i + 1);
model.email = "test" + String(i + 1) + "@test.com";
model.name = "山田 太郎";
model.password = "00000000";
model.company = "テスト会社";
model.department = "テスト部";
model.roleId = "1";
model.roleName = "システム管理者";
staffList.push(model);
}
}
return staffList;
}
/**
* 事業者一覧取得
* @returns 事業者一覧
*/
getAgencyList(): Map<string, string> {
const agencyList = new Map();
for (let i = 0; i < 5; i++) {
const str = String(i + 1);
agencyList.set("000" + str, "事業所" + str);
}
return agencyList;
}
/**
* 権限一覧取得
* @returns 権限一覧
*/
getRoleList(): Map<string, string> {
const roleList = new Map();
for (let i = 0; i < 3; i++) {
const str = String(i + 1);
roleList?.set(str, "権限" + str)
}
return roleList;
}
/**
* 担当者登録
* @param model 担当者情報
*/
regist(model: StaffInfoModel): void {
if (model) {
return;
}
}
/**
* 担当者更新
* @param model 担当者情報
*/
update(model: StaffInfoModel): void {
if (model) {
return;
}
}
/**
* 担当者情報削除
* @param emailList メールアドレス
*/
delete(emailList: string[]): void {
if (emailList) {
return;
}
}
}
import { TestBed } from '@angular/core/testing';
import { StatusUpdateService } from './status-update.service';
describe('StatusUpdateService', () => {
let service: StatusUpdateService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(StatusUpdateService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
import { StatusUpdateComponent } from '../menu/history-list/status-update/status-update.component';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { HistoryModel } from '../model/history.model';
@Injectable({
providedIn: 'root'
})
export class StatusUpdateService {
model?: HistoryModel;
constructor(private modalService: NgbModal) { }
confirm(model: HistoryModel): Promise<boolean> {
this.model = model;
const modalRef = this.modalService.open(StatusUpdateComponent);
const component = modalRef.componentInstance as StatusUpdateComponent;
component.model = model;
component.status = model.status;
return modalRef.result.then(() => {
return true;
}, () => {
return false;
});
}
}
import { TestBed } from '@angular/core/testing';
import { UserService } from './user.service';
describe('UserService', () => {
let service: UserService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(UserService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
import { UserInfoModel } from '../model/user-info.model';
@Injectable({
providedIn: 'root'
})
export class UserService {
/**
* 利用者一覧取得
* @param name 利用者名
* @returns 利用者一覧
*/
getList(name?: string): UserInfoModel[] {
const userList: UserInfoModel[] = [];
if (name) {
for (let i = 0; i < 10; i++) {
const str = String(i + 1);
const model = new UserInfoModel();
model.customerId = str;
model.name = "山田太郎" + str;
model.nameKana = "ヤマダタロウ" + str;
model.email = "tarou_yamada" + str + "@test.com";
model.phoneNumber = "09088882456";
userList.push(model);
}
}
return userList;
}
}
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { RouteService } from '../service/route.service'; import { RouteService } from '../service/route.service';
import { LoginService } from '../service/login.service';
/** /**
* ログイン画面 * ログイン画面
...@@ -18,14 +19,15 @@ export class TopComponent { ...@@ -18,14 +19,15 @@ export class TopComponent {
/** /**
* コンストラクタ * コンストラクタ
*/ */
constructor(private routeService: RouteService) { constructor(private routeService: RouteService, private loginService: LoginService) { }
}
/** /**
* ログイン * ログイン
*/ */
onClickLogin(): void { onClickLogin(): void {
if (!this.loginService.login(this.email, this.password)) {
return;
}
this.routeService.navigateMenu(); this.routeService.navigateMenu();
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment