Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions backend-weekly-report/src/middleware/checkAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const jwt = require("jsonwebtoken");

module.exports = (req, res, next) => {
try {
console.log("👑👑👑👑👑👑", req.body);
const token = req.headers.authorization;
const decodedToken = jwt.verify(token, "dvurising");
req.userData = decodedToken;
Expand Down
2 changes: 2 additions & 0 deletions backend-weekly-report/src/middleware/checkGmAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ module.exports = (req, res, next) => {
try {
const token = req.headers.authorization;
const decodedToken = jwt.verify(token, "dvurising");
console.log("🚀 🚀🚀🚀~ file: checkGmAuth.js ~ line 8 ~ req.body.gm_id", req.body)
console.log("🚀 🚀🚀🚀~ file: checkGmAuth.js ~ line 8 ~ decodedToken.gm_id", decodedToken)
if (decodedToken.is_gm == true) {
next();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ <h1 *ngIf="rows" class="jumbotron-heading">{{ rows[0]? rows[0].week_id + ". Haft
class="form-control"
[ngClass]="{ 'is-invalid': f.actions.errors && (f.actions.touched || f.actions.dirty) }">
</textarea>
<mat-error *ngIf="f.actions.errors && (f.actions.touched || f.actions.dirty)">Alınan aksiyonlar en az 20 karakter içermelidir.</mat-error>
<mat-error *ngIf="f.actions.errors && (f.actions.touched || f.actions.dirty)">Alınan aksiyonlar en az 30 karakter içermelidir.</mat-error>
</div>
</div>
</td>
Expand Down Expand Up @@ -165,7 +165,7 @@ <h1 *ngIf="rows" class="jumbotron-heading">{{ rows[0]? rows[0].week_id + ". Haft
class="form-control"></textarea>
</div>
</div>
<div class="form-group row float-right mt-4 mr-1">
<div style="background-color: #f44336;" class="form-group row float-right mt-4 mr-1">
<button (click)="addRow()" [disabled]="!rowForm.valid" name="submit" type="submit"
class="btn btn-primary">Satırı Ekle</button>
</div>
Expand Down Expand Up @@ -232,7 +232,7 @@ <h6>HAFTALIK FAALİYETLER</h6>
<td>{{row.actions}}</td>
<td>{{row.comments}}</td>
<!-- <td>{{row.code | vatAdded: 10 | currency:'₺'}}</td> -->
<td [style.color]="setColor(row.matter+1)" class="font-weight-bolder">{{row.matter+1}}</td>
<td [style.color]="setColor(row.matter+1)" class="font-weight-bolder">{{colorName(row.matter+1)}}</td>
<td>{{row.start_date | date: 'dd/MM/yyyy'}}</td>
<td>{{row.finish_date | date: 'dd/MM/yyyy'}}</td>
<td>{{row.is_timeout ? "Var":"Yok"}}</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,40 @@ export class ReportDetailComponent implements OnInit {
this.pasteModel.finish_date = row.finish_date;
this.pasteModel.actions = row.actions;
this.pasteModel.weekly_time_spent = row.weekly_time_spent;
this.pasteModel.is_timeout = row.is_timeout ? 'Var' : 'Yok';
this.pasteModel.is_timeout = row.is_timeout==true ? 'Var' : 'Yok';
this.pasteModel.comments = row.comments;
}

CheckAllOptions() {
let boxes = this.checkBoxes
if (boxes.every(val => val.checked == true))
let boxes = this.checkBoxes;

if (boxes.every((val) => val.checked == true))
for (let i = 0; i < boxes.length; i++) {
boxes[i].checked = false;
}
else
for (let i = 0; i < boxes.length; i++) {
boxes[i].checked = true;
}
}

colorName(matter_number) {
switch (matter_number) {
case 1:
return 'çok düşük';
case 1:
return 'düşük';
case 3:
return 'normal';
case 4:
return 'yüksek';
case 5:
return 'çok yüksek';
case 6:
return 'çok düşük';
default:
return 'belirtilmemiş';
}
}

setColor(matter: string): string {
Expand Down Expand Up @@ -194,16 +212,19 @@ export class ReportDetailComponent implements OnInit {
: 'yapılan işler eklenmeden gönderildi. ';
let subject = `<${week_id}>.Hafta<${worker_name}>`;

let html = `<h3><${week_id?week_id+".Hafta":"Rapor Numarası: "+this.reportId}><${worker_name}></h3>${week_id}. Hafta raporu ${worker_name} tarafından gönderildi.<br>Raporu hemen görüntülemek için<a href="http://localhost:4200/report-detail/${this.reportId}">tıklayınız</a>`;
let html = `<h3><${
week_id ? week_id + '.Hafta' : 'Rapor Numarası: ' + this.reportId
}><${worker_name}></h3>${week_id}. Hafta raporu ${worker_name} tarafından gönderildi.<br>Raporu hemen görüntülemek için<a href="http://localhost:4200/report-detail/${
this.reportId
}">tıklayınız</a>`;

let mailPacket = {
general_manager_email: general_manager_email,
subject: subject,
html: html,
};

this.mailService.sentToGm(mailPacket).subscribe((data) => {
});
this.mailService.sentToGm(mailPacket).subscribe((data) => {});
}

sendMailToWorker() {
Expand All @@ -222,13 +243,11 @@ export class ReportDetailComponent implements OnInit {
subject: subject,
html: html,
};
this.mailService.sentToGm(mailPacket).subscribe((data) => {
});
this.mailService.sentToGm(mailPacket).subscribe((data) => {});
}

sendMailToWorker2(mailPacket) {
this.mailService.sentToWorker(mailPacket).subscribe((data) => {
});
this.mailService.sentToWorker(mailPacket).subscribe((data) => {});
}

getRows(report_id: any) {
Expand All @@ -237,7 +256,9 @@ export class ReportDetailComponent implements OnInit {
if (response.resCode == 200) {
this.toastrService.success(response.message);
this.rows = response.data; //sadece rowları değil yanında week idyi de getirir
this.week_id = response.data[0].week_id?response.data[0].week_id:"boş";
this.week_id = response.data[0].week_id
? response.data[0].week_id
: 'boş';
response.data.forEach((row) => {
this.checkBoxes.push({
checked: row.checked_by_admin,
Expand Down Expand Up @@ -302,7 +323,7 @@ export class ReportDetailComponent implements OnInit {
if (checkBoxes.length > 0) {
const dialogRef = this.dialog.open(PopupEditComponent, {
width: '400px',
data: { name: this.name, claimant_comment: this.claimant_comment},
data: { name: this.name, claimant_comment: this.claimant_comment },
});

checkBoxes.forEach((item) => {
Expand Down Expand Up @@ -353,11 +374,10 @@ export class ReportDetailComponent implements OnInit {
};

this.sendMailToWorker2(mailPacket);
debugger
debugger;
this.toastrService.success('kullanıcıya e posta gönderildi');
});
}
else {
} else {
this.toastrService.info('Rapor gönderim işlemi iptal edildi');
}
});
Expand All @@ -371,49 +391,56 @@ export class ReportDetailComponent implements OnInit {
dialogRef.afterClosed().subscribe((result) => {
this.claimant_comment = result;
if (this.claimant_comment.length > 0) {

this.workerService.getByReport(this.reportId).subscribe((worker) => {
this.worker_name = worker[0].worker_name;
this.worker_surname = worker[0].worker_surname;
this.worker_email = worker[0].worker_email;
this.week_id? worker[0].week_id: 0;

this.reportService.sendBackReport(this.reportId).subscribe((data) => {
this.toastrService.info(
`${this.reportId} numaralı rapor gönderilmedi olarak işaretlenmiştir`
);
});
let mailPacket = {
worker_email: this.worker_email,
subject: `<${this.week_id?this.week_id : "Boş"}>.Rapor.Düzeltme Talebi`,
html: `
this.workerService.getByReport(this.reportId).subscribe((worker) => {
this.worker_name = worker[0].worker_name;
this.worker_surname = worker[0].worker_surname;
this.worker_email = worker[0].worker_email;
this.week_id ? worker[0].week_id : 0;

this.reportService
.sendBackReport(this.reportId)
.subscribe((data) => {
this.toastrService.info(
`${this.reportId} numaralı rapor gönderilmedi olarak işaretlenmiştir`
);
});
let mailPacket = {
worker_email: this.worker_email,
subject: `<${
this.week_id ? this.week_id : 'Boş'
}>.Rapor.Düzeltme Talebi`,
html: `
<table>
<tr>
<td>Başlık</td>
<td>Açıklama</td>
<td>Yönetici Yorumu</td>
</tr>
<tr>
<td>${this.worker_name} ${this.worker_surname} Rapor düzenleme talebi</td>
<td>${this.worker_name} ${
this.worker_surname
} Rapor düzenleme talebi</td>
<td>

Sn. ${this.worker_name} ${this.worker_surname}, <br>${this.week_id?this.week_id:""}. haftalık raporunuzu boş olarak gönderdiniz. Tekrar <br> düzenlemelisiniz. <b>raporunuz gönderilmedi olarak </b> işaretlendi
Sn. ${this.worker_name} ${this.worker_surname}, <br>${
this.week_id ? this.week_id : ''
}. haftalık raporunuzu boş olarak gönderdiniz. Tekrar <br> düzenlemelisiniz. <b>raporunuz gönderilmedi olarak </b> işaretlendi
<br>
<b>raporu düzenlemek için</b><a href="http://localhost:4200/report-detail/${this.reportId}">tıklayınız</a>
<b>raporu düzenlemek için</b><a href="http://localhost:4200/report-detail/${
this.reportId
}">tıklayınız</a>
</td>
<td>${this.claimant_comment}</td>
</tr>

</table>
`,
};
};

this.sendMailToWorker2(mailPacket);
this.toastrService.success('kullanıcıya e posta gönderildi');
});
}
else
this.toastrService.info("Rapor revizyon işlemi iptal edildi")
this.sendMailToWorker2(mailPacket);
this.toastrService.success('kullanıcıya e posta gönderildi');
});
} else this.toastrService.info('Rapor revizyon işlemi iptal edildi');
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h2 class="h2">Şifre sıfırlama</h2>
<p *ngIf="message=='Şifreler uyuşmuyor.'" class="alert alert-warning">{{message}}</p>
<div class="form-group row">
<div class="offset-4 col-8">
<button (click)="sendResetPasswordEmail()" class="btn btn-primary">E posta gönder</button>
<button (click)="setPassword()" class="btn btn-primary">E posta gönder</button>
</div>
</div>
</form>
Expand Down
Loading