File
Implements
Methods
closePopover
|
closePopover()
|
|
|
prepareTaskMeta
|
prepareTaskMeta()
|
|
|
currentYear
|
Default value : new Date().getFullYear()
|
|
Public
popOverCtrl
|
Type : PopoverController
|
|
import { Component, OnInit } from '@angular/core';
import { AttachmentService, ToastService, UtilsService } from '@app/app/manage-learn/core';
import { ModalController, PopoverController } from '@ionic/angular';
@Component({
selector: 'app-create-task',
templateUrl: './create-task.component.html',
styleUrls: ['./create-task.component.scss'],
})
export class CreateTaskComponent implements OnInit {
newTask;
currentYear = new Date().getFullYear();
today;
constructor(
private modalCtrl: ModalController,
private utils: UtilsService,
private attachmentService: AttachmentService,
private toast: ToastService,
public popOverCtrl: PopoverController
) { }
ngOnInit() {
this.prepareTaskMeta();
}
prepareTaskMeta() {
this.newTask = JSON.parse(JSON.stringify(this.utils.getMetaData('task')));
}
close() {
this.modalCtrl.dismiss();
}
openAction() {
this.attachmentService.selectImage().then(data => {
!this.newTask.attachments ? this.newTask.attachments = [] : '';
data.data ? this.newTask.attachments.push(data.data) : ''
})
}
addTask() {
if(this.newTask.name){
this.toast.showMessage('FRMELEMNTS_MSG_NEW_TASK_ADDED_SUCCESSFUL', 'success');
this.popOverCtrl.dismiss(this.newTask)
} else {
this.toast.showMessage('FRMELEMNTS_MSG_REQUIRED_FIELDS', 'danger')
}
}
share() {
this.toast.showMessage('FRMELEMNTS_MSG_COMING_SOON', 'danger');
}
closePopover() {
this.popOverCtrl.dismiss();
}
}
<ion-content class="P0">
<div class="ecd-header ion-text-center">
</div>
<ion-grid class="P0 sb-popover-content-details">
<ion-icon name="close" class="sb-modal-close close-popup" (click)="closePopover()"></ion-icon>
<ion-row class="P16 color-white">
<h5> {{'FRMELEMNTS_LBL_ADD_NEW_TASK' | translate}}</h5>
<section class="W100 MT3V">
<p>{{'FRMELEMNTS_LBL_TASK_DESCRIPTION' | translate}}</p>
<ion-col size="12" class="ion-no-padding">
<div class="W100 merged-input-container MT10">
<ion-textarea type="text" placeholder="{{'FRMELEMNTS_LBL_ADD_DESCRIPTION_HERE' | translate}}" class="form-control custom task-desc" [(ngModel)]="newTask.name">
</ion-textarea>
</div>
</ion-col>
</section>
</ion-row>
<ion-row class="custom-shadow">
<ion-col padding size="12">
<ion-button expand="block" (click)="addTask()" class="custom-btn-txt-transform-none">
{{ 'FRMELEMNTS_LBL_ADD_TASK' | translate }}
</ion-button>
</ion-col>
</ion-row>
</ion-grid>
</ion-content>
@import "../../../../../assets/styles/_variables.scss";
.close-popup{
margin: 10px;
font-size: 1.5rem;
right: 0px;
position: absolute;
}
.P16 {
padding: 16px !important;
h5{
font-weight: 600;
}
}
.task-desc{
border:1px solid $gray-400;
}
Legend
Html element with directive