Ammends
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2021-06-18 12:32:37 +02:00
parent c622f24b0a
commit 0ff114ff36
5 changed files with 35 additions and 17 deletions

View File

@ -181,8 +181,6 @@ describe('workerTimeControl add/delete timeEntry()', () => {
ctx.args = {direction: 'out'};
const updatedTimeEntry = await models.WorkerTimeControl.updateTimeEntry(ctx, createdTimeEntry.id, options);
// const deletedTimeEntry = await models.WorkerTimeControl.findById(createdTimeEntry.id, null, options);
expect(updatedTimeEntry.direction).toEqual('out');
await tx.rollback();
} catch (e) {

View File

@ -133,8 +133,8 @@
<!-- Edit entry Popover -->
<vn-popover vn-id="editEntry">
<vn-horizontal class="vn-pa-sm edit-entry">
<vn-autocomplete class="dense" style="width: 200px"
<vn-horizontal class="vn-pa-sm edit-time-entry">
<vn-autocomplete class="dense"
ng-model="$ctrl.selectedRow.direction"
data="$ctrl.entryDirections"
select-fields="['code','description']"

View File

@ -255,9 +255,20 @@ class Controller extends Section {
}
addTime() {
try {
const entry = this.newTimeEntry;
if (!entry.direction)
throw new Error(`The entry type can't be empty`);
const query = `WorkerTimeControls/${this.worker.id}/addTimeEntry`;
this.$http.post(query, this.newTimeEntry)
this.$http.post(query, entry)
.then(() => this.fetchHours());
} catch (e) {
this.vnApp.showError(this.$t(e.message));
return false;
}
return true;
}
showDeleteDialog($event, hour) {
@ -284,12 +295,19 @@ class Controller extends Section {
}
save() {
try {
const entry = this.selectedRow;
if (!entry.direction)
throw new Error(`The entry type can't be empty`);
const query = `WorkerTimeControls/${entry.id}/updateTimeEntry`;
this.$http.post(query, {direction: entry.direction})
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')))
.then(() => this.$.editEntry.hide())
.then(() => this.fetchHours());
} catch (e) {
this.vnApp.showError(this.$t(e.message));
}
}
}

View File

@ -10,3 +10,4 @@ This time entry will be deleted: Se eliminará la hora fichada
Are you sure you want to delete this entry?: ¿Seguro que quieres eliminarla?
Finish at: Termina a las
Entry removed: Fichada borrada
The entry type can't be empty: El tipo de fichada no puede quedar vacía

View File

@ -24,7 +24,8 @@ vn-worker-time-control {
.totalBox {
max-width: none
}
.edit-entry {
width: 150px
}
.edit-time-entry {
width: 200px
}