From ba8680c89e0aa2338e94e8914938fb887bdccb00 Mon Sep 17 00:00:00 2001 From: samuelmbabhazi Date: Sat, 24 Aug 2024 19:57:33 +0200 Subject: [PATCH 1/6] [Feature] Timer | add dropdown Reasons optional --- packages/ui-core/i18n/assets/i18n/ach.json | 1 + packages/ui-core/i18n/assets/i18n/ar.json | 1 + packages/ui-core/i18n/assets/i18n/bg.json | 1 + packages/ui-core/i18n/assets/i18n/de.json | 1 + packages/ui-core/i18n/assets/i18n/en.json | 1 + packages/ui-core/i18n/assets/i18n/es.json | 1 + packages/ui-core/i18n/assets/i18n/fr.json | 1 + packages/ui-core/i18n/assets/i18n/he.json | 1 + packages/ui-core/i18n/assets/i18n/it.json | 1 + packages/ui-core/i18n/assets/i18n/nl.json | 1 + packages/ui-core/i18n/assets/i18n/pl.json | 1 + packages/ui-core/i18n/assets/i18n/pt.json | 1 + packages/ui-core/i18n/assets/i18n/ru.json | 1 + packages/ui-core/i18n/assets/i18n/zh.json | 1 + .../edit-time-log-modal.component.html | 189 +++++------------- .../edit-time-log-modal.component.ts | 11 +- .../edit-time-log-modal.module.ts | 4 + 17 files changed, 83 insertions(+), 135 deletions(-) diff --git a/packages/ui-core/i18n/assets/i18n/ach.json b/packages/ui-core/i18n/assets/i18n/ach.json index e8be2b0cb66..15a1fc292bd 100644 --- a/packages/ui-core/i18n/assets/i18n/ach.json +++ b/packages/ui-core/i18n/assets/i18n/ach.json @@ -3599,6 +3599,7 @@ "NO_TODO": "crwdns4904:0crwdne4904:0", "OVERLAP_MESSAGE": "crwdns4906:0crwdne4906:0", "REASON": "crwdns7576:0crwdne7576:0", + "CUSTOMREASON": "Sababu maalum", "NOTES": "crwdns8044:0crwdne8044:0", "TIME_OVERLAPS": "crwdns8046:0crwdne8046:0", "TIME_TRACKING": "crwdns8048:0crwdne8048:0", diff --git a/packages/ui-core/i18n/assets/i18n/ar.json b/packages/ui-core/i18n/assets/i18n/ar.json index e0fe0fa9756..d552265b438 100644 --- a/packages/ui-core/i18n/assets/i18n/ar.json +++ b/packages/ui-core/i18n/assets/i18n/ar.json @@ -4059,6 +4059,7 @@ "NO_TODO": "لا شيء للقيام به", "OVERLAP_MESSAGE": "يتداخل إدخال الوقت هذا مع النشاط في مشاريع / مهام أخرى ، والتي ستستبدل.", "REASON": "السبب", + "CUSTOMREASON": "سبب مخصص", "NOTES": "ملاحظات", "TIME_OVERLAPS": "تتداخل الأوقات", "TIME_TRACKING": "تتبع الوقت", diff --git a/packages/ui-core/i18n/assets/i18n/bg.json b/packages/ui-core/i18n/assets/i18n/bg.json index b0bff0d74de..d3248bb5c41 100644 --- a/packages/ui-core/i18n/assets/i18n/bg.json +++ b/packages/ui-core/i18n/assets/i18n/bg.json @@ -4081,6 +4081,7 @@ "NO_TODO": "Няма задачи", "OVERLAP_MESSAGE": "Този времеви запис припокрива активност в други проекти/задачи, които ще бъдат заменени:", "REASON": "Причина", + "CUSTOMREASON": "Персонализирана причина", "NOTES": "Бележки", "APPS": "Приложения", "TIME_OVERLAPS": "Времето се припокрива", diff --git a/packages/ui-core/i18n/assets/i18n/de.json b/packages/ui-core/i18n/assets/i18n/de.json index d58c4a4080d..f29bb0c0a76 100644 --- a/packages/ui-core/i18n/assets/i18n/de.json +++ b/packages/ui-core/i18n/assets/i18n/de.json @@ -4056,6 +4056,7 @@ "NO_TODO": "Keine Aufgaben.", "OVERLAP_MESSAGE": "Diese Zeiterfassung überschneidet sich mit Aktivitäten in anderen Projekten/Aufgaben, die ersetzt werden.", "REASON": "Grund", + "CUSTOMREASON": "Eigener Grund", "NOTES": "Notizen", "TIME_OVERLAPS": "Zeitüberschneidungen", "TIME_TRACKING": "Zeiterfassung", diff --git a/packages/ui-core/i18n/assets/i18n/en.json b/packages/ui-core/i18n/assets/i18n/en.json index dc009e07035..438e97e28ea 100644 --- a/packages/ui-core/i18n/assets/i18n/en.json +++ b/packages/ui-core/i18n/assets/i18n/en.json @@ -4188,6 +4188,7 @@ "NO_TODO": "No To-do", "OVERLAP_MESSAGE": "This time entry overlaps activity in other projects/tasks, Which will be replaced:", "REASON": "Reason", + "CUSTOMREASON": "Custom reason", "NOTES": "Notes", "APPS": "Apps", "TIME_OVERLAPS": "Time overlaps", diff --git a/packages/ui-core/i18n/assets/i18n/es.json b/packages/ui-core/i18n/assets/i18n/es.json index d38f6b3d50b..133ca465247 100644 --- a/packages/ui-core/i18n/assets/i18n/es.json +++ b/packages/ui-core/i18n/assets/i18n/es.json @@ -4062,6 +4062,7 @@ "NO_TODO": "No hay nada por hacer.", "OVERLAP_MESSAGE": "Esta entrada de tiempo se superpone con la actividad en otros proyectos/tareas, que será reemplazada.", "REASON": "Razón", + "CUSTOMREASON": "Razón personalizada", "NOTES": "Notas", "TIME_OVERLAPS": "El tiempo se superpone.", "TIME_TRACKING": "Seguimiento del tiempo", diff --git a/packages/ui-core/i18n/assets/i18n/fr.json b/packages/ui-core/i18n/assets/i18n/fr.json index 142fe0a8d75..2e1fa69865f 100644 --- a/packages/ui-core/i18n/assets/i18n/fr.json +++ b/packages/ui-core/i18n/assets/i18n/fr.json @@ -4061,6 +4061,7 @@ "NO_TODO": "Pas de liste de tâches.", "OVERLAP_MESSAGE": "Cette entrée de temps chevauche une activité dans d'autres projets/tâches, qui sera remplacée.", "REASON": "Raison", + "CUSTOMREASON": "Raison personnalisée", "NOTES": "Notes", "TIME_OVERLAPS": "Le temps se chevauche.", "TIME_TRACKING": "Suivi du temps", diff --git a/packages/ui-core/i18n/assets/i18n/he.json b/packages/ui-core/i18n/assets/i18n/he.json index 2ef56b5c1cc..d37c4500e66 100644 --- a/packages/ui-core/i18n/assets/i18n/he.json +++ b/packages/ui-core/i18n/assets/i18n/he.json @@ -4072,6 +4072,7 @@ "NO_TODO": "אין לעשות", "OVERLAP_MESSAGE": "רישום זמן זה מתנגש עם פעילות בפרויקטים / משימות אחרות, שייעוף:", "REASON": "סיבה", + "CUSTOMREASON": "סיבה מותאמת אישית", "NOTES": "הערות", "APPS": "אפליקציות", "TIME_OVERLAPS": "התמוטטות זמן", diff --git a/packages/ui-core/i18n/assets/i18n/it.json b/packages/ui-core/i18n/assets/i18n/it.json index 90c5277f4fe..9dca19d96e1 100644 --- a/packages/ui-core/i18n/assets/i18n/it.json +++ b/packages/ui-core/i18n/assets/i18n/it.json @@ -4060,6 +4060,7 @@ "NO_TODO": "Nessun da fare", "OVERLAP_MESSAGE": "Questa voce di tempo si sovrappone all'attività in altri progetti/incarichi, che verranno sostituiti", "REASON": "Motivo", + "CUSTOMREASON": "Motivo personalizzato", "NOTES": "Note", "TIME_OVERLAPS": "Sovrapposizione temporale", "TIME_TRACKING": "Tracking del tempo", diff --git a/packages/ui-core/i18n/assets/i18n/nl.json b/packages/ui-core/i18n/assets/i18n/nl.json index f7ade47ce53..1d621ba4846 100644 --- a/packages/ui-core/i18n/assets/i18n/nl.json +++ b/packages/ui-core/i18n/assets/i18n/nl.json @@ -4060,6 +4060,7 @@ "NO_TODO": "Geen takenlijst", "OVERLAP_MESSAGE": "Deze tijdsregistratie overlapt een activiteit in andere projecten/taken en zal worden vervangen:", "REASON": "Reden", + "CUSTOMREASON": "Aangepaste reden", "NOTES": "Notities", "TIME_OVERLAPS": "Tijd overlapt", "TIME_TRACKING": "Tijdregistratie", diff --git a/packages/ui-core/i18n/assets/i18n/pl.json b/packages/ui-core/i18n/assets/i18n/pl.json index cc16c342f45..76581bef1c5 100644 --- a/packages/ui-core/i18n/assets/i18n/pl.json +++ b/packages/ui-core/i18n/assets/i18n/pl.json @@ -4060,6 +4060,7 @@ "NO_TODO": "Brak zadań", "OVERLAP_MESSAGE": "Ten wpis czasu nakłada się na jedno zadań w innych projektach/zadaniach i zostanie zastąpiony:", "REASON": "Powód", + "CUSTOMREASON": "Własny powód", "NOTES": "Notatki", "TIME_OVERLAPS": "Nakładające się czasy", "TIME_TRACKING": "Śledzenie czasu", diff --git a/packages/ui-core/i18n/assets/i18n/pt.json b/packages/ui-core/i18n/assets/i18n/pt.json index c85fe451b86..863fc15e4fd 100644 --- a/packages/ui-core/i18n/assets/i18n/pt.json +++ b/packages/ui-core/i18n/assets/i18n/pt.json @@ -4060,6 +4060,7 @@ "NO_TODO": "Sem Tarefas.", "OVERLAP_MESSAGE": "Esta entrada de tempo se sobrepõe a atividades em outros projetos/tarefas, que serão substituídas.", "REASON": "Razão", + "CUSTOMREASON": "Razão personalizada", "NOTES": "Notas", "TIME_OVERLAPS": "O tempo se sobrepõe", "TIME_TRACKING": "Rastreamento de Tempo", diff --git a/packages/ui-core/i18n/assets/i18n/ru.json b/packages/ui-core/i18n/assets/i18n/ru.json index 2cdbde04e48..294885a2aa3 100644 --- a/packages/ui-core/i18n/assets/i18n/ru.json +++ b/packages/ui-core/i18n/assets/i18n/ru.json @@ -4079,6 +4079,7 @@ "NO_TODO": "Нет задач", "OVERLAP_MESSAGE": "Эта запись перекрывает деятельность в других проектах/задачах, которые будут заменены:", "REASON": "Причина", + "CUSTOMREASON": "Своя причина", "NOTES": "Заметки", "APPS": "Программы", "TIME_OVERLAPS": "Перекрытие времени", diff --git a/packages/ui-core/i18n/assets/i18n/zh.json b/packages/ui-core/i18n/assets/i18n/zh.json index cef01755242..c7898a52f04 100644 --- a/packages/ui-core/i18n/assets/i18n/zh.json +++ b/packages/ui-core/i18n/assets/i18n/zh.json @@ -4060,6 +4060,7 @@ "NO_TODO": "没有待办事项", "OVERLAP_MESSAGE": "此时间记录与其他项目/任务的活动重叠,将被替换。", "REASON": "原因", + "CUSTOMREASON_zh": "自定义原因", "NOTES": "笔记", "TIME_OVERLAPS": "时间重叠", "TIME_TRACKING": "时间跟踪", diff --git a/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.component.html b/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.component.html index 4e45b325420..e4bc35362d0 100644 --- a/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.component.html +++ b/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.component.html @@ -1,29 +1,16 @@
- - +
- {{ - (mode == 'update' - ? 'TIMESHEET.EDIT_TIME_LOGS' - : 'TIMESHEET.ADD_TIME_LOGS' - ) | translate - }} + {{ (mode == 'update' ? 'TIMESHEET.EDIT_TIME_LOGS' : 'TIMESHEET.ADD_TIME_LOGS') | translate }}
-
-
+
+
-
+
{{ 'TIMESHEET.VALIDATION.EMPLOYEE' | translate }}
@@ -65,31 +47,22 @@
- +
{{ timeDiff | durationFormat }}
- +
- + {{ 'TIMESHEET.TIME_OVERLAPS' | translate }}

{{ 'TIMESHEET.OVERLAP_MESSAGE' | translate }}

-
+
{{ 'TIMESHEET.PROJECT' | translate }} / {{ 'TIMESHEET.TODO' | translate }} @@ -107,46 +80,27 @@ *ngFor="let overlapTimeLog of overlaps" >
- + {{ overlapTimeLog?.project?.name }} - {{ - 'TIMESHEET.NO_PROJECT' | translate - }} + {{ 'TIMESHEET.NO_PROJECT' | translate }}
- + {{ - 'TIMESHEET.TODO' | translate - }} + >{{ 'TIMESHEET.TODO' | translate }} : {{ overlapTimeLog?.task?.title }} - {{ - 'TIMESHEET.NO_TODO' | translate - }} + {{ 'TIMESHEET.NO_TODO' | translate }}
- {{ - overlapTimeLog.overlapDuration - | durationFormat - }} + {{ overlapTimeLog.overlapDuration | durationFormat }}
@@ -156,11 +110,7 @@
- + {{ 'TIMER_TRACKER.IS_BILLABLE' | translate }}
@@ -168,9 +118,7 @@
- +
-
- {{ - 'TIMER_TRACKER.VALIDATION.CLIENT_REQUIRED' - | translate - }} +
+ {{ 'TIMER_TRACKER.VALIDATION.CLIENT_REQUIRED' | translate }}
- + -
+
{{ 'TIMESHEET.VALIDATION.PROJECT' | translate }}
@@ -240,10 +166,7 @@ formControlName="taskId" [required]="organization?.requireTask" > -
+
{{ 'TIMESHEET.VALIDATION.TASK' | translate }}
@@ -263,10 +186,7 @@ formControlName="description" [required]="organization?.requireDescription" > -
+
{{ 'TIMESHEET.VALIDATION.DESCRIPTION' | translate }}
@@ -276,26 +196,40 @@
- + [(selected)]="selectedReason" + [required]="organization?.requireReason" + > + {{ reason }} + +
-
+ + +
+
+
+ {{ 'TIMESHEET.VALIDATION.REASON' | translate }}
+
@@ -308,20 +242,10 @@ nbSpinnerStatus="primary" > - {{ - (mode == 'create' - ? 'TIMESHEET.ADD_TIME' - : 'TIMESHEET.UPDATE_TIME' - ) | translate - }} + {{ (mode == 'create' ? 'TIMESHEET.ADD_TIME' : 'TIMESHEET.UPDATE_TIME') | translate }} - - + + diff --git a/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.component.ts b/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.component.ts index bc6e133ed6c..f948993a411 100644 --- a/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.component.ts +++ b/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.component.ts @@ -43,7 +43,9 @@ export class EditTimeLogModalComponent implements OnInit, AfterViewInit, OnDestr subject$: Subject = new Subject(); changeSelectedEmployee: boolean; - + reasons = ['Worked offline', 'Internet issue', 'Forgot to track', 'Usability issue', 'App issue', 'Other']; + selectedReason: string = ''; // To hold the selected reason + customReason: string = ''; // To hold a custom reason if provided private _timeLog: ITimeLog | Partial; get timeLog(): ITimeLog | Partial { return this._timeLog; @@ -66,6 +68,7 @@ export class EditTimeLogModalComponent implements OnInit, AfterViewInit, OnDestr taskId: [], description: [], reason: [], + customReason: [], selectedRange: [self.selectedRange] }); } @@ -97,6 +100,7 @@ export class EditTimeLogModalComponent implements OnInit, AfterViewInit, OnDestr taskId: this._timeLog.taskId || null, description: this._timeLog.description || null, reason: this._timeLog.reason || null, + customReason: [''], selectedRange: { start: this._timeLog.startedAt, end: this._timeLog.stoppedAt @@ -173,6 +177,7 @@ export class EditTimeLogModalComponent implements OnInit, AfterViewInit, OnDestr } const request: IGetTimeLogConflictInput = { ...(this.timeLog.id ? { ignoreId: [this.timeLog.id] } : {}), + startDate, endDate, employeeId, @@ -227,6 +232,10 @@ export class EditTimeLogModalComponent implements OnInit, AfterViewInit, OnDestr const payload = { ..._.omit(this.form.value, ['selectedRange']), + reason: + this.form.get('reason').value === 'Other' + ? this.form.get('customReason').value + : this.form.get('reason').value, startedAt, stoppedAt, organizationId, diff --git a/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.module.ts b/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.module.ts index 2448a174b43..d29c829523d 100644 --- a/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.module.ts +++ b/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.module.ts @@ -7,6 +7,8 @@ import { NbCheckboxModule, NbIconModule, NbInputModule, + NbOptionModule, + NbSelectModule, NbSpinnerModule, NbTooltipModule } from '@nebular/theme'; @@ -35,6 +37,8 @@ import { TaskSelectModule } from '../../tasks/task-select/task-select.module'; NbInputModule, NbSpinnerModule, NbTooltipModule, + NbSelectModule, + NbOptionModule, NgxPermissionsModule.forChild(), TranslateModule.forChild(), SharedModule, From 733ad2cda90feeb3c58cc0b3c0ea72f6a2f3f5c1 Mon Sep 17 00:00:00 2001 From: samuelmbabhazi Date: Sat, 24 Aug 2024 20:00:52 +0200 Subject: [PATCH 2/6] fix: Timer | add dropdown Reasons optional --- .../edit-time-log-modal/edit-time-log-modal.component.html | 1 - .../edit-time-log-modal/edit-time-log-modal.component.ts | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.component.html b/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.component.html index e4bc35362d0..bc79e2c5709 100644 --- a/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.component.html +++ b/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.component.html @@ -214,7 +214,6 @@ -
{{ 'TIMESHEET.VALIDATION.REASON' | translate }} diff --git a/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.component.ts b/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.component.ts index 6c36ef8ab26..858b78cfc1c 100644 --- a/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.component.ts +++ b/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.component.ts @@ -43,7 +43,7 @@ export class EditTimeLogModalComponent implements OnInit, AfterViewInit, OnDestr subject$: Subject = new Subject(); changeSelectedEmployee: boolean; - reasons = ['Worked offline', 'Internet issue', 'Forgot to track', 'Usability issue', 'App issue', 'Other']; + reasons = ['Worked offline', 'Internet issue', 'Forgot to track', 'Usability issue', 'App issue']; selectedReason: string = ''; private _timeLog: ITimeLog | Partial; get timeLog(): ITimeLog | Partial { @@ -67,7 +67,6 @@ export class EditTimeLogModalComponent implements OnInit, AfterViewInit, OnDestr taskId: [], description: [], reason: [], - customReason: [], selectedRange: [self.selectedRange] }); } @@ -99,7 +98,6 @@ export class EditTimeLogModalComponent implements OnInit, AfterViewInit, OnDestr taskId: this._timeLog.taskId || null, description: this._timeLog.description || null, reason: this._timeLog.reason || null, - customReason: [''], selectedRange: { start: this._timeLog.startedAt, end: this._timeLog.stoppedAt @@ -230,10 +228,7 @@ export class EditTimeLogModalComponent implements OnInit, AfterViewInit, OnDestr const payload = { ..._.omit(this.form.value, ['selectedRange']), - reason: - this.form.get('reason').value === 'Other' - ? this.form.get('customReason').value - : this.form.get('reason').value, + startedAt, stoppedAt, organizationId, diff --git a/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.module.ts b/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.module.ts index d29c829523d..85fd260b070 100644 --- a/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.module.ts +++ b/packages/ui-core/shared/src/lib/timesheet/edit-time-log-modal/edit-time-log-modal.module.ts @@ -2,9 +2,11 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { + NbAutocompleteModule, NbButtonModule, NbCardModule, NbCheckboxModule, + NbFormFieldModule, NbIconModule, NbInputModule, NbOptionModule, @@ -33,6 +35,8 @@ import { TaskSelectModule } from '../../tasks/task-select/task-select.module'; NbButtonModule, NbCardModule, NbCheckboxModule, + NbAutocompleteModule, + NbFormFieldModule, NbIconModule, NbInputModule, NbSpinnerModule, From e73c4be713d76898aebf23bdbb1a2e77f787e668 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Tue, 27 Aug 2024 14:42:16 +0530 Subject: [PATCH 6/6] fix(cspell): typo spelling :-) --- .cspell.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.cspell.json b/.cspell.json index f733e0a2ebd..f09cfdc0ae4 100644 --- a/.cspell.json +++ b/.cspell.json @@ -514,7 +514,8 @@ "flexbox", "nbinput", "nbbutton", - "xaxis" + "xaxis", + "wdth" ], "useGitignore": true, "ignorePaths": [