Datenbank erweitert, typenen und attacken
This commit is contained in:
parent
607ffbd0f6
commit
25a5793f2f
@ -48,9 +48,6 @@
|
||||
],
|
||||
"cordovaPlatforms": [
|
||||
"ios",
|
||||
{
|
||||
"platform": "android",
|
||||
"locator": "./engine/cordova-android-c0.6.1/"
|
||||
}
|
||||
"android"
|
||||
]
|
||||
}
|
||||
|
||||
@ -349,3 +349,346 @@ md-input-container {
|
||||
width: 32px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
|
||||
.pokemontyp1sm {
|
||||
display: inline-block;
|
||||
padding: 0 25px;
|
||||
height: 16px;
|
||||
font-size: 10px;
|
||||
line-height: 16px;
|
||||
border-radius: 5px;
|
||||
background-color: #D50000;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.pokemontyp1sm img {
|
||||
float: left;
|
||||
margin: 0 10px 0 -25px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.pokemontyp2sm {
|
||||
display: inline-block;
|
||||
padding: 0 25px;
|
||||
height: 16px;
|
||||
font-size: 10px;
|
||||
line-height: 16px;
|
||||
border-radius: 5px;
|
||||
background-color: #C51162;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.pokemontyp2sm img {
|
||||
float: left;
|
||||
margin: 0 10px 0 -25px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.pokemontyp3sm {
|
||||
display: inline-block;
|
||||
padding: 0 25px;
|
||||
height: 16px;
|
||||
font-size: 10px;
|
||||
line-height: 16px;
|
||||
border-radius: 5px;
|
||||
background-color: #AA00FF;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.pokemontyp3sm img {
|
||||
float: left;
|
||||
margin: 0 10px 0 -25px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.pokemontyp4sm {
|
||||
display: inline-block;
|
||||
padding: 0 25px;
|
||||
height: 16px;
|
||||
font-size: 10px;
|
||||
line-height: 16px;
|
||||
border-radius: 5px;
|
||||
background-color: #6200EA;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.pokemontyp4sm img {
|
||||
float: left;
|
||||
margin: 0 10px 0 -25px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.pokemontyp5sm {
|
||||
display: inline-block;
|
||||
padding: 0 25px;
|
||||
height: 16px;
|
||||
font-size: 10px;
|
||||
line-height: 16px;
|
||||
border-radius: 5px;
|
||||
background-color: #304FFE;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.pokemontyp5sm img {
|
||||
float: left;
|
||||
margin: 0 10px 0 -25px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.pokemontyp6sm {
|
||||
display: inline-block;
|
||||
padding: 0 25px;
|
||||
height: 16px;
|
||||
font-size: 10px;
|
||||
line-height: 16px;
|
||||
border-radius: 5px;
|
||||
background-color: #2962FF;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.pokemontyp6sm img {
|
||||
float: left;
|
||||
margin: 0 10px 0 -25px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.pokemontyp7sm {
|
||||
display: inline-block;
|
||||
padding: 0 25px;
|
||||
height: 16px;
|
||||
font-size: 10px;
|
||||
line-height: 16px;
|
||||
border-radius: 5px;
|
||||
background-color: #0091EA;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.pokemontyp7sm img {
|
||||
float: left;
|
||||
margin: 0 10px 0 -25px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.pokemontyp8sm {
|
||||
display: inline-block;
|
||||
padding: 0 25px;
|
||||
height: 16px;
|
||||
font-size: 10px;
|
||||
line-height: 16px;
|
||||
border-radius: 5px;
|
||||
background-color: #00B8D4;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.pokemontyp8sm img {
|
||||
float: left;
|
||||
margin: 0 10px 0 -25px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.pokemontyp9sm {
|
||||
display: inline-block;
|
||||
padding: 0 25px;
|
||||
height: 16px;
|
||||
font-size: 10px;
|
||||
line-height: 16px;
|
||||
border-radius: 5px;
|
||||
background-color: #00BFA5;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.pokemontyp9sm img {
|
||||
float: left;
|
||||
margin: 0 10px 0 -25px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.pokemontyp10sm {
|
||||
display: inline-block;
|
||||
padding: 0 25px;
|
||||
height: 16px;
|
||||
font-size: 10px;
|
||||
line-height: 16px;
|
||||
border-radius: 5px;
|
||||
background-color: #1B5E20;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.pokemontyp10sm img {
|
||||
float: left;
|
||||
margin: 0 10px 0 -25px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.pokemontyp11sm {
|
||||
display: inline-block;
|
||||
padding: 0 25px;
|
||||
height: 16px;
|
||||
font-size: 10px;
|
||||
line-height: 16px;
|
||||
border-radius: 5px;
|
||||
background-color: #33691E;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.pokemontyp11sm img {
|
||||
float: left;
|
||||
margin: 0 10px 0 -25px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.pokemontyp12sm {
|
||||
display: inline-block;
|
||||
padding: 0 25px;
|
||||
height: 16px;
|
||||
font-size: 10px;
|
||||
line-height: 16px;
|
||||
border-radius: 5px;
|
||||
background-color: #827717;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.pokemontyp12sm img {
|
||||
float: left;
|
||||
margin: 0 10px 0 -25px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.pokemontyp13sm {
|
||||
display: inline-block;
|
||||
padding: 0 25px;
|
||||
height: 16px;
|
||||
font-size: 10px;
|
||||
line-height: 16px;
|
||||
border-radius: 5px;
|
||||
background-color: #F57F17;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.pokemontyp13sm img {
|
||||
float: left;
|
||||
margin: 0 10px 0 -25px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.pokemontyp14sm {
|
||||
display: inline-block;
|
||||
padding: 0 25px;
|
||||
height: 16px;
|
||||
font-size: 10px;
|
||||
line-height: 16px;
|
||||
border-radius: 5px;
|
||||
background-color: #FF6F00;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.pokemontyp14sm img {
|
||||
float: left;
|
||||
margin: 0 10px 0 -25px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.pokemontyp15sm {
|
||||
display: inline-block;
|
||||
padding: 0 25px;
|
||||
height: 16px;
|
||||
font-size: 10px;
|
||||
line-height: 16px;
|
||||
border-radius: 5px;
|
||||
background-color: #E65100;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.pokemontyp15sm img {
|
||||
float: left;
|
||||
margin: 0 10px 0 -25px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.pokemontyp16sm {
|
||||
display: inline-block;
|
||||
padding: 0 25px;
|
||||
height: 16px;
|
||||
font-size: 10px;
|
||||
line-height: 16px;
|
||||
border-radius: 5px;
|
||||
background-color: #BF360C;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.pokemontyp16sm img {
|
||||
float: left;
|
||||
margin: 0 10px 0 -25px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.pokemontyp17sm {
|
||||
display: inline-block;
|
||||
padding: 0 25px;
|
||||
height: 16px;
|
||||
font-size: 10px;
|
||||
line-height: 16px;
|
||||
border-radius: 5px;
|
||||
background-color: #3E2723;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.pokemontyp17sm img {
|
||||
float: left;
|
||||
margin: 0 10px 0 -25px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.pokemontyp18sm {
|
||||
display: inline-block;
|
||||
padding: 0 25px;
|
||||
height: 16px;
|
||||
font-size: 10px;
|
||||
line-height: 16px;
|
||||
border-radius: 5px;
|
||||
background-color: #212121;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.pokemontyp18sm img {
|
||||
float: left;
|
||||
margin: 0 10px 0 -25px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
BIN
www/pokedex.db
BIN
www/pokedex.db
Binary file not shown.
@ -26,7 +26,7 @@
|
||||
<div class="item item-body">
|
||||
<img class="full-image" src="{{pokemon.pokemonimage}}">
|
||||
<p>
|
||||
Richtig geiles Pokemon.
|
||||
{{pokemon.pokemontext}}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@ -69,63 +69,36 @@
|
||||
<div class="item item-divider">
|
||||
Schwächen
|
||||
</div>
|
||||
<div class="item item-text-wrap">
|
||||
<md-list>
|
||||
<div class="row" ng-repeat="pokemonschwaeche in pokemonschwaechenliste">
|
||||
|
||||
<div ng-if="pokemon.pokemonweaka > 0" class="row">
|
||||
<div ng-if="pokemon.pokemonweaka > 0" class="col-50">
|
||||
<div ng-if="pokemon.pokemonweaka > 0" class="pokemontyp{{ pokemon.pokemonweaka }}">
|
||||
<img src="img/typbilder/{{ pokemon.pokemonweaka }}.png" alt="PokemonTyp" width="32" height="32">
|
||||
{{ pokemon.pokemonweakaString }}
|
||||
</div>
|
||||
</div>
|
||||
<div ng-if="pokemon.pokemonweakb > 0" class="col-50">
|
||||
<div ng-if="pokemon.pokemonweakb > 0" class="pokemontyp{{ pokemon.pokemonweakb }}">
|
||||
<img src="img/typbilder/{{ pokemon.pokemonweakb }}.png" alt="PokemonTyp" width="32" height="32">
|
||||
{{ pokemon.pokemonweakbString }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="pokemontyp{{ pokemonschwaeche.pokemontypid1}}sm">
|
||||
<img src="img/typbilder/{{ pokemonschwaeche.pokemontypid1}}.png" alt="PokemonTyp" width="32" height="32">
|
||||
{{ pokemonschwaeche.pokemontyptext1 }}
|
||||
</div>
|
||||
{{ pokemonschwaeche.pokemontyp1 }}
|
||||
</div>
|
||||
|
||||
<div ng-if="pokemon.pokemonweakc > 0" class="row">
|
||||
<div ng-if="pokemon.pokemonweakc > 0" class="col-50">
|
||||
<div ng-if="pokemon.pokemonweakc > 0" class="pokemontyp{{ pokemon.pokemonweakc }}">
|
||||
<img src="img/typbilder/{{ pokemon.pokemonweakc }}.png" alt="PokemonTyp" width="32" height="32">
|
||||
{{ pokemon.pokemonweakcString }}
|
||||
</div>
|
||||
</div>
|
||||
<div ng-if="pokemon.pokemonweakd > 0" class="col-50">
|
||||
<div ng-if="pokemon.pokemonweakd > 0" class="pokemontyp{{ pokemon.pokemonweakd }}">
|
||||
<img src="img/typbilder/{{ pokemon.pokemonweakd }}.png" alt="PokemonTyp" width="32" height="32">
|
||||
{{ pokemon.pokemonweakdString }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="pokemontyp{{ pokemonschwaeche.pokemontypid2}}sm">
|
||||
<img src="img/typbilder/{{ pokemonschwaeche.pokemontypid2}}.png" alt="PokemonTyp" width="32" height="32">
|
||||
{{ pokemonschwaeche.pokemontyptext2 }}
|
||||
</div>
|
||||
{{ pokemonschwaeche.pokemontyp2 }}
|
||||
</div>
|
||||
|
||||
<div ng-if="pokemon.pokemonweake > 0" class="row">
|
||||
<div ng-if="pokemon.pokemonweake > 0" class="col-50">
|
||||
<div ng-if="pokemon.pokemonweake > 0" class="pokemontyp{{ pokemon.pokemonweake }}">
|
||||
<img src="img/typbilder/{{ pokemon.pokemonweake }}.png" alt="PokemonTyp" width="32" height="32">
|
||||
{{ pokemon.pokemonweakeString }}
|
||||
</div>
|
||||
</div>
|
||||
<div ng-if="pokemon.pokemonweakf > 0" class="col-50">
|
||||
<div ng-if="pokemon.pokemonweakf > 0" class="pokemontyp{{ pokemon.pokemonweakf }}">
|
||||
<img src="img/typbilder/{{ pokemon.pokemonweakf }}.png" alt="PokemonTyp" width="32" height="32">
|
||||
{{ pokemon.pokemonweakfString }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="pokemontyp{{ pokemonschwaeche.pokemontypid3}}sm">
|
||||
<img src="img/typbilder/{{ pokemonschwaeche.pokemontypid3}}.png" alt="PokemonTyp" width="32" height="32">
|
||||
{{ pokemonschwaeche.pokemontyptext3 }}
|
||||
</div>
|
||||
{{ pokemonschwaeche.pokemontyp3 }}
|
||||
</div>
|
||||
|
||||
<div ng-if="pokemon.pokemonweakg > 0" class="row">
|
||||
<div ng-if="pokemon.pokemonweakg > 0" class="col-50">
|
||||
<div ng-if="pokemon.pokemonweakg > 0" class="pokemontyp{{ pokemon.pokemonweakg }}">
|
||||
<img src="img/typbilder/{{ pokemon.pokemonweakg }}.png" alt="PokemonTyp" width="32" height="32">
|
||||
{{ pokemon.pokemonweakgString }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</md-list>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
|
||||
@ -67,14 +67,6 @@ appControllers.controller('pokemonListCtrl', function ($scope, $stateParams,$fil
|
||||
$scope.pokemons = pokedexDB.all();
|
||||
};//End getPokemonList.
|
||||
|
||||
// updatePokemon is for update pokemons.
|
||||
// By sending pokemon to pokedexDB.update(pokemon) service.
|
||||
// Parameter :
|
||||
// pokemon = pokemon that user select from view.
|
||||
$scope.updatePokemon = function (pokemon) {
|
||||
pokedexDB.update(pokemon);
|
||||
};// End updatePokemon.
|
||||
|
||||
// navigateTo is for navigate to other page
|
||||
// by using targetPage to be the destination page
|
||||
// and sending objectData to the destination page.
|
||||
@ -89,195 +81,48 @@ appControllers.controller('pokemonListCtrl', function ($scope, $stateParams,$fil
|
||||
},400);
|
||||
};// End navigateTo.
|
||||
|
||||
// callTo is for using mobile calling.
|
||||
// Parameter :
|
||||
// number = number that going to call.
|
||||
$scope.callTo = function (number) {
|
||||
window.open("tel:" + number);
|
||||
}// End callTo.
|
||||
|
||||
|
||||
$scope.initialForm();
|
||||
|
||||
});// End of Pokemon List Page Controller.
|
||||
|
||||
// Controller of pokemon Detail Page.
|
||||
appControllers.controller('pokemonDetailCtrl', function ($mdBottomSheet, $mdToast, $scope, $stateParams, $filter, $mdDialog, $ionicHistory, pokedexDB) {
|
||||
appControllers.controller('pokemonDetailCtrl', function ($mdBottomSheet, $mdToast, $scope, $stateParams, $filter, $mdDialog, $ionicHistory,$timeout, pokedexDB) {
|
||||
|
||||
// initialForm is the first activity in the controller.
|
||||
// It will initial all variable data and let the function works when page load.
|
||||
$scope.initialForm = function () {
|
||||
|
||||
// $scope.disableSaveBtn is the variable for setting disable or enable the save button.
|
||||
$scope.disableSaveBtn = false;
|
||||
|
||||
$scope.pokemonschwaechenliste = [];
|
||||
// $scope.pokemon is the variable that store pokemon detail data that receive form pokemon list page.
|
||||
// Parameter :
|
||||
// $stateParams.actionDelete(bool) = status that pass from pokemon list page.
|
||||
// $stateParams.pokemondetail(object) = pokemon that user select from pokemon list page.
|
||||
$scope.pokemon = $scope.getPokemonData($stateParams.pokemondetail);
|
||||
|
||||
//$scope.actionDelete is the variable for allow or not allow to delete data.
|
||||
// It will allow to delete data when have data in the database.
|
||||
$scope.actionDelete = $stateParams.actionDelete;
|
||||
$timeout(function () {
|
||||
$scope.getTypenEffekt($scope.pokemon.pokedexid);
|
||||
}, 1000);
|
||||
|
||||
}; //End initialForm.
|
||||
|
||||
// getPokemonData is for get pokemon detail data.
|
||||
$scope.getPokemonData = function (pokemonDetail) {
|
||||
// tempPokemon is temporary pokemon data detail.
|
||||
var tempPokemon = {
|
||||
id: null,
|
||||
pokedexid: '',
|
||||
pokedexidString: '',
|
||||
pokemonname: '',
|
||||
pokemontypa: '',
|
||||
pokemontypb: '',
|
||||
pokemontypaString: '',
|
||||
pokemontypbString: '',
|
||||
pokemonimage: ''
|
||||
}
|
||||
// If actionDelete is true pokemon Detail Page will show pokemon detail that receive form pokemon list page.
|
||||
// else it will show pokemon for user to add new data.
|
||||
//return (actionDelete ? angular.copy(pokemonDetail) : tempPokemon);
|
||||
return (pokemonDetail);
|
||||
|
||||
};//End get pokemon detail data.
|
||||
|
||||
// savePokemon is for save pokemon.
|
||||
// Parameter :
|
||||
// pokemon(object) = pokemon object that presenting on the view.
|
||||
// $event(object) = position of control that user tap.
|
||||
$scope.saveContract = function (pokemon, $event) {
|
||||
//$mdBottomSheet.hide() use for hide bottom sheet.
|
||||
$mdBottomSheet.hide();
|
||||
//mdDialog.show use for show alert box for Confirm to save data.
|
||||
$mdDialog.show({
|
||||
controller: 'DialogController',
|
||||
templateUrl: 'confirm-dialog.html',
|
||||
targetEvent: $event,
|
||||
locals: {
|
||||
displayOption: {
|
||||
title: "Confirm to save data?",
|
||||
content: "Data will save to SQLite.",
|
||||
ok: "Confirm",
|
||||
cancel: "Close"
|
||||
}
|
||||
}
|
||||
}).then(function () {
|
||||
|
||||
// For confirm button to save data.
|
||||
try {
|
||||
// To update data by calling pokedexDB.update(pokemon) service.
|
||||
if ($scope.actionDelete) {
|
||||
if ($scope.pokemon.id == null) {
|
||||
$scope.pokemon.id = $scope.pokemonList[$scope.pokemonList.length - 1].id;
|
||||
}
|
||||
pokedexDB.update(pokemon);
|
||||
} // End update data.
|
||||
|
||||
// To add new data by calling pokedexDB.add(pokemon) service.
|
||||
else {
|
||||
pokedexDB.add(pokemon);
|
||||
$scope.pokemonList = pokedexDB.all();
|
||||
$scope.actionDelete = true;
|
||||
}// End add new data.
|
||||
|
||||
// Showing toast for save data is success.
|
||||
$mdToast.show({
|
||||
controller: 'toastController',
|
||||
templateUrl: 'toast.html',
|
||||
hideDelay: 400,
|
||||
position: 'top',
|
||||
locals: {
|
||||
displayOption: {
|
||||
title: "Data Saved !"
|
||||
}
|
||||
}
|
||||
});//End showing toast.
|
||||
}
|
||||
catch (e) {
|
||||
// Showing toast for unable to save data.
|
||||
$mdToast.show({
|
||||
controller: 'toastController',
|
||||
templateUrl: 'toast.html',
|
||||
hideDelay: 800,
|
||||
position: 'top',
|
||||
locals: {
|
||||
displayOption: {
|
||||
title: window.globalVariable.message.errorMessage
|
||||
}
|
||||
}
|
||||
});//End showing toast.
|
||||
}
|
||||
}, function () {
|
||||
// For cancel button to save data.
|
||||
});// End alert box.
|
||||
};// End save pokemon.
|
||||
|
||||
// deletePokemon is for remove pokemon.
|
||||
// Parameter :
|
||||
// pokemon(object) = pokemon object that presenting on the view.
|
||||
// $event(object) = position of control that user tap.
|
||||
$scope.deletePokemon= function (pokemon, $event) {
|
||||
//$mdBottomSheet.hide() use for hide bottom sheet.
|
||||
$mdBottomSheet.hide();
|
||||
//mdDialog.show use for show alert box for Confirm to delete data.
|
||||
$mdDialog.show({
|
||||
controller: 'DialogController',
|
||||
templateUrl: 'confirm-dialog.html',
|
||||
targetEvent: $event,
|
||||
locals: {
|
||||
displayOption: {
|
||||
title: "Confirm to remove data?",
|
||||
content: "Data will remove form SQLite.",
|
||||
ok: "Confirm",
|
||||
cancel: "Close"
|
||||
}
|
||||
}
|
||||
}).then(function () {
|
||||
// For confirm button to remove data.
|
||||
try {
|
||||
// Remove contract by calling pokedexDB.remove(contract)service.
|
||||
if ($scope.pokemon.id == null) {
|
||||
$scope.pokemon.id = $scope.pokemonList[$scope.pokemonList.length - 1].id;
|
||||
}
|
||||
pokedexDB.remove(pokemon);
|
||||
$ionicHistory.goBack();
|
||||
}// End remove contract.
|
||||
catch (e) {
|
||||
// Showing toast for unable to remove data.
|
||||
$mdToast.show({
|
||||
controller: 'toastController',
|
||||
templateUrl: 'toast.html',
|
||||
hideDelay: 800,
|
||||
position: 'top',
|
||||
locals: {
|
||||
displayOption: {
|
||||
title: window.globalVariable.message.errorMessage
|
||||
}
|
||||
}
|
||||
});// End showing toast.
|
||||
}
|
||||
}, function () {
|
||||
// For cancel button to remove data.
|
||||
});// End alert box.
|
||||
};// End remove contract.
|
||||
|
||||
// validateRequiredField is for validate the required field.
|
||||
// Parameter :
|
||||
// form(object) = contract object that presenting on the view.
|
||||
$scope.validateRequiredField = function (form) {
|
||||
return !( (form.firstName.$error.required == undefined)
|
||||
&& (form.lastName.$error.required == undefined)
|
||||
&& (form.telephone.$error.required == undefined));
|
||||
};// End validate the required field.
|
||||
// getPokemonList is for get all pokemons.
|
||||
// By calling pokedexDB.all() service.
|
||||
$scope.getTypenEffekt = function (pokedexid) {
|
||||
$scope.pokemonschwaechenliste = pokedexDB.getTypenEffekte(pokedexid);
|
||||
};//End getPokemonList.
|
||||
|
||||
// showListBottomSheet is for showing the bottom sheet.
|
||||
// Parameter :
|
||||
// $event(object) = position of control that user tap.
|
||||
// contractForm(object) = contract object that presenting on the view.
|
||||
$scope.showListBottomSheet = function ($event, contractForm) {
|
||||
$scope.disableSaveBtn = $scope.validateRequiredField(contractForm);
|
||||
$mdBottomSheet.show({
|
||||
templateUrl: 'contract-actions-template',
|
||||
targetEvent: $event,
|
||||
|
||||
@ -38,6 +38,8 @@ appServices.factory('pokedexDB', function ($cordovaSQLite)
|
||||
// pokemonList variable use to store data from sqlite query
|
||||
var pokemonList = [];
|
||||
var pokemontypen = [];
|
||||
var pokemoneffektlist = [];
|
||||
|
||||
return {
|
||||
// Select all data from sqlite
|
||||
all: function ()
|
||||
@ -89,31 +91,14 @@ appServices.factory('pokedexDB', function ($cordovaSQLite)
|
||||
pokemontypb : res.rows.item(i).POKEMONTYPB ,
|
||||
pokemontypaString : pokemontypen[res.rows.item(i).POKEMONTYPA] ,
|
||||
pokemontypbString : pokemontypen[res.rows.item(i).POKEMONTYPB] ,
|
||||
pokemonweaka : res.rows.item(i).POKEMONWEAKA ,
|
||||
pokemonweakb : res.rows.item(i).POKEMONWEAKB ,
|
||||
pokemonweakc : res.rows.item(i).POKEMONWEAKC ,
|
||||
pokemonweakd : res.rows.item(i).POKEMONWEAKD ,
|
||||
pokemonweake : res.rows.item(i).POKEMONWEAKE ,
|
||||
pokemonweakf : res.rows.item(i).POKEMONWEAKF ,
|
||||
pokemonweakg : res.rows.item(i).POKEMONWEAKG ,
|
||||
pokemonweakaString : pokemontypen[res.rows.item(i).POKEMONWEAKA] ,
|
||||
pokemonweakbString : pokemontypen[res.rows.item(i).POKEMONWEAKB] ,
|
||||
pokemonweakcString : pokemontypen[res.rows.item(i).POKEMONWEAKC] ,
|
||||
pokemonweakdString : pokemontypen[res.rows.item(i).POKEMONWEAKD] ,
|
||||
pokemonweakeString : pokemontypen[res.rows.item(i).POKEMONWEAKE] ,
|
||||
pokemonweakfString : pokemontypen[res.rows.item(i).POKEMONWEAKF] ,
|
||||
pokemonweakgString : pokemontypen[res.rows.item(i).POKEMONWEAKG] ,
|
||||
pokemonmaxa : res.rows.item(i).POKEMONMAXA ,
|
||||
pokemonmaxb : res.rows.item(i).POKEMONMAXB ,
|
||||
pokemonmaxc : res.rows.item(i).POKEMONMAXC ,
|
||||
pokemonmaxd : res.rows.item(i).POKEMONMAXD ,
|
||||
pokemonmaxe : res.rows.item(i).POKEMONMAXE ,
|
||||
pokemonmaxf : res.rows.item(i).POKEMONMAXF ,
|
||||
pokemonmaxg : res.rows.item(i).POKEMONMAXG ,
|
||||
pokemonfangchance : res.rows.item(i).POKEMONFANGCHANCE ,
|
||||
pokemonfluchtchance : res.rows.item(i).POKEMONFLUCHTCHANCE ,
|
||||
pokemoneidistanz : res.rows.item(i).POKEMONEIDISTANZ ,
|
||||
pokemonentwicklungtext : res.rows.item(i).POKEMONENTWICKLUNGTEXT ,
|
||||
pokemonentwicklung : res.rows.item(i).POKEMONENTWICKLUNG ,
|
||||
pokemonentwicklungkosten : res.rows.item(i).POKEMONENTWICKLUNGKOSTEN ,
|
||||
pokemontext : res.rows.item(i).POKEMONTEXT ,
|
||||
pokemonnote : res.rows.item(i).POKEMONNOTE ,
|
||||
pokemonentwa : res.rows.item(i).POKEMONENTWA ,
|
||||
pokemonentwb : res.rows.item(i).POKEMONENTWB ,
|
||||
pokemonimage : res.rows.item(i).POKEMONIMAGE
|
||||
};
|
||||
pokemonList.push(dataItem);
|
||||
@ -123,6 +108,106 @@ appServices.factory('pokedexDB', function ($cordovaSQLite)
|
||||
return pokemonList;
|
||||
},// End select all data.
|
||||
|
||||
getTypenEffekte: function (pokedexid)
|
||||
{
|
||||
|
||||
pokemoneffektlist = [];
|
||||
|
||||
var query = "SELECT * FROM tblPokemonTypenEffekt WHERE POKEDEXID= ?";
|
||||
// Execute query statement from query variable.
|
||||
$cordovaSQLite.execute(db, query,[pokedexid]).then(function (res)
|
||||
{
|
||||
if (res.rows.length > 0)
|
||||
{
|
||||
for (var i = 0; i < res.rows.length; i++)
|
||||
{
|
||||
var dataItem1 = {
|
||||
pokemontyp1 : res.rows.item(i).POKEMONTYP8 ,
|
||||
pokemontypid1 : 8,
|
||||
pokemontyptext1 : pokemontypen[8] ,
|
||||
pokemontyp2 : res.rows.item(i).POKEMONTYP15 ,
|
||||
pokemontypid2 : 15,
|
||||
pokemontyptext2 : pokemontypen[15] ,
|
||||
pokemontyp3 : res.rows.item(i).POKEMONTYP14 ,
|
||||
pokemontypid3 : 14,
|
||||
pokemontyptext3 : pokemontypen[14]
|
||||
};
|
||||
|
||||
var dataItem2 = {
|
||||
pokemontyp1 : res.rows.item(i).POKEMONTYP7 ,
|
||||
pokemontypid1 : 7,
|
||||
pokemontyptext1 : pokemontypen[7] ,
|
||||
pokemontyp2 : res.rows.item(i).POKEMONTYP9 ,
|
||||
pokemontypid2 : 9,
|
||||
pokemontyptext2 : pokemontypen[9] ,
|
||||
pokemontyp3 : res.rows.item(i).POKEMONTYP2 ,
|
||||
pokemontypid3 : 2,
|
||||
pokemontyptext3 : pokemontypen[2]
|
||||
};
|
||||
|
||||
var dataItem3 = {
|
||||
pokemontyp1 : res.rows.item(i).POKEMONTYP18 ,
|
||||
pokemontypid1 : 18,
|
||||
pokemontyptext1 : pokemontypen[18] ,
|
||||
pokemontyp2 : res.rows.item(i).POKEMONTYP13 ,
|
||||
pokemontypid2 : 13,
|
||||
pokemontyptext2 : pokemontypen[13] ,
|
||||
pokemontyp3 : res.rows.item(i).POKEMONTYP12 ,
|
||||
pokemontypid3 : 12,
|
||||
pokemontyptext3 : pokemontypen[12]
|
||||
};
|
||||
|
||||
var dataItem4 = {
|
||||
pokemontyp1 : res.rows.item(i).POKEMONTYP6 ,
|
||||
pokemontypid1 : 6,
|
||||
pokemontyptext1 : pokemontypen[6] ,
|
||||
pokemontyp2 : res.rows.item(i).POKEMONTYP10 ,
|
||||
pokemontypid2 : 10,
|
||||
pokemontyptext2 : pokemontypen[10] ,
|
||||
pokemontyp3 : res.rows.item(i).POKEMONTYP4 ,
|
||||
pokemontypid3 : 4,
|
||||
pokemontyptext3 : pokemontypen[4]
|
||||
};
|
||||
|
||||
|
||||
var dataItem5 = {
|
||||
pokemontyp1 : res.rows.item(i).POKEMONTYP5 ,
|
||||
pokemontypid1 : 5,
|
||||
pokemontyptext1 : pokemontypen[5] ,
|
||||
pokemontyp2 : res.rows.item(i).POKEMONTYP1 ,
|
||||
pokemontypid2 : 1,
|
||||
pokemontyptext2 : pokemontypen[1] ,
|
||||
pokemontyp3 : res.rows.item(i).POKEMONTYP11 ,
|
||||
pokemontypid3 : 11,
|
||||
pokemontyptext3 : pokemontypen[11]
|
||||
};
|
||||
|
||||
|
||||
var dataItem6 = {
|
||||
pokemontyp1 : res.rows.item(i).POKEMONTYP17 ,
|
||||
pokemontypid1 : 17,
|
||||
pokemontyptext1 : pokemontypen[17] ,
|
||||
pokemontyp2 : res.rows.item(i).POKEMONTYP16 ,
|
||||
pokemontypid2 : 16,
|
||||
pokemontyptext2 : pokemontypen[16] ,
|
||||
pokemontyp3 : res.rows.item(i).POKEMONTYP3 ,
|
||||
pokemontypid3 : 3,
|
||||
pokemontyptext3 : pokemontypen[3]
|
||||
};
|
||||
|
||||
console.debug(dataItem1);
|
||||
pokemoneffektlist.push(dataItem1);
|
||||
pokemoneffektlist.push(dataItem2);
|
||||
pokemoneffektlist.push(dataItem3);
|
||||
pokemoneffektlist.push(dataItem4);
|
||||
pokemoneffektlist.push(dataItem5);
|
||||
pokemoneffektlist.push(dataItem6);
|
||||
}
|
||||
}
|
||||
});
|
||||
return pokemoneffektlist;
|
||||
},
|
||||
|
||||
// To add data to sqlite.
|
||||
// It will receive newContract from controller then insert it into sqlite.
|
||||
add: function (newContract)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user