File

src/app/manage-learn/shared/components/create-task/create-task.component.ts

Implements

OnInit

Metadata

Index

Properties
Methods

Constructor

constructor(modalCtrl: ModalController, utils: UtilsService, attachmentService: AttachmentService, toast: ToastService, popOverCtrl: PopoverController)
Parameters :
Name Type Optional
modalCtrl ModalController No
utils UtilsService No
attachmentService AttachmentService No
toast ToastService No
popOverCtrl PopoverController No

Methods

addTask
addTask()
Returns : void
close
close()
Returns : void
closePopover
closePopover()
Returns : void
ngOnInit
ngOnInit()
Returns : void
openAction
openAction()
Returns : void
prepareTaskMeta
prepareTaskMeta()
Returns : void
share
share()
Returns : void

Properties

currentYear
Default value : new Date().getFullYear()
newTask
Public popOverCtrl
Type : PopoverController
today
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>

./create-task.component.scss

@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
Component
Html element with directive

results matching ""

    No results matching ""