From 4d1c61359febb7d11cb7393c78d928c5f3f110b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Engin=20Karata=C5=9F?= <43602725+EnginKARATAS@users.noreply.github.com> Date: Mon, 27 Sep 2021 08:41:04 +0300 Subject: [PATCH 1/4] Revert "prod email links adjusted" This reverts commit 8c0e57f5fa02f8cea510daa738866e064b732248. --- backend-weekly-report/app.js | 12 ++----- .../src/middleware/checkAuth.js | 1 + .../src/middleware/checkGmAuth.js | 2 ++ .../reset-password.component.html | 2 +- .../reset-password.component.ts | 33 +++++++++++++------ .../src/app/services/auth.service.ts | 4 +-- .../src/app/services/claimant.service.ts | 2 +- .../src/app/services/mail.service.ts | 4 +-- .../src/app/services/report.service.ts | 16 ++++----- .../src/app/services/row.service.ts | 4 +-- .../src/app/services/worker.service.ts | 8 ++--- .../set-password/set-password.component.ts | 5 ++- 12 files changed, 51 insertions(+), 42 deletions(-) diff --git a/backend-weekly-report/app.js b/backend-weekly-report/app.js index 2d83f17..6091542 100644 --- a/backend-weekly-report/app.js +++ b/backend-weekly-report/app.js @@ -109,7 +109,7 @@ app.post("/sendResetEmail", (req, res) => { let sql = "select * from workers where worker_email = ? "; con.query(sql, [email], (err, worker) => { - if (worker.length > 0) { + if (worker.length > 0) { crypto.randomBytes(127, (err, buf) => { let worker_name = worker[0].worker_name; let worker_surname = worker[0].worker_surname; @@ -121,11 +121,7 @@ app.post("/sendResetEmail", (req, res) => { con.query(update, data, (err, row) => { if (err) { - res.json({ - message: err, - resCode: 399, - }); - res.end() + res.json(err); } else { let mailSended = mailer.sendMailToWorker( email, @@ -137,7 +133,6 @@ app.post("/sendResetEmail", (req, res) => { message: "Şifre sıfırlamanız için email gönderildi", resCode: 200, }); - res.end(); } }); }); @@ -146,7 +141,6 @@ app.post("/sendResetEmail", (req, res) => { message: "E mailiniz sistemimizde kayıtlı değildir", resCode: 400, }); - res.end(); } }); }); @@ -226,7 +220,7 @@ app.post("/api/workers", checkAuth, function (req, res) { let subject = "Katana Reporting Kaydı!"; let html = `Değerli çalışanımız, katana reporting uygulamasına davet edildiniz. Dilerseniz aşağıdaki linke tıklayark şifrenizi belirleyebilirsiniz -
Kullanıcı adı: ${username}
şifre:belirlemek için bu linke tıklayınız`; +
Kullanıcı adı: ${username}
şifre:belirlemek için bu linke tıklayınız`; // ${req.headers.host} let data = [ worker_name, diff --git a/backend-weekly-report/src/middleware/checkAuth.js b/backend-weekly-report/src/middleware/checkAuth.js index 992881a..bc93408 100644 --- a/backend-weekly-report/src/middleware/checkAuth.js +++ b/backend-weekly-report/src/middleware/checkAuth.js @@ -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; diff --git a/backend-weekly-report/src/middleware/checkGmAuth.js b/backend-weekly-report/src/middleware/checkGmAuth.js index bed398a..4afda09 100644 --- a/backend-weekly-report/src/middleware/checkGmAuth.js +++ b/backend-weekly-report/src/middleware/checkGmAuth.js @@ -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(); } diff --git a/weekly-report-app/src/app/reset-password/reset-password.component.html b/weekly-report-app/src/app/reset-password/reset-password.component.html index abaa076..af7a61c 100644 --- a/weekly-report-app/src/app/reset-password/reset-password.component.html +++ b/weekly-report-app/src/app/reset-password/reset-password.component.html @@ -14,7 +14,7 @@

Şifre sıfırlama

{{message}}

- +
diff --git a/weekly-report-app/src/app/reset-password/reset-password.component.ts b/weekly-report-app/src/app/reset-password/reset-password.component.ts index d9e9b6d..e946900 100644 --- a/weekly-report-app/src/app/reset-password/reset-password.component.ts +++ b/weekly-report-app/src/app/reset-password/reset-password.component.ts @@ -11,13 +11,13 @@ import { WorkerService } from '../services/worker.service'; styleUrls: ['./reset-password.component.css'], }) export class ResetPasswordComponent implements OnInit { - message = ''; + message = "" constructor( private activatedRoute: ActivatedRoute, private formBuilder: FormBuilder, private workerService: WorkerService, private toastr: ToastrService, - private emailService: MailService + private emailService: MailService, ) {} resetPasswordForm: FormGroup; @@ -31,19 +31,32 @@ export class ResetPasswordComponent implements OnInit { this.createRowForm(); } - sendResetPasswordEmail(): void { + setPassword(): void { let email = this.resetPasswordForm.value.email; let regexEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; - + if (email.match(regexEmail)) { - this.workerService.sendResetEmail(email).subscribe((data) => { - if ((data.resCode == 200)) { + this.workerService.sendResetEmail(email).subscribe(data => { + console.log(data) + if (data.resCode = 200) { this.toastr.success(data.message); } - else if ((data.resCode == 400)) { - this.toastr.error(data.message); + if (data.resCode = 400) { + // this.toastr.error(data.message); } - }); - } else this.toastr.error('E posta hatalıdır.'); + }) + + // let mailPacket = { + // worker_email: email, + // subject: "Şifre sıfırlama talebi", + // html: "html", + // }; + + + // this.emailService.sentToWorker(mailPacket) + + + } + else this.toastr.error("E posta hatalıdır.") } } diff --git a/weekly-report-app/src/app/services/auth.service.ts b/weekly-report-app/src/app/services/auth.service.ts index 1f86260..95e5a40 100644 --- a/weekly-report-app/src/app/services/auth.service.ts +++ b/weekly-report-app/src/app/services/auth.service.ts @@ -8,8 +8,8 @@ import { Report } from '../models/reports'; providedIn: 'root' }) export class AuthService { -baseUrl: string = 'http://localhost:4000/auth'; -gmbaseUrl: string = 'http://localhost:4000/gmauth'; +baseUrl: string = 'http://10.41.150.82:4000/auth'; +gmbaseUrl: string = 'http://10.41.150.82:4000/gmauth'; constructor(private http: HttpClient) { } login(username: string, password: string): Observable { diff --git a/weekly-report-app/src/app/services/claimant.service.ts b/weekly-report-app/src/app/services/claimant.service.ts index e6e6963..674c269 100644 --- a/weekly-report-app/src/app/services/claimant.service.ts +++ b/weekly-report-app/src/app/services/claimant.service.ts @@ -6,7 +6,7 @@ import { Observable } from 'rxjs'; providedIn: 'root' }) export class ClaimantService { - baseUrl: string = 'http://localhost:4000/api/claimants' + baseUrl: string = 'http://10.41.150.82:4000/api/claimants' constructor(private http : HttpClient) { } diff --git a/weekly-report-app/src/app/services/mail.service.ts b/weekly-report-app/src/app/services/mail.service.ts index 408ca7b..302e110 100644 --- a/weekly-report-app/src/app/services/mail.service.ts +++ b/weekly-report-app/src/app/services/mail.service.ts @@ -6,8 +6,8 @@ import { Observable } from 'rxjs'; providedIn: 'root', }) export class MailService { - baseUrl: string = 'http://localhost:4000/sendmailtogm'; - secondUrl: string = 'http://localhost:4000/sendmailtoworker'; + baseUrl: string = 'http://10.41.150.82:4000/sendmailtogm'; + secondUrl: string = 'http://10.41.150.82:4000/sendmailtoworker'; constructor(private http: HttpClient) {} sentToGm(data): Observable { diff --git a/weekly-report-app/src/app/services/report.service.ts b/weekly-report-app/src/app/services/report.service.ts index 2bd4ddb..8ac042f 100644 --- a/weekly-report-app/src/app/services/report.service.ts +++ b/weekly-report-app/src/app/services/report.service.ts @@ -7,14 +7,14 @@ import { Report } from '../models/reports'; providedIn: 'root', }) export class ReportService { - baseUrl: string = 'http://localhost:4000/api/reports'; - secondUrl: string = 'http://localhost:4000/api/reports/isreportsended'; - thirdUrl: string = 'http://localhost:4000/api/sendreport'; - fourthUrl: string = 'http://localhost:4000/api/sendbackreport'; - deleteUrl: string = 'http://localhost:4000/deletereportbyid'; - sixthUrl: string = 'http://localhost:4000/api/reports/getByCode'; - seventhUrl: string = 'http://localhost:4000/api/reports/getByAction'; - eighth: string = 'http://localhost:4000/api/reports/getAllReports'; + baseUrl: string = 'http://10.41.150.82:4000/api/reports'; + secondUrl: string = 'http://10.41.150.82:4000/api/reports/isreportsended'; + thirdUrl: string = 'http://10.41.150.82:4000/api/sendreport'; + fourthUrl: string = 'http://10.41.150.82:4000/api/sendbackreport'; + deleteUrl: string = 'http://10.41.150.82:4000/deletereportbyid'; + sixthUrl: string = 'http://10.41.150.82:4000/api/reports/getByCode'; + seventhUrl: string = 'http://10.41.150.82:4000/api/reports/getByAction'; + eighth: string = 'http://10.41.150.82:4000/api/reports/getAllReports'; constructor(private http: HttpClient) {} getAll(gm_id): Observable { diff --git a/weekly-report-app/src/app/services/row.service.ts b/weekly-report-app/src/app/services/row.service.ts index 962f5c6..13bba69 100644 --- a/weekly-report-app/src/app/services/row.service.ts +++ b/weekly-report-app/src/app/services/row.service.ts @@ -7,8 +7,8 @@ import { Row } from '../models/row'; providedIn: 'root', }) export class RowService { - baseUrl: string = 'http://localhost:4000/api/rows'; - secondUrl: string = 'http://localhost:4000/api/rows'; + baseUrl: string = 'http://10.41.150.82:4000/api/rows'; + secondUrl: string = 'http://10.41.150.82:4000/api/rows'; constructor(private http: HttpClient) {} getAll(): Observable { diff --git a/weekly-report-app/src/app/services/worker.service.ts b/weekly-report-app/src/app/services/worker.service.ts index 319b9e4..961a9f4 100644 --- a/weekly-report-app/src/app/services/worker.service.ts +++ b/weekly-report-app/src/app/services/worker.service.ts @@ -6,10 +6,10 @@ import { Observable } from 'rxjs'; providedIn: 'root', }) export class WorkerService { - baseUrl: string = 'http://localhost:4000/api/workers'; - passwordUrl: string = 'http://localhost:4000/setpassword'; - thirdUrl: string = 'http://localhost:4000/getWorkerByReport'; - fourthUrl: string = 'http://localhost:4000/sendResetEmail' + baseUrl: string = 'http://10.41.150.82:4000/api/workers'; + passwordUrl: string = 'http://10.41.150.82:4000/setpassword'; + thirdUrl: string = 'http://10.41.150.82:4000/getWorkerByReport'; + fourthUrl: string = 'http://10.41.150.82:4000/sendResetEmail' constructor(private http: HttpClient) {} diff --git a/weekly-report-app/src/app/set-password/set-password.component.ts b/weekly-report-app/src/app/set-password/set-password.component.ts index 114e3b1..d856f4b 100644 --- a/weekly-report-app/src/app/set-password/set-password.component.ts +++ b/weekly-report-app/src/app/set-password/set-password.component.ts @@ -46,8 +46,7 @@ export class SetPasswordComponent implements OnInit { let repassword = this.setPasswordForm.value.repassword; if (password != repassword) { this.message = 'Şifreler uyuşmuyor.'; - } - else if(password === repassword) { + } else { const data = { token: this.token, password: password, @@ -56,8 +55,8 @@ export class SetPasswordComponent implements OnInit { this.workerService.updatePassword(data).subscribe((data) => { if (data.resCode == 200) { this.router.navigate(['/login']).then((b) => { - this.toastr.success(data.message); window.location.reload(); + this.toastr.success(data.message); }); } if (data.resCode == 400) this.toastr.error(data.message); From 60abe35e796627d4f4ce12f393bce7910bf4ed9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Engin=20Karata=C5=9F?= <43602725+EnginKARATAS@users.noreply.github.com> Date: Mon, 27 Sep 2021 11:05:44 +0300 Subject: [PATCH 2/4] color shows with their names --- backend-weekly-report/app.js | 29 +++-- .../report-detail.component.html | 6 +- .../report-detaill/report-detail.component.ts | 111 +++++++++++------- .../src/app/services/auth.service.ts | 4 +- .../src/app/services/claimant.service.ts | 2 +- .../src/app/services/mail.service.ts | 4 +- .../src/app/services/report.service.ts | 16 +-- .../src/app/services/row.service.ts | 4 +- .../src/app/services/worker.service.ts | 8 +- 9 files changed, 109 insertions(+), 75 deletions(-) diff --git a/backend-weekly-report/app.js b/backend-weekly-report/app.js index 6091542..86276ad 100644 --- a/backend-weekly-report/app.js +++ b/backend-weekly-report/app.js @@ -126,7 +126,7 @@ app.post("/sendResetEmail", (req, res) => { let mailSended = mailer.sendMailToWorker( email, `${worker_name} ${worker_surname} Şifre sıfırlama talebi`, - `Şifre sıfırlama talebiniz alınmıştır. Şifrenizi sıfırlamak için TIKLAYINIZ` + `Şifre sıfırlama talebiniz alınmıştır. Şifrenizi sıfırlamak için TIKLAYINIZ` ); res.json({ @@ -174,27 +174,35 @@ app.put("/setpassword", (req, res) => { resCode: 0, }; - let datenow = Date(); + let date = (new Date ((new Date((new Date(new Date())).toISOString() )).getTime() - ((new Date()).getTimezoneOffset()*60000))).toISOString().slice(0, 19).replace('T', ' '); if (password == repassword) { password = crypto.createHash("md5").update(password).digest("hex"); - let data = [password, token, datenow]; + let data = [password, token, date]; let sql = `UPDATE workers SET password = ? WHERE token = ? AND ? < token_expire `; con.query(sql, data, (err, rows, fields) => { if (err) { + console.log("111111111111"); responseModel.resCode = 400; responseModel.message = err.message; - res.send(responseModel); + res.json(responseModel); + res.end(); + } else { + console.log("222222222"); + + responseModel.message = + "Şifre değiştirme başarılı. Lütfen giriş yapınız."; + responseModel.resCode = 200; + res.json(responseModel); + res.end(); } - responseModel.message = - "Şifre değiştirme başarılı. Lütfen giriş yapınız."; - responseModel.resCode = 200; - res.send(responseModel); }); } else { + console.log("3333333333333"); responseModel.message = "Şifreler uyuşmamaktadır."; responseModel.resCode = 400; res.json(responseModel); + res.end(); } }); @@ -220,7 +228,7 @@ app.post("/api/workers", checkAuth, function (req, res) { let subject = "Katana Reporting Kaydı!"; let html = `Değerli çalışanımız, katana reporting uygulamasına davet edildiniz. Dilerseniz aşağıdaki linke tıklayark şifrenizi belirleyebilirsiniz -
Kullanıcı adı: ${username}
şifre:belirlemek için bu linke tıklayınız`; +
Kullanıcı adı: ${username}
şifre:belirlemek için bu linke tıklayınız`; // ${req.headers.host} let data = [ worker_name, @@ -233,7 +241,6 @@ app.post("/api/workers", checkAuth, function (req, res) { ]; let sql = `INSERT INTO workers (worker_name, worker_surname, job_title, worker_email, username, token, token_expire) VALUES (?, ? , ?, ?, ?, ?, ?)`; con.query(sql, data, function (error, results, fields) { - res.send({ message: "Kullanıcıya kaydolması için e-posta gönderilmiştir.", resCode: 200, @@ -308,7 +315,7 @@ app.post("/gmauth", function (request, response) { muuid: gm.worker_name, memail: gm.worker_email, cid: gm.id, - is_gm: true + is_gm: true, }, "dvurising", { diff --git a/weekly-report-app/src/app/reports/report-detaill/report-detail.component.html b/weekly-report-app/src/app/reports/report-detaill/report-detail.component.html index 839a3c7..8ba2412 100644 --- a/weekly-report-app/src/app/reports/report-detaill/report-detail.component.html +++ b/weekly-report-app/src/app/reports/report-detaill/report-detail.component.html @@ -126,7 +126,7 @@

{{ rows[0]? rows[0].week_id + ". Haft class="form-control" [ngClass]="{ 'is-invalid': f.actions.errors && (f.actions.touched || f.actions.dirty) }"> - Alınan aksiyonlar en az 20 karakter içermelidir. + Alınan aksiyonlar en az 30 karakter içermelidir. @@ -165,7 +165,7 @@

{{ rows[0]? rows[0].week_id + ". Haft class="form-control"> -
+
@@ -232,7 +232,7 @@
HAFTALIK FAALİYETLER
{{row.actions}} {{row.comments}} - {{row.matter+1}} + {{colorName(row.matter+1)}} {{row.start_date | date: 'dd/MM/yyyy'}} {{row.finish_date | date: 'dd/MM/yyyy'}} {{row.is_timeout ? "Var":"Yok"}} diff --git a/weekly-report-app/src/app/reports/report-detaill/report-detail.component.ts b/weekly-report-app/src/app/reports/report-detaill/report-detail.component.ts index 257b557..24a4440 100644 --- a/weekly-report-app/src/app/reports/report-detaill/report-detail.component.ts +++ b/weekly-report-app/src/app/reports/report-detaill/report-detail.component.ts @@ -124,14 +124,14 @@ 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; } @@ -139,7 +139,25 @@ export class ReportDetailComponent implements OnInit { 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 { @@ -194,7 +212,11 @@ export class ReportDetailComponent implements OnInit { : 'yapılan işler eklenmeden gönderildi. '; let subject = `<${week_id}>.Hafta<${worker_name}>`; - let html = `

<${week_id?week_id+".Hafta":"Rapor Numarası: "+this.reportId}><${worker_name}>

${week_id}. Hafta raporu ${worker_name} tarafından gönderildi.
Raporu hemen görüntülemek içintıklayınız`; + let html = `

<${ + week_id ? week_id + '.Hafta' : 'Rapor Numarası: ' + this.reportId + }><${worker_name}>

${week_id}. Hafta raporu ${worker_name} tarafından gönderildi.
Raporu hemen görüntülemek içintıklayınız`; let mailPacket = { general_manager_email: general_manager_email, @@ -202,8 +224,7 @@ export class ReportDetailComponent implements OnInit { html: html, }; - this.mailService.sentToGm(mailPacket).subscribe((data) => { - }); + this.mailService.sentToGm(mailPacket).subscribe((data) => {}); } sendMailToWorker() { @@ -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) { @@ -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, @@ -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) => { @@ -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'); } }); @@ -371,22 +391,25 @@ 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: ` @@ -394,26 +417,30 @@ export class ReportDetailComponent implements OnInit { - +
BaşlıkYönetici Yorumu
${this.worker_name} ${this.worker_surname} Rapor düzenleme talebi${this.worker_name} ${ + this.worker_surname + } Rapor düzenleme talebi - Sn. ${this.worker_name} ${this.worker_surname},
${this.week_id?this.week_id:""}. haftalık raporunuzu boş olarak gönderdiniz. Tekrar
düzenlemelisiniz. raporunuz gönderilmedi olarak işaretlendi + Sn. ${this.worker_name} ${this.worker_surname},
${ + this.week_id ? this.week_id : '' + }. haftalık raporunuzu boş olarak gönderdiniz. Tekrar
düzenlemelisiniz. raporunuz gönderilmedi olarak işaretlendi
- raporu düzenlemek içintıklayınız + raporu düzenlemek içintıklayınız
${this.claimant_comment}
`, - }; + }; - 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'); }); } } diff --git a/weekly-report-app/src/app/services/auth.service.ts b/weekly-report-app/src/app/services/auth.service.ts index 95e5a40..1f86260 100644 --- a/weekly-report-app/src/app/services/auth.service.ts +++ b/weekly-report-app/src/app/services/auth.service.ts @@ -8,8 +8,8 @@ import { Report } from '../models/reports'; providedIn: 'root' }) export class AuthService { -baseUrl: string = 'http://10.41.150.82:4000/auth'; -gmbaseUrl: string = 'http://10.41.150.82:4000/gmauth'; +baseUrl: string = 'http://localhost:4000/auth'; +gmbaseUrl: string = 'http://localhost:4000/gmauth'; constructor(private http: HttpClient) { } login(username: string, password: string): Observable { diff --git a/weekly-report-app/src/app/services/claimant.service.ts b/weekly-report-app/src/app/services/claimant.service.ts index 674c269..e6e6963 100644 --- a/weekly-report-app/src/app/services/claimant.service.ts +++ b/weekly-report-app/src/app/services/claimant.service.ts @@ -6,7 +6,7 @@ import { Observable } from 'rxjs'; providedIn: 'root' }) export class ClaimantService { - baseUrl: string = 'http://10.41.150.82:4000/api/claimants' + baseUrl: string = 'http://localhost:4000/api/claimants' constructor(private http : HttpClient) { } diff --git a/weekly-report-app/src/app/services/mail.service.ts b/weekly-report-app/src/app/services/mail.service.ts index 302e110..408ca7b 100644 --- a/weekly-report-app/src/app/services/mail.service.ts +++ b/weekly-report-app/src/app/services/mail.service.ts @@ -6,8 +6,8 @@ import { Observable } from 'rxjs'; providedIn: 'root', }) export class MailService { - baseUrl: string = 'http://10.41.150.82:4000/sendmailtogm'; - secondUrl: string = 'http://10.41.150.82:4000/sendmailtoworker'; + baseUrl: string = 'http://localhost:4000/sendmailtogm'; + secondUrl: string = 'http://localhost:4000/sendmailtoworker'; constructor(private http: HttpClient) {} sentToGm(data): Observable { diff --git a/weekly-report-app/src/app/services/report.service.ts b/weekly-report-app/src/app/services/report.service.ts index 8ac042f..2bd4ddb 100644 --- a/weekly-report-app/src/app/services/report.service.ts +++ b/weekly-report-app/src/app/services/report.service.ts @@ -7,14 +7,14 @@ import { Report } from '../models/reports'; providedIn: 'root', }) export class ReportService { - baseUrl: string = 'http://10.41.150.82:4000/api/reports'; - secondUrl: string = 'http://10.41.150.82:4000/api/reports/isreportsended'; - thirdUrl: string = 'http://10.41.150.82:4000/api/sendreport'; - fourthUrl: string = 'http://10.41.150.82:4000/api/sendbackreport'; - deleteUrl: string = 'http://10.41.150.82:4000/deletereportbyid'; - sixthUrl: string = 'http://10.41.150.82:4000/api/reports/getByCode'; - seventhUrl: string = 'http://10.41.150.82:4000/api/reports/getByAction'; - eighth: string = 'http://10.41.150.82:4000/api/reports/getAllReports'; + baseUrl: string = 'http://localhost:4000/api/reports'; + secondUrl: string = 'http://localhost:4000/api/reports/isreportsended'; + thirdUrl: string = 'http://localhost:4000/api/sendreport'; + fourthUrl: string = 'http://localhost:4000/api/sendbackreport'; + deleteUrl: string = 'http://localhost:4000/deletereportbyid'; + sixthUrl: string = 'http://localhost:4000/api/reports/getByCode'; + seventhUrl: string = 'http://localhost:4000/api/reports/getByAction'; + eighth: string = 'http://localhost:4000/api/reports/getAllReports'; constructor(private http: HttpClient) {} getAll(gm_id): Observable { diff --git a/weekly-report-app/src/app/services/row.service.ts b/weekly-report-app/src/app/services/row.service.ts index 13bba69..962f5c6 100644 --- a/weekly-report-app/src/app/services/row.service.ts +++ b/weekly-report-app/src/app/services/row.service.ts @@ -7,8 +7,8 @@ import { Row } from '../models/row'; providedIn: 'root', }) export class RowService { - baseUrl: string = 'http://10.41.150.82:4000/api/rows'; - secondUrl: string = 'http://10.41.150.82:4000/api/rows'; + baseUrl: string = 'http://localhost:4000/api/rows'; + secondUrl: string = 'http://localhost:4000/api/rows'; constructor(private http: HttpClient) {} getAll(): Observable { diff --git a/weekly-report-app/src/app/services/worker.service.ts b/weekly-report-app/src/app/services/worker.service.ts index 961a9f4..319b9e4 100644 --- a/weekly-report-app/src/app/services/worker.service.ts +++ b/weekly-report-app/src/app/services/worker.service.ts @@ -6,10 +6,10 @@ import { Observable } from 'rxjs'; providedIn: 'root', }) export class WorkerService { - baseUrl: string = 'http://10.41.150.82:4000/api/workers'; - passwordUrl: string = 'http://10.41.150.82:4000/setpassword'; - thirdUrl: string = 'http://10.41.150.82:4000/getWorkerByReport'; - fourthUrl: string = 'http://10.41.150.82:4000/sendResetEmail' + baseUrl: string = 'http://localhost:4000/api/workers'; + passwordUrl: string = 'http://localhost:4000/setpassword'; + thirdUrl: string = 'http://localhost:4000/getWorkerByReport'; + fourthUrl: string = 'http://localhost:4000/sendResetEmail' constructor(private http: HttpClient) {} From 16bdc50f3087d09508d810b71cfb2071bdc9d993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Engin=20Karata=C5=9F?= <43602725+EnginKARATAS@users.noreply.github.com> Date: Mon, 27 Sep 2021 13:35:33 +0300 Subject: [PATCH 3/4] report detail color styles --- .../src/controller/row.controller.js | 1 - weekly-report-app/package-lock.json | 56 ++++++++++++++ weekly-report-app/package.json | 1 + .../report-detail.component.css | 74 +++++++++++-------- .../report-detail.component.html | 22 ++++-- .../report-detaill/report-detail.component.ts | 43 +++++++++-- .../src/app/reports/report-form.component.ts | 19 ++--- .../src/app/reports/report.module.ts | 4 +- .../src/app/services/row.service.ts | 6 +- weekly-report-app/src/enviroment.ts | 18 +++++ 10 files changed, 179 insertions(+), 65 deletions(-) create mode 100644 weekly-report-app/src/enviroment.ts diff --git a/backend-weekly-report/src/controller/row.controller.js b/backend-weekly-report/src/controller/row.controller.js index 78340f2..eced61a 100644 --- a/backend-weekly-report/src/controller/row.controller.js +++ b/backend-weekly-report/src/controller/row.controller.js @@ -76,7 +76,6 @@ exports.create = function (req, res) { return res.status(400).send("One or more required fields are missing"); } else { Row.create(newRow, function (err, report_id) { - if (err || report_id <= 0) return res.status(500).send("Error occured during saving report"); diff --git a/weekly-report-app/package-lock.json b/weekly-report-app/package-lock.json index eea1234..34cdf62 100644 --- a/weekly-report-app/package-lock.json +++ b/weekly-report-app/package-lock.json @@ -24,6 +24,7 @@ "jquery": "^3.6.0", "md5": "^2.3.0", "ngx-cookie-service": "^12.0.3", + "ngx-material-timepicker": "^5.5.3", "ngx-toastr": "^14.1.0", "nodemon": "^2.0.12", "rxjs": "~6.6.0", @@ -2462,6 +2463,11 @@ "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", "dev": true }, + "node_modules/@types/luxon": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-1.11.1.tgz", + "integrity": "sha512-XBHQ7rzpOHyJudEQcMyoT67Np61FTb6S2jWqWQER/U7H2NAS+dpC8wv5T+6ygV5g/yJQdaojQbsJQiweool0Aw==" + }, "node_modules/@types/minimatch": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", @@ -8841,6 +8847,14 @@ "node": ">=10" } }, + "node_modules/luxon": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-1.24.0.tgz", + "integrity": "sha512-PNeB5cFbBtmuS137OuEdaJnCMTMPS2vz9hnM1Zl6tUIuYdtUgEhMqfVZ7yxX0jHEGx6rp757ECe7cdZxDgq2Tg==", + "engines": { + "node": "*" + } + }, "node_modules/magic-string": { "version": "0.25.7", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", @@ -9474,6 +9488,21 @@ "@angular/core": "^12.0.0" } }, + "node_modules/ngx-material-timepicker": { + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/ngx-material-timepicker/-/ngx-material-timepicker-5.5.3.tgz", + "integrity": "sha512-Ua6eNNNneHS8S1/3Tn2dUOnLdZ4k6MhQqvLM/eFVoeF0WF+q/uK1DAH8eAki3HW1ogq2oDWnVRSeXvvZGJldhQ==", + "dependencies": { + "@types/luxon": "1.11.1", + "luxon": "1.24.0", + "tslib": "^1.9.0" + } + }, + "node_modules/ngx-material-timepicker/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, "node_modules/ngx-toastr": { "version": "14.1.0", "resolved": "https://registry.npmjs.org/ngx-toastr/-/ngx-toastr-14.1.0.tgz", @@ -18563,6 +18592,11 @@ "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", "dev": true }, + "@types/luxon": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-1.11.1.tgz", + "integrity": "sha512-XBHQ7rzpOHyJudEQcMyoT67Np61FTb6S2jWqWQER/U7H2NAS+dpC8wv5T+6ygV5g/yJQdaojQbsJQiweool0Aw==" + }, "@types/minimatch": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", @@ -23549,6 +23583,11 @@ "yallist": "^4.0.0" } }, + "luxon": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-1.24.0.tgz", + "integrity": "sha512-PNeB5cFbBtmuS137OuEdaJnCMTMPS2vz9hnM1Zl6tUIuYdtUgEhMqfVZ7yxX0jHEGx6rp757ECe7cdZxDgq2Tg==" + }, "magic-string": { "version": "0.25.7", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", @@ -24045,6 +24084,23 @@ "tslib": "^2.0.0" } }, + "ngx-material-timepicker": { + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/ngx-material-timepicker/-/ngx-material-timepicker-5.5.3.tgz", + "integrity": "sha512-Ua6eNNNneHS8S1/3Tn2dUOnLdZ4k6MhQqvLM/eFVoeF0WF+q/uK1DAH8eAki3HW1ogq2oDWnVRSeXvvZGJldhQ==", + "requires": { + "@types/luxon": "1.11.1", + "luxon": "1.24.0", + "tslib": "^1.9.0" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + } + } + }, "ngx-toastr": { "version": "14.1.0", "resolved": "https://registry.npmjs.org/ngx-toastr/-/ngx-toastr-14.1.0.tgz", diff --git a/weekly-report-app/package.json b/weekly-report-app/package.json index 0c40140..a43a03d 100644 --- a/weekly-report-app/package.json +++ b/weekly-report-app/package.json @@ -27,6 +27,7 @@ "jquery": "^3.6.0", "md5": "^2.3.0", "ngx-cookie-service": "^12.0.3", + "ngx-material-timepicker": "^5.5.3", "ngx-toastr": "^14.1.0", "nodemon": "^2.0.12", "rxjs": "~6.6.0", diff --git a/weekly-report-app/src/app/reports/report-detaill/report-detail.component.css b/weekly-report-app/src/app/reports/report-detaill/report-detail.component.css index 1e04fae..3b44891 100644 --- a/weekly-report-app/src/app/reports/report-detaill/report-detail.component.css +++ b/weekly-report-app/src/app/reports/report-detaill/report-detail.component.css @@ -1,56 +1,66 @@ -th{ - font-size: 0.90rem; +th { + font-size: 0.9rem; } -td{ - font-size: 0.90rem; +td { + font-size: 0.9rem; } -h6{ - font-size: 20px; +h6 { + font-size: 20px; } -h5{ - font-size: 20px; +h5 { + font-size: 20px; } -#codeButton{ - font-size: 10px; +#codeButton { + font-size: 10px; } -mat-icon{ - font-size: 15px; - +mat-icon { + font-size: 15px; } -span{ - font-size: 13px; +span { + font-size: 13px; } -th{width: 0%;font-size: 14px;} +th { + width: 0%; + font-size: 14px; +} -span{ - font-size: 10px; +span { + font-size: 10px; } -.sira{ - font-size: 13.5px; +.sira { + font-size: 13.5px; } ::ng-deep .mat-checkbox .mat-checkbox-frame { - background: rgba(131, 187, 197, 0.5); - } + background: rgba(131, 187, 197, 0.5); +} -.codes{ - font-size: 11px; +.codes { + font-size: 11px; } - -.mat-expansion-panel{ - background-color: rgb(235, 235, 235) ; + +.mat-expansion-panel { + background-color: rgb(235, 235, 235); } -.mat-expansion-panel-header-title{ - color: black; +.mat-expansion-panel-header-title { + color: black; } -.mat-expansion-panel-header-description{ - color: black; -} \ No newline at end of file +.mat-expansion-panel-header-description { + color: black; +} +ngx-timepicker-field { + padding: 0; + width: 73%; +} + + mat-accordion > mat-expansion-panel{ + background: lavender; +} diff --git a/weekly-report-app/src/app/reports/report-detaill/report-detail.component.html b/weekly-report-app/src/app/reports/report-detaill/report-detail.component.html index 8ba2412..0a2225f 100644 --- a/weekly-report-app/src/app/reports/report-detaill/report-detail.component.html +++ b/weekly-report-app/src/app/reports/report-detaill/report-detail.component.html @@ -1,6 +1,7 @@
-

{{ rows[0]? rows[0].week_id + ". Hafta": "" }}  | Haftalık Faaliyet Raporu +

{{ rows[0]? rows[0].week_id + ". Hafta": "" }}  | Haftalık Faaliyet + Raporu |

Değerli çalışanımız, raporu vaktinde göndermeyi ihmal etmeyiniz Teşekkür ederiz.
⛔ Boş Rapor @@ -76,7 +77,7 @@

{{ rows[0]? rows[0].week_id + ". Haft [ngClass]="{ 'is-invalid': f.status.errors && (f.status.touched || f.status.dirty) }"> - + @@ -126,17 +127,21 @@

{{ rows[0]? rows[0].week_id + ". Haft class="form-control" [ngClass]="{ 'is-invalid': f.actions.errors && (f.actions.touched || f.actions.dirty) }"> - Alınan aksiyonlar en az 30 karakter içermelidir. + Alınan aksiyonlar en + az 30 karakter içermelidir.

- + + Haftalık harcanan saat Harcanan süre belirtilmelidir. @@ -165,7 +170,7 @@

{{ rows[0]? rows[0].week_id + ". Haft class="form-control">

-
+
@@ -225,6 +230,7 @@
HAFTALIK FAALİYETLER
class="badge badge-outline-danger">{{i+1}}. Sil + @@ -232,14 +238,14 @@
HAFTALIK FAALİYETLER
{{row.actions}} {{row.comments}} - {{colorName(row.matter+1)}} + {{row.start_date | date: 'dd/MM/yyyy'}} {{row.finish_date | date: 'dd/MM/yyyy'}} - {{row.is_timeout ? "Var":"Yok"}} + {{row.is_timeout?"Var":"Yok"}} {{row.claimants}} {{row.scheduled_completion_date | date: 'dd/MM/yyyy'}} {{row.weekly_time_spent}} - {{row.status}} + {{row.status}} {{row.code}} diff --git a/weekly-report-app/src/app/reports/report-detaill/report-detail.component.ts b/weekly-report-app/src/app/reports/report-detaill/report-detail.component.ts index 24a4440..a99c74a 100644 --- a/weekly-report-app/src/app/reports/report-detaill/report-detail.component.ts +++ b/weekly-report-app/src/app/reports/report-detaill/report-detail.component.ts @@ -124,7 +124,7 @@ 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==true ? 'Var' : 'Yok'; + this.pasteModel.is_timeout = row.is_timeout == true ? 'Var' : 'Yok'; this.pasteModel.comments = row.comments; } @@ -145,7 +145,7 @@ export class ReportDetailComponent implements OnInit { switch (matter_number) { case 1: return 'çok düşük'; - case 1: + case 2: return 'düşük'; case 3: return 'normal'; @@ -153,14 +153,12 @@ export class ReportDetailComponent implements OnInit { return 'yüksek'; case 5: return 'çok yüksek'; - case 6: - return 'çok düşük'; default: return 'belirtilmemiş'; } } - setColor(matter: string): string { + setColorMatter(matter: string): string { switch (parseInt(matter)) { case 1: return '#36b342'; @@ -177,6 +175,31 @@ export class ReportDetailComponent implements OnInit { } } + setColorIsTimeout(timeout: string): string { + switch (timeout) { + case 'Var': + return 'red'; + case 'Yok': + return 'green'; + default: + return 'black'; + } + } + setColorStatus(status) { + switch (status) { + case 'Devam Ediyor': + return 'blue'; + case 'Kapandı': + return 'green'; + case 'Onay Bekleniyor': + return '#FFD700'; + case 'İptal Edildi': + return 'red'; + default: + return 'black'; + } + } + checkLogin() { if (this.cookieService.get('gmisLoggedIn').includes('true')) { this.gmLoginStatus = true; @@ -306,11 +329,15 @@ export class ReportDetailComponent implements OnInit { } addRow(): void { this.toastrService.info('Satır başarılı bir şekilde eklendi'); - this.rowForm.value.report_id = this.reportId; - + if (this.rowForm.value.is_timeout.includes('Var')) { + this.rowForm.value.is_timeout = 1; + } else if (this.rowForm.value.is_timeout.includes('Yok')) { + this.rowForm.value.is_timeout = 0; + } + console.log('😒😒😒'); + console.log(this.rowForm.value); this.rowService.addRow(this.rowForm.value).subscribe((data) => { - debugger; this.rows.push(data); }); } diff --git a/weekly-report-app/src/app/reports/report-form.component.ts b/weekly-report-app/src/app/reports/report-form.component.ts index 021636c..e444331 100644 --- a/weekly-report-app/src/app/reports/report-form.component.ts +++ b/weekly-report-app/src/app/reports/report-form.component.ts @@ -57,20 +57,17 @@ export class ReportFormComponent implements OnInit { addRow(): void { this.toastrService.info('Satır başarılı bir şekilde eklendi'); + this.reportForm.value.is_timeout.includes('Var') ? 1 : 0; console.log('😒😒😒'); console.log(this.reportForm.value); - this.reportForm.value.report_id = this.cookieService.get("id"); - console.log("🚀 ~ file: report-form.component.ts ~ line 69 ~ ReportFormComponent ~ addRow ~ this.rowForm.value", this.reportForm.value) + this.reportForm.value.report_id = this.cookieService.get('id'); - - this.rowService - .addRow(this.reportForm.value) - .subscribe((data) => { - console.log( - '🚀 ~ file: report-form.component.ts ~ line 62 ~ ReportFormComponent ~ this.rowService.addRow ~ data', - data - ); - }); + this.rowService.addRow(this.reportForm.value).subscribe((data) => { + console.log( + '🚀 ~ file: report-form.component.ts ~ line 62 ~ ReportFormComponent ~ this.rowService.addRow ~ data', + data + ); + }); // if (this.rowForm.valid) { // console.log("valid") diff --git a/weekly-report-app/src/app/reports/report.module.ts b/weekly-report-app/src/app/reports/report.module.ts index 2fc5dc9..8cf4284 100644 --- a/weekly-report-app/src/app/reports/report.module.ts +++ b/weekly-report-app/src/app/reports/report.module.ts @@ -18,7 +18,7 @@ import {MatIcon, MatIconModule} from '@angular/material/icon' import {MatCheckboxModule} from '@angular/material/checkbox'; import {MatExpansionModule} from '@angular/material/expansion'; import { MatFormFieldModule } from '@angular/material/form-field'; - +import {NgxMaterialTimepickerModule} from 'ngx-material-timepicker'; @NgModule({ declarations: [ @@ -40,6 +40,8 @@ import { MatFormFieldModule } from '@angular/material/form-field'; MatExpansionModule, MatFormFieldModule, + NgxMaterialTimepickerModule, + BrowserAnimationsModule, diff --git a/weekly-report-app/src/app/services/row.service.ts b/weekly-report-app/src/app/services/row.service.ts index 962f5c6..88af8de 100644 --- a/weekly-report-app/src/app/services/row.service.ts +++ b/weekly-report-app/src/app/services/row.service.ts @@ -2,11 +2,13 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { Row } from '../models/row'; +import { environment } from '../../enviroment'; @Injectable({ providedIn: 'root', }) export class RowService { + enviroment; baseUrl: string = 'http://localhost:4000/api/rows'; secondUrl: string = 'http://localhost:4000/api/rows'; constructor(private http: HttpClient) {} @@ -38,8 +40,4 @@ export class RowService { deleteAll(): Observable { return this.http.delete(this.baseUrl); } - - // findByCode(code): Observable { - // return this.http.get(`${this.baseUrl}?code=${code}`); - // } } diff --git a/weekly-report-app/src/enviroment.ts b/weekly-report-app/src/enviroment.ts new file mode 100644 index 0000000..4d29b7e --- /dev/null +++ b/weekly-report-app/src/enviroment.ts @@ -0,0 +1,18 @@ +// This file can be replaced during build by using the `fileReplacements` array. +// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. +// The list of file replacements can be found in `angular.json`. +const origin = "http://localhost:4200";//window.location.origin; + +export const environment = { + production: false, + apiUrl: origin +}; + +/* + * For easier debugging in development mode, you can import the following file + * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. + * + * This import should be commented out in production mode because it will have a negative impact + * on performance if an error is thrown. + */ +// import 'zone.js/dist/zone-error'; // Included with Angular CLI. From d5b00ff188cb46bf4da2c9306411a488cbcaa7c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Engin=20Karata=C5=9F?= <43602725+EnginKARATAS@users.noreply.github.com> Date: Wed, 29 Sep 2021 20:44:10 +0300 Subject: [PATCH 4/4] Revert "report detail color styles" This reverts commit 16bdc50f3087d09508d810b71cfb2071bdc9d993. --- .../{ => node_modules}/Dockerfile | 0 .../{ => node_modules}/app.js | 0 .../{ => node_modules}/config/db.js | 0 .../{ => node_modules}/package-lock.json | 0 .../{ => node_modules}/package.json | 0 .../{ => node_modules}/readme.rst | 0 .../src/controller/row.controller.js | 1 + weekly-report-app/package-lock.json | 56 -------------- weekly-report-app/package.json | 1 - .../report-detail.component.css | 74 ++++++++----------- .../report-detail.component.html | 22 ++---- .../report-detaill/report-detail.component.ts | 43 ++--------- .../src/app/reports/report-form.component.ts | 19 +++-- .../src/app/reports/report.module.ts | 4 +- .../src/app/services/row.service.ts | 6 +- weekly-report-app/src/enviroment.ts | 18 ----- 16 files changed, 65 insertions(+), 179 deletions(-) rename backend-weekly-report/{ => node_modules}/Dockerfile (100%) rename backend-weekly-report/{ => node_modules}/app.js (100%) rename backend-weekly-report/{ => node_modules}/config/db.js (100%) rename backend-weekly-report/{ => node_modules}/package-lock.json (100%) rename backend-weekly-report/{ => node_modules}/package.json (100%) rename backend-weekly-report/{ => node_modules}/readme.rst (100%) delete mode 100644 weekly-report-app/src/enviroment.ts diff --git a/backend-weekly-report/Dockerfile b/backend-weekly-report/node_modules/Dockerfile similarity index 100% rename from backend-weekly-report/Dockerfile rename to backend-weekly-report/node_modules/Dockerfile diff --git a/backend-weekly-report/app.js b/backend-weekly-report/node_modules/app.js similarity index 100% rename from backend-weekly-report/app.js rename to backend-weekly-report/node_modules/app.js diff --git a/backend-weekly-report/config/db.js b/backend-weekly-report/node_modules/config/db.js similarity index 100% rename from backend-weekly-report/config/db.js rename to backend-weekly-report/node_modules/config/db.js diff --git a/backend-weekly-report/package-lock.json b/backend-weekly-report/node_modules/package-lock.json similarity index 100% rename from backend-weekly-report/package-lock.json rename to backend-weekly-report/node_modules/package-lock.json diff --git a/backend-weekly-report/package.json b/backend-weekly-report/node_modules/package.json similarity index 100% rename from backend-weekly-report/package.json rename to backend-weekly-report/node_modules/package.json diff --git a/backend-weekly-report/readme.rst b/backend-weekly-report/node_modules/readme.rst similarity index 100% rename from backend-weekly-report/readme.rst rename to backend-weekly-report/node_modules/readme.rst diff --git a/backend-weekly-report/src/controller/row.controller.js b/backend-weekly-report/src/controller/row.controller.js index eced61a..78340f2 100644 --- a/backend-weekly-report/src/controller/row.controller.js +++ b/backend-weekly-report/src/controller/row.controller.js @@ -76,6 +76,7 @@ exports.create = function (req, res) { return res.status(400).send("One or more required fields are missing"); } else { Row.create(newRow, function (err, report_id) { + if (err || report_id <= 0) return res.status(500).send("Error occured during saving report"); diff --git a/weekly-report-app/package-lock.json b/weekly-report-app/package-lock.json index 34cdf62..eea1234 100644 --- a/weekly-report-app/package-lock.json +++ b/weekly-report-app/package-lock.json @@ -24,7 +24,6 @@ "jquery": "^3.6.0", "md5": "^2.3.0", "ngx-cookie-service": "^12.0.3", - "ngx-material-timepicker": "^5.5.3", "ngx-toastr": "^14.1.0", "nodemon": "^2.0.12", "rxjs": "~6.6.0", @@ -2463,11 +2462,6 @@ "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", "dev": true }, - "node_modules/@types/luxon": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-1.11.1.tgz", - "integrity": "sha512-XBHQ7rzpOHyJudEQcMyoT67Np61FTb6S2jWqWQER/U7H2NAS+dpC8wv5T+6ygV5g/yJQdaojQbsJQiweool0Aw==" - }, "node_modules/@types/minimatch": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", @@ -8847,14 +8841,6 @@ "node": ">=10" } }, - "node_modules/luxon": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/luxon/-/luxon-1.24.0.tgz", - "integrity": "sha512-PNeB5cFbBtmuS137OuEdaJnCMTMPS2vz9hnM1Zl6tUIuYdtUgEhMqfVZ7yxX0jHEGx6rp757ECe7cdZxDgq2Tg==", - "engines": { - "node": "*" - } - }, "node_modules/magic-string": { "version": "0.25.7", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", @@ -9488,21 +9474,6 @@ "@angular/core": "^12.0.0" } }, - "node_modules/ngx-material-timepicker": { - "version": "5.5.3", - "resolved": "https://registry.npmjs.org/ngx-material-timepicker/-/ngx-material-timepicker-5.5.3.tgz", - "integrity": "sha512-Ua6eNNNneHS8S1/3Tn2dUOnLdZ4k6MhQqvLM/eFVoeF0WF+q/uK1DAH8eAki3HW1ogq2oDWnVRSeXvvZGJldhQ==", - "dependencies": { - "@types/luxon": "1.11.1", - "luxon": "1.24.0", - "tslib": "^1.9.0" - } - }, - "node_modules/ngx-material-timepicker/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, "node_modules/ngx-toastr": { "version": "14.1.0", "resolved": "https://registry.npmjs.org/ngx-toastr/-/ngx-toastr-14.1.0.tgz", @@ -18592,11 +18563,6 @@ "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", "dev": true }, - "@types/luxon": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-1.11.1.tgz", - "integrity": "sha512-XBHQ7rzpOHyJudEQcMyoT67Np61FTb6S2jWqWQER/U7H2NAS+dpC8wv5T+6ygV5g/yJQdaojQbsJQiweool0Aw==" - }, "@types/minimatch": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", @@ -23583,11 +23549,6 @@ "yallist": "^4.0.0" } }, - "luxon": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/luxon/-/luxon-1.24.0.tgz", - "integrity": "sha512-PNeB5cFbBtmuS137OuEdaJnCMTMPS2vz9hnM1Zl6tUIuYdtUgEhMqfVZ7yxX0jHEGx6rp757ECe7cdZxDgq2Tg==" - }, "magic-string": { "version": "0.25.7", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", @@ -24084,23 +24045,6 @@ "tslib": "^2.0.0" } }, - "ngx-material-timepicker": { - "version": "5.5.3", - "resolved": "https://registry.npmjs.org/ngx-material-timepicker/-/ngx-material-timepicker-5.5.3.tgz", - "integrity": "sha512-Ua6eNNNneHS8S1/3Tn2dUOnLdZ4k6MhQqvLM/eFVoeF0WF+q/uK1DAH8eAki3HW1ogq2oDWnVRSeXvvZGJldhQ==", - "requires": { - "@types/luxon": "1.11.1", - "luxon": "1.24.0", - "tslib": "^1.9.0" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - } - } - }, "ngx-toastr": { "version": "14.1.0", "resolved": "https://registry.npmjs.org/ngx-toastr/-/ngx-toastr-14.1.0.tgz", diff --git a/weekly-report-app/package.json b/weekly-report-app/package.json index a43a03d..0c40140 100644 --- a/weekly-report-app/package.json +++ b/weekly-report-app/package.json @@ -27,7 +27,6 @@ "jquery": "^3.6.0", "md5": "^2.3.0", "ngx-cookie-service": "^12.0.3", - "ngx-material-timepicker": "^5.5.3", "ngx-toastr": "^14.1.0", "nodemon": "^2.0.12", "rxjs": "~6.6.0", diff --git a/weekly-report-app/src/app/reports/report-detaill/report-detail.component.css b/weekly-report-app/src/app/reports/report-detaill/report-detail.component.css index 3b44891..1e04fae 100644 --- a/weekly-report-app/src/app/reports/report-detaill/report-detail.component.css +++ b/weekly-report-app/src/app/reports/report-detaill/report-detail.component.css @@ -1,66 +1,56 @@ -th { - font-size: 0.9rem; +th{ + font-size: 0.90rem; } -td { - font-size: 0.9rem; +td{ + font-size: 0.90rem; } -h6 { - font-size: 20px; +h6{ + font-size: 20px; } -h5 { - font-size: 20px; +h5{ + font-size: 20px; } -#codeButton { - font-size: 10px; +#codeButton{ + font-size: 10px; } -mat-icon { - font-size: 15px; +mat-icon{ + font-size: 15px; + } -span { - font-size: 13px; +span{ + font-size: 13px; } -th { - width: 0%; - font-size: 14px; -} +th{width: 0%;font-size: 14px;} -span { - font-size: 10px; +span{ + font-size: 10px; } -.sira { - font-size: 13.5px; +.sira{ + font-size: 13.5px; } ::ng-deep .mat-checkbox .mat-checkbox-frame { - background: rgba(131, 187, 197, 0.5); -} + background: rgba(131, 187, 197, 0.5); + } -.codes { - font-size: 11px; +.codes{ + font-size: 11px; } - -.mat-expansion-panel { - background-color: rgb(235, 235, 235); + +.mat-expansion-panel{ + background-color: rgb(235, 235, 235) ; } -.mat-expansion-panel-header-title { - color: black; +.mat-expansion-panel-header-title{ + color: black; } -.mat-expansion-panel-header-description { - color: black; -} -ngx-timepicker-field { - padding: 0; - width: 73%; -} - - mat-accordion > mat-expansion-panel{ - background: lavender; -} +.mat-expansion-panel-header-description{ + color: black; +} \ No newline at end of file diff --git a/weekly-report-app/src/app/reports/report-detaill/report-detail.component.html b/weekly-report-app/src/app/reports/report-detaill/report-detail.component.html index 0a2225f..8ba2412 100644 --- a/weekly-report-app/src/app/reports/report-detaill/report-detail.component.html +++ b/weekly-report-app/src/app/reports/report-detaill/report-detail.component.html @@ -1,7 +1,6 @@
-

{{ rows[0]? rows[0].week_id + ". Hafta": "" }}  | Haftalık Faaliyet - Raporu +

{{ rows[0]? rows[0].week_id + ". Hafta": "" }}  | Haftalık Faaliyet Raporu |

Değerli çalışanımız, raporu vaktinde göndermeyi ihmal etmeyiniz Teşekkür ederiz.
⛔ Boş Rapor @@ -77,7 +76,7 @@

{{ rows[0]? rows[0].week_id + ". Haft [ngClass]="{ 'is-invalid': f.status.errors && (f.status.touched || f.status.dirty) }"> - + @@ -127,21 +126,17 @@

{{ rows[0]? rows[0].week_id + ". Haft class="form-control" [ngClass]="{ 'is-invalid': f.actions.errors && (f.actions.touched || f.actions.dirty) }"> - Alınan aksiyonlar en - az 30 karakter içermelidir. + Alınan aksiyonlar en az 30 karakter içermelidir.

- - - Haftalık harcanan saat Harcanan süre belirtilmelidir. @@ -170,7 +165,7 @@

{{ rows[0]? rows[0].week_id + ". Haft class="form-control">

-
+
@@ -230,7 +225,6 @@
HAFTALIK FAALİYETLER
class="badge badge-outline-danger">{{i+1}}. Sil - @@ -238,14 +232,14 @@
HAFTALIK FAALİYETLER
{{row.actions}} {{row.comments}} - + {{colorName(row.matter+1)}} {{row.start_date | date: 'dd/MM/yyyy'}} {{row.finish_date | date: 'dd/MM/yyyy'}} - {{row.is_timeout?"Var":"Yok"}} + {{row.is_timeout ? "Var":"Yok"}} {{row.claimants}} {{row.scheduled_completion_date | date: 'dd/MM/yyyy'}} {{row.weekly_time_spent}} - {{row.status}} + {{row.status}} {{row.code}} diff --git a/weekly-report-app/src/app/reports/report-detaill/report-detail.component.ts b/weekly-report-app/src/app/reports/report-detaill/report-detail.component.ts index a99c74a..24a4440 100644 --- a/weekly-report-app/src/app/reports/report-detaill/report-detail.component.ts +++ b/weekly-report-app/src/app/reports/report-detaill/report-detail.component.ts @@ -124,7 +124,7 @@ 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 == true ? 'Var' : 'Yok'; + this.pasteModel.is_timeout = row.is_timeout==true ? 'Var' : 'Yok'; this.pasteModel.comments = row.comments; } @@ -145,7 +145,7 @@ export class ReportDetailComponent implements OnInit { switch (matter_number) { case 1: return 'çok düşük'; - case 2: + case 1: return 'düşük'; case 3: return 'normal'; @@ -153,12 +153,14 @@ export class ReportDetailComponent implements OnInit { return 'yüksek'; case 5: return 'çok yüksek'; + case 6: + return 'çok düşük'; default: return 'belirtilmemiş'; } } - setColorMatter(matter: string): string { + setColor(matter: string): string { switch (parseInt(matter)) { case 1: return '#36b342'; @@ -175,31 +177,6 @@ export class ReportDetailComponent implements OnInit { } } - setColorIsTimeout(timeout: string): string { - switch (timeout) { - case 'Var': - return 'red'; - case 'Yok': - return 'green'; - default: - return 'black'; - } - } - setColorStatus(status) { - switch (status) { - case 'Devam Ediyor': - return 'blue'; - case 'Kapandı': - return 'green'; - case 'Onay Bekleniyor': - return '#FFD700'; - case 'İptal Edildi': - return 'red'; - default: - return 'black'; - } - } - checkLogin() { if (this.cookieService.get('gmisLoggedIn').includes('true')) { this.gmLoginStatus = true; @@ -329,15 +306,11 @@ export class ReportDetailComponent implements OnInit { } addRow(): void { this.toastrService.info('Satır başarılı bir şekilde eklendi'); + this.rowForm.value.report_id = this.reportId; - if (this.rowForm.value.is_timeout.includes('Var')) { - this.rowForm.value.is_timeout = 1; - } else if (this.rowForm.value.is_timeout.includes('Yok')) { - this.rowForm.value.is_timeout = 0; - } - console.log('😒😒😒'); - console.log(this.rowForm.value); + this.rowService.addRow(this.rowForm.value).subscribe((data) => { + debugger; this.rows.push(data); }); } diff --git a/weekly-report-app/src/app/reports/report-form.component.ts b/weekly-report-app/src/app/reports/report-form.component.ts index e444331..021636c 100644 --- a/weekly-report-app/src/app/reports/report-form.component.ts +++ b/weekly-report-app/src/app/reports/report-form.component.ts @@ -57,17 +57,20 @@ export class ReportFormComponent implements OnInit { addRow(): void { this.toastrService.info('Satır başarılı bir şekilde eklendi'); - this.reportForm.value.is_timeout.includes('Var') ? 1 : 0; console.log('😒😒😒'); console.log(this.reportForm.value); - this.reportForm.value.report_id = this.cookieService.get('id'); + this.reportForm.value.report_id = this.cookieService.get("id"); + console.log("🚀 ~ file: report-form.component.ts ~ line 69 ~ ReportFormComponent ~ addRow ~ this.rowForm.value", this.reportForm.value) - this.rowService.addRow(this.reportForm.value).subscribe((data) => { - console.log( - '🚀 ~ file: report-form.component.ts ~ line 62 ~ ReportFormComponent ~ this.rowService.addRow ~ data', - data - ); - }); + + this.rowService + .addRow(this.reportForm.value) + .subscribe((data) => { + console.log( + '🚀 ~ file: report-form.component.ts ~ line 62 ~ ReportFormComponent ~ this.rowService.addRow ~ data', + data + ); + }); // if (this.rowForm.valid) { // console.log("valid") diff --git a/weekly-report-app/src/app/reports/report.module.ts b/weekly-report-app/src/app/reports/report.module.ts index 8cf4284..2fc5dc9 100644 --- a/weekly-report-app/src/app/reports/report.module.ts +++ b/weekly-report-app/src/app/reports/report.module.ts @@ -18,7 +18,7 @@ import {MatIcon, MatIconModule} from '@angular/material/icon' import {MatCheckboxModule} from '@angular/material/checkbox'; import {MatExpansionModule} from '@angular/material/expansion'; import { MatFormFieldModule } from '@angular/material/form-field'; -import {NgxMaterialTimepickerModule} from 'ngx-material-timepicker'; + @NgModule({ declarations: [ @@ -40,8 +40,6 @@ import {NgxMaterialTimepickerModule} from 'ngx-material-timepicker'; MatExpansionModule, MatFormFieldModule, - NgxMaterialTimepickerModule, - BrowserAnimationsModule, diff --git a/weekly-report-app/src/app/services/row.service.ts b/weekly-report-app/src/app/services/row.service.ts index 88af8de..962f5c6 100644 --- a/weekly-report-app/src/app/services/row.service.ts +++ b/weekly-report-app/src/app/services/row.service.ts @@ -2,13 +2,11 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { Row } from '../models/row'; -import { environment } from '../../enviroment'; @Injectable({ providedIn: 'root', }) export class RowService { - enviroment; baseUrl: string = 'http://localhost:4000/api/rows'; secondUrl: string = 'http://localhost:4000/api/rows'; constructor(private http: HttpClient) {} @@ -40,4 +38,8 @@ export class RowService { deleteAll(): Observable { return this.http.delete(this.baseUrl); } + + // findByCode(code): Observable { + // return this.http.get(`${this.baseUrl}?code=${code}`); + // } } diff --git a/weekly-report-app/src/enviroment.ts b/weekly-report-app/src/enviroment.ts deleted file mode 100644 index 4d29b7e..0000000 --- a/weekly-report-app/src/enviroment.ts +++ /dev/null @@ -1,18 +0,0 @@ -// This file can be replaced during build by using the `fileReplacements` array. -// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. -// The list of file replacements can be found in `angular.json`. -const origin = "http://localhost:4200";//window.location.origin; - -export const environment = { - production: false, - apiUrl: origin -}; - -/* - * For easier debugging in development mode, you can import the following file - * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. - * - * This import should be commented out in production mode because it will have a negative impact - * on performance if an error is thrown. - */ -// import 'zone.js/dist/zone-error'; // Included with Angular CLI.