my files
This commit is contained in:
+1
-1
@@ -112,5 +112,5 @@ https://www.youtube.com/watch?v=fU8uM5oU1wY&t=1640s
|
||||
android:name="android.hardware.location.network"
|
||||
android:required="false" />
|
||||
|
||||
|
||||
https://www.npmjs.com/package/flutterwave-angular-v3
|
||||
npm install flutterwave-angular-v3
|
||||
|
||||
@@ -38,9 +38,15 @@
|
||||
<ion-card style="margin: 0px;">
|
||||
<ion-card-content style="padding: 1px;">
|
||||
<div style="margin-bottom: 5px;">
|
||||
<ion-input style="background-color: aliceblue;" label="Input with placeholder" placeholder="Item Name"></ion-input>
|
||||
<ion-input style="background-color: aliceblue;"
|
||||
maxlength="20" [(ngModel)]='title'
|
||||
label="Input with placeholder"
|
||||
(ionChange)="inVerify()"
|
||||
placeholder="Item Name"></ion-input>
|
||||
</div>
|
||||
<ion-textarea
|
||||
(ionChange)="inVerify()"
|
||||
maxlength="35" [(ngModel)]='description'
|
||||
style="background-color: aliceblue; margin: 0px; min-height: 80px"
|
||||
label="File description ..."
|
||||
placeholder="Enter detail description"
|
||||
@@ -53,10 +59,10 @@
|
||||
</ion-col>
|
||||
|
||||
<ion-col style="text-align: right;">
|
||||
<ion-button fill="outline" color="secondary" (click)="startCamera(100)">
|
||||
<ion-button fill="outline" [disabled]="isDisabled" color="secondary" (click)="startCamera(100)">
|
||||
<ion-icon slot="icon-only" name="camera-reverse-outline"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button fill="outline" style="margin-left: 10px;" (click)="startCamera(0)">
|
||||
<ion-button fill="outline" [disabled]="isDisabled" style="margin-left: 10px;" (click)="startCamera(0)">
|
||||
<ion-icon slot="icon-only" name="folder-outline"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-col>
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import {NavController} from "@ionic/angular";
|
||||
import {Component, OnInit, ViewChild} from '@angular/core';
|
||||
import {LoadingController, NavController} from "@ionic/angular";
|
||||
import {Router} from "@angular/router";
|
||||
import { WrenchService } from 'src/app/services/wrench.service';
|
||||
import {SessionDataProviderService} from "../../store/session-data-provider.service";
|
||||
import {Camera, CameraResultType, CameraSource} from "@capacitor/camera";
|
||||
//import {visit} from "@angular/compiler-cli/src/ngtsc/util/src/visitor";
|
||||
|
||||
@Component({
|
||||
selector: 'app-myfiles',
|
||||
@@ -10,16 +12,20 @@ import {SessionDataProviderService} from "../../store/session-data-provider.serv
|
||||
styleUrls: ['./myfiles.page.scss'],
|
||||
})
|
||||
export class MyfilesPage implements OnInit {
|
||||
|
||||
@ViewChild('title') title;
|
||||
@ViewChild('description') description;
|
||||
|
||||
tabs = 'myfiles';
|
||||
session_image_server:string='';
|
||||
curr_session:string="";
|
||||
isDisabled:boolean = true;
|
||||
|
||||
constructor(
|
||||
private navctr: NavController,
|
||||
private router: Router,
|
||||
public sessionDataProviderService: SessionDataProviderService,
|
||||
private wrenchService: WrenchService
|
||||
private wrenchService: WrenchService,
|
||||
private loadingCtrl: LoadingController
|
||||
) {
|
||||
|
||||
|
||||
@@ -69,4 +75,73 @@ export class MyfilesPage implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
inVerify(){
|
||||
this.isDisabled = true;
|
||||
if ( this.title !='' && this.description !=''){
|
||||
this.isDisabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
uploadData: {
|
||||
action:number,
|
||||
member_id: number,
|
||||
uid: string,
|
||||
sessionid: string,
|
||||
msg_type:'FILE',
|
||||
file_name: string,
|
||||
file_size: number,
|
||||
file_type: string,
|
||||
file_data: string,
|
||||
title:string,
|
||||
description: string
|
||||
};
|
||||
|
||||
uploadResult:any;
|
||||
async startCamera(cameraMode){
|
||||
const image = await Camera.getPhoto({
|
||||
quality: 50,
|
||||
width : 600,
|
||||
height : 300,
|
||||
allowEditing: false,
|
||||
resultType: CameraResultType.Base64,
|
||||
source: (cameraMode == 100 ) ? CameraSource.Camera : CameraSource.Photos // Camera, Photos or Prompt!
|
||||
});
|
||||
|
||||
if (image) {
|
||||
const loading = await this.loadingCtrl.create({
|
||||
message: 'Uploading Banner',
|
||||
duration: 5000,
|
||||
});
|
||||
var file_size = parseInt(String(image.base64String.toString().length / 1.3224954) ) ;
|
||||
// this.saveImage(image)
|
||||
//debugger;
|
||||
//image.base64String
|
||||
this.uploadData={
|
||||
action:11307,
|
||||
member_id: this.sessionDataProviderService.member_id,
|
||||
uid: this.sessionDataProviderService.member_uid,
|
||||
sessionid: this.sessionDataProviderService.session ,
|
||||
msg_type:'FILE',
|
||||
file_name: `myfile.${image.format}`,
|
||||
file_size: file_size ,
|
||||
file_type: `image/${image.format}`,
|
||||
file_data: image.base64String,
|
||||
title: this.title,
|
||||
description: this.description
|
||||
};
|
||||
//console.log(image);
|
||||
loading.present();
|
||||
this.wrenchService.uploadFile(this.uploadData).subscribe(
|
||||
uploadResult => {
|
||||
this.uploadResult = uploadResult;
|
||||
console.log("this.wrenchService.uploadFile RETURN DATA->", this.uploadResult);
|
||||
this.title='';
|
||||
this.description ='';
|
||||
this.getMyFiles();
|
||||
}
|
||||
);
|
||||
|
||||
console.log( this.uploadData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ if ( this.job_duration== undefined || this.job_duration < 1){
|
||||
email: '',
|
||||
assign_mode: 110022
|
||||
};
|
||||
console.log('XXX-> ', this.reqData );
|
||||
// console.log('XXX-> ', this.reqData );
|
||||
// debugger;
|
||||
|
||||
const loading = await this.loadingCtrl.create({
|
||||
|
||||
Reference in New Issue
Block a user