|
@@ -25,14 +25,14 @@ export class AbsorpationAddComponent implements OnInit {
|
|
|
|
|
|
absorpation = {
|
|
absorpation = {
|
|
name: '',
|
|
name: '',
|
|
- status: '',
|
|
|
|
|
|
+ status: '1',
|
|
department_id: '',
|
|
department_id: '',
|
|
count: null,
|
|
count: null,
|
|
}
|
|
}
|
|
|
|
|
|
@ViewChild('f') formData: NgForm;
|
|
@ViewChild('f') formData: NgForm;
|
|
|
|
|
|
- startDate;
|
|
|
|
|
|
+ startDate: string = '';
|
|
endDate: string = '';
|
|
endDate: string = '';
|
|
checkSaveclick: boolean = false;
|
|
checkSaveclick: boolean = false;
|
|
typeMode: boolean = false;
|
|
typeMode: boolean = false;
|
|
@@ -103,6 +103,17 @@ export class AbsorpationAddComponent implements OnInit {
|
|
|
|
|
|
//get value date from child component
|
|
//get value date from child component
|
|
public getDate(date: any , type: string):void {
|
|
public getDate(date: any , type: string):void {
|
|
|
|
+
|
|
|
|
+ if(date.month < 10) {
|
|
|
|
+ date.month = '0' + date.month;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(date.day < 10) {
|
|
|
|
+ date.day = '0' + date.day;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ console.log( date);
|
|
|
|
+
|
|
console.log( date);
|
|
console.log( date);
|
|
if(type == 'start') {
|
|
if(type == 'start') {
|
|
this.startDate = date.year + '-' + date.month + '-' + date.day;
|
|
this.startDate = date.year + '-' + date.month + '-' + date.day;
|
|
@@ -136,7 +147,7 @@ export class AbsorpationAddComponent implements OnInit {
|
|
if(startDateData[0] > endDateData[0]) {
|
|
if(startDateData[0] > endDateData[0]) {
|
|
this.toastr.warning('سنه تاريخ الإنتهاء يجب أن تكون أكبر من سنه تاريخ الإنتهاء !');
|
|
this.toastr.warning('سنه تاريخ الإنتهاء يجب أن تكون أكبر من سنه تاريخ الإنتهاء !');
|
|
this.checkSaveclick = false;
|
|
this.checkSaveclick = false;
|
|
- } else if(startDateData[1] > endDateData[1]){
|
|
|
|
|
|
+ } else if(startDateData[0] == endDateData[0] && startDateData[1] > endDateData[1]){
|
|
this.toastr.warning('شهر تاريخ الانتهاء يجب أن يكون أكبر من شهر تاريخ الإبتداء !');
|
|
this.toastr.warning('شهر تاريخ الانتهاء يجب أن يكون أكبر من شهر تاريخ الإبتداء !');
|
|
this.checkSaveclick = false;
|
|
this.checkSaveclick = false;
|
|
} else if(startDateData[1] == endDateData[1] && startDateData[2] > endDateData[2]){
|
|
} else if(startDateData[1] == endDateData[1] && startDateData[2] > endDateData[2]){
|
|
@@ -159,10 +170,10 @@ export class AbsorpationAddComponent implements OnInit {
|
|
if(startDateData[0] > endDateData[0]) {
|
|
if(startDateData[0] > endDateData[0]) {
|
|
this.toastr.warning('سنه تاريخ الإنتهاء يجب أن تكون أكبر من سنه تاريخ الإنتهاء !');
|
|
this.toastr.warning('سنه تاريخ الإنتهاء يجب أن تكون أكبر من سنه تاريخ الإنتهاء !');
|
|
this.checkSaveclick = false;
|
|
this.checkSaveclick = false;
|
|
- } else if(startDateData[1] == endDateData[1] && startDateData[2] > endDateData[2]){
|
|
|
|
|
|
+ } else if(startDateData[0] == endDateData[0] && startDateData[1] > endDateData[1]){
|
|
this.toastr.warning('شهر تاريخ الانتهاء يجب أن يكون أكبر من شهر تاريخ الإبتداء !');
|
|
this.toastr.warning('شهر تاريخ الانتهاء يجب أن يكون أكبر من شهر تاريخ الإبتداء !');
|
|
this.checkSaveclick = false;
|
|
this.checkSaveclick = false;
|
|
- } else if(startDateData[2] > endDateData[2]){
|
|
|
|
|
|
+ } else if(startDateData[1] == endDateData[1] && startDateData[2] > endDateData[2]){
|
|
this.toastr.warning(' يوم تاريخ الإنتهاء يجب أن يكون أكبر من يوم تاريخ الإبتداء!');
|
|
this.toastr.warning(' يوم تاريخ الإنتهاء يجب أن يكون أكبر من يوم تاريخ الإبتداء!');
|
|
this.checkSaveclick = false;
|
|
this.checkSaveclick = false;
|
|
} else {
|
|
} else {
|