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
8a376776
Commit
8a376776
authored
May 27, 2019
by
Александр Чаплыгин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Пересчет суммарных значений по статусам заказов
parent
7d43e037
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
12 deletions
+59
-12
styles-feeds-stat.css
src/public/css/styles-feeds-stat.css
+7
-2
script-feeds-stat-table.js
src/public/js/script-feeds-stat-table.js
+41
-5
script-feeds-stat.js
src/public/js/script-feeds-stat.js
+11
-5
No files found.
src/public/css/styles-feeds-stat.css
View file @
8a376776
...
@@ -188,7 +188,8 @@ input[type="checkbox"]
...
@@ -188,7 +188,8 @@ input[type="checkbox"]
}
}
/* Фильтрация строк в таблице transactions */
/* Фильтрация строк в таблице transactions */
table
.table-striped.admin.transactions
.transaction-item
table
.table-striped.admin.transactions
.transaction-item
,
table
.table-striped.admin.transactions
.total-orders
{
{
display
:
none
;
display
:
none
;
}
}
...
@@ -196,7 +197,11 @@ input[type="checkbox"]
...
@@ -196,7 +197,11 @@ input[type="checkbox"]
table
.table-striped.admin.transactions.all
.transaction-item
,
table
.table-striped.admin.transactions.all
.transaction-item
,
table
.table-striped.admin.transactions.approved
.transaction-item.approved
,
table
.table-striped.admin.transactions.approved
.transaction-item.approved
,
table
.table-striped.admin.transactions.confirmed
.transaction-item.confirmed
,
table
.table-striped.admin.transactions.confirmed
.transaction-item.confirmed
,
table
.table-striped.admin.transactions.rejected
.transaction-item.rejected
table
.table-striped.admin.transactions.rejected
.transaction-item.rejected
,
table
.table-striped.admin.transactions.all
.total-orders.all
,
table
.table-striped.admin.transactions.approved
.total-orders.approved
,
table
.table-striped.admin.transactions.confirmed
.total-orders.confirmed
,
table
.table-striped.admin.transactions.rejected
.total-orders.rejected
{
{
display
:
table-row
;
display
:
table-row
;
}
}
...
...
src/public/js/script-feeds-stat-table.js
View file @
8a376776
...
@@ -11,7 +11,8 @@ $(document).ready(function(){
...
@@ -11,7 +11,8 @@ $(document).ready(function(){
dateTimeFields
=
[
'Timestamp'
,
'period'
],
dateTimeFields
=
[
'Timestamp'
,
'period'
],
trClassConfirmed
=
'confirmed'
,
trClassConfirmed
=
'confirmed'
,
trClassRejected
=
'rejected'
,
trClassRejected
=
'rejected'
,
trClassApproved
=
'approved'
;
trClassApproved
=
'approved'
,
ordersStatuses
=
[
'approved'
,
'confirmed'
,
'rejected'
];
// Шаблон содержимого ячейки Basket
// Шаблон содержимого ячейки Basket
var
templateBasketContent
=
_
.
template
(
'
\
n'
+
var
templateBasketContent
=
_
.
template
(
'
\
n'
+
...
@@ -122,7 +123,6 @@ $(document).ready(function(){
...
@@ -122,7 +123,6 @@ $(document).ready(function(){
console
.
log
(
'AAA dataLineChartStat = '
,
dataLineChartStat
.
ordersStatus
);
console
.
log
(
'AAA dataLineChartStat = '
,
dataLineChartStat
.
ordersStatus
);
}
}
// Подготовка данных для сортировки:
// Подготовка данных для сортировки:
dataPeriod
.
forEach
(
function
(
dataTableItem
,
ind
){
dataPeriod
.
forEach
(
function
(
dataTableItem
,
ind
){
var
dataTableSortItem
=
{};
var
dataTableSortItem
=
{};
...
@@ -234,7 +234,7 @@ $(document).ready(function(){
...
@@ -234,7 +234,7 @@ $(document).ready(function(){
// Добавляем строку "Всего заказов" для отчета 'transactions':
// Добавляем строку "Всего заказов" для отчета 'transactions':
if
(
dataLineChartStat
.
report
==
'transactions'
)
{
if
(
dataLineChartStat
.
report
==
'transactions'
)
{
$row
=
$
(
'<tr class="total-orders">'
);
$row
=
$
(
'<tr class="total-orders
all
">'
);
$row
.
append
(
$
(
'<td>'
).
html
(
"Всего заказов: "
+
dataPeriod
.
length
));
$row
.
append
(
$
(
'<td>'
).
html
(
"Всего заказов: "
+
dataPeriod
.
length
));
activeLines
.
forEach
(
function
(
item
){
activeLines
.
forEach
(
function
(
item
){
...
@@ -253,6 +253,17 @@ $(document).ready(function(){
...
@@ -253,6 +253,17 @@ $(document).ready(function(){
$row
.
append
(
$
(
'<td class="'
+
item
+
'">'
).
html
(
valueFormat
(
totalValue
)));
$row
.
append
(
$
(
'<td class="'
+
item
+
'">'
).
html
(
valueFormat
(
totalValue
)));
});
});
$row
.
appendTo
(
$tableContent
);
$row
.
appendTo
(
$tableContent
);
// Добавляем total-строки для статусов заказов:
ordersStatuses
.
forEach
(
function
(
item
){
$row
=
$
(
'<tr class="total-orders '
+
item
+
'">'
);
$row
.
append
(
$
(
'<td class="count">'
).
html
(
"Заказов: <span></span>"
));
activeLines
.
forEach
(
function
(
activeLine
){
$row
.
append
(
$
(
'<td class="'
+
activeLine
+
'">'
));
});
$row
.
appendTo
(
$tableContent
);
});
}
}
}
}
...
@@ -269,7 +280,6 @@ $(document).ready(function(){
...
@@ -269,7 +280,6 @@ $(document).ready(function(){
//console.log('AAA TableStat render: ', dataLineChartStat);
//console.log('AAA TableStat render: ', dataLineChartStat);
//console.log('AAA activeLines: ', activeLines);
//console.log('AAA activeLines: ', activeLines);
if
(
dataLineChartStat
.
type
==
'interval'
)
{
if
(
dataLineChartStat
.
type
==
'interval'
)
{
RenderInterval
(
dataLineChartStat
);
RenderInterval
(
dataLineChartStat
);
...
@@ -280,7 +290,6 @@ $(document).ready(function(){
...
@@ -280,7 +290,6 @@ $(document).ready(function(){
}
}
$tableBody
.
html
(
''
).
append
(
$tableContent
.
children
());
$tableBody
.
html
(
''
).
append
(
$tableContent
.
children
());
},
},
// Определяем список категорий, отмеченных галочками в таблице:
// Определяем список категорий, отмеченных галочками в таблице:
CheckedCategories
:
function
()
{
CheckedCategories
:
function
()
{
...
@@ -292,6 +301,33 @@ $(document).ready(function(){
...
@@ -292,6 +301,33 @@ $(document).ready(function(){
});
});
return
listCats
;
return
listCats
;
},
},
OrdersStatusReCalc
:
function
()
{
console
.
log
(
'AAA OrdersStatusReCalc'
);
// Добавляем total-строки для статусов заказов:
ordersStatuses
.
forEach
(
function
(
item
){
var
$trStatus
=
$
(
'tr.transaction-item.'
+
item
,
$table
),
$trTotalStatus
=
$
(
'tr.total-orders.'
+
item
,
$table
);
$
(
'td.count span'
,
$trTotalStatus
).
html
(
$trStatus
.
length
);
activeLines
.
forEach
(
function
(
activeLine
){
currentActiveLine
=
activeLine
;
var
isNotSumValue
=
notFormatFields
.
indexOf
(
activeLine
)
>
-
1
;
if
(
!
isNotSumValue
)
{
var
totalValue
=
0
;
$trStatus
.
each
(
function
(){
var
$this
=
$
(
this
);
totalValue
+=
parseFloat
(
$
(
'td.'
+
activeLine
,
$this
).
html
().
replace
(
','
,
''
));
});
$
(
'td.'
+
activeLine
,
$trTotalStatus
).
html
(
valueFormat
(
totalValue
));
}
});
});
},
}
}
});
});
...
...
src/public/js/script-feeds-stat.js
View file @
8a376776
...
@@ -280,7 +280,9 @@ $(document).ready(function(){
...
@@ -280,7 +280,9 @@ $(document).ready(function(){
$tableStat
=
$
(
'table.transactions'
),
$tableStat
=
$
(
'table.transactions'
),
$ordersSwitcher
=
$
(
'.b-filter__switch.category-orders .b-filter__switch-item'
),
$ordersSwitcher
=
$
(
'.b-filter__switch.category-orders .b-filter__switch-item'
),
switcherActiveClass
=
'm-filter__switch-item_active'
;
switcherActiveClass
=
'm-filter__switch-item_active'
;
OrdersStatusReCalc
();
// Переключение статусов заказов:
// Переключение статусов заказов:
$ordersSwitcher
.
on
(
'click'
,
function
()
{
$ordersSwitcher
.
on
(
'click'
,
function
()
{
var
$this
=
$
(
this
);
var
$this
=
$
(
this
);
...
@@ -322,6 +324,7 @@ $(document).ready(function(){
...
@@ -322,6 +324,7 @@ $(document).ready(function(){
$this
.
prop
(
"checked"
,
!
$this
.
prop
(
"checked"
))
$this
.
prop
(
"checked"
,
!
$this
.
prop
(
"checked"
))
}
}
$this
.
prop
(
"disabled"
,
false
);
$this
.
prop
(
"disabled"
,
false
);
OrdersStatusReCalc
();
},
},
error
:
function
(
rew
,
status
,
err
)
{
error
:
function
(
rew
,
status
,
err
)
{
console
.
log
(
status
,
err
);
console
.
log
(
status
,
err
);
...
@@ -329,15 +332,12 @@ $(document).ready(function(){
...
@@ -329,15 +332,12 @@ $(document).ready(function(){
}
}
});
});
return
false
;
return
false
;
});
});
// Клик на Утвердить заказы:
// Клик на Утвердить заказы:
$
(
'a.btn.approve'
).
on
(
'click'
,
function
(){
$
(
'a.btn.approve'
).
on
(
'click'
,
function
(){
if
(
!
confirm
(
"Утвердить заказы за выбранный период?"
))
return
false
;
if
(
!
confirm
(
"Утвердить заказы за выбранный период?"
))
return
false
;
var
var
action
=
$tableStat
.
data
(
'link'
),
action
=
$tableStat
.
data
(
'link'
),
...
@@ -374,6 +374,7 @@ $(document).ready(function(){
...
@@ -374,6 +374,7 @@ $(document).ready(function(){
$inputItem
.
prop
(
"disabled"
,
true
);
$inputItem
.
prop
(
"disabled"
,
true
);
$orderTr
.
removeClass
(
'confirmed'
).
removeClass
(
'rejected'
).
addClass
(
'approved'
);
$orderTr
.
removeClass
(
'confirmed'
).
removeClass
(
'rejected'
).
addClass
(
'approved'
);
});
});
OrdersStatusReCalc
();
}
}
},
},
error
:
function
(
rew
,
status
,
err
)
{
error
:
function
(
rew
,
status
,
err
)
{
...
@@ -385,7 +386,12 @@ $(document).ready(function(){
...
@@ -385,7 +386,12 @@ $(document).ready(function(){
return
false
;
return
false
;
});
});
// Пересчет кол-ва заказов по группам
function
OrdersStatusReCalc
()
{
$
.
TableStat
.
OrdersStatusReCalc
();
}
})();
})();
...
...
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