Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
3ae92c020c
|
|||
d098317331
|
|||
641565d8ff
|
|||
25d016c154
|
|||
39703dca22
|
|||
c06184d1b1
|
|||
1450c8fdd7
|
|||
72a3241286
|
|||
d2cf532a0e
|
|||
dbb9686312
|
|||
05823a1829
|
@ -2,6 +2,7 @@ stages:
|
||||
- check
|
||||
- build
|
||||
- dockerize
|
||||
- deploy
|
||||
|
||||
|
||||
check:
|
||||
@ -55,6 +56,7 @@ build-ui:
|
||||
- cd ui/hv2-ui
|
||||
- if [ "$CI_COMMIT_TAG" != "" ]; then
|
||||
sed -i -e 's/GITTAGVERSION/'"$CI_COMMIT_TAG"':'"$CI_COMMIT_SHORT_SHA"'/' ./src/app/navigation/navigation.component.html;
|
||||
sed -i -e 's,http://localhost:8080,https://api.hv.nober.de,' ./src/app/config.ts;
|
||||
fi
|
||||
- npm install
|
||||
- ./node_modules/.bin/ng build --prod
|
||||
@ -80,4 +82,40 @@ dockerize-ui:
|
||||
docker push $IMAGE_NAME:${CI_COMMIT_TAG};
|
||||
fi
|
||||
|
||||
.deploy:
|
||||
image: registry.hottis.de/dockerized/docker-bash:latest
|
||||
stage: deploy
|
||||
tags:
|
||||
- hottis
|
||||
- linux
|
||||
- docker
|
||||
only:
|
||||
- tags
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
script:
|
||||
- docker stop $CONTAINER_NAME || echo "container not running, never mind"
|
||||
- docker rm $CONTAINER_NAME || echo "container not existing, never mind"
|
||||
- docker run -d --network docker-server
|
||||
--ip $CONTAINER_IP
|
||||
$VOLUMEOPT
|
||||
--name $CONTAINER_NAME
|
||||
--restart always
|
||||
$IMAGE_NAME:$CI_COMMIT_TAG
|
||||
|
||||
deploy-api:
|
||||
extends:
|
||||
- .deploy
|
||||
variables:
|
||||
IMAGE_NAME: ${CI_REGISTRY}/${CI_PROJECT_PATH}/api
|
||||
CONTAINER_NAME: hv2-api
|
||||
CONTAINER_IP: 172.16.10.38
|
||||
VOLUMEOPT: -v hv2-api-conf:/opt/app/config
|
||||
|
||||
deploy-ui:
|
||||
extends:
|
||||
- .deploy
|
||||
variables:
|
||||
IMAGE_NAME: ${CI_REGISTRY}/${CI_PROJECT_PATH}/ui
|
||||
CONTAINER_NAME: hv2-ui
|
||||
CONTAINER_IP: 172.16.10.39
|
||||
|
@ -1519,26 +1519,37 @@ components:
|
||||
type: integer
|
||||
salutation:
|
||||
type: string
|
||||
nullable: true
|
||||
firstname:
|
||||
type: string
|
||||
nullable: true
|
||||
lastname:
|
||||
type: string
|
||||
nullable: true
|
||||
address1:
|
||||
type: string
|
||||
nullable: true
|
||||
address2:
|
||||
type: string
|
||||
nullable: true
|
||||
address3:
|
||||
type: string
|
||||
nullable: true
|
||||
zip:
|
||||
type: string
|
||||
nullable: true
|
||||
city:
|
||||
type: string
|
||||
nullable: true
|
||||
phone1:
|
||||
type: string
|
||||
nullable: true
|
||||
phone2:
|
||||
type: string
|
||||
nullable: true
|
||||
iban:
|
||||
type: string
|
||||
nullable: true
|
||||
account:
|
||||
type: integer
|
||||
premise:
|
||||
@ -1549,6 +1560,7 @@ components:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
nullable: true
|
||||
street:
|
||||
type: string
|
||||
zip:
|
||||
@ -1563,12 +1575,15 @@ components:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
nullable: true
|
||||
premise:
|
||||
type: integer
|
||||
nullable: true
|
||||
area:
|
||||
type: number
|
||||
flat_no:
|
||||
type: integer
|
||||
nullable: true
|
||||
overhead_advance:
|
||||
description: overhead_advance
|
||||
type: object
|
||||
@ -1577,12 +1592,15 @@ components:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
nullable: true
|
||||
amount:
|
||||
type: number
|
||||
startdate:
|
||||
type: string
|
||||
nullable: true
|
||||
enddate:
|
||||
type: string
|
||||
nullable: true
|
||||
overhead_advance_flat_mapping:
|
||||
description: overhead_advance_flat_mapping
|
||||
type: object
|
||||
@ -1601,8 +1619,10 @@ components:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
nullable: true
|
||||
premise:
|
||||
type: integer
|
||||
nullable: true
|
||||
commercial_premise:
|
||||
description: commercial_premise
|
||||
type: object
|
||||
@ -1611,8 +1631,10 @@ components:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
nullable: true
|
||||
premise:
|
||||
type: integer
|
||||
nullable: true
|
||||
tenancy:
|
||||
description: tenancy
|
||||
type: object
|
||||
@ -1621,18 +1643,23 @@ components:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
nullable: true
|
||||
tenant:
|
||||
type: integer
|
||||
flat:
|
||||
type: integer
|
||||
nullable: true
|
||||
parking:
|
||||
type: integer
|
||||
nullable: true
|
||||
commercial_premise:
|
||||
type: integer
|
||||
nullable: true
|
||||
startdate:
|
||||
type: string
|
||||
enddate:
|
||||
type: string
|
||||
nullable: true
|
||||
fee:
|
||||
description: fee
|
||||
type: object
|
||||
@ -1641,14 +1668,17 @@ components:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
nullable: true
|
||||
amount:
|
||||
type: number
|
||||
fee_type:
|
||||
type: string
|
||||
startdate:
|
||||
type: string
|
||||
nullable: true
|
||||
enddate:
|
||||
type: string
|
||||
nullable: true
|
||||
tenancy_fee_mapping:
|
||||
description: tenancy_fee_mapping
|
||||
type: object
|
||||
|
@ -151,5 +151,8 @@ components:
|
||||
#for $column in $table.columns
|
||||
$column.name:
|
||||
type: $column.apitype
|
||||
#if (('notnull' not in $column) or (not $column.notnull))
|
||||
nullable: true
|
||||
#end if
|
||||
#end for
|
||||
#end for
|
||||
|
@ -3,10 +3,16 @@ from flask_cors import CORS
|
||||
|
||||
# instantiate the webservice
|
||||
app = connexion.App(__name__)
|
||||
app.add_api('openapi.yaml')
|
||||
app.add_api('openapi.yaml', options = {"swagger_ui": False})
|
||||
|
||||
# CORSify it - otherwise Angular won't accept it
|
||||
CORS(app.app)
|
||||
CORS(app.app,
|
||||
origins=[
|
||||
"http://localhost:4200",
|
||||
"https://base.hv.nober.de"
|
||||
],
|
||||
supports_credentials=True
|
||||
)
|
||||
|
||||
# provide the webservice application to uwsgi
|
||||
application = app.app
|
||||
|
@ -3,7 +3,7 @@
|
||||
[attr.role]="(isHandset$ | async) ? 'dialog' : 'navigation'"
|
||||
[mode]="(isHandset$ | async) ? 'over' : 'side'"
|
||||
[opened]="(isHandset$ | async) === false">
|
||||
<mat-toolbar>Menu</mat-toolbar>
|
||||
<mat-toolbar *ngIf="authenticated">Menu</mat-toolbar>
|
||||
<mat-nav-list>
|
||||
<a mat-list-item href="/tenants">Meine Mieter/innen</a>
|
||||
</mat-nav-list><mat-divider></mat-divider><mat-nav-list>
|
||||
|
@ -98,7 +98,8 @@
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<mat-accordion>
|
||||
<mat-expansion-panel (opened)="collapseTenancies = true"
|
||||
<mat-expansion-panel #panelTenancies
|
||||
(opened)="collapseTenancies = true"
|
||||
(closed)="collapseTenancies = false">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title *ngIf="!collapseTenancies">
|
||||
@ -138,6 +139,54 @@
|
||||
</table>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
<mat-expansion-panel #panelAddMapping
|
||||
(opened)="openTenancyMapping()"
|
||||
(closed)="closeTenancyMapping()">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title *ngIf="!collapseTenancyMapping">
|
||||
Mietverhältnis hinzufügen
|
||||
</mat-panel-title>
|
||||
<mat-panel-description>
|
||||
</mat-panel-description>
|
||||
</mat-expansion-panel-header>
|
||||
<div>
|
||||
<form (ngSubmit)="addTenancyToTenant()">
|
||||
<div>
|
||||
<mat-form-field appearance="outline" id="setenddatefield">
|
||||
<mat-label>Beginn</mat-label>
|
||||
<input matInput name="startdate" [(ngModel)]="newTenancy.startdate" [matDatepicker]="newtenancystartdatepicker"/>
|
||||
<mat-datepicker-toggle matSuffix [for]="newtenancystartdatepicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #newtenancystartdatepicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Beschreibung</mat-label>
|
||||
<input matInput name="description" [(ngModel)]="newTenancy.description"/>
|
||||
</mat-form-field>
|
||||
</div><div>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-select #mapSelect [(ngModel)]="newTenancy.flat" name="flat" (selectionChange)="flatSelected()">
|
||||
<mat-label>Wohnung</mat-label>
|
||||
<mat-option *ngFor="let p of allFlats" [value]="p.rawFlat.id">{{p.rawFlat.description}} {{p.premise}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Garage</mat-label>
|
||||
<mat-select #mapSelect [(ngModel)]="newTenancy.parking" name="parking" (selectionChange)="parkingSelected()">
|
||||
<mat-option *ngFor="let p of allParkings" [value]="p.rawParking.id">{{p.rawParking.description}} {{p.premise}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Büro</mat-label>
|
||||
<mat-select #mapSelect [(ngModel)]="newTenancy.commercial_premise" name="commercial_premise" (selectionChange)="commercialPremiseSelected()">
|
||||
<mat-option *ngFor="let p of allCommercialPremises" [value]="p.rawCommercialPremise.id">{{p.rawCommercialPremise.description}} {{p.premise}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
<button #addTenancyToTenantButton type="submit" mat-raised-button color="primary">Anlegen</button>
|
||||
</form>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
</mat-accordion>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
@ -6,6 +6,7 @@ import { MessageService } from '../message.service';
|
||||
import { MatButton } from '@angular/material/button';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { ExtApiService } from '../ext-data-object-service';
|
||||
import { MatExpansionPanel } from '@angular/material/expansion';
|
||||
|
||||
|
||||
interface DN_Tenancy {
|
||||
@ -15,6 +16,21 @@ interface DN_Tenancy {
|
||||
commercialPremise: string
|
||||
}
|
||||
|
||||
interface DN_Flat {
|
||||
rawFlat: Flat
|
||||
premise: string
|
||||
}
|
||||
|
||||
interface DN_Parking {
|
||||
rawParking: Parking
|
||||
premise: string
|
||||
}
|
||||
|
||||
interface DN_CommercialPremise {
|
||||
rawCommercialPremise: CommercialPremise
|
||||
premise: string
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-tenant-details',
|
||||
templateUrl: './tenant-details.component.html',
|
||||
@ -27,12 +43,15 @@ export class TenantDetailsComponent implements OnInit {
|
||||
|
||||
account: Account = NULL_Account
|
||||
|
||||
premisesMap: Map<number, Premise>
|
||||
|
||||
tenancies: DN_Tenancy[]
|
||||
tenancyDataSource: MatTableDataSource<DN_Tenancy>
|
||||
tenancyDisplayColumns: string[] = [ "description", "flat", "parking", "commercial_premise", "startdate", "enddate" ]
|
||||
|
||||
collapseTenantDetails: boolean = false
|
||||
collapseTenancies: boolean = false
|
||||
collapseTenancyMapping: boolean = false
|
||||
|
||||
selectedTenancy: Tenancy = undefined
|
||||
mappedFees: Fee[]
|
||||
@ -41,9 +60,15 @@ export class TenantDetailsComponent implements OnInit {
|
||||
allFees: Fee[]
|
||||
selectedFee: number
|
||||
|
||||
newTenancy: Tenancy = NULL_Tenancy
|
||||
allFlats: DN_Flat[]
|
||||
allParkings: DN_Parking[]
|
||||
allCommercialPremises: DN_CommercialPremise[]
|
||||
|
||||
@ViewChild('submitButton') submitButton: MatButton
|
||||
@ViewChild('mapFeeButton') mapFeeButton: MatButton
|
||||
@ViewChild('panelTenancies') panelTenancies: MatExpansionPanel
|
||||
@ViewChild('panelAddMapping') panelAddMapping: MatExpansionPanel
|
||||
|
||||
constructor(
|
||||
private tenantService: TenantService,
|
||||
@ -78,20 +103,16 @@ export class TenantDetailsComponent implements OnInit {
|
||||
async getTenancies(): Promise<void> {
|
||||
try {
|
||||
this.tenancies = []
|
||||
const premises: Premise[] = await this.premiseService.getPremises()
|
||||
const premisesDict = new Map<number, Premise>()
|
||||
for (let p of premises) {
|
||||
premisesDict.set(p.id, p)
|
||||
}
|
||||
await this.getPremises()
|
||||
for (let t of await this.tenancyService.getTenancysByTenant(this.tenant.id)) {
|
||||
const flat: Flat = (t.flat) ? await this.flatService.getFlat(t.flat) : NULL_Flat
|
||||
const parking: Parking = (t.parking) ? await this.parkingService.getParking(t.parking) : NULL_Parking
|
||||
const commercialPremise: CommercialPremise = (t.commercial_premise) ? await this.commercialPremiseService.getCommercialPremise(t.commercial_premise) : NULL_CommercialPremise
|
||||
this.tenancies.push({
|
||||
rawTenancy: t,
|
||||
flat: (flat != NULL_Flat) ? `${flat.description} (${premisesDict.get(flat.premise).description})` : '',
|
||||
parking: (parking != NULL_Parking) ? `${parking.description} (${premisesDict.get(parking.premise).description})` : '',
|
||||
commercialPremise: (commercialPremise != NULL_CommercialPremise) ? `${commercialPremise.description} (${premisesDict.get(commercialPremise.premise).description})` : ''
|
||||
flat: (flat != NULL_Flat) ? `${flat.description} (${this.premisesMap.get(flat.premise).description})` : '',
|
||||
parking: (parking != NULL_Parking) ? `${parking.description} (${this.premisesMap.get(parking.premise).description})` : '',
|
||||
commercialPremise: (commercialPremise != NULL_CommercialPremise) ? `${commercialPremise.description} (${this.premisesMap.get(commercialPremise.premise).description})` : ''
|
||||
})
|
||||
}
|
||||
this.tenancyDataSource = new MatTableDataSource<DN_Tenancy>(this.tenancies)
|
||||
@ -156,7 +177,25 @@ export class TenantDetailsComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
async addFee() {
|
||||
async getPremises(): Promise<void> {
|
||||
if ((! this.premisesMap) || (this.premisesMap.size == 0)) {
|
||||
try {
|
||||
this.messageService.add("Trying to load premises")
|
||||
const premises = await this.premiseService.getPremises()
|
||||
this.premisesMap = new Map<number, Premise>()
|
||||
for (let p of premises) {
|
||||
this.premisesMap.set(p.id, p)
|
||||
}
|
||||
this.messageService.add("Premises loaded")
|
||||
} catch (err) {
|
||||
this.messageService.add(`Error in getPremises: ${ JSON.stringify(err, undefined, 4) }`)
|
||||
}
|
||||
} else {
|
||||
this.messageService.add("Premises already loaded")
|
||||
}
|
||||
}
|
||||
|
||||
async addFee(): Promise<void> {
|
||||
try {
|
||||
this.mapFeeButton.disabled = true
|
||||
this.messageService.add(`fee: ${ JSON.stringify(this.selectedFee, undefined, 4) }`)
|
||||
@ -174,6 +213,79 @@ export class TenantDetailsComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
async openTenancyMapping(): Promise<void> {
|
||||
this.messageService.add("TenancyMapping opened")
|
||||
this.collapseTenancyMapping = true
|
||||
await this.getPremises()
|
||||
if (! this.allFlats) {
|
||||
let flats = await this.flatService.getFlats()
|
||||
this.allFlats = []
|
||||
for (let p of flats) {
|
||||
this.allFlats.push({
|
||||
rawFlat: p,
|
||||
premise: this.premisesMap.get(p.premise).description
|
||||
})
|
||||
}
|
||||
}
|
||||
if (! this.allParkings) {
|
||||
let parkings = await this.parkingService.getParkings()
|
||||
this.allParkings = []
|
||||
for (let p of parkings) {
|
||||
this.allParkings.push({
|
||||
rawParking: p,
|
||||
premise: this.premisesMap.get(p.premise).description
|
||||
})
|
||||
}
|
||||
}
|
||||
if (! this.allCommercialPremises) {
|
||||
let commercialPremises = await this.commercialPremiseService.getCommercialPremises()
|
||||
this.allCommercialPremises = []
|
||||
for (let p of commercialPremises) {
|
||||
this.allCommercialPremises.push({
|
||||
rawCommercialPremise: p,
|
||||
premise: this.premisesMap.get(p.premise).description
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async closeTenancyMapping(): Promise<void> {
|
||||
this.messageService.add("TenancyMapping closed")
|
||||
this.collapseTenancyMapping = false
|
||||
|
||||
}
|
||||
|
||||
flatSelected(): void {
|
||||
this.newTenancy.parking = null
|
||||
this.newTenancy.commercial_premise = null
|
||||
}
|
||||
|
||||
parkingSelected(): void {
|
||||
this.newTenancy.flat = null
|
||||
this.newTenancy.commercial_premise = null
|
||||
}
|
||||
|
||||
commercialPremiseSelected(): void {
|
||||
this.newTenancy.parking = null
|
||||
this.newTenancy.flat = null
|
||||
}
|
||||
|
||||
async addTenancyToTenant(): Promise<void> {
|
||||
try {
|
||||
this.messageService.add(`Going to mapping ${JSON.stringify(this.newTenancy, undefined, 4)}`)
|
||||
this.newTenancy.tenant = this.tenant.id
|
||||
this.messageService.add(`new tenancy is ${JSON.stringify(this.newTenancy, undefined, 4)}`)
|
||||
this.newTenancy = await this.tenancyService.postTenancy(this.newTenancy)
|
||||
this.messageService.add(`New tenancy added with id ${this.newTenancy.id}`)
|
||||
this.panelAddMapping.close()
|
||||
this.panelTenancies.open()
|
||||
this.getTenancies()
|
||||
} catch (err) {
|
||||
this.messageService.add(`Error in addTenancyToTenant: ${ JSON.stringify(err, undefined, 4)}`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ngOnInit(): void {
|
||||
this.getTenant()
|
||||
this.getFees()
|
||||
|
Reference in New Issue
Block a user