Datenbank erweitert, typenen und attacken
This commit is contained in:
parent
607ffbd0f6
commit
25a5793f2f
@ -48,9 +48,6 @@
|
|||||||
],
|
],
|
||||||
"cordovaPlatforms": [
|
"cordovaPlatforms": [
|
||||||
"ios",
|
"ios",
|
||||||
{
|
"android"
|
||||||
"platform": "android",
|
|
||||||
"locator": "./engine/cordova-android-c0.6.1/"
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -349,3 +349,346 @@ md-input-container {
|
|||||||
width: 32px;
|
width: 32px;
|
||||||
border-radius: 50%;
|
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">
|
<div class="item item-body">
|
||||||
<img class="full-image" src="{{pokemon.pokemonimage}}">
|
<img class="full-image" src="{{pokemon.pokemonimage}}">
|
||||||
<p>
|
<p>
|
||||||
Richtig geiles Pokemon.
|
{{pokemon.pokemontext}}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -69,63 +69,36 @@
|
|||||||
<div class="item item-divider">
|
<div class="item item-divider">
|
||||||
Schwächen
|
Schwächen
|
||||||
</div>
|
</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 class="col">
|
||||||
<div ng-if="pokemon.pokemonweaka > 0" class="col-50">
|
<div class="pokemontyp{{ pokemonschwaeche.pokemontypid1}}sm">
|
||||||
<div ng-if="pokemon.pokemonweaka > 0" class="pokemontyp{{ pokemon.pokemonweaka }}">
|
<img src="img/typbilder/{{ pokemonschwaeche.pokemontypid1}}.png" alt="PokemonTyp" width="32" height="32">
|
||||||
<img src="img/typbilder/{{ pokemon.pokemonweaka }}.png" alt="PokemonTyp" width="32" height="32">
|
{{ pokemonschwaeche.pokemontyptext1 }}
|
||||||
{{ 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>
|
||||||
|
{{ pokemonschwaeche.pokemontyp1 }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-if="pokemon.pokemonweakc > 0" class="row">
|
<div class="col">
|
||||||
<div ng-if="pokemon.pokemonweakc > 0" class="col-50">
|
<div class="pokemontyp{{ pokemonschwaeche.pokemontypid2}}sm">
|
||||||
<div ng-if="pokemon.pokemonweakc > 0" class="pokemontyp{{ pokemon.pokemonweakc }}">
|
<img src="img/typbilder/{{ pokemonschwaeche.pokemontypid2}}.png" alt="PokemonTyp" width="32" height="32">
|
||||||
<img src="img/typbilder/{{ pokemon.pokemonweakc }}.png" alt="PokemonTyp" width="32" height="32">
|
{{ pokemonschwaeche.pokemontyptext2 }}
|
||||||
{{ 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>
|
||||||
|
{{ pokemonschwaeche.pokemontyp2 }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-if="pokemon.pokemonweake > 0" class="row">
|
<div class="col">
|
||||||
<div ng-if="pokemon.pokemonweake > 0" class="col-50">
|
<div class="pokemontyp{{ pokemonschwaeche.pokemontypid3}}sm">
|
||||||
<div ng-if="pokemon.pokemonweake > 0" class="pokemontyp{{ pokemon.pokemonweake }}">
|
<img src="img/typbilder/{{ pokemonschwaeche.pokemontypid3}}.png" alt="PokemonTyp" width="32" height="32">
|
||||||
<img src="img/typbilder/{{ pokemon.pokemonweake }}.png" alt="PokemonTyp" width="32" height="32">
|
{{ pokemonschwaeche.pokemontyptext3 }}
|
||||||
{{ 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 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>
|
||||||
|
{{ pokemonschwaeche.pokemontyp3 }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</md-list>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
|||||||
@ -67,14 +67,6 @@ appControllers.controller('pokemonListCtrl', function ($scope, $stateParams,$fil
|
|||||||
$scope.pokemons = pokedexDB.all();
|
$scope.pokemons = pokedexDB.all();
|
||||||
};//End getPokemonList.
|
};//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
|
// navigateTo is for navigate to other page
|
||||||
// by using targetPage to be the destination page
|
// by using targetPage to be the destination page
|
||||||
// and sending objectData to the destination page.
|
// and sending objectData to the destination page.
|
||||||
@ -89,195 +81,48 @@ appControllers.controller('pokemonListCtrl', function ($scope, $stateParams,$fil
|
|||||||
},400);
|
},400);
|
||||||
};// End navigateTo.
|
};// 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();
|
$scope.initialForm();
|
||||||
|
|
||||||
});// End of Pokemon List Page Controller.
|
});// End of Pokemon List Page Controller.
|
||||||
|
|
||||||
// Controller of pokemon Detail Page.
|
// 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.
|
// initialForm is the first activity in the controller.
|
||||||
// It will initial all variable data and let the function works when page load.
|
// It will initial all variable data and let the function works when page load.
|
||||||
$scope.initialForm = function () {
|
$scope.initialForm = function () {
|
||||||
|
|
||||||
// $scope.disableSaveBtn is the variable for setting disable or enable the save button.
|
$scope.pokemonschwaechenliste = [];
|
||||||
$scope.disableSaveBtn = false;
|
|
||||||
|
|
||||||
// $scope.pokemon is the variable that store pokemon detail data that receive form pokemon list page.
|
// $scope.pokemon is the variable that store pokemon detail data that receive form pokemon list page.
|
||||||
// Parameter :
|
// Parameter :
|
||||||
// $stateParams.actionDelete(bool) = status that pass from pokemon list page.
|
|
||||||
// $stateParams.pokemondetail(object) = pokemon that user select from pokemon list page.
|
// $stateParams.pokemondetail(object) = pokemon that user select from pokemon list page.
|
||||||
$scope.pokemon = $scope.getPokemonData($stateParams.pokemondetail);
|
$scope.pokemon = $scope.getPokemonData($stateParams.pokemondetail);
|
||||||
|
|
||||||
//$scope.actionDelete is the variable for allow or not allow to delete data.
|
//$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.
|
// 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.
|
}; //End initialForm.
|
||||||
|
|
||||||
// getPokemonData is for get pokemon detail data.
|
// getPokemonData is for get pokemon detail data.
|
||||||
$scope.getPokemonData = function (pokemonDetail) {
|
$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);
|
return (pokemonDetail);
|
||||||
|
|
||||||
};//End get pokemon detail data.
|
};//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.
|
// getPokemonList is for get all pokemons.
|
||||||
try {
|
// By calling pokedexDB.all() service.
|
||||||
// To update data by calling pokedexDB.update(pokemon) service.
|
$scope.getTypenEffekt = function (pokedexid) {
|
||||||
if ($scope.actionDelete) {
|
$scope.pokemonschwaechenliste = pokedexDB.getTypenEffekte(pokedexid);
|
||||||
if ($scope.pokemon.id == null) {
|
};//End getPokemonList.
|
||||||
$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.
|
|
||||||
|
|
||||||
// showListBottomSheet is for showing the bottom sheet.
|
// showListBottomSheet is for showing the bottom sheet.
|
||||||
// Parameter :
|
// Parameter :
|
||||||
// $event(object) = position of control that user tap.
|
// $event(object) = position of control that user tap.
|
||||||
// contractForm(object) = contract object that presenting on the view.
|
// contractForm(object) = contract object that presenting on the view.
|
||||||
$scope.showListBottomSheet = function ($event, contractForm) {
|
$scope.showListBottomSheet = function ($event, contractForm) {
|
||||||
$scope.disableSaveBtn = $scope.validateRequiredField(contractForm);
|
|
||||||
$mdBottomSheet.show({
|
$mdBottomSheet.show({
|
||||||
templateUrl: 'contract-actions-template',
|
templateUrl: 'contract-actions-template',
|
||||||
targetEvent: $event,
|
targetEvent: $event,
|
||||||
|
|||||||
@ -38,6 +38,8 @@ appServices.factory('pokedexDB', function ($cordovaSQLite)
|
|||||||
// pokemonList variable use to store data from sqlite query
|
// pokemonList variable use to store data from sqlite query
|
||||||
var pokemonList = [];
|
var pokemonList = [];
|
||||||
var pokemontypen = [];
|
var pokemontypen = [];
|
||||||
|
var pokemoneffektlist = [];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// Select all data from sqlite
|
// Select all data from sqlite
|
||||||
all: function ()
|
all: function ()
|
||||||
@ -89,31 +91,14 @@ appServices.factory('pokedexDB', function ($cordovaSQLite)
|
|||||||
pokemontypb : res.rows.item(i).POKEMONTYPB ,
|
pokemontypb : res.rows.item(i).POKEMONTYPB ,
|
||||||
pokemontypaString : pokemontypen[res.rows.item(i).POKEMONTYPA] ,
|
pokemontypaString : pokemontypen[res.rows.item(i).POKEMONTYPA] ,
|
||||||
pokemontypbString : pokemontypen[res.rows.item(i).POKEMONTYPB] ,
|
pokemontypbString : pokemontypen[res.rows.item(i).POKEMONTYPB] ,
|
||||||
pokemonweaka : res.rows.item(i).POKEMONWEAKA ,
|
pokemonfangchance : res.rows.item(i).POKEMONFANGCHANCE ,
|
||||||
pokemonweakb : res.rows.item(i).POKEMONWEAKB ,
|
pokemonfluchtchance : res.rows.item(i).POKEMONFLUCHTCHANCE ,
|
||||||
pokemonweakc : res.rows.item(i).POKEMONWEAKC ,
|
pokemoneidistanz : res.rows.item(i).POKEMONEIDISTANZ ,
|
||||||
pokemonweakd : res.rows.item(i).POKEMONWEAKD ,
|
pokemonentwicklungtext : res.rows.item(i).POKEMONENTWICKLUNGTEXT ,
|
||||||
pokemonweake : res.rows.item(i).POKEMONWEAKE ,
|
pokemonentwicklung : res.rows.item(i).POKEMONENTWICKLUNG ,
|
||||||
pokemonweakf : res.rows.item(i).POKEMONWEAKF ,
|
pokemonentwicklungkosten : res.rows.item(i).POKEMONENTWICKLUNGKOSTEN ,
|
||||||
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 ,
|
|
||||||
pokemontext : res.rows.item(i).POKEMONTEXT ,
|
pokemontext : res.rows.item(i).POKEMONTEXT ,
|
||||||
pokemonnote : res.rows.item(i).POKEMONNOTE ,
|
pokemonnote : res.rows.item(i).POKEMONNOTE ,
|
||||||
pokemonentwa : res.rows.item(i).POKEMONENTWA ,
|
|
||||||
pokemonentwb : res.rows.item(i).POKEMONENTWB ,
|
|
||||||
pokemonimage : res.rows.item(i).POKEMONIMAGE
|
pokemonimage : res.rows.item(i).POKEMONIMAGE
|
||||||
};
|
};
|
||||||
pokemonList.push(dataItem);
|
pokemonList.push(dataItem);
|
||||||
@ -123,6 +108,106 @@ appServices.factory('pokedexDB', function ($cordovaSQLite)
|
|||||||
return pokemonList;
|
return pokemonList;
|
||||||
},// End select all data.
|
},// 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.
|
// To add data to sqlite.
|
||||||
// It will receive newContract from controller then insert it into sqlite.
|
// It will receive newContract from controller then insert it into sqlite.
|
||||||
add: function (newContract)
|
add: function (newContract)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user