Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CDEK Development
cdek-warehouse
Commits
a783ab54
Commit
a783ab54
authored
7 years ago
by
Anna
Browse files
Options
Download
Email Patches
Plain Diff
contextMenu + buf of dateOfMeeting
parent
9ad74c87
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
front/cdek_front/src/main/java/ru/cdek/authentication/CustomAuthenticationProvider.java
+5
-3
.../ru/cdek/authentication/CustomAuthenticationProvider.java
front/cdek_front/webapp/commons/javascripts/cdek/component/ui-utils.js
+10
-1
...ont/webapp/commons/javascripts/cdek/component/ui-utils.js
front/cdek_front/webapp/shipping/application/shipping.js
+47
-54
front/cdek_front/webapp/shipping/application/shipping.js
front/cdek_front/webapp/shipping/index.ftl
+0
-1
front/cdek_front/webapp/shipping/index.ftl
front/cdek_front/webapp/shipping/shipping.ftl
+1
-15
front/cdek_front/webapp/shipping/shipping.ftl
with
63 additions
and
74 deletions
+63
-74
front/cdek_front/src/main/java/ru/cdek/authentication/CustomAuthenticationProvider.java
View file @
a783ab54
...
...
@@ -22,6 +22,7 @@ import org.springframework.stereotype.Component;
import
java.security.MessageDigest
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Component
public
class
CustomAuthenticationProvider
implements
AuthenticationProvider
{
...
...
@@ -77,8 +78,9 @@ public class CustomAuthenticationProvider implements AuthenticationProvider {
}
FrontUser
jsUser
=
new
FrontUser
(
response
);
//delete password and roles
jsUser
.
setRoles
(
null
);
ArrayList
<
String
>
collect
=
grantedAuths
.
stream
().
map
(
GrantedAuthority:
:
getAuthority
).
collect
(
Collectors
.
toCollection
(
ArrayList:
:
new
));
jsUser
.
setRoles
(
collect
.
toArray
(
new
String
[
0
]));
//delete password
jsUser
.
setPassword
(
null
);
jsUser
.
setBlocked
(
false
);
//set employeeCode
...
...
@@ -89,7 +91,7 @@ public class CustomAuthenticationProvider implements AuthenticationProvider {
}
//set branchCode
if
(
null
==
employee
||
StringUtils
.
isBlank
(
employee
.
getBranchCode
()))
{
if
(
StringUtils
.
isBlank
(
employee
.
getBranchCode
()))
{
jsUser
.
setBranchCode
(
StringUtils
.
EMPTY
);
}
else
{
jsUser
.
setBranchCode
(
employee
.
getBranchCode
());
...
...
This diff is collapsed.
Click to expand it.
front/cdek_front/webapp/commons/javascripts/cdek/component/ui-utils.js
View file @
a783ab54
...
...
@@ -259,7 +259,16 @@ angular.module('Utils', []).directive('splitJoinFormatter', function(){
}
});
};
/**
* Проверяет роль пользователя требуемой роли
*
* @param user - пользователь
* @param role - роль
*/
this
.
isUserInRole
=
function
(
user
,
role
)
{
return
user
.
roles
.
indexOf
(
role
)
!=
-
1
;
};
/**
* Вывод alert-сообщения
...
...
This diff is collapsed.
Click to expand it.
front/cdek_front/webapp/shipping/application/shipping.js
View file @
a783ab54
...
...
@@ -13,63 +13,56 @@ app.controller('ShippingCtrl', function($scope, $routeParams, $route,
userService
.
getUser
().
then
(
function
successCallback
(
response
)
{
$scope
.
currentUser
=
response
.
data
;
setupShipmentGrid
(
$scope
.
shippingListApi
.
gridOptions
);
});
$timeout
(
function
(){
gridUtils
.
setupGrid
(
'
warehouse.shippings
'
,
setupShipmentGrid
(
$scope
.
shippingListApi
.
gridOptions
)
)
;
gridUtils
.
setupGrid
(
'
warehouse.shipping.cargoplaces
'
,
$scope
.
cargoPlacesListApi
.
gridOptions
);
gridUtils
.
setupGrid
(
'
warehouse.shipping.problems
'
,
$scope
.
problemListApi
.
gridOptions
);
gridUtils
.
setupGrid
(
'
warehouse.shipping.from.list
'
,
$scope
.
fromListApi
.
gridOptions
);
gridUtils
.
setupGrid
(
'
warehouse.shipping.to.list
'
,
$scope
.
toListApi
.
gridOptions
);
$timeout
(
function
()
{
gridUtils
.
setupGrid
(
'
warehouse.shippings
'
,
$scope
.
shippingListApi
.
gridOptions
);
gridUtils
.
setupGrid
(
'
warehouse.shipping.cargoplaces
'
,
$scope
.
cargoPlacesListApi
.
gridOptions
);
gridUtils
.
setupGrid
(
'
warehouse.shipping.problems
'
,
$scope
.
problemListApi
.
gridOptions
);
gridUtils
.
setupGrid
(
'
warehouse.shipping.from.list
'
,
$scope
.
fromListApi
.
gridOptions
);
gridUtils
.
setupGrid
(
'
warehouse.shipping.to.list
'
,
$scope
.
toListApi
.
gridOptions
);
$
(
$scope
.
shippingListApi
.
gridOptions
.
api
.
gridPanel
.
eBodyContainer
).
contextmenu
({
'
target
'
:
'
#shipmentContextMenu
'
});
});
var
setupShipmentGrid
=
function
(
grid
)
{
if
(
grid
!=
null
)
{
grid
.
getContextMenuItems
=
$scope
.
getContextMenuItems
;
return
grid
;
}
};
$scope
.
getContextMenuItems
=
function
(
params
)
{
if
(
params
.
node
!=
null
)
{
var
data
=
params
.
node
.
data
;
var
result
=
[
{
//должны быть другие имена
name
:
'
addDatetimeOfMeetPlan
'
,
action
:
function
()
{
//должны быть другие функции
$scope
.
datetimeOfMeetPlanDialog
;
}
},
{
name
:
'
addDatetimeOfMeet
'
,
action
:
function
()
{
$scope
.
datetimeOfMeetDialog
;
}
},
{
name
:
'
addProblemDialog
'
,
action
:
function
()
{
$scope
.
problemDialog
;
}
}
];
for
(
var
i
=
0
;
i
<
params
.
defaultItems
.
length
;
i
++
)
{
if
(
params
.
defaultItems
[
i
]
==
'
toolPanel
'
){
result
.
push
(
params
.
defaultItems
[
i
]);
}
}
}
else
{
var
result
=
params
.
defaultItems
;
}
return
result
;
}
var
setupShipmentGrid
=
function
(
grid
)
{
if
(
grid
!=
null
)
{
grid
.
getContextMenuItems
=
$scope
.
getContextMenuItems
;
return
grid
;
}
};
$scope
.
getContextMenuItems
=
function
(
params
)
{
var
result
=
[];
if
(
utils
.
isUserInRole
(
$scope
.
currentUser
,
'
ROLE_shipping5.update
'
)
&&
params
.
node
!=
null
)
{
result
.
push
({
name
:
config
.
message
(
'
shipping.journal.datetimeOfSend
'
),
action
:
function
()
{
$scope
.
datetimeOfMeetPlanDialog
();
}
});
result
.
push
({
name
:
config
.
message
(
'
shipping.journal.datetimeOfMeet
'
),
action
:
function
()
{
$scope
.
datetimeOfMeetDialog
();
}
});
result
.
push
({
name
:
config
.
message
(
'
shipping.problems.dialogAdd.title
'
),
action
:
function
()
{
$scope
.
problemDialog
();
}
});
}
for
(
var
i
=
0
;
i
<
params
.
defaultItems
.
length
;
i
++
)
{
if
(
params
.
defaultItems
[
i
]
==
'
toolPanel
'
)
{
result
.
push
(
params
.
defaultItems
[
i
]);
}
}
return
result
;
}
utils
.
setupDateRangeValidation
(
$
(
'
#filterFromDate
'
),
$
(
'
#filterToDate
'
));
...
...
@@ -416,7 +409,7 @@ app.controller('ShippingCtrl', function($scope, $routeParams, $route,
resizable
:
false
});
};
$scope
.
datetimeOfMeetDialog
=
function
()
{
$scope
.
dateOfMeeting
=
$scope
.
shippingListApi
.
single
.
dateOfMeeting
;
...
...
@@ -432,7 +425,7 @@ app.controller('ShippingCtrl', function($scope, $routeParams, $route,
resizable
:
false
});
};
var
doAfterClose
=
function
(
callback
)
{
if
(
!
$scope
.
shippingListApi
.
single
.
dateClosed
)
{
dialogs
.
confirmation
(
config
.
message
(
'
shipping.dialog.close
'
)
+
"
"
+
(
$scope
.
shippingListApi
.
single
.
number
||
""
)
+
"
?
"
).
then
(
function
()
{
...
...
This diff is collapsed.
Click to expand it.
front/cdek_front/webapp/shipping/index.ftl
View file @
a783ab54
...
...
@@ -2,7 +2,6 @@
<#import "/spring.ftl" as spring />
<@components.index app="cdek">
<script src="/commons/javascripts/bootstrap/bootstrap-contextmenu.js"></script>
<script src="/shipping/application/route.js"></script>
<script src="/shipping/application/shipping.js"></script>
</@components.index>
...
...
This diff is collapsed.
Click to expand it.
front/cdek_front/webapp/shipping/shipping.ftl
View file @
a783ab54
...
...
@@ -661,6 +661,7 @@
<input placeholder="<@spring.message "warehouse.dateformat"/>"
type="text"
class="form-control"
data-date-format="DD.MM.YYYY HH:mm"
ng-model="dateOfMeeting">
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar datepickerbutton"></span>
...
...
@@ -677,18 +678,3 @@
<button type="button" class="btn btn-primary" ng-click="editDateOfMeeting()"><@spring.message "template.save"/></button>
</div>
</div>
<div id="shipmentContextMenu">
<ul class="dropdown-menu" role="menu">
<@security.authorize access="hasRole('ROLE_shipping5.update')">
<li>
<a tabindex="-1" ng-click="datetimeOfMeetPlanDialog()" translate><@spring.message "shipping.journal.datetimeOfSend"/></a>
</li>
<li>
<a tabindex="-1" ng-click="datetimeOfMeetDialog()" translate><@spring.message "shipping.journal.datetimeOfMeet"/></a>
</li>
<li>
<a tabindex="-1" ng-click="problemDialog()" translate><@spring.message "shipping.problems.dialogAdd.title"/></a>
</li>
</@security.authorize>
</ul>
</div>
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help