improve edition of draft

This commit is contained in:
Eudes Inácio
2023-07-10 12:38:41 +01:00
parent 9676bab7eb
commit c69ea92c91
11 changed files with 124 additions and 33 deletions
@@ -91,7 +91,8 @@ export class ViewDocumentPage implements OnInit {
cssClass: 'model aside-modal search-submodal',
componentProps: {
fulltask: this.task,
task: this.task
task: this.task,
content: ""
}
});
await modal.present();
@@ -127,6 +127,9 @@ export class DespachoPage implements OnInit {
"Sender": "",
"SourceDocId": "",
"content": resd.data.content,
"path": resd.data.path,
"ownerId": resd.data.ownerId,
"status": resd.data.status,
}
this.mergedArray.push(object)
console.log('List of draff', resd)
@@ -155,7 +158,7 @@ export class DespachoPage implements OnInit {
"DeadlineType": res.workflowInstanceDataFields.DeadlineType,
"activityInstanceName": res.activityInstanceName,
"Status": res.workflowInstanceDataFields.Status,
"Deadline": res.deadline
"Deadline": res.deadline,
}
// this.updateProcessOnDB(res);
@@ -165,7 +168,7 @@ export class DespachoPage implements OnInit {
const mergedArray1 = [];
const mergedArray2 = [];
// Merge array1 with tag
this.fulltask.Documents.forEach(element => {
@@ -179,11 +182,14 @@ export class DespachoPage implements OnInit {
"Sender": element.Sender,
"SourceDocId": element.SourceDocId,
"content": "",
"path": "",
"ownerId": "",
"status": "",
}
this.mergedArray.push(docObject);
});
console.log('All',this.mergedArray)
console.log('All', this.mergedArray)
let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
@@ -235,7 +241,7 @@ export class DespachoPage implements OnInit {
async viewDocument(docId: string, Document, content) {
if(Document.content == "") {
if (Document.content == "") {
const modal = await this.modalController.create({
component: ViewDocumentPage,
componentProps: {
@@ -266,7 +272,7 @@ export class DespachoPage implements OnInit {
await modal.present();
}
}
+1 -1
View File
@@ -119,7 +119,7 @@ export class LoginPage implements OnInit {
const loader = this.toastService.loading()
let attempt = await this.authService.login(this.userattempt, {saveSession: false})
await this.authService.loginContenteProduction(this.userattempt, {saveSession: false})
await this.authService.loginContenteProduction(this.userattempt, {saveSession: true})
loader.remove()
+1 -1
View File
@@ -115,7 +115,7 @@ export class AuthService {
try {
response = await this.http.post<LoginUserRespose>(environment.apiURL + "UserAuthentication/LoginJwt", '', this.opts).toPromise();
console.log('JWT',response)
if(saveSession) {
/* this.SetSession(response, user) */
@@ -146,6 +146,12 @@ export class HttpErrorHandle {
case 'Aprovar exp':
this.toastService._successMessage('Expediente enviado!');
break;
case 'Draft Save':
this.toastService._successMessage('Rascunho salvo!');
break;
case 'Draft Concluído':
this.toastService._successMessage('Documento Concluído!');
break;
default:
this.toastService._successMessage('Processo efetuado!')
+22 -2
View File
@@ -11,6 +11,7 @@ import { fullTaskList } from '../models/dailyworktask.model';
import { ChangeProfileService } from './change-profile.service';
import { SessionStore } from '../store/session.service';
import { StorageService } from './storage.service';
import { DocumentManagementStore } from '../store/documentManagement';
@Injectable({
providedIn: 'root'
})
@@ -20,12 +21,14 @@ export class ProcessesService {
loggeduser: LoginUserRespose;
headers: HttpHeaders;
headers2: HttpHeaders;
documentMangement = DocumentManagementStore;
constructor(
private http: HttpClient,
private changeProfileService: ChangeProfileService,
private storageSevice: StorageService
private storageSevice: StorageService,
) {
this.loggeduser = SessionStore.user;
@@ -42,12 +45,13 @@ export class ProcessesService {
setHeader() {
this.headers = new HttpHeaders();
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
this.headers2 = new HttpHeaders();
this.headers2 = this.headers2.set('Authorization',"bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIyNjIiLCJ1bmlxdWVfbmFtZSI6IkdpbHNvbiBNYW51ZWwiLCJlbWFpbCI6ImdpbHNvbi5tYW51ZWxAZ2FiaW5ldGVkaWdpdGFsLmxvY2FsIiwicm9sZSI6IlNlY3JldMOhcmlvIEdlcmFsIiwiZ3JvdXBzaWQiOiJHYWJpbmV0ZSBkZSBUZWNub2xvZ2lhcyBkZSBJbmZvcm1hw6fDo28iLCJvcmdhbmljZW50aXR5aWREIjoiMTA2IiwibmJmIjoxNjg4NTg0NTYzLCJleHAiOjE3MjAxMjA1NjMsImlhdCI6MTY4ODU4NDU2MywiaXNzIjoiOGIxMzBhN2YwLWM3YjctNDdzMjMtOWE4ZC1kNTlhMDE5YWY3NDkiLCJhdWQiOiJkMjh3dzE0NTMtM2M2OC00MWFkLThiNmMtYTUzNDUzODNlMGMyIn0.QDCrQsCH59GQMoudZTHyCMwwHYVwz1mZkLTzvzAwh64"
this.headers2 = this.headers2.set('Authorization',"Bearer "+ this.documentMangement.session?.AuthorizationJwt
);
}
@@ -132,6 +136,9 @@ export class ProcessesService {
}
GetDraftByID(id:string): Observable<any> {
console.log('Instancia estas instanciar?',this.documentMangement.session?.AuthorizationJwt)
const geturl = environment.apiPCURL + `Documents/${id}`;
let params = new HttpParams();
@@ -144,6 +151,19 @@ export class ProcessesService {
return this.http.get<any>(`${geturl}`, options);
}
SaveDraftByID(id:string, object): Observable<any> {
const geturl = environment.apiPCURL + `Documents/${id}`;
let params = new HttpParams();
/* params = params.set("serialNumber", serialnumber); */
let options = {
headers: this.headers2,
/* params: params */
};
return this.http.put<any>(`${geturl}`, object, options);
}
SetTaskToPending(serialNumber:string): Observable<any>{
const geturl = environment.apiURL + 'Tasks/SetTaskPending';
let params = new HttpParams();
@@ -1,5 +1,5 @@
<ion-content class="container width-100 ">
<div class="buttons">
<div *ngIf="content == ''" class="buttons">
<button (click)="openExpedientActionsModal('0')" class="btn-cancel" shape="round" >Efetuar Despacho</button>
<div class="solid"></div>
<button (click)="openExpedientActionsModal('1')" class="btn-cancel" shape="round" >Solicitar Parecer</button>
@@ -7,4 +7,9 @@
<button (click)="openBookMeetingModal()" class="btn-cancel" shape="round" >Marcar Reunião</button>
<button class="btn-cancel" shape="round" (click)="close()">Cancelar</button>
</div>
<div *ngIf="content != ''" class="buttons">
<button (click)="save(Document, content)" class="btn-cancel" shape="round" >Salvar</button>
<button (click)="saveDraft(Document, content)" class="btn-cancel" shape="round" >Salvar Rascunho</button>
<button class="btn-cancel" shape="round" (click)="close()">Cancelar</button>
</div>
</ion-content>
@@ -1,6 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { ModalController, NavParams } from '@ionic/angular';
import { error } from 'console';
import { PermissionService } from 'src/app/services/permission.service';
import { ProcessesService} from 'src/app/services/processes.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({
selector: 'app-event-details-documents-options',
@@ -9,12 +12,23 @@ import { PermissionService } from 'src/app/services/permission.service';
})
export class EventDetailsDocumentsOptionsPage implements OnInit {
Document: any
content: any = "";
constructor(
public p: PermissionService,
private modalController: ModalController,
) {}
private navParams: NavParams,
private processService: ProcessesService,
private erroHandler: HttpErrorHandle
) {
this.Document = this.navParams.get('Document')
this.content = this.navParams.get('content')
}
ngOnInit() {}
ngOnInit() {
console.log(this.content)
}
close() {
this.modalController.dismiss();
@@ -25,13 +39,51 @@ export class EventDetailsDocumentsOptionsPage implements OnInit {
}
async openBookMeetingModal() {
this.modalController.dismiss({component:'openBookMeetingModal', taskAction: ''});
this.modalController.dismiss({ component: 'openBookMeetingModal', taskAction: '' });
}
async openExpedientActionsModal( taskAction: any) {
this.modalController.dismiss({component:'openExpedientActionsModal', taskAction});
async openExpedientActionsModal(taskAction: any) {
this.modalController.dismiss({ component: 'openExpedientActionsModal', taskAction });
}
async distartExpedientModal(body:any) {}
async distartExpedientModal(body: any) { }
save(document,content) {
console.log(document)
let objectDraft = {
"status": true,
"description": document.Assunto,
"content": content,
"path": document.path,
"ownerId": document.ownerId
}
this.processService.SaveDraftByID(document.DocId, objectDraft).subscribe((res) => [
this.erroHandler.httpsSucessMessagge('Draft Save'),
this.modalController.dismiss()
],(error) => {
this.erroHandler.httpStatusHandle(error)
})
this.modalController.dismiss();
}
saveDraft(document, content) {
console.log(document)
let objectDraft = {
"status": false,
"description": document.Assunto,
"content": content,
"path": document.path,
"ownerId": document.ownerId
}
this.processService.SaveDraftByID(document.DocId, objectDraft).subscribe((res) => [
this.erroHandler.httpsSucessMessagge('Draft Save'),
this.modalController.dismiss()
],(error) => {
this.erroHandler.httpStatusHandle(error)
})
}
}
+2 -3
View File
@@ -33,7 +33,6 @@ apiKey="wr5dk69kive0qr9ig6y5spqvlj3a0tsiwnzdsexnz241k69p"
alignleft aligncenter alignright alignjustify | \
bullist numlist outdent indent | removeformat | print | help' }"
initialValue='{{content}}'
[(ngModel)]="editorContent"
[(ngModel)]="content"
(onSaveContent)="somefunction()"
></editor>
<button (click)="somefunction()">Save Content</button>
></editor>
+7 -5
View File
@@ -11,10 +11,11 @@ export class TinyMCEPage implements OnInit {
title = '<h1>Hello, World!</h1><p>This is my HTML document.</p>';
title = '<p><img style="display: block; margin-left: auto; margin-right: auto;" src="assets/TempImgs/TCROUND.png" alt="" width="102" height="104" />Just Testing with an image yoOH.</p>';
Document: any
content: any
content: string
editorContent: string;
value: string;
@@ -28,6 +29,7 @@ export class TinyMCEPage implements OnInit {
}
ngOnInit() {
this.value = ""
}
close() {
@@ -35,7 +37,7 @@ export class TinyMCEPage implements OnInit {
}
somefunction() {
console.log(this.title)
console.log(this.content)
}
async openOptions() {
@@ -43,8 +45,8 @@ export class TinyMCEPage implements OnInit {
component: EventDetailsDocumentsOptionsPage,
cssClass: 'model aside-modal search-submodal',
componentProps: {
/* fulltask: this.task,
task: this.task */
Document: this.Document,
content: this.content
}
});
await modal.present();