@sneat/ext-assetus-components 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/index.js +2 -0
- package/esm2022/index.js.map +1 -0
- package/esm2022/lib/asset-add/add-asset-base-component.js +48 -0
- package/esm2022/lib/asset-add/add-asset-base-component.js.map +1 -0
- package/esm2022/lib/asset-add/asset-add-document/asset-add-document.component.js +166 -0
- package/esm2022/lib/asset-add/asset-add-document/asset-add-document.component.js.map +1 -0
- package/esm2022/lib/asset-add/asset-add-dwelling/asset-add-dwelling.component.js +115 -0
- package/esm2022/lib/asset-add/asset-add-dwelling/asset-add-dwelling.component.js.map +1 -0
- package/esm2022/lib/asset-add/asset-add-vehicle/asset-add-vehicle.component.js +173 -0
- package/esm2022/lib/asset-add/asset-add-vehicle/asset-add-vehicle.component.js.map +1 -0
- package/esm2022/lib/asset-add/index.js +4 -0
- package/esm2022/lib/asset-add/index.js.map +1 -0
- package/esm2022/lib/asset-base-page.js +30 -0
- package/esm2022/lib/asset-base-page.js.map +1 -0
- package/esm2022/lib/asset-card/asset-card.component.js +41 -0
- package/esm2022/lib/asset-card/asset-card.component.js.map +1 -0
- package/esm2022/lib/asset-component-base-params.js +16 -0
- package/esm2022/lib/asset-component-base-params.js.map +1 -0
- package/esm2022/lib/asset-possesion-card/asset-possession-card.component.js +36 -0
- package/esm2022/lib/asset-possesion-card/asset-possession-card.component.js.map +1 -0
- package/esm2022/lib/asset-reg-number-input/asset-reg-number-input.component.js +118 -0
- package/esm2022/lib/asset-reg-number-input/asset-reg-number-input.component.js.map +1 -0
- package/esm2022/lib/assets-list/assets-list.component.js +138 -0
- package/esm2022/lib/assets-list/assets-list.component.js.map +1 -0
- package/esm2022/lib/edit-dwelling-card/edit-dwelling-card.component.js +121 -0
- package/esm2022/lib/edit-dwelling-card/edit-dwelling-card.component.js.map +1 -0
- package/esm2022/lib/index.js +14 -0
- package/esm2022/lib/index.js.map +1 -0
- package/esm2022/lib/make-model-card/make-model-card.component.js +68 -0
- package/esm2022/lib/make-model-card/make-model-card.component.js.map +1 -0
- package/esm2022/lib/mileage-dialog/mileage-dialog.component.js +128 -0
- package/esm2022/lib/mileage-dialog/mileage-dialog.component.js.map +1 -0
- package/esm2022/lib/period-segment/period-segment.component.js +24 -0
- package/esm2022/lib/period-segment/period-segment.component.js.map +1 -0
- package/esm2022/lib/real-estate-location/real-estate-location.component.js +22 -0
- package/esm2022/lib/real-estate-location/real-estate-location.component.js.map +1 -0
- package/esm2022/lib/services/asset-service.dto.js +2 -0
- package/esm2022/lib/services/asset-service.dto.js.map +1 -0
- package/esm2022/lib/services/asset-service.js +59 -0
- package/esm2022/lib/services/asset-service.js.map +1 -0
- package/esm2022/lib/services/assetus-services.module.js +17 -0
- package/esm2022/lib/services/assetus-services.module.js.map +1 -0
- package/esm2022/lib/services/assetus-space.service.js +18 -0
- package/esm2022/lib/services/assetus-space.service.js.map +1 -0
- package/esm2022/lib/services/index.js +5 -0
- package/esm2022/lib/services/index.js.map +1 -0
- package/esm2022/lib/vehicle-card/vehicle-card.component.js +160 -0
- package/esm2022/lib/vehicle-card/vehicle-card.component.js.map +1 -0
- package/esm2022/lib/vehicle-engine/vehicle-engine.component.js +98 -0
- package/esm2022/lib/vehicle-engine/vehicle-engine.component.js.map +1 -0
- package/esm2022/sneat-ext-assetus-components.js +5 -0
- package/esm2022/sneat-ext-assetus-components.js.map +1 -0
- package/index.d.ts +1 -0
- package/lib/asset-add/add-asset-base-component.d.ts +20 -0
- package/lib/asset-add/asset-add-document/asset-add-document.component.d.ts +26 -0
- package/lib/asset-add/asset-add-dwelling/asset-add-dwelling.component.d.ts +16 -0
- package/lib/asset-add/asset-add-vehicle/asset-add-vehicle.component.d.ts +26 -0
- package/lib/asset-add/index.d.ts +3 -0
- package/lib/asset-base-page.d.ts +15 -0
- package/lib/asset-card/asset-card.component.d.ts +13 -0
- package/lib/asset-component-base-params.d.ts +9 -0
- package/lib/asset-possesion-card/asset-possession-card.component.d.ts +12 -0
- package/lib/asset-reg-number-input/asset-reg-number-input.component.d.ts +31 -0
- package/lib/assets-list/assets-list.component.d.ts +25 -0
- package/lib/edit-dwelling-card/edit-dwelling-card.component.d.ts +23 -0
- package/lib/index.d.ts +13 -0
- package/lib/make-model-card/make-model-card.component.d.ts +20 -0
- package/lib/mileage-dialog/mileage-dialog.component.d.ts +33 -0
- package/lib/period-segment/period-segment.component.d.ts +10 -0
- package/lib/real-estate-location/real-estate-location.component.d.ts +7 -0
- package/lib/services/asset-service.d.ts +19 -0
- package/lib/services/asset-service.dto.d.ts +23 -0
- package/lib/services/assetus-services.module.d.ts +6 -0
- package/lib/services/assetus-space.service.d.ts +10 -0
- package/lib/services/index.d.ts +4 -0
- package/lib/vehicle-card/vehicle-card.component.d.ts +34 -0
- package/lib/vehicle-engine/vehicle-engine.component.d.ts +14 -0
- package/package.json +27 -0
- package/sneat-ext-assetus-components.d.ts +5 -0
- package/tsconfig.lib.prod.tsbuildinfo +1 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, Output, } from '@angular/core';
|
|
2
|
+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
3
|
+
import { IonCard, IonInput, IonItem, IonList } from '@ionic/angular/standalone';
|
|
4
|
+
import { CountrySelectorComponent } from '@sneat/components';
|
|
5
|
+
import { AssetPossessionCardComponent } from '../asset-possesion-card/asset-possession-card.component';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
import * as i1 from "@angular/forms";
|
|
8
|
+
export class AddDwellingCardComponent {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.dwellingAssetChange = new EventEmitter();
|
|
11
|
+
this.title = '';
|
|
12
|
+
this.address = '';
|
|
13
|
+
this.rent_price_currency = 'USD';
|
|
14
|
+
}
|
|
15
|
+
ngOnChanges(changes) {
|
|
16
|
+
const spaceChanges = changes['space'];
|
|
17
|
+
if (spaceChanges &&
|
|
18
|
+
this.space?.dbo?.countryID &&
|
|
19
|
+
this.dwellingAsset?.dbo &&
|
|
20
|
+
!this.dwellingAsset.dbo.countryID) {
|
|
21
|
+
this.dwellingAsset = {
|
|
22
|
+
...this.dwellingAsset,
|
|
23
|
+
dbo: { ...this.dwellingAsset.dbo, countryID: this.space.dbo.countryID },
|
|
24
|
+
};
|
|
25
|
+
this.dwellingAssetChange.emit(this.dwellingAsset);
|
|
26
|
+
}
|
|
27
|
+
if (changes['dwellingAsset']) {
|
|
28
|
+
this.title = this.dwellingAsset?.dbo?.title || '';
|
|
29
|
+
this.address = this.dwellingAsset?.dbo?.extra?.address?.lines || '';
|
|
30
|
+
this.rent_price_amount =
|
|
31
|
+
this.dwellingAsset?.dbo?.extra?.rent_price?.value;
|
|
32
|
+
this.rent_price_currency =
|
|
33
|
+
this.dwellingAsset?.dbo?.extra?.rent_price?.currency || 'USD';
|
|
34
|
+
this.number_of_bedrooms =
|
|
35
|
+
this.dwellingAsset?.dbo?.extra?.numberOfBedrooms;
|
|
36
|
+
this.areaSqM = this.dwellingAsset?.dbo?.extra?.areaSqM;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
onBriefFieldChanged(field, value) {
|
|
40
|
+
if (this.dwellingAsset?.dbo) {
|
|
41
|
+
this.dwellingAsset = {
|
|
42
|
+
...this.dwellingAsset,
|
|
43
|
+
dbo: {
|
|
44
|
+
...this.dwellingAsset.dbo,
|
|
45
|
+
[field]: value,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
this.dwellingAssetChange.emit(this.dwellingAsset);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
onExtraFieldChanged(field, value) {
|
|
52
|
+
if (this.dwellingAsset?.dbo && this.dwellingAsset?.dbo?.extra) {
|
|
53
|
+
this.dwellingAsset = {
|
|
54
|
+
...this.dwellingAsset,
|
|
55
|
+
dbo: {
|
|
56
|
+
...this.dwellingAsset.dbo,
|
|
57
|
+
extra: {
|
|
58
|
+
...this.dwellingAsset.dbo.extra,
|
|
59
|
+
[field]: value,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
this.dwellingAssetChange.emit(this.dwellingAsset);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
onRentPriceFieldChanged(field, value) {
|
|
67
|
+
if (this.dwellingAsset?.dbo?.extra?.rent_price) {
|
|
68
|
+
this.dwellingAsset = {
|
|
69
|
+
...this.dwellingAsset,
|
|
70
|
+
dbo: {
|
|
71
|
+
...this.dwellingAsset.dbo,
|
|
72
|
+
extra: {
|
|
73
|
+
...this.dwellingAsset.dbo.extra,
|
|
74
|
+
rent_price: {
|
|
75
|
+
...this.dwellingAsset.dbo.extra.rent_price,
|
|
76
|
+
[field]: value,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
this.dwellingAssetChange.emit(this.dwellingAsset);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
onCountryChanged(value) {
|
|
85
|
+
if (this.dwellingAsset?.dbo) {
|
|
86
|
+
this.dwellingAsset = {
|
|
87
|
+
...this.dwellingAsset,
|
|
88
|
+
dbo: { ...this.dwellingAsset.dbo, countryID: value },
|
|
89
|
+
};
|
|
90
|
+
this.dwellingAssetChange.emit(this.dwellingAsset);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
onAssetChanged(asset) {
|
|
94
|
+
this.dwellingAsset = asset;
|
|
95
|
+
this.dwellingAssetChange.emit(this.dwellingAsset);
|
|
96
|
+
}
|
|
97
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: AddDwellingCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
98
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: AddDwellingCardComponent, isStandalone: true, selector: "sneat-edit-dwelling-card", inputs: { space: "space", dwellingAsset: "dwellingAsset" }, outputs: { dwellingAssetChange: "dwellingAssetChange" }, usesOnChanges: true, ngImport: i0, template: "<ion-card>\n <ion-list>\n <ion-item>\n <ion-input\n label=\"Title\"\n placeholder=\"Dwelling Title\"\n [(ngModel)]=\"this.title\"\n (ngModelChange)=\"onBriefFieldChanged('title', $event)\"\n />\n </ion-item>\n <sneat-country-selector\n [countryID]=\"dwellingAsset?.brief?.countryID\"\n [readonly]=\"!!dwellingAsset?.brief?.countryID\"\n [defaultCountryID]=\"space?.dbo?.countryID\"\n label=\"Country\"\n (countryIDChange)=\"onCountryChanged($event)\"\n />\n <ion-item>\n <ion-input\n label=\"Address\"\n placeholder=\"Address\"\n [(ngModel)]=\"this.address\"\n (ngModelChange)=\"onExtraFieldChanged('address', $event)\"\n />\n </ion-item>\n </ion-list>\n</ion-card>\n\n<sneat-asset-possession-card\n [asset]=\"dwellingAsset\"\n (assetChange)=\"onAssetChanged($event)\"\n/>\n\n<ion-card>\n <ion-list>\n @if (dwellingAsset?.dbo?.possession === \"renting\") {\n <ion-item>\n <ion-input\n label=\"Rent price\"\n placeholder=\"Rent price\"\n [(ngModel)]=\"this.rent_price_amount\"\n (ngModelChange)=\"onRentPriceFieldChanged('value', $event)\"\n />\n </ion-item>\n }\n <ion-item>\n <ion-input\n label=\"Number of bedrooms\"\n placeholder=\"Number of bedrooms\"\n [(ngModel)]=\"this.number_of_bedrooms\"\n (ngModelChange)=\"onExtraFieldChanged('numberOfBedrooms', $event)\"\n />\n </ion-item>\n <ion-item>\n <ion-input\n label=\"Area\"\n placeholder=\"Area\"\n [(ngModel)]=\"this.areaSqM\"\n (ngModelChange)=\"onExtraFieldChanged('areaSqM', $event)\"\n />\n </ion-item>\n </ion-list>\n</ion-card>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: CountrySelectorComponent, selector: "sneat-country-selector", inputs: ["countryID", "defaultCountryID", "readonly", "disabled", "label", "canBeUnknown"], outputs: ["countryIDChange"] }, { kind: "component", type: AssetPossessionCardComponent, selector: "sneat-asset-possession-card", inputs: ["asset"], outputs: ["assetChange"] }, { kind: "component", type: IonCard, selector: "ion-card", inputs: ["button", "color", "disabled", "download", "href", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonList, selector: "ion-list", inputs: ["inset", "lines", "mode"] }, { kind: "component", type: IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }] }); }
|
|
99
|
+
}
|
|
100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: AddDwellingCardComponent, decorators: [{
|
|
101
|
+
type: Component,
|
|
102
|
+
args: [{ selector: 'sneat-edit-dwelling-card', imports: [
|
|
103
|
+
FormsModule,
|
|
104
|
+
ReactiveFormsModule,
|
|
105
|
+
CountrySelectorComponent,
|
|
106
|
+
AssetPossessionCardComponent,
|
|
107
|
+
IonCard,
|
|
108
|
+
IonList,
|
|
109
|
+
IonItem,
|
|
110
|
+
IonInput,
|
|
111
|
+
], template: "<ion-card>\n <ion-list>\n <ion-item>\n <ion-input\n label=\"Title\"\n placeholder=\"Dwelling Title\"\n [(ngModel)]=\"this.title\"\n (ngModelChange)=\"onBriefFieldChanged('title', $event)\"\n />\n </ion-item>\n <sneat-country-selector\n [countryID]=\"dwellingAsset?.brief?.countryID\"\n [readonly]=\"!!dwellingAsset?.brief?.countryID\"\n [defaultCountryID]=\"space?.dbo?.countryID\"\n label=\"Country\"\n (countryIDChange)=\"onCountryChanged($event)\"\n />\n <ion-item>\n <ion-input\n label=\"Address\"\n placeholder=\"Address\"\n [(ngModel)]=\"this.address\"\n (ngModelChange)=\"onExtraFieldChanged('address', $event)\"\n />\n </ion-item>\n </ion-list>\n</ion-card>\n\n<sneat-asset-possession-card\n [asset]=\"dwellingAsset\"\n (assetChange)=\"onAssetChanged($event)\"\n/>\n\n<ion-card>\n <ion-list>\n @if (dwellingAsset?.dbo?.possession === \"renting\") {\n <ion-item>\n <ion-input\n label=\"Rent price\"\n placeholder=\"Rent price\"\n [(ngModel)]=\"this.rent_price_amount\"\n (ngModelChange)=\"onRentPriceFieldChanged('value', $event)\"\n />\n </ion-item>\n }\n <ion-item>\n <ion-input\n label=\"Number of bedrooms\"\n placeholder=\"Number of bedrooms\"\n [(ngModel)]=\"this.number_of_bedrooms\"\n (ngModelChange)=\"onExtraFieldChanged('numberOfBedrooms', $event)\"\n />\n </ion-item>\n <ion-item>\n <ion-input\n label=\"Area\"\n placeholder=\"Area\"\n [(ngModel)]=\"this.areaSqM\"\n (ngModelChange)=\"onExtraFieldChanged('areaSqM', $event)\"\n />\n </ion-item>\n </ion-list>\n</ion-card>\n" }]
|
|
112
|
+
}], propDecorators: { space: [{
|
|
113
|
+
type: Input,
|
|
114
|
+
args: [{ required: true }]
|
|
115
|
+
}], dwellingAsset: [{
|
|
116
|
+
type: Input,
|
|
117
|
+
args: [{ required: true }]
|
|
118
|
+
}], dwellingAssetChange: [{
|
|
119
|
+
type: Output
|
|
120
|
+
}] } });
|
|
121
|
+
//# sourceMappingURL=edit-dwelling-card.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-dwelling-card.component.js","sourceRoot":"","sources":["../../../../../../../../libs/extensions/assetus/components/src/lib/edit-dwelling-card/edit-dwelling-card.component.ts","../../../../../../../../libs/extensions/assetus/components/src/lib/edit-dwelling-card/edit-dwelling-card.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,KAAK,EAEL,MAAM,GAEP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAG7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,yDAAyD,CAAC;;;AAgBvG,MAAM,OAAO,wBAAwB;IAdrC;QAkBqB,wBAAmB,GAAG,IAAI,YAAY,EAAiB,CAAC;QAEjE,UAAK,GAAG,EAAE,CAAC;QACX,YAAO,GAAG,EAAE,CAAC;QAEb,wBAAmB,GAAG,KAAK,CAAC;KA8FvC;IA1FC,WAAW,CAAC,OAAsB;QAChC,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;QACtC,IACE,YAAY;YACZ,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS;YAC1B,IAAI,CAAC,aAAa,EAAE,GAAG;YACvB,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,EACjC,CAAC;YACD,IAAI,CAAC,aAAa,GAAG;gBACnB,GAAG,IAAI,CAAC,aAAa;gBACrB,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE;aACxE,CAAC;YACF,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC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AES,cAAc,CAAC,KAAoB;QAC3C,IAAI,CAAC,aAAa,GAAG,KAA8B,CAAC;QACpD,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACpD,CAAC;8GAtGU,wBAAwB;kGAAxB,wBAAwB,8NC7BrC,6uDA+DA,2CD5CI,WAAW,8VACX,mBAAmB,+BACnB,wBAAwB,6LACxB,4BAA4B,qHAC5B,OAAO,yLACP,OAAO,yFACP,OAAO,0NACP,QAAQ;;2FAGC,wBAAwB;kBAdpC,SAAS;+BACE,0BAA0B,WAE3B;wBACP,WAAW;wBACX,mBAAmB;wBACnB,wBAAwB;wBACxB,4BAA4B;wBAC5B,OAAO;wBACP,OAAO;wBACP,OAAO;wBACP,QAAQ;qBACT;;sBAGA,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAExB,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBACxB,MAAM","sourcesContent":["import {\n Component,\n EventEmitter,\n Input,\n OnChanges,\n Output,\n SimpleChanges,\n} from '@angular/core';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { IonCard, IonInput, IonItem, IonList } from '@ionic/angular/standalone';\nimport { CountrySelectorComponent } from '@sneat/components';\nimport { IAssetContext, IAssetDwellingContext } from '@sneat/mod-assetus-core';\nimport { ISpaceContext } from '@sneat/space-models';\nimport { AssetPossessionCardComponent } from '../asset-possesion-card/asset-possession-card.component';\n\n@Component({\n selector: 'sneat-edit-dwelling-card',\n templateUrl: './edit-dwelling-card.component.html',\n imports: [\n FormsModule,\n ReactiveFormsModule,\n CountrySelectorComponent,\n AssetPossessionCardComponent,\n IonCard,\n IonList,\n IonItem,\n IonInput,\n ],\n})\nexport class AddDwellingCardComponent implements OnChanges {\n @Input({ required: true }) space?: ISpaceContext;\n\n @Input({ required: true }) dwellingAsset?: IAssetDwellingContext;\n @Output() readonly dwellingAssetChange = new EventEmitter<IAssetContext>();\n\n protected title = '';\n protected address = '';\n protected rent_price_amount?: number;\n protected rent_price_currency = 'USD';\n protected number_of_bedrooms?: number;\n protected areaSqM?: number;\n\n ngOnChanges(changes: SimpleChanges): void {\n const spaceChanges = changes['space'];\n if (\n spaceChanges &&\n this.space?.dbo?.countryID &&\n this.dwellingAsset?.dbo &&\n !this.dwellingAsset.dbo.countryID\n ) {\n this.dwellingAsset = {\n ...this.dwellingAsset,\n dbo: { ...this.dwellingAsset.dbo, countryID: this.space.dbo.countryID },\n };\n this.dwellingAssetChange.emit(this.dwellingAsset);\n }\n\n if (changes['dwellingAsset']) {\n this.title = this.dwellingAsset?.dbo?.title || '';\n this.address = this.dwellingAsset?.dbo?.extra?.address?.lines || '';\n this.rent_price_amount =\n this.dwellingAsset?.dbo?.extra?.rent_price?.value;\n this.rent_price_currency =\n this.dwellingAsset?.dbo?.extra?.rent_price?.currency || 'USD';\n this.number_of_bedrooms =\n this.dwellingAsset?.dbo?.extra?.numberOfBedrooms;\n this.areaSqM = this.dwellingAsset?.dbo?.extra?.areaSqM;\n }\n }\n\n protected onBriefFieldChanged(field: string, value: string): void {\n if (this.dwellingAsset?.dbo) {\n this.dwellingAsset = {\n ...this.dwellingAsset,\n dbo: {\n ...this.dwellingAsset.dbo,\n [field]: value,\n },\n };\n this.dwellingAssetChange.emit(this.dwellingAsset);\n }\n }\n\n protected onExtraFieldChanged(field: string, value: string): void {\n if (this.dwellingAsset?.dbo && this.dwellingAsset?.dbo?.extra) {\n this.dwellingAsset = {\n ...this.dwellingAsset,\n dbo: {\n ...this.dwellingAsset.dbo,\n extra: {\n ...this.dwellingAsset.dbo.extra,\n [field]: value,\n },\n },\n };\n this.dwellingAssetChange.emit(this.dwellingAsset);\n }\n }\n\n protected onRentPriceFieldChanged(field: string, value: string): void {\n if (this.dwellingAsset?.dbo?.extra?.rent_price) {\n this.dwellingAsset = {\n ...this.dwellingAsset,\n dbo: {\n ...this.dwellingAsset.dbo,\n extra: {\n ...this.dwellingAsset.dbo.extra,\n rent_price: {\n ...this.dwellingAsset.dbo.extra.rent_price,\n [field]: value,\n },\n },\n },\n };\n this.dwellingAssetChange.emit(this.dwellingAsset);\n }\n }\n\n protected onCountryChanged(value: string): void {\n if (this.dwellingAsset?.dbo) {\n this.dwellingAsset = {\n ...this.dwellingAsset,\n dbo: { ...this.dwellingAsset.dbo, countryID: value },\n };\n this.dwellingAssetChange.emit(this.dwellingAsset);\n }\n }\n\n protected onAssetChanged(asset: IAssetContext): void {\n this.dwellingAsset = asset as IAssetDwellingContext;\n this.dwellingAssetChange.emit(this.dwellingAsset);\n }\n}\n","<ion-card>\n <ion-list>\n <ion-item>\n <ion-input\n label=\"Title\"\n placeholder=\"Dwelling Title\"\n [(ngModel)]=\"this.title\"\n (ngModelChange)=\"onBriefFieldChanged('title', $event)\"\n />\n </ion-item>\n <sneat-country-selector\n [countryID]=\"dwellingAsset?.brief?.countryID\"\n [readonly]=\"!!dwellingAsset?.brief?.countryID\"\n [defaultCountryID]=\"space?.dbo?.countryID\"\n label=\"Country\"\n (countryIDChange)=\"onCountryChanged($event)\"\n />\n <ion-item>\n <ion-input\n label=\"Address\"\n placeholder=\"Address\"\n [(ngModel)]=\"this.address\"\n (ngModelChange)=\"onExtraFieldChanged('address', $event)\"\n />\n </ion-item>\n </ion-list>\n</ion-card>\n\n<sneat-asset-possession-card\n [asset]=\"dwellingAsset\"\n (assetChange)=\"onAssetChanged($event)\"\n/>\n\n<ion-card>\n <ion-list>\n @if (dwellingAsset?.dbo?.possession === \"renting\") {\n <ion-item>\n <ion-input\n label=\"Rent price\"\n placeholder=\"Rent price\"\n [(ngModel)]=\"this.rent_price_amount\"\n (ngModelChange)=\"onRentPriceFieldChanged('value', $event)\"\n />\n </ion-item>\n }\n <ion-item>\n <ion-input\n label=\"Number of bedrooms\"\n placeholder=\"Number of bedrooms\"\n [(ngModel)]=\"this.number_of_bedrooms\"\n (ngModelChange)=\"onExtraFieldChanged('numberOfBedrooms', $event)\"\n />\n </ion-item>\n <ion-item>\n <ion-input\n label=\"Area\"\n placeholder=\"Area\"\n [(ngModel)]=\"this.areaSqM\"\n (ngModelChange)=\"onExtraFieldChanged('areaSqM', $event)\"\n />\n </ion-item>\n </ion-list>\n</ion-card>\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './services';
|
|
2
|
+
export * from './period-segment/period-segment.component';
|
|
3
|
+
export * from './asset-card/asset-card.component';
|
|
4
|
+
export * from './asset-add';
|
|
5
|
+
export * from './asset-add/add-asset-base-component';
|
|
6
|
+
export * from './services/asset-service.dto';
|
|
7
|
+
export * from './asset-base-page';
|
|
8
|
+
export * from './asset-component-base-params';
|
|
9
|
+
export * from './assets-list/assets-list.component';
|
|
10
|
+
export * from './real-estate-location/real-estate-location.component';
|
|
11
|
+
export * from './asset-add/asset-add-vehicle/asset-add-vehicle.component';
|
|
12
|
+
export * from './vehicle-card/vehicle-card.component';
|
|
13
|
+
export * from './mileage-dialog/mileage-dialog.component';
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/extensions/assetus/components/src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mCAAmC,CAAC;AAClD,cAAc,aAAa,CAAC;AAC5B,cAAc,sCAAsC,CAAC;AACrD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,cAAc,uDAAuD,CAAC;AACtE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,uCAAuC,CAAC;AACtD,cAAc,2CAA2C,CAAC","sourcesContent":["export * from './services';\nexport * from './period-segment/period-segment.component';\nexport * from './asset-card/asset-card.component';\nexport * from './asset-add';\nexport * from './asset-add/add-asset-base-component';\nexport * from './services/asset-service.dto';\nexport * from './asset-base-page';\nexport * from './asset-component-base-params';\nexport * from './assets-list/assets-list.component';\nexport * from './real-estate-location/real-estate-location.component';\nexport * from './asset-add/asset-add-vehicle/asset-add-vehicle.component';\nexport * from './vehicle-card/vehicle-card.component';\nexport * from './mileage-dialog/mileage-dialog.component';\n"]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, Output, ViewChild, } from '@angular/core';
|
|
2
|
+
import { FormsModule } from '@angular/forms';
|
|
3
|
+
import { IonInput, IonItem } from '@ionic/angular/standalone';
|
|
4
|
+
import { SelectFromListComponent } from '@sneat/ui';
|
|
5
|
+
import { carMakes } from '@sneat/mod-assetus-core';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
import * as i1 from "@angular/forms";
|
|
8
|
+
export class MakeModelCardComponent {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.makeChange = new EventEmitter();
|
|
11
|
+
this.modelChange = new EventEmitter();
|
|
12
|
+
this.makes = Object.keys(carMakes).map((id) => ({
|
|
13
|
+
id,
|
|
14
|
+
title: id,
|
|
15
|
+
}));
|
|
16
|
+
this.models = [
|
|
17
|
+
{ id: 'A4', title: 'A4' },
|
|
18
|
+
{ id: 'A6', title: 'A6' },
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
isKnownMake() {
|
|
22
|
+
return !!this.make && !!carMakes[this.make];
|
|
23
|
+
}
|
|
24
|
+
isKnownModel() {
|
|
25
|
+
const model = this.model?.toLowerCase();
|
|
26
|
+
return (!!model &&
|
|
27
|
+
!!this.models?.length &&
|
|
28
|
+
this.models.some((m) => m.id == model || m.title.toLowerCase() === model));
|
|
29
|
+
}
|
|
30
|
+
onMakeChanged(event) {
|
|
31
|
+
const make = this.make ? carMakes[this.make] : undefined;
|
|
32
|
+
if (make) {
|
|
33
|
+
this.models = make.models.map((v) => ({ id: v.id, title: v.id }));
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.models = [];
|
|
37
|
+
}
|
|
38
|
+
this.makeChange.emit(this.make);
|
|
39
|
+
if (this.model) {
|
|
40
|
+
this.model = '';
|
|
41
|
+
}
|
|
42
|
+
this.onModelChanged(event);
|
|
43
|
+
this.modelSelector?.focus();
|
|
44
|
+
}
|
|
45
|
+
onModelChanged(_event) {
|
|
46
|
+
this.modelChange.emit(this.model);
|
|
47
|
+
}
|
|
48
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: MakeModelCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
49
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: MakeModelCardComponent, isStandalone: true, selector: "sneat-make-model-card", inputs: { assetType: "assetType", make: "make", model: "model" }, outputs: { makeChange: "makeChange", modelChange: "modelChange" }, viewQueries: [{ propertyName: "modelSelector", first: true, predicate: ["modelSelector"], descendants: true }], ngImport: i0, template: "@if (make && !isKnownMake()) {\n <ion-item>\n <ion-input label=\"Make\" [(ngModel)]=\"make\" placeholder=\"Make\" />\n </ion-item>\n} @else {\n <sneat-select-from-list\n label=\"Make\"\n filterLabel=\"Choose Make\"\n [(ngModel)]=\"make\"\n (ngModelChange)=\"onMakeChanged($event)\"\n labelPlacement=\"end\"\n [isFilterable]=\"true\"\n [items]=\"makes\"\n [canAdd]=\"true\"\n />\n}\n@if (make && model && !isKnownModel()) {\n <ion-item>\n <ion-input label=\"Model\" [(ngModel)]=\"model\" placeholder=\"Model\" />\n </ion-item>\n}\n@if (make && (!model || isKnownModel())) {\n <sneat-select-from-list\n #modelSelector\n [(ngModel)]=\"model\"\n label=\"Model\"\n filterLabel=\"Choose Model\"\n (ngModelChange)=\"onModelChanged($event)\"\n labelPlacement=\"end\"\n [isFilterable]=\"true\"\n [items]=\"models\"\n [canAdd]=\"true\"\n />\n}\n", dependencies: [{ kind: "component", type: SelectFromListComponent, selector: "sneat-select-from-list", inputs: ["value", "filterLabel", "label", "listLabel", "listLabelColor", "isFilterable", "isLoading", "items", "items$", "lastItemLines", "labelPlacement", "justify", "other", "canAdd", "filterItem", "selectMode", "isReadonly", "$isProcessing", "sortBy"], outputs: ["valueChange", "filterChanged"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }] }); }
|
|
50
|
+
}
|
|
51
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: MakeModelCardComponent, decorators: [{
|
|
52
|
+
type: Component,
|
|
53
|
+
args: [{ selector: 'sneat-make-model-card', imports: [SelectFromListComponent, FormsModule, IonItem, IonInput], template: "@if (make && !isKnownMake()) {\n <ion-item>\n <ion-input label=\"Make\" [(ngModel)]=\"make\" placeholder=\"Make\" />\n </ion-item>\n} @else {\n <sneat-select-from-list\n label=\"Make\"\n filterLabel=\"Choose Make\"\n [(ngModel)]=\"make\"\n (ngModelChange)=\"onMakeChanged($event)\"\n labelPlacement=\"end\"\n [isFilterable]=\"true\"\n [items]=\"makes\"\n [canAdd]=\"true\"\n />\n}\n@if (make && model && !isKnownModel()) {\n <ion-item>\n <ion-input label=\"Model\" [(ngModel)]=\"model\" placeholder=\"Model\" />\n </ion-item>\n}\n@if (make && (!model || isKnownModel())) {\n <sneat-select-from-list\n #modelSelector\n [(ngModel)]=\"model\"\n label=\"Model\"\n filterLabel=\"Choose Model\"\n (ngModelChange)=\"onModelChanged($event)\"\n labelPlacement=\"end\"\n [isFilterable]=\"true\"\n [items]=\"models\"\n [canAdd]=\"true\"\n />\n}\n" }]
|
|
54
|
+
}], propDecorators: { assetType: [{
|
|
55
|
+
type: Input
|
|
56
|
+
}], make: [{
|
|
57
|
+
type: Input
|
|
58
|
+
}], model: [{
|
|
59
|
+
type: Input
|
|
60
|
+
}], makeChange: [{
|
|
61
|
+
type: Output
|
|
62
|
+
}], modelChange: [{
|
|
63
|
+
type: Output
|
|
64
|
+
}], modelSelector: [{
|
|
65
|
+
type: ViewChild,
|
|
66
|
+
args: ['modelSelector', { static: false }]
|
|
67
|
+
}] } });
|
|
68
|
+
//# sourceMappingURL=make-model-card.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"make-model-card.component.js","sourceRoot":"","sources":["../../../../../../../../libs/extensions/assetus/components/src/lib/make-model-card/make-model-card.component.ts","../../../../../../../../libs/extensions/assetus/components/src/lib/make-model-card/make-model-card.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,KAAK,EACL,MAAM,EACN,SAAS,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAa,QAAQ,EAAiB,MAAM,yBAAyB,CAAC;;;AAO7E,MAAM,OAAO,sBAAsB;IALnC;QAUY,eAAU,GAAG,IAAI,YAAY,EAAU,CAAC;QACxC,gBAAW,GAAG,IAAI,YAAY,EA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AAM,GAAG,EAAE,CAAC;QACnB,CAAC;QACD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAClB,CAAC;QACD,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC3B,IAAI,CAAC,aAAa,EAAE,KAAK,EAAE,CAAC;IAC9B,CAAC;IAES,cAAc,CAAC,MAAa;QACpC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;8GAlDU,sBAAsB;kGAAtB,sBAAsB,sUCjBnC,s4BAkCA,4CDnBY,uBAAuB,6WAAE,WAAW,+VAAE,OAAO,0NAAE,QAAQ;;2FAEtD,sBAAsB;kBALlC,SAAS;+BACE,uBAAuB,WAExB,CAAC,uBAAuB,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,CAAC;;sBAGjE,KAAK;;sBACL,KAAK;;sBACL,KAAK;;sBAEL,MAAM;;sBACN,MAAM;;sBAEN,SAAS;uBAAC,eAAe,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE","sourcesContent":["import {\n Component,\n EventEmitter,\n Input,\n Output,\n ViewChild,\n} from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { IonInput, IonItem } from '@ionic/angular/standalone';\nimport { SelectFromListComponent } from '@sneat/ui';\nimport { AssetType, carMakes, IMake, IModel } from '@sneat/mod-assetus-core';\n\n@Component({\n selector: 'sneat-make-model-card',\n templateUrl: './make-model-card.component.html',\n imports: [SelectFromListComponent, FormsModule, IonItem, IonInput],\n})\nexport class MakeModelCardComponent {\n @Input() assetType?: AssetType;\n @Input() make?: string;\n @Input() model?: string;\n\n @Output() makeChange = new EventEmitter<string>();\n @Output() modelChange = new EventEmitter<string>();\n\n @ViewChild('modelSelector', { static: false })\n modelSelector?: SelectFromListComponent;\n\n public makes: IMake[] = Object.keys(carMakes).map((id) => ({\n id,\n title: id,\n }));\n public models: IModel[] = [\n { id: 'A4', title: 'A4' },\n { id: 'A6', title: 'A6' },\n ];\n\n protected isKnownMake(): boolean {\n return !!this.make && !!carMakes[this.make];\n }\n\n protected isKnownModel(): boolean {\n const model = this.model?.toLowerCase();\n return (\n !!model &&\n !!this.models?.length &&\n this.models.some((m) => m.id == model || m.title.toLowerCase() === model)\n );\n }\n\n protected onMakeChanged(event: Event): void {\n const make = this.make ? carMakes[this.make] : undefined;\n if (make) {\n this.models = make.models.map((v) => ({ id: v.id, title: v.id }));\n } else {\n this.models = [];\n }\n this.makeChange.emit(this.make);\n if (this.model) {\n this.model = '';\n }\n this.onModelChanged(event);\n this.modelSelector?.focus();\n }\n\n protected onModelChanged(_event: Event): void {\n this.modelChange.emit(this.model);\n }\n}\n","@if (make && !isKnownMake()) {\n <ion-item>\n <ion-input label=\"Make\" [(ngModel)]=\"make\" placeholder=\"Make\" />\n </ion-item>\n} @else {\n <sneat-select-from-list\n label=\"Make\"\n filterLabel=\"Choose Make\"\n [(ngModel)]=\"make\"\n (ngModelChange)=\"onMakeChanged($event)\"\n labelPlacement=\"end\"\n [isFilterable]=\"true\"\n [items]=\"makes\"\n [canAdd]=\"true\"\n />\n}\n@if (make && model && !isKnownModel()) {\n <ion-item>\n <ion-input label=\"Model\" [(ngModel)]=\"model\" placeholder=\"Model\" />\n </ion-item>\n}\n@if (make && (!model || isKnownModel())) {\n <sneat-select-from-list\n #modelSelector\n [(ngModel)]=\"model\"\n label=\"Model\"\n filterLabel=\"Choose Model\"\n (ngModelChange)=\"onModelChanged($event)\"\n labelPlacement=\"end\"\n [isFilterable]=\"true\"\n [items]=\"models\"\n [canAdd]=\"true\"\n />\n}\n"]}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { Component, Input, inject } from '@angular/core';
|
|
2
|
+
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
3
|
+
import { ModalController, IonButton, IonButtons, IonContent, IonInput, IonItem, IonList, IonSelect, IonSelectOption, IonTitle, IonToolbar, } from '@ionic/angular/standalone';
|
|
4
|
+
import { ErrorLogger } from '@sneat/core';
|
|
5
|
+
import { CurrencyList, FuelVolumeUnitTypes, MileageUnitTypes, } from '@sneat/mod-assetus-core';
|
|
6
|
+
import { AssetService } from '../services';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
import * as i1 from "@angular/forms";
|
|
9
|
+
export class MileAgeDialogComponent {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.errorLogger = inject(ErrorLogger);
|
|
12
|
+
this.assetService = inject(AssetService);
|
|
13
|
+
this.modalCtrl = inject(ModalController);
|
|
14
|
+
this.currencyList = CurrencyList;
|
|
15
|
+
this.fuelVolumeUnitTypes = FuelVolumeUnitTypes;
|
|
16
|
+
this.mileageUnitTypes = MileageUnitTypes;
|
|
17
|
+
this.fuelVolume = new FormControl(undefined);
|
|
18
|
+
this.fuelVolumeUnit = new FormControl(undefined);
|
|
19
|
+
this.fuelCost = new FormControl(undefined);
|
|
20
|
+
this.currency = new FormControl(undefined);
|
|
21
|
+
this.mileage = new FormControl(undefined);
|
|
22
|
+
this.mileageUnit = new FormControl(undefined);
|
|
23
|
+
this.addVehicleRecordForm = new FormGroup({
|
|
24
|
+
fuelVolume: this.fuelVolume,
|
|
25
|
+
fuelVolumeUnit: this.fuelVolumeUnit,
|
|
26
|
+
fuelCost: this.fuelCost,
|
|
27
|
+
currency: this.currency,
|
|
28
|
+
mileage: this.mileage,
|
|
29
|
+
mileageUnit: this.mileageUnit,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
// ionViewDidEnter() {
|
|
33
|
+
// setTimeout(() => {
|
|
34
|
+
// this.inputTitle
|
|
35
|
+
// ?.setFocus()
|
|
36
|
+
// .catch((err) =>
|
|
37
|
+
// this.errorLogger.logError(err, 'Failed to set focus to title input'),
|
|
38
|
+
// );
|
|
39
|
+
// }, 100);
|
|
40
|
+
// }
|
|
41
|
+
// selectCardType(cardType: 'sql' | 'http'): void {
|
|
42
|
+
// this.modalCtrl
|
|
43
|
+
// .dismiss({ cardType, title: this.cardTitle })
|
|
44
|
+
// .catch(this.errorLogger.logErrorHandler('Failed to dismiss modal'));
|
|
45
|
+
// }
|
|
46
|
+
submit() {
|
|
47
|
+
if (!this.asset?.id) {
|
|
48
|
+
throw new Error('assetId is not set');
|
|
49
|
+
}
|
|
50
|
+
if (!this.space?.id) {
|
|
51
|
+
throw new Error('spaceId is not set');
|
|
52
|
+
}
|
|
53
|
+
if ((this.fuelVolume.value !== undefined) !==
|
|
54
|
+
(this.fuelVolumeUnit.value !== undefined)) {
|
|
55
|
+
throw new Error('fuelVolume and fuelVolumeUnit should be both set or both unset');
|
|
56
|
+
}
|
|
57
|
+
if ((this.fuelCost.value !== undefined) !==
|
|
58
|
+
(this.currency.value !== undefined)) {
|
|
59
|
+
throw new Error('fuelCost and currency should be both set or both unset');
|
|
60
|
+
}
|
|
61
|
+
if ((this.mileage.value !== undefined) !==
|
|
62
|
+
(this.mileageUnit.value !== undefined)) {
|
|
63
|
+
throw new Error('mileage and mileageUnit should be both set or both unset');
|
|
64
|
+
}
|
|
65
|
+
const request = {
|
|
66
|
+
spaceID: this.space.id,
|
|
67
|
+
assetID: this.asset.id,
|
|
68
|
+
fuelVolume: this.fuelVolume.value || undefined,
|
|
69
|
+
fuelVolumeUnit: this.fuelVolumeUnit.value || undefined,
|
|
70
|
+
fuelCost: this.fuelCost.value || undefined,
|
|
71
|
+
currency: this.currency.value || undefined,
|
|
72
|
+
mileage: this.mileage.value || undefined,
|
|
73
|
+
mileageUnit: this.mileageUnit.value || undefined,
|
|
74
|
+
};
|
|
75
|
+
this.assetService.addVehicleRecord(request).subscribe({
|
|
76
|
+
next: (_id) => {
|
|
77
|
+
this.modalCtrl
|
|
78
|
+
.dismiss()
|
|
79
|
+
.catch(this.errorLogger.logErrorHandler('Failed to dismiss modal on success'));
|
|
80
|
+
},
|
|
81
|
+
error: (err) => {
|
|
82
|
+
console.error('Failed to add vehicle record:', err);
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
// const request: ICreateDebtRecordRequest = {
|
|
86
|
+
// spaceID,
|
|
87
|
+
// contactID,
|
|
88
|
+
// amount: this.amount.value,
|
|
89
|
+
// currency: this.currency.value,
|
|
90
|
+
// };
|
|
91
|
+
// this.debtusService.createDebtRecord(request).subscribe({
|
|
92
|
+
// next: (id) => {
|
|
93
|
+
// console.log('Debt record created:', id);
|
|
94
|
+
// },
|
|
95
|
+
// error: (err) => {
|
|
96
|
+
// console.error('Failed to create debt record:', err);
|
|
97
|
+
// },
|
|
98
|
+
// });
|
|
99
|
+
}
|
|
100
|
+
cancel() {
|
|
101
|
+
this.modalCtrl
|
|
102
|
+
.dismiss()
|
|
103
|
+
.catch(this.errorLogger.logErrorHandler('Failed to dismiss modal on cancel'));
|
|
104
|
+
}
|
|
105
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: MileAgeDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
106
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: MileAgeDialogComponent, isStandalone: true, selector: "sneat-mileage-dialog", inputs: { space: "space", asset: "asset" }, ngImport: i0, template: "<ion-toolbar>\n <ion-title\n >Add miles & fuel @\n @switch (asset?.brief?.extraType) {\n @case (\"vehicle\") {\n @if (asset?.brief?.extra?.[\"make\"] && asset?.brief?.extra?.[\"model\"]) {\n {{ asset?.brief?.extra?.[\"make\"] }}/{{\n asset?.brief?.extra?.[\"model\"]\n }}\n }\n @if (\n asset?.brief?.title &&\n asset?.brief?.extra?.[\"make\"] &&\n asset?.brief?.extra?.[\"model\"]\n ) {\n —\n }\n }\n @case (\"dwelling\") {\n {{ asset?.brief?.extra?.[\"address\"] || asset?.brief?.title }}\n }\n }\n @if (asset?.brief?.title) {\n {{ asset?.brief?.title }}\n }\n </ion-title>\n</ion-toolbar>\n<ion-content>\n <ion-list>\n <ion-item>\n <ion-input [formControl]=\"fuelVolume\" label=\"Fuel Volume\"></ion-input>\n <ion-select\n [formControl]=\"fuelVolumeUnit\"\n placeholder=\"Select Volume Unit\"\n >\n @for (fuelVolumeUnit of fuelVolumeUnitTypes; track fuelVolumeUnit) {\n <ion-select-option [value]=\"fuelVolumeUnit\">{{\n fuelVolumeUnit\n }}</ion-select-option>\n }\n </ion-select>\n </ion-item>\n <ion-item>\n <ion-input [formControl]=\"fuelCost\" label=\"Fuel Cost\"></ion-input>\n <ion-select [formControl]=\"currency\" placeholder=\"Select Currency\">\n @for (currency of currencyList; track currency) {\n <ion-select-option [value]=\"currency\">{{\n currency\n }}</ion-select-option>\n }\n </ion-select>\n </ion-item>\n <ion-item>\n <ion-input [formControl]=\"mileage\" label=\"Mileage\"></ion-input>\n <ion-select [formControl]=\"mileageUnit\" placeholder=\"Select Mileage Unit\">\n @for (mileageUnit of mileageUnitTypes; track mileageUnit) {\n <ion-select-option [value]=\"mileageUnit\">{{\n mileageUnit\n }}</ion-select-option>\n }\n </ion-select>\n </ion-item>\n </ion-list>\n</ion-content>\n<ion-toolbar>\n <ion-buttons slot=\"start\">\n <ion-button (click)=\"cancel()\" fill=\"solid\" color=\"danger\">\n Cancel\n </ion-button>\n </ion-buttons>\n <ion-buttons slot=\"end\">\n <ion-button (click)=\"submit()\" fill=\"solid\" color=\"success\">\n Save\n </ion-button>\n </ion-buttons>\n</ion-toolbar>\n", styles: [""], dependencies: [{ kind: "component", type: IonTitle, selector: "ion-title", inputs: ["color", "size"] }, { kind: "component", type: IonContent, selector: "ion-content", inputs: ["color", "fixedSlotPlacement", "forceOverscroll", "fullscreen", "scrollEvents", "scrollX", "scrollY"] }, { kind: "component", type: IonList, selector: "ion-list", inputs: ["inset", "lines", "mode"] }, { kind: "component", type: IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }, { kind: "component", type: IonSelect, selector: "ion-select", inputs: ["cancelText", "color", "compareWith", "disabled", "errorText", "expandedIcon", "fill", "helperText", "interface", "interfaceOptions", "justify", "label", "labelPlacement", "mode", "multiple", "name", "okText", "placeholder", "selectedText", "shape", "toggleIcon", "value"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: IonSelectOption, selector: "ion-select-option", inputs: ["disabled", "value"] }, { kind: "component", type: IonToolbar, selector: "ion-toolbar", inputs: ["color", "mode"] }, { kind: "component", type: IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }] }); }
|
|
107
|
+
}
|
|
108
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: MileAgeDialogComponent, decorators: [{
|
|
109
|
+
type: Component,
|
|
110
|
+
args: [{ selector: 'sneat-mileage-dialog', imports: [
|
|
111
|
+
IonTitle,
|
|
112
|
+
IonContent,
|
|
113
|
+
IonList,
|
|
114
|
+
IonItem,
|
|
115
|
+
IonInput,
|
|
116
|
+
IonSelect,
|
|
117
|
+
ReactiveFormsModule,
|
|
118
|
+
IonSelectOption,
|
|
119
|
+
IonToolbar,
|
|
120
|
+
IonButtons,
|
|
121
|
+
IonButton,
|
|
122
|
+
], template: "<ion-toolbar>\n <ion-title\n >Add miles & fuel @\n @switch (asset?.brief?.extraType) {\n @case (\"vehicle\") {\n @if (asset?.brief?.extra?.[\"make\"] && asset?.brief?.extra?.[\"model\"]) {\n {{ asset?.brief?.extra?.[\"make\"] }}/{{\n asset?.brief?.extra?.[\"model\"]\n }}\n }\n @if (\n asset?.brief?.title &&\n asset?.brief?.extra?.[\"make\"] &&\n asset?.brief?.extra?.[\"model\"]\n ) {\n —\n }\n }\n @case (\"dwelling\") {\n {{ asset?.brief?.extra?.[\"address\"] || asset?.brief?.title }}\n }\n }\n @if (asset?.brief?.title) {\n {{ asset?.brief?.title }}\n }\n </ion-title>\n</ion-toolbar>\n<ion-content>\n <ion-list>\n <ion-item>\n <ion-input [formControl]=\"fuelVolume\" label=\"Fuel Volume\"></ion-input>\n <ion-select\n [formControl]=\"fuelVolumeUnit\"\n placeholder=\"Select Volume Unit\"\n >\n @for (fuelVolumeUnit of fuelVolumeUnitTypes; track fuelVolumeUnit) {\n <ion-select-option [value]=\"fuelVolumeUnit\">{{\n fuelVolumeUnit\n }}</ion-select-option>\n }\n </ion-select>\n </ion-item>\n <ion-item>\n <ion-input [formControl]=\"fuelCost\" label=\"Fuel Cost\"></ion-input>\n <ion-select [formControl]=\"currency\" placeholder=\"Select Currency\">\n @for (currency of currencyList; track currency) {\n <ion-select-option [value]=\"currency\">{{\n currency\n }}</ion-select-option>\n }\n </ion-select>\n </ion-item>\n <ion-item>\n <ion-input [formControl]=\"mileage\" label=\"Mileage\"></ion-input>\n <ion-select [formControl]=\"mileageUnit\" placeholder=\"Select Mileage Unit\">\n @for (mileageUnit of mileageUnitTypes; track mileageUnit) {\n <ion-select-option [value]=\"mileageUnit\">{{\n mileageUnit\n }}</ion-select-option>\n }\n </ion-select>\n </ion-item>\n </ion-list>\n</ion-content>\n<ion-toolbar>\n <ion-buttons slot=\"start\">\n <ion-button (click)=\"cancel()\" fill=\"solid\" color=\"danger\">\n Cancel\n </ion-button>\n </ion-buttons>\n <ion-buttons slot=\"end\">\n <ion-button (click)=\"submit()\" fill=\"solid\" color=\"success\">\n Save\n </ion-button>\n </ion-buttons>\n</ion-toolbar>\n" }]
|
|
123
|
+
}], propDecorators: { space: [{
|
|
124
|
+
type: Input
|
|
125
|
+
}], asset: [{
|
|
126
|
+
type: Input
|
|
127
|
+
}] } });
|
|
128
|
+
//# sourceMappingURL=mileage-dialog.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mileage-dialog.component.js","sourceRoot":"","sources":["../../../../../../../../libs/extensions/assetus/components/src/lib/mileage-dialog/mileage-dialog.component.ts","../../../../../../../../libs/extensions/assetus/components/src/lib/mileage-dialog/mileage-dialog.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EACL,eAAe,EACf,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EACR,OAAO,EACP,OAAO,EACP,SAAS,EACT,eAAe,EACf,QAAQ,EACR,UAAU,GACX,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAgB,MAAM,aAAa,CAAC;AACxD,OAAO,EAEL,YAAY,EAEZ,mBAAmB,EAGnB,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAA4B,MAAM,aAAa,CAAC;;;AAqBrE,MAAM,OAAO,sBAAsB;IAlBnC;QAmBmB,gBAAW,GAAG,MAAM,CAAe,WAAW,CAAC,CAAC;QAChD,iBAAY,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;Q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,CAAC,SAAS;qBACX,OAAO,EAAE;qBACT,KAAK,CACJ,IAAI,CAAC,WAAW,CAAC,eAAe,CAC9B,oCAAoC,CACrC,CACF,CAAC;YACN,CAAC;YACD,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;gBACb,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,GAAG,CAAC,CAAC;YACtD,CAAC;SACF,CAAC,CAAC;QAEH,8CAA8C;QAC9C,YAAY;QACZ,cAAc;QACd,8BAA8B;QAC9B,kCAAkC;QAClC,KAAK;QACL,2DAA2D;QAC3D,mBAAmB;QACnB,6CAA6C;QAC7C,MAAM;QACN,qBAAqB;QACrB,yDAAyD;QACzD,MAAM;QACN,MAAM;IACR,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,SAAS;aACX,OAAO,EAAE;aACT,KAAK,CACJ,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,mCAAmC,CAAC,CACtE,CAAC;IACN,CAAC;8GAnIU,sBAAsB;kGAAtB,sBAAsB,4HC/CnC,42EA4EA,0DD1CI,QAAQ,iFACR,UAAU,wKACV,OAAO,yFACP,OAAO,0NACP,QAAQ,8eACR,SAAS,iVACT,mBAAmB,0TACnB,eAAe,6FACf,UAAU,mFACV,UAAU,8EACV,SAAS;;2FAGA,sBAAsB;kBAlBlC,SAAS;+BACE,sBAAsB,WAGvB;wBACP,QAAQ;wBACR,UAAU;wBACV,OAAO;wBACP,OAAO;wBACP,QAAQ;wBACR,SAAS;wBACT,mBAAmB;wBACnB,eAAe;wBACf,UAAU;wBACV,UAAU;wBACV,SAAS;qBACV;;sBAOA,KAAK;;sBACL,KAAK","sourcesContent":["import { Component, Input, inject } from '@angular/core';\nimport { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';\nimport {\n ModalController,\n IonButton,\n IonButtons,\n IonContent,\n IonInput,\n IonItem,\n IonList,\n IonSelect,\n IonSelectOption,\n IonTitle,\n IonToolbar,\n} from '@ionic/angular/standalone';\nimport { IIdAndBrief } from '@sneat/core';\nimport { ErrorLogger, IErrorLogger } from '@sneat/core';\nimport {\n IAssetBrief,\n CurrencyList,\n CurrencyCode,\n FuelVolumeUnitTypes,\n FuelVolumeUnit,\n MileageUnit,\n MileageUnitTypes,\n} from '@sneat/mod-assetus-core';\nimport { AssetService, IAddVehicleRecordRequest } from '../services';\nimport { ISpaceBrief } from '@sneat/dto';\n\n@Component({\n selector: 'sneat-mileage-dialog',\n templateUrl: './mileage-dialog.component.html',\n styleUrls: ['./mileage-dialog.component.scss'],\n imports: [\n IonTitle,\n IonContent,\n IonList,\n IonItem,\n IonInput,\n IonSelect,\n ReactiveFormsModule,\n IonSelectOption,\n IonToolbar,\n IonButtons,\n IonButton,\n ],\n})\nexport class MileAgeDialogComponent {\n private readonly errorLogger = inject<IErrorLogger>(ErrorLogger);\n private readonly assetService = inject(AssetService);\n private readonly modalCtrl = inject(ModalController);\n\n @Input() space?: IIdAndBrief<ISpaceBrief>;\n @Input() asset?: IIdAndBrief<IAssetBrief>;\n\n protected currencyList: CurrencyCode[] = CurrencyList;\n protected fuelVolumeUnitTypes = FuelVolumeUnitTypes;\n protected mileageUnitTypes = MileageUnitTypes;\n\n protected fuelVolume = new FormControl<number | undefined>(undefined);\n protected fuelVolumeUnit = new FormControl<FuelVolumeUnit | undefined>(\n undefined,\n );\n\n protected fuelCost = new FormControl<number | undefined>(undefined);\n protected currency = new FormControl<CurrencyCode | undefined>(undefined);\n\n protected mileage = new FormControl<number | undefined>(undefined);\n protected mileageUnit = new FormControl<MileageUnit | undefined>(undefined);\n\n protected addVehicleRecordForm = new FormGroup({\n fuelVolume: this.fuelVolume,\n fuelVolumeUnit: this.fuelVolumeUnit,\n\n fuelCost: this.fuelCost,\n currency: this.currency,\n\n mileage: this.mileage,\n mileageUnit: this.mileageUnit,\n });\n\n // ionViewDidEnter() {\n // \tsetTimeout(() => {\n // \t\tthis.inputTitle\n // \t\t\t?.setFocus()\n // \t\t\t.catch((err) =>\n // \t\t\t\tthis.errorLogger.logError(err, 'Failed to set focus to title input'),\n // \t\t\t);\n // \t}, 100);\n // }\n\n // selectCardType(cardType: 'sql' | 'http'): void {\n // \tthis.modalCtrl\n // \t\t.dismiss({ cardType, title: this.cardTitle })\n // \t\t.catch(this.errorLogger.logErrorHandler('Failed to dismiss modal'));\n // }\n\n submit(): void {\n if (!this.asset?.id) {\n throw new Error('assetId is not set');\n }\n if (!this.space?.id) {\n throw new Error('spaceId is not set');\n }\n\n if (\n (this.fuelVolume.value !== undefined) !==\n (this.fuelVolumeUnit.value !== undefined)\n ) {\n throw new Error(\n 'fuelVolume and fuelVolumeUnit should be both set or both unset',\n );\n }\n\n if (\n (this.fuelCost.value !== undefined) !==\n (this.currency.value !== undefined)\n ) {\n throw new Error('fuelCost and currency should be both set or both unset');\n }\n\n if (\n (this.mileage.value !== undefined) !==\n (this.mileageUnit.value !== undefined)\n ) {\n throw new Error(\n 'mileage and mileageUnit should be both set or both unset',\n );\n }\n\n const request: IAddVehicleRecordRequest = {\n spaceID: this.space.id,\n assetID: this.asset.id,\n fuelVolume: this.fuelVolume.value || undefined,\n fuelVolumeUnit: this.fuelVolumeUnit.value || undefined,\n fuelCost: this.fuelCost.value || undefined,\n currency: this.currency.value || undefined,\n mileage: this.mileage.value || undefined,\n mileageUnit: this.mileageUnit.value || undefined,\n };\n\n this.assetService.addVehicleRecord(request).subscribe({\n next: (_id) => {\n this.modalCtrl\n .dismiss()\n .catch(\n this.errorLogger.logErrorHandler(\n 'Failed to dismiss modal on success',\n ),\n );\n },\n error: (err) => {\n console.error('Failed to add vehicle record:', err);\n },\n });\n\n // const request: ICreateDebtRecordRequest = {\n // \tspaceID,\n // \tcontactID,\n // \tamount: this.amount.value,\n // \tcurrency: this.currency.value,\n // };\n // this.debtusService.createDebtRecord(request).subscribe({\n // \tnext: (id) => {\n // \t\tconsole.log('Debt record created:', id);\n // \t},\n // \terror: (err) => {\n // \t\tconsole.error('Failed to create debt record:', err);\n // \t},\n // });\n }\n\n cancel(): void {\n this.modalCtrl\n .dismiss()\n .catch(\n this.errorLogger.logErrorHandler('Failed to dismiss modal on cancel'),\n );\n }\n}\n","<ion-toolbar>\n <ion-title\n >Add miles & fuel @\n @switch (asset?.brief?.extraType) {\n @case (\"vehicle\") {\n @if (asset?.brief?.extra?.[\"make\"] && asset?.brief?.extra?.[\"model\"]) {\n {{ asset?.brief?.extra?.[\"make\"] }}/{{\n asset?.brief?.extra?.[\"model\"]\n }}\n }\n @if (\n asset?.brief?.title &&\n asset?.brief?.extra?.[\"make\"] &&\n asset?.brief?.extra?.[\"model\"]\n ) {\n —\n }\n }\n @case (\"dwelling\") {\n {{ asset?.brief?.extra?.[\"address\"] || asset?.brief?.title }}\n }\n }\n @if (asset?.brief?.title) {\n {{ asset?.brief?.title }}\n }\n </ion-title>\n</ion-toolbar>\n<ion-content>\n <ion-list>\n <ion-item>\n <ion-input [formControl]=\"fuelVolume\" label=\"Fuel Volume\"></ion-input>\n <ion-select\n [formControl]=\"fuelVolumeUnit\"\n placeholder=\"Select Volume Unit\"\n >\n @for (fuelVolumeUnit of fuelVolumeUnitTypes; track fuelVolumeUnit) {\n <ion-select-option [value]=\"fuelVolumeUnit\">{{\n fuelVolumeUnit\n }}</ion-select-option>\n }\n </ion-select>\n </ion-item>\n <ion-item>\n <ion-input [formControl]=\"fuelCost\" label=\"Fuel Cost\"></ion-input>\n <ion-select [formControl]=\"currency\" placeholder=\"Select Currency\">\n @for (currency of currencyList; track currency) {\n <ion-select-option [value]=\"currency\">{{\n currency\n }}</ion-select-option>\n }\n </ion-select>\n </ion-item>\n <ion-item>\n <ion-input [formControl]=\"mileage\" label=\"Mileage\"></ion-input>\n <ion-select [formControl]=\"mileageUnit\" placeholder=\"Select Mileage Unit\">\n @for (mileageUnit of mileageUnitTypes; track mileageUnit) {\n <ion-select-option [value]=\"mileageUnit\">{{\n mileageUnit\n }}</ion-select-option>\n }\n </ion-select>\n </ion-item>\n </ion-list>\n</ion-content>\n<ion-toolbar>\n <ion-buttons slot=\"start\">\n <ion-button (click)=\"cancel()\" fill=\"solid\" color=\"danger\">\n Cancel\n </ion-button>\n </ion-buttons>\n <ion-buttons slot=\"end\">\n <ion-button (click)=\"submit()\" fill=\"solid\" color=\"success\">\n Save\n </ion-button>\n </ion-buttons>\n</ion-toolbar>\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
2
|
+
import { IonLabel, IonSegment, IonSegmentButton, } from '@ionic/angular/standalone';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export class PeriodSegmentComponent {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.changed = new EventEmitter();
|
|
7
|
+
}
|
|
8
|
+
segmentChanged(ev) {
|
|
9
|
+
// console.log('period segment changed', ev.detail);
|
|
10
|
+
this.period = ev.detail.value;
|
|
11
|
+
this.changed.emit(this.period);
|
|
12
|
+
}
|
|
13
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: PeriodSegmentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
14
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.0", type: PeriodSegmentComponent, isStandalone: true, selector: "sneat-period-segment", inputs: { period: "period" }, outputs: { changed: "changed" }, ngImport: i0, template: "<ion-segment [value]=\"period\" (ionChange)=\"segmentChanged($event)\">\n <!--<ion-segment-button value=\"day\" title=\"Daily\"><ion-label>Day</ion-label></ion-segment-button>-->\n <ion-segment-button value=\"week\" title=\"Weekly\">\n <ion-label>Week</ion-label>\n </ion-segment-button>\n <ion-segment-button value=\"month\" title=\"Monthly\">\n <ion-label>Month</ion-label>\n </ion-segment-button>\n <ion-segment-button value=\"year\" title=\"Yearly\">\n <ion-label>Year</ion-label>\n </ion-segment-button>\n</ion-segment>\n", dependencies: [{ kind: "component", type: IonSegment, selector: "ion-segment", inputs: ["color", "disabled", "mode", "scrollable", "selectOnFocus", "swipeGesture", "value"] }, { kind: "component", type: IonSegmentButton, selector: "ion-segment-button", inputs: ["contentId", "disabled", "layout", "mode", "type", "value"] }, { kind: "component", type: IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }] }); }
|
|
15
|
+
}
|
|
16
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: PeriodSegmentComponent, decorators: [{
|
|
17
|
+
type: Component,
|
|
18
|
+
args: [{ selector: 'sneat-period-segment', imports: [IonSegment, IonSegmentButton, IonLabel], template: "<ion-segment [value]=\"period\" (ionChange)=\"segmentChanged($event)\">\n <!--<ion-segment-button value=\"day\" title=\"Daily\"><ion-label>Day</ion-label></ion-segment-button>-->\n <ion-segment-button value=\"week\" title=\"Weekly\">\n <ion-label>Week</ion-label>\n </ion-segment-button>\n <ion-segment-button value=\"month\" title=\"Monthly\">\n <ion-label>Month</ion-label>\n </ion-segment-button>\n <ion-segment-button value=\"year\" title=\"Yearly\">\n <ion-label>Year</ion-label>\n </ion-segment-button>\n</ion-segment>\n" }]
|
|
19
|
+
}], propDecorators: { period: [{
|
|
20
|
+
type: Input
|
|
21
|
+
}], changed: [{
|
|
22
|
+
type: Output
|
|
23
|
+
}] } });
|
|
24
|
+
//# sourceMappingURL=period-segment.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"period-segment.component.js","sourceRoot":"","sources":["../../../../../../../../libs/extensions/assetus/components/src/lib/period-segment/period-segment.component.ts","../../../../../../../../libs/extensions/assetus/components/src/lib/period-segment/period-segment.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EACL,QAAQ,EACR,UAAU,EACV,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;;AAQnC,MAAM,OAAO,sBAAsB;IALnC;QASY,YAAO,GAAG,IAAI,YAAY,EAAU,CAAC;KAOhD;IALC,cAAc,CAAC,EAAe;QAC5B,oDAAoD;QACpD,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;8GAVU,sBAAsB;kGAAtB,sBAAsB,+ICbnC,giBAYA,4CDDY,UAAU,uJAAE,gBAAgB,qIAAE,QAAQ;;2FAErC,sBAAsB;kBALlC,SAAS;+BACE,sBAAsB,WAEvB,CAAC,UAAU,EAAE,gBAAgB,EAAE,QAAQ,CAAC;;sBAGhD,KAAK;;sBAGL,MAAM","sourcesContent":["import { Component, EventEmitter, Input, Output } from '@angular/core';\nimport {\n IonLabel,\n IonSegment,\n IonSegmentButton,\n} from '@ionic/angular/standalone';\nimport { Period } from '@sneat/dto';\n\n@Component({\n selector: 'sneat-period-segment',\n templateUrl: './period-segment.component.html',\n imports: [IonSegment, IonSegmentButton, IonLabel],\n})\nexport class PeriodSegmentComponent {\n @Input()\n public period?: Period;\n\n @Output() changed = new EventEmitter<Period>();\n\n segmentChanged(ev: CustomEvent): void {\n // console.log('period segment changed', ev.detail);\n this.period = ev.detail.value;\n this.changed.emit(this.period);\n }\n}\n","<ion-segment [value]=\"period\" (ionChange)=\"segmentChanged($event)\">\n <!--<ion-segment-button value=\"day\" title=\"Daily\"><ion-label>Day</ion-label></ion-segment-button>-->\n <ion-segment-button value=\"week\" title=\"Weekly\">\n <ion-label>Week</ion-label>\n </ion-segment-button>\n <ion-segment-button value=\"month\" title=\"Monthly\">\n <ion-label>Month</ion-label>\n </ion-segment-button>\n <ion-segment-button value=\"year\" title=\"Yearly\">\n <ion-label>Year</ion-label>\n </ion-segment-button>\n</ion-segment>\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
2
|
+
import { IonButton, IonButtons, IonIcon, IonInput, IonItem, IonLabel, IonTextarea, } from '@ionic/angular/standalone';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export class RealEstateLocationComponent {
|
|
5
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: RealEstateLocationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.0", type: RealEstateLocationComponent, isStandalone: true, selector: "sneat-real-estate-location", inputs: { asset: "asset" }, ngImport: i0, template: "<ion-item class=\"with-buttons\">\n <ion-label position=\"stacked\">Address</ion-label>\n <ion-textarea />\n <ion-buttons slot=\"end\">\n <ion-button color=\"medium\" title=\"Copy\">\n <ion-icon name=\"copy\" />\n </ion-button>\n </ion-buttons>\n</ion-item>\n<ion-item class=\"with-buttons\">\n <ion-label>Eir code</ion-label>\n <ion-input />\n <ion-buttons slot=\"end\">\n <ion-button color=\"medium\" title=\"Copy\">\n <ion-icon name=\"copy\" />\n </ion-button>\n </ion-buttons>\n</ion-item>\n<ion-item class=\"with-buttons\">\n <ion-label position=\"stacked\">Alarm</ion-label>\n <ion-input />\n <ion-buttons slot=\"end\">\n <ion-button color=\"medium\" title=\"Copy\">\n <ion-icon name=\"copy\" />\n </ion-button>\n </ion-buttons>\n</ion-item>\n", dependencies: [{ kind: "component", type: IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: IonTextarea, selector: "ion-textarea", inputs: ["autoGrow", "autocapitalize", "autofocus", "clearOnEdit", "color", "cols", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "maxlength", "minlength", "mode", "name", "placeholder", "readonly", "required", "rows", "shape", "spellcheck", "value", "wrap"] }, { kind: "component", type: IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }] }); }
|
|
7
|
+
}
|
|
8
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: RealEstateLocationComponent, decorators: [{
|
|
9
|
+
type: Component,
|
|
10
|
+
args: [{ selector: 'sneat-real-estate-location', imports: [
|
|
11
|
+
IonItem,
|
|
12
|
+
IonLabel,
|
|
13
|
+
IonTextarea,
|
|
14
|
+
IonButtons,
|
|
15
|
+
IonButton,
|
|
16
|
+
IonIcon,
|
|
17
|
+
IonInput,
|
|
18
|
+
], template: "<ion-item class=\"with-buttons\">\n <ion-label position=\"stacked\">Address</ion-label>\n <ion-textarea />\n <ion-buttons slot=\"end\">\n <ion-button color=\"medium\" title=\"Copy\">\n <ion-icon name=\"copy\" />\n </ion-button>\n </ion-buttons>\n</ion-item>\n<ion-item class=\"with-buttons\">\n <ion-label>Eir code</ion-label>\n <ion-input />\n <ion-buttons slot=\"end\">\n <ion-button color=\"medium\" title=\"Copy\">\n <ion-icon name=\"copy\" />\n </ion-button>\n </ion-buttons>\n</ion-item>\n<ion-item class=\"with-buttons\">\n <ion-label position=\"stacked\">Alarm</ion-label>\n <ion-input />\n <ion-buttons slot=\"end\">\n <ion-button color=\"medium\" title=\"Copy\">\n <ion-icon name=\"copy\" />\n </ion-button>\n </ion-buttons>\n</ion-item>\n" }]
|
|
19
|
+
}], propDecorators: { asset: [{
|
|
20
|
+
type: Input
|
|
21
|
+
}] } });
|
|
22
|
+
//# sourceMappingURL=real-estate-location.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"real-estate-location.component.js","sourceRoot":"","sources":["../../../../../../../../libs/extensions/assetus/components/src/lib/real-estate-location/real-estate-location.component.ts","../../../../../../../../libs/extensions/assetus/components/src/lib/real-estate-location/real-estate-location.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EACL,SAAS,EACT,UAAU,EACV,OAAO,EACP,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,WAAW,GACZ,MAAM,2BAA2B,CAAC;;AAgBnC,MAAM,OAAO,2BAA2B;8GAA3B,2BAA2B;kGAA3B,2BAA2B,kHCzBxC,4xBA2BA,4CDXI,OAAO,0NACP,QAAQ,6FACR,WAAW,iaACX,UAAU,8EACV,SAAS,oPACT,OAAO,2JACP,QAAQ;;2FAGC,2BAA2B;kBAbvC,SAAS;+BACE,4BAA4B,WAE7B;wBACP,OAAO;wBACP,QAAQ;wBACR,WAAW;wBACX,UAAU;wBACV,SAAS;wBACT,OAAO;wBACP,QAAQ;qBACT;;sBAGA,KAAK","sourcesContent":["import { Component, Input } from '@angular/core';\nimport {\n IonButton,\n IonButtons,\n IonIcon,\n IonInput,\n IonItem,\n IonLabel,\n IonTextarea,\n} from '@ionic/angular/standalone';\nimport { IAssetContext } from '@sneat/mod-assetus-core';\n\n@Component({\n selector: 'sneat-real-estate-location',\n templateUrl: './real-estate-location.component.html',\n imports: [\n IonItem,\n IonLabel,\n IonTextarea,\n IonButtons,\n IonButton,\n IonIcon,\n IonInput,\n ],\n})\nexport class RealEstateLocationComponent {\n @Input() asset?: IAssetContext;\n}\n","<ion-item class=\"with-buttons\">\n <ion-label position=\"stacked\">Address</ion-label>\n <ion-textarea />\n <ion-buttons slot=\"end\">\n <ion-button color=\"medium\" title=\"Copy\">\n <ion-icon name=\"copy\" />\n </ion-button>\n </ion-buttons>\n</ion-item>\n<ion-item class=\"with-buttons\">\n <ion-label>Eir code</ion-label>\n <ion-input />\n <ion-buttons slot=\"end\">\n <ion-button color=\"medium\" title=\"Copy\">\n <ion-icon name=\"copy\" />\n </ion-button>\n </ion-buttons>\n</ion-item>\n<ion-item class=\"with-buttons\">\n <ion-label position=\"stacked\">Alarm</ion-label>\n <ion-input />\n <ion-buttons slot=\"end\">\n <ion-button color=\"medium\" title=\"Copy\">\n <ion-icon name=\"copy\" />\n </ion-button>\n </ion-buttons>\n</ion-item>\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-service.dto.js","sourceRoot":"","sources":["../../../../../../../../libs/extensions/assetus/components/src/lib/services/asset-service.dto.ts"],"names":[],"mappings":"","sourcesContent":["import {\n AssetExtraType,\n IAssetDboBase,\n IAssetExtra,\n} from '@sneat/mod-assetus-core';\nimport { CurrencyCode } from '@sneat/mod-schedulus-core';\nimport { ISpaceRequest } from '@sneat/space-models';\n\nexport interface ICreateAssetRequest<\n ExtraType extends AssetExtraType,\n Extra extends IAssetExtra,\n> extends ISpaceRequest {\n readonly asset: IAssetDboBase<ExtraType, Extra>;\n readonly memberID?: string;\n}\n\nexport interface IAssetRequest extends ISpaceRequest {\n assetID: string;\n assetCategory: string;\n}\n\nexport interface IUpdateAssetRequest extends IAssetRequest {\n regNumber?: string;\n}\n\nexport interface IAddVehicleRecordRequest extends ISpaceRequest {\n readonly assetID: string;\n readonly fuelVolume?: number;\n readonly fuelVolumeUnit?: 'l' | 'g';\n readonly fuelCost?: number;\n readonly currency?: CurrencyCode;\n readonly mileage?: number;\n readonly mileageUnit?: 'km' | 'mile';\n}\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { HttpParams } from '@angular/common/http';
|
|
2
|
+
import { Injectable, inject, Injector } from '@angular/core';
|
|
3
|
+
import { Firestore as AngularFirestore } from '@angular/fire/firestore';
|
|
4
|
+
import { SneatApiService } from '@sneat/api';
|
|
5
|
+
import { ModuleSpaceItemService } from '@sneat/space-services';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export class AssetService extends ModuleSpaceItemService {
|
|
8
|
+
constructor() {
|
|
9
|
+
const afs = inject(AngularFirestore);
|
|
10
|
+
const sneatApiService = inject(SneatApiService);
|
|
11
|
+
const injector = inject(Injector);
|
|
12
|
+
super(injector, 'assetus', 'assets', afs, sneatApiService);
|
|
13
|
+
this.watchAssetByID = this.watchSpaceItemByIdWithSpaceRef;
|
|
14
|
+
}
|
|
15
|
+
deleteAsset(spaceID, assetID) {
|
|
16
|
+
const request = new HttpParams({
|
|
17
|
+
fromObject: { id: assetID, space: spaceID },
|
|
18
|
+
});
|
|
19
|
+
return this.sneatApiService.delete('assets/delete_asset', request);
|
|
20
|
+
}
|
|
21
|
+
updateAsset(request) {
|
|
22
|
+
return this.sneatApiService.post('assets/update_asset', request);
|
|
23
|
+
}
|
|
24
|
+
createAsset(space, request) {
|
|
25
|
+
// console.log(`AssetService.createAsset()`, request);
|
|
26
|
+
request = { ...request, asset: { ...request.asset, isRequest: true } };
|
|
27
|
+
return this.createSpaceItem('assets/create_asset?assetCategory=' + request.asset.category, space, request);
|
|
28
|
+
}
|
|
29
|
+
addVehicleRecord(request) {
|
|
30
|
+
return this.sneatApiService.post('assets/add_vehicle_record', request);
|
|
31
|
+
}
|
|
32
|
+
updateVehicleRecord(request) {
|
|
33
|
+
return this.sneatApiService.post('assets/update_vehicle_record', request);
|
|
34
|
+
}
|
|
35
|
+
deleteVehicleRecord(request) {
|
|
36
|
+
return this.sneatApiService.post('assets/delete_vehicle_record', request);
|
|
37
|
+
}
|
|
38
|
+
watchSpaceAssets(space, category) {
|
|
39
|
+
// console.log('watchAssetsByTeamID()', team.id);
|
|
40
|
+
const filter = category
|
|
41
|
+
? [
|
|
42
|
+
{
|
|
43
|
+
field: 'category',
|
|
44
|
+
operator: '==',
|
|
45
|
+
value: category,
|
|
46
|
+
},
|
|
47
|
+
]
|
|
48
|
+
: undefined;
|
|
49
|
+
return this.watchModuleSpaceItemsWithSpaceRef(space, {
|
|
50
|
+
filter,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: AssetService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
54
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: AssetService }); }
|
|
55
|
+
}
|
|
56
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: AssetService, decorators: [{
|
|
57
|
+
type: Injectable
|
|
58
|
+
}], ctorParameters: () => [] });
|
|
59
|
+
//# sourceMappingURL=asset-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-service.js","sourceRoot":"","sources":["../../../../../../../../libs/extensions/assetus/components/src/lib/services/asset-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAW,eAAe,EAAE,MAAM,YAAY,CAAC;AAWtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;;AAS/D,MAAM,OAAO,YAAa,SAAQ,sBAGjC;IACC;QACE,MAAM,GAAG,GAAG,MAAM,CAAC,gBAAgB,CAA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;QAEjC,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,8BAA8B,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;IAIM,gBAAgB,CAIrB,KAAoB,EACpB,QAAwB;QAExB,iDAAiD;QACjD,MAAM,MAAM,GAA0B,QAAQ;YAC5C,CAAC,CAAC;gBACE;oBACE,KAAK,EAAE,UAAU;oBACjB,QAAQ,EAAE,IAAI;oBACd,KAAK,EAAE,QAAQ;iBAChB;aACF;YACH,CAAC,CAAC,SAAS,CAAC;QACd,OAAO,IAAI,CAAC,iCAAiC,CAC3C,KAAK,EACL;YACE,MAAM;SACP,CAC+C,CAAC;IACrD,CAAC;8GAlFU,YAAY;kHAAZ,YAAY;;2FAAZ,YAAY;kBADxB,UAAU","sourcesContent":["import { HttpParams } from '@angular/common/http';\nimport { Injectable, inject, Injector } from '@angular/core';\nimport { Firestore as AngularFirestore } from '@angular/fire/firestore';\nimport { IFilter, SneatApiService } from '@sneat/api';\nimport {\n AssetCategory,\n IAssetBrief,\n IAssetDboBase,\n IAssetContext,\n IAssetDbo,\n AssetExtraType,\n IAssetExtra,\n} from '@sneat/mod-assetus-core';\nimport { ISpaceContext } from '@sneat/space-models';\nimport { ModuleSpaceItemService } from '@sneat/space-services';\nimport { Observable } from 'rxjs';\nimport {\n IAddVehicleRecordRequest,\n ICreateAssetRequest,\n IUpdateAssetRequest,\n} from './asset-service.dto';\n\n@Injectable()\nexport class AssetService extends ModuleSpaceItemService<\n IAssetBrief<string>,\n IAssetDboBase<string>\n> {\n constructor() {\n const afs = inject(AngularFirestore);\n const sneatApiService = inject(SneatApiService);\n const injector = inject(Injector);\n super(injector, 'assetus', 'assets', afs, sneatApiService);\n }\n\n public deleteAsset(spaceID: string, assetID: string): Observable<void> {\n const request = new HttpParams({\n fromObject: { id: assetID, space: spaceID },\n });\n return this.sneatApiService.delete<void>('assets/delete_asset', request);\n }\n\n public updateAsset(request: IUpdateAssetRequest): Observable<void> {\n return this.sneatApiService.post('assets/update_asset', request);\n }\n\n public createAsset<\n ExtraType extends AssetExtraType,\n Extra extends IAssetExtra,\n >(\n space: ISpaceContext,\n request: ICreateAssetRequest<ExtraType, Extra>,\n ): Observable<IAssetContext<ExtraType, Extra>> {\n // console.log(`AssetService.createAsset()`, request);\n request = { ...request, asset: { ...request.asset, isRequest: true } };\n return this.createSpaceItem<\n IAssetBrief<ExtraType, Extra>,\n IAssetDbo<ExtraType, Extra>\n >(\n 'assets/create_asset?assetCategory=' + request.asset.category,\n space,\n request,\n );\n }\n\n public addVehicleRecord(request: IAddVehicleRecordRequest): Observable<void> {\n return this.sneatApiService.post('assets/add_vehicle_record', request);\n }\n\n public updateVehicleRecord(\n request: IAddVehicleRecordRequest,\n ): Observable<void> {\n return this.sneatApiService.post('assets/update_vehicle_record', request);\n }\n\n public deleteVehicleRecord(\n request: IAddVehicleRecordRequest,\n ): Observable<void> {\n return this.sneatApiService.post('assets/delete_vehicle_record', request);\n }\n\n public readonly watchAssetByID = this.watchSpaceItemByIdWithSpaceRef;\n\n public watchSpaceAssets<\n ExtraType extends AssetExtraType,\n Extra extends IAssetExtra,\n >(\n space: ISpaceContext,\n category?: AssetCategory,\n ): Observable<IAssetContext<ExtraType, Extra>[]> {\n // console.log('watchAssetsByTeamID()', team.id);\n const filter: IFilter[] | undefined = category\n ? [\n {\n field: 'category',\n operator: '==',\n value: category,\n },\n ]\n : undefined;\n return this.watchModuleSpaceItemsWithSpaceRef<IAssetDbo<ExtraType, Extra>>(\n space,\n {\n filter,\n },\n ) as Observable<IAssetContext<ExtraType, Extra>[]>;\n }\n}\n"]}
|