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
10127a48
Commit
10127a48
authored
Sep 30, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete envelop button
parent
7a0149bc
Pipeline
#1335
passed with stage
in 1 minute 25 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
2 deletions
+40
-2
models.py
envelops/models.py
+1
-1
envelops.js
envelops/static/js/envelops.js
+35
-1
index.html
templates/envelops/index.html
+4
-0
No files found.
envelops/models.py
View file @
10127a48
...
@@ -91,7 +91,7 @@ class CagetteEnvelops(models.Model):
...
@@ -91,7 +91,7 @@ class CagetteEnvelops(models.Model):
if
not
(
'error'
in
res
):
if
not
(
'error'
in
res
):
try
:
try
:
if
int
(
float
(
data
[
'amount'
])
*
100
)
==
int
(
float
(
invoice
[
'residual_signed'
])
*
100
):
if
int
(
float
(
data
[
'amount'
])
*
100
)
==
int
(
float
(
invoice
[
'residual_signed'
])
*
100
):
# This payment is what
it
was left to pay, so change invoice state
# This payment is what was left to pay, so change invoice state
self
.
o_api
.
update
(
'account.invoice'
,
[
invoice
[
'id'
]],
{
'state'
:
'paid'
})
self
.
o_api
.
update
(
'account.invoice'
,
[
invoice
[
'id'
]],
{
'state'
:
'paid'
})
except
Exception
as
e
:
except
Exception
as
e
:
res
[
'error'
]
=
repr
(
e
)
res
[
'error'
]
=
repr
(
e
)
...
...
envelops/static/js/envelops.js
View file @
10127a48
...
@@ -16,6 +16,10 @@ function toggle_success_alert() {
...
@@ -16,6 +16,10 @@ function toggle_success_alert() {
$
(
'#envelop_cashing_success'
).
toggle
(
250
);
$
(
'#envelop_cashing_success'
).
toggle
(
250
);
}
}
function
toggle_deleted_alert
()
{
$
(
'#envelop_deletion_success'
).
toggle
(
250
);
}
// Set an envelop content on the document
// Set an envelop content on the document
function
set_envelop_dom
(
envelop
,
envelop_name
,
envelop_content_id
,
envelop_index
)
{
function
set_envelop_dom
(
envelop
,
envelop_name
,
envelop_content_id
,
envelop_index
)
{
var
envelops_section
=
$
(
'#'
+
envelop
.
type
+
'_envelops'
);
var
envelops_section
=
$
(
'#'
+
envelop
.
type
+
'_envelops'
);
...
@@ -39,7 +43,7 @@ function set_envelop_dom(envelop, envelop_name, envelop_content_id, envelop_inde
...
@@ -39,7 +43,7 @@ function set_envelop_dom(envelop, envelop_name, envelop_content_id, envelop_inde
}
}
new_html
+=
'</div>'
new_html
+=
'</div>'
+
'<div class="panel"><ol id="'
+
envelop_content_id
+
'"></ol></div>'
+
'<div class="panel
panel_'
+
envelop_content_id
+
'
"><ol id="'
+
envelop_content_id
+
'"></ol></div>'
+
'</div>'
;
+
'</div>'
;
$
(
new_html
).
appendTo
(
envelops_section
);
$
(
new_html
).
appendTo
(
envelops_section
);
...
@@ -58,6 +62,9 @@ function set_envelop_dom(envelop, envelop_name, envelop_content_id, envelop_inde
...
@@ -58,6 +62,9 @@ function set_envelop_dom(envelop, envelop_name, envelop_content_id, envelop_inde
li_node
.
appendChild
(
textnode
);
// Append the text to <li>
li_node
.
appendChild
(
textnode
);
// Append the text to <li>
document
.
getElementById
(
envelop_content_id
).
appendChild
(
li_node
);
document
.
getElementById
(
envelop_content_id
).
appendChild
(
li_node
);
}
}
let
envelop_panel
=
$
(
`.panel_
${
envelop_content_id
}
`
);
envelop_panel
.
append
(
'<button class="btn--danger delete_envelop_button item-fluid" onClick="openModal(
\'
<h3>Supprimer enveloppe ?</h3>
\'
, function() {delete_envelop(
\'
'
+
envelop
.
type
+
'
\'
, '
+
envelop_index
+
');},
\'
Supprimer
\'
)">Supprimer l
\'
enveloppe</button>'
);
}
}
// Set the envelops data according to their type
// Set the envelops data according to their type
...
@@ -118,7 +125,33 @@ function set_envelops(envelops) {
...
@@ -118,7 +125,33 @@ function set_envelops(envelops) {
}
}
}
}
function
delete_envelop
(
type
,
index
)
{
if
(
is_time_to
(
'delete_envelop'
,
1000
))
{
openModal
();
var
envelop
=
null
;
if
(
type
==
"cash"
)
{
envelop
=
cash_envelops
[
index
];
}
else
{
envelop
=
ch_envelops
[
index
];
}
envelop
.
_deleted
=
true
;
dbc
.
put
(
envelop
,
function
callback
(
err
,
result
)
{
if
(
!
err
&&
result
!==
undefined
)
{
toggle_deleted_alert
();
get_envelops
();
}
else
{
alert
(
"Erreur lors de la suppression de l'enveloppe... Essaye de recharger la page et réessaye."
);
console
.
log
(
err
);
}
});
}
}
function
archive_envelop
(
type
,
index
)
{
function
archive_envelop
(
type
,
index
)
{
if
(
is_time_to
(
'archive_envelop'
,
1000
))
{
$
(
'#envelop_cashing_error'
).
hide
();
$
(
'#envelop_cashing_error'
).
hide
();
$
(
'#envelop_cashing_success'
).
hide
();
$
(
'#envelop_cashing_success'
).
hide
();
// Loading on
// Loading on
...
@@ -179,6 +212,7 @@ function archive_envelop(type, index) {
...
@@ -179,6 +212,7 @@ function archive_envelop(type, index) {
alert
(
'Erreur serveur. Merci de ne pas ré-encaisser l
\'
enveloppe qui a causé l
\'
erreur.'
);
alert
(
'Erreur serveur. Merci de ne pas ré-encaisser l
\'
enveloppe qui a causé l
\'
erreur.'
);
}
}
});
});
}
}
}
// Get all the envelops from couch db
// Get all the envelops from couch db
...
...
templates/envelops/index.html
View file @
10127a48
...
@@ -20,6 +20,10 @@
...
@@ -20,6 +20,10 @@
<div
style=
"width: 90%"
class=
"fl txtleft"
>
Enveloppe encaissée !
</div>
<div
style=
"width: 90%"
class=
"fl txtleft"
>
Enveloppe encaissée !
</div>
<div
style=
"width: 10%"
class=
"fr txtright"
><i
class=
"fas fa-times"
></i></div>
<div
style=
"width: 10%"
class=
"fr txtright"
><i
class=
"fas fa-times"
></i></div>
</div>
</div>
<div
id=
"envelop_deletion_success"
class=
"alert--success clearfix custom_alert"
onClick=
"toggle_deleted_alert()"
>
<div
style=
"width: 90%"
class=
"fl txtleft"
>
Enveloppe supprimée !
</div>
<div
style=
"width: 10%"
class=
"fr txtright"
><i
class=
"fas fa-times"
></i></div>
</div>
<section
class=
"grid-2 has-gutter"
>
<section
class=
"grid-2 has-gutter"
>
<section
id=
"cash"
>
<section
id=
"cash"
>
...
...
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