Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
third-party
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-foodcoops
third-party
Commits
a93bd4aa
Commit
a93bd4aa
authored
Feb 03, 2022
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
little cleanup
parent
afdeff5b
Pipeline
#1754
passed with stage
in 1 minute 41 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
15 deletions
+30
-15
envelops.css
envelops/static/css/envelops.css
+4
-0
envelops.js
envelops/static/js/envelops.js
+26
-15
No files found.
envelops/static/css/envelops.css
View file @
a93bd4aa
#cash
,
#ch
{
margin-top
:
15px
;
}
.envelop_section
{
margin-bottom
:
10px
;
}
...
...
envelops/static/js/envelops.js
View file @
a93bd4aa
...
...
@@ -57,7 +57,13 @@ function get_envelop_name(envelop, name_type = 'short') {
return
envelop_name
;
}
// Set an envelop content on the document
/**
* Set the envelops contents on the document (could use a little cleanup someday: don't generate html in js, etc...)
* @param {Object} envelop
* @param {String} envelop_name
* @param {Int} envelop_content_id
* @param {Int} envelop_index
*/
function
set_envelop_dom
(
envelop
,
envelop_name
,
envelop_content_id
,
envelop_index
)
{
var
envelops_section
=
$
(
'#'
+
envelop
.
type
+
'_envelops'
);
...
...
@@ -135,7 +141,10 @@ function set_envelop_dom(envelop, envelop_name, envelop_content_id, envelop_inde
}
// Set the envelops data according to their type
/**
* Given the raw list of envelop documents, generate the cash and cheque lists
* @param {Array} envelops
*/
function
set_envelops
(
envelops
)
{
var
cash_index
=
0
;
var
ch_index
=
0
;
...
...
@@ -376,7 +385,9 @@ function archive_envelop(type, index) {
}
}
// Get all the envelops from couch db
/**
* Get all the envelops from couchdb
*/
function
get_envelops
()
{
dbc
.
allDocs
({
include_docs
:
true
,
...
...
@@ -390,20 +401,20 @@ function get_envelops() {
});
}
// Hande change in couc db
sync
.
on
(
'change'
,
function
(
info
)
{
// handle change
if
(
info
.
direction
==
'pull'
)
{
get_envelops
();
}
}).
on
(
'error'
,
function
(
err
)
{
// handle error
console
.
log
(
'erreur sync'
);
console
.
log
(
err
);
});
$
(
document
).
ready
(
function
()
{
if
(
typeof
must_identify
==
"undefined"
||
coop_is_connected
())
{
get_envelops
();
// Hande change in couc db
sync
.
on
(
'change'
,
function
(
info
)
{
// handle change
if
(
info
.
direction
==
'pull'
)
{
get_envelops
();
}
}).
on
(
'error'
,
function
(
err
)
{
// handle error
console
.
log
(
'erreur sync'
);
console
.
log
(
err
);
});
}
});
Write
Preview
Markdown
is supported
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