Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
DoliSCAN
client-cordova
Commits
de80e43a
Commit
de80e43a
authored
Feb 16, 2020
by
Eric Seigne
Browse files
creation tables ok et synchronisation offline ok
parent
b34b6473
Changes
4
Hide whitespace changes
Inline
Side-by-side
www/index.html
View file @
de80e43a
...
...
@@ -455,6 +455,16 @@
ons
.
ready
(
function
()
{
document
.
addEventListener
(
'
deviceready
'
,
function
()
{
myDebug
(
"
deviceReady index.html
"
);
let
gotoLoginPage
=
true
;
// $(document).ready(function () {
if
(
localGetData
(
"
email
"
)
!=
null
)
{
$
(
"
#autoLoginText
"
).
append
(
"
Compte
"
+
localGetData
(
"
email
"
)
+
"
sur
"
+
localGetData
(
"
name_server
"
));
$
(
'
input[name="email"]
'
).
val
(
localGetData
(
"
email
"
));
}
//On nettoie l'historique au lancement de l'appli
cleanHistorique
();
...
...
@@ -505,31 +515,25 @@
});
});
myDebug
(
"
SQL : end config ok
"
);
if
(
localGetData
(
"
api_server
"
)
!=
null
)
{
gotoLoginPage
=
false
;
//Au lancement on regarde si on a pas déjà ces infos de la dernière fois ...
// switchServer('#server', localGetData("name_server"), localGetData("api_server"));
//Et on essaye de reprendre la session !
loginWithAPIToken
();
}
if
(
gotoLoginPage
)
{
// myDebug("carouselLogin 7");
carouselLogin
();
}
});
myDebug
(
"
SQL : end 2 config ok
"
);
}
let
gotoLoginPage
=
true
;
// $(document).ready(function () {
if
(
localGetData
(
"
email
"
)
!=
null
)
{
$
(
"
#autoLoginText
"
).
append
(
"
Compte
"
+
localGetData
(
"
email
"
)
+
"
sur
"
+
localGetData
(
"
name_server
"
));
$
(
'
input[name="email"]
'
).
val
(
localGetData
(
"
email
"
));
}
if
(
localGetData
(
"
api_server
"
)
!=
null
)
{
gotoLoginPage
=
false
;
//Au lancement on regarde si on a pas déjà ces infos de la dernière fois ...
// switchServer('#server', localGetData("name_server"), localGetData("api_server"));
//Et on essaye de reprendre la session !
loginWithAPIToken
();
}
// else {
// switchServer('#server', "CAP-REL démo", 'https://z.cap-rel.fr/ndfdemo');
// }
if
(
gotoLoginPage
)
{
// myDebug("carouselLogin 7");
carouselLogin
();
}
});
});
...
...
www/js/ndf-head.js
View file @
de80e43a
...
...
@@ -189,21 +189,20 @@ function feedToSync(formField) {
t
.
executeSql
(
'
SELECT * FROM ldfsToSync
'
,
[],
function
(
tx
,
rs
)
{
let
html
=
""
;
myDebug
(
"
-> SQL SELECT * OK: res
"
+
rs
.
rows
.
length
);
let
nbRes
=
rs
.
rows
.
length
;
let
i
=
0
;
let
html
=
"
<ul>
"
;
for
(
i
=
0
;
i
<
nbRes
;
i
++
)
{
let
id
=
rs
.
rows
.
item
(
i
).
s
id
;
let
id
=
rs
.
rows
.
item
(
i
).
id
;
let
url
=
rs
.
rows
.
item
(
i
).
url
;
let
jsonData
=
rs
.
rows
.
item
(
i
).
jsonData
;
let
localFileName
=
rs
.
rows
.
item
(
i
).
localFileName
;
let
data
=
JSON
.
parse
(
jsonData
);
html
+=
"
<
li
>
"
+
id
+
"
:
"
+
data
.
typeFrais
+
"
du
"
+
data
.
ladate
+
"
(
"
+
data
.
label
+
"
,
"
+
data
.
ttc
+
"
€) <ons-button modifier=
\"
material
\"
onclick=
\"
rSyncOne(
"
+
id
+
"
);
\"
>Sync</ons-button>
</li
>
\n
"
;
html
+=
"
<
div style=
\"
clear:both
\"
>
"
+
id
+
"
:
"
+
data
.
typeFrais
+
"
du
"
+
data
.
ladate
+
"
(
"
+
data
.
label
+
"
,
"
+
data
.
ttc
+
"
€)
<br /><div style=
\"
float:right
\"
>
<ons-button modifier=
\"
material
\"
onclick=
\"
rSyncOne(
"
+
id
+
"
);
\"
>Sync
hroniser
</ons-button>
<ons-button modifier=
\"
material
\"
onclick=
\"
rSyncDeleteConfirm(
"
+
id
+
"
);
\"
>Supprimer</ons-button></div></div><hr /
>
\n
"
;
}
html
+=
"
</ul>
"
;
$
(
formField
).
append
(
html
);
},
function
()
{
...
...
@@ -471,16 +470,19 @@ ons.ready(function () {
fn
.
back
();
});
if
(
globalDB
==
null
)
{
myDebug
(
"
SQL : On essaye d'ouvrir la base de données ...
"
);
globalDB
=
window
.
sqlitePlugin
.
openDatabase
({
name
:
'
doliscan.db
'
,
location
:
'
default
'
,
androidDatabaseProvider
:
'
system
'
},
function
()
{
myDebug
(
"
SQL : ouverture OK, les tables existent deja (page index)
"
);
});
myDebug
(
"
SQL : end 2 config ok
"
);
var
path
=
window
.
location
.
pathname
;
var
page
=
path
.
split
(
"
/
"
).
pop
();
if
(
page
!=
"
index.html
"
)
{
if
(
globalDB
==
null
)
{
myDebug
(
"
SQL : On essaye d'ouvrir la base de données ...
"
);
globalDB
=
window
.
sqlitePlugin
.
openDatabase
({
name
:
'
doliscan.db
'
,
location
:
'
default
'
,
androidDatabaseProvider
:
'
system
'
},
function
()
{
myDebug
(
"
SQL : ouverture OK (ndf-head hors index.html normalement)
"
);
});
}
}
});
});
...
...
www/js/ndf.js
View file @
de80e43a
...
...
@@ -722,6 +722,20 @@ function genericCheckForm() {
}
}
//Supprime un id en attente de synchronisation
function
rSyncDelete
(
idToDelete
)
{
if
(
globalDB
!=
null
)
{
myDebug
(
"
SQL DELETE FROM ldfsToSync WHERE ID=
"
+
idToDelete
);
globalDB
.
executeSql
(
'
DELETE FROM ldfsToSync WHERE ID=?;
'
,
[
idToDelete
]);
myDebug
(
"
SQL DELETE FROM ... : ok
"
);
gotoPage
(
'
sync.html
'
,
false
);
}
else
{
myDebug
(
"
ERREUR SQL DELETE impossible (rsyncdelete)
"
);
gotoPage
(
'
sync.html
'
,
false
);
}
}
//Synchronise un élément vers le serveur
function
rSyncOne
(
idToSync
)
{
showWait
();
...
...
www/sync.html
View file @
de80e43a
...
...
@@ -22,4 +22,15 @@
$
(
document
).
ready
(
function
()
{
setPageTitle
(
"
Synchronisation
"
);
});
function
rSyncDeleteConfirm
(
id
)
{
ons
.
notification
.
confirm
(
"
Voulez-vous vraiment supprimer ce document ?
"
,
{
title
:
"
Vérification
"
,
buttonLabels
:
[
'
Non
'
,
'
Oui, supprimer
'
],
callback
:
function
(
index
)
{
if
(
index
==
1
)
{
rSyncDelete
(
id
);
}
}
});
}
</script>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment