refs #5334 fix descriptor
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Satorres 2023-05-30 13:21:57 +02:00
parent 45085cccc8
commit 8860c77147
2 changed files with 23 additions and 6 deletions

View File

@ -3,16 +3,15 @@
description="$ctrl.department.name"
base-state="worker.department">
<slot-menu>
<vn-item
ng-click="$ctrl.handleExcluded()"
translate
ng-if="!$ctrl.excluded">
<vn-item
ng-click="deleteConfirmation.show()"
ng-show="$ctrl.isEditable"
name="deleteDepartment"
translate>
Delete
</vn-item>
</slot-menu>
<slot-body>
<h2>{{department}}</h2>
<p>{{department.id}}</p>
<div class="attributes">
<vn-label-value
label="Chat"
@ -38,6 +37,11 @@
<vn-worker-summary worker="$ctrl.worker"></vn-worker-summary>
</vn-popup>
<vn-confirm
vn-id="deleteConfirmation"
on-accept="$ctrl.deleteDepartment()"
question="You are going to delete this department">
</vn-confirm>
<!-- Upload photo dialog -->
<!-- <vn-upload-photo
vn-id="uploadPhoto"

View File

@ -14,6 +14,19 @@ class Controller extends Descriptor {
set department(value) {
this.entity = value;
}
deleteDepartment() {
return this.$http.post(`Departments/${this.id}/setDeleted`)
.then(() => this.reload())
.then(() => {
const isInsideDepartment = this.$state.current.name.startsWith('department');
if (isInsideDepartment)
this.$state.go('department.index');
this.vnApp.showSuccess(this.$t('Department deleted.'));
});
}
loadData() {
const filter = {
fields: ['id', 'name', 'code', 'workerFk', 'isProduction', 'chatName',