refactor code
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
05d91ed50e
commit
35b47c6da2
|
@ -97,7 +97,8 @@
|
|||
<vn-button
|
||||
label="Resend"
|
||||
ng-click="$ctrl.resendEmail()"
|
||||
class="right">
|
||||
class="right"
|
||||
ng-show="::$ctrl.isHr">
|
||||
</vn-button>
|
||||
</vn-button-bar>
|
||||
|
||||
|
|
|
@ -26,10 +26,22 @@ class Controller extends Section {
|
|||
this.date = initialDate;
|
||||
}
|
||||
|
||||
get isHr() {
|
||||
return this.aclService.hasAny(['hr']);
|
||||
}
|
||||
|
||||
get worker() {
|
||||
return this._worker;
|
||||
}
|
||||
|
||||
get weekNumber() {
|
||||
return this.getWeekNumber(this.date);
|
||||
}
|
||||
|
||||
set weekNumber(value) {
|
||||
this._weekNumber = value;
|
||||
}
|
||||
|
||||
set worker(value) {
|
||||
this._worker = value;
|
||||
}
|
||||
|
@ -306,11 +318,10 @@ class Controller extends Section {
|
|||
}
|
||||
|
||||
isSatisfied() {
|
||||
const weekNumber = this.getWeekNumber(this.date);
|
||||
const params = {
|
||||
workerId: this.worker.id,
|
||||
year: this.date.getFullYear(),
|
||||
week: weekNumber,
|
||||
week: this.weekNumber,
|
||||
state: 'CONFIRMED'
|
||||
};
|
||||
const query = `WorkerTimeControls/updateWorkerTimeControlMail`;
|
||||
|
@ -321,11 +332,10 @@ class Controller extends Section {
|
|||
}
|
||||
|
||||
isUnsatisfied() {
|
||||
const weekNumber = this.getWeekNumber(this.date);
|
||||
const params = {
|
||||
workerId: this.worker.id,
|
||||
year: this.date.getFullYear(),
|
||||
week: weekNumber,
|
||||
week: this.weekNumber,
|
||||
state: 'REVISE',
|
||||
reason: this.reason
|
||||
};
|
||||
|
@ -374,11 +384,9 @@ class Controller extends Section {
|
|||
this.$http.get('WorkerTimeControlMails/findOne', {filter})
|
||||
.then(res => {
|
||||
const state = res.data.state;
|
||||
const currentWeekNumber = this.getWeekNumber(this.date);
|
||||
if (currentWeekNumber == weekNumberValue) {
|
||||
if (this.weekNumber == weekNumberValue) {
|
||||
this.state = state;
|
||||
this.reason = res.data.reason;
|
||||
console.log(currentWeekNumber, weekNumberValue, this.state, this.reason);
|
||||
}
|
||||
if (state == 'CONFIRMED') {
|
||||
weekNumber.classList.add('confirmed');
|
||||
|
@ -390,25 +398,17 @@ class Controller extends Section {
|
|||
}
|
||||
|
||||
resendEmail() {
|
||||
const filter = {
|
||||
where: {userFk: this.$params.id},
|
||||
const timestamp = this.date.getTime() / 1000;
|
||||
const url = `${window.location.origin}/#!/worker/${this.worker.id}/time-control?timestamp=${timestamp}`;
|
||||
const params = {
|
||||
recipient: this.worker.user.emailUser.email,
|
||||
week: this.weekNumber + 1,
|
||||
year: this.date.getFullYear(),
|
||||
url: url,
|
||||
};
|
||||
this.$http.get('EmailUsers/findOne', {filter})
|
||||
this.$http.post(`WorkerTimeControls/weekly-hour-hecord-email`, params)
|
||||
.then(res => {
|
||||
const timestamp = this.date.getTime() / 1000;
|
||||
const url = `${window.location.origin}/#!/worker/${this.$params.id}/time-control?timestamp=${timestamp}`;
|
||||
const weekNumber = this.getWeekNumber(this.date);
|
||||
|
||||
const params = {
|
||||
recipient: res.data.email,
|
||||
week: weekNumber + 1,
|
||||
year: this.date.getFullYear(),
|
||||
url: url,
|
||||
};
|
||||
this.$http.post(`WorkerTimeControls/weekly-hour-hecord-email`, params)
|
||||
.then(res => {
|
||||
this.vnApp.showSuccess(this.$t('Email sended'));
|
||||
});
|
||||
this.vnApp.showSuccess(this.$t('Email sended'));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue