-
-
Save leonardocouy/93f5d6e45860e7043591 to your computer and use it in GitHub Desktop.
PLACE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.controller ('ListarPacienteCtrl', function($scope,$ionicListDelegate,$ionicFilterBar, Paciente){ | |
$scope.pacientes = Paciente.all() | |
$scope.listCanSwipe = true; | |
$scope.data = { | |
showDelete: false | |
}; | |
$scope.onpacienteDelete = function(paciente) { | |
console.log(paciente.nombre) | |
Paciente.remove(paciente) | |
}; | |
$scope.showFilterBar = function () { | |
$ionicFilterBar.show({ | |
items: $scope.pacientes, | |
update: function (filteredItems) { | |
$scope.pacientes = filteredItems; | |
}, | |
}); | |
}; | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> | |
<title></title> | |
<link href="lib/ionic/css/ionic.css" rel="stylesheet"> | |
<link href="css/style.css" rel="stylesheet"> | |
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above | |
<link href="css/ionic.app.css" rel="stylesheet"> | |
--> | |
<!-- ionic/angularjs js --> | |
<script src="lib/ionic/js/ionic.bundle.js"></script> | |
<!-- cordova script (this will be a 404 during development) --> | |
<script src="cordova.js"></script> | |
<!-- your app's js --> | |
<script src="js/app.js"></script> | |
<script src="js/controllers.js"></script> | |
<script src="js/services.js"></script> | |
<script src="lib/ngstorage/ngStorage.min.js"></script> | |
</head> | |
<body ng-app="starter"> | |
<!-- | |
The nav bar that will be updated as we navigate between views. | |
--> | |
<ion-nav-bar class="bar-stable"> | |
<ion-nav-back-button> | |
</ion-nav-back-button> | |
</ion-nav-bar> | |
<!-- | |
The views will be rendered in the <ion-nav-view> directive below | |
Templates are in the /templates folder (but you could also | |
have templates inline in this html file if you'd like). | |
--> | |
<ion-nav-view></ion-nav-view> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ion-view view-title="Paciente"> | |
<ion-content class="padding"> | |
<ion-list> | |
<p> | |
{{paciente.nombre}}</p> | |
<p> | |
{{paciente.apellidos}}</p> | |
<p> | |
{{paciente.edad}}</p> | |
<p> | |
{{paciente.estatura}}</p> | |
<p> | |
{{paciente.peso}}</p> | |
<p> | |
{{paciente.presion}}</p> | |
</ion-item> | |
</ion-content> | |
</ion-view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('starter.services', ['ngStorage']) | |
.factory('Paciente', function($localStorage) { | |
// Might use a resource here that returns a JSON array | |
// Some fake testing data | |
return { | |
all: function() { | |
return $localStorage.pacientes; | |
}, | |
save: function(paciente) { | |
if(!$localStorage.pacientes){ | |
$localStorage.pacientes = [] | |
} | |
$localStorage.pacientes.push(paciente); | |
}, | |
newProject: function(pacientes) { | |
// Add a new project | |
return { | |
name: '' | |
}; | |
}, | |
get: function(nombrePaciente) { | |
for (var i = 0; i < $localStorage.pacientes.length; i++) { | |
if ($localStorage.pacientes[i].nombre === nombrePaciente) { | |
return $localStorage.pacientes[i]; | |
} | |
} | |
return null; | |
}, | |
remove: function(paciente) { | |
$localStorage.pacientes.splice($localStorage.pacientes.indexOf(paciente.nombre)) | |
}, | |
update: function(paciente) { | |
var id_paciente = $localStorage.pacientes.indexOf(paciente) | |
$localStorage.pacientes[id_paciente] = paciente | |
}, | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ion-view view-title="Lista de paciente"> | |
<ion-nav-buttons side="right"> | |
<div class="buttons"> | |
<button class="button button-icon ion-android-search" ng-click="showFilterBar()"></button> | |
</div> | |
</ion-nav-buttons> | |
<ion-content > | |
<ion-list show-delete="data.showDelete" type="item-text-wrap" can-swipe="listCanSwipe"> | |
<ion-item ng-repeat="paciente in pacientes" | |
href="#/tab/listarpaciente/{{paciente.nombre}}"> | |
<p> {{paciente.nombre}}</p> | |
<p>{{paciente.apellidos}}</p> | |
<ion-delete-button class="ion-minus-circled" | |
ng-click="onpacienteDelete(paciente)"> | |
</ion-delete-button> | |
</ion-item> | |
</ion-content> | |
</ion-view> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment