Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
ulakbus-ui
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ulakbus
ulakbus-ui
Commits
ee23a6e8
Commit
ee23a6e8
authored
Jul 08, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
submit fix form
bower json dependencies
parent
31af5bec
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
15 deletions
+21
-15
staff_controller.js
app/components/staff/staff_controller.js
+10
-6
form_service.js
app/zetalib/forms/form_service.js
+2
-2
interceptors.js
app/zetalib/interceptors.js
+8
-6
bower.json
bower.json
+1
-1
No files found.
app/components/staff/staff_controller.js
View file @
ee23a6e8
...
...
@@ -12,7 +12,7 @@ var staff = angular.module('zaerp.staff', ['ngRoute', 'schemaForm', 'formService
/**
* StaffCtrl is a controller
* Staff
AddEdit
Ctrl is a controller
* which provide a form with form generator.
*/
...
...
@@ -40,6 +40,7 @@ var staff = angular.module('zaerp.staff', ['ngRoute', 'schemaForm', 'formService
//});
staff
.
controller
(
'StaffAddEditCtrl'
,
function
(
$scope
,
$http
,
$log
,
Generator
,
$routeParams
)
{
$scope
.
url
=
'personel_duzenle_basitlestirilmis'
;
var
form_params
=
{};
if
(
$routeParams
.
id
){
form_params
[
'id'
]
=
$routeParams
.
id
;
...
...
@@ -48,11 +49,11 @@ staff.controller('StaffAddEditCtrl', function ($scope, $http, $log, Generator, $
else
{
form_params
[
'cmd'
]
=
'add_object'
;
}
Generator
.
get_form
(
'personel_duzenle_basitlestirilmis'
,
form_params
).
then
(
function
(
data
)
{
Generator
.
get_form
(
$scope
.
url
,
form_params
).
then
(
function
(
data
)
{
var
d
=
data
.
data
.
forms
;
$scope
.
schema
=
d
.
schema
;
$scope
.
form
=
d
.
form
;
$scope
.
form
.
push
({
"key"
:
"birth_date"
,
"format"
:
"yyyy-mm-dd"
});
//
$scope.form.push({"key": "birth_date", "format": "yyyy-mm-dd"});
$scope
.
model
=
d
.
model
?
d
.
model
:
{};
$scope
.
initialModel
=
angular
.
copy
(
d
.
model
);
//$scope.form.push($asyncValidators: Generator.asyncValidators);
...
...
@@ -68,17 +69,20 @@ staff.controller('StaffAddEditCtrl', function ($scope, $http, $log, Generator, $
$scope
.
onSubmit
=
function
(
form
)
{
$scope
.
$broadcast
(
'schemaFormValidate'
);
if
(
form
.
$valid
)
{
Generator
.
submit
(
'edit_staff'
,
$scope
);
Generator
.
submit
(
$scope
);
}
}
});
// todo: for single point of failure code a "get item" service and use it to
// retrieve list and single item
/**
* Staff List Controller
*/
staff
.
controller
(
'StaffListCtrl'
,
function
(
$scope
,
$http
){
$http
.
ge
t
(
'personel_duzenle_basitlestirilmis'
).
then
(
function
(
res
){
$http
.
pos
t
(
'personel_duzenle_basitlestirilmis'
).
then
(
function
(
res
){
$scope
.
staffs
=
res
.
data
;
})
});
...
...
@@ -87,7 +91,7 @@ staff.controller('StaffListCtrl', function($scope, $http){
* Staff Show Controller
*/
staff
.
controller
(
'StaffShowCtrl'
,
function
(
$scope
,
$http
,
$routeParams
){
$http
.
get
(
'http://127.0.0.1:3000/api/list_staff/
'
).
then
(
function
(
res
){
$http
.
post
(
'personel_duzenle_basitlestirilmis
'
).
then
(
function
(
res
){
$scope
.
staff
=
res
.
data
[
0
];
})
});
\ No newline at end of file
app/zetalib/forms/form_service.js
View file @
ee23a6e8
...
...
@@ -42,10 +42,10 @@ form_generator.factory('Generator', function ($http, $q, $log, $timeout, RESTURL
return
deferred
.
promise
;
}
};
generator
.
submit
=
function
(
url
,
$scope
)
{
generator
.
submit
=
function
(
$scope
)
{
var
get_diff
=
FormDiff
.
get_diff
(
$scope
.
model
,
$scope
.
initialModel
);
$log
.
info
(
get_diff
);
$http
.
post
(
RESTURL
.
url
+
url
,
get_diff
).
then
(
function
(
res
)
{
$http
.
post
(
RESTURL
.
url
+
$scope
.
url
,
get_diff
).
then
(
function
(
res
)
{
// todo: for now fake rest api returns 'ok' no data to
// manipulate on ui. therefor used just a log
$log
.
info
(
res
);
...
...
app/zetalib/interceptors.js
View file @
ee23a6e8
...
...
@@ -25,13 +25,11 @@ app.config(['$httpProvider', function ($httpProvider) {
//Will only be called for HTTP up to 300
if
(
response
.
data
.
is_login
){
$rootScope
.
loggedInUser
=
response
.
data
.
is_login
;
console
.
log
(
"login"
,
response
.
data
.
is_login
);
$location
.
path
(
"/dashboard"
);
//$location.path("/dashboard");
}
if
(
response
.
screen
)
{
$location
.
path
(
response
.
screen
);
if
(
response
.
data
.
screen
)
{
$location
.
path
(
response
.
data
.
screen
);
}
console
.
log
(
"login"
,
response
);
return
response
;
},
'responseError'
:
function
(
rejection
)
{
...
...
@@ -40,7 +38,11 @@ app.config(['$httpProvider', function ($httpProvider) {
$location
.
reload
();
}
if
(
rejection
.
status
===
401
)
{
$location
.
path
(
'/login'
);
if
(
$location
.
path
()
===
"/login"
){
console
.
log
(
"show errors on login form"
);
}
else
{
$location
.
path
(
'/login'
);
}
}
return
$q
.
reject
(
rejection
);
}
...
...
bower.json
View file @
ee23a6e8
...
...
@@ -6,7 +6,7 @@
"license"
:
"GPL"
,
"private"
:
false
,
"dependencies"
:
{
"angular"
:
"1.4.
x
"
,
"angular"
:
"1.4.
1
"
,
"angular-mocks"
:
"1.4.x"
,
"angular-route"
:
"1.4.x"
,
"angular-resource"
:
"1.4.x"
,
...
...
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