Files
gilze-angular/app/pages/user/form/edit-user-form.component.js
T
2026-06-17 16:11:25 +02:00

47 lines
2.3 KiB
JavaScript

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1 = require("@angular/core");
var user_class_1 = require("../../../classes/user.class");
var data_service_1 = require("./../../../services/data.service");
var EditUserFormComponent = (function () {
function EditUserFormComponent(data) {
this.data = data;
this.roles = ['Pilot', 'Student', 'Instructor'];
this.submitted = false;
}
EditUserFormComponent.prototype.ngOnInit = function () {
this.user = new user_class_1.User(this.model.id, this.model.name, this.model.card, this.model.role);
};
EditUserFormComponent.prototype.onSubmit = function () {
var _this = this;
this.model.name = this.user.name;
this.model.role = this.user.role;
this.submitted = true;
this.data.load().then(function () {
_this.data.editUser(_this.model).subscribe(function (b) { return _this.temp = JSON.stringify(b); });
console.log(_this.temp);
});
};
return EditUserFormComponent;
}());
__decorate([
core_1.Input(),
__metadata("design:type", user_class_1.User)
], EditUserFormComponent.prototype, "model", void 0);
EditUserFormComponent = __decorate([
core_1.Component({
selector: 'edit-user-form',
templateUrl: './edit-user-form.component.html'
}),
__metadata("design:paramtypes", [data_service_1.DataService])
], EditUserFormComponent);
exports.EditUserFormComponent = EditUserFormComponent;
//# sourceMappingURL=edit-user-form.component.js.map