Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5712f9ff
authored
Dec 15, 2016
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
admin angular UI ready
parent
c1ebf0f7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
0 deletions
sails/src/assets/scripts/modules/admin/controllers/licenses.js
sails/src/assets/scripts/modules/admin/views/licenses.html
sails/src/assets/scripts/modules/admin/controllers/licenses.js
0 → 100644
View file @
5712f9ff
'use strict'
;
//--------------------------
// Admin License Controller
//--------------------------
dashboardControllers
.
controller
(
'AdminLicensesCtrl'
,
function
AdminLicensesCtrl
(
$scope
,
$window
,
$http
,
config
,
$translate
,
ngToast
)
{
// The parameter 'config' is injected from config.js (defined in dashboardConfig module)
// Don't show the message at the begining
$scope
.
showmessagesupervisor
=
false
;
$scope
.
formdatalicense
=
{
duration
:
''
};
// This generates a new license and registers it in the database
$scope
.
create_license
=
function
(
supervisor
){
$http
.
post
(
config
.
backend
+
'/license'
,
$scope
.
formdatalicense
)
.
success
(
function
(
data
,
status
,
headers
,
config
)
{
$scope
.
formdatalicense
.
duration
=
''
;
$scope
.
new_number
=
data
.
number
.
substr
(
0
,
4
)
+
"-"
+
data
.
number
.
substr
(
4
,
4
)
+
"-"
+
data
.
number
.
substr
(
8
,
4
)
+
"-"
+
data
.
number
.
substr
(
12
,
4
);
console
.
log
(
$scope
.
new_number
);
$scope
.
duration_registered
=
data
.
duration
;
})
.
error
(
function
(
data
,
status
,
headers
,
config
)
{
ngToast
.
danger
({
content
:
$translate
.
instant
(
'error_general'
)});
console
.
log
(
"Error from API: "
+
data
.
error
);
});
};
});
sails/src/assets/scripts/modules/admin/views/licenses.html
0 → 100644
View file @
5712f9ff
<!-- Admin Licenses -->
<div
class=
"row"
>
<div
class=
"col-md-2"
>
</div>
<div
class=
"col-md-4"
>
<h3
translate
>
licenses
</h3>
<form
role=
"form"
ng-submit=
"create_license()"
>
<div
class=
"form-group"
>
<input
type=
"number"
class=
"form-control"
id=
"setup_duration"
placeholder=
"{{ 'duration_in_months' | translate }}"
required
ng-model=
"formdatalicense.duration"
required
/>
</div>
<div
class=
"form-group text-center"
>
<button
type=
"submit"
class=
"btn btn-primary"
translate
>
generate
</button>
</div>
</form>
</div>
<div
class=
"col-md-4"
>
<div
ng-show=
"new_number.length > 16"
class=
"alert alert-info"
>
<p>
{{ 'license_created' | translate }}:
<strong>
{{ new_number }}
</strong></p>
<p>
{{ 'duration_in_months' | translate }}: {{ duration_registered }}
</p>
</div>
</div>
<div
class=
"col-md-2"
>
</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