mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
offline angenda and actions
This commit is contained in:
@@ -138,7 +138,7 @@
|
||||
|
||||
<calendar
|
||||
class="calendar-component"
|
||||
[eventSource]="CalendarStore.eventSource"
|
||||
[eventSource]="listToPresent"
|
||||
[calendarMode]="calendar.mode"
|
||||
[currentDate]="calendar.currentDate"
|
||||
(onEventSelected)="onEventSelected($event)"
|
||||
|
||||
+295
-201
File diff suppressed because it is too large
Load Diff
@@ -108,14 +108,14 @@ export class EventsPage implements OnInit {
|
||||
|
||||
});
|
||||
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
/* if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
} else {
|
||||
try {
|
||||
this.sqliteservice.databaseConn();
|
||||
} catch (error) {
|
||||
console.log("Error creating local database: ", error)
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
}
|
||||
|
||||
@@ -324,52 +324,6 @@ export class EventsPage implements OnInit {
|
||||
|
||||
getEventsFromLocalDb() {
|
||||
|
||||
window.addEventListener('online',() => {
|
||||
this.showGreeting();
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationEnd && event.url == '/home/events') {
|
||||
this.RefreshEvents();
|
||||
setTimeout(() => {
|
||||
this.LoadList();
|
||||
}, 1500)
|
||||
}
|
||||
});
|
||||
this.hideSearch();
|
||||
})
|
||||
|
||||
window.addEventListener('offline', () => {
|
||||
this.sqliteservice.getAllEvents().then((event:any[]) => {
|
||||
this.listToPresent = event
|
||||
this.totalEvent = this.listToPresent.length
|
||||
this.currentEvent = this.listToPresent[0].Subject
|
||||
this.currentHoursMinutes = this.listToPresent[0].StartDate
|
||||
console.log("All events from local,", event)
|
||||
})
|
||||
|
||||
this.sqliteservice.getprocessByworkflow("Expediente").then((process: any[]) => {
|
||||
var expedientlist = [];
|
||||
process.forEach((element) => {
|
||||
let task = {
|
||||
CreateDate: element.taskStartDate,
|
||||
DocumentsQty: element.totalDocuments,
|
||||
Senders: JSON.parse(element.workflowInstanceDataFields).Sender,
|
||||
SerialNumber: element.serialNumber,
|
||||
Status: JSON.parse(element.workflowInstanceDataFields).Status,
|
||||
Subject: JSON.parse(element.workflowInstanceDataFields).Subject,
|
||||
WorkflowName: element.workflowDisplayName,
|
||||
activityInstanceName: element.activityInstanceName,
|
||||
taskStartDate: element.taskStartDate,
|
||||
}
|
||||
expedientlist.push(task);
|
||||
})
|
||||
const ExpedienteTask = expedientlist.map(e => this.expedienteTaskPipe.transform(e))
|
||||
this.listToPresentexpediente = ExpedienteTask;
|
||||
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
if (synchro.connected === true) {
|
||||
this.showGreeting();
|
||||
|
||||
@@ -382,7 +336,8 @@ export class EventsPage implements OnInit {
|
||||
}
|
||||
});
|
||||
this.hideSearch();
|
||||
} else {
|
||||
} else {
|
||||
this.platform.ready().then(async () => {
|
||||
this.sqliteservice.getAllEvents().then((event:any[]) => {
|
||||
this.listToPresent = event
|
||||
this.totalEvent = this.listToPresent.length
|
||||
@@ -412,6 +367,7 @@ export class EventsPage implements OnInit {
|
||||
|
||||
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<div class="aside overflow-y-auto d-flex flex-wrap width-100">
|
||||
<!-- <ion-list class="width-100"> -->
|
||||
<ion-item-sliding disabled="{{showSlidingOptions}}" class="width-100 cursor-pointer"
|
||||
*ngFor="let viagem of publicationTravelFolderService.list">
|
||||
*ngFor="let viagem of publicationsTravelFolderList">
|
||||
<ion-item lines="none"
|
||||
class="item width-100 d-flex ion-no-border ion-no-margin ion-no-padding"
|
||||
[class.item-active]="viagem.ProcessId == idSelected"
|
||||
@@ -73,7 +73,7 @@
|
||||
</ion-item-sliding>
|
||||
|
||||
<ion-item-sliding disabled="{{showSlidingOptions}}" class="width-100"
|
||||
*ngFor="let evento of publicationEventFolderStorage.list">
|
||||
*ngFor="let evento of publicationsEventFolderList">
|
||||
<ion-item lines="none"
|
||||
class="item cursor-pointer width-100 d-flex ion-no-border ion-no-margin ion-no-padding"
|
||||
[class.item-active]="evento.ProcessId == idSelected"
|
||||
|
||||
@@ -13,6 +13,8 @@ import { EditActionPage } from './edit-action/edit-action.page';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { PublicationEventFolderStorage } from 'src/app/store/publication-event-folder.service';
|
||||
import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-folder.service';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-publications',
|
||||
@@ -28,11 +30,11 @@ export class PublicationsPage implements OnInit {
|
||||
actionsListStorage: PublicationFolder[] = new Array();
|
||||
publicationsTravelFolderList: PublicationFolder[];
|
||||
|
||||
theDate:any;
|
||||
theEndDate:any;
|
||||
customDate:any;
|
||||
theDate: any;
|
||||
theEndDate: any;
|
||||
customDate: any;
|
||||
months: string[];
|
||||
days:string[];
|
||||
days: string[];
|
||||
|
||||
publicationEventFolderStorage = PublicationEventFolderStorage
|
||||
publicationTravelFolderService = PublicationTravelFolderStore
|
||||
@@ -61,41 +63,33 @@ export class PublicationsPage implements OnInit {
|
||||
private modalController: ModalController,
|
||||
private animationController: AnimationController,
|
||||
private publications: PublicationsService,
|
||||
private toastService: ToastService
|
||||
) {
|
||||
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
|
||||
this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
const pathname = window.location.pathname
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if(event instanceof NavigationEnd && event.url == pathname) {
|
||||
this.getActions();
|
||||
}
|
||||
});
|
||||
|
||||
this.hideRefreshButton();
|
||||
private toastService: ToastService,
|
||||
private sqliteservice: SqliteService
|
||||
) {
|
||||
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
|
||||
this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
|
||||
}
|
||||
|
||||
hideRefreshButton(){
|
||||
ngOnInit() {
|
||||
this.getFromDB();
|
||||
}
|
||||
|
||||
hideRefreshButton() {
|
||||
window.onresize = (event) => {
|
||||
if( window.innerWidth < 801) {
|
||||
if (window.innerWidth < 801) {
|
||||
this.hideRefreshBtn = false;
|
||||
this.showSlidingOptions = false;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.hideRefreshBtn = true;
|
||||
this.showSlidingOptions = true;
|
||||
}
|
||||
}
|
||||
if(window.innerWidth < 801){
|
||||
if (window.innerWidth < 801) {
|
||||
this.hideRefreshBtn = false;
|
||||
this.showSlidingOptions = false;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.hideRefreshBtn = true;
|
||||
this.showSlidingOptions = true;
|
||||
}
|
||||
@@ -120,12 +114,15 @@ export class PublicationsPage implements OnInit {
|
||||
|
||||
getDate(date) {
|
||||
this.theDate = new Date(date);
|
||||
return this.theDate.getDate() +" de " + ( this.months[this.theDate.getMonth()])+" de " +this.theDate.getFullYear()
|
||||
return this.theDate.getDate() + " de " + (this.months[this.theDate.getMonth()]) + " de " + this.theDate.getFullYear()
|
||||
}
|
||||
|
||||
getActions() {
|
||||
this.showLoader = true;
|
||||
this.publications.GetPublicationFolderList().subscribe(res=>{
|
||||
this.publications.GetPublicationFolderList().subscribe(res => {
|
||||
|
||||
console.log('accoes', res)
|
||||
this.sqliteservice.addactions(res);
|
||||
|
||||
this.publicationsEventFolderList = new Array();
|
||||
this.publicationsTravelFolderList = new Array();
|
||||
@@ -140,46 +137,87 @@ export class PublicationsPage implements OnInit {
|
||||
ActionType: data.ActionType,
|
||||
}
|
||||
|
||||
if(data.ActionType == "Evento") {
|
||||
if (data.ActionType == "Evento") {
|
||||
this.publicationsEventFolderList.push(folder);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.publicationsTravelFolderList.push(folder);
|
||||
}
|
||||
this.showLoader = false;
|
||||
|
||||
this.publicationEventFolderStorage.reset(this.publicationsEventFolderList)
|
||||
this.publicationTravelFolderService.reset(this.publicationsTravelFolderList)
|
||||
/* this.publicationEventFolderStorage.reset(this.publicationsEventFolderList)
|
||||
this.publicationTravelFolderService.reset(this.publicationsTravelFolderList) */
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
async editAction(folderId?: string){
|
||||
getFromDB() {
|
||||
|
||||
if (synchro.connected === true) {
|
||||
const pathname = window.location.pathname
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationEnd && event.url == pathname) {
|
||||
this.getActions();
|
||||
}
|
||||
});
|
||||
|
||||
this.hideRefreshButton();
|
||||
} else {
|
||||
this.sqliteservice.getAllActions().then((actions: any[]) => {
|
||||
|
||||
this.publicationsEventFolderList = new Array();
|
||||
this.publicationsTravelFolderList = new Array();
|
||||
|
||||
actions.forEach(data => {
|
||||
let folder: PublicationFolder = {
|
||||
ProcessId: data.ProcessId,
|
||||
Description: data.Description,
|
||||
Detail: data.Detail,
|
||||
DateBegin: data.DateBegin,
|
||||
DateEnd: data.DateEnd,
|
||||
ActionType: data.ActionType,
|
||||
}
|
||||
|
||||
if (data.ActionType == "Evento") {
|
||||
this.publicationsEventFolderList.push(folder);
|
||||
}
|
||||
else {
|
||||
this.publicationsTravelFolderList.push(folder);
|
||||
}
|
||||
this.showLoader = false;
|
||||
});
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async editAction(folderId?: string) {
|
||||
const modal = await this.modalController.create({
|
||||
component: EditActionPage,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
folderId: folderId,
|
||||
},
|
||||
cssClass: 'new-action modal modal-desktop',
|
||||
backdropDismiss: true
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(()=>{
|
||||
modal.onDidDismiss().then(() => {
|
||||
this.getActions();
|
||||
});
|
||||
//this.refreshing()
|
||||
}
|
||||
|
||||
async deleteAction(id?: string){
|
||||
async deleteAction(id?: string) {
|
||||
|
||||
const loader = this.toastService.loading();
|
||||
|
||||
try {
|
||||
await this.publications.DeletePresidentialAction(id).toPromise();
|
||||
this.toastService.successMessage()
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
finally {
|
||||
@@ -189,21 +227,21 @@ export class PublicationsPage implements OnInit {
|
||||
this.refreshing()
|
||||
}
|
||||
|
||||
async AddPublicationFolder(item?:any) {
|
||||
async AddPublicationFolder(item?: any) {
|
||||
|
||||
this.closeDesktopComponent();
|
||||
if(window.innerWidth <= 1024) {
|
||||
if (window.innerWidth <= 1024) {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: NewActionPage,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
item: item,
|
||||
},
|
||||
cssClass: 'new-action modal modal-desktop',
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(()=>{
|
||||
modal.onDidDismiss().then(() => {
|
||||
this.getActions();
|
||||
});
|
||||
} else {
|
||||
@@ -212,12 +250,12 @@ export class PublicationsPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
goToPublicationsList(folderId: string){
|
||||
goToPublicationsList(folderId: string) {
|
||||
this.folderId = folderId
|
||||
this.idSelected = folderId;
|
||||
|
||||
if( window.innerWidth <= 800){
|
||||
this.router.navigate(['/home/publications',folderId]);
|
||||
if (window.innerWidth <= 800) {
|
||||
this.router.navigate(['/home/publications', folderId]);
|
||||
} else {
|
||||
this.closeDesktopComponent();
|
||||
this.folderId = folderId
|
||||
@@ -256,14 +294,14 @@ export class PublicationsPage implements OnInit {
|
||||
this.closeDesktopComponent();
|
||||
|
||||
// OpenModal
|
||||
if( window.innerWidth <= 800){
|
||||
if (window.innerWidth <= 800) {
|
||||
/* let item = this.publicationFolderList; */
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewPublicationsPage,
|
||||
//enterAnimation,
|
||||
//leaveAnimation,
|
||||
componentProps:{
|
||||
folderId:folderId,
|
||||
componentProps: {
|
||||
folderId: folderId,
|
||||
},
|
||||
cssClass: 'new-action modal modal-desktop',
|
||||
backdropDismiss: false
|
||||
@@ -281,7 +319,7 @@ export class PublicationsPage implements OnInit {
|
||||
|
||||
// called from publications details
|
||||
// Emittter
|
||||
goBackToViewPublications(){
|
||||
goBackToViewPublications() {
|
||||
|
||||
this.closeDesktopComponent();
|
||||
this.desktopComponent.showViewPublication = true;
|
||||
@@ -289,21 +327,21 @@ export class PublicationsPage implements OnInit {
|
||||
|
||||
// called from publications details
|
||||
// Emitters
|
||||
goBackToPubications(){
|
||||
goBackToPubications() {
|
||||
this.closeDesktopComponent();
|
||||
this.desktopComponent.showViewPublication = true;
|
||||
}
|
||||
|
||||
// called from edit publication (Emitters only)
|
||||
// Emitters
|
||||
async goBacktoPublicationDetails(){
|
||||
async goBacktoPublicationDetails() {
|
||||
this.closeDesktopComponent();
|
||||
this.desktopComponent.showPublicationDetail = true;
|
||||
|
||||
}
|
||||
|
||||
// add new publication or edit publicaton
|
||||
async addNewPublication({publicationType, folderId, publication}){
|
||||
async addNewPublication({ publicationType, folderId, publication }) {
|
||||
|
||||
this.closeDesktopComponent();
|
||||
|
||||
@@ -319,7 +357,7 @@ export class PublicationsPage implements OnInit {
|
||||
this.desktopComponent.showAddNewPublication = true;
|
||||
}
|
||||
|
||||
async openPublicationDetails(publicationId: string){
|
||||
async openPublicationDetails(publicationId: string) {
|
||||
|
||||
this.publicationId = publicationId;
|
||||
|
||||
@@ -328,11 +366,11 @@ export class PublicationsPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
async updateDesktopComponent(e?:any){
|
||||
async updateDesktopComponent(e?: any) {
|
||||
this.getActions();
|
||||
}
|
||||
|
||||
async closeDesktopComponent (xx?: any){
|
||||
async closeDesktopComponent(xx?: any) {
|
||||
|
||||
this.desktopComponent = {
|
||||
showViewPublication: false,
|
||||
@@ -380,10 +418,10 @@ export class PublicationsPage implements OnInit {
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(res => {
|
||||
if(res['data']=='edit') {
|
||||
if (res['data'] == 'edit') {
|
||||
this.closeDesktopComponent();
|
||||
this.desktopComponent.showEditActions = true;
|
||||
} else if (res['data']=='delete') {
|
||||
} else if (res['data'] == 'delete') {
|
||||
setTimeout(() => {
|
||||
this.getActions();
|
||||
}, 1000)
|
||||
|
||||
@@ -10,6 +10,8 @@ import { PublicationListStorage } from 'src/app/store/publication-list.service';
|
||||
import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-folder.service';
|
||||
import { NewPublicationPage } from '../new-publication/new-publication.page';
|
||||
import { PublicationDetailPage } from './publication-detail/publication-detail.page';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-view-publications',
|
||||
@@ -36,7 +38,8 @@ export class ViewPublicationsPage implements OnInit {
|
||||
private modalController: ModalController,
|
||||
private publications: PublicationsService,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private router: Router) {
|
||||
private router: Router,
|
||||
private sqliteservice: SqliteService) {
|
||||
|
||||
this.item = new PublicationFolder();
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
@@ -97,6 +100,7 @@ export class ViewPublicationsPage implements OnInit {
|
||||
setTimeout(() => {
|
||||
let allActions = this.publicationEventFolderStorage.list.concat(this.publicationTravelFolderService.list)
|
||||
this.item = allActions.find((e)=> e.ProcessId == this.folderId);
|
||||
console.log('item', this.item)
|
||||
}, 100);
|
||||
|
||||
}
|
||||
@@ -105,7 +109,9 @@ export class ViewPublicationsPage implements OnInit {
|
||||
this.showLoader = true;
|
||||
const folderId = this.folderId
|
||||
this.publications.GetPublications(this.folderId).subscribe(res=>{
|
||||
|
||||
console.log(this.folderId)
|
||||
console.log('getPublications',res)
|
||||
this.sqliteservice.updateactions(this.folderId, res);
|
||||
|
||||
this.publicationList = new Array();
|
||||
|
||||
@@ -131,6 +137,14 @@ export class ViewPublicationsPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
getFromDB() {
|
||||
if(synchro.connected === true) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
async AddPublication(publicationType:any, folderId:any) {
|
||||
const modal = await this.modalController.create({
|
||||
component: NewPublicationPage,
|
||||
|
||||
@@ -12,10 +12,13 @@ export class SqliteService {
|
||||
readonly events: string = "Events";
|
||||
readonly expedientes: string = "Expedientes";
|
||||
readonly allprocess: string = "ALLPROCESS";
|
||||
readonly actions: string = "ACTIONS";
|
||||
readonly publications: string = "PUBLICATIONS";
|
||||
EVENTS: Array<any>;
|
||||
EXPEDIENTES: Array<any>;
|
||||
ALLPROCESS: Array<any>;
|
||||
PROCESS: Array<any>;
|
||||
ALLACTIONS: Array<any>;
|
||||
|
||||
constructor(private platform: Platform,
|
||||
private sqlite: SQLite) {
|
||||
@@ -51,7 +54,8 @@ export class SqliteService {
|
||||
EventRecurrence Text,
|
||||
Attachments Text,
|
||||
Body Text,
|
||||
Profile varchar(255)
|
||||
Profile varchar(255),
|
||||
HumanDate varchar(255)
|
||||
)`, [])
|
||||
.then((res) => {
|
||||
console.log("Sucess Events Table created: ", res)
|
||||
@@ -102,22 +106,59 @@ export class SqliteService {
|
||||
console.log("Sucess AllProcess Table created: ", res)
|
||||
})
|
||||
.catch((error) => console.log(JSON.stringify(error)));
|
||||
|
||||
await sqLite.executeSql(`
|
||||
CREATE TABLE IF NOT EXISTS ${this.actions} (
|
||||
ProcessId INTERGER PRIMARY KEY,
|
||||
ActionType varchar(255),
|
||||
DateBegin varchar(255),
|
||||
DateEnd varchar(255),
|
||||
Detail varchar(255),
|
||||
Description varchar(255),
|
||||
DateIndex varchar(255),
|
||||
DatePublication varchar(255),
|
||||
DocumentId INTERGER,
|
||||
FileBase64 Text,
|
||||
FileExtension varchar(255),
|
||||
Message varchar(255),
|
||||
OrganicEntityId INTERGER,
|
||||
OriginalFileName varchar(255),
|
||||
Title varchar(255)
|
||||
)`, [])
|
||||
.then((res) => {
|
||||
console.log("Sucess action Table created: ", res)
|
||||
})
|
||||
.catch((error) => console.log(JSON.stringify(error)));
|
||||
})
|
||||
.catch((error) => console.log(JSON.stringify(error)));
|
||||
});
|
||||
}
|
||||
|
||||
//addactions
|
||||
public addactions(data) {
|
||||
this.dbInstance.executeSql(`
|
||||
INSERT OR IGNORE INTO ${this.actions} (ActionType,DateBegin,DateEnd,Description,Detail,ProcessId,DateIndex,DatePublication,DocumentId,FileBase64,FileExtension,Message,OrganicEntityId,OriginalFileName,Title)
|
||||
VALUES ('${data.ActionType}','${data.DateBegin}', '${data.DateEnd}','${data.Description}','${data.Detail}','${data.ProcessId}','${data.DateIndex}','${data.DatePublication},'${data.DocumentId}',
|
||||
'${data.FileBase64}','${data.FileExtension}','${data.Message}','${data.OrganicEntityId}','${data.OriginalFileName}','${data.Title}')`, [])
|
||||
.then(() => {
|
||||
console.log("action add with Success");
|
||||
|
||||
}, (e) => {
|
||||
console.log(JSON.stringify(e.err));
|
||||
});
|
||||
}
|
||||
|
||||
//addEvent
|
||||
public addEvent(data) {
|
||||
this.dbInstance.executeSql(`
|
||||
INSERT OR IGNORE INTO ${this.events} (EventId,Subject,HasAttachments,Location,CalendarId,CalendarName,StartDate,EndDate,EventType,Attendees,IsMeeting,IsRecurring,IsAllDayEvent,AppointmentState,TimeZone,Organizer,Category,EventRecurrence,Attachments,Body,Profile )
|
||||
VALUES ('${data.EventId}','${data.Subject}', '${data.HasAttachments}','${data.Location}','${data.CalendarId}','${data.CalendarName}','${data.StartDate}','${data.EndDate}','${data.EventType}','${data.Attendees}','${data.IsMeeting}','${data.IsRecurring}',
|
||||
'${data.IsAllDayEvent}','${data.AppointmentState}','${data.TimeZone}','${data.Organizer}','${data.Category}','${data.EventRecurrence}','${data.Attachments}','${data.Body}','${data.Profile}')`, [])
|
||||
INSERT OR IGNORE INTO ${this.events} (EventId,Subject,HasAttachments,Location,CalendarId,CalendarName,StartDate,EndDate,EventType,Attendees,IsMeeting,IsRecurring,IsAllDayEvent,AppointmentState,TimeZone,Organizer,Category,EventRecurrence,Attachments,Body,Profile,HumanDate )
|
||||
VALUES ('${data.EventId}','${data.Subject}','${data.HasAttachments}','${data.Location}','${data.CalendarId}','${data.CalendarName}','${data.StartDate}','${data.EndDate}','${data.EventType}','${data.Attendees}','${data.IsMeeting}','${data.IsRecurring}',
|
||||
'${data.IsAllDayEvent}','${data.AppointmentState}','${data.TimeZone}','${data.Organizer}','${data.Category}','${data.EventRecurrence}','${data.Attachments}','${data.Body}','${data.Profile}','${data.HumanDate}')`, [])
|
||||
.then(() => {
|
||||
console.log("event add with Success");
|
||||
|
||||
}, (e) => {
|
||||
console.log(JSON.stringify(e.err));
|
||||
console.log(JSON.stringify(e));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -149,34 +190,47 @@ export class SqliteService {
|
||||
});
|
||||
}
|
||||
|
||||
//updateprocess
|
||||
public updateProcess(data) {
|
||||
this.dbInstance.executeSql(`
|
||||
//updateActions
|
||||
public updateactions(id,data) {
|
||||
this.dbInstance.executeSql(`
|
||||
UPDATE ${this.actions} SET DateIndex = ?, DatePublication = ?,DocumentId = ?,FileBase64 = ?,FileExtension = ?,Message = ?,OrganicEntityId = ?,OriginalFileName = ?,Title = ? WHERE ProcessId = ${id}`,data)
|
||||
.then(() => {
|
||||
console.log("action update with Success");
|
||||
|
||||
}, (e) => {
|
||||
console.log(JSON.stringify(e.err));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//updateprocess
|
||||
public updateProcess(data) {
|
||||
this.dbInstance.executeSql(`
|
||||
INSERT OR REPLACE INTO ${this.allprocess} (serialNumber,workflowInstanceFolio,Documents,actions,activityInstanceName,formURL,originator,taskStartDate,totalDocuments,workflowDisplayName,workflowID,workflowInstanceDataFields,workflowInstanceID,workflowName)
|
||||
VALUES ('${data.serialNumber}','${data.workflowInstanceFolio}', '${JSON.stringify(data.Documents)}','${JSON.stringify(data.actions)}','${data.activityInstanceName}','${data.formURL}','${JSON.stringify(data.originator)}','${data.taskStartDate}','${data.totalDocuments}','${data.workflowDisplayName}','${data.workflowID}',
|
||||
'${JSON.stringify(data.workflowInstanceDataFields)}','${data.workflowInstanceID}','${data.workflowName}')`, [])
|
||||
.then(() => {
|
||||
console.log("process add with Success");
|
||||
|
||||
}, (e) => {
|
||||
console.log(JSON.stringify(e.err));
|
||||
});
|
||||
}
|
||||
.then(() => {
|
||||
console.log("process add with Success");
|
||||
|
||||
//updateAttachment
|
||||
updateUser(id, document,) {
|
||||
let data = [document];
|
||||
return this.dbInstance.executeSql(`UPDATE ${this.allprocess} SET Documents = ? WHERE serialNumber = ${id}`, [document]).then(() => {
|
||||
console.log("process attachment updated")
|
||||
})
|
||||
}
|
||||
//updateAttachment
|
||||
updateProcessInterveners(id, interveners,) {
|
||||
let data = [document];
|
||||
return this.dbInstance.executeSql(`UPDATE ${this.allprocess} SET interveners = ? WHERE serialNumber = ${id}`, [interveners]).then(() => {
|
||||
console.log("process interveners updated")
|
||||
})
|
||||
}
|
||||
}, (e) => {
|
||||
console.log(JSON.stringify(e.err));
|
||||
});
|
||||
}
|
||||
|
||||
//updateAttachment
|
||||
updateUser(id, document,) {
|
||||
let data = [document];
|
||||
return this.dbInstance.executeSql(`UPDATE ${this.allprocess} SET Documents = ? WHERE serialNumber = ${id}`, [document]).then(() => {
|
||||
console.log("process attachment updated")
|
||||
})
|
||||
}
|
||||
//updateAttachment
|
||||
updateProcessInterveners(id, interveners,) {
|
||||
let data = [document];
|
||||
return this.dbInstance.executeSql(`UPDATE ${this.allprocess} SET interveners = ? WHERE serialNumber = ${id}`, [interveners]).then(() => {
|
||||
console.log("process interveners updated")
|
||||
})
|
||||
}
|
||||
//getAllEvents
|
||||
getAllEvents() {
|
||||
var hashattachment = false;
|
||||
@@ -218,7 +272,10 @@ export class SqliteService {
|
||||
Organizer: res.rows.item(i).Organizer,
|
||||
Category: res.rows.item(i).Category,
|
||||
EventRecurrence: res.rows.item(i).EventRecurrence,
|
||||
Attachments: res.rows.item(i).Attachments
|
||||
Attachments: res.rows.item(i).Attachments,
|
||||
Profile: res.rows.item(i).Profile,
|
||||
HumanDate: res.rows.item(i).HumanDate
|
||||
|
||||
}
|
||||
this.EVENTS.push(event);
|
||||
}
|
||||
@@ -258,9 +315,23 @@ export class SqliteService {
|
||||
});
|
||||
}
|
||||
|
||||
//getAllAtions
|
||||
getAllActions() {
|
||||
return this.dbInstance.executeSql(`SELECT * FROM ${this.actions}`, []).then((res) => {
|
||||
this.ALLACTIONS = [];
|
||||
if (res.rows.length > 0) {
|
||||
for (var i = 0; i < res.rows.length; i++) {
|
||||
this.ALLACTIONS.push(res.rows.item(i));
|
||||
}
|
||||
return this.ALLACTIONS;
|
||||
}
|
||||
}, (e) => {
|
||||
console.log(" Get all actions error", JSON.stringify(e));
|
||||
});
|
||||
}
|
||||
//getlistOfEventAprove
|
||||
getListOfEventAprove(process, type) {
|
||||
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE workflowDisplayName = ? OR workflowDisplayName = ? `, [process,type]).then((res) => {
|
||||
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE workflowDisplayName = ? OR workflowDisplayName = ? `, [process, type]).then((res) => {
|
||||
this.ALLPROCESS = [];
|
||||
if (res.rows.length > 0) {
|
||||
for (var i = 0; i < res.rows.length; i++) {
|
||||
@@ -288,35 +359,35 @@ export class SqliteService {
|
||||
});
|
||||
}
|
||||
|
||||
//getprocessByworkflow
|
||||
getprocessByworkflow(process) {
|
||||
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE workflowDisplayName = ? `, [process]).then((res) => {
|
||||
this.ALLPROCESS = [];
|
||||
if (res.rows.length > 0) {
|
||||
for (var i = 0; i < res.rows.length; i++) {
|
||||
this.ALLPROCESS.push(res.rows.item(i));
|
||||
}
|
||||
return this.ALLPROCESS;
|
||||
//getprocessByworkflow
|
||||
getprocessByworkflow(process) {
|
||||
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE workflowDisplayName = ? `, [process]).then((res) => {
|
||||
this.ALLPROCESS = [];
|
||||
if (res.rows.length > 0) {
|
||||
for (var i = 0; i < res.rows.length; i++) {
|
||||
this.ALLPROCESS.push(res.rows.item(i));
|
||||
}
|
||||
}, (e) => {
|
||||
console.log(" Get all process error", JSON.stringify(e));
|
||||
});
|
||||
}
|
||||
return this.ALLPROCESS;
|
||||
}
|
||||
}, (e) => {
|
||||
console.log(" Get all process error", JSON.stringify(e));
|
||||
});
|
||||
}
|
||||
|
||||
//getprocessByworkflowpedido
|
||||
getprocessByworkflowpedido(process, process2) {
|
||||
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE workflowDisplayName = ? OR workflowDisplayName = ? `, [process, process2]).then((res) => {
|
||||
this.ALLPROCESS = [];
|
||||
if (res.rows.length > 0) {
|
||||
for (var i = 0; i < res.rows.length; i++) {
|
||||
this.ALLPROCESS.push(res.rows.item(i));
|
||||
}
|
||||
return this.ALLPROCESS;
|
||||
//getprocessByworkflowpedido
|
||||
getprocessByworkflowpedido(process, process2) {
|
||||
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE workflowDisplayName = ? OR workflowDisplayName = ? `, [process, process2]).then((res) => {
|
||||
this.ALLPROCESS = [];
|
||||
if (res.rows.length > 0) {
|
||||
for (var i = 0; i < res.rows.length; i++) {
|
||||
this.ALLPROCESS.push(res.rows.item(i));
|
||||
}
|
||||
}, (e) => {
|
||||
console.log(" Get all process error", JSON.stringify(e));
|
||||
});
|
||||
}
|
||||
return this.ALLPROCESS;
|
||||
}
|
||||
}, (e) => {
|
||||
console.log(" Get all process error", JSON.stringify(e));
|
||||
});
|
||||
}
|
||||
|
||||
getProcessById(serial) {
|
||||
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE serialNumber = ? `, [serial]).then((res) => {
|
||||
|
||||
Reference in New Issue
Block a user