text: "use strict";var __decorate=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;0<=s;s--)(o=e[s])&&(i=(a<3?o(i):3<a?o(t,r,i):o(t,r))||i);return 3<a&&i&&Object.defineProperty(t,r,i),i},__awaiter=this&&this.__awaiter||function(e,i,s,c){return new(s=s||Promise)(function(r,t){function n(e){try{a(c.next(e))}catch(e){t(e)}}function o(e){try{a(c.throw(e))}catch(e){t(e)}}function a(e){var t;e.done?r(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(n,o)}a((c=c.apply(e,i||[])).next())})},__generator=this&&this.__generator||function(r,n){var o,a,i,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,a&&(i=2&t[0]?a.return:t[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,t[1])).done)return i;switch(a=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,a=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(i=0<(i=s.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3])){s.label=t[1];break}if(6===t[0]&&s.label<i[1]){s.label=i[1],i=t;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(t);break}i[2]&&s.ops.pop(),s.trys.pop();continue}t=n.call(r,s)}catch(e){t=[6,e],a=0}finally{o=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}};exports.__esModule=!0,exports.AddNewTaskPage=void 0;var core_1=require("@angular/core"),AddNewTaskPage=function(){function e(e,t,r){this.modalCtlr=e,this.todoService=t,this.toastController=r,this.minDate=(new Date).toISOString(),this.maxDate=(new Date).getFullYear()+3,this.categories=[],this.newTaskObj={}}return e.prototype.ngOnInit=function(){this.categories.push("Work"),this.categories.push("Homework"),this.categories.push("Personal")},e.prototype.add=function(){return __awaiter(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return this.newTaskObj={itemName:this.itemName,itemDueDate:this.itemDueDate,itemPriority:this.itemPriority,itemCategory:this.categorySelectedCategory},console.log(this.newTaskObj),(t=this.itemName+this.itemDueDate)?[4,this.todoService.addTask(t,this.newTaskObj)]:[3,2];case 1:return e.sent(),[3,5];case 2:return[4,this.toastController.create({color:"dark",duration:2e3,message:"Can't save empty task"})];case 3:return[4,e.sent().present()];case 4:e.sent(),console.log("can't save empty task"),e.label=5;case 5:return this.dismis(),[2]}})})},e.prototype.selectCategory=function(e){this.categorySelectedCategory=this.categories[e],console.log(this.categorySelectedCategory)},e.prototype.dismis=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return[4,this.modalCtlr.dismiss(this.newTaskObj)];case 1:return e.sent(),[2]}})})},e=__decorate([core_1.Component({selector:"app-add-new-task",templateUrl:"./add-new-task.page.html",styleUrls:["./add-new-task.page.scss"]})],e)}();exports.AddNewTaskPage=AddNewTaskPage;