@@ -148,4 +160,21 @@
ng-click="$ctrl.save()">
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js
index ebf70e886..c3d3e5eab 100644
--- a/modules/worker/front/time-control/index.js
+++ b/modules/worker/front/time-control/index.js
@@ -294,6 +294,42 @@ class Controller extends Section {
this.$.editEntry.show($event);
}
+ getWeekNumber(currentDate) {
+ const startDate = new Date(currentDate.getFullYear(), 0, 1);
+ let days = Math.floor((currentDate - startDate) /
+ (24 * 60 * 60 * 1000));
+ return Math.ceil(days / 7);
+ }
+
+ isSatisfied() {
+ const weekNumber = this.getWeekNumber(this.date);
+ const params = {
+ workerId: this.worker.id,
+ year: this.date.getFullYear(),
+ week: weekNumber,
+ state: 'CONFIRMED'
+ };
+ const query = `WorkerTimeControls/updateWorkerTimeControlMail`;
+ this.$http.post(query, params).then(() => {
+ this.vnApp.showSuccess(this.$t('Data saved!'));
+ });
+ }
+
+ isUnsatisfied() {
+ const weekNumber = this.getWeekNumber(this.date);
+ const params = {
+ workerId: this.worker.id,
+ year: this.date.getFullYear(),
+ week: weekNumber,
+ state: 'REVISE',
+ reason: this.reason
+ };
+ const query = `WorkerTimeControls/updateWorkerTimeControlMail`;
+ this.$http.post(query, params).then(() => {
+ this.vnApp.showSuccess(this.$t('Data saved!'));
+ });
+ }
+
save() {
try {
const entry = this.selectedRow;
diff --git a/modules/worker/front/time-control/locale/es.yml b/modules/worker/front/time-control/locale/es.yml
index 8b2486f05..2a3bffc00 100644
--- a/modules/worker/front/time-control/locale/es.yml
+++ b/modules/worker/front/time-control/locale/es.yml
@@ -10,4 +10,7 @@ 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
\ No newline at end of file
+The entry type can't be empty: El tipo de fichada no puede quedar vacía
+Satisfied: Conforme
+Not satisfied: No conforme
+Reason: Motivo
\ No newline at end of file