Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
erp5
Commits
362dd21c
Commit
362dd21c
authored
Oct 31, 2019
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_produciton_planning: fix minor issue
no need to format no need to bind other input
parent
e111113b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
14 deletions
+6
-14
bt5/erp5_production_planning/SkinTemplateItem/portal_skins/erp5_production_planning/production_planning.js.js
..._skins/erp5_production_planning/production_planning.js.js
+6
-14
No files found.
bt5/erp5_production_planning/SkinTemplateItem/portal_skins/erp5_production_planning/production_planning.js.js
View file @
362dd21c
var
matrixbox
;
var
sRegExp
=
new
RegExp
(
'
(-?[0-9]+)([0-9]{3})
'
);
function
format
(
num
)
{
// format a number to string, only 1 234 format is supported.
num
=
num
.
toString
();
while
(
sRegExp
.
test
(
num
))
{
num
=
num
.
replace
(
sRegExp
,
'
$1 $2
'
);
}
return
num
;
}
function
parse
(
str
)
{
// parse a string to a number
// \s is for opera, others are for chrome / firefox
...
...
@@ -58,7 +50,7 @@ function recalculateSumLine(idx, element) {
}
if
(
v
)
{
sum
+=
v
;
}
}
jQuery
(
element
).
text
(
format
(
sum
)
);
jQuery
(
element
).
text
(
sum
);
});
}
...
...
@@ -79,7 +71,7 @@ function recalculateSumColumn(idx, element) {
}
if
(
v
)
{
sum
+=
v
;
}
}
me
.
text
(
format
(
sum
)
);
me
.
text
(
sum
);
}
function
addTotalColumnToMatrixBox
()
{
...
...
@@ -112,7 +104,7 @@ function listenToInputChange(matrixbox_container) {
sum
,
previous_value
,
actual_value
;
$
(
'
td input
'
).
bind
(
'
input
'
,
null
,
function
(
e
)
{
$
(
'
div.matrixbox_production_planning
td input
'
).
bind
(
'
input
'
,
null
,
function
(
e
)
{
var
input
=
$
(
this
);
if
(
input
[
0
].
getAttribute
(
'
value
'
)
!=
input
[
0
].
value
)
{
input
.
addClass
(
'
change
'
);
...
...
@@ -126,14 +118,14 @@ function listenToInputChange(matrixbox_container) {
actual_value
=
parseInt
(
input
[
0
].
value
)
||
0
;
sum
=
sum
+
(
actual_value
-
parseInt
(
previous_value
));
input
[
0
].
setAttribute
(
'
data-previous-value
'
,
actual_value
);
sum_span
.
text
(
format
(
sum
)
);
sum_span
.
text
(
sum
);
});
}
function
listenToInputPaste
(
matrixbox_container
)
{
matrixbox
=
$
(
matrixbox_container
.
querySelector
(
'
.MatrixContent
'
));
$
(
'
td input
'
).
bind
(
'
paste
'
,
null
,
function
(
e
)
{
$
(
'
div.matrixbox_production_planning
td input
'
).
bind
(
'
paste
'
,
null
,
function
(
e
)
{
var
i
,
j
,
input
,
td_index
=
$
(
e
.
target
.
parentElement
.
parentElement
).
index
(),
...
...
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