mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
⚡ update manual text dates input on change and prefill
This commit is contained in:
parent
19e5e07d26
commit
217d9a97c7
@ -47,7 +47,7 @@ export class PollService implements Resolve<Poll> {
|
|||||||
public showDateInterval = false;
|
public showDateInterval = false;
|
||||||
public allowSeveralHours = false;
|
public allowSeveralHours = false;
|
||||||
public richTextMode = false;
|
public richTextMode = false;
|
||||||
public mode_calendar = true;
|
public mode_calendar = false;
|
||||||
public calendar: Date[] = [new Date()];
|
public calendar: Date[] = [new Date()];
|
||||||
public disabled_dates: Date[] = [];
|
public disabled_dates: Date[] = [];
|
||||||
|
|
||||||
|
@ -7,9 +7,6 @@
|
|||||||
(cdkDropListDropped)="dropDayItem($event)"
|
(cdkDropListDropped)="dropDayItem($event)"
|
||||||
>
|
>
|
||||||
<div class="date-choice-container" *ngFor="let choice of dateChoices; index as id">
|
<div class="date-choice-container" *ngFor="let choice of dateChoices; index as id">
|
||||||
<p>
|
|
||||||
{{ choice.date_object | date: 'short' }}
|
|
||||||
</p>
|
|
||||||
<div class="date-choice" cdkDrag [ngClass]="{ 'day-weekend': isWeekendDay(choice.date_input) }">
|
<div class="date-choice" cdkDrag [ngClass]="{ 'day-weekend': isWeekendDay(choice.date_input) }">
|
||||||
<!-- <span class="button is-default">-->
|
<!-- <span class="button is-default">-->
|
||||||
<!-- <i class="icon fa fa-arrows-v"></i>-->
|
<!-- <i class="icon fa fa-arrows-v"></i>-->
|
||||||
@ -26,7 +23,8 @@
|
|||||||
<span class="format-helper pull-right">{{ 'dates.format_helper' | translate }}</span>
|
<span class="format-helper pull-right">{{ 'dates.format_helper' | translate }}</span>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
[(ngModel)]="choice.date_input"
|
[ngModel]="choice.date_object | date: 'yyyy-MM-dd'"
|
||||||
|
(ngModelChange)="convertDateInput($event, id)"
|
||||||
class="date-choice-item"
|
class="date-choice-item"
|
||||||
name="dateChoices_{{ id }}"
|
name="dateChoices_{{ id }}"
|
||||||
id="dateChoices_{{ id }}"
|
id="dateChoices_{{ id }}"
|
||||||
|
@ -180,4 +180,16 @@ export class DayListComponent {
|
|||||||
openSimple() {
|
openSimple() {
|
||||||
this.display = !this.display;
|
this.display = !this.display;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* convert back date object to datechoices
|
||||||
|
* @param date_as_string
|
||||||
|
* @param choice_id
|
||||||
|
*/
|
||||||
|
convertDateInput(date_as_string: string, choice_id: number) {
|
||||||
|
console.log('$event,date_object', date_as_string, choice_id);
|
||||||
|
let newDate = new Date(date_as_string);
|
||||||
|
this.dateChoices[choice_id].date_object = newDate;
|
||||||
|
this.dateChoices[choice_id].date_input = date_as_string;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user