Skip to content
This repository was archived by the owner on Nov 11, 2021. It is now read-only.

Commit f265ceb

Browse files
committed
Desktop app
1 parent 3867d25 commit f265ceb

File tree

15 files changed

+420
-18
lines changed

15 files changed

+420
-18
lines changed

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ target/
6363
*.db
6464

6565
# Node.js modules
66-
platforms/desktop/src/node_modules
67-
platforms/mobile/src/node_modeules
66+
platforms/desktop/src/clients/admin/static/assets/components
67+
# platforms/desktop/src/clients/admin/static/assets/components
6868

6969
# Platform builds
70-
platforms/desktop/dist
71-
platforms/mobiles/dist
70+
# platforms/desktop/dist
71+
# platforms/mobiles/dist

assets/js/components/angular/angular.js

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory" : "static/assets/components"
3+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "angular-material-starter",
3+
"description": "A starter project for AngularJS Material",
4+
"version": "0.0.1",
5+
"homepage": "https://github.com/angular/material-start",
6+
"license": "MIT",
7+
"private": true,
8+
"dependencies": {
9+
"angular": "master",
10+
"angular-animate": "master",
11+
"angular-aria": "master",
12+
"angular-material": "master"
13+
},
14+
"devDependencies": {
15+
"angular-material": "master"
16+
}
17+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
var app = require('app'); // Module to control application life.
2+
var ipc = require('ipc');
3+
4+
var BrowserWindow = require('browser-window'); // Module to create native browser window.
5+
var APP_DIR = 'file://' + __dirname;
6+
var STATIC_DIR = APP_DIR + '/static/';
7+
8+
// Report crashes to our server.
9+
require('crash-reporter').start();
10+
11+
// Keep a global reference of the window object, if you don't, the window will
12+
// be closed automatically when the javascript object is GCed.
13+
var mainWindow = null;
14+
15+
// Quit when all windows are closed.
16+
app.on('window-all-closed', function() {
17+
if (process.platform != 'darwin'){
18+
app.quit();
19+
}
20+
});
21+
22+
// This method will be called when Electron has done everything
23+
// initialization and ready for creating browser windows.
24+
app.on('ready', function() {
25+
// Create the browser window.
26+
mainWindow = new BrowserWindow({width: 640, height: 380, frame:false, show:false});
27+
28+
// and load the index.html of the app.
29+
mainWindow.loadUrl(STATIC_DIR + 'login.html');
30+
31+
mainWindow.webContents.on('did-finish-load', function() {
32+
mainWindow.show();
33+
mainWindow.webContents.send('ping', 'whoooooooh!');
34+
});
35+
36+
mainWindow.openDevTools();
37+
38+
// Emitted when the window is closed.
39+
mainWindow.on('closed', function() {
40+
// Dereference the window object, usually you would store windows
41+
// in an array if your app supports multi windows, this is the time
42+
// when you should delete the corresponding element.
43+
mainWindow = null;
44+
});
45+
46+
ipc.on('window-evt', function(event, action) {
47+
mainWindow[action]();
48+
});
49+
50+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "citasalud.admin",
3+
"version": "0.1.0",
4+
"description": "(ADMIN) CitaSalud - Gestión de citas y diagnóstico",
5+
"main": "main.js",
6+
"scripts": {
7+
"postinstall": "bower update"
8+
},
9+
"author": "Richard Cotrina <[email protected]>",
10+
"license": "ISC",
11+
"devDependencies": {},
12+
"dependencies": {}
13+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
html, body {
2+
font-family: 'Roboto', sans-serif;
3+
font-size:14px;
4+
height:100%;
5+
margin: 0px;
6+
padding: 0px;
7+
}
8+
9+
body#login md-input-container.md-icon-float > md-icon {
10+
top: 22px;
11+
}
12+
13+
#login md-input-container.md-icon-float.md-input-focused, md-input-container.md-icon-float.md-input-has-value {
14+
margin-top: -16px;
15+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
var app = angular.module('citaSalud', ['ngMaterial', 'users'])
2+
.config(function($mdThemingProvider, $mdIconProvider){
3+
$mdIconProvider
4+
.iconSet("action", "assets/components/svg-material-icons/svg-sprite-action.svg", 24)
5+
.iconSet("alert", "assets/components/svg-material-icons/svg-sprite-alert.svg", 24)
6+
.iconSet("av", "assets/components/svg-material-icons/svg-sprite-av.svg", 24)
7+
.iconSet("communication", "assets/components/svg-material-icons/svg-sprite-communication", 24)
8+
.iconSet("content", "assets/components/svg-material-icons/svg-sprite-content.svg", 24)
9+
.iconSet("device", "assets/components/svg-material-icons/svg-sprite-device.svg", 24)
10+
.iconSet("editor", "assets/components/svg-material-icons/svg-sprite-editor.svg", 24)
11+
.iconSet("file", "assets/components/svg-material-icons/svg-sprite-file.svg", 24)
12+
.iconSet("hardware", "assets/components/svg-material-icons/svg-sprite-hardware.svg", 24)
13+
.iconSet("image", "assets/components/svg-material-icons/svg-sprite-image.svg", 24)
14+
.iconSet("maps", "assets/components/svg-material-icons/svg-sprite-maps.svg", 24)
15+
.iconSet("navigation", "assets/components/svg-material-icons/svg-sprite-navigation.svg", 24)
16+
.iconSet("notification", "assets/components/svg-material-icons/svg-sprite-notification.svg", 24)
17+
.iconSet("social", "assets/components/svg-material-icons/svg-sprite-social", 24)
18+
.iconSet("toggle", "assets/components/svg-material-icons/svg-sprite-toggle.svg", 24);
19+
20+
$mdThemingProvider.theme('default')
21+
.primaryPalette('blue')
22+
.accentPalette('blue-grey');
23+
});
24+
25+
app.controller('mainCtrl', function($scope, $mdDialog){
26+
27+
var ipc = require('ipc');
28+
var messenger = {
29+
send : function(event, action) {
30+
ipc.send(event, action);
31+
}
32+
};
33+
34+
$scope.loginData = {
35+
'username' : 'admin',
36+
'password' : 'admin',
37+
'remember_pwd' : true
38+
};
39+
40+
$scope.closeW = function(){
41+
messenger.send('window-evt', 'close');
42+
};
43+
$scope.minW = function(){
44+
messenger.send('window-evt', 'minimize');
45+
$scope.hide();
46+
};
47+
48+
$scope.doLogin = function(){
49+
$scope.loading();
50+
};
51+
52+
$scope.loading = function() {
53+
var parentEl = angular.element(document.querySelector('#internalw'));
54+
$mdDialog.show({
55+
parent : parentEl,
56+
controller: DialogController,
57+
template: '<md-progress-circular class="md-accent" md-mode="indeterminate"></md-progress-circular>',
58+
})
59+
.then(function(answer) {
60+
$scope.alert = 'You said the information was "' + answer + '".';
61+
}, function() {
62+
$scope.alert = 'You cancelled the dialog.';
63+
});
64+
65+
};
66+
67+
function DialogController(scope, $mdDialog) {
68+
scope.closeDialog = function() {
69+
$mdDialog.hide();
70+
}
71+
}
72+
73+
$scope.hide = function(){
74+
$mdDialog.cancel();
75+
}
76+
});

platforms/desktop/src/clients/admin/static/assets/js/services/auth.js

Whitespace-only changes.
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
(function(){
2+
3+
angular
4+
.module('users')
5+
.controller('UserController', [
6+
'userService', '$mdSidenav', '$mdBottomSheet', '$log', '$q',
7+
UserController
8+
]);
9+
10+
/**
11+
* Main Controller for the Angular Material Starter App
12+
* @param $scope
13+
* @param $mdSidenav
14+
* @param avatarsService
15+
* @constructor
16+
*/
17+
function UserController( userService, $mdSidenav, $mdBottomSheet, $log, $q) {
18+
var self = this;
19+
20+
self.selected = null;
21+
self.users = [ ];
22+
self.selectUser = selectUser;
23+
self.toggleList = toggleUsersList;
24+
self.share = share;
25+
26+
// Load all registered users
27+
28+
userService
29+
.loadAllUsers()
30+
.then( function( users ) {
31+
self.users = [].concat(users);
32+
self.selected = users[0];
33+
});
34+
35+
// *********************************
36+
// Internal methods
37+
// *********************************
38+
39+
/**
40+
* First hide the bottomsheet IF visible, then
41+
* hide or Show the 'left' sideNav area
42+
*/
43+
function toggleUsersList() {
44+
var pending = $mdBottomSheet.hide() || $q.when(true);
45+
46+
pending.then(function(){
47+
$mdSidenav('left').toggle();
48+
});
49+
}
50+
51+
/**
52+
* Select the current avatars
53+
* @param menuId
54+
*/
55+
function selectUser ( user ) {
56+
self.selected = angular.isNumber(user) ? $scope.users[user] : user;
57+
self.toggleList();
58+
}
59+
60+
/**
61+
* Show the bottom sheet
62+
*/
63+
function share($event) {
64+
var user = self.selected;
65+
66+
$mdBottomSheet.show({
67+
parent: angular.element(document.getElementById('content')),
68+
templateUrl: 'view/contactSheet.html',
69+
controller: [ '$mdBottomSheet', UserSheetController],
70+
controllerAs: "vm",
71+
bindToController : true,
72+
targetEvent: $event
73+
}).then(function(clickedItem) {
74+
clickedItem && $log.debug( clickedItem.name + ' clicked!');
75+
});
76+
77+
/**
78+
* Bottom Sheet controller for the Avatar Actions
79+
*/
80+
function UserSheetController( $mdBottomSheet ) {
81+
this.user = user;
82+
this.items = [
83+
{ name: 'Phone' , icon: 'phone' , icon_url: './assets/svg/phone.svg'},
84+
{ name: 'Twitter' , icon: 'twitter' , icon_url: './assets/svg/twitter.svg'},
85+
{ name: 'Google+' , icon: 'google_plus' , icon_url: './assets/svg/google_plus.svg'},
86+
{ name: 'Hangout' , icon: 'hangouts' , icon_url: './assets/svg/hangouts.svg'}
87+
];
88+
this.performAction = function(action) {
89+
$mdBottomSheet.hide(action);
90+
};
91+
}
92+
}
93+
94+
}
95+
96+
})();
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
(function(){
2+
'use strict';
3+
4+
angular.module('users')
5+
.service('userService', ['$q', UserService]);
6+
7+
/**
8+
* Users DataService
9+
* Uses embedded, hard-coded data model; acts asynchronously to simulate
10+
* remote data service call(s).
11+
*
12+
* @returns {{loadAll: Function}}
13+
* @constructor
14+
*/
15+
function UserService($q){
16+
var users = [
17+
{
18+
name: 'Lia Lugo',
19+
avatar: 'svg-1',
20+
content: 'I love cheese, especially airedale queso. Cheese and biscuits halloumi cauliflower cheese cottage cheese swiss boursin fondue caerphilly. Cow port-salut camembert de normandie macaroni cheese feta who moved my cheese babybel boursin. Red leicester roquefort boursin squirty cheese jarlsberg blue castello caerphilly chalk and cheese. Lancashire.'
21+
},
22+
{
23+
name: 'George Duke',
24+
avatar: 'svg-2',
25+
content: 'Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit​​, morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris.'
26+
},
27+
{
28+
name: 'Gener Delosreyes',
29+
avatar: 'svg-3',
30+
content: "Raw denim pour-over readymade Etsy Pitchfork. Four dollar toast pickled locavore bitters McSweeney's blog. Try-hard art party Shoreditch selfies. Odd Future butcher VHS, disrupt pop-up Thundercats chillwave vinyl jean shorts taxidermy master cleanse letterpress Wes Anderson mustache Helvetica. Schlitz bicycle rights chillwave irony lumberhungry Kickstarter next level sriracha typewriter Intelligentsia, migas kogi heirloom tousled. Disrupt 3 wolf moon lomo four loko. Pug mlkshk fanny pack literally hoodie bespoke, put a bird on it Marfa messenger bag kogi VHS."
31+
},
32+
{
33+
name: 'Lawrence Ray',
34+
avatar: 'svg-4',
35+
content: 'Scratch the furniture spit up on light gray carpet instead of adjacent linoleum so eat a plant, kill a hand pelt around the house and up and down stairs chasing phantoms run in circles, or claw drapes. Always hungry pelt around the house and up and down stairs chasing phantoms.'
36+
},
37+
{
38+
name: 'Ernesto Urbina',
39+
avatar: 'svg-5',
40+
content: 'Webtwo ipsum dolor sit amet, eskobo chumby doostang bebo. Bubbli greplin stypi prezi mzinga heroku wakoopa, shopify airbnb dogster dopplr gooru jumo, reddit plickers edmodo stypi zillow etsy.'
41+
},
42+
{
43+
name: 'Gani Ferrer',
44+
avatar: 'svg-6',
45+
content: "Lebowski ipsum yeah? What do you think happens when you get rad? You turn in your library card? Get a new driver's license? Stop being awesome? Dolor sit amet, consectetur adipiscing elit praesent ac magna justo pellentesque ac lectus. You don't go out and make a living dressed like that in the middle of a weekday. Quis elit blandit fringilla a ut turpis praesent felis ligula, malesuada suscipit malesuada."
46+
}
47+
];
48+
49+
// Promise-based API
50+
return {
51+
loadAllUsers : function() {
52+
// Simulate async nature of real remote calls
53+
return $q.when(users);
54+
}
55+
};
56+
}
57+
58+
})();
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
(function(){
2+
'use strict';
3+
4+
// Prepare the 'users' module for subsequent registration of controllers and delegates
5+
angular.module('users', [ 'ngMaterial' ]);
6+
7+
8+
})();
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<md-bottom-sheet class="md-list md-has-header">
2+
3+
<md-subheader>
4+
Contact <span class="name">{{ vm.user.name }}</span>:
5+
</md-subheader>
6+
7+
<md-list>
8+
<md-item ng-repeat="item in vm.items">
9+
<md-button ng-click="vm.performAction(item)">
10+
<md-icon md-svg-icon="{{ item.icon_url }}"></md-icon>
11+
{{item.name}}
12+
</md-button>
13+
</md-item>
14+
</md-list>
15+
16+
</md-bottom-sheet>

0 commit comments

Comments
 (0)