diff --git a/src/app/pages/jobactive/jobactive.page.html b/src/app/pages/jobactive/jobactive.page.html index 643fed8..2469196 100644 --- a/src/app/pages/jobactive/jobactive.page.html +++ b/src/app/pages/jobactive/jobactive.page.html @@ -118,12 +118,15 @@ - - - - - + + Send File + + + + + + { - // this.msgListTotalData = msgListTotalData; - // // console.log("REFER RETURN->", this.referTotalData); - // this.msgListData = this.msgListTotalData.result_list; - // console.log("REFER RETURN DATA->", this.msgListData); - // } - // ); - // - // } reqData: { action:number, member_id: number, uid: string, sessionid: string, msg_type:string, @@ -189,5 +161,58 @@ export class JobactivePage implements OnInit { // console.log( this.uploadData); } } + uploadFormData: { + action:number, + member_id: number, + uid: string, + contract: string, + sessionid: string, + msg_type:'FILE' + }; + async pickFiles (fileMode) { + const result = await FilePicker.pickFiles({ + types: ['image/png','image/jpeg','video/mp4'], + multiple: false, + readData:true + }); + + const loading = await this.loadingCtrl.create({ + message: 'Uploading...', + duration: 5000, + }); + + if(result){ + console.log(result); + // debugger; + this.uploadFormData={ + action:14010, + member_id: this.sessionDataProviderService.member_id, + uid: this.sessionDataProviderService.member_uid, + contract: this.jobData.contract, + sessionid: this.sessionDataProviderService.session , + msg_type:'FILE' + }; + + console.log(this.uploadFormData); + for (const [key, value] of Object.entries( this.uploadFormData )) { + console.log(`${key}: ${value}`); + } + + var blob = new Blob([ result.files[0].data ], { type: result.files[0].mimeType }); + var file = new File([blob], result.files[0].name, {type: result.files[0].mimeType }); +//return; + await loading.present(); + this.mediaConnectService.uploadtaskFile(this.uploadFormData, file).subscribe( + uploadResult => { + loading.dismiss(); + this.uploadResult = uploadResult; + console.log("this.mediaConnectService.uploadFile RETURN DATA->", this.uploadFormData); + const event = new Event("app-taskactivities-refresh"); + // Dispatch the event. + dispatchEvent(event); + } + ); + } + } }