next lang select on click on icon
This commit is contained in:
parent
71d139f177
commit
422090e997
|
@ -124,7 +124,6 @@ export class DayListComponent {
|
||||||
});
|
});
|
||||||
|
|
||||||
// this.cd.detectChanges();
|
// this.cd.detectChanges();
|
||||||
console.log('this.choices.length', this.storageService.dateList.length);
|
|
||||||
|
|
||||||
this.focusOnChoice(this.storageService.dateList.length - 1);
|
this.focusOnChoice(this.storageService.dateList.length - 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,6 @@ export class FormComponent implements OnInit {
|
||||||
startDateInterval: ['', [Validators.required]],
|
startDateInterval: ['', [Validators.required]],
|
||||||
endDateInterval: ['', [Validators.required]],
|
endDateInterval: ['', [Validators.required]],
|
||||||
});
|
});
|
||||||
console.log('this.form ', this.form);
|
|
||||||
|
|
||||||
// take back values from pollservice
|
// take back values from pollservice
|
||||||
this.form.patchValue(this.pollService.poll);
|
this.form.patchValue(this.pollService.poll);
|
||||||
|
@ -140,8 +139,6 @@ export class FormComponent implements OnInit {
|
||||||
const dateStart = this.dateUtils.formateDateToInputStringNg(new Date());
|
const dateStart = this.dateUtils.formateDateToInputStringNg(new Date());
|
||||||
const dateEnd = this.dateUtils.formateDateToInputStringNg(this.dateUtils.addDaysToDate(5, new Date()));
|
const dateEnd = this.dateUtils.formateDateToInputStringNg(this.dateUtils.addDaysToDate(5, new Date()));
|
||||||
|
|
||||||
console.log('dateStart', dateStart);
|
|
||||||
|
|
||||||
this.form.patchValue({
|
this.form.patchValue({
|
||||||
title: title,
|
title: title,
|
||||||
custom_url: this.pollUtilitiesService.makeSlugFromString(title),
|
custom_url: this.pollUtilitiesService.makeSlugFromString(title),
|
||||||
|
@ -156,7 +153,6 @@ export class FormComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
goNextStep() {
|
goNextStep() {
|
||||||
console.log('this.steps', this.steps);
|
|
||||||
let indexCurrentStep = this.steps.indexOf(this.currentStep);
|
let indexCurrentStep = this.steps.indexOf(this.currentStep);
|
||||||
indexCurrentStep += 1;
|
indexCurrentStep += 1;
|
||||||
this.currentStep = this.steps[indexCurrentStep];
|
this.currentStep = this.steps[indexCurrentStep];
|
||||||
|
@ -164,7 +160,6 @@ export class FormComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
public createPoll(): void {
|
public createPoll(): void {
|
||||||
console.log('this.form', this.form);
|
|
||||||
const newpoll = this.pollService.newPollFromForm(this.form);
|
const newpoll = this.pollService.newPollFromForm(this.form);
|
||||||
console.log('newpoll', newpoll);
|
console.log('newpoll', newpoll);
|
||||||
const router = this.router;
|
const router = this.router;
|
||||||
|
@ -180,7 +175,7 @@ export class FormComponent implements OnInit {
|
||||||
router.navigate(['success']);
|
router.navigate(['success']);
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
this.toastService.display('erreur lors de la sauvegarde');
|
this.toastService.display('erreur lors de la sauvegarde ' + err.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -23,7 +23,7 @@ export class ErrorsListComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
getFormValidationErrors(): void {
|
getFormValidationErrors(): void {
|
||||||
console.log('%c ==>> Validation Errors: ', 'color: red; font-weight: bold; font-size:22px;');
|
// console.log('%c ==>> Validation Errors: ', 'color: red; font-weight: bold; font-size:22px;');
|
||||||
|
|
||||||
let totalErrors = 0;
|
let totalErrors = 0;
|
||||||
this.messages = [];
|
this.messages = [];
|
||||||
|
@ -37,22 +37,16 @@ export class ErrorsListComponent implements OnInit {
|
||||||
if (!firstErrorId) {
|
if (!firstErrorId) {
|
||||||
firstErrorId = key;
|
firstErrorId = key;
|
||||||
}
|
}
|
||||||
// totalErrors++;
|
|
||||||
// this.messages.push('' + key + ' est invalide');
|
|
||||||
}
|
}
|
||||||
const controlErrors: ValidationErrors = theKey.errors;
|
const controlErrors: ValidationErrors = theKey.errors;
|
||||||
|
|
||||||
if (controlErrors != null) {
|
if (controlErrors != null) {
|
||||||
console.log('controlErrors', controlErrors);
|
|
||||||
totalErrors++;
|
totalErrors++;
|
||||||
Object.keys(controlErrors).forEach((keyError) => {
|
Object.keys(controlErrors).forEach((keyError) => {
|
||||||
if (!firstErrorId) {
|
if (!firstErrorId) {
|
||||||
firstErrorId = key;
|
firstErrorId = key;
|
||||||
}
|
}
|
||||||
const message = '' + key + ', ' + keyError + '';
|
const message = '' + key + ', ' + keyError + '';
|
||||||
console.log(
|
|
||||||
'Key control: ' + key + ', keyError: ' + keyError + ', err value: ' + controlErrors[keyError]
|
|
||||||
);
|
|
||||||
|
|
||||||
this.messages.push(message);
|
this.messages.push(message);
|
||||||
});
|
});
|
||||||
|
@ -62,11 +56,10 @@ export class ErrorsListComponent implements OnInit {
|
||||||
this.firstErrorId = firstErrorId;
|
this.firstErrorId = firstErrorId;
|
||||||
|
|
||||||
if (totalErrors) {
|
if (totalErrors) {
|
||||||
console.log('Number of errors: ', totalErrors);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollToFirstError() {
|
scrollToFirstError(): void {
|
||||||
if (this.firstErrorId) {
|
if (this.firstErrorId) {
|
||||||
const foundErrorField = this.document.querySelector('#' + this.firstErrorId);
|
const foundErrorField = this.document.querySelector('#' + this.firstErrorId);
|
||||||
if (foundErrorField) {
|
if (foundErrorField) {
|
||||||
|
@ -77,7 +70,6 @@ export class ErrorsListComponent implements OnInit {
|
||||||
behavior: 'smooth',
|
behavior: 'smooth',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
console.log('foundErrorField', foundErrorField);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
<label for="lang_selector" class="hidden">{{ 'selector.lang' | translate }}</label>
|
<label for="lang_selector" class="hidden">{{ 'selector.lang' | translate }}</label>
|
||||||
<select class="select is-hidden-touch" id="lang_selector" (change)="setLang()" [(ngModel)]="currentLang">
|
<select class="select is-hidden-touch" id="lang_selector" (change)="setLang()" [(ngModel)]="currentLang">
|
||||||
<option *ngFor="let language of availableLanguages" value="{{ language }}">
|
<option *ngFor="let language of availableLanguages" value="{{ language }}">
|
||||||
{{ language }} - {{ 'LANGUAGES.' + language | translate }}
|
<!-- {{ language }} - -->
|
||||||
|
{{ 'LANGUAGES.' + language | translate }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { StorageService } from '../../../../core/services/storage.service';
|
||||||
})
|
})
|
||||||
export class LanguageSelectorComponent implements OnInit {
|
export class LanguageSelectorComponent implements OnInit {
|
||||||
public currentLang: Language;
|
public currentLang: Language;
|
||||||
public availableLanguages: string[] = [];
|
public availableLanguages: any = [];
|
||||||
|
|
||||||
constructor(private languageService: LanguageService, private storageService: StorageService) {}
|
constructor(private languageService: LanguageService, private storageService: StorageService) {}
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ export class LanguageSelectorComponent implements OnInit {
|
||||||
this.availableLanguages = this.languageService.getAvailableLanguages();
|
this.availableLanguages = this.languageService.getAvailableLanguages();
|
||||||
|
|
||||||
this.currentLang = this.languageService.getLangage();
|
this.currentLang = this.languageService.getLangage();
|
||||||
this.nextLang();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setLang(): void {
|
setLang(): void {
|
||||||
|
@ -27,7 +26,26 @@ export class LanguageSelectorComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
nextLang(): void {
|
nextLang(): void {
|
||||||
|
const index = this.availableLanguages.indexOf(this.currentLang);
|
||||||
|
console.log('this.currentLang ', this.currentLang, 'index', index);
|
||||||
|
|
||||||
|
if (index !== -1) {
|
||||||
|
// on passe au language suivant si il existe, sinon on revient au numéro 0
|
||||||
|
const nextlang = console.log('this.availableLanguages[index + 1]', this.availableLanguages[index + 1]);
|
||||||
|
console.log('nextlang', nextlang);
|
||||||
|
|
||||||
|
if (this.availableLanguages[index + 1]) {
|
||||||
|
console.log('lang suivante', this.availableLanguages[index + 1]);
|
||||||
|
this.currentLang = this.availableLanguages[index + 1];
|
||||||
|
} else {
|
||||||
|
console.log('retour à la langue 0');
|
||||||
|
this.currentLang = this.availableLanguages[0];
|
||||||
|
}
|
||||||
|
this.setLang();
|
||||||
|
}
|
||||||
console.log('this.currentLang ', this.currentLang);
|
console.log('this.currentLang ', this.currentLang);
|
||||||
|
|
||||||
|
console.log('this.availableLanguages', this.availableLanguages);
|
||||||
console.log('TODO');
|
console.log('TODO');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue