mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Event to aprove and Expediente already have offline mode
This commit is contained in:
@@ -11,8 +11,11 @@ export class SqliteService {
|
||||
readonly db_name: string = "gabinetedigital.db";
|
||||
readonly events: string = "Events";
|
||||
readonly expedientes: string = "Expedientes";
|
||||
readonly allprocess: string = "ALLPROCESS";
|
||||
EVENTS: Array<any>;
|
||||
EXPEDIENTES: Array<any>;
|
||||
ALLPROCESS: Array<any>;
|
||||
PROCESS: Array<any>;
|
||||
|
||||
constructor(private platform: Platform,
|
||||
private sqlite: SQLite) {
|
||||
@@ -75,6 +78,28 @@ export class SqliteService {
|
||||
console.log("Sucess Espedientes Table created: ", res)
|
||||
})
|
||||
.catch((error) => console.log(JSON.stringify(error)));
|
||||
|
||||
await sqLite.executeSql(`
|
||||
CREATE TABLE IF NOT EXISTS ${this.allprocess} (
|
||||
serialNumber varchar(255) PRIMARY KEY,
|
||||
workflowInstanceFolio varchar(255),
|
||||
Documents Text,
|
||||
actions Text,
|
||||
activityInstanceName varchar(255),
|
||||
formURL varchar(255),
|
||||
originator Text,
|
||||
taskStartDate varchar(255),
|
||||
totalDocuments INTERGER,
|
||||
workflowDisplayName varchar(255),
|
||||
workflowID INTERGER,
|
||||
workflowInstanceDataFields Text,
|
||||
workflowInstanceID INTERGER,
|
||||
workflowName varchar(255)
|
||||
)`, [])
|
||||
.then((res) => {
|
||||
console.log("Sucess AllProcess Table created: ", res)
|
||||
})
|
||||
.catch((error) => console.log(JSON.stringify(error)));
|
||||
})
|
||||
.catch((error) => console.log(JSON.stringify(error)));
|
||||
});
|
||||
@@ -107,6 +132,42 @@ export class SqliteService {
|
||||
console.log(JSON.stringify(e.err));
|
||||
});
|
||||
}
|
||||
|
||||
//addprocess
|
||||
public addProcess(data) {
|
||||
this.dbInstance.executeSql(`
|
||||
INSERT OR IGNORE 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));
|
||||
});
|
||||
}
|
||||
|
||||
//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));
|
||||
});
|
||||
}
|
||||
|
||||
//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")
|
||||
})
|
||||
}
|
||||
//getAllEvents
|
||||
getAllEvents() {
|
||||
var hashattachment = false;
|
||||
@@ -174,6 +235,64 @@ export class SqliteService {
|
||||
});
|
||||
}
|
||||
|
||||
getAllProcess() {
|
||||
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess}`, []).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;
|
||||
}
|
||||
}, (e) => {
|
||||
console.log(" Get all process error", JSON.stringify(e));
|
||||
});
|
||||
}
|
||||
|
||||
//getlistOfEventAprove
|
||||
getListOfEventAprove(process, type) {
|
||||
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++) {
|
||||
this.ALLPROCESS.push(res.rows.item(i));
|
||||
}
|
||||
return this.ALLPROCESS;
|
||||
}
|
||||
}, (e) => {
|
||||
console.log(" Get all process error", JSON.stringify(e));
|
||||
});
|
||||
}
|
||||
|
||||
//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;
|
||||
}
|
||||
}, (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) => {
|
||||
this.PROCESS = [];
|
||||
if (res.rows.length > 0) {
|
||||
for (var i = 0; i < res.rows.length; i++) {
|
||||
this.PROCESS.push(res.rows.item(i))
|
||||
}
|
||||
return this.PROCESS;
|
||||
}
|
||||
}, (e) => {
|
||||
console.log(" Get process by serial error", JSON.stringify(e));
|
||||
});
|
||||
}
|
||||
|
||||
//getEventBy id
|
||||
getEventById(id) {
|
||||
|
||||
@@ -234,7 +353,7 @@ export class SqliteService {
|
||||
IsMeeting: ismeeting,
|
||||
IsRecurring: isrecurring,
|
||||
IsAllDayEvent: isallday,
|
||||
Body: res.rows.item(i).Body,
|
||||
Body: res.rows.item(i).Body,
|
||||
AppointmentState: res.rows.item(i).AppointmentState,
|
||||
TimeZone: res.rows.item(i).TimeZone,
|
||||
Organizer: res.rows.item(i).Organizer,
|
||||
|
||||
Reference in New Issue
Block a user