Commit 9afb4586 authored by Evren Kutar's avatar Evren Kutar

new link on index page & bower.json edit

parent 712c7ddf
......@@ -23,7 +23,7 @@ app.config(['$routeProvider', function ($routeProvider) {
})
.when('/student_add', {
templateUrl: 'components/student/student_add_template.html',
controller: 'StudentAddCtrl',
controller: 'StudentAddEditCtrl',
resolve: {
loadMyCtrl: ['$ocLazyLoad', function ($ocLazyLoad) {
return $ocLazyLoad.load('components/student/student_controller.js');
......
......@@ -18,11 +18,15 @@ var student = angular.module('zaerp.student.add', ['ngRoute', 'schemaForm', 'for
* to add student, provide form with form generator
*/
student.controller('StudentAddCtrl', function($scope, $http, $log, Generator, $routeParams){
student.controller('StudentAddEditCtrl', function($scope, $http, $log, Generator, $routeParams){
Generator.get_form('add_student', $routeParams).then(function(d){
$scope.schema = d.schema;
$scope.form = d.form;
// model is the init data of the form or in edit templates
$scope.model = {};
// for email validation add asyncvalidator
$scope.form[0].$asyncValidators = Generator.asyncValidators;
// add submit button to the form todo: move this to form service
$scope.form.push(
{
type: "submit",
......@@ -33,10 +37,8 @@ student.controller('StudentAddCtrl', function($scope, $http, $log, Generator, $r
$scope.onSubmit = function (form) {
$scope.$broadcast('schemaFormValidate');
if (form.$valid) {
$log.info(form);
}
else {
$log.info("not valid");
// todo: implement form diff here
$log.info($scope);
}
}
});
\ No newline at end of file
......@@ -51,7 +51,7 @@
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li class="active"><a href="#">Overview <span class="sr-only">(current)</span></a></li>
<li><a href="#">Reports</a></li>
<li><a href="#/student_add">New Student</a></li>
<li><a href="#">Analytics</a></li>
<li><a href="#">Export</a></li>
</ul>
......
......@@ -53,5 +53,12 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL) {
return deferred.promise;
}
};
generator.submit = function (form, $scope, $log) {
$scope.$broadcast('schemaFormValidate');
if (form.$valid) {
// todo: implement form diff here
$log.info($scope.model);
}
};
return generator;
});
\ No newline at end of file
{
"name": "angular-seed",
"description": "A starter project for AngularJS",
"version": "0.0.0",
"homepage": "https://github.com/angular/angular-seed",
"license": "MIT",
"private": true,
"name": "zaerp-ui",
"description": "UI project for ZAERP",
"version": "0.0.1",
"homepage": "https://github.com/zetaops/zaerp-ui",
"license": "GPL",
"private": false,
"dependencies": {
"angular": "1.4.x",
"angular-mocks": "1.4.x",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment