Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
addcpm-json
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Александр Чаплыгин
addcpm-json
Commits
43ea90f1
Commit
43ea90f1
authored
Nov 12, 2018
by
Александр Чаплыгин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Подключил сортировку в стат. таблице
parent
1c221a7b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
16 deletions
+67
-16
script-feeds-stat-table.js
src/public/js/script-feeds-stat-table.js
+66
-15
cabinet-feed.phtml
src/templates/app/user/cabinet-feed.phtml
+1
-1
No files found.
src/public/js/script-feeds-stat-table.js
View file @
43ea90f1
...
@@ -39,25 +39,76 @@ $(document).ready(function(){
...
@@ -39,25 +39,76 @@ $(document).ready(function(){
$row
.
append
(
$
(
'<td>'
).
html
(
valueFormat
(
totalValue
)));
$row
.
append
(
$
(
'<td>'
).
html
(
valueFormat
(
totalValue
)));
});
});
$row
.
appendTo
(
$tableContent
);
$row
.
appendTo
(
$tableContent
);
// Сортировка строк в таблице:
var
sortField
=
false
,
$selectedField
=
$
(
'#table-line thead th b.selected'
),
isDesc
=
true
;
if
(
$selectedField
.
length
>
0
)
{
sortField
=
$selectedField
.
attr
(
'id'
);
isDesc
=
$selectedField
.
hasClass
(
'desc'
);
}
if
(
sortField
)
{
//console.log('AAA sortField = ', sortField);
//console.log('AAA dataTable = ', dataTable);
var
dataTableForSort
=
[];
dataTable
.
period
.
forEach
(
function
(
dataTableItem
,
ind
){
var
dataTableSortItem
=
{};
dataTableSortItem
[
'period'
]
=
dataTableItem
;
activeLines
.
forEach
(
function
(
activeLine
){
dataTableSortItem
[
activeLine
]
=
dataTable
[
activeLine
][
ind
];
});
dataTableForSort
.
push
(
dataTableSortItem
);
});
dataTableForSort
.
sort
(
function
(
a
,
b
){
if
(
isDesc
)
{
return
b
[
sortField
]
-
a
[
sortField
];
}
else
{
return
a
[
sortField
]
-
b
[
sortField
];
}
});
//console.log('AAA dataTableForSort = ', dataTableForSort);
dataTableForSort
.
forEach
(
function
(
item
){
for
(
var
i
=
dataPeriod
.
length
-
1
;
i
>=
0
;
i
--
)
{
$row
=
$
(
'<tr>'
);
$row
.
append
(
$
(
'<td>'
).
html
(
item
[
'period'
]));
activeLines
.
forEach
(
function
(
line
){
$row
.
append
(
$
(
'<td>'
).
html
(
item
[
line
]));
});
$row
.
appendTo
(
$tableContent
);
});
}
else
{
for
(
var
i
=
dataPeriod
.
length
-
1
;
i
>=
0
;
i
--
)
{
var
var
date
=
dataPeriod
[
i
],
date
=
dataPeriod
[
i
],
values
=
{};
values
=
{};
activeLines
.
forEach
(
function
(
activeLine
){
activeLines
.
forEach
(
function
(
activeLine
){
currentActiveLine
=
activeLine
;
currentActiveLine
=
activeLine
;
values
[
activeLine
]
=
valueFormat
(
dataTable
[
activeLine
][
i
]);
values
[
activeLine
]
=
valueFormat
(
dataTable
[
activeLine
][
i
]);
});
});
$row
=
$
(
'<tr>'
);
$row
=
$
(
'<tr>'
);
$row
.
append
(
$
(
'<td>'
).
html
(
date
));
$row
.
append
(
$
(
'<td>'
).
html
(
date
));
activeLines
.
forEach
(
function
(
item
){
activeLines
.
forEach
(
function
(
item
){
$row
.
append
(
$
(
'<td>'
).
html
(
values
[
item
]));
$row
.
append
(
$
(
'<td>'
).
html
(
values
[
item
]));
});
});
$row
.
appendTo
(
$tableContent
);
$row
.
appendTo
(
$tableContent
);
}
}
}
}
}
$
.
extend
({
$
.
extend
({
...
@@ -68,7 +119,7 @@ $(document).ready(function(){
...
@@ -68,7 +119,7 @@ $(document).ready(function(){
activeLines
=
[
'shows'
,
'clicks'
,
'transactions'
,
'salemoney'
,
'admoney'
];
activeLines
=
[
'shows'
,
'clicks'
,
'transactions'
,
'salemoney'
,
'admoney'
];
//console.log('AAA TableStat render: ', dataLineChartStat);
//console.log('AAA TableStat render: ', dataLineChartStat);
//
console.log('AAA activeLines: ', activeLines);
console
.
log
(
'AAA activeLines: '
,
activeLines
);
dataTable
=
{};
dataTable
=
{};
activeLines
.
forEach
(
function
(
item
){
activeLines
.
forEach
(
function
(
item
){
...
...
src/templates/app/user/cabinet-feed.phtml
View file @
43ea90f1
...
@@ -146,7 +146,7 @@ $dates = $this->dates;
...
@@ -146,7 +146,7 @@ $dates = $this->dates;
<th>
<?=
_t
(
'Дата/Компания'
)
?>
</th>
<th>
<?=
_t
(
'Дата/Компания'
)
?>
</th>
<?php
foreach
([
'shows'
,
'clicks'
,
'transactions'
,
'salemoney'
,
'admoney'
]
as
$name
)
:
?>
<?php
foreach
([
'shows'
,
'clicks'
,
'transactions'
,
'salemoney'
,
'admoney'
]
as
$name
)
:
?>
<th>
<th>
<input
type=
"checkbox"
/>
<input
type=
"checkbox"
data-field=
"
<?=
$name
?>
"
/>
<b
id=
"
<?=
$name
?>
"
>
<b
id=
"
<?=
$name
?>
"
>
<?=
_t
(
$name
)
?>
<?=
_t
(
$name
)
?>
<!--
<!--
...
...
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