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
d5328b2b
Commit
d5328b2b
authored
Dec 02, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resolves #21
fix: when refresh 500 error (route cmd wrong)
parent
08d077a5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
65 additions
and
80 deletions
+65
-80
crud_controller.js
app/components/crud/crud_controller.js
+1
-1
foreignKey.html
app/shared/templates/foreignKey.html
+2
-6
multiselect.html
app/shared/templates/multiselect.html
+15
-17
form_service.js
app/zetalib/form_service.js
+28
-31
app.js
dist/app.js
+2
-2
templates.js
dist/templates.js
+17
-23
No files found.
app/components/crud/crud_controller.js
View file @
d5328b2b
...
@@ -39,7 +39,7 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
...
@@ -39,7 +39,7 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
}
}
});
});
scope
.
form_params
=
{
scope
.
form_params
=
{
cmd
:
cmd
,
//
cmd: cmd,
model
:
routeParams
.
model
,
model
:
routeParams
.
model
,
param
:
scope
.
param
||
routeParams
.
param
,
param
:
scope
.
param
||
routeParams
.
param
,
id
:
scope
.
param_id
||
routeParams
.
param_id
,
id
:
scope
.
param_id
||
routeParams
.
param_id
,
...
...
app/shared/templates/foreignKey.html
View file @
d5328b2b
<div
class=
"form-group {{form.htmlClass}} schema-form-select col-md-12"
<div
class=
"form-group {{form.htmlClass}} schema-form-select col-md-12"
ng-class=
"{'has-error': form.disableErrorState !== true && hasError(), 'has-success': form.disableSuccessState !== true && hasSuccess(), 'has-feedback': form.feedback !== false}"
>
ng-class=
"{'has-error': form.disableErrorState !== true && hasError(), 'has-success': form.disableSuccessState !== true && hasSuccess(), 'has-feedback': form.feedback !== false}"
>
<div
class=
"col-md-
8
"
>
<div
class=
"col-md-
12
"
>
<label
class=
"control-label {{form.labelHtmlClass}}"
ng-show=
"showTitle()"
>
<label
class=
"control-label {{form.labelHtmlClass}}"
ng-show=
"showTitle()"
>
{{form.title}}
{{form.title}}
</label>
</label>
<a><i
class=
"fa fa-plus-circle fa-fw"
add-modal-for-linked-model=
"{{form.formName}}"
></i></a>
<div
class=
"form-group input-group"
>
<div
class=
"form-group input-group"
>
<span
class=
"input-group-btn"
>
<span
class=
"input-group-btn"
>
...
@@ -43,9 +44,4 @@
...
@@ -43,9 +44,4 @@
<div
class=
"help-block"
sf-message=
"form.description"
></div>
<div
class=
"help-block"
sf-message=
"form.description"
></div>
</div>
</div>
<div
class=
"col-md-4"
>
<a
href=
"javascript:void(0);"
add-modal-for-linked-model=
"{{form.formName}}"
>
<i
class=
"fa fa-plus-circle fa-fw"
></i>
</a>
</div>
</div>
</div>
\ No newline at end of file
app/shared/templates/multiselect.html
View file @
d5328b2b
<div
class=
"form-group {{form.htmlClass}} schema-form-select col-md-12"
<div
class=
"form-group {{form.htmlClass}} schema-form-select col-md-12"
ng-class=
"{'has-error': form.disableErrorState !== true && hasError(), 'has-success': form.disableSuccessState !== true && hasSuccess(), 'has-feedback': form.feedback !== false}"
>
ng-class=
"{'has-error': form.disableErrorState !== true && hasError(), 'has-success': form.disableSuccessState !== true && hasSuccess(), 'has-feedback': form.feedback !== false}"
>
<div
class=
"col-md-
8
"
>
<div
class=
"col-md-
12
"
>
<label
class=
"control-label {{form.labelHtmlClass}}"
ng-show=
"showTitle()"
>
<label
class=
"control-label {{form.labelHtmlClass}}"
ng-show=
"showTitle()"
>
{{form.title}}
{{form.title}}
</label>
</label>
<a><i
class=
"fa fa-plus-circle fa-fw"
add-modal-for-linked-model=
"{{form.formName}}"
></i></a>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"
form-group input-group
"
>
<div
class=
"
col-md-12
"
>
<input
type=
"text"
<input
type=
"text"
placeholder=
"{{form.title}} filtrele"
placeholder=
"{{form.title}} filtrele"
class=
"form-control {{form.fieldHtmlClass}}"
class=
"form-control {{form.fieldHtmlClass}}"
name=
"filter-interface"
name=
"filter-interface"
ng-model=
"form.filterValue"
ng-model=
"form.filterValue"
ng-keyup=
"form.appendFiltered(form.filterValue)"
ng-keyup=
"form.appendFiltered(form.filterValue)"
/>
/>
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<div
class=
"col-md-5"
>
<label
for=
"filterItems"
>
{{form.title}} Liste
</label>
<label
for=
"filterItems"
>
{{form.title}} Liste
</label>
<select
ng-model=
"selectedItemsModel"
<select
ng-model=
"selectedItemsModel"
value=
"$$value$$"
value=
"$$value$$"
...
@@ -31,13 +30,12 @@
...
@@ -31,13 +30,12 @@
</select>
</select>
</div>
</div>
<div
class=
"col-md-12 text-center"
>
<div
class=
"col-md-1"
>
<a><i
class=
"fa fa-arrow-down fa-fw"
ng-click=
"form.select(selectedItemsModel)"
></i></a>
<a
href=
"javascript:void(0)"
ng-click=
"form.select(selectedItemsModel)"
><i
class=
"fa fa-arrow-right fa-fw"
></i></a><br>
<a><i
class=
"fa fa-arrow-up fa-fw"
ng-click=
"form.deselect(selectedFilteredItemsModel)"
></i></a>
<a
href=
"javascript:void(0)"
ng-click=
"form.deselect(selectedFilteredItemsModel)"
><i
class=
"fa fa-arrow-left fa-fw"
></i></a>
</div>
</div>
<div
class=
"col-md-
5
"
>
<div
class=
"col-md-
12
"
>
<label
for=
"selectedItems"
>
Seçilenler
</label>
<label
for=
"selectedItems"
>
Seçilenler
</label>
<select
ng-model=
"selectedFilteredItemsModel"
<select
ng-model=
"selectedFilteredItemsModel"
value=
"$$value$$"
value=
"$$value$$"
...
@@ -54,9 +52,9 @@
...
@@ -54,9 +52,9 @@
<div
class=
"help-block"
sf-message=
"form.description"
></div>
<div
class=
"help-block"
sf-message=
"form.description"
></div>
</div>
</div>
<
div
class=
"col-md-4"
>
<
!--<div class="col-md-4">--
>
<
a
href=
"javascript:void(0);"
add-modal-for-linked-model
>
<
!--<a href="javascript:void(0);" add-modal-for-linked-model>--
>
<
i
class=
"fa fa-plus-circle fa-fw"
></i
>
<
!--<i class="fa fa-plus-circle fa-fw"></i>--
>
<
/a
>
<
!--</a>--
>
<
/div
>
<
!--</div>--
>
</div>
</div>
\ No newline at end of file
app/zetalib/form_service.js
View file @
d5328b2b
...
@@ -31,7 +31,6 @@ angular.module('formService', ['ui.bootstrap'])
...
@@ -31,7 +31,6 @@ angular.module('formService', ['ui.bootstrap'])
*/
*/
generator
.
makeUrl
=
function
(
scope
)
{
generator
.
makeUrl
=
function
(
scope
)
{
var
getparams
=
scope
.
form_params
.
param
?
"?"
+
scope
.
form_params
.
param
+
"="
+
scope
.
form_params
.
id
:
""
;
var
getparams
=
scope
.
form_params
.
param
?
"?"
+
scope
.
form_params
.
param
+
"="
+
scope
.
form_params
.
id
:
""
;
//return RESTURL.url + scope.url + '/' + (scope.form_params.model || '') + getparams;
return
RESTURL
.
url
+
scope
.
url
+
getparams
;
return
RESTURL
.
url
+
scope
.
url
+
getparams
;
};
};
/**
/**
...
@@ -71,10 +70,6 @@ angular.module('formService', ['ui.bootstrap'])
...
@@ -71,10 +70,6 @@ angular.module('formService', ['ui.bootstrap'])
scope
.
object_id
=
scope
.
form_params
.
object_id
;
scope
.
object_id
=
scope
.
form_params
.
object_id
;
// showSaveButton is used for to show or not to show save button on top of the page
// here change to true because the view retrieves form from api
$rootScope
.
showSaveButton
=
true
;
$log
.
debug
(
'scope at after generate'
,
scope
);
$log
.
debug
(
'scope at after generate'
,
scope
);
return
scope
;
return
scope
;
};
};
...
@@ -100,9 +95,6 @@ angular.module('formService', ['ui.bootstrap'])
...
@@ -100,9 +95,6 @@ angular.module('formService', ['ui.bootstrap'])
*/
*/
generator
.
prepareFormItems
=
function
(
scope
)
{
generator
.
prepareFormItems
=
function
(
scope
)
{
//scope.schema.properties.Permissions ? scope.schema.properties.Permissions['widget']='filter_interface':true;
// todo: remove after backend fix
angular
.
forEach
(
scope
.
form
,
function
(
value
,
key
)
{
angular
.
forEach
(
scope
.
form
,
function
(
value
,
key
)
{
if
(
value
.
type
===
'select'
)
{
if
(
value
.
type
===
'select'
)
{
scope
.
schema
.
properties
[
value
.
key
].
type
=
'select'
;
scope
.
schema
.
properties
[
value
.
key
].
type
=
'select'
;
...
@@ -185,9 +177,6 @@ angular.module('formService', ['ui.bootstrap'])
...
@@ -185,9 +177,6 @@ angular.module('formService', ['ui.bootstrap'])
//var buttonsToTop = angular.element(document.querySelector('.' + buttonClass));
//var buttonsToTop = angular.element(document.querySelector('.' + buttonClass));
//angular.element(document.querySelector(selectorTop)).append(buttonsToTop);
//angular.element(document.querySelector(selectorTop)).append(buttonsToTop);
$log
.
debug
(
selectorBottom
,
buttonsToBottom
);
$log
.
debug
(
angular
.
element
(
document
.
querySelector
(
selectorBottom
)));
buttonsToBottom
.
removeClass
(
'hide'
);
buttonsToBottom
.
removeClass
(
'hide'
);
//buttonsToTop.removeClass('hide');
//buttonsToTop.removeClass('hide');
});
});
...
@@ -201,9 +190,9 @@ angular.module('formService', ['ui.bootstrap'])
...
@@ -201,9 +190,9 @@ angular.module('formService', ['ui.bootstrap'])
'dateNotValid'
:
"Girdiğiniz tarih geçerli değildir. <i>orn: '01.01.2015'<i/>"
'dateNotValid'
:
"Girdiğiniz tarih geçerli değildir. <i>orn: '01.01.2015'<i/>"
},
},
$asyncValidators
:
{
$asyncValidators
:
{
'dateNotValid'
:
function
(
value
)
{
'dateNotValid'
:
function
(
value
)
{
var
deferred
=
$q
.
defer
();
var
deferred
=
$q
.
defer
();
$timeout
(
function
()
{
$timeout
(
function
()
{
if
(
isNaN
(
Date
.
parse
(
value
))
||
value
.
split
(
'.'
).
length
!==
3
)
{
if
(
isNaN
(
Date
.
parse
(
value
))
||
value
.
split
(
'.'
).
length
!==
3
)
{
deferred
.
reject
();
deferred
.
reject
();
}
else
{
}
else
{
...
@@ -329,24 +318,25 @@ angular.module('formService', ['ui.bootstrap'])
...
@@ -329,24 +318,25 @@ angular.module('formService', ['ui.bootstrap'])
"name"
:
item
.
value
"name"
:
item
.
value
});
});
}
}
// get selected item from titleMap using model value
if
(
item
.
key
===
scope
.
model
[
k
])
{
formitem
.
selected_item
=
{
value
:
item
.
key
,
name
:
item
.
value
};
}
});
});
// after rendering change input value to model value
formitem
.
filteredItems
=
generator
.
get_diff_array
(
angular
.
copy
(
formitem
.
titleMap
),
angular
.
copy
(
formitem
.
selectedFilteredItems
));
scope
.
$watch
(
document
.
querySelector
(
'input[name='
+
v
.
model_name
+
']'
),
function
()
{
angular
.
element
(
document
.
querySelector
(
'input[name='
+
v
.
model_name
+
']'
)).
val
(
formitem
.
selected_item
.
name
);
}
);
})
})
};
};
var
modelItems
=
[];
angular
.
forEach
(
scope
.
model
[
k
],
function
(
value
,
mkey
)
{
modelItems
.
push
({
"value"
:
value
[
v
.
schema
[
0
].
name
].
key
,
"name"
:
value
[
v
.
schema
[
0
].
name
].
unicode
})
});
formitem
=
{
formitem
=
{
type
:
"template"
,
type
:
"template"
,
templateUrl
:
"shared/templates/multiselect.html"
,
templateUrl
:
"shared/templates/multiselect.html"
,
title
:
v
.
title
,
title
:
v
.
title
,
// formName will be used in modal return to save item on form
formName
:
k
,
wf
:
v
.
wf
,
wf
:
v
.
wf
,
add_cmd
:
v
.
add_cmd
,
add_cmd
:
v
.
add_cmd
,
name
:
v
.
model_name
,
name
:
v
.
model_name
,
...
@@ -354,7 +344,7 @@ angular.module('formService', ['ui.bootstrap'])
...
@@ -354,7 +344,7 @@ angular.module('formService', ['ui.bootstrap'])
filterValue
:
''
,
filterValue
:
''
,
selected_item
:
{},
selected_item
:
{},
filteredItems
:
[],
filteredItems
:
[],
selectedFilteredItems
:
[]
,
selectedFilteredItems
:
modelItems
,
titleMap
:
scope
.
generateTitleMap
(
modelScope
),
titleMap
:
scope
.
generateTitleMap
(
modelScope
),
onSelect
:
function
(
item
)
{
onSelect
:
function
(
item
)
{
scope
.
model
[
k
]
=
item
.
value
;
scope
.
model
[
k
]
=
item
.
value
;
...
@@ -364,8 +354,8 @@ angular.module('formService', ['ui.bootstrap'])
...
@@ -364,8 +354,8 @@ angular.module('formService', ['ui.bootstrap'])
jQuery
(
'input[name='
+
inputname
+
']'
).
val
(
item
.
name
);
jQuery
(
'input[name='
+
inputname
+
']'
).
val
(
item
.
name
);
},
},
appendFiltered
:
function
(
filterValue
)
{
appendFiltered
:
function
(
filterValue
)
{
formitem
.
filteredItems
=
[];
if
(
filterValue
.
length
>
2
)
{
if
(
filterValue
.
length
>
2
)
{
formitem
.
filteredItems
=
[];
angular
.
forEach
(
formitem
.
titleMap
,
function
(
value
,
key
)
{
angular
.
forEach
(
formitem
.
titleMap
,
function
(
value
,
key
)
{
if
(
value
.
name
.
indexOf
(
filterValue
)
>
-
1
)
{
if
(
value
.
name
.
indexOf
(
filterValue
)
>
-
1
)
{
formitem
.
filteredItems
.
push
(
formitem
.
titleMap
[
key
]);
formitem
.
filteredItems
.
push
(
formitem
.
titleMap
[
key
]);
...
@@ -375,13 +365,16 @@ angular.module('formService', ['ui.bootstrap'])
...
@@ -375,13 +365,16 @@ angular.module('formService', ['ui.bootstrap'])
formitem
.
filteredItems
=
generator
.
get_diff_array
(
formitem
.
filteredItems
,
formitem
.
selectedFilteredItems
);
formitem
.
filteredItems
=
generator
.
get_diff_array
(
formitem
.
filteredItems
,
formitem
.
selectedFilteredItems
);
},
},
select
:
function
(
selectedItemsModel
)
{
select
:
function
(
selectedItemsModel
)
{
if
(
!
selectedItemsModel
){
return
;}
formitem
.
selectedFilteredItems
=
formitem
.
selectedFilteredItems
.
concat
(
selectedItemsModel
);
formitem
.
selectedFilteredItems
=
formitem
.
selectedFilteredItems
.
concat
(
selectedItemsModel
);
formitem
.
appendFiltered
(
formitem
.
filterValue
);
formitem
.
appendFiltered
(
formitem
.
filterValue
);
scope
.
model
[
k
]
=
formitem
.
dataToModel
(
selectedItemsModel
);
scope
.
model
[
k
]
=
formitem
.
dataToModel
(
selectedItemsModel
);
},
},
deselect
:
function
(
selectedFilteredItemsModel
)
{
deselect
:
function
(
selectedFilteredItemsModel
)
{
formitem
.
selectedFilteredItems
=
generator
.
get_diff_array
(
formitem
.
selectedFilteredItems
,
selectedFilteredItemsModel
);
if
(
!
selectedFilteredItemsModel
){
return
;}
formitem
.
selectedFilteredItems
=
generator
.
get_diff_array
(
angular
.
copy
(
formitem
.
selectedFilteredItems
),
angular
.
copy
(
selectedFilteredItemsModel
));
formitem
.
appendFiltered
(
formitem
.
filterValue
);
formitem
.
appendFiltered
(
formitem
.
filterValue
);
formitem
.
filteredItems
=
formitem
.
filteredItems
.
concat
(
selectedFilteredItemsModel
);
scope
.
model
[
k
]
=
formitem
.
dataToModel
(
formitem
.
selectedFilteredItems
);
scope
.
model
[
k
]
=
formitem
.
dataToModel
(
formitem
.
selectedFilteredItems
);
},
},
dataToModel
:
function
(
data
)
{
dataToModel
:
function
(
data
)
{
...
@@ -621,8 +614,6 @@ angular.module('formService', ['ui.bootstrap'])
...
@@ -621,8 +614,6 @@ angular.module('formService', ['ui.bootstrap'])
else
{
else
{
$location
.
path
(
pathUrl
);
$location
.
path
(
pathUrl
);
}
}
$log
.
debug
(
'pathDecider scope'
,
scope
);
}
}
// client_cmd can be in ['list', 'form', 'show', 'reload', 'reset']
// client_cmd can be in ['list', 'form', 'show', 'reload', 'reset']
...
@@ -657,7 +648,7 @@ angular.module('formService', ['ui.bootstrap'])
...
@@ -657,7 +648,7 @@ angular.module('formService', ['ui.bootstrap'])
generator
.
get_diff_array
=
function
(
array1
,
array2
)
{
generator
.
get_diff_array
=
function
(
array1
,
array2
)
{
var
result
=
[];
var
result
=
[];
angular
.
forEach
(
array1
,
function
(
value
,
key
)
{
angular
.
forEach
(
array1
,
function
(
value
,
key
)
{
if
(
a
rray2
.
indexOf
(
value
)
<
0
)
{
if
(
a
ngular
.
toJson
(
array2
).
indexOf
(
value
.
value
)
<
0
)
{
result
.
push
(
value
);
result
.
push
(
value
);
}
}
});
});
...
@@ -889,8 +880,14 @@ angular.module('formService', ['ui.bootstrap'])
...
@@ -889,8 +880,14 @@ angular.module('formService', ['ui.bootstrap'])
// scope.model can be reached via prototype chain
// scope.model can be reached via prototype chain
scope
.
model
[
formName
]
=
data
.
forms
.
model
.
object_key
;
scope
.
model
[
formName
]
=
data
.
forms
.
model
.
object_key
;
// scope.form prototype chain returns this form item
// scope.form prototype chain returns this form item
scope
.
form
.
titleMap
.
push
({
value
:
data
.
forms
.
model
.
object_key
,
name
:
data
.
forms
.
model
.
unicode
});
scope
.
form
.
titleMap
.
push
({
scope
.
form
.
selected_item
=
{
value
:
data
.
forms
.
model
.
object_key
,
name
:
data
.
forms
.
model
.
unicode
};
value
:
data
.
forms
.
model
.
object_key
,
name
:
data
.
forms
.
model
.
unicode
});
scope
.
form
.
selected_item
=
{
value
:
data
.
forms
.
model
.
object_key
,
name
:
data
.
forms
.
model
.
unicode
};
scope
.
$watch
(
document
.
querySelector
(
'input[name='
+
scope
.
form
.
model_name
+
']'
),
scope
.
$watch
(
document
.
querySelector
(
'input[name='
+
scope
.
form
.
model_name
+
']'
),
function
()
{
function
()
{
angular
.
element
(
document
.
querySelector
(
'input[name='
+
scope
.
form
.
model_name
+
']'
)).
val
(
scope
.
form
.
selected_item
.
name
);
angular
.
element
(
document
.
querySelector
(
'input[name='
+
scope
.
form
.
model_name
+
']'
)).
val
(
scope
.
form
.
selected_item
.
name
);
...
...
dist/app.js
View file @
d5328b2b
/*! ulakbus-ui 2015-12-02 */
/*! ulakbus-ui 2015-12-02 */
"use strict"
;
var
app
=
angular
.
module
(
"ulakbus"
,[
"ui.bootstrap"
,
"angular-loading-bar"
,
"ngRoute"
,
"ngSanitize"
,
"ngCookies"
,
"formService"
,
"ulakbus.dashboard"
,
"ulakbus.auth"
,
"ulakbus.error_pages"
,
"ulakbus.crud"
,
"ulakbus.debug"
,
"ulakbus.devSettings"
,
"ulakbus.version"
,
"gettext"
,
"templates-prod"
]).
constant
(
"RESTURL"
,
function
(){
var
backendurl
=
location
.
href
.
indexOf
(
"nightly"
)
>-
1
?
"//nightly.api.ulakbus.net/"
:
"//api.ulakbus.net/"
;
if
(
document
.
cookie
.
indexOf
(
"backendurl"
)
>-
1
){
var
cookiearray
=
document
.
cookie
.
split
(
";"
);
angular
.
forEach
(
cookiearray
,
function
(
item
){
item
.
indexOf
(
"backendurl"
)
>-
1
&&
(
backendurl
=
item
.
split
(
"="
)[
1
])})}
if
(
location
.
href
.
indexOf
(
"backendurl"
)
>-
1
){
var
urlfromqstr
=
location
.
href
.
split
(
"?"
)[
1
].
split
(
"="
)[
1
];
backendurl
=
decodeURIComponent
(
urlfromqstr
.
replace
(
/
\+
/g
,
" "
)),
document
.
cookie
=
"backendurl="
+
backendurl
,
window
.
location
.
href
=
window
.
location
.
href
.
split
(
"?"
)[
0
]}
return
{
url
:
backendurl
}}()).
constant
(
"USER_ROLES"
,{
all
:
"*"
,
admin
:
"admin"
,
student
:
"student"
,
staff
:
"staff"
,
dean
:
"dean"
}).
constant
(
"AUTH_EVENTS"
,{
loginSuccess
:
"auth-login-success"
,
loginFailed
:
"auth-login-failed"
,
logoutSuccess
:
"auth-logout-success"
,
sessionTimeout
:
"auth-session-timeout"
,
notAuthenticated
:
"auth-not-authenticated"
,
notAuthorized
:
"auth-not-authorized"
});
app
.
config
([
"$routeProvider"
,
function
(
$routeProvider
,
$route
){
$routeProvider
.
when
(
"/login"
,{
templateUrl
:
"components/auth/login.html"
,
controller
:
"LoginCtrl"
}).
when
(
"/dashboard"
,{
templateUrl
:
"components/dashboard/dashboard.html"
,
controller
:
"DashCtrl"
}).
when
(
"/dev/settings"
,{
templateUrl
:
"components/devSettings/devSettings.html"
,
controller
:
"DevSettingsCtrl"
}).
when
(
"/debug/list"
,{
templateUrl
:
"components/debug/debug.html"
,
controller
:
"DebugCtrl"
}).
when
(
"/:wf/"
,{
templateUrl
:
"components/crud/templates/crud.html"
,
controller
:
"CRUDCtrl"
}).
when
(
"/:wf/do/:cmd"
,{
templateUrl
:
"components/crud/templates/crud.html"
,
controller
:
"CRUDListFormCtrl"
}).
when
(
"/:wf/do/:cmd/:key"
,{
templateUrl
:
"components/crud/templates/crud.html"
,
controller
:
"CRUDListFormCtrl"
}).
when
(
"/:wf/:model"
,{
templateUrl
:
"components/crud/templates/crud.html"
,
controller
:
"CRUDCtrl"
}).
when
(
"/:wf/:model/do/:cmd"
,{
templateUrl
:
"components/crud/templates/crud.html"
,
controller
:
"CRUDListFormCtrl"
}).
when
(
"/:wf/:model/do/:cmd/:key"
,{
templateUrl
:
"components/crud/templates/crud.html"
,
controller
:
"CRUDListFormCtrl"
}).
otherwise
({
redirectTo
:
"/dashboard"
})}]).
run
(
function
(
$rootScope
){
$rootScope
.
loggedInUser
=!
0
,
$rootScope
.
$on
(
"$routeChangeStart"
,
function
(
event
,
next
,
current
){})}).
config
([
"$httpProvider"
,
function
(
$httpProvider
){
$httpProvider
.
defaults
.
withCredentials
=!
0
}]).
run
(
function
(
gettextCatalog
){
gettextCatalog
.
setCurrentLanguage
(
"tr"
),
gettextCatalog
.
debug
=!
0
}).
config
([
"cfpLoadingBarProvider"
,
function
(
cfpLoadingBarProvider
){
cfpLoadingBarProvider
.
includeBar
=!
1
,
cfpLoadingBarProvider
.
parentSelector
=
"loaderdiv"
,
cfpLoadingBarProvider
.
spinnerTemplate
=
'<div class="loader">Loading...</div>'
}]),
app
.
config
([
"$httpProvider"
,
function
(
$httpProvider
){
$httpProvider
.
interceptors
.
push
(
function
(
$q
,
$rootScope
,
$location
,
$timeout
){
return
{
request
:
function
(
config
){
return
"POST"
===
config
.
method
&&
(
config
.
headers
[
"Content-Type"
]
=
"text/plain"
),
config
},
response
:
function
(
response
){
return
response
.
data
.
_debug_queries
&&
response
.
data
.
_debug_queries
.
length
>
0
&&
(
$rootScope
.
debug_queries
=
$rootScope
.
debug_queries
||
[],
$rootScope
.
debug_queries
.
push
({
url
:
response
.
config
.
url
,
queries
:
response
.
data
.
_debug_queries
})),
response
.
data
.
is_login
===!
1
&&
(
$rootScope
.
loggedInUser
=
response
.
data
.
is_login
,
$location
.
path
(
"/login"
)),
response
.
data
.
is_login
===!
0
&&
(
$rootScope
.
loggedInUser
=!
0
,
"/login"
===
$location
.
path
()
&&
$location
.
path
(
"/dashboard"
)),
response
},
responseError
:
function
(
rejection
){
var
errorModal
=
function
(){
var
codefield
=
""
;
rejection
.
data
.
error
&&
(
codefield
=
"<p><pre>"
+
rejection
.
data
.
error
+
"</pre></p>"
),
$
(
'<div class="modal"><div class="modal-dialog" style="width:1024px;" role="document"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button><h4 class="modal-title" id="exampleModalLabel">'
+
rejection
.
status
+
rejection
.
data
.
title
+
'</h4></div><div class="modal-body"><div class="alert alert-danger"><strong>'
+
rejection
.
data
.
description
+
"</strong>"
+
codefield
+
'</div></div><div class="modal-footer"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button></div></div></div></div>'
).
modal
()};
return
-
1
===
rejection
.
status
&&
(
rejection
.
data
=
{
title
:
"error"
,
description
:
"connection failed"
},
errorModal
()),
400
===
rejection
.
status
&&
$location
.
reload
(),
401
===
rejection
.
status
&&
(
$location
.
path
(
"/login"
),
"/login"
===
$location
.
path
()
&&
console
.
log
(
"show errors on login form"
)),
403
===
rejection
.
status
&&
(
rejection
.
data
.
is_login
===!
0
&&
(
$rootScope
.
loggedInUser
=!
0
,
"/login"
===
$location
.
path
()
&&
$location
.
path
(
"/dashboard"
)),
errorModal
()),
$rootScope
.
$broadcast
(
"show_notifications"
,
rejection
.
data
),
404
===
rejection
.
status
&&
errorModal
(),
500
===
rejection
.
status
&&
errorModal
(),
$q
.
reject
(
rejection
)}}})}]),
angular
.
module
(
"formService"
,[
"ui.bootstrap"
]).
factory
(
"Generator"
,
function
(
$http
,
$q
,
$timeout
,
$location
,
$route
,
$compile
,
$log
,
RESTURL
,
$rootScope
){
var
generator
=
{};
return
generator
.
makeUrl
=
function
(
scope
){
var
getparams
=
scope
.
form_params
.
param
?
"?"
+
scope
.
form_params
.
param
+
"="
+
scope
.
form_params
.
id
:
""
;
return
RESTURL
.
url
+
scope
.
url
+
getparams
},
generator
.
generate
=
function
(
scope
,
data
){
return
data
.
forms
?(
angular
.
forEach
(
data
.
forms
,
function
(
value
,
key
){
scope
[
key
]
=
data
.
forms
[
key
]}),
scope
.
client_cmd
=
data
.
client_cmd
,
scope
.
token
=
data
.
token
,
scope
.
initialModel
=
angular
.
copy
(
scope
.
model
),
generator
.
prepareFormItems
(
scope
),
scope
.
object_id
=
scope
.
form_params
.
object_id
,
$rootScope
.
showSaveButton
=!
0
,
$log
.
debug
(
"scope at after generate"
,
scope
),
scope
):
scope
},
generator
.
group
=
function
(
formObject
){
return
formObject
},
generator
.
prepareFormItems
=
function
(
scope
){
return
angular
.
forEach
(
scope
.
form
,
function
(
value
,
key
){
"select"
===
value
.
type
&&
(
scope
.
schema
.
properties
[
value
.
key
].
type
=
"select"
,
scope
.
schema
.
properties
[
value
.
key
].
titleMap
=
value
.
titleMap
,
scope
.
form
[
key
]
=
value
.
key
)}),
angular
.
forEach
(
scope
.
schema
.
properties
,
function
(
v
,
k
){
if
(
"form_params"
in
scope
&&
k
==
scope
.
form_params
.
param
)
return
scope
.
model
[
k
]
=
scope
.
form_params
.
id
,
void
scope
.
form
.
splice
(
scope
.
form
.
indexOf
(
k
),
1
);
if
(
"select"
===
v
.
type
&&
(
scope
.
form
[
scope
.
form
.
indexOf
(
k
)]
=
{
type
:
"template"
,
title
:
v
.
title
,
templateUrl
:
"shared/templates/select.html"
,
name
:
k
,
key
:
k
,
titleMap
:
v
.
titleMap
}),
"submit"
===
v
.
type
||
"button"
===
v
.
type
){
var
buttonPositions
=
scope
.
modalElements
?
scope
.
modalElements
.
buttonPositions
:{
bottom
:
"move-to-bottom"
,
top
:
"move-to-top"
,
none
:
""
},
workOnForm
=
scope
.
modalElements
?
scope
.
modalElements
.
workOnForm
:
"formgenerated"
,
workOnDiv
=
scope
.
modalElements
?
scope
.
modalElements
.
workOnDiv
:
""
,
buttonClass
=
buttonPositions
[
v
.
position
]
||
buttonPositions
.
bottom
,
redirectTo
=
scope
.
modalElements
?
!
1
:
!
0
;
scope
.
form
[
scope
.
form
.
indexOf
(
k
)]
=
{
type
:
v
.
type
,
title
:
v
.
title
,
style
:
"btn-primary hide "
+
buttonClass
,
onClick
:
function
(){
delete
scope
.
form_params
.
cmd
,
delete
scope
.
form_params
.
flow
,
v
.
cmd
&&
(
scope
.
form_params
.
cmd
=
v
.
cmd
),
v
.
flow
&&
(
scope
.
form_params
.
flow
=
v
.
flow
),
scope
.
model
[
k
]
=
1
,
scope
.
modalElements
?
scope
.
submitModalForm
():
v
.
validation
===!
1
?
generator
.
submit
(
scope
,
redirectTo
):(
scope
.
$broadcast
(
"schemaFormValidate"
),
scope
[
workOnForm
].
$valid
&&
(
generator
.
submit
(
scope
,
redirectTo
),
scope
.
$broadcast
(
"disposeModal"
)))}},
$timeout
(
function
(){
var
selectorBottom
=
".buttons-on-bottom"
+
workOnDiv
,
buttonsToBottom
=
angular
.
element
(
document
.
querySelector
(
"."
+
buttonClass
));
angular
.
element
(
document
.
querySelector
(
selectorBottom
)).
append
(
buttonsToBottom
),
$log
.
debug
(
selectorBottom
,
buttonsToBottom
),
$log
.
debug
(
angular
.
element
(
document
.
querySelector
(
selectorBottom
))),
buttonsToBottom
.
removeClass
(
"hide"
)})}
if
(
"date"
===
v
.
type
&&
(
scope
.
form
[
scope
.
form
.
indexOf
(
k
)]
=
{
key
:
k
,
name
:
k
,
validationMessage
:{
dateNotValid
:
"Girdiğiniz tarih geçerli değildir. <i>orn: '01.01.2015'<i/>"
},
$asyncValidators
:{
dateNotValid
:
function
(
value
){
var
deferred
=
$q
.
defer
();
return
$timeout
(
function
(){
isNaN
(
Date
.
parse
(
value
))
||
3
!==
value
.
split
(
"."
).
length
?
deferred
.
reject
():
deferred
.
resolve
()},
500
),
deferred
.
promise
}}},
v
.
type
=
"string"
,
scope
.
model
[
k
]
=
generator
.
dateformatter
(
scope
.
model
[
k
]),
$timeout
(
function
(){
jQuery
(
"#"
+
k
).
datepicker
({
changeMonth
:
!
0
,
changeYear
:
!
0
,
dateFormat
:
"dd.mm.yy"
,
onSelect
:
function
(
date
,
inst
){
scope
.
model
[
k
]
=
date
,
scope
.
modalElements
?
scope
.
validateModalDate
(
k
):
scope
.
$broadcast
(
"schemaForm.error."
+
k
,
"tv4-302"
,
!
0
)}})})),(
"int"
===
v
.
type
||
"float"
===
v
.
type
)
&&
(
v
.
type
=
"number"
,
scope
.
model
[
k
]
=
parseInt
(
scope
.
model
[
k
])),
"text_general"
===
v
.
type
&&
(
v
.
type
=
"string"
,
v
[
"x-schema-form"
]
=
{
type
:
"textarea"
}),
"model"
===
v
.
type
){
var
formitem
=
scope
.
form
[
scope
.
form
.
indexOf
(
k
)],
modelScope
=
{
url
:
v
.
wf
,
form_params
:{
model
:
v
.
model_name
,
cmd
:
v
.
list_cmd
}};
scope
.
generateTitleMap
=
function
(
modelScope
){
generator
.
get_list
(
modelScope
).
then
(
function
(
res
){
formitem
.
titleMap
=
[],
angular
.
forEach
(
res
.
data
.
objects
,
function
(
item
){
"-1"
!==
item
&&
formitem
.
titleMap
.
push
({
value
:
item
.
key
,
name
:
item
.
value
}),
item
.
key
===
scope
.
model
[
k
]
&&
(
formitem
.
selected_item
=
{
value
:
item
.
key
,
name
:
item
.
value
})});
try
{
scope
.
$watch
(
document
.
querySelector
(
"input[name="
+
v
.
model_name
+
"]"
),
function
(){
angular
.
element
(
document
.
querySelector
(
"input[name="
+
v
.
model_name
+
"]"
)).
val
(
formitem
.
selected_item
.
name
)})}
catch
(
e
){
$log
.
debug
(
"exception"
,
e
)}})},
formitem
=
{
type
:
"template"
,
templateUrl
:
"shared/templates/foreignKey.html"
,
formName
:
k
,
title
:
v
.
title
,
wf
:
v
.
wf
,
add_cmd
:
v
.
add_cmd
,
name
:
v
.
model_name
,
model_name
:
v
.
model_name
,
selected_item
:{},
titleMap
:
scope
.
generateTitleMap
(
modelScope
),
onSelect
:
function
(
item
){
scope
.
model
[
k
]
=
item
.
value
},
onDropdownSelect
:
function
(
item
,
inputname
){
scope
.
model
[
k
]
=
item
.
value
,
jQuery
(
"input[name="
+
inputname
+
"]"
).
val
(
item
.
name
)}},
scope
.
form
[
scope
.
form
.
indexOf
(
k
)]
=
formitem
}
if
((
"ListNode"
===
v
.
type
||
"Node"
===
v
.
type
)
&&
"filter_interface"
===
v
.
widget
){
var
formitem
=
scope
.
form
[
scope
.
form
.
indexOf
(
k
)],
modelScope
=
{
url
:
v
.
wf
||
scope
.
wf
,
form_params
:{
model
:
v
.
model_name
||
v
.
schema
[
0
].
model_name
,
cmd
:
v
.
list_cmd
||
"select_list"
}};
scope
.
generateTitleMap
=
function
(
modelScope
){
generator
.
get_list
(
modelScope
).
then
(
function
(
res
){
formitem
.
titleMap
=
[],
angular
.
forEach
(
res
.
data
.
objects
,
function
(
item
){
"-1"
!==
item
&&
formitem
.
titleMap
.
push
({
value
:
item
.
key
,
name
:
item
.
value
}),
item
.
key
===
scope
.
model
[
k
]
&&
(
formitem
.
selected_item
=
{
value
:
item
.
key
,
name
:
item
.
value
})}),
scope
.
$watch
(
document
.
querySelector
(
"input[name="
+
v
.
model_name
+
"]"
),
function
(){
angular
.
element
(
document
.
querySelector
(
"input[name="
+
v
.
model_name
+
"]"
)).
val
(
formitem
.
selected_item
.
name
)})})},
formitem
=
{
type
:
"template"
,
templateUrl
:
"shared/templates/multiselect.html"
,
title
:
v
.
title
,
wf
:
v
.
wf
,
add_cmd
:
v
.
add_cmd
,
name
:
v
.
model_name
,
model_name
:
v
.
model_name
,
filterValue
:
""
,
selected_item
:{},
filteredItems
:[],
selectedFilteredItems
:[],
titleMap
:
scope
.
generateTitleMap
(
modelScope
),
onSelect
:
function
(
item
){
scope
.
model
[
k
]
=
item
.
value
},
onDropdownSelect
:
function
(
item
,
inputname
){
scope
.
model
[
k
]
=
item
.
value
,
jQuery
(
"input[name="
+
inputname
+
"]"
).
val
(
item
.
name
)},
appendFiltered
:
function
(
filterValue
){
formitem
.
filteredItems
=
[],
filterValue
.
length
>
2
&&
angular
.
forEach
(
formitem
.
titleMap
,
function
(
value
,
key
){
value
.
name
.
indexOf
(
filterValue
)
>-
1
&&
formitem
.
filteredItems
.
push
(
formitem
.
titleMap
[
key
])}),
formitem
.
filteredItems
=
generator
.
get_diff_array
(
formitem
.
filteredItems
,
formitem
.
selectedFilteredItems
)},
select
:
function
(
selectedItemsModel
){
formitem
.
selectedFilteredItems
=
formitem
.
selectedFilteredItems
.
concat
(
selectedItemsModel
),
formitem
.
appendFiltered
(
formitem
.
filterValue
),
scope
.
model
[
k
]
=
formitem
.
dataToModel
(
selectedItemsModel
)},
deselect
:
function
(
selectedFilteredItemsModel
){
formitem
.
selectedFilteredItems
=
generator
.
get_diff_array
(
formitem
.
selectedFilteredItems
,
selectedFilteredItemsModel
),
formitem
.
appendFiltered
(
formitem
.
filterValue
),
scope
.
model
[
k
]
=
formitem
.
dataToModel
(
formitem
.
selectedFilteredItems
)},
dataToModel
:
function
(
data
){
var
dataValues
=
[];
return
angular
.
forEach
(
data
,
function
(
value
,
key
){
var
dataKey
=
{};
dataKey
[
v
.
schema
[
0
].
name
]
=
value
.
value
,
dataValues
.
push
(
dataKey
)}),
dataValues
}},
scope
.
form
[
scope
.
form
.
indexOf
(
k
)]
=
formitem
}
"ListNode"
!==
v
.
type
&&
"Node"
!==
v
.
type
||
"filter_interface"
===
v
.
widget
||
(
scope
[
v
.
type
]
=
scope
[
v
.
type
]
||
{},
scope
[
v
.
type
][
k
]
=
angular
.
copy
({
title
:
v
.
title
,
form
:[],
schema
:{
properties
:{},
required
:[],
title
:
v
.
title
,
type
:
"object"
,
formType
:
v
.
type
,
model_name
:
k
},
url
:
scope
.
url
}),
scope
[
v
.
type
][
k
].
model
=
angular
.
copy
(
scope
.
model
[
k
])
||
{},
"ListNode"
===
v
.
type
&&
(
scope
[
v
.
type
][
k
].
items
=
[]),
angular
.
forEach
(
v
.
schema
,
function
(
item
){
scope
[
v
.
type
][
k
].
schema
.
properties
[
item
.
name
]
=
angular
.
copy
(
item
),
item
.
required
===!
0
&&
"idx"
!==
item
.
name
&&
scope
[
v
.
type
][
k
].
schema
.
required
.
push
(
angular
.
copy
(
item
.
name
)),
"idx"
===
item
.
name
?
scope
[
v
.
type
][
k
].
form
.
push
({
type
:
"string"
,
key
:
angular
.
copy
(
item
.
name
),
htmlClass
:
"hidden"
}):
scope
[
v
.
type
][
k
].
form
.
push
(
item
.
name
)}),
scope
[
v
.
type
][
k
].
lengthModels
=
scope
.
model
[
k
]?
1
:
0
)}),
$log
.
debug
(
"scope at after prepareformitems"
,
scope
),
scope
},
generator
.
dateformatter
=
function
(
formObject
){
var
ndate
=
new
Date
(
formObject
);
if
(
"Invalid Date"
==
ndate
)
return
""
;
var
newdatearray
=
[
ndate
.
getDate
(),
ndate
.
getMonth
()
+
1
,
ndate
.
getFullYear
()];
return
newdatearray
.
join
(
"."
)},
generator
.
doItemAction
=
function
(
$scope
,
key
,
cmd
,
mode
){
var
_do
=
{
normal
:
function
(){
return
$log
.
debug
(
"normal mode starts"
),
$scope
.
form_params
.
cmd
=
cmd
,
$scope
.
form_params
.
object_id
=
key
,
$scope
.
form_params
.
param
=
$scope
.
param
,
$scope
.
form_params
.
id
=
$scope
.
param_id
,
$scope
.
form_params
.
token
=
$scope
.
token
,
generator
.
get_wf
(
$scope
)},
modal
:
function
(){
$log
.
debug
(
"modal mode is not not ready"
)},
"new"
:
function
(){
$log
.
debug
(
"new mode is not not ready"
)}};
return
_do
[
mode
]()},
generator
.
get_form
=
function
(
scope
){
return
$http
.
post
(
generator
.
makeUrl
(
scope
),
scope
.
form_params
).
then
(
function
(
res
){
return
generator
.
generate
(
scope
,
res
.
data
)})},
generator
.
get_list
=
function
(
scope
){
return
$http
.
post
(
generator
.
makeUrl
(
scope
),
scope
.
form_params
).
then
(
function
(
res
){
return
res
})},
generator
.
get_wf
=
function
(
scope
){
return
$http
.
post
(
generator
.
makeUrl
(
scope
),
scope
.
form_params
).
then
(
function
(
res
){
if
(
res
.
data
.
client_cmd
)
return
generator
.
pathDecider
(
res
.
data
.
client_cmd
,
scope
,
res
.
data
);
if
(
res
.
data
.
msgbox
){
scope
.
msgbox
=
res
.
data
.
msgbox
;
var
newElement
=
$compile
(
"<msgbox></msgbox>"
)(
scope
);
angular
.
element
(
document
.
querySelector
(
".main.ng-scope"
)).
children
().
remove
(),
angular
.
element
(
document
.
querySelector
(
".main.ng-scope"
)).
append
(
newElement
)}})},
generator
.
isValidEmail
=
function
(
email
){
var
re
=
/^
([\w
-
]
+
(?:\.[\w
-
]
+
)
*
)
@
((?:[\w
-
]
+
\.)
*
\w[\w
-
]{0,66})\.([
a-z
]{2,6}(?:\.[
a-z
]{2})?)
$/i
;
return
re
.
test
(
email
)},
generator
.
isValidTCNo
=
function
(
tcno
){
var
re
=
/^
([
1-9
]{1}[
0-9
]{9}[
0,2,4,6,8
]{1})
$/i
;
return
re
.
test
(
tcno
)},
generator
.
isValidDate
=
function
(
dateValue
){
var
datevalid
=
Date
.
parse
(
dateValue
)
===
Nan
?
!
1
:
!
0
;
return
datevalid
},
generator
.
asyncValidators
=
{
emailNotValid
:
function
(
value
){
var
deferred
=
$q
.
defer
();
return
$timeout
(
function
(){
generator
.
isValidEmail
(
value
)?
deferred
.
resolve
():
deferred
.
reject
()},
500
),
deferred
.
promise
},
tcNoNotValid
:
function
(
value
){
var
deferred
=
$q
.
defer
();
return
$timeout
(
function
(){
generator
.
isValidTCNo
(
value
)?
deferred
.
resolve
():
deferred
.
reject
()},
500
),
deferred
.
promise
}},
generator
.
pageData
=
{},
generator
.
getPageData
=
function
(){
return
generator
.
pageData
},
generator
.
setPageData
=
function
(
value
){
generator
.
pageData
=
value
},
generator
.
pathDecider
=
function
(
client_cmd
,
$scope
,
data
){
function
redirectTo
(
scope
,
page
){
var
pathUrl
=
"/"
+
scope
.
form_params
.
wf
;
return
pathUrl
+=
scope
.
form_params
.
model
?
"/"
+
scope
.
form_params
.
model
+
"/do/"
+
page
:
"/do/"
+
page
,
$location
.
path
()
===
pathUrl
?
$route
.
reload
():(
$location
.
path
(
pathUrl
),
void
$log
.
debug
(
"pathDecider scope"
,
scope
))}
function
dispatchClientCmd
(){
data
[
$scope
.
form_params
.
param
]
=
$scope
.
form_params
.
id
,
data
.
model
=
$scope
.
form_params
.
model
,
data
.
wf
=
$scope
.
form_params
.
wf
,
data
.
param
=
$scope
.
form_params
.
param
,
data
.
param_id
=
$scope
.
form_params
.
id
,
data
.
pageData
=!
0
,
generator
.
setPageData
(
data
),
redirectTo
(
$scope
,
client_cmd
[
0
])}
return
"reload"
===
client_cmd
[
0
]
||
"reset"
===
client_cmd
[
0
]?
void
$rootScope
.
$broadcast
(
"reload_cmd"
,
client_cmd
[
0
]):
void
dispatchClientCmd
()},
generator
.
get_diff
=
function
(
obj1
,
obj2
){
var
result
=
{};
for
(
key
in
obj1
)
obj2
[
key
]
!=
obj1
[
key
]
&&
(
result
[
key
]
=
obj1
[
key
]),
"array"
==
typeof
obj2
[
key
]
&&
"array"
==
typeof
obj1
[
key
]
&&
(
result
[
key
]
=
arguments
.
callee
(
obj1
[
key
],
obj2
[
key
])),
"object"
==
typeof
obj2
[
key
]
&&
"object"
==
typeof
obj1
[
key
]
&&
(
result
[
key
]
=
arguments
.
callee
(
obj1
[
key
],
obj2
[
key
]));
return
result
},
generator
.
get_diff_array
=
function
(
array1
,
array2
){
var
result
=
[];
return
angular
.
forEach
(
array1
,
function
(
value
,
key
){
array2
.
indexOf
(
value
)
<
0
&&
result
.
push
(
value
)}),
result
},
generator
.
submit
=
function
(
$scope
,
redirectTo
){
angular
.
forEach
(
$scope
.
ListNode
,
function
(
value
,
key
){
$scope
.
model
[
key
]
=
value
.
items
}),
angular
.
forEach
(
$scope
.
Node
,
function
(
value
,
key
){
$scope
.
model
[
key
]
=
value
.
model
});
var
data
=
{
form
:
$scope
.
model
,
token
:
$scope
.
token
,
model
:
$scope
.
form_params
.
model
,
cmd
:
$scope
.
form_params
.
cmd
,
flow
:
$scope
.
form_params
.
flow
,
object_id
:
$scope
.
object_id
};
return
$http
.
post
(
generator
.
makeUrl
(
$scope
),
data
).
success
(
function
(
data
){
if
(
redirectTo
===!
0
&&
(
data
.
client_cmd
&&
generator
.
pathDecider
(
data
.
client_cmd
,
$scope
,
data
),
data
.
msgbox
)){
$scope
.
msgbox
=
data
.
msgbox
;
var
newElement
=
$compile
(
"<msgbox></msgbox>"
)(
$scope
);
angular
.
element
(
document
.
querySelector
(
".main.ng-scope"
)).
children
().
remove
(),
angular
.
element
(
document
.
querySelector
(
".main.ng-scope"
)).
append
(
newElement
)}})},
generator
}).
controller
(
"ModalCtrl"
,
function
(
$scope
,
$uibModalInstance
,
Generator
,
items
){
angular
.
forEach
(
items
,
function
(
value
,
key
){
$scope
[
key
]
=
items
[
key
]}),
$scope
.
$on
(
"disposeModal"
,
function
(){
$scope
.
cancel
()}),
$scope
.
$on
(
"modalFormLocator"
,
function
(
event
){
$scope
.
linkedModelForm
=
event
.
targetScope
.
linkedModelForm
}),
$scope
.
$on
(
"submitModalForm"
,
function
(){
$scope
.
onSubmit
(
$scope
.
linkedModelForm
)}),
$scope
.
$on
(
"validateModalDate"
,
function
(
event
,
field
){
$scope
.
$broadcast
(
"schemaForm.error."
+
field
,
"tv4-302"
,
!
0
)}),
$scope
.
onSubmit
=
function
(
form
){
$scope
.
$broadcast
(
"schemaFormValidate"
),
form
.
$valid
&&
$uibModalInstance
.
close
(
$scope
)},
$scope
.
onNodeSubmit
=
function
(){
$scope
.
$broadcast
(
"schemaFormValidate"
),
$scope
.
modalForm
.
$valid
&&
$uibModalInstance
.
close
(
$scope
)},
$scope
.
cancel
=
function
(){
$uibModalInstance
.
dismiss
(
"cancel"
)}}).
directive
(
"modalForNodes"
,
function
(
$uibModal
,
Generator
){
return
{
link
:
function
(
scope
,
element
,
attributes
){
element
.
on
(
"click"
,
function
(){
var
modalInstance
=
$uibModal
.
open
({
animation
:
!
0
,
backdrop
:
"static"
,
templateUrl
:
"shared/templates/listnodeModalContent.html"
,
controller
:
"ModalCtrl"
,
size
:
"lg"
,
resolve
:{
items
:
function
(){
var
attribs
=
attributes
.
modalForNodes
.
split
(
","
),
node
=
angular
.
copy
(
scope
.
$parent
[
attribs
[
1
]][
attribs
[
0
]]);
"add"
===
attribs
[
2
]
&&
(
node
.
model
=
{}),
attribs
[
3
]
&&
(
node
.
model
=
node
.
model
[
attribs
[
3
]]),
node
.
edit
=
attribs
[
3
],
scope
.
node
.
schema
.
wf
=
scope
.
node
.
url
,
angular
.
forEach
(
scope
.
node
.
schema
.
properties
,
function
(
value
,
key
){
scope
.
node
.
schema
.
properties
[
key
].
wf
=
scope
.
node
.
url
,
scope
.
node
.
schema
.
properties
[
key
].
list_cmd
=
"select_list"
});
var
newscope
=
{
url
:
scope
.
node
.
url
,
form_params
:{
model
:
scope
.
node
.
schema
.
model_name
}};
return
Generator
.
generate
(
newscope
,{
forms
:
scope
.
node
}),
newscope
}}});
modalInstance
.
result
.
then
(
function
(
childmodel
,
key
){
var
listNodeItem
=
scope
.
$parent
[
childmodel
.
schema
.
formType
][
childmodel
.
schema
.
model_name
];
"Node"
===
childmodel
.
schema
.
formType
&&
(
listNodeItem
.
model
=
angular
.
copy
(
childmodel
.
model
),
listNodeItem
.
lengthModels
+=
1
),
"ListNode"
===
childmodel
.
schema
.
formType
&&
(
childmodel
.
edit
?
listNodeItem
.
model
[
childmodel
.
edit
]
=
childmodel
.
model
:
listNodeItem
.
items
.
push
(
angular
.
copy
(
childmodel
.
model
)),
listNodeItem
.
lengthModels
+=
1
)})})}}}).
directive
(
"addModalForLinkedModel"
,
function
(
$uibModal
,
$rootScope
,
$route
,
Generator
){
return
{
link
:
function
(
scope
,
element
,
attributes
){
element
.
on
(
"click"
,
function
(){
var
modalInstance
=
$uibModal
.
open
({
animation
:
!
0
,
backdrop
:
"static"
,
templateUrl
:
"shared/templates/linkedModelModalContent.html"
,
controller
:
"ModalCtrl"
,
size
:
"lg"
,
resolve
:{
items
:
function
(){
var
formName
=
attributes
.
addModalForLinkedModel
;
return
Generator
.
get_form
({
url
:
scope
.
form
.
wf
,
form_params
:{
model
:
scope
.
form
.
model_name
,
cmd
:
scope
.
form
.
add_cmd
},
modalElements
:{
buttonPositions
:{
bottom
:
"move-to-bottom-modal"
,
top
:
"move-to-top-modal"
,
none
:
""
},
workOnForm
:
"linkedModelForm"
,
workOnDiv
:
"-modal"
},
submitModalForm
:
function
(){
$rootScope
.
$broadcast
(
"submitModalForm"
)},
validateModalDate
:
function
(
field
){
$rootScope
.
$broadcast
(
"validateModalDate"
,
field
)},
formName
:
formName
})}}});
modalInstance
.
result
.
then
(
function
(
childscope
,
key
){
var
formName
=
childscope
.
formName
;
Generator
.
submit
(
childscope
,
!
1
).
success
(
function
(
data
){
scope
.
model
[
formName
]
=
data
.
forms
.
model
.
object_key
,
scope
.
form
.
titleMap
.
push
({
value
:
data
.
forms
.
model
.
object_key
,
name
:
data
.
forms
.
model
.
unicode
}),
scope
.
form
.
selected_item
=
{
value
:
data
.
forms
.
model
.
object_key
,
name
:
data
.
forms
.
model
.
unicode
},
scope
.
$watch
(
document
.
querySelector
(
"input[name="
+
scope
.
form
.
model_name
+
"]"
),
function
(){
angular
.
element
(
document
.
querySelector
(
"input[name="
+
scope
.
form
.
model_name
+
"]"
)).
val
(
scope
.
form
.
selected_item
.
name
)})})})})}}}).
directive
(
"modalFormLocator"
,
function
(){
return
{
link
:
function
(
scope
){
scope
.
$emit
(
"modalFormLocator"
)}}}).
directive
(
"editModalForLinkedModel"
,
function
(
$uibModal
,
Generator
){
return
{
link
:
function
(
scope
,
element
){
element
.
on
(
"click"
,
function
(){
var
modalInstance
=
$uibModal
.
open
({
animation
:
!
1
,
templateUrl
:
"shared/templates/linkedModelModalContent.html"
,
controller
:
"ModalCtrl"
,
size
:
"lg"
,
resolve
:{
items
:
function
(){
return
Generator
.
get_form
({
url
:
"crud"
,
form_params
:{
model
:
scope
.
form
.
title
,
cmd
:
"form"
}})}}});
modalInstance
.
result
.
then
(
function
(
childmodel
,
key
){
Generator
.
submit
(
childmodel
)})})}}}),
app
.
directive
(
"logout"
,
function
(
$http
,
$location
,
RESTURL
){
return
{
link
:
function
(
$scope
,
$element
,
$rootScope
){
$element
.
on
(
"click"
,
function
(){
$http
.
post
(
RESTURL
.
url
+
"logout"
,{}).
then
(
function
(){
$rootScope
.
loggedInUser
=!
1
,
$location
.
path
(
"/login"
)})})}}}).
directive
(
"headerNotification"
,
function
(
$http
,
$rootScope
,
$cookies
,
$interval
,
RESTURL
){
return
{
templateUrl
:
"shared/templates/directives/header-notification.html"
,
restrict
:
"E"
,
replace
:
!
0
,
link
:
function
(
$scope
){
$scope
.
groupNotifications
=
function
(
notifications
){
$scope
.
notifications
=
{
1
:[],
2
:[],
3
:[],
4
:[]},
angular
.
forEach
(
notifications
,
function
(
value
,
key
){
$scope
.
notifications
[
value
.
type
].
push
(
value
)})},
$scope
.
getNotifications
=
function
(){
$http
.
get
(
RESTURL
.
url
+
"notify"
,{
ignoreLoadingBar
:
!
0
}).
success
(
function
(
data
){
$scope
.
groupNotifications
(
data
.
notifications
),
$rootScope
.
$broadcast
(
"notifications"
,
$scope
.
notifications
)})},
$scope
.
getNotifications
(),
$interval
(
function
(){
"on"
==
$cookies
.
get
(
"notificate"
)
&&
$scope
.
getNotifications
()},
5
e3
),
$scope
.
markAsRead
=
function
(
items
){
$http
.
post
(
RESTURL
.
url
+
"notify"
,{
ignoreLoadingBar
:
!
0
,
read
:[
items
]}).
success
(
function
(
data
){
$scope
.
groupNotifications
(
data
.
notifications
),
$rootScope
.
$broadcast
(
"notifications"
,
$scope
.
notifications
)})},
$scope
.
$on
(
"markasread"
,
function
(
event
,
data
){
$scope
.
markAsRead
(
data
)})}}}).
directive
(
"searchDirective"
,
function
(
Generator
,
$log
){
return
{
templateUrl
:
"shared/templates/directives/search.html"
,
restrict
:
"E"
,
replace
:
!
0
,
link
:
function
(
$scope
){
$scope
.
searchForm
=
[{
key
:
"searchbox"
,
htmlClass
:
"pull-left"
},{
type
:
"submit"
,
title
:
"Ara"
,
htmlClass
:
"pull-left"
}],
$scope
.
searchSchema
=
{
type
:
"object"
,
properties
:{
searchbox
:{
type
:
"string"
,
minLength
:
2
,
title
:
"Ara"
,
"x-schema-form"
:{
placeholder
:
"Arama kriteri giriniz..."
}}},
required
:[
"searchbox"
]},
$scope
.
searchModel
=
{
searchbox
:
""
},
$scope
.
searchSubmit
=
function
(
form
){
if
(
$scope
.
$broadcast
(
"schemaFormValidate"
),
form
.
$valid
){
var
searchparams
=
{
url
:
$scope
.
wf
,
token
:
$scope
.
$parent
.
token
,
object_id
:
$scope
.
$parent
.
object_id
,
form_params
:{
model
:
$scope
.
$parent
.
form_params
.
model
,
cmd
:
$scope
.
$parent
.
reload_cmd
,
flow
:
$scope
.
$parent
.
form_params
.
flow
,
param
:
"query"
,
id
:
$scope
.
searchModel
.
searchbox
}};
Generator
.
submit
(
searchparams
)}}}}}).
directive
(
"sortDirective"
,
function
(
Generator
,
$log
){
return
{
templateUrl
:
"shared/templates/directives/sort.html"
,
restrict
:
"E"
,
replace
:
!
0
,
link
:
function
(
$scope
){
$scope
.
titleMap
=
[{
value
:
"artan"
,
name
:
"Artan"
},{
value
:
"azalan"
,
name
:
"Azalan"
}],
$scope
.
sortForm
=
[{
key
:
"sortbox"
,
htmlClass
:
"pull-left"
,
type
:
"select"
,
titleMap
:
$scope
.
titleMap
},{
type
:
"submit"
,
title
:
"Sırala"
,
htmlClass
:
"pull-left"
}],
$scope
.
sortSchema
=
{
type
:
"object"
,
properties
:{
sortbox
:{
type
:
"select"
,
title
:
"Sırala"
}},
required
:[
"sortbox"
]},
$scope
.
sortModel
=
{
sortbox
:
""
},
$scope
.
sortSubmit
=
function
(
form
){
if
(
$scope
.
$broadcast
(
"schemaFormValidate"
),
form
.
$valid
){
var
sortparams
=
{
url
:
$scope
.
wf
,
token
:
$scope
.
$parent
.
token
,
object_id
:
$scope
.
$parent
.
object_id
,
form_params
:{
model
:
$scope
.
$parent
.
form_params
.
model
,
cmd
:
$scope
.
$parent
.
reload_cmd
,
flow
:
$scope
.
$parent
.
form_params
.
flow
,
param
:
"sort"
,
id
:
$scope
.
sortModel
.
sortbox
}};
Generator
.
submit
(
sortparams
)}}}}}).
directive
(
"collapseMenu"
,
function
(
$timeout
,
$window
,
$cookies
){
return
{
templateUrl
:
"shared/templates/directives/menuCollapse.html"
,
restrict
:
"E"
,
replace
:
!
0
,
scope
:{},
controller
:
function
(
$scope
,
$rootScope
){
$rootScope
.
collapsed
=!
1
,
$rootScope
.
sidebarPinned
=
$cookies
.
get
(
"sidebarPinned"
)
||
0
,
$scope
.
collapseToggle
=
function
(){
$window
.
innerWidth
>
"768"
&&
(
$rootScope
.
collapsed
===!
1
?(
jQuery
(
".sidebar"
).
css
(
"width"
,
"62px"
),
jQuery
(
".manager-view"
).
css
(
"width"
,
"calc(100% - 62px)"
),
$rootScope
.
collapsed
=!
0
,
$rootScope
.
sidebarPinned
=
0
,
$cookies
.
put
(
"sidebarPinned"
,
0
)):(
jQuery
(
"span.menu-text, span.arrow, .sidebar footer"
).
fadeIn
(
400
),
jQuery
(
".sidebar"
).
css
(
"width"
,
"250px"
),
jQuery
(
".manager-view"
).
css
(
"width"
,
"calc(100% - 250px)"
),
$rootScope
.
collapsed
=!
1
,
$rootScope
.
sidebarPinned
=
1
,
$cookies
.
put
(
"sidebarPinned"
,
1
)))},
$timeout
(
function
(){
"0"
===
$cookies
.
get
(
"sidebarPinned"
)
&&
$scope
.
collapseToggle
()})}}}).
directive
(
"headerSubMenu"
,
function
(
$location
){
return
{
templateUrl
:
"shared/templates/directives/header-sub-menu.html"
,
restrict
:
"E"
,
replace
:
!
0
,
link
:
function
(
$scope
){
$scope
.
style
=
"width:calc(100% - 300px);"
,
$scope
.
$on
(
"$routeChangeStart"
,
function
(){
$scope
.
style
=
"/dashboard"
===
$location
.
path
()?
"width:calc(100% - 300px);"
:
"width:%100 !important;"
,
console
.
log
(
"style of header"
,
$location
.
path
())})}}}).
directive
(
"headerBreadcrumb"
,
function
(){
return
{
templateUrl
:
"shared/templates/directives/header-breadcrumb.html"
,
restrict
:
"E"
,
replace
:
!
0
}}).
directive
(
"selectedUser"
,
function
(){
return
{
templateUrl
:
"shared/templates/directives/selected-user.html"
,
restrict
:
"E"
,
replace
:
!
1
,
link
:
function
(
$scope
,
$rootScope
){
$scope
.
selectedUser
=
$rootScope
.
selectedUser
}}}).
directive
(
"sidebar"
,[
"$location"
,
function
(){
return
{
templateUrl
:
"shared/templates/directives/sidebar.html"
,
restrict
:
"E"
,
replace
:
!
0
,
scope
:{},
controller
:
function
(
$scope
,
$rootScope
,
$cookies
,
$route
,
$http
,
RESTURL
,
$location
,
$window
,
$timeout
){
$scope
.
prepareMenu
=
function
(
menuItems
){
var
newMenuItems
=
{};
return
angular
.
forEach
(
menuItems
,
function
(
value
,
key
){
angular
.
forEach
(
value
,
function
(
v
,
k
){
newMenuItems
[
k
]
=
v
})}),
newMenuItems
};
var
sidebarmenu
=
$
(
"#side-menu"
);
sidebarmenu
.
metisMenu
(),
$http
.
get
(
RESTURL
.
url
+
"menu/"
).
success
(
function
(
data
){
function
reGroupMenuItems
(
items
,
baseCategory
){
var
newItems
=
{};
return
angular
.
forEach
(
items
,
function
(
value
,
key
){
newItems
[
value
.
kategori
]
=
newItems
[
value
.
kategori
]
||
[],
value
.
baseCategory
=
baseCategory
,
newItems
[
value
.
kategori
].
push
(
value
)}),
newItems
}
$scope
.
allMenuItems
=
angular
.
copy
(
data
),
angular
.
forEach
(
$scope
.
allMenuItems
,
function
(
value
,
key
){
$scope
.
allMenuItems
[
key
]
=
reGroupMenuItems
(
value
,
key
)}),
$rootScope
.
$broadcast
(
"authz"
,
data
),
$scope
.
menuItems
=
$scope
.
prepareMenu
({
other
:
$scope
.
allMenuItems
.
other
}),
$timeout
(
function
(){
sidebarmenu
.
metisMenu
()})}),
$scope
.
$on
(
"menuitems"
,
function
(
event
,
data
){
var
menu
=
{
other
:
$scope
.
allMenuItems
.
other
};
menu
[
data
]
=
$scope
.
allMenuItems
[
data
],
$scope
.
menuItems
=
$scope
.
prepareMenu
(
menu
),
$timeout
(
function
(){
sidebarmenu
.
metisMenu
()})}),
$scope
.
openSidebar
=
function
(){
$window
.
innerWidth
>
"768"
&&
0
===
$rootScope
.
sidebarPinned
&&
(
jQuery
(
"span.menu-text, span.arrow, .sidebar footer, #side-menu"
).
fadeIn
(
400
),
jQuery
(
".sidebar"
).
css
(
"width"
,
"250px"
),
jQuery
(
".manager-view"
).
css
(
"width"
,
"calc(100% - 250px)"
),
$rootScope
.
collapsed
=!
1
)},
$scope
.
closeSidebar
=
function
(){
$window
.
innerWidth
>
"768"
&&
0
===
$rootScope
.
sidebarPinned
&&
(
jQuery
(
".sidebar"
).
css
(
"width"
,
"62px"
),
jQuery
(
".manager-view"
).
css
(
"width"
,
"calc(100% - 62px)"
),
$rootScope
.
collapsed
=!
0
)},
$rootScope
.
$watch
(
function
(
$rootScope
){
return
$rootScope
.
section
},
function
(
newindex
,
oldindex
){
newindex
>-
1
&&
(
$scope
.
menuItems
=
[
$scope
.
allMenuItems
[
newindex
]],
$scope
.
collapseVar
=
1
)}),
$scope
.
selectedMenu
=
$location
.
path
(),
$scope
.
collapseVar
=
0
,
$scope
.
multiCollapseVar
=
0
,
$scope
.
check
=
function
(
x
){
x
===
$scope
.
collapseVar
?
$scope
.
collapseVar
=
0
:
$scope
.
collapseVar
=
x
},
$scope
.
breadcrumb
=
function
(
itemlist
,
$event
){
$rootScope
.
breadcrumblinks
=
itemlist
,
$rootScope
.
showSaveButton
=!
1
},
$scope
.
multiCheck
=
function
(
y
){
y
===
$scope
.
multiCollapseVar
?
$scope
.
multiCollapseVar
=
0
:
$scope
.
multiCollapseVar
=
y
}}}}]).
directive
(
"stats"
,
function
(){
return
{
templateUrl
:
"shared/templates/directives/stats.html"
,
restrict
:
"E"
,
replace
:
!
0
,
scope
:{
model
:
"="
,
comments
:
"@"
,
number
:
"@"
,
name
:
"@"
,
colour
:
"@"
,
details
:
"@"
,
type
:
"@"
,
"goto"
:
"@"
}}}).
directive
(
"notifications"
,
function
(){
return
{
templateUrl
:
"shared/templates/directives/notifications.html"
,
restrict
:
"E"
,
replace
:
!
0
}}).
directive
(
"msgbox"
,
function
(){
return
{
templateUrl
:
"shared/templates/directives/msgbox.html"
,
restrict
:
"E"
,
replace
:
!
1
}}).
directive
(
"sidebarSearch"
,
function
(){
return
{
templateUrl
:
"shared/templates/directives/sidebar-search.html"
,
restrict
:
"E"
,
replace
:
!
0
,
scope
:{},
controller
:
function
(
$scope
){
$scope
.
selectedMenu
=
"home"
}}});
var
auth
=
angular
.
module
(
"ulakbus.auth"
,[
"ngRoute"
,
"schemaForm"
,
"ngCookies"
]);
auth
.
controller
(
"LoginCtrl"
,
function
(
$scope
,
$q
,
$timeout
,
$routeParams
,
Generator
,
LoginService
){
$scope
.
url
=
"login"
,
$scope
.
form_params
=
{},
$scope
.
form_params
.
clear_wf
=
1
,
Generator
.
get_form
(
$scope
).
then
(
function
(
data
){
$scope
.
form
=
[{
key
:
"username"
,
type
:
"string"
,
title
:
"Kullanıcı Adı"
},{
key
:
"password"
,
type
:
"password"
,
title
:
"Şifre"
},{
type
:
"submit"
,
title
:
"Giriş Yap"
}]}),
$scope
.
onSubmit
=
function
(
form
){
$scope
.
$broadcast
(
"schemaFormValidate"
),
form
.
$valid
?
LoginService
.
login
(
$scope
.
url
,
$scope
.
model
).
error
(
function
(
data
){
$scope
.
message
=
data
.
title
}):
console
.
log
(
"not valid"
)}}),
auth
.
factory
(
"LoginService"
,
function
(
$http
,
$rootScope
,
$location
,
$log
,
Session
,
RESTURL
){
var
loginService
=
{};
return
loginService
.
login
=
function
(
url
,
credentials
){
return
credentials
.
cmd
=
"do"
,
$http
.
post
(
RESTURL
.
url
+
url
,
credentials
).
success
(
function
(
data
,
status
,
headers
,
config
){
$rootScope
.
loggedInUser
=!
0
}).
error
(
function
(
data
,
status
,
headers
,
config
){
return
data
})},
loginService
.
logout
=
function
(){
return
$log
.
info
(
"logout"
),
$http
.
post
(
RESTURL
.
url
+
"logout"
,{}).
success
(
function
(
data
){
$rootScope
.
loggedInUser
=!
1
,
$log
.
info
(
"loggedout"
),
$location
.
path
(
"/login"
)})},
loginService
.
isAuthenticated
=
function
(){
return
!!
Session
.
userId
},
loginService
.
isAuthorized
=
function
(
authorizedRoles
){
return
angular
.
isArray
(
authorizedRoles
)
||
(
authorizedRoles
=
[
authorizedRoles
]),
loginService
.
isAuthenticated
()
&&-
1
!==
loginService
.
indexOf
(
Session
.
userRole
)},
loginService
.
isValidEmail
=
function
(
email
){
var
re
=
/^
([\w
-
]
+
(?:\.[\w
-
]
+
)
*
)
@
((?:[\w
-
]
+
\.)
*
\w[\w
-
]{0,66})\.([
a-z
]{2,6}(?:\.[
a-z
]{2})?)
$/i
;
return
re
.
test
(
email
)},
loginService
}),
auth
.
service
(
"Session"
,
function
(){
this
.
create
=
function
(
sessionId
,
userId
,
userRole
){
this
.
id
=
sessionId
,
this
.
userId
=
userId
,
this
.
userRole
=
userRole
},
this
.
destroy
=
function
(){
this
.
id
=
null
,
this
.
userId
=
null
,
this
.
userRole
=
null
}}),
angular
.
module
(
"ulakbus.dashboard"
,[
"ngRoute"
]).
controller
(
"DashCtrl"
,
function
(
$scope
,
$rootScope
,
$timeout
,
$http
,
$cookies
,
RESTURL
){
$scope
.
section
=
function
(
section_index
){
$rootScope
.
section
=
section_index
},
$scope
.
$on
(
"authz"
,
function
(
event
,
data
){
$scope
.
menuitems
=
data
}),
$scope
.
student_kw
=
""
,
$scope
.
staff_kw
=
""
,
$scope
.
students
=
[],
$scope
.
staffs
=
[],
$scope
.
search
=
function
(
where
){
$timeout
(
function
(){
"personel"
===
where
&&
$scope
.
staff_kw
.
length
>
2
&&
$scope
.
getItems
(
where
,
$scope
.
staff_kw
).
success
(
function
(
data
){
$scope
.
staffs
=
data
.
results
}),
"ogrenci"
===
where
&&
$scope
.
student_kw
.
length
>
2
&&
$scope
.
getItems
(
where
,
$scope
.
student_kw
).
success
(
function
(
data
){
$scope
.
students
=
data
.
results
})})},
$scope
.
getItems
=
function
(
where
,
what
){
return
$http
.
get
(
RESTURL
.
url
+
"ara/"
+
where
+
"/"
+
what
)},
$scope
.
select
=
function
(
who
,
type
){
$rootScope
.
selectedUser
=
{
name
:
who
[
0
],
tcno
:
who
[
1
],
key
:
who
[
2
]},
$rootScope
.
$broadcast
(
"menuitems"
,
type
)},
$scope
.
$on
(
"notifications"
,
function
(
event
,
data
){
$scope
.
notifications
=
data
}),
$scope
.
markAsRead
=
function
(
items
){
$rootScope
.
$broadcast
(
"markasread"
,
items
)}}).
directive
(
"sidebarNotifications"
,
function
(){
return
{
templateUrl
:
"shared/templates/directives/sidebar-notification.html"
,
"use strict"
;
var
app
=
angular
.
module
(
"ulakbus"
,[
"ui.bootstrap"
,
"angular-loading-bar"
,
"ngRoute"
,
"ngSanitize"
,
"ngCookies"
,
"formService"
,
"ulakbus.dashboard"
,
"ulakbus.auth"
,
"ulakbus.error_pages"
,
"ulakbus.crud"
,
"ulakbus.debug"
,
"ulakbus.devSettings"
,
"ulakbus.version"
,
"gettext"
,
"templates-prod"
]).
constant
(
"RESTURL"
,
function
(){
var
backendurl
=
location
.
href
.
indexOf
(
"nightly"
)
>-
1
?
"//nightly.api.ulakbus.net/"
:
"//api.ulakbus.net/"
;
if
(
document
.
cookie
.
indexOf
(
"backendurl"
)
>-
1
){
var
cookiearray
=
document
.
cookie
.
split
(
";"
);
angular
.
forEach
(
cookiearray
,
function
(
item
){
item
.
indexOf
(
"backendurl"
)
>-
1
&&
(
backendurl
=
item
.
split
(
"="
)[
1
])})}
if
(
location
.
href
.
indexOf
(
"backendurl"
)
>-
1
){
var
urlfromqstr
=
location
.
href
.
split
(
"?"
)[
1
].
split
(
"="
)[
1
];
backendurl
=
decodeURIComponent
(
urlfromqstr
.
replace
(
/
\+
/g
,
" "
)),
document
.
cookie
=
"backendurl="
+
backendurl
,
window
.
location
.
href
=
window
.
location
.
href
.
split
(
"?"
)[
0
]}
return
{
url
:
backendurl
}}()).
constant
(
"USER_ROLES"
,{
all
:
"*"
,
admin
:
"admin"
,
student
:
"student"
,
staff
:
"staff"
,
dean
:
"dean"
}).
constant
(
"AUTH_EVENTS"
,{
loginSuccess
:
"auth-login-success"
,
loginFailed
:
"auth-login-failed"
,
logoutSuccess
:
"auth-logout-success"
,
sessionTimeout
:
"auth-session-timeout"
,
notAuthenticated
:
"auth-not-authenticated"
,
notAuthorized
:
"auth-not-authorized"
});
app
.
config
([
"$routeProvider"
,
function
(
$routeProvider
,
$route
){
$routeProvider
.
when
(
"/login"
,{
templateUrl
:
"components/auth/login.html"
,
controller
:
"LoginCtrl"
}).
when
(
"/dashboard"
,{
templateUrl
:
"components/dashboard/dashboard.html"
,
controller
:
"DashCtrl"
}).
when
(
"/dev/settings"
,{
templateUrl
:
"components/devSettings/devSettings.html"
,
controller
:
"DevSettingsCtrl"
}).
when
(
"/debug/list"
,{
templateUrl
:
"components/debug/debug.html"
,
controller
:
"DebugCtrl"
}).
when
(
"/:wf/"
,{
templateUrl
:
"components/crud/templates/crud.html"
,
controller
:
"CRUDCtrl"
}).
when
(
"/:wf/do/:cmd"
,{
templateUrl
:
"components/crud/templates/crud.html"
,
controller
:
"CRUDListFormCtrl"
}).
when
(
"/:wf/do/:cmd/:key"
,{
templateUrl
:
"components/crud/templates/crud.html"
,
controller
:
"CRUDListFormCtrl"
}).
when
(
"/:wf/:model"
,{
templateUrl
:
"components/crud/templates/crud.html"
,
controller
:
"CRUDCtrl"
}).
when
(
"/:wf/:model/do/:cmd"
,{
templateUrl
:
"components/crud/templates/crud.html"
,
controller
:
"CRUDListFormCtrl"
}).
when
(
"/:wf/:model/do/:cmd/:key"
,{
templateUrl
:
"components/crud/templates/crud.html"
,
controller
:
"CRUDListFormCtrl"
}).
otherwise
({
redirectTo
:
"/dashboard"
})}]).
run
(
function
(
$rootScope
){
$rootScope
.
loggedInUser
=!
0
,
$rootScope
.
$on
(
"$routeChangeStart"
,
function
(
event
,
next
,
current
){})}).
config
([
"$httpProvider"
,
function
(
$httpProvider
){
$httpProvider
.
defaults
.
withCredentials
=!
0
}]).
run
(
function
(
gettextCatalog
){
gettextCatalog
.
setCurrentLanguage
(
"tr"
),
gettextCatalog
.
debug
=!
0
}).
config
([
"cfpLoadingBarProvider"
,
function
(
cfpLoadingBarProvider
){
cfpLoadingBarProvider
.
includeBar
=!
1
,
cfpLoadingBarProvider
.
parentSelector
=
"loaderdiv"
,
cfpLoadingBarProvider
.
spinnerTemplate
=
'<div class="loader">Loading...</div>'
}]),
app
.
config
([
"$httpProvider"
,
function
(
$httpProvider
){
$httpProvider
.
interceptors
.
push
(
function
(
$q
,
$rootScope
,
$location
,
$timeout
){
return
{
request
:
function
(
config
){
return
"POST"
===
config
.
method
&&
(
config
.
headers
[
"Content-Type"
]
=
"text/plain"
),
config
},
response
:
function
(
response
){
return
response
.
data
.
_debug_queries
&&
response
.
data
.
_debug_queries
.
length
>
0
&&
(
$rootScope
.
debug_queries
=
$rootScope
.
debug_queries
||
[],
$rootScope
.
debug_queries
.
push
({
url
:
response
.
config
.
url
,
queries
:
response
.
data
.
_debug_queries
})),
response
.
data
.
is_login
===!
1
&&
(
$rootScope
.
loggedInUser
=
response
.
data
.
is_login
,
$location
.
path
(
"/login"
)),
response
.
data
.
is_login
===!
0
&&
(
$rootScope
.
loggedInUser
=!
0
,
"/login"
===
$location
.
path
()
&&
$location
.
path
(
"/dashboard"
)),
response
},
responseError
:
function
(
rejection
){
var
errorModal
=
function
(){
var
codefield
=
""
;
rejection
.
data
.
error
&&
(
codefield
=
"<p><pre>"
+
rejection
.
data
.
error
+
"</pre></p>"
),
$
(
'<div class="modal"><div class="modal-dialog" style="width:1024px;" role="document"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button><h4 class="modal-title" id="exampleModalLabel">'
+
rejection
.
status
+
rejection
.
data
.
title
+
'</h4></div><div class="modal-body"><div class="alert alert-danger"><strong>'
+
rejection
.
data
.
description
+
"</strong>"
+
codefield
+
'</div></div><div class="modal-footer"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button></div></div></div></div>'
).
modal
()};
return
-
1
===
rejection
.
status
&&
(
rejection
.
data
=
{
title
:
"error"
,
description
:
"connection failed"
},
errorModal
()),
400
===
rejection
.
status
&&
$location
.
reload
(),
401
===
rejection
.
status
&&
(
$location
.
path
(
"/login"
),
"/login"
===
$location
.
path
()
&&
console
.
log
(
"show errors on login form"
)),
403
===
rejection
.
status
&&
(
rejection
.
data
.
is_login
===!
0
&&
(
$rootScope
.
loggedInUser
=!
0
,
"/login"
===
$location
.
path
()
&&
$location
.
path
(
"/dashboard"
)),
errorModal
()),
$rootScope
.
$broadcast
(
"show_notifications"
,
rejection
.
data
),
404
===
rejection
.
status
&&
errorModal
(),
500
===
rejection
.
status
&&
errorModal
(),
$q
.
reject
(
rejection
)}}})}]),
angular
.
module
(
"formService"
,[
"ui.bootstrap"
]).
factory
(
"Generator"
,
function
(
$http
,
$q
,
$timeout
,
$location
,
$route
,
$compile
,
$log
,
RESTURL
,
$rootScope
){
var
generator
=
{};
return
generator
.
makeUrl
=
function
(
scope
){
var
getparams
=
scope
.
form_params
.
param
?
"?"
+
scope
.
form_params
.
param
+
"="
+
scope
.
form_params
.
id
:
""
;
return
RESTURL
.
url
+
scope
.
url
+
getparams
},
generator
.
generate
=
function
(
scope
,
data
){
return
data
.
forms
?(
angular
.
forEach
(
data
.
forms
,
function
(
value
,
key
){
scope
[
key
]
=
data
.
forms
[
key
]}),
scope
.
client_cmd
=
data
.
client_cmd
,
scope
.
token
=
data
.
token
,
scope
.
initialModel
=
angular
.
copy
(
scope
.
model
),
generator
.
prepareFormItems
(
scope
),
scope
.
object_id
=
scope
.
form_params
.
object_id
,
$log
.
debug
(
"scope at after generate"
,
scope
),
scope
):
scope
},
generator
.
group
=
function
(
formObject
){
return
formObject
},
generator
.
prepareFormItems
=
function
(
scope
){
return
angular
.
forEach
(
scope
.
form
,
function
(
value
,
key
){
"select"
===
value
.
type
&&
(
scope
.
schema
.
properties
[
value
.
key
].
type
=
"select"
,
scope
.
schema
.
properties
[
value
.
key
].
titleMap
=
value
.
titleMap
,
scope
.
form
[
key
]
=
value
.
key
)}),
angular
.
forEach
(
scope
.
schema
.
properties
,
function
(
v
,
k
){
if
(
"form_params"
in
scope
&&
k
==
scope
.
form_params
.
param
)
return
scope
.
model
[
k
]
=
scope
.
form_params
.
id
,
void
scope
.
form
.
splice
(
scope
.
form
.
indexOf
(
k
),
1
);
if
(
"select"
===
v
.
type
&&
(
scope
.
form
[
scope
.
form
.
indexOf
(
k
)]
=
{
type
:
"template"
,
title
:
v
.
title
,
templateUrl
:
"shared/templates/select.html"
,
name
:
k
,
key
:
k
,
titleMap
:
v
.
titleMap
}),
"submit"
===
v
.
type
||
"button"
===
v
.
type
){
var
buttonPositions
=
scope
.
modalElements
?
scope
.
modalElements
.
buttonPositions
:{
bottom
:
"move-to-bottom"
,
top
:
"move-to-top"
,
none
:
""
},
workOnForm
=
scope
.
modalElements
?
scope
.
modalElements
.
workOnForm
:
"formgenerated"
,
workOnDiv
=
scope
.
modalElements
?
scope
.
modalElements
.
workOnDiv
:
""
,
buttonClass
=
buttonPositions
[
v
.
position
]
||
buttonPositions
.
bottom
,
redirectTo
=
scope
.
modalElements
?
!
1
:
!
0
;
scope
.
form
[
scope
.
form
.
indexOf
(
k
)]
=
{
type
:
v
.
type
,
title
:
v
.
title
,
style
:
"btn-primary hide "
+
buttonClass
,
onClick
:
function
(){
delete
scope
.
form_params
.
cmd
,
delete
scope
.
form_params
.
flow
,
v
.
cmd
&&
(
scope
.
form_params
.
cmd
=
v
.
cmd
),
v
.
flow
&&
(
scope
.
form_params
.
flow
=
v
.
flow
),
scope
.
model
[
k
]
=
1
,
scope
.
modalElements
?
scope
.
submitModalForm
():
v
.
validation
===!
1
?
generator
.
submit
(
scope
,
redirectTo
):(
scope
.
$broadcast
(
"schemaFormValidate"
),
scope
[
workOnForm
].
$valid
&&
(
generator
.
submit
(
scope
,
redirectTo
),
scope
.
$broadcast
(
"disposeModal"
)))}},
$timeout
(
function
(){
var
selectorBottom
=
".buttons-on-bottom"
+
workOnDiv
,
buttonsToBottom
=
angular
.
element
(
document
.
querySelector
(
"."
+
buttonClass
));
angular
.
element
(
document
.
querySelector
(
selectorBottom
)).
append
(
buttonsToBottom
),
buttonsToBottom
.
removeClass
(
"hide"
)})}
if
(
"date"
===
v
.
type
&&
(
scope
.
form
[
scope
.
form
.
indexOf
(
k
)]
=
{
key
:
k
,
name
:
k
,
validationMessage
:{
dateNotValid
:
"Girdiğiniz tarih geçerli değildir. <i>orn: '01.01.2015'<i/>"
},
$asyncValidators
:{
dateNotValid
:
function
(
value
){
var
deferred
=
$q
.
defer
();
return
$timeout
(
function
(){
isNaN
(
Date
.
parse
(
value
))
||
3
!==
value
.
split
(
"."
).
length
?
deferred
.
reject
():
deferred
.
resolve
()},
500
),
deferred
.
promise
}}},
v
.
type
=
"string"
,
scope
.
model
[
k
]
=
generator
.
dateformatter
(
scope
.
model
[
k
]),
$timeout
(
function
(){
jQuery
(
"#"
+
k
).
datepicker
({
changeMonth
:
!
0
,
changeYear
:
!
0
,
dateFormat
:
"dd.mm.yy"
,
onSelect
:
function
(
date
,
inst
){
scope
.
model
[
k
]
=
date
,
scope
.
modalElements
?
scope
.
validateModalDate
(
k
):
scope
.
$broadcast
(
"schemaForm.error."
+
k
,
"tv4-302"
,
!
0
)}})})),(
"int"
===
v
.
type
||
"float"
===
v
.
type
)
&&
(
v
.
type
=
"number"
,
scope
.
model
[
k
]
=
parseInt
(
scope
.
model
[
k
])),
"text_general"
===
v
.
type
&&
(
v
.
type
=
"string"
,
v
[
"x-schema-form"
]
=
{
type
:
"textarea"
}),
"model"
===
v
.
type
){
var
formitem
=
scope
.
form
[
scope
.
form
.
indexOf
(
k
)],
modelScope
=
{
url
:
v
.
wf
,
form_params
:{
model
:
v
.
model_name
,
cmd
:
v
.
list_cmd
}};
scope
.
generateTitleMap
=
function
(
modelScope
){
generator
.
get_list
(
modelScope
).
then
(
function
(
res
){
formitem
.
titleMap
=
[],
angular
.
forEach
(
res
.
data
.
objects
,
function
(
item
){
"-1"
!==
item
&&
formitem
.
titleMap
.
push
({
value
:
item
.
key
,
name
:
item
.
value
}),
item
.
key
===
scope
.
model
[
k
]
&&
(
formitem
.
selected_item
=
{
value
:
item
.
key
,
name
:
item
.
value
})});
try
{
scope
.
$watch
(
document
.
querySelector
(
"input[name="
+
v
.
model_name
+
"]"
),
function
(){
angular
.
element
(
document
.
querySelector
(
"input[name="
+
v
.
model_name
+
"]"
)).
val
(
formitem
.
selected_item
.
name
)})}
catch
(
e
){
$log
.
debug
(
"exception"
,
e
)}})},
formitem
=
{
type
:
"template"
,
templateUrl
:
"shared/templates/foreignKey.html"
,
formName
:
k
,
title
:
v
.
title
,
wf
:
v
.
wf
,
add_cmd
:
v
.
add_cmd
,
name
:
v
.
model_name
,
model_name
:
v
.
model_name
,
selected_item
:{},
titleMap
:
scope
.
generateTitleMap
(
modelScope
),
onSelect
:
function
(
item
){
scope
.
model
[
k
]
=
item
.
value
},
onDropdownSelect
:
function
(
item
,
inputname
){
scope
.
model
[
k
]
=
item
.
value
,
jQuery
(
"input[name="
+
inputname
+
"]"
).
val
(
item
.
name
)}},
scope
.
form
[
scope
.
form
.
indexOf
(
k
)]
=
formitem
}
if
((
"ListNode"
===
v
.
type
||
"Node"
===
v
.
type
)
&&
"filter_interface"
===
v
.
widget
){
var
formitem
=
scope
.
form
[
scope
.
form
.
indexOf
(
k
)],
modelScope
=
{
url
:
v
.
wf
||
scope
.
wf
,
form_params
:{
model
:
v
.
model_name
||
v
.
schema
[
0
].
model_name
,
cmd
:
v
.
list_cmd
||
"select_list"
}};
scope
.
generateTitleMap
=
function
(
modelScope
){
generator
.
get_list
(
modelScope
).
then
(
function
(
res
){
formitem
.
titleMap
=
[],
angular
.
forEach
(
res
.
data
.
objects
,
function
(
item
){
"-1"
!==
item
&&
formitem
.
titleMap
.
push
({
value
:
item
.
key
,
name
:
item
.
value
})}),
formitem
.
filteredItems
=
generator
.
get_diff_array
(
angular
.
copy
(
formitem
.
titleMap
),
angular
.
copy
(
formitem
.
selectedFilteredItems
))})};
var
modelItems
=
[];
angular
.
forEach
(
scope
.
model
[
k
],
function
(
value
,
mkey
){
modelItems
.
push
({
value
:
value
[
v
.
schema
[
0
].
name
].
key
,
name
:
value
[
v
.
schema
[
0
].
name
].
unicode
})}),
formitem
=
{
type
:
"template"
,
templateUrl
:
"shared/templates/multiselect.html"
,
title
:
v
.
title
,
formName
:
k
,
wf
:
v
.
wf
,
add_cmd
:
v
.
add_cmd
,
name
:
v
.
model_name
,
model_name
:
v
.
model_name
,
filterValue
:
""
,
selected_item
:{},
filteredItems
:[],
selectedFilteredItems
:
modelItems
,
titleMap
:
scope
.
generateTitleMap
(
modelScope
),
onSelect
:
function
(
item
){
scope
.
model
[
k
]
=
item
.
value
},
onDropdownSelect
:
function
(
item
,
inputname
){
scope
.
model
[
k
]
=
item
.
value
,
jQuery
(
"input[name="
+
inputname
+
"]"
).
val
(
item
.
name
)},
appendFiltered
:
function
(
filterValue
){
filterValue
.
length
>
2
&&
(
formitem
.
filteredItems
=
[],
angular
.
forEach
(
formitem
.
titleMap
,
function
(
value
,
key
){
value
.
name
.
indexOf
(
filterValue
)
>-
1
&&
formitem
.
filteredItems
.
push
(
formitem
.
titleMap
[
key
])})),
formitem
.
filteredItems
=
generator
.
get_diff_array
(
formitem
.
filteredItems
,
formitem
.
selectedFilteredItems
)},
select
:
function
(
selectedItemsModel
){
selectedItemsModel
&&
(
formitem
.
selectedFilteredItems
=
formitem
.
selectedFilteredItems
.
concat
(
selectedItemsModel
),
formitem
.
appendFiltered
(
formitem
.
filterValue
),
scope
.
model
[
k
]
=
formitem
.
dataToModel
(
selectedItemsModel
))},
deselect
:
function
(
selectedFilteredItemsModel
){
selectedFilteredItemsModel
&&
(
formitem
.
selectedFilteredItems
=
generator
.
get_diff_array
(
angular
.
copy
(
formitem
.
selectedFilteredItems
),
angular
.
copy
(
selectedFilteredItemsModel
)),
formitem
.
appendFiltered
(
formitem
.
filterValue
),
formitem
.
filteredItems
=
formitem
.
filteredItems
.
concat
(
selectedFilteredItemsModel
),
scope
.
model
[
k
]
=
formitem
.
dataToModel
(
formitem
.
selectedFilteredItems
))},
dataToModel
:
function
(
data
){
var
dataValues
=
[];
return
angular
.
forEach
(
data
,
function
(
value
,
key
){
var
dataKey
=
{};
dataKey
[
v
.
schema
[
0
].
name
]
=
value
.
value
,
dataValues
.
push
(
dataKey
)}),
dataValues
}},
scope
.
form
[
scope
.
form
.
indexOf
(
k
)]
=
formitem
}
"ListNode"
!==
v
.
type
&&
"Node"
!==
v
.
type
||
"filter_interface"
===
v
.
widget
||
(
scope
[
v
.
type
]
=
scope
[
v
.
type
]
||
{},
scope
[
v
.
type
][
k
]
=
angular
.
copy
({
title
:
v
.
title
,
form
:[],
schema
:{
properties
:{},
required
:[],
title
:
v
.
title
,
type
:
"object"
,
formType
:
v
.
type
,
model_name
:
k
},
url
:
scope
.
url
}),
scope
[
v
.
type
][
k
].
model
=
angular
.
copy
(
scope
.
model
[
k
])
||
{},
"ListNode"
===
v
.
type
&&
(
scope
[
v
.
type
][
k
].
items
=
[]),
angular
.
forEach
(
v
.
schema
,
function
(
item
){
scope
[
v
.
type
][
k
].
schema
.
properties
[
item
.
name
]
=
angular
.
copy
(
item
),
item
.
required
===!
0
&&
"idx"
!==
item
.
name
&&
scope
[
v
.
type
][
k
].
schema
.
required
.
push
(
angular
.
copy
(
item
.
name
)),
"idx"
===
item
.
name
?
scope
[
v
.
type
][
k
].
form
.
push
({
type
:
"string"
,
key
:
angular
.
copy
(
item
.
name
),
htmlClass
:
"hidden"
}):
scope
[
v
.
type
][
k
].
form
.
push
(
item
.
name
)}),
scope
[
v
.
type
][
k
].
lengthModels
=
scope
.
model
[
k
]?
1
:
0
)}),
$log
.
debug
(
"scope at after prepareformitems"
,
scope
),
scope
},
generator
.
dateformatter
=
function
(
formObject
){
var
ndate
=
new
Date
(
formObject
);
if
(
"Invalid Date"
==
ndate
)
return
""
;
var
newdatearray
=
[
ndate
.
getDate
(),
ndate
.
getMonth
()
+
1
,
ndate
.
getFullYear
()];
return
newdatearray
.
join
(
"."
)},
generator
.
doItemAction
=
function
(
$scope
,
key
,
cmd
,
mode
){
var
_do
=
{
normal
:
function
(){
return
$log
.
debug
(
"normal mode starts"
),
$scope
.
form_params
.
cmd
=
cmd
,
$scope
.
form_params
.
object_id
=
key
,
$scope
.
form_params
.
param
=
$scope
.
param
,
$scope
.
form_params
.
id
=
$scope
.
param_id
,
$scope
.
form_params
.
token
=
$scope
.
token
,
generator
.
get_wf
(
$scope
)},
modal
:
function
(){
$log
.
debug
(
"modal mode is not not ready"
)},
"new"
:
function
(){
$log
.
debug
(
"new mode is not not ready"
)}};
return
_do
[
mode
]()},
generator
.
get_form
=
function
(
scope
){
return
$http
.
post
(
generator
.
makeUrl
(
scope
),
scope
.
form_params
).
then
(
function
(
res
){
return
generator
.
generate
(
scope
,
res
.
data
)})},
generator
.
get_list
=
function
(
scope
){
return
$http
.
post
(
generator
.
makeUrl
(
scope
),
scope
.
form_params
).
then
(
function
(
res
){
return
res
})},
generator
.
get_wf
=
function
(
scope
){
return
$http
.
post
(
generator
.
makeUrl
(
scope
),
scope
.
form_params
).
then
(
function
(
res
){
if
(
res
.
data
.
client_cmd
)
return
generator
.
pathDecider
(
res
.
data
.
client_cmd
,
scope
,
res
.
data
);
if
(
res
.
data
.
msgbox
){
scope
.
msgbox
=
res
.
data
.
msgbox
;
var
newElement
=
$compile
(
"<msgbox></msgbox>"
)(
scope
);
angular
.
element
(
document
.
querySelector
(
".main.ng-scope"
)).
children
().
remove
(),
angular
.
element
(
document
.
querySelector
(
".main.ng-scope"
)).
append
(
newElement
)}})},
generator
.
isValidEmail
=
function
(
email
){
var
re
=
/^
([\w
-
]
+
(?:\.[\w
-
]
+
)
*
)
@
((?:[\w
-
]
+
\.)
*
\w[\w
-
]{0,66})\.([
a-z
]{2,6}(?:\.[
a-z
]{2})?)
$/i
;
return
re
.
test
(
email
)},
generator
.
isValidTCNo
=
function
(
tcno
){
var
re
=
/^
([
1-9
]{1}[
0-9
]{9}[
0,2,4,6,8
]{1})
$/i
;
return
re
.
test
(
tcno
)},
generator
.
isValidDate
=
function
(
dateValue
){
var
datevalid
=
Date
.
parse
(
dateValue
)
===
Nan
?
!
1
:
!
0
;
return
datevalid
},
generator
.
asyncValidators
=
{
emailNotValid
:
function
(
value
){
var
deferred
=
$q
.
defer
();
return
$timeout
(
function
(){
generator
.
isValidEmail
(
value
)?
deferred
.
resolve
():
deferred
.
reject
()},
500
),
deferred
.
promise
},
tcNoNotValid
:
function
(
value
){
var
deferred
=
$q
.
defer
();
return
$timeout
(
function
(){
generator
.
isValidTCNo
(
value
)?
deferred
.
resolve
():
deferred
.
reject
()},
500
),
deferred
.
promise
}},
generator
.
pageData
=
{},
generator
.
getPageData
=
function
(){
return
generator
.
pageData
},
generator
.
setPageData
=
function
(
value
){
generator
.
pageData
=
value
},
generator
.
pathDecider
=
function
(
client_cmd
,
$scope
,
data
){
function
redirectTo
(
scope
,
page
){
var
pathUrl
=
"/"
+
scope
.
form_params
.
wf
;
return
pathUrl
+=
scope
.
form_params
.
model
?
"/"
+
scope
.
form_params
.
model
+
"/do/"
+
page
:
"/do/"
+
page
,
$location
.
path
()
===
pathUrl
?
$route
.
reload
():
void
$location
.
path
(
pathUrl
)}
function
dispatchClientCmd
(){
data
[
$scope
.
form_params
.
param
]
=
$scope
.
form_params
.
id
,
data
.
model
=
$scope
.
form_params
.
model
,
data
.
wf
=
$scope
.
form_params
.
wf
,
data
.
param
=
$scope
.
form_params
.
param
,
data
.
param_id
=
$scope
.
form_params
.
id
,
data
.
pageData
=!
0
,
generator
.
setPageData
(
data
),
redirectTo
(
$scope
,
client_cmd
[
0
])}
return
"reload"
===
client_cmd
[
0
]
||
"reset"
===
client_cmd
[
0
]?
void
$rootScope
.
$broadcast
(
"reload_cmd"
,
client_cmd
[
0
]):
void
dispatchClientCmd
()},
generator
.
get_diff
=
function
(
obj1
,
obj2
){
var
result
=
{};
for
(
key
in
obj1
)
obj2
[
key
]
!=
obj1
[
key
]
&&
(
result
[
key
]
=
obj1
[
key
]),
"array"
==
typeof
obj2
[
key
]
&&
"array"
==
typeof
obj1
[
key
]
&&
(
result
[
key
]
=
arguments
.
callee
(
obj1
[
key
],
obj2
[
key
])),
"object"
==
typeof
obj2
[
key
]
&&
"object"
==
typeof
obj1
[
key
]
&&
(
result
[
key
]
=
arguments
.
callee
(
obj1
[
key
],
obj2
[
key
]));
return
result
},
generator
.
get_diff_array
=
function
(
array1
,
array2
){
var
result
=
[];
return
angular
.
forEach
(
array1
,
function
(
value
,
key
){
angular
.
toJson
(
array2
).
indexOf
(
value
.
value
)
<
0
&&
result
.
push
(
value
)}),
result
},
generator
.
submit
=
function
(
$scope
,
redirectTo
){
angular
.
forEach
(
$scope
.
ListNode
,
function
(
value
,
key
){
$scope
.
model
[
key
]
=
value
.
items
}),
angular
.
forEach
(
$scope
.
Node
,
function
(
value
,
key
){
$scope
.
model
[
key
]
=
value
.
model
});
var
data
=
{
form
:
$scope
.
model
,
token
:
$scope
.
token
,
model
:
$scope
.
form_params
.
model
,
cmd
:
$scope
.
form_params
.
cmd
,
flow
:
$scope
.
form_params
.
flow
,
object_id
:
$scope
.
object_id
};
return
$http
.
post
(
generator
.
makeUrl
(
$scope
),
data
).
success
(
function
(
data
){
if
(
redirectTo
===!
0
&&
(
data
.
client_cmd
&&
generator
.
pathDecider
(
data
.
client_cmd
,
$scope
,
data
),
data
.
msgbox
)){
$scope
.
msgbox
=
data
.
msgbox
;
var
newElement
=
$compile
(
"<msgbox></msgbox>"
)(
$scope
);
angular
.
element
(
document
.
querySelector
(
".main.ng-scope"
)).
children
().
remove
(),
angular
.
element
(
document
.
querySelector
(
".main.ng-scope"
)).
append
(
newElement
)}})},
generator
}).
controller
(
"ModalCtrl"
,
function
(
$scope
,
$uibModalInstance
,
Generator
,
items
){
angular
.
forEach
(
items
,
function
(
value
,
key
){
$scope
[
key
]
=
items
[
key
]}),
$scope
.
$on
(
"disposeModal"
,
function
(){
$scope
.
cancel
()}),
$scope
.
$on
(
"modalFormLocator"
,
function
(
event
){
$scope
.
linkedModelForm
=
event
.
targetScope
.
linkedModelForm
}),
$scope
.
$on
(
"submitModalForm"
,
function
(){
$scope
.
onSubmit
(
$scope
.
linkedModelForm
)}),
$scope
.
$on
(
"validateModalDate"
,
function
(
event
,
field
){
$scope
.
$broadcast
(
"schemaForm.error."
+
field
,
"tv4-302"
,
!
0
)}),
$scope
.
onSubmit
=
function
(
form
){
$scope
.
$broadcast
(
"schemaFormValidate"
),
form
.
$valid
&&
$uibModalInstance
.
close
(
$scope
)},
$scope
.
onNodeSubmit
=
function
(){
$scope
.
$broadcast
(
"schemaFormValidate"
),
$scope
.
modalForm
.
$valid
&&
$uibModalInstance
.
close
(
$scope
)},
$scope
.
cancel
=
function
(){
$uibModalInstance
.
dismiss
(
"cancel"
)}}).
directive
(
"modalForNodes"
,
function
(
$uibModal
,
Generator
){
return
{
link
:
function
(
scope
,
element
,
attributes
){
element
.
on
(
"click"
,
function
(){
var
modalInstance
=
$uibModal
.
open
({
animation
:
!
0
,
backdrop
:
"static"
,
templateUrl
:
"shared/templates/listnodeModalContent.html"
,
controller
:
"ModalCtrl"
,
size
:
"lg"
,
resolve
:{
items
:
function
(){
var
attribs
=
attributes
.
modalForNodes
.
split
(
","
),
node
=
angular
.
copy
(
scope
.
$parent
[
attribs
[
1
]][
attribs
[
0
]]);
"add"
===
attribs
[
2
]
&&
(
node
.
model
=
{}),
attribs
[
3
]
&&
(
node
.
model
=
node
.
model
[
attribs
[
3
]]),
node
.
edit
=
attribs
[
3
],
scope
.
node
.
schema
.
wf
=
scope
.
node
.
url
,
angular
.
forEach
(
scope
.
node
.
schema
.
properties
,
function
(
value
,
key
){
scope
.
node
.
schema
.
properties
[
key
].
wf
=
scope
.
node
.
url
,
scope
.
node
.
schema
.
properties
[
key
].
list_cmd
=
"select_list"
});
var
newscope
=
{
url
:
scope
.
node
.
url
,
form_params
:{
model
:
scope
.
node
.
schema
.
model_name
}};
return
Generator
.
generate
(
newscope
,{
forms
:
scope
.
node
}),
newscope
}}});
modalInstance
.
result
.
then
(
function
(
childmodel
,
key
){
var
listNodeItem
=
scope
.
$parent
[
childmodel
.
schema
.
formType
][
childmodel
.
schema
.
model_name
];
"Node"
===
childmodel
.
schema
.
formType
&&
(
listNodeItem
.
model
=
angular
.
copy
(
childmodel
.
model
),
listNodeItem
.
lengthModels
+=
1
),
"ListNode"
===
childmodel
.
schema
.
formType
&&
(
childmodel
.
edit
?
listNodeItem
.
model
[
childmodel
.
edit
]
=
childmodel
.
model
:
listNodeItem
.
items
.
push
(
angular
.
copy
(
childmodel
.
model
)),
listNodeItem
.
lengthModels
+=
1
)})})}}}).
directive
(
"addModalForLinkedModel"
,
function
(
$uibModal
,
$rootScope
,
$route
,
Generator
){
return
{
link
:
function
(
scope
,
element
,
attributes
){
element
.
on
(
"click"
,
function
(){
var
modalInstance
=
$uibModal
.
open
({
animation
:
!
0
,
backdrop
:
"static"
,
templateUrl
:
"shared/templates/linkedModelModalContent.html"
,
controller
:
"ModalCtrl"
,
size
:
"lg"
,
resolve
:{
items
:
function
(){
var
formName
=
attributes
.
addModalForLinkedModel
;
return
Generator
.
get_form
({
url
:
scope
.
form
.
wf
,
form_params
:{
model
:
scope
.
form
.
model_name
,
cmd
:
scope
.
form
.
add_cmd
},
modalElements
:{
buttonPositions
:{
bottom
:
"move-to-bottom-modal"
,
top
:
"move-to-top-modal"
,
none
:
""
},
workOnForm
:
"linkedModelForm"
,
workOnDiv
:
"-modal"
},
submitModalForm
:
function
(){
$rootScope
.
$broadcast
(
"submitModalForm"
)},
validateModalDate
:
function
(
field
){
$rootScope
.
$broadcast
(
"validateModalDate"
,
field
)},
formName
:
formName
})}}});
modalInstance
.
result
.
then
(
function
(
childscope
,
key
){
var
formName
=
childscope
.
formName
;
Generator
.
submit
(
childscope
,
!
1
).
success
(
function
(
data
){
scope
.
model
[
formName
]
=
data
.
forms
.
model
.
object_key
,
scope
.
form
.
titleMap
.
push
({
value
:
data
.
forms
.
model
.
object_key
,
name
:
data
.
forms
.
model
.
unicode
}),
scope
.
form
.
selected_item
=
{
value
:
data
.
forms
.
model
.
object_key
,
name
:
data
.
forms
.
model
.
unicode
},
scope
.
$watch
(
document
.
querySelector
(
"input[name="
+
scope
.
form
.
model_name
+
"]"
),
function
(){
angular
.
element
(
document
.
querySelector
(
"input[name="
+
scope
.
form
.
model_name
+
"]"
)).
val
(
scope
.
form
.
selected_item
.
name
)})})})})}}}).
directive
(
"modalFormLocator"
,
function
(){
return
{
link
:
function
(
scope
){
scope
.
$emit
(
"modalFormLocator"
)}}}).
directive
(
"editModalForLinkedModel"
,
function
(
$uibModal
,
Generator
){
return
{
link
:
function
(
scope
,
element
){
element
.
on
(
"click"
,
function
(){
var
modalInstance
=
$uibModal
.
open
({
animation
:
!
1
,
templateUrl
:
"shared/templates/linkedModelModalContent.html"
,
controller
:
"ModalCtrl"
,
size
:
"lg"
,
resolve
:{
items
:
function
(){
return
Generator
.
get_form
({
url
:
"crud"
,
form_params
:{
model
:
scope
.
form
.
title
,
cmd
:
"form"
}})}}});
modalInstance
.
result
.
then
(
function
(
childmodel
,
key
){
Generator
.
submit
(
childmodel
)})})}}}),
app
.
directive
(
"logout"
,
function
(
$http
,
$location
,
RESTURL
){
return
{
link
:
function
(
$scope
,
$element
,
$rootScope
){
$element
.
on
(
"click"
,
function
(){
$http
.
post
(
RESTURL
.
url
+
"logout"
,{}).
then
(
function
(){
$rootScope
.
loggedInUser
=!
1
,
$location
.
path
(
"/login"
)})})}}}).
directive
(
"headerNotification"
,
function
(
$http
,
$rootScope
,
$cookies
,
$interval
,
RESTURL
){
return
{
templateUrl
:
"shared/templates/directives/header-notification.html"
,
restrict
:
"E"
,
replace
:
!
0
,
link
:
function
(
$scope
){
$scope
.
groupNotifications
=
function
(
notifications
){
$scope
.
notifications
=
{
1
:[],
2
:[],
3
:[],
4
:[]},
angular
.
forEach
(
notifications
,
function
(
value
,
key
){
$scope
.
notifications
[
value
.
type
].
push
(
value
)})},
$scope
.
getNotifications
=
function
(){
$http
.
get
(
RESTURL
.
url
+
"notify"
,{
ignoreLoadingBar
:
!
0
}).
success
(
function
(
data
){
$scope
.
groupNotifications
(
data
.
notifications
),
$rootScope
.
$broadcast
(
"notifications"
,
$scope
.
notifications
)})},
$scope
.
getNotifications
(),
$interval
(
function
(){
"on"
==
$cookies
.
get
(
"notificate"
)
&&
$scope
.
getNotifications
()},
5
e3
),
$scope
.
markAsRead
=
function
(
items
){
$http
.
post
(
RESTURL
.
url
+
"notify"
,{
ignoreLoadingBar
:
!
0
,
read
:[
items
]}).
success
(
function
(
data
){
$scope
.
groupNotifications
(
data
.
notifications
),
$rootScope
.
$broadcast
(
"notifications"
,
$scope
.
notifications
)})},
$scope
.
$on
(
"markasread"
,
function
(
event
,
data
){
$scope
.
markAsRead
(
data
)})}}}).
directive
(
"searchDirective"
,
function
(
Generator
,
$log
){
return
{
templateUrl
:
"shared/templates/directives/search.html"
,
restrict
:
"E"
,
replace
:
!
0
,
link
:
function
(
$scope
){
$scope
.
searchForm
=
[{
key
:
"searchbox"
,
htmlClass
:
"pull-left"
},{
type
:
"submit"
,
title
:
"Ara"
,
htmlClass
:
"pull-left"
}],
$scope
.
searchSchema
=
{
type
:
"object"
,
properties
:{
searchbox
:{
type
:
"string"
,
minLength
:
2
,
title
:
"Ara"
,
"x-schema-form"
:{
placeholder
:
"Arama kriteri giriniz..."
}}},
required
:[
"searchbox"
]},
$scope
.
searchModel
=
{
searchbox
:
""
},
$scope
.
searchSubmit
=
function
(
form
){
if
(
$scope
.
$broadcast
(
"schemaFormValidate"
),
form
.
$valid
){
var
searchparams
=
{
url
:
$scope
.
wf
,
token
:
$scope
.
$parent
.
token
,
object_id
:
$scope
.
$parent
.
object_id
,
form_params
:{
model
:
$scope
.
$parent
.
form_params
.
model
,
cmd
:
$scope
.
$parent
.
reload_cmd
,
flow
:
$scope
.
$parent
.
form_params
.
flow
,
param
:
"query"
,
id
:
$scope
.
searchModel
.
searchbox
}};
Generator
.
submit
(
searchparams
)}}}}}).
directive
(
"sortDirective"
,
function
(
Generator
,
$log
){
return
{
templateUrl
:
"shared/templates/directives/sort.html"
,
restrict
:
"E"
,
replace
:
!
0
,
link
:
function
(
$scope
){
$scope
.
titleMap
=
[{
value
:
"artan"
,
name
:
"Artan"
},{
value
:
"azalan"
,
name
:
"Azalan"
}],
$scope
.
sortForm
=
[{
key
:
"sortbox"
,
htmlClass
:
"pull-left"
,
type
:
"select"
,
titleMap
:
$scope
.
titleMap
},{
type
:
"submit"
,
title
:
"Sırala"
,
htmlClass
:
"pull-left"
}],
$scope
.
sortSchema
=
{
type
:
"object"
,
properties
:{
sortbox
:{
type
:
"select"
,
title
:
"Sırala"
}},
required
:[
"sortbox"
]},
$scope
.
sortModel
=
{
sortbox
:
""
},
$scope
.
sortSubmit
=
function
(
form
){
if
(
$scope
.
$broadcast
(
"schemaFormValidate"
),
form
.
$valid
){
var
sortparams
=
{
url
:
$scope
.
wf
,
token
:
$scope
.
$parent
.
token
,
object_id
:
$scope
.
$parent
.
object_id
,
form_params
:{
model
:
$scope
.
$parent
.
form_params
.
model
,
cmd
:
$scope
.
$parent
.
reload_cmd
,
flow
:
$scope
.
$parent
.
form_params
.
flow
,
param
:
"sort"
,
id
:
$scope
.
sortModel
.
sortbox
}};
Generator
.
submit
(
sortparams
)}}}}}).
directive
(
"collapseMenu"
,
function
(
$timeout
,
$window
,
$cookies
){
return
{
templateUrl
:
"shared/templates/directives/menuCollapse.html"
,
restrict
:
"E"
,
replace
:
!
0
,
scope
:{},
controller
:
function
(
$scope
,
$rootScope
){
$rootScope
.
collapsed
=!
1
,
$rootScope
.
sidebarPinned
=
$cookies
.
get
(
"sidebarPinned"
)
||
0
,
$scope
.
collapseToggle
=
function
(){
$window
.
innerWidth
>
"768"
&&
(
$rootScope
.
collapsed
===!
1
?(
jQuery
(
".sidebar"
).
css
(
"width"
,
"62px"
),
jQuery
(
".manager-view"
).
css
(
"width"
,
"calc(100% - 62px)"
),
$rootScope
.
collapsed
=!
0
,
$rootScope
.
sidebarPinned
=
0
,
$cookies
.
put
(
"sidebarPinned"
,
0
)):(
jQuery
(
"span.menu-text, span.arrow, .sidebar footer"
).
fadeIn
(
400
),
jQuery
(
".sidebar"
).
css
(
"width"
,
"250px"
),
jQuery
(
".manager-view"
).
css
(
"width"
,
"calc(100% - 250px)"
),
$rootScope
.
collapsed
=!
1
,
$rootScope
.
sidebarPinned
=
1
,
$cookies
.
put
(
"sidebarPinned"
,
1
)))},
$timeout
(
function
(){
"0"
===
$cookies
.
get
(
"sidebarPinned"
)
&&
$scope
.
collapseToggle
()})}}}).
directive
(
"headerSubMenu"
,
function
(
$location
){
return
{
templateUrl
:
"shared/templates/directives/header-sub-menu.html"
,
restrict
:
"E"
,
replace
:
!
0
,
link
:
function
(
$scope
){
$scope
.
style
=
"width:calc(100% - 300px);"
,
$scope
.
$on
(
"$routeChangeStart"
,
function
(){
$scope
.
style
=
"/dashboard"
===
$location
.
path
()?
"width:calc(100% - 300px);"
:
"width:%100 !important;"
,
console
.
log
(
"style of header"
,
$location
.
path
())})}}}).
directive
(
"headerBreadcrumb"
,
function
(){
return
{
templateUrl
:
"shared/templates/directives/header-breadcrumb.html"
,
restrict
:
"E"
,
replace
:
!
0
}}).
directive
(
"selectedUser"
,
function
(){
return
{
templateUrl
:
"shared/templates/directives/selected-user.html"
,
restrict
:
"E"
,
replace
:
!
1
,
link
:
function
(
$scope
,
$rootScope
){
$scope
.
selectedUser
=
$rootScope
.
selectedUser
}}}).
directive
(
"sidebar"
,[
"$location"
,
function
(){
return
{
templateUrl
:
"shared/templates/directives/sidebar.html"
,
restrict
:
"E"
,
replace
:
!
0
,
scope
:{},
controller
:
function
(
$scope
,
$rootScope
,
$cookies
,
$route
,
$http
,
RESTURL
,
$location
,
$window
,
$timeout
){
$scope
.
prepareMenu
=
function
(
menuItems
){
var
newMenuItems
=
{};
return
angular
.
forEach
(
menuItems
,
function
(
value
,
key
){
angular
.
forEach
(
value
,
function
(
v
,
k
){
newMenuItems
[
k
]
=
v
})}),
newMenuItems
};
var
sidebarmenu
=
$
(
"#side-menu"
);
sidebarmenu
.
metisMenu
(),
$http
.
get
(
RESTURL
.
url
+
"menu/"
).
success
(
function
(
data
){
function
reGroupMenuItems
(
items
,
baseCategory
){
var
newItems
=
{};
return
angular
.
forEach
(
items
,
function
(
value
,
key
){
newItems
[
value
.
kategori
]
=
newItems
[
value
.
kategori
]
||
[],
value
.
baseCategory
=
baseCategory
,
newItems
[
value
.
kategori
].
push
(
value
)}),
newItems
}
$scope
.
allMenuItems
=
angular
.
copy
(
data
),
angular
.
forEach
(
$scope
.
allMenuItems
,
function
(
value
,
key
){
$scope
.
allMenuItems
[
key
]
=
reGroupMenuItems
(
value
,
key
)}),
$rootScope
.
$broadcast
(
"authz"
,
data
),
$scope
.
menuItems
=
$scope
.
prepareMenu
({
other
:
$scope
.
allMenuItems
.
other
}),
$timeout
(
function
(){
sidebarmenu
.
metisMenu
()})}),
$scope
.
$on
(
"menuitems"
,
function
(
event
,
data
){
var
menu
=
{
other
:
$scope
.
allMenuItems
.
other
};
menu
[
data
]
=
$scope
.
allMenuItems
[
data
],
$scope
.
menuItems
=
$scope
.
prepareMenu
(
menu
),
$timeout
(
function
(){
sidebarmenu
.
metisMenu
()})}),
$scope
.
openSidebar
=
function
(){
$window
.
innerWidth
>
"768"
&&
0
===
$rootScope
.
sidebarPinned
&&
(
jQuery
(
"span.menu-text, span.arrow, .sidebar footer, #side-menu"
).
fadeIn
(
400
),
jQuery
(
".sidebar"
).
css
(
"width"
,
"250px"
),
jQuery
(
".manager-view"
).
css
(
"width"
,
"calc(100% - 250px)"
),
$rootScope
.
collapsed
=!
1
)},
$scope
.
closeSidebar
=
function
(){
$window
.
innerWidth
>
"768"
&&
0
===
$rootScope
.
sidebarPinned
&&
(
jQuery
(
".sidebar"
).
css
(
"width"
,
"62px"
),
jQuery
(
".manager-view"
).
css
(
"width"
,
"calc(100% - 62px)"
),
$rootScope
.
collapsed
=!
0
)},
$rootScope
.
$watch
(
function
(
$rootScope
){
return
$rootScope
.
section
},
function
(
newindex
,
oldindex
){
newindex
>-
1
&&
(
$scope
.
menuItems
=
[
$scope
.
allMenuItems
[
newindex
]],
$scope
.
collapseVar
=
1
)}),
$scope
.
selectedMenu
=
$location
.
path
(),
$scope
.
collapseVar
=
0
,
$scope
.
multiCollapseVar
=
0
,
$scope
.
check
=
function
(
x
){
x
===
$scope
.
collapseVar
?
$scope
.
collapseVar
=
0
:
$scope
.
collapseVar
=
x
},
$scope
.
breadcrumb
=
function
(
itemlist
,
$event
){
$rootScope
.
breadcrumblinks
=
itemlist
,
$rootScope
.
showSaveButton
=!
1
},
$scope
.
multiCheck
=
function
(
y
){
y
===
$scope
.
multiCollapseVar
?
$scope
.
multiCollapseVar
=
0
:
$scope
.
multiCollapseVar
=
y
}}}}]).
directive
(
"stats"
,
function
(){
return
{
templateUrl
:
"shared/templates/directives/stats.html"
,
restrict
:
"E"
,
replace
:
!
0
,
scope
:{
model
:
"="
,
comments
:
"@"
,
number
:
"@"
,
name
:
"@"
,
colour
:
"@"
,
details
:
"@"
,
type
:
"@"
,
"goto"
:
"@"
}}}).
directive
(
"notifications"
,
function
(){
return
{
templateUrl
:
"shared/templates/directives/notifications.html"
,
restrict
:
"E"
,
replace
:
!
0
}}).
directive
(
"msgbox"
,
function
(){
return
{
templateUrl
:
"shared/templates/directives/msgbox.html"
,
restrict
:
"E"
,
replace
:
!
1
}}).
directive
(
"sidebarSearch"
,
function
(){
return
{
templateUrl
:
"shared/templates/directives/sidebar-search.html"
,
restrict
:
"E"
,
replace
:
!
0
,
scope
:{},
controller
:
function
(
$scope
){
$scope
.
selectedMenu
=
"home"
}}});
var
auth
=
angular
.
module
(
"ulakbus.auth"
,[
"ngRoute"
,
"schemaForm"
,
"ngCookies"
]);
auth
.
controller
(
"LoginCtrl"
,
function
(
$scope
,
$q
,
$timeout
,
$routeParams
,
Generator
,
LoginService
){
$scope
.
url
=
"login"
,
$scope
.
form_params
=
{},
$scope
.
form_params
.
clear_wf
=
1
,
Generator
.
get_form
(
$scope
).
then
(
function
(
data
){
$scope
.
form
=
[{
key
:
"username"
,
type
:
"string"
,
title
:
"Kullanıcı Adı"
},{
key
:
"password"
,
type
:
"password"
,
title
:
"Şifre"
},{
type
:
"submit"
,
title
:
"Giriş Yap"
}]}),
$scope
.
onSubmit
=
function
(
form
){
$scope
.
$broadcast
(
"schemaFormValidate"
),
form
.
$valid
?
LoginService
.
login
(
$scope
.
url
,
$scope
.
model
).
error
(
function
(
data
){
$scope
.
message
=
data
.
title
}):
console
.
log
(
"not valid"
)}}),
auth
.
factory
(
"LoginService"
,
function
(
$http
,
$rootScope
,
$location
,
$log
,
Session
,
RESTURL
){
var
loginService
=
{};
return
loginService
.
login
=
function
(
url
,
credentials
){
return
credentials
.
cmd
=
"do"
,
$http
.
post
(
RESTURL
.
url
+
url
,
credentials
).
success
(
function
(
data
,
status
,
headers
,
config
){
$rootScope
.
loggedInUser
=!
0
}).
error
(
function
(
data
,
status
,
headers
,
config
){
return
data
})},
loginService
.
logout
=
function
(){
return
$log
.
info
(
"logout"
),
$http
.
post
(
RESTURL
.
url
+
"logout"
,{}).
success
(
function
(
data
){
$rootScope
.
loggedInUser
=!
1
,
$log
.
info
(
"loggedout"
),
$location
.
path
(
"/login"
)})},
loginService
.
isAuthenticated
=
function
(){
return
!!
Session
.
userId
},
loginService
.
isAuthorized
=
function
(
authorizedRoles
){
return
angular
.
isArray
(
authorizedRoles
)
||
(
authorizedRoles
=
[
authorizedRoles
]),
loginService
.
isAuthenticated
()
&&-
1
!==
loginService
.
indexOf
(
Session
.
userRole
)},
loginService
.
isValidEmail
=
function
(
email
){
var
re
=
/^
([\w
-
]
+
(?:\.[\w
-
]
+
)
*
)
@
((?:[\w
-
]
+
\.)
*
\w[\w
-
]{0,66})\.([
a-z
]{2,6}(?:\.[
a-z
]{2})?)
$/i
;
return
re
.
test
(
email
)},
loginService
}),
auth
.
service
(
"Session"
,
function
(){
this
.
create
=
function
(
sessionId
,
userId
,
userRole
){
this
.
id
=
sessionId
,
this
.
userId
=
userId
,
this
.
userRole
=
userRole
},
this
.
destroy
=
function
(){
this
.
id
=
null
,
this
.
userId
=
null
,
this
.
userRole
=
null
}}),
angular
.
module
(
"ulakbus.dashboard"
,[
"ngRoute"
]).
controller
(
"DashCtrl"
,
function
(
$scope
,
$rootScope
,
$timeout
,
$http
,
$cookies
,
RESTURL
){
$scope
.
section
=
function
(
section_index
){
$rootScope
.
section
=
section_index
},
$scope
.
$on
(
"authz"
,
function
(
event
,
data
){
$scope
.
menuitems
=
data
}),
$scope
.
student_kw
=
""
,
$scope
.
staff_kw
=
""
,
$scope
.
students
=
[],
$scope
.
staffs
=
[],
$scope
.
search
=
function
(
where
){
$timeout
(
function
(){
"personel"
===
where
&&
$scope
.
staff_kw
.
length
>
2
&&
$scope
.
getItems
(
where
,
$scope
.
staff_kw
).
success
(
function
(
data
){
$scope
.
staffs
=
data
.
results
}),
"ogrenci"
===
where
&&
$scope
.
student_kw
.
length
>
2
&&
$scope
.
getItems
(
where
,
$scope
.
student_kw
).
success
(
function
(
data
){
$scope
.
students
=
data
.
results
})})},
$scope
.
getItems
=
function
(
where
,
what
){
return
$http
.
get
(
RESTURL
.
url
+
"ara/"
+
where
+
"/"
+
what
)},
$scope
.
select
=
function
(
who
,
type
){
$rootScope
.
selectedUser
=
{
name
:
who
[
0
],
tcno
:
who
[
1
],
key
:
who
[
2
]},
$rootScope
.
$broadcast
(
"menuitems"
,
type
)},
$scope
.
$on
(
"notifications"
,
function
(
event
,
data
){
$scope
.
notifications
=
data
}),
$scope
.
markAsRead
=
function
(
items
){
$rootScope
.
$broadcast
(
"markasread"
,
items
)}}).
directive
(
"sidebarNotifications"
,
function
(){
restrict
:
"E"
,
replace
:
!
0
,
link
:
function
(
$scope
){}}}),
angular
.
module
(
"ulakbus.crud"
,[
"ui.bootstrap"
,
"schemaForm"
,
"formService"
]).
service
(
"CrudUtility"
,
function
(
$log
){
return
{
generateParam
:
function
(
scope
,
routeParams
,
cmd
){
return
scope
.
url
=
routeParams
.
wf
,
angular
.
forEach
(
routeParams
,
function
(
value
,
key
){
key
.
indexOf
(
"_id"
)
>-
1
&&
"param_id"
!==
key
&&
(
scope
.
param
=
key
,
scope
.
param_id
=
value
)}),
scope
.
form_params
=
{
cmd
:
cmd
,
model
:
routeParams
.
model
,
param
:
scope
.
param
||
routeParams
.
param
,
id
:
scope
.
param_id
||
routeParams
.
param_id
,
wf
:
routeParams
.
wf
,
object_id
:
routeParams
.
key
},
scope
.
form_params
[
scope
.
param
]
=
scope
.
param_id
,
scope
.
model
=
scope
.
form_params
.
model
,
scope
.
wf
=
scope
.
form_params
.
wf
,
scope
.
param
=
scope
.
form_params
.
param
,
scope
.
param_id
=
scope
.
form_params
.
id
,
scope
},
listPageItems
:
function
(
scope
,
pageData
){
angular
.
forEach
(
pageData
,
function
(
value
,
key
){
scope
[
key
]
=
value
}),
angular
.
forEach
(
scope
.
objects
,
function
(
value
,
key
){
if
(
key
>
0
){
var
linkIndexes
=
{};
angular
.
forEach
(
value
.
actions
,
function
(
v
,
k
){
"link"
===
v
.
show_as
&&
(
linkIndexes
=
v
)}),
angular
.
forEach
(
value
.
fields
,
function
(
v
,
k
){
value
.
actions
.
length
>
0
&&
linkIndexes
.
fields
?
scope
.
objects
[
key
].
fields
[
k
]
=
{
type
:
linkIndexes
.
fields
.
indexOf
(
k
)
>-
1
?
"link"
:
"str"
,
content
:
v
,
cmd
:
linkIndexes
.
cmd
,
mode
:
linkIndexes
.
mode
}:
scope
.
objects
[
key
].
fields
[
k
]
=
{
type
:
"str"
,
content
:
v
}})}}),
$log
.
debug
(
scope
.
objects
)}}}).
controller
(
"CRUDCtrl"
,
function
(
$scope
,
$routeParams
,
Generator
,
CrudUtility
){
CrudUtility
.
generateParam
(
$scope
,
$routeParams
),
Generator
.
get_wf
(
$scope
)}).
controller
(
"CRUDListFormCtrl"
,
function
(
$scope
,
$rootScope
,
$location
,
$http
,
$log
,
$uibModal
,
$timeout
,
Generator
,
$routeParams
,
CrudUtility
){
$scope
.
reload
=
function
(
reloadData
){
$scope
.
form_params
.
cmd
=
$scope
.
reload_cmd
,
$scope
.
form_params
=
angular
.
extend
(
$scope
.
form_params
,
reloadData
),
$log
.
debug
(
"reload data"
,
$scope
),
Generator
.
get_wf
(
$scope
)},
$scope
.
$on
(
"reload_cmd"
,
function
(
event
,
data
){
$scope
.
reload_cmd
=
data
,
$scope
.
reload
({})}),
$scope
.
$on
(
"formLocator"
,
function
(
event
){
$scope
.
formgenerated
=
event
.
targetScope
.
formgenerated
}),
$scope
.
onSubmit
=
function
(
form
){
$scope
.
$broadcast
(
"schemaFormValidate"
),
form
.
$valid
&&
Generator
.
submit
(
$scope
)},
$scope
.
do_action
=
function
(
key
,
cmd
,
mode
){
Generator
.
doItemAction
(
$scope
,
key
,
cmd
,
mode
||
"normal"
)},
$scope
.
getNumber
=
function
(
num
){
return
new
Array
(
num
)},
$timeout
(
function
(){
jQuery
(
".filterDate"
).
datepicker
({
changeMonth
:
!
0
,
changeYear
:
!
0
,
dateFormat
:
"dd.mm.yy"
,
onSelect
:
function
(
date
,
inst
){}}).
datepicker
(
"setDate"
,
new
Date
)}),
$scope
.
showCmd
=
function
(){
CrudUtility
.
generateParam
(
$scope
,
$routeParams
,
$routeParams
.
cmd
);
var
createListObjects
=
function
(){
angular
.
forEach
(
$scope
.
object
,
function
(
value
,
key
){
"object"
==
typeof
value
&&
(
$scope
.
listobjects
[
key
]
=
value
,
delete
$scope
.
object
[
key
])})};
$scope
.
listobjects
=
{};
var
pageData
=
Generator
.
getPageData
();
pageData
.
pageData
===!
0
?(
$scope
.
object
=
pageData
.
object
,
Generator
.
setPageData
({
pageData
:
!
1
})):
Generator
.
get_single_item
(
$scope
).
then
(
function
(
res
){
$scope
.
object
=
res
.
data
.
object
,
$scope
.
model
=
$routeParams
.
model
}),
createListObjects
()},
$scope
.
listFormCmd
=
function
(){
var
setpageobjects
=
function
(
data
){
CrudUtility
.
listPageItems
(
$scope
,
data
),
Generator
.
generate
(
$scope
,
data
),
Generator
.
setPageData
({
pageData
:
!
1
})},
pageData
=
Generator
.
getPageData
();
pageData
.
pageData
===!
0
&&
(
$log
.
debug
(
"pagedata"
,
pageData
.
pageData
),
CrudUtility
.
generateParam
(
$scope
,
pageData
,
$routeParams
.
cmd
),
setpageobjects
(
pageData
,
pageData
)),(
void
0
===
pageData
.
pageData
||
pageData
.
pageData
===!
1
)
&&
(
CrudUtility
.
generateParam
(
$scope
,
$routeParams
,
$routeParams
.
cmd
),
Generator
.
get_wf
(
$scope
))},
$scope
.
reloadCmd
=
function
(){
$scope
.
reload
({})},
$scope
.
resetCmd
=
function
(){
delete
$scope
.
token
,
$scope
.
cmd
=
"reset"
,
Generator
.
get_wf
(
$scope
)};
var
executeCmd
=
{
show
:
$scope
.
showCmd
,
list
:
$scope
.
listFormCmd
,
form
:
$scope
.
listFormCmd
,
reload
:
$scope
.
reloadCmd
,
reset
:
$scope
.
resetCmd
};
return
executeCmd
[
$routeParams
.
cmd
]()}).
directive
(
"crudListDirective"
,
function
(){
return
{
templateUrl
:
"components/crud/templates/list.html"
,
restrict
:
"E"
,
replace
:
!
0
}}).
directive
(
"crudFormDirective"
,
function
(){
return
{
templateUrl
:
"components/crud/templates/form.html"
,
restrict
:
"E"
,
replace
:
!
0
}}).
directive
(
"crudShowDirective"
,
function
(){
return
{
templateUrl
:
"components/crud/templates/show.html"
,
restrict
:
"E"
,
replace
:
!
0
}}).
directive
(
"formLocator"
,
function
(){
return
{
link
:
function
(
scope
){
scope
.
$emit
(
"formLocator"
)}}}).
directive
(
"crudFilters"
,
function
(){
return
{
templateUrl
:
"components/crud/templates/filter.html"
,
restrict
:
"E"
,
replace
:
!
0
}}),
angular
.
module
(
"ulakbus.debug"
,[
"ngRoute"
]).
controller
(
"DebugCtrl"
,
function
(
$scope
,
$rootScope
,
$location
){
$scope
.
debug_queries
=
$rootScope
.
debug_queries
}),
angular
.
module
(
"ulakbus.devSettings"
,[
"ngRoute"
]).
controller
(
"DevSettingsCtrl"
,
function
(
$scope
,
$cookies
,
$rootScope
,
RESTURL
){
$scope
.
backendurl
=
$cookies
.
get
(
"backendurl"
),
$scope
.
notificate
=
$cookies
.
get
(
"notificate"
)
||
"on"
,
$scope
.
changeSettings
=
function
(
what
,
set
){
document
.
cookie
=
what
+
"="
+
set
,
$scope
[
what
]
=
set
,
$rootScope
.
$broadcast
(
what
,
set
)},
$scope
.
switchOnOff
=
function
(
pinn
){
return
"on"
==
pinn
?
"off"
:
"on"
},
$scope
.
setbackendurl
=
function
(){
$scope
.
changeSettings
(
"backendurl"
,
$scope
.
backendurl
),
RESTURL
.
url
=
$scope
.
backendurl
},
$scope
.
setnotification
=
function
(){
$scope
.
changeSettings
(
"notificate"
,
$scope
.
switchOnOff
(
$scope
.
notificate
))}}),
app
.
config
([
"$routeProvider"
,
function
(
$routeProvider
){
$routeProvider
.
when
(
"/error/500"
,{
templateUrl
:
"components/error_pages/500.html"
,
controller
:
"500Ctrl"
}).
when
(
"/error/404"
,{
templateUrl
:
"components/error_pages/404.html"
,
controller
:
"404Ctrl"
})}]),
angular
.
module
(
"ulakbus.error_pages"
,[
"ngRoute"
]).
controller
(
"500Ctrl"
,
function
(
$scope
,
$rootScope
,
$location
){}).
controller
(
"404Ctrl"
,
function
(
$scope
,
$rootScope
,
$location
){}),
angular
.
module
(
"ulakbus.version"
,[
"ulakbus.version.interpolate-filter"
,
"ulakbus.version.version-directive"
]).
value
(
"version"
,
"0.4.1"
),
angular
.
module
(
"ulakbus.version.interpolate-filter"
,[]).
filter
(
"interpolate"
,[
"version"
,
function
(
version
){
return
function
(
text
){
return
String
(
text
).
replace
(
/
\%
VERSION
\%
/gm
,
version
)}}]),
angular
.
module
(
"ulakbus.version.version-directive"
,[]).
directive
(
"appVersion"
,[
"version"
,
function
(
version
){
return
function
(
scope
,
elm
,
attrs
){
elm
.
text
(
version
)}}]);
return
{
templateUrl
:
"shared/templates/directives/sidebar-notification.html"
,
restrict
:
"E"
,
replace
:
!
0
,
link
:
function
(
$scope
){}}}),
angular
.
module
(
"ulakbus.crud"
,[
"ui.bootstrap"
,
"schemaForm"
,
"formService"
]).
service
(
"CrudUtility"
,
function
(
$log
){
return
{
generateParam
:
function
(
scope
,
routeParams
,
cmd
){
return
scope
.
url
=
routeParams
.
wf
,
angular
.
forEach
(
routeParams
,
function
(
value
,
key
){
key
.
indexOf
(
"_id"
)
>-
1
&&
"param_id"
!==
key
&&
(
scope
.
param
=
key
,
scope
.
param_id
=
value
)}),
scope
.
form_params
=
{
model
:
routeParams
.
model
,
param
:
scope
.
param
||
routeParams
.
param
,
id
:
scope
.
param_id
||
routeParams
.
param_id
,
wf
:
routeParams
.
wf
,
object_id
:
routeParams
.
key
},
scope
.
form_params
[
scope
.
param
]
=
scope
.
param_id
,
scope
.
model
=
scope
.
form_params
.
model
,
scope
.
wf
=
scope
.
form_params
.
wf
,
scope
.
param
=
scope
.
form_params
.
param
,
scope
.
param_id
=
scope
.
form_params
.
id
,
scope
},
listPageItems
:
function
(
scope
,
pageData
){
angular
.
forEach
(
pageData
,
function
(
value
,
key
){
scope
[
key
]
=
value
}),
angular
.
forEach
(
scope
.
objects
,
function
(
value
,
key
){
if
(
key
>
0
){
var
linkIndexes
=
{};
angular
.
forEach
(
value
.
actions
,
function
(
v
,
k
){
"link"
===
v
.
show_as
&&
(
linkIndexes
=
v
)}),
angular
.
forEach
(
value
.
fields
,
function
(
v
,
k
){
value
.
actions
.
length
>
0
&&
linkIndexes
.
fields
?
scope
.
objects
[
key
].
fields
[
k
]
=
{
type
:
linkIndexes
.
fields
.
indexOf
(
k
)
>-
1
?
"link"
:
"str"
,
content
:
v
,
cmd
:
linkIndexes
.
cmd
,
mode
:
linkIndexes
.
mode
}:
scope
.
objects
[
key
].
fields
[
k
]
=
{
type
:
"str"
,
content
:
v
}})}}),
$log
.
debug
(
scope
.
objects
)}}}).
controller
(
"CRUDCtrl"
,
function
(
$scope
,
$routeParams
,
Generator
,
CrudUtility
){
CrudUtility
.
generateParam
(
$scope
,
$routeParams
),
Generator
.
get_wf
(
$scope
)}).
controller
(
"CRUDListFormCtrl"
,
function
(
$scope
,
$rootScope
,
$location
,
$http
,
$log
,
$uibModal
,
$timeout
,
Generator
,
$routeParams
,
CrudUtility
){
$scope
.
reload
=
function
(
reloadData
){
$scope
.
form_params
.
cmd
=
$scope
.
reload_cmd
,
$scope
.
form_params
=
angular
.
extend
(
$scope
.
form_params
,
reloadData
),
$log
.
debug
(
"reload data"
,
$scope
),
Generator
.
get_wf
(
$scope
)},
$scope
.
$on
(
"reload_cmd"
,
function
(
event
,
data
){
$scope
.
reload_cmd
=
data
,
$scope
.
reload
({})}),
$scope
.
$on
(
"formLocator"
,
function
(
event
){
$scope
.
formgenerated
=
event
.
targetScope
.
formgenerated
}),
$scope
.
onSubmit
=
function
(
form
){
$scope
.
$broadcast
(
"schemaFormValidate"
),
form
.
$valid
&&
Generator
.
submit
(
$scope
)},
$scope
.
do_action
=
function
(
key
,
cmd
,
mode
){
Generator
.
doItemAction
(
$scope
,
key
,
cmd
,
mode
||
"normal"
)},
$scope
.
getNumber
=
function
(
num
){
return
new
Array
(
num
)},
$timeout
(
function
(){
jQuery
(
".filterDate"
).
datepicker
({
changeMonth
:
!
0
,
changeYear
:
!
0
,
dateFormat
:
"dd.mm.yy"
,
onSelect
:
function
(
date
,
inst
){}}).
datepicker
(
"setDate"
,
new
Date
)}),
$scope
.
showCmd
=
function
(){
CrudUtility
.
generateParam
(
$scope
,
$routeParams
,
$routeParams
.
cmd
);
var
createListObjects
=
function
(){
angular
.
forEach
(
$scope
.
object
,
function
(
value
,
key
){
"object"
==
typeof
value
&&
(
$scope
.
listobjects
[
key
]
=
value
,
delete
$scope
.
object
[
key
])})};
$scope
.
listobjects
=
{};
var
pageData
=
Generator
.
getPageData
();
pageData
.
pageData
===!
0
?(
$scope
.
object
=
pageData
.
object
,
Generator
.
setPageData
({
pageData
:
!
1
})):
Generator
.
get_single_item
(
$scope
).
then
(
function
(
res
){
$scope
.
object
=
res
.
data
.
object
,
$scope
.
model
=
$routeParams
.
model
}),
createListObjects
()},
$scope
.
listFormCmd
=
function
(){
var
setpageobjects
=
function
(
data
){
CrudUtility
.
listPageItems
(
$scope
,
data
),
Generator
.
generate
(
$scope
,
data
),
Generator
.
setPageData
({
pageData
:
!
1
})},
pageData
=
Generator
.
getPageData
();
pageData
.
pageData
===!
0
&&
(
$log
.
debug
(
"pagedata"
,
pageData
.
pageData
),
CrudUtility
.
generateParam
(
$scope
,
pageData
,
$routeParams
.
cmd
),
setpageobjects
(
pageData
,
pageData
)),(
void
0
===
pageData
.
pageData
||
pageData
.
pageData
===!
1
)
&&
(
CrudUtility
.
generateParam
(
$scope
,
$routeParams
,
$routeParams
.
cmd
),
Generator
.
get_wf
(
$scope
))},
$scope
.
reloadCmd
=
function
(){
$scope
.
reload
({})},
$scope
.
resetCmd
=
function
(){
delete
$scope
.
token
,
$scope
.
cmd
=
"reset"
,
Generator
.
get_wf
(
$scope
)};
var
executeCmd
=
{
show
:
$scope
.
showCmd
,
list
:
$scope
.
listFormCmd
,
form
:
$scope
.
listFormCmd
,
reload
:
$scope
.
reloadCmd
,
reset
:
$scope
.
resetCmd
};
return
executeCmd
[
$routeParams
.
cmd
]()}).
directive
(
"crudListDirective"
,
function
(){
return
{
templateUrl
:
"components/crud/templates/list.html"
,
restrict
:
"E"
,
replace
:
!
0
}}).
directive
(
"crudFormDirective"
,
function
(){
return
{
templateUrl
:
"components/crud/templates/form.html"
,
restrict
:
"E"
,
replace
:
!
0
}}).
directive
(
"crudShowDirective"
,
function
(){
return
{
templateUrl
:
"components/crud/templates/show.html"
,
restrict
:
"E"
,
replace
:
!
0
}}).
directive
(
"formLocator"
,
function
(){
return
{
link
:
function
(
scope
){
scope
.
$emit
(
"formLocator"
)}}}).
directive
(
"crudFilters"
,
function
(){
return
{
templateUrl
:
"components/crud/templates/filter.html"
,
restrict
:
"E"
,
replace
:
!
0
}}),
angular
.
module
(
"ulakbus.debug"
,[
"ngRoute"
]).
controller
(
"DebugCtrl"
,
function
(
$scope
,
$rootScope
,
$location
){
$scope
.
debug_queries
=
$rootScope
.
debug_queries
}),
angular
.
module
(
"ulakbus.devSettings"
,[
"ngRoute"
]).
controller
(
"DevSettingsCtrl"
,
function
(
$scope
,
$cookies
,
$rootScope
,
RESTURL
){
$scope
.
backendurl
=
$cookies
.
get
(
"backendurl"
),
$scope
.
notificate
=
$cookies
.
get
(
"notificate"
)
||
"on"
,
$scope
.
changeSettings
=
function
(
what
,
set
){
document
.
cookie
=
what
+
"="
+
set
,
$scope
[
what
]
=
set
,
$rootScope
.
$broadcast
(
what
,
set
)},
$scope
.
switchOnOff
=
function
(
pinn
){
return
"on"
==
pinn
?
"off"
:
"on"
},
$scope
.
setbackendurl
=
function
(){
$scope
.
changeSettings
(
"backendurl"
,
$scope
.
backendurl
),
RESTURL
.
url
=
$scope
.
backendurl
},
$scope
.
setnotification
=
function
(){
$scope
.
changeSettings
(
"notificate"
,
$scope
.
switchOnOff
(
$scope
.
notificate
))}}),
app
.
config
([
"$routeProvider"
,
function
(
$routeProvider
){
$routeProvider
.
when
(
"/error/500"
,{
templateUrl
:
"components/error_pages/500.html"
,
controller
:
"500Ctrl"
}).
when
(
"/error/404"
,{
templateUrl
:
"components/error_pages/404.html"
,
controller
:
"404Ctrl"
})}]),
angular
.
module
(
"ulakbus.error_pages"
,[
"ngRoute"
]).
controller
(
"500Ctrl"
,
function
(
$scope
,
$rootScope
,
$location
){}).
controller
(
"404Ctrl"
,
function
(
$scope
,
$rootScope
,
$location
){}),
angular
.
module
(
"ulakbus.version"
,[
"ulakbus.version.interpolate-filter"
,
"ulakbus.version.version-directive"
]).
value
(
"version"
,
"0.4.1"
),
angular
.
module
(
"ulakbus.version.interpolate-filter"
,[]).
filter
(
"interpolate"
,[
"version"
,
function
(
version
){
return
function
(
text
){
return
String
(
text
).
replace
(
/
\%
VERSION
\%
/gm
,
version
)}}]),
angular
.
module
(
"ulakbus.version.version-directive"
,[]).
directive
(
"appVersion"
,[
"version"
,
function
(
version
){
return
function
(
scope
,
elm
,
attrs
){
elm
.
text
(
version
)}}]);
\ No newline at end of file
\ No newline at end of file
dist/templates.js
View file @
d5328b2b
...
@@ -1462,10 +1462,11 @@ angular.module("shared/templates/foreignKey.html", []).run(["$templateCache", fu
...
@@ -1462,10 +1462,11 @@ angular.module("shared/templates/foreignKey.html", []).run(["$templateCache", fu
$templateCache
.
put
(
"shared/templates/foreignKey.html"
,
$templateCache
.
put
(
"shared/templates/foreignKey.html"
,
"<div class=
\"
form-group {{form.htmlClass}} schema-form-select col-md-12
\"\n
"
+
"<div class=
\"
form-group {{form.htmlClass}} schema-form-select col-md-12
\"\n
"
+
" ng-class=
\"
{'has-error': form.disableErrorState !== true && hasError(), 'has-success': form.disableSuccessState !== true && hasSuccess(), 'has-feedback': form.feedback !== false}
\"
>
\n
"
+
" ng-class=
\"
{'has-error': form.disableErrorState !== true && hasError(), 'has-success': form.disableSuccessState !== true && hasSuccess(), 'has-feedback': form.feedback !== false}
\"
>
\n
"
+
" <div class=
\"
col-md-
8
\"
>
\n
"
+
" <div class=
\"
col-md-
12
\"
>
\n
"
+
" <label class=
\"
control-label {{form.labelHtmlClass}}
\"
ng-show=
\"
showTitle()
\"
>
\n
"
+
" <label class=
\"
control-label {{form.labelHtmlClass}}
\"
ng-show=
\"
showTitle()
\"
>
\n
"
+
" {{form.title}}
\n
"
+
" {{form.title}}
\n
"
+
" </label>
\n
"
+
" </label>
\n
"
+
" <a><i class=
\"
fa fa-plus-circle fa-fw
\"
add-modal-for-linked-model=
\"
{{form.formName}}
\"
></i></a>
\n
"
+
"
\n
"
+
"
\n
"
+
" <div class=
\"
form-group input-group
\"
>
\n
"
+
" <div class=
\"
form-group input-group
\"
>
\n
"
+
" <span class=
\"
input-group-btn
\"
>
\n
"
+
" <span class=
\"
input-group-btn
\"
>
\n
"
+
...
@@ -1505,11 +1506,6 @@ angular.module("shared/templates/foreignKey.html", []).run(["$templateCache", fu
...
@@ -1505,11 +1506,6 @@ angular.module("shared/templates/foreignKey.html", []).run(["$templateCache", fu
"
\n
"
+
"
\n
"
+
" <div class=
\"
help-block
\"
sf-message=
\"
form.description
\"
></div>
\n
"
+
" <div class=
\"
help-block
\"
sf-message=
\"
form.description
\"
></div>
\n
"
+
" </div>
\n
"
+
" </div>
\n
"
+
" <div class=
\"
col-md-4
\"
>
\n
"
+
" <a href=
\"
javascript:void(0);
\"
add-modal-for-linked-model=
\"
{{form.formName}}
\"
>
\n
"
+
" <i class=
\"
fa fa-plus-circle fa-fw
\"
></i>
\n
"
+
" </a>
\n
"
+
" </div>
\n
"
+
"</div>"
);
"</div>"
);
}]);
}]);
...
@@ -1579,24 +1575,23 @@ angular.module("shared/templates/multiselect.html", []).run(["$templateCache", f
...
@@ -1579,24 +1575,23 @@ angular.module("shared/templates/multiselect.html", []).run(["$templateCache", f
$templateCache
.
put
(
"shared/templates/multiselect.html"
,
$templateCache
.
put
(
"shared/templates/multiselect.html"
,
"<div class=
\"
form-group {{form.htmlClass}} schema-form-select col-md-12
\"\n
"
+
"<div class=
\"
form-group {{form.htmlClass}} schema-form-select col-md-12
\"\n
"
+
" ng-class=
\"
{'has-error': form.disableErrorState !== true && hasError(), 'has-success': form.disableSuccessState !== true && hasSuccess(), 'has-feedback': form.feedback !== false}
\"
>
\n
"
+
" ng-class=
\"
{'has-error': form.disableErrorState !== true && hasError(), 'has-success': form.disableSuccessState !== true && hasSuccess(), 'has-feedback': form.feedback !== false}
\"
>
\n
"
+
" <div class=
\"
col-md-
8
\"
>
\n
"
+
" <div class=
\"
col-md-
12
\"
>
\n
"
+
" <label class=
\"
control-label {{form.labelHtmlClass}}
\"
ng-show=
\"
showTitle()
\"
>
\n
"
+
" <label class=
\"
control-label {{form.labelHtmlClass}}
\"
ng-show=
\"
showTitle()
\"
>
\n
"
+
" {{form.title}}
\n
"
+
" {{form.title}}
\n
"
+
" </label>
\n
"
+
" </label>
\n
"
+
" <a><i class=
\"
fa fa-plus-circle fa-fw
\"
add-modal-for-linked-model=
\"
{{form.formName}}
\"
></i></a>
\n
"
+
"
\n
"
+
"
\n
"
+
" <div class=
\"
row
\"
>
\n
"
+
" <div class=
\"
row
\"
>
\n
"
+
" <div class=
\"
form-group input-group
\"
>
\n
"
+
" <div class=
\"
col-md-12
\"
>
\n
"
+
" <input type=
\"
text
\"\n
"
+
" <input type=
\"
text
\"\n
"
+
" placeholder=
\"
{{form.title}} filtrele
\"\n
"
+
" placeholder=
\"
{{form.title}} filtrele
\"\n
"
+
" class=
\"
form-control {{form.fieldHtmlClass}}
\"\n
"
+
" class=
\"
form-control {{form.fieldHtmlClass}}
\"\n
"
+
" name=
\"
filter-interface
\"\n
"
+
" name=
\"
filter-interface
\"\n
"
+
" ng-model=
\"
form.filterValue
\"\n
"
+
" ng-model=
\"
form.filterValue
\"\n
"
+
" ng-keyup=
\"
form.appendFiltered(form.filterValue)
\"\n
"
+
" ng-keyup=
\"
form.appendFiltered(form.filterValue)
\"
/>
\n
"
+
" />
\n
"
+
" </div>
\n
"
+
" </div>
\n
"
+
" </div>
\n
"
+
"
\n
"
+
" <div class=
\"
row
\"
>
\n
"
+
" <div class=
\"
col-md-12
\"
>
\n
"
+
" <div class=
\"
col-md-5
\"
>
\n
"
+
" <label for=
\"
filterItems
\"
>{{form.title}} Liste</label>
\n
"
+
" <label for=
\"
filterItems
\"
>{{form.title}} Liste</label>
\n
"
+
" <select ng-model=
\"
selectedItemsModel
\"\n
"
+
" <select ng-model=
\"
selectedItemsModel
\"\n
"
+
" value=
\"
$$value$$
\"\n
"
+
" value=
\"
$$value$$
\"\n
"
+
...
@@ -1610,13 +1605,12 @@ angular.module("shared/templates/multiselect.html", []).run(["$templateCache", f
...
@@ -1610,13 +1605,12 @@ angular.module("shared/templates/multiselect.html", []).run(["$templateCache", f
" </select>
\n
"
+
" </select>
\n
"
+
" </div>
\n
"
+
" </div>
\n
"
+
"
\n
"
+
"
\n
"
+
"
\n
"
+
" <div class=
\"
col-md-12 text-center
\"
>
\n
"
+
" <div class=
\"
col-md-1
\"
>
\n
"
+
" <a><i class=
\"
fa fa-arrow-down fa-fw
\"
ng-click=
\"
form.select(selectedItemsModel)
\"
></i></a>
\n
"
+
" <a href=
\"
javascript:void(0)
\"
ng-click=
\"
form.select(selectedItemsModel)
\"
><i class=
\"
fa fa-arrow-right fa-fw
\"
></i></a><br>
\n
"
+
" <a><i class=
\"
fa fa-arrow-up fa-fw
\"
ng-click=
\"
form.deselect(selectedFilteredItemsModel)
\"
></i></a>
\n
"
+
" <a href=
\"
javascript:void(0)
\"
ng-click=
\"
form.deselect(selectedFilteredItemsModel)
\"
><i class=
\"
fa fa-arrow-left fa-fw
\"
></i></a>
\n
"
+
" </div>
\n
"
+
" </div>
\n
"
+
"
\n
"
+
"
\n
"
+
" <div class=
\"
col-md-
5
\"
>
\n
"
+
" <div class=
\"
col-md-
12
\"
>
\n
"
+
" <label for=
\"
selectedItems
\"
>Seçilenler</label>
\n
"
+
" <label for=
\"
selectedItems
\"
>Seçilenler</label>
\n
"
+
" <select ng-model=
\"
selectedFilteredItemsModel
\"\n
"
+
" <select ng-model=
\"
selectedFilteredItemsModel
\"\n
"
+
" value=
\"
$$value$$
\"\n
"
+
" value=
\"
$$value$$
\"\n
"
+
...
@@ -1633,11 +1627,11 @@ angular.module("shared/templates/multiselect.html", []).run(["$templateCache", f
...
@@ -1633,11 +1627,11 @@ angular.module("shared/templates/multiselect.html", []).run(["$templateCache", f
"
\n
"
+
"
\n
"
+
" <div class=
\"
help-block
\"
sf-message=
\"
form.description
\"
></div>
\n
"
+
" <div class=
\"
help-block
\"
sf-message=
\"
form.description
\"
></div>
\n
"
+
" </div>
\n
"
+
" </div>
\n
"
+
" <
div class=
\"
col-md-4
\"
>
\n
"
+
" <
!--<div class=
\"
col-md-4
\"
>--
>
\n
"
+
" <
a href=
\"
javascript:void(0);
\"
add-modal-for-linked-model
>
\n
"
+
" <
!--<a href=
\"
javascript:void(0);
\"
add-modal-for-linked-model>--
>
\n
"
+
" <
i class=
\"
fa fa-plus-circle fa-fw
\"
></i
>
\n
"
+
" <
!--<i class=
\"
fa fa-plus-circle fa-fw
\"
></i>--
>
\n
"
+
" <
/a
>
\n
"
+
" <
!--</a>--
>
\n
"
+
" <
/div
>
\n
"
+
" <
!--</div>--
>
\n
"
+
"</div>"
);
"</div>"
);
}]);
}]);
...
...
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