2500
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import {Component, OnInit, ViewChild} from '@angular/core';
|
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 {Router} from "@angular/router";
|
||||||
import { SessionDataProviderService } from 'src/app/store/session-data-provider.service';
|
import { SessionDataProviderService } from 'src/app/store/session-data-provider.service';
|
||||||
import { BlogDataService } from 'src/app/store/blog-data.service';
|
import { BlogDataService } from 'src/app/store/blog-data.service';
|
||||||
@@ -31,6 +31,7 @@ export class ActivetaskPage implements OnInit {
|
|||||||
private alertController:AlertController,
|
private alertController:AlertController,
|
||||||
private wrenchService: WrenchService,
|
private wrenchService: WrenchService,
|
||||||
public tasksDataService:TasksDataService,
|
public tasksDataService:TasksDataService,
|
||||||
|
private toastController: ToastController,
|
||||||
public blogDataService: BlogDataService,
|
public blogDataService: BlogDataService,
|
||||||
private loadingCtrl: LoadingController,
|
private loadingCtrl: LoadingController,
|
||||||
private mediaConnectService: MediaConnectService,
|
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(){
|
async taskCompleted(){
|
||||||
// alert(100);
|
// alert(100);
|
||||||
|
if ( this.completionRestricted()==false ){
|
||||||
|
return;
|
||||||
|
}
|
||||||
let reqData = {
|
let reqData = {
|
||||||
contract: this.jobData.contract,
|
contract: this.jobData.contract,
|
||||||
contract_uid: this.jobData.contract_uid,
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user