Implement eviction lawsuit initiation feature for Mietobjekt; add related UI and backend logic; update localization and configuration

This commit is contained in:
2026-01-24 11:51:16 +01:00
parent 3da6d140c7
commit ec612318c3
8 changed files with 250 additions and 4 deletions

View File

@@ -0,0 +1,57 @@
define('custom:handlers/mietobjekt/eviction-action', [], function () {
/**
* Handler for initiating eviction lawsuit from Mietobjekt
*/
return class {
constructor(view) {
this.view = view;
}
/**
* Initialize the handler
*/
initEvictionAction() {
// Initialization if needed
}
/**
* Action to initiate eviction (Räumungsklage)
*/
initiateEviction() {
const model = this.view.model;
// Confirm dialog
this.view.confirm(
this.view.translate('initiateEvictionConfirmation', 'messages', 'CMietobjekt'),
() => {
Espo.Ui.notify(this.view.translate('pleaseWait', 'messages'));
// POST request to backend
Espo.Ajax.postRequest('CMietobjekt/action/initiateEviction', {
id: model.id
}).then(response => {
Espo.Ui.success(
this.view.translate('evictionCreatedSuccess', 'messages', 'CMietobjekt')
);
// Navigate to the newly created Räumungsklage
this.view.getRouter().navigate(
'#CVmhRumungsklage/view/' + response.id,
{trigger: true}
);
}).catch(xhr => {
let message = this.view.translate('evictionCreatedError', 'messages', 'CMietobjekt');
if (xhr.responseJSON && xhr.responseJSON.message) {
message = xhr.responseJSON.message;
}
Espo.Ui.error(message);
});
}
);
}
};
});