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
c8053b3d
Commit
c8053b3d
authored
May 23, 2019
by
Александр Чаплыгин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил модель для статусов заказов, стартовый рендер по признаку статуса
parent
4109bae4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
206 additions
and
8 deletions
+206
-8
dependencies.global.php
src/config/autoload/dependencies.global.php
+13
-0
styles-feeds-stat.css
src/public/css/styles-feeds-stat.css
+6
-0
script-feeds-stat-table.js
src/public/js/script-feeds-stat-table.js
+20
-8
Cabinet.php
src/src/App/Action/User/Cabinet.php
+16
-0
OrderStatus.php
src/src/App/Entity/Feeds/OrderStatus.php
+112
-0
OrdersStatus.php
src/src/App/Model/Feeds/OrdersStatus.php
+39
-0
No files found.
src/config/autoload/dependencies.global.php
View file @
c8053b3d
...
...
@@ -60,6 +60,7 @@ return [
$hpm
->
setService
(
\App\Entity\Feeds\CategoryFee
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\Feeds\StatsDay
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\Feeds\Transaction
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\Feeds\OrderStatus
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\Contacts
::
class
,
new
\Zend\Hydrator\ClassMethods
());
...
...
@@ -211,6 +212,18 @@ return [
$container
->
get
(
\Monolog\Logger
::
class
)
);
},
\App\Model\Feeds\OrdersStatus
::
class
=>
function
(
ContainerInterface
$container
)
{
return
new
\App\Model\Feeds\OrdersStatus
(
new
Zend\Db\TableGateway\TableGateway
(
'orders_status'
,
$container
->
get
(
Zend\Db\Adapter\AdapterRetarg
::
class
),
new
\Zend\Db\TableGateway\Feature\MetadataFeature
(),
new
\Zend\Db\ResultSet\HydratingResultSet
(
$container
->
get
(
\Zend\Hydrator\DelegatingHydrator
::
class
),
new
\App\Entity\Feeds\OrderStatus
())
),
$container
->
get
(
\Zend\Hydrator\DelegatingHydrator
::
class
),
$container
->
get
(
\Monolog\Logger
::
class
)
);
},
\App\Model\FAQ\Categories
::
class
=>
function
(
ContainerInterface
$container
)
{
return
new
\App\Model\FAQ\Categories
(
new
Zend\Db\TableGateway\TableGateway
(
...
...
src/public/css/styles-feeds-stat.css
View file @
c8053b3d
...
...
@@ -233,6 +233,12 @@ input[type="checkbox"]
width
:
550px
;
}
.table.table-striped.admin.transactions
tbody
tr
td
span
.order-id
{
white-space
:
nowrap
;
}
/* .b-basket-content */
.table.table-striped.admin.transactions
thead
tr
th
.period
{
...
...
src/public/js/script-feeds-stat-table.js
View file @
c8053b3d
...
...
@@ -35,7 +35,10 @@ $(document).ready(function(){
// Шаблон ячейки OrderID
var
templateOrderIDContent
=
_
.
template
(
'
\
n'
+
' <span class="order-id">
\
n'
+
' <input type="checkbox" name="order-id" id="<%=data.orderId %>" data-feed-id="<%=data.feedId %>" <%=data.confirmed %> <%=data.approved %>>
\
n'
+
' <a class="orderid-link" href="orderid/<%=data.feedId %>/<%=data.orderId %>" target="_blank"><%=data.orderId %></a>
\
n'
+
' </span>
\
n'
+
''
);
// Шаблон ячейки ViewID
...
...
@@ -89,13 +92,6 @@ $(document).ready(function(){
sortField
=
false
,
isDesc
=
true
;
/*
dataTable = {};
for (var key in dataLineChartStat) {
dataTable[key] = dataLineChartStat[key];
}
*/
// Определение поля для сортировки строк в таблице:
if
(
$selectedField
.
length
>
0
)
{
sortField
=
$selectedField
.
attr
(
'id'
);
...
...
@@ -119,6 +115,11 @@ $(document).ready(function(){
}
//console.log('AAA sortField = ', sortField, ' isDesc = ', isDesc);
if
(
dataLineChartStat
.
report
==
'transactions'
)
{
console
.
log
(
'AAA dataLineChartStat = '
,
dataLineChartStat
.
ordersStatus
);
}
// Подготовка данных для сортировки:
dataPeriod
.
forEach
(
function
(
dataTableItem
,
ind
){
var
dataTableSortItem
=
{};
...
...
@@ -147,8 +148,19 @@ $(document).ready(function(){
$row
=
$
(
'<tr>'
);
if
(
dataLineChartStat
.
report
==
'transactions'
)
{
var
feedId
=
item
[
'ViewID'
][
0
],
orderId
=
item
[
'period'
],
orderStatus
=
dataLineChartStat
.
ordersStatus
[
feedId
][
orderId
];
$row
.
append
(
$
(
'<td>'
).
append
(
templateOrderIDContent
({
data
:
{
feedId
:
item
[
'ViewID'
][
0
],
orderId
:
item
[
'period'
]}
data
:
{
feedId
:
item
[
'ViewID'
][
0
],
orderId
:
item
[
'period'
],
confirmed
:
(
orderStatus
&&
!
orderStatus
.
confirmed
)
?
''
:
'checked'
,
approved
:
(
orderStatus
&&
orderStatus
.
approved
)
?
'disabled'
:
''
,
}
})));
}
else
{
$row
.
append
(
$
(
'<td>'
).
html
(
item
[
'period'
]));
...
...
src/src/App/Action/User/Cabinet.php
View file @
c8053b3d
...
...
@@ -32,6 +32,7 @@ use App\Model\Users;
use
App\Model\Statistics
;
use
App\Model\Providers
;
use
App\Model\Feeds\Feeds
;
use
App\Model\Feeds\OrdersStatus
;
use
App\Entity\Feeds\CategoryFee
;
use
Psr\Http\Message\ResponseInterface
;
use
Psr\Http\Message\ServerRequestInterface
;
...
...
@@ -138,6 +139,21 @@ class Cabinet extends Common
break
;
}
// Добавляем данные о статусах заказов:
if
(
$report_type
==
'transactions'
)
{
/** @var \App\Model\Feeds $ordersStatusModel */
$ordersStatusModel
=
$this
->
container
->
get
(
OrdersStatus
::
class
);
$ordersStatus
=
$ordersStatusModel
->
findAll
([
'feed_id'
=>
$feed_id_list
])
->
toArray
();
$statuses
=
[];
foreach
(
$ordersStatus
as
$order_item
)
{
$statuses
[
$order_item
[
'feed_id'
]][
$order_item
[
'order_id'
]]
=
array
(
'confirmed'
=>
$order_item
[
'confirmed'
]
?
1
:
0
,
'approved'
=>
$order_item
[
'approved'
]
?
1
:
0
);
}
$periodStats
[
'ordersStatus'
]
=
$statuses
;
}
$data
[
'feeds'
]
=
$feeds
;
$data
[
'current_report'
]
=
$report_type
;
$data
[
'current_period'
]
=
$current_period
;
...
...
src/src/App/Entity/Feeds/OrderStatus.php
0 → 100644
View file @
c8053b3d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Entity\Feeds
;
use
App\Entity\Common
;
/**
* Class OrderStatus
* @package App\Entity
*/
class
OrderStatus
extends
Common
{
/**
* @return int
*/
public
function
getFeedId
()
:
int
{
return
$this
->
feedId
;
}
/**
* @param int $feed_id
* @return OrderStatus
*/
public
function
setFeedId
(
$feed_id
)
{
$this
->
feedId
=
$feed_id
;
return
$this
;
}
/**
* @return int
*/
public
function
getOrderId
()
:
int
{
return
$this
->
orderId
;
}
/**
* @param int $order_id
* @return OrderStatus
*/
public
function
setOrderId
(
$order_id
)
{
$this
->
orderId
=
$order_id
;
return
$this
;
}
/**
* @return int
*/
public
function
getConfirmed
()
:
bool
{
return
$this
->
confirmed
;
}
/**
* @param int $confirmed
* @return OrderStatus
*/
public
function
setConfirmed
(
$confirmed
)
{
$this
->
confirmed
=
$confirmed
;
return
$this
;
}
/**
* @return int
*/
public
function
getApproved
()
:
bool
{
return
$this
->
approved
;
}
/**
* @param int $approved
* @return OrderStatus
*/
public
function
setApproved
(
$approved
)
{
$this
->
approved
=
$approved
;
return
$this
;
}
}
\ No newline at end of file
src/src/App/Model/Feeds/OrdersStatus.php
0 → 100644
View file @
c8053b3d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Model\Feeds
;
use
App\Model\Common
;
/**
* Class OrdersStatus
* @package App\Model
*/
class
OrdersStatus
extends
Common
{
}
\ No newline at end of file
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