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
|
<vn-button
|
||||||
label="Resend"
|
label="Resend"
|
||||||
ng-click="$ctrl.resendEmail()"
|
ng-click="$ctrl.resendEmail()"
|
||||||
class="right">
|
class="right"
|
||||||
|
ng-show="::$ctrl.isHr">
|
||||||
</vn-button>
|
</vn-button>
|
||||||
</vn-button-bar>
|
</vn-button-bar>
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,22 @@ class Controller extends Section {
|
||||||
this.date = initialDate;
|
this.date = initialDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isHr() {
|
||||||
|
return this.aclService.hasAny(['hr']);
|
||||||
|
}
|
||||||
|
|
||||||
get worker() {
|
get worker() {
|
||||||
return this._worker;
|
return this._worker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get weekNumber() {
|
||||||
|
return this.getWeekNumber(this.date);
|
||||||
|
}
|
||||||
|
|
||||||
|
set weekNumber(value) {
|
||||||
|
this._weekNumber = value;
|
||||||
|
}
|
||||||
|
|
||||||
set worker(value) {
|
set worker(value) {
|
||||||
this._worker = value;
|
this._worker = value;
|
||||||
}
|
}
|
||||||
|
@ -306,11 +318,10 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
isSatisfied() {
|
isSatisfied() {
|
||||||
const weekNumber = this.getWeekNumber(this.date);
|
|
||||||
const params = {
|
const params = {
|
||||||
workerId: this.worker.id,
|
workerId: this.worker.id,
|
||||||
year: this.date.getFullYear(),
|
year: this.date.getFullYear(),
|
||||||
week: weekNumber,
|
week: this.weekNumber,
|
||||||
state: 'CONFIRMED'
|
state: 'CONFIRMED'
|
||||||
};
|
};
|
||||||
const query = `WorkerTimeControls/updateWorkerTimeControlMail`;
|
const query = `WorkerTimeControls/updateWorkerTimeControlMail`;
|
||||||
|
@ -321,11 +332,10 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
isUnsatisfied() {
|
isUnsatisfied() {
|
||||||
const weekNumber = this.getWeekNumber(this.date);
|
|
||||||
const params = {
|
const params = {
|
||||||
workerId: this.worker.id,
|
workerId: this.worker.id,
|
||||||
year: this.date.getFullYear(),
|
year: this.date.getFullYear(),
|
||||||
week: weekNumber,
|
week: this.weekNumber,
|
||||||
state: 'REVISE',
|
state: 'REVISE',
|
||||||
reason: this.reason
|
reason: this.reason
|
||||||
};
|
};
|
||||||
|
@ -374,11 +384,9 @@ class Controller extends Section {
|
||||||
this.$http.get('WorkerTimeControlMails/findOne', {filter})
|
this.$http.get('WorkerTimeControlMails/findOne', {filter})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const state = res.data.state;
|
const state = res.data.state;
|
||||||
const currentWeekNumber = this.getWeekNumber(this.date);
|
if (this.weekNumber == weekNumberValue) {
|
||||||
if (currentWeekNumber == weekNumberValue) {
|
|
||||||
this.state = state;
|
this.state = state;
|
||||||
this.reason = res.data.reason;
|
this.reason = res.data.reason;
|
||||||
console.log(currentWeekNumber, weekNumberValue, this.state, this.reason);
|
|
||||||
}
|
}
|
||||||
if (state == 'CONFIRMED') {
|
if (state == 'CONFIRMED') {
|
||||||
weekNumber.classList.add('confirmed');
|
weekNumber.classList.add('confirmed');
|
||||||
|
@ -390,25 +398,17 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
resendEmail() {
|
resendEmail() {
|
||||||
const filter = {
|
const timestamp = this.date.getTime() / 1000;
|
||||||
where: {userFk: this.$params.id},
|
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 => {
|
.then(res => {
|
||||||
const timestamp = this.date.getTime() / 1000;
|
this.vnApp.showSuccess(this.$t('Email sended'));
|
||||||
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'));
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue