Commit a49cd6c0 authored by Evren Kutar's avatar Evren Kutar

dashboard check login fix

header and sidebar reload when login
parent 40ed53b7
......@@ -27,9 +27,77 @@ crud.controller('CRUDAddEditCtrl', function ($scope, $rootScope, $location, $htt
$scope.form_params['cmd'] = 'add';
}
$scope.today = function() {
$scope.dt = new Date();
};
$scope.today();
$scope.clear = function () {
$scope.dt = null;
};
// Disable weekend selection
$scope.disabled = function(date, mode) {
return ( mode === 'day' && ( date.getDay() === 0 || date.getDay() === 6 ) );
};
$scope.toggleMin = function() {
$scope.minDate = $scope.minDate ? null : new Date();
};
$scope.toggleMin();
$scope.maxDate = new Date(2020, 5, 22);
$scope.open = function() {
debugger;
$scope.status.opened = true;
};
$scope.dateOptions = {
formatYear: 'yy',
startingDay: 1,
initDate: new Date('01-01-1900')
};
$scope.format = 'dd.MM.yyyy';
$scope.status = {
opened: false
};
var tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
var afterTomorrow = new Date();
afterTomorrow.setDate(tomorrow.getDate() + 2);
$scope.events =
[
{
date: tomorrow,
status: 'full'
},
{
date: afterTomorrow,
status: 'partially'
}
];
$scope.getDayClass = function(date, mode) {
if (mode === 'day') {
var dayToCheck = new Date(date).setHours(0,0,0,0);
for (var i=0;i<$scope.events.length;i++){
var currentDay = new Date($scope.events[i].date).setHours(0,0,0,0);
if (dayToCheck === currentDay) {
return $scope.events[i].status;
}
}
}
return '';
};
// get form with generator
$scope.loaddata = function() {
console.log('loading data');
Generator.get_form($scope);
};
......@@ -48,6 +116,8 @@ crud.controller('CRUDAddEditCtrl', function ($scope, $rootScope, $location, $htt
});
}
};
console.log($scope);
});
/**
......
<div ng-app="ulakbus.dashboard">
<div class="starter-template">
<!-- table view -->
<table class="table table-bordered" style="background-color:#fff;">
<thead>
<table class="table table-bordered" style="background-color:#fff;">
<thead>
<tr>
<th colspan="2">
<label>
<input type="checkbox" style="zoom:1.5; margin:5px 0 0 8px;">
Hepsini Seç
</label>
</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
<th colspan="2">
<label>
<input type="checkbox" style="zoom:1.5; margin:5px 0 0 8px;">
Hepsini Seç
</label>
</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
</thead>
<tbody>
<tr>
<td width="60">
<label>
<input type="checkbox" style="zoom:1.5; margin:5px 0 0 8px;">
</label>
</td>
<th scope="row" style="text-align:center">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
<td width="60">
<label>
<input type="checkbox" style="zoom:1.5; margin:5px 0 0 8px;">
</label>
</td>
<th scope="row" style="text-align:center">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<td>
<label>
<input type="checkbox" style="zoom:1.5; margin:5px 0 0 8px;">
</label>
</td>
<th scope="row" style="text-align:center">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
<td>
<label>
<input type="checkbox" style="zoom:1.5; margin:5px 0 0 8px;">
</label>
</td>
<th scope="row" style="text-align:center">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<td>
<label>
<input type="checkbox" style="zoom:1.5; margin:5px 0 0 8px;">
</label>
</td>
<th scope="row" style="text-align:center">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
<td>
<label>
<input type="checkbox" style="zoom:1.5; margin:5px 0 0 8px;">
</label>
</td>
<th scope="row" style="text-align:center">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<td width="60">
<label>
<input type="checkbox" style="zoom:1.5; margin:5px 0 0 8px;">
</label>
</td>
<th scope="row" style="text-align:center">4</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
<td width="60">
<label>
<input type="checkbox" style="zoom:1.5; margin:5px 0 0 8px;">
</label>
</td>
<th scope="row" style="text-align:center">4</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<td>
<label>
<input type="checkbox" style="zoom:1.5; margin:5px 0 0 8px;">
</label>
</td>
<th scope="row" style="text-align:center">5</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
<td>
<label>
<input type="checkbox" style="zoom:1.5; margin:5px 0 0 8px;">
</label>
</td>
<th scope="row" style="text-align:center">5</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<td>
<label>
<input type="checkbox" style="zoom:1.5; margin:5px 0 0 8px;">
</label>
</td>
<th scope="row" style="text-align:center">6</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
<td>
<label>
<input type="checkbox" style="zoom:1.5; margin:5px 0 0 8px;">
</label>
</td>
<th scope="row" style="text-align:center">6</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</tbody>
</table>
<!-- end of table view -->
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
İşlemler <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="">İşlem 1</a></li>
<li><a href="">İşlem 2</a></li>
<li><a href="">İşlem 3</a></li>
<li role="separator" class="divider"></li>
<li><a href="">İşlem 4</a></li>
</ul>
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
İşlemler <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="">İşlem 1</a></li>
<li><a href="">İşlem 2</a></li>
<li><a href="">İşlem 3</a></li>
<li role="separator" class="divider"></li>
<li><a href="">İşlem 4</a></li>
</ul>
</div>
<hr>
</div>
......
......@@ -11,6 +11,7 @@
angular.module('ulakbus.dashboard', ['ngRoute'])
.controller('DashCtrl', function ($scope) {
.controller('DashCtrl', function ($scope, $rootScope, $location) {
if(!$rootScope.loggedInUser){$location.path("/login");}
$scope.testData = "<h1>This is main Dashboard</h1>";
});
\ No newline at end of file
......@@ -45,19 +45,12 @@
<header-notification></header-notification>
</nav>
<sidebar></sidebar>
<sidebar ng-if="$root.loggedInUser"></sidebar>
<div class="manager-view">
<div class="manager-view-inner">
<!-- manager-header -->
<div class="manager-view-header container-fluid">
<ul class="breadcrumb">
<li><a href="#">Personeller</a></li>
<li><a href="#">Liste</a></li>
<li class="active">Tablo</li>
</ul>
<button type="button" class="btn btn-primary">Kaydet</button>
</div>
<header-sub-menu ng-if="$root.loggedInUser"></header-sub-menu>
<!-- end of manager-header -->
<div class="manager-view-content">
<div class="row">
......@@ -76,15 +69,13 @@
<script src="bower_components/angular-cookies/angular-cookies.min.js"></script>
<script src="bower_components/angular-resource/angular-resource.min.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap.min.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.min.js"></script>
<script src="bower_components/tv4/tv4.js"></script>
<script src="bower_components/objectpath/lib/ObjectPath.js"></script>
<script src="bower_components/objectpath/lib/ObjectPath.js"></script>
<script src="bower_components/angular-schema-form/dist/schema-form.js"></script>
<script src="bower_components/angular-schema-form/dist/schema-form.min.js"></script>
<script src="bower_components/angular-schema-form/dist/bootstrap-decorator.min.js"></script>
<!--<script src="bower_components/angular-schema-form-datepicker/bootstrap-datepicker.min.js"></script>-->
<script src="bower_components/angular-gettext/dist/angular-gettext.min.js"></script>
......@@ -99,8 +90,8 @@
<script src="app.js"></script>
<script src="app_routes.js"></script>
<script src="shared/scripts/theme.js"></script>
<script src="shared/directives.js"></script>
<!--<script src="shared/scripts/theme.js"></script>-->
<script src="zetalib/interceptors.js"></script>
<script src="zetalib/general.js"></script>
<script src="zetalib/forms/form_service.js"></script>
......
......@@ -34,6 +34,14 @@ app.directive('headerNotification', function () {
}
});
app.directive('headerSubMenu', function () {
return {
templateUrl: 'shared/templates/directives/header-sub-menu.html',
restrict: 'E',
replace: true,
}
});
app.directive('sidebar', ['$location', function () {
return {
templateUrl: 'shared/templates/directives/sidebar.html',
......
<div class="form-group schema-form-{{form.type}} {{form.htmlClass}}"
ng-class="{'has-error': form.disableErrorState !== true && hasError(), 'has-success': form.disableSuccessState !== true && hasSuccess(), 'has-feedback': form.feedback !== false }">
<label class="control-label {{form.labelHtmlClass}}" ng-class="{'sr-only': !showTitle()}"
for="{{form.key.slice(-1)[0]}}">{{form.title}}</label>
<p class="input-group">
<input ng-if="!form.fieldAddonLeft && !form.fieldAddonRight"
ng-show="form.key"
step="any"
sf-changed="form"
placeholder="{{form.placeholder}}"
class="form-control {{form.fieldHtmlClass}}"
id="{{form.key.slice(-1)[0]}}"
ng-model-options="form.ngModelOptions"
ng-model="dt"
ng-disabled="form.readonly"
schema-validate="form"
name="{{form.key.slice(-1)[0]}}"
aria-describedby="{{form.key.slice(-1)[0] + 'Status'}}"
type="date"
datepicker-popup
is-open="status.opened"
datepicker-options="dateOptions"
date-disabled="disabled(date, mode)"
close-text="Close"/>
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open($event)">
<i class="glyphicon glyphicon-calendar"></i>
</button>
</span>
</p>
<!--<input ng-if="!form.fieldAddonLeft && !form.fieldAddonRight"-->
<!--ng-show="form.key"-->
<!--type="{{form.type}}"-->
<!--step="any"-->
<!--sf-changed="form"-->
<!--placeholder="{{form.placeholder}}"-->
<!--class="form-control {{form.fieldHtmlClass}}"-->
<!--id="{{form.key.slice(-1)[0]}}"-->
<!--ng-model-options="form.ngModelOptions"-->
<!--ng-model="$$value$$"-->
<!--ng-disabled="form.readonly"-->
<!--schema-validate="form"-->
<!--name="{{form.key.slice(-1)[0]}}"-->
<!--aria-describedby="{{form.key.slice(-1)[0] + 'Status'}}">-->
<div ng-if="form.fieldAddonLeft || form.fieldAddonRight"
ng-class="{'input-group': (form.fieldAddonLeft || form.fieldAddonRight)}">
<span ng-if="form.fieldAddonLeft"
class="input-group-addon"
ng-bind-html="form.fieldAddonLeft"></span>
<input ng-show="form.key"
type="{{form.type}}"
step="any"
sf-changed="form"
placeholder="{{form.placeholder}}"
class="form-control {{form.fieldHtmlClass}}"
id="{{form.key.slice(-1)[0]}}"
ng-model-options="form.ngModelOptions"
ng-model="$$value$$"
ng-disabled="form.readonly"
schema-validate="form"
name="{{form.key.slice(-1)[0]}}"
aria-describedby="{{form.key.slice(-1)[0] + 'Status'}}">
<span ng-if="form.fieldAddonRight"
class="input-group-addon"
ng-bind-html="form.fieldAddonRight"></span>
</div>
<span ng-if="form.feedback !== false"
class="form-control-feedback"
ng-class="evalInScope(form.feedback) || {'glyphicon': true, 'glyphicon-ok': hasSuccess(), 'glyphicon-remove': hasError() }"
aria-hidden="true"></span>
<span ng-if="hasError() || hasSuccess()"
id="{{form.key.slice(-1)[0] + 'Status'}}"
class="sr-only">{{ hasSuccess() ? '(success)' : '(error)' }}</span>
<div class="help-block" sf-message="form.description"></div>
</div>
<div class="manager-view-header container-fluid">
<ul class="breadcrumb">
<li><a href="#">Personeller</a></li>
<li><a href="#">Liste</a></li>
<li class="active">Tablo</li>
</ul>
<button type="button" class="btn btn-primary">Kaydet</button>
</div>
\ No newline at end of file
......@@ -30,16 +30,84 @@ form_generator.factory('Generator', function ($http, $q, $log, $modal, $timeout,
// todo: make datepicker work below
if (k.type == 'date') {
k.type = "string";
//k.templateUrl = "shared/templates/datefield.html";
//scope.form[scope.form.indexOf(v)] = {
// "key": k.name,
// "minDate": "1995-09-01",
// "maxDate": new Date(),
// "format": "yyyy-mm-dd"
//}
// clear default value todo: make it in backend
scope.model[v] = null;
k.title= k.title;
scope.form[scope.form.indexOf(v)] = {
"type": "template",
"templateUrl": "shared/templates/datefield.html",
"title": k.title,
"key": k.name,
};
var parentScope = scope.$parent.$parent.$parent.$parent;
debugger;
scope.today = function() {
scope.dt = new Date();
};
scope.today();
scope.clear = function () {
scope.dt = null;
};
// Disable weekend selection
scope.disabled = function(date, mode) {
return ( mode === 'day' && ( date.getDay() === 0 || date.getDay() === 6 ) );
};
scope.toggleMin = function() {
scope.minDate = scope.minDate ? null : new Date();
};
scope.toggleMin();
scope.maxDate = new Date(2020, 5, 22);
scope.open = function($event) {
debugger;
scope.status.opened = true;
};
scope.dateOptions = {
formatYear: 'yy',
startingDay: 1,
initDate: new Date('01-01-1900')
};
scope.format = 'dd.MM.yyyy';
scope.status = {
opened: false
};
var tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
var afterTomorrow = new Date();
afterTomorrow.setDate(tomorrow.getDate() + 2);
scope.events =
[
{
date: tomorrow,
status: 'full'
},
{
date: afterTomorrow,
status: 'partially'
}
];
scope.getDayClass = function(date, mode) {
if (mode === 'day') {
var dayToCheck = new Date(date).setHours(0,0,0,0);
for (var i=0;i<$scope.events.length;i++){
var currentDay = new Date($scope.events[i].date).setHours(0,0,0,0);
if (dayToCheck === currentDay) {
return $scope.events[i].status;
}
}
}
return '';
};
}
if (k.type == 'int') {
......
......@@ -25,7 +25,7 @@ app.config(['$httpProvider', function ($httpProvider) {
'response': function (response) {
//Will only be called for HTTP up to 300
if(response.data.is_login===true){
//$rootScope.loggedInUser = response.data.is_login;
$rootScope.loggedInUser = response.data.is_login;
//$location.replace();
if($location.path()==="/login"){
$location.path("/dashboard");
......@@ -42,6 +42,7 @@ app.config(['$httpProvider', function ($httpProvider) {
$location.reload();
}
if(rejection.status === 401) {
$rootScope.loggedInUser = response.data.is_login;
if($location.path()==="/login"){
console.log("show errors on login form");
} else{
......
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