|
@@ -95,6 +95,7 @@ export class RegistrationTraineeMovementAddComponent implements OnInit {
|
|
nameFile: '',
|
|
nameFile: '',
|
|
id: null,
|
|
id: null,
|
|
}];
|
|
}];
|
|
|
|
+
|
|
attachments_ids = []; //attachements ids;
|
|
attachments_ids = []; //attachements ids;
|
|
|
|
|
|
|
|
|
|
@@ -158,7 +159,7 @@ export class RegistrationTraineeMovementAddComponent implements OnInit {
|
|
|
|
|
|
this.route.params.subscribe(
|
|
this.route.params.subscribe(
|
|
(params: Params) => {
|
|
(params: Params) => {
|
|
- this.reportId = params['registrationTraineereviewSectionAddId'];
|
|
|
|
|
|
+ this.reportId = +params['registrationTraineereviewSectionAddId'];
|
|
}
|
|
}
|
|
);
|
|
);
|
|
|
|
|
|
@@ -185,6 +186,7 @@ export class RegistrationTraineeMovementAddComponent implements OnInit {
|
|
this.formData.training_period = responce['data']['request'].training_period;
|
|
this.formData.training_period = responce['data']['request'].training_period;
|
|
this.formData.functional_number = responce['data']['request'].functional_number;
|
|
this.formData.functional_number = responce['data']['request'].functional_number;
|
|
this.formData.organization_affiliated_with = responce['data']['request'].organization_affiliated_with;
|
|
this.formData.organization_affiliated_with = responce['data']['request'].organization_affiliated_with;
|
|
|
|
+ this.formData.status = responce['data']['request'].status;
|
|
this.formData.registration_number = responce['data']['request'].registration_number;
|
|
this.formData.registration_number = responce['data']['request'].registration_number;
|
|
this.userData.name = responce['data']['user'].name;
|
|
this.userData.name = responce['data']['user'].name;
|
|
this.userData.email = responce['data']['user'].email;
|
|
this.userData.email = responce['data']['user'].email;
|
|
@@ -249,7 +251,7 @@ export class RegistrationTraineeMovementAddComponent implements OnInit {
|
|
traineeStatus(status: string) {
|
|
traineeStatus(status: string) {
|
|
console.log(status);
|
|
console.log(status);
|
|
if(status == 'ended') {
|
|
if(status == 'ended') {
|
|
- this.toastr.warning('تم الانهاء للمتدرب');
|
|
|
|
|
|
+ this.toastr.warning('تم الانهاء للمتدرب ، قم بتسجيل تققيم القسم للمتدرب');
|
|
this.actionForm.trainee_status = status;
|
|
this.actionForm.trainee_status = status;
|
|
this.endedShow = true;
|
|
this.endedShow = true;
|
|
this.stoppedShow = false;
|
|
this.stoppedShow = false;
|
|
@@ -267,8 +269,8 @@ export class RegistrationTraineeMovementAddComponent implements OnInit {
|
|
|
|
|
|
//change file
|
|
//change file
|
|
onFileChanges(event, index:number) {
|
|
onFileChanges(event, index:number) {
|
|
- console.log(event);
|
|
|
|
- console.log(index);
|
|
|
|
|
|
+ console.log(event);
|
|
|
|
+ console.log(index);
|
|
this.files[index].nameFile = event[0].name.substring(0,20) + '....';
|
|
this.files[index].nameFile = event[0].name.substring(0,20) + '....';
|
|
this.files[index].file = event[0].base64;
|
|
this.files[index].file = event[0].base64;
|
|
this.files[index].file_type = event[0].type.split('/')[1];
|
|
this.files[index].file_type = event[0].type.split('/')[1];
|
|
@@ -280,8 +282,8 @@ export class RegistrationTraineeMovementAddComponent implements OnInit {
|
|
this.checkSaveClick = false;
|
|
this.checkSaveClick = false;
|
|
}
|
|
}
|
|
console.log(this.files);
|
|
console.log(this.files);
|
|
- console.log('files after change ',this.files);
|
|
|
|
-}
|
|
|
|
|
|
+ console.log('files after change ',this.files);
|
|
|
|
+ }
|
|
|
|
|
|
plusImage() {
|
|
plusImage() {
|
|
this.files.push({
|
|
this.files.push({
|
|
@@ -342,6 +344,7 @@ plusImage() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -351,13 +354,13 @@ plusImage() {
|
|
delete this.files[i].id;
|
|
delete this.files[i].id;
|
|
}
|
|
}
|
|
|
|
|
|
- //get attachmeents in object files
|
|
|
|
- const attachements = [];
|
|
|
|
- for(let i = 0; i < this.files.length; i++) {
|
|
|
|
- if(this.files[i].file != '') {
|
|
|
|
- attachements.push(this.files[i]);
|
|
|
|
- }
|
|
|
|
|
|
+ //get attachmeents in object files
|
|
|
|
+ const attachements = [];
|
|
|
|
+ for(let i = 0; i < this.files.length; i++) {
|
|
|
|
+ if(this.files[i].file != '') {
|
|
|
|
+ attachements.push(this.files[i]);
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
|
|
//add to form the edit old file
|
|
//add to form the edit old file
|
|
this.actionForm['editable_attachments'] = editAttachements;
|
|
this.actionForm['editable_attachments'] = editAttachements;
|
|
@@ -365,18 +368,24 @@ plusImage() {
|
|
this.actionForm['attachments_ids'] = this.attachments_ids;//departments_ids
|
|
this.actionForm['attachments_ids'] = this.attachments_ids;//departments_ids
|
|
|
|
|
|
console.log(this.actionForm);
|
|
console.log(this.actionForm);
|
|
- this.http.post(this.authSer.pathApi + '/trace_trainee_movement', this.actionForm).subscribe(
|
|
|
|
- (responce) => {
|
|
|
|
- console.log(responce);
|
|
|
|
- this.toastr.success('تم بنجاح');
|
|
|
|
- this.location.back();
|
|
|
|
- },
|
|
|
|
- (error) => {
|
|
|
|
- console.log(error);
|
|
|
|
- this.toastr.error('يوجد خطأ في الحفظ ، حاول لاحقاً');
|
|
|
|
- this.location.back();
|
|
|
|
- }
|
|
|
|
- );
|
|
|
|
|
|
+ if(this.actionForm.trainee_status == 'ended' && this.actionForm.trainee_evaluation == ''){
|
|
|
|
+ this.toastr.warning('قم بتسجيل تقييم القسم للمتدرب !');
|
|
|
|
+ this.checkSaveClick = false;
|
|
|
|
+ } else {
|
|
|
|
+ this.http.post(this.authSer.pathApi + '/trace_trainee_movement', this.actionForm).subscribe(
|
|
|
|
+ (responce) => {
|
|
|
|
+ console.log(responce);
|
|
|
|
+ this.toastr.success('تم بنجاح');
|
|
|
|
+ this.location.back();
|
|
|
|
+ },
|
|
|
|
+ (error) => {
|
|
|
|
+ console.log(error);
|
|
|
|
+ this.toastr.error('يوجد خطأ في الحفظ ، حاول لاحقاً');
|
|
|
|
+ this.location.back();
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|