load controller
This commit is contained in:
@@ -71,7 +71,7 @@
|
||||
</div>
|
||||
|
||||
<div *ngIf="tabs =='activities'" class="lesson">
|
||||
<ion-card>
|
||||
<ion-card style="margin: 0px;">
|
||||
<ion-card-content style="padding: 1px;">
|
||||
<ion-textarea
|
||||
style="background-color: aliceblue; margin: 0px; min-height: 120px"
|
||||
@@ -82,12 +82,16 @@
|
||||
<ion-grid>
|
||||
<ion-row>
|
||||
<ion-col style="text-align: left;">
|
||||
<ion-button fill="outline" size="small" color="secondary" (click)="startCamera(100)">
|
||||
<ion-icon slot="icon-only" name="camera-reverse-outline"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button fill="outline" size="small" style="margin-left: 10px;" (click)="startCamera(0)">
|
||||
<ion-icon slot="icon-only" name="folder-outline"></ion-icon>
|
||||
<ion-button fill="outline" size="small" color="secondary" (click)="pickFiles(100)">
|
||||
<ion-icon name="document-attach-outline"></ion-icon> Send File
|
||||
</ion-button>
|
||||
<!-- -->
|
||||
<!-- <ion-button fill="outline" size="small" color="secondary" (click)="startCamera(100)">-->
|
||||
<!-- <ion-icon slot="icon-only" name="camera-reverse-outline"></ion-icon>-->
|
||||
<!-- </ion-button>-->
|
||||
<!-- <ion-button fill="outline" size="small" style="margin-left: 10px;" (click)="startCamera(0)">-->
|
||||
<!-- <ion-icon slot="icon-only" name="folder-outline"></ion-icon>-->
|
||||
<!-- </ion-button>-->
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-button style="margin-left: 20px;"
|
||||
|
||||
@@ -6,6 +6,8 @@ import { BlogDataService } from 'src/app/store/blog-data.service';
|
||||
import { WrenchService } from 'src/app/services/wrench.service';
|
||||
import {Camera, CameraResultType, CameraSource} from "@capacitor/camera";
|
||||
import {TasksDataService} from "../../store/tasks-data.service";
|
||||
import {FilePicker} from "@capawesome/capacitor-file-picker";
|
||||
import {MediaConnectService} from "../../services/media-connect.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-activetask',
|
||||
@@ -28,7 +30,8 @@ export class ActivetaskPage implements OnInit {
|
||||
private wrenchService: WrenchService,
|
||||
public tasksDataService:TasksDataService,
|
||||
public blogDataService: BlogDataService,
|
||||
private loadingCtrl: LoadingController
|
||||
private loadingCtrl: LoadingController,
|
||||
private mediaConnectService: MediaConnectService
|
||||
) {
|
||||
this.yourmessage='';
|
||||
this.jobData = this.router.getCurrentNavigation().extras.state;
|
||||
@@ -354,7 +357,60 @@ export class ActivetaskPage implements OnInit {
|
||||
],
|
||||
});
|
||||
await alert.present();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user