From bf75ebcdcca5e01444a6ffcee58cc33f6572ddb7 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Thu, 3 Oct 2024 05:05:09 -0400 Subject: [PATCH] 2500 --- src/app/pages/activetask/activetask.page.ts | 30 ++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/app/pages/activetask/activetask.page.ts b/src/app/pages/activetask/activetask.page.ts index 375a8c8..634ef7c 100644 --- a/src/app/pages/activetask/activetask.page.ts +++ b/src/app/pages/activetask/activetask.page.ts @@ -1,5 +1,5 @@ import {Component, OnInit, ViewChild} from '@angular/core'; -import {AlertController, LoadingController, NavController} from "@ionic/angular"; +import {AlertController, LoadingController, NavController, ToastController} from "@ionic/angular"; import {Router} from "@angular/router"; import { SessionDataProviderService } from 'src/app/store/session-data-provider.service'; import { BlogDataService } from 'src/app/store/blog-data.service'; @@ -31,6 +31,7 @@ export class ActivetaskPage implements OnInit { private alertController:AlertController, private wrenchService: WrenchService, public tasksDataService:TasksDataService, + private toastController: ToastController, public blogDataService: BlogDataService, private loadingCtrl: LoadingController, private mediaConnectService: MediaConnectService, @@ -172,8 +173,26 @@ export class ActivetaskPage implements OnInit { ); } + completionRestricted(){ + const strict_timeline = this.jobData.strict_timeline; + const minimum_due = new Date(this.jobData.minimum_due); + + if ( strict_timeline > 0 ){ + const today = new Date(); + const result = ( today > minimum_due); + if ( result == false) { + const tMeassage = "This task can onlt be marked completed after " + minimum_due; + this.presentToast(tMeassage, "middle", 5500); + } + return result; + } + return true; + } async taskCompleted(){ // alert(100); + if ( this.completionRestricted()==false ){ + return; + } let reqData = { contract: this.jobData.contract, contract_uid: this.jobData.contract_uid, @@ -421,4 +440,13 @@ export class ActivetaskPage implements OnInit { ); } } + async presentToast(amessage, position: 'top' | 'middle' | 'bottom', duration: number= 2500) { + const toast = await this.toastController.create({ + message: amessage, + duration: duration, + position: position, + }); + + await toast.present(); + } }