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
2402d6fd
Commit
2402d6fd
authored
Jul 09, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
redirect to list page after save
parent
1769017f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
10 deletions
+22
-10
staff_controller.js
app/components/staff/staff_controller.js
+8
-2
form_service.js
app/zetalib/forms/form_service.js
+14
-8
No files found.
app/components/staff/staff_controller.js
View file @
2402d6fd
...
@@ -16,7 +16,7 @@ var staff = angular.module('zaerp.staff', ['ngRoute', 'schemaForm', 'formService
...
@@ -16,7 +16,7 @@ var staff = angular.module('zaerp.staff', ['ngRoute', 'schemaForm', 'formService
* which provide a form with form generator.
* which provide a form with form generator.
*/
*/
staff
.
controller
(
'StaffAddEditCtrl'
,
function
(
$scope
,
$rootScope
,
$http
,
$log
,
Generator
,
$routeParams
)
{
staff
.
controller
(
'StaffAddEditCtrl'
,
function
(
$scope
,
$rootScope
,
$
location
,
$
http
,
$log
,
Generator
,
$routeParams
)
{
$scope
.
url
=
'personel_duzenle_basitlestirilmis'
;
$scope
.
url
=
'personel_duzenle_basitlestirilmis'
;
var
form_params
=
{};
var
form_params
=
{};
if
(
$routeParams
.
id
)
{
if
(
$routeParams
.
id
)
{
...
@@ -45,7 +45,13 @@ staff.controller('StaffAddEditCtrl', function ($scope, $rootScope, $http, $log,
...
@@ -45,7 +45,13 @@ staff.controller('StaffAddEditCtrl', function ($scope, $rootScope, $http, $log,
$scope
.
onSubmit
=
function
(
form
)
{
$scope
.
onSubmit
=
function
(
form
)
{
$scope
.
$broadcast
(
'schemaFormValidate'
);
$scope
.
$broadcast
(
'schemaFormValidate'
);
if
(
form
.
$valid
)
{
if
(
form
.
$valid
)
{
Generator
.
submit
(
$scope
);
Generator
.
submit
(
$scope
)
.
success
(
function
(
data
){
$location
.
path
(
"/staffs"
);
})
.
error
(
function
(
data
){
$scope
.
message
=
data
.
title
;
});
}
}
}
}
});
});
...
...
app/zetalib/forms/form_service.js
View file @
2402d6fd
...
@@ -9,7 +9,7 @@ var form_generator = angular.module('formService', ['general']);
...
@@ -9,7 +9,7 @@ var form_generator = angular.module('formService', ['general']);
form_generator
.
factory
(
'Generator'
,
function
(
$http
,
$q
,
$log
,
$timeout
,
RESTURL
,
FormDiff
)
{
form_generator
.
factory
(
'Generator'
,
function
(
$http
,
$q
,
$log
,
$timeout
,
RESTURL
,
FormDiff
)
{
var
generator
=
{};
var
generator
=
{};
generator
.
makeUrl
=
function
(
url
)
{
generator
.
makeUrl
=
function
(
url
)
{
return
RESTURL
.
url
+
url
;
return
RESTURL
.
url
+
url
;
};
};
generator
.
generate
=
function
(
modelObject
)
{
generator
.
generate
=
function
(
modelObject
)
{
...
@@ -44,18 +44,24 @@ form_generator.factory('Generator', function ($http, $q, $log, $timeout, RESTURL
...
@@ -44,18 +44,24 @@ form_generator.factory('Generator', function ($http, $q, $log, $timeout, RESTURL
}
}
};
};
generator
.
submit
=
function
(
$scope
)
{
generator
.
submit
=
function
(
$scope
)
{
if
(
$scope
.
object_id
)
{
if
(
$scope
.
object_id
)
{
var
get_diff
=
FormDiff
.
get_diff
(
$scope
.
model
,
$scope
.
initialModel
);
var
get_diff
=
FormDiff
.
get_diff
(
$scope
.
model
,
$scope
.
initialModel
);
var
data
=
{
"object_id"
:
$scope
.
object_id
,
"form"
:
get_diff
,
"cmd"
:
"do"
};
var
data
=
{
"object_id"
:
$scope
.
object_id
,
"form"
:
get_diff
,
"cmd"
:
"do"
};
}
}
else
{
else
{
data
=
{
"form"
:
$scope
.
model
,
"cmd"
:
"do"
};
data
=
{
"form"
:
$scope
.
model
,
"cmd"
:
"do"
};
}
}
$http
.
post
(
generator
.
makeUrl
(
$scope
.
url
),
data
).
then
(
function
(
res
)
{
return
$http
// todo: for now fake rest api returns 'ok' no data to
.
post
(
generator
.
makeUrl
(
$scope
.
url
),
data
)
// manipulate on ui. therefor used just a log
//.then(function (res) {
$log
.
info
(
res
);
// // todo: for now fake rest api returns 'ok' no data to
});
// // manipulate on ui. therefor used just a log
// $log.info(res);
//});
};
};
return
generator
;
return
generator
;
});
});
\ 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