mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
merge with Peter changes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import * as internal from "stream";
|
||||
|
||||
export class DailyWorkTask{
|
||||
export class DailyWorkTask {
|
||||
SerialNumber: string;
|
||||
Folio: string;
|
||||
Senders: string;
|
||||
|
||||
@@ -46,9 +46,7 @@
|
||||
<div class="item-top-detail">
|
||||
<div class="item-subject">
|
||||
<!-- ... {{ task.SerialNumber || task.serialNumber}} {{ task.WorkflowName || task.workflowName }} {{ task.activityInstanceName }} -->
|
||||
<ion-label *ngIf="task.Folio">{{ task.Folio }}</ion-label>
|
||||
<ion-label *ngIf="task.Subject">{{ task.Subject }}</ion-label>
|
||||
<ion-label *ngIf="task.workflowInstanceDataFields">{{ task.workflowInstanceDataFields.Subject }}</ion-label>
|
||||
<ion-label>{{ task.Folio || task.Subject || task.workflowInstanceDataFields.Subject}}</ion-label>
|
||||
</div>
|
||||
<div *ngIf="task.DocumentsQty != 0" class="item-icon">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-expediente-attachment.svg"></ion-icon>
|
||||
|
||||
@@ -18,6 +18,8 @@ import { Camera, CameraResultType, CameraSource, Photo } from '@capacitor/camera
|
||||
|
||||
import { Filesystem, Directory } from '@capacitor/filesystem';
|
||||
import { NgxImageCompressService } from "ngx-image-compress";
|
||||
import { readAndCompressImage } from 'browser-image-resizer';
|
||||
import { environment } from 'src/environments/environment';
|
||||
|
||||
const IMAGE_DIR = 'stored-images';
|
||||
|
||||
@@ -108,7 +110,7 @@ export class NewPublicationPage implements OnInit {
|
||||
}
|
||||
|
||||
async takePicture() {
|
||||
|
||||
alert('take')
|
||||
const capturedImage = await Camera.getPhoto({
|
||||
quality: 90,
|
||||
// allowEditing: true,
|
||||
@@ -119,11 +121,30 @@ export class NewPublicationPage implements OnInit {
|
||||
const response = await fetch(capturedImage.webPath!);
|
||||
const blob = await response.blob();
|
||||
|
||||
this.convertBlobToBase64Worker.postMessage(blob);
|
||||
this.convertBlobToBase64Worker.onmessage = async (oEvent)=> {
|
||||
this.capturedImage = oEvent.data
|
||||
const config = {
|
||||
quality: 0.5,
|
||||
maxWidth: 800,
|
||||
debug: true
|
||||
};
|
||||
|
||||
var file = new File([blob], "camera.jpg");
|
||||
|
||||
// Note: A single file comes from event.target.files on <input>
|
||||
readAndCompressImage(file, config)
|
||||
.then(resizedImage => {
|
||||
console.log('resizedImage', resizedImage);
|
||||
|
||||
this.convertBlobToBase64Worker.postMessage(resizedImage);
|
||||
this.convertBlobToBase64Worker.onmessage = async (oEvent)=> {
|
||||
this.capturedImage = oEvent.data
|
||||
|
||||
}
|
||||
})
|
||||
.then(result => {
|
||||
// TODO: Handle the result
|
||||
console.log('result', result);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
imageSize(image) {
|
||||
@@ -179,12 +200,35 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
const response = await fetch(capturedImage.webPath!);
|
||||
const blob = await response.blob();
|
||||
|
||||
|
||||
const config = {
|
||||
quality: 0.9,
|
||||
maxWidth: 800,
|
||||
debug: !environment.production
|
||||
};
|
||||
|
||||
var file = new File([blob], "camera.jpg");
|
||||
|
||||
// Note: A single file comes from event.target.files on <input>
|
||||
readAndCompressImage(file, config)
|
||||
.then(resizedImage => {
|
||||
console.log('resizedImage', resizedImage);
|
||||
|
||||
this.convertBlobToBase64Worker.postMessage(resizedImage);
|
||||
this.convertBlobToBase64Worker.onmessage = async (oEvent)=> {
|
||||
this.capturedImage = oEvent.data
|
||||
|
||||
}
|
||||
})
|
||||
.then(result => {
|
||||
// TODO: Handle the result
|
||||
// console.log('result', result);
|
||||
});
|
||||
|
||||
|
||||
|
||||
this.convertBlobToBase64Worker.postMessage(blob);
|
||||
this.convertBlobToBase64Worker.onmessage = async (oEvent)=> {
|
||||
this.capturedImage = oEvent.data
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -198,7 +242,7 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
this.Form = new FormGroup({
|
||||
Subject: new FormControl(this.pub.Title, [
|
||||
//Validators.required,
|
||||
Validators.required,
|
||||
// Validators.minLength(4)
|
||||
]),
|
||||
capturedImage: new FormControl(this.capturedImage, [
|
||||
@@ -269,11 +313,11 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
try {
|
||||
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
|
||||
this.toastService.successMessage("Publicação criado")
|
||||
this.toastService._successMessage("Publicação criado")
|
||||
|
||||
this.close();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest("Publicação não criado")
|
||||
this.toastService._badRequest("Publicação não criado")
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
@@ -297,11 +341,11 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
try {
|
||||
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
|
||||
this.toastService.successMessage("Publicação criado")
|
||||
this.toastService._successMessage("Publicação criado")
|
||||
|
||||
this.close();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest("Publicação não criado")
|
||||
this.toastService._badRequest("Publicação não criado")
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
@@ -333,12 +377,12 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
await this.publications.CreatePublication(this.folderId, this.publication).toPromise();
|
||||
this.close();
|
||||
this.toastService.successMessage("Publicação criado")
|
||||
this.toastService._successMessage("Publicação criado")
|
||||
|
||||
|
||||
this.close();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest("Publicação não criado")
|
||||
this.toastService._badRequest("Publicação não criado")
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
@@ -37,9 +37,7 @@
|
||||
|
||||
<!-- {{ task.SerialNumber || task.serialNumber}} {{ task.WorkflowName || task.workflowName || task.workflowDisplayName }} {{ task.activityInstanceName }} -->
|
||||
|
||||
<ion-label *ngIf="task.Folio">{{ task.Folio }}</ion-label>
|
||||
<ion-label *ngIf="task.Subject">{{ task.Subject }}</ion-label>
|
||||
<ion-label *ngIf="task.workflowInstanceDataFields">{{ task.workflowInstanceDataFields.Subject }}</ion-label>
|
||||
<ion-label>{{ task.Folio || task.Subject || task.workflowInstanceDataFields.Subject}}</ion-label>
|
||||
</div>
|
||||
<div *ngIf="task.DocumentsQty != 0" class="item-icon">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-expediente-attachment.svg"></ion-icon>
|
||||
|
||||
Reference in New Issue
Block a user