diff --git a/src/app/features/administration/administration.module.ts b/src/app/features/administration/administration.module.ts index f9bcb2e3..c83035d6 100644 --- a/src/app/features/administration/administration.module.ts +++ b/src/app/features/administration/administration.module.ts @@ -1,6 +1,6 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { TranslateModule } from '@ngx-translate/core'; import { SharedModule } from '../../shared/shared.module'; @@ -16,6 +16,7 @@ import { TextSelectComponent } from './form/text-select/text-select.component'; import { KindSelectComponent } from './form/kind-select/kind-select.component'; import { BaseConfigComponent } from './form/base-config/base-config.component'; import { AdvancedConfigComponent } from './form/advanced-config/advanced-config.component'; +import { CalendarModule } from 'primeng'; @NgModule({ declarations: [ @@ -31,6 +32,7 @@ import { AdvancedConfigComponent } from './form/advanced-config/advanced-config. AdvancedConfigComponent, ], imports: [ + CalendarModule, AdministrationRoutingModule, CommonModule, ReactiveFormsModule, diff --git a/src/app/features/administration/form/date-select/date-select.component.html b/src/app/features/administration/form/date-select/date-select.component.html index b158044c..09e87034 100644 --- a/src/app/features/administration/form/date-select/date-select.component.html +++ b/src/app/features/administration/form/date-select/date-select.component.html @@ -51,19 +51,27 @@
-
-			form.value.hasSeveralHours :
-				{{ form.value.hasSeveralHours | json }}
-			
+ + + horaires différentes à chaque jour +
- - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - -
- - {{ dateList.length }} - - - {{ 'dates.count_dates' | translate }} - - -
- {{ id }}) - - - -
-
+
+
+ + +
+
+ + {{ dateList.length }} + + + {{ 'dates.count_dates' | translate }} + +
+
+ +
+
+
+ {{ id }}) - + +
+
+ + +
+
+
+
+
+ + + + +
+
+
diff --git a/src/app/features/administration/form/date-select/date-select.component.scss b/src/app/features/administration/form/date-select/date-select.component.scss index e69de29b..29f803f3 100644 --- a/src/app/features/administration/form/date-select/date-select.component.scss +++ b/src/app/features/administration/form/date-select/date-select.component.scss @@ -0,0 +1,8 @@ +:host { + .btn i + span { + margin-left: 1ch; + } + .btn + .btn { + margin-left: 1em; + } +} diff --git a/src/app/features/administration/form/date-select/date-select.component.ts b/src/app/features/administration/form/date-select/date-select.component.ts index 42b5f7d5..f23cbc4c 100644 --- a/src/app/features/administration/form/date-select/date-select.component.ts +++ b/src/app/features/administration/form/date-select/date-select.component.ts @@ -8,8 +8,8 @@ import { ApiService } from '../../../../core/services/api.service'; import { Router } from '@angular/router'; import { DOCUMENT } from '@angular/common'; import { DateChoice, otherDefaultDates } from '../../../old-stuff/config/defaultConfigs'; -import { Poll } from '../../../../core/models/poll.model'; import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'; +import { TranslateService } from '@ngx-translate/core'; @Component({ selector: 'app-date-select', @@ -22,12 +22,15 @@ export class DateSelectComponent implements OnInit { public showDateInterval = true; public allowSeveralHours = true; + today = new Date(); startDateInterval: string; endDateInterval: string; intervalDays: any; intervalDaysDefault = 7; dateList: any = otherDefaultDates; // sets of days as strings, config to set identical time for days in a special days poll timeList: DateChoice[] = otherDefaultDates; // ranges of time expressed as strings + dateCalendarEnum: any = [new Date('02/09/2021')]; + selectionKind: string = 'range'; constructor( private fb: FormBuilder, @@ -38,6 +41,7 @@ export class DateSelectComponent implements OnInit { public dateUtilities: DateUtilities, private apiService: ApiService, private router: Router, + private translateService: TranslateService, @Inject(DOCUMENT) private document: any ) {} @@ -64,6 +68,7 @@ export class DateSelectComponent implements OnInit { startDateInterval: this.startDateInterval, endDateInterval: this.endDateInterval, }); + this.dateCalendarEnum = [dateCurrent, this.dateUtilities.addDaysToDate(this.intervalDaysDefault, dateCurrent)]; this.countDays(); } @@ -72,7 +77,7 @@ export class DateSelectComponent implements OnInit { this.dateUtilities.parseInputDateToDateObject(this.startDateInterval), this.dateUtilities.parseInputDateToDateObject(this.endDateInterval) ); - this.cd.detectChanges(); + // this.cd.detectChanges(); } /** @@ -143,13 +148,17 @@ export class DateSelectComponent implements OnInit { date_object: new Date(), }); const selector = '[ng-reflect-choice_label="dateTime_' + id + '_Choices_' + (this.timeList.length - 1) + '"]'; - this.cd.detectChanges(); + // this.cd.detectChanges(); const elem = this.document.querySelector(selector); if (elem) { elem.focus(); } } + get dateChoices() { + return this.form.get('dateChoices') as FormArray; + } + addChoice(optionalLabel = ''): void { const newControlGroup = this.fb.group({ label: this.fb.control('', [Validators.required]), @@ -162,8 +171,8 @@ export class DateSelectComponent implements OnInit { imageUrl: 'mon url', }); } - this.form.value.choices.push(newControlGroup); - this.cd.detectChanges(); + this.dateChoices.push(newControlGroup); + // this.cd.detectChanges(); console.log('this.choices.length', this.choices.length); this.focusOnChoice(this.choices.length - 1); @@ -220,7 +229,7 @@ export class DateSelectComponent implements OnInit { if ($event.ctrlKey && $event.key == 'Backspace') { this.deleteChoiceField(choice_number); this.toastService.display('choix supprimé par raccourci "Ctrl + retour"'); - this.cd.detectChanges(); + // this.cd.detectChanges(); this.focusOnChoice(Math.min(choice_number - 1, 0)); } if ($event.ctrlKey && $event.key == 'Enter') { diff --git a/src/app/shared/components/selectors/language-selector/language-selector.component.ts b/src/app/shared/components/selectors/language-selector/language-selector.component.ts index 9cb904c4..a7ce3d6e 100644 --- a/src/app/shared/components/selectors/language-selector/language-selector.component.ts +++ b/src/app/shared/components/selectors/language-selector/language-selector.component.ts @@ -1,8 +1,6 @@ import { Component, DoCheck, OnInit } from '@angular/core'; -import { TranslateService } from '@ngx-translate/core'; import { Language } from '../../../../core/enums/language.enum'; -import { StorageService } from '../../../../core/services/storage.service'; import { LanguageService } from '../../../../core/services/language.service'; @Component({ diff --git a/src/assets/i18n/EN.json b/src/assets/i18n/EN.json index 6085c5df..993cee82 100644 --- a/src/assets/i18n/EN.json +++ b/src/assets/i18n/EN.json @@ -584,5 +584,41 @@ "NL": "Néérlandais", "OC": "oc", "SV": "sv" + }, + + "calendar_widget" : { + "startsWith": "Starts with", + "contains": "Contains", + "notContains": "Not contains", + "endsWith": "Ends with", + "equals": "Equals", + "notEquals": "Not equals", + "noFilter": "No Filter", + "lt": "Less than", + "lte": "Less than or equal to", + "gt": "Greater than", + "gte": "Great then or equals", + "is": "Is", + "isNot": "Is not", + "before": "Before", + "after": "After", + "clear": "Clear", + "apply": "Apply", + "matchAll": "Match All", + "matchAny": "Match Any", + "addRule": "Add Rule", + "removeRule": "Remove Rule", + "accept": "Yes", + "reject": "No", + "choose": "Choose", + "upload": "Upload", + "cancel": "Cancel", + "dayNames": ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], + "dayNamesShort": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + "dayNamesMin": ["Su","Mo","Tu","We","Th","Fr","Sa"], + "monthNames": ["January","February","March","April","May","June","July","August","September","October","November","December"], + "monthNamesShort": ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], + "today": "Today", + "weekHeader": "Wk" } } diff --git a/src/assets/i18n/FR.json b/src/assets/i18n/FR.json index 67cceeec..2721c87e 100644 --- a/src/assets/i18n/FR.json +++ b/src/assets/i18n/FR.json @@ -588,5 +588,40 @@ "NL": "Néérlandais", "OC": "oc", "SV": "sv" - } + }, + "calendar_widget" : { + "startsWith": "Starts with", + "contains": "Contains", + "notContains": "Not contains", + "endsWith": "Ends with", + "equals": "Equals", + "notEquals": "Not equals", + "noFilter": "No Filter", + "lt": "Less than", + "lte": "Less than or equal to", + "gt": "Greater than", + "gte": "Great then or equals", + "is": "Is", + "isNot": "Is not", + "before": "Before", + "after": "After", + "clear": "Clear", + "apply": "Apply", + "matchAll": "Match All", + "matchAny": "Match Any", + "addRule": "Add Rule", + "removeRule": "Remove Rule", + "accept": "Yes", + "reject": "No", + "choose": "Choose", + "upload": "Upload", + "cancel": "Cancel", + "dayNames": ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], + "dayNamesShort": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + "dayNamesMin": ["Su","Mo","Tu","We","Th","Fr","Sa"], + "monthNames": ["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"], + "monthNamesShort": ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], + "today": "Aujourd'hui", + "weekHeader": "Wk" +} }