Datenbank erweitert by Akki, Detail-Seite by Kalle

This commit is contained in:
Carsten Hilmer 2016-09-02 00:02:44 +02:00
parent 6a0a74191e
commit 607ffbd0f6
5 changed files with 169 additions and 47 deletions

View File

@ -355,8 +355,7 @@ angular.module('starter', ['ionic','ngIOS9UIWebViewPatch','starter.controllers',
.state('app.pokemondetail', {
url: "/pokemondetail",
params: {
contractdetail: null,
actionDelete: false
pokemondetail: null
},
views: {
'menuContent': {

Binary file not shown.

View File

@ -13,49 +13,147 @@
</a>
</ion-nav-buttons> <!--end left button on navigation bar-->
<!--contract detail section-->
<form name="contractForm">
<ion-content id="contract-details-content">
<!--contract detail input section-->
<md-input-container md-no-float>
<i class="ion-android-person"></i>
<input ng-model="contract.firstName" name="firstName" required placeholder="* First Name (required)">
</md-input-container>
<md-input-container md-no-float>
<i class="ion-android-people"></i>
<input ng-model="contract.lastName" name="lastName" required placeholder="* Last Name (required)">
</md-input-container>
<md-input-container md-no-float>
<i class="ion-android-phone-portrait"></i>
<input ng-model="contract.telephone" name="telephone" required placeholder="* Telephone (required)"
type="tel">
</md-input-container>
<md-input-container md-no-float>
<i class="ion-android-mail"></i>
<input ng-model="contract.email" name="email" placeholder="Email">
</md-input-container>
<md-input-container md-no-float>
<i class="ion-android-calendar"></i>
<input ng-model="contract.createDate" disabled name="dateTime" placeholder="Date Time">
</md-input-container>
<md-input-container md-no-float>
<i class="ion-android-favorite"></i>
<input ng-model="contract.age" numbers-only name="age" placeholder="Age" type="tel">
</md-input-container><!--end contract detail input section-->
<ion-content>
<!--Pokemon detail section-->
<div class="list card">
<!--contract switch section-->
<md-switch ng-model="contract.isEnable" ng-disabled="actionDelete">
{{(contract.isEnable == true ? 'Enable' : 'Disabled' ) }} Contract
</md-switch><!--end contract switch section-->
<div class="item item-avatar">
<img src="{{pokemon.pokemonimage}}">
<h2>{{pokemon.pokemonname}}</h2>
<p>Pokedex-Id: {{ pokemon.pokedexidString }}</p>
</div>
</ion-content>
<div class="item item-body">
<img class="full-image" src="{{pokemon.pokemonimage}}">
<p>
Richtig geiles Pokemon.
</p>
</div>
</div>
<div class="card">
<div class="item item-divider">
Beschreibung
</div>
<div class="item item-text-wrap">
This is a basic Card with some text.
</div>
</div>
<div class="card">
<div class="item item-divider">
Typ
</div>
<div class="item item-text-wrap">
<div class="row">
<div class="col-50">
<div ng-if="pokemon.pokemontypa > 0" class="pokemontyp{{ pokemon.pokemontypa }}">
<img src="img/typbilder/{{ pokemon.pokemontypa }}.png" alt="PokemonTyp" width="32" height="32">
{{ pokemon.pokemontypaString }}
</div>
</div>
<div class="col-50">
<div ng-if="pokemon.pokemontypb > 0" class="pokemontyp{{ pokemon.pokemontypb }}">
<img src="img/typbilder/{{ pokemon.pokemontypb }}.png" alt="PokemonTyp" width="32" height="32">
{{ pokemon.pokemontypbString }}
</div>
</div>
</div>
</div>
</div>
<div class="card">
<div class="item item-divider">
Schwächen
</div>
<div class="item item-text-wrap">
<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 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 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 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>
<div class="card">
<div class="item item-divider">
Basiswerte
</div>
<div class="item item-text-wrap">
This is a basic Card with some text.
</div>
</div>
<div class="card">
<div class="item item-divider">
Evolution
</div>
<div class="item item-text-wrap">
{{ pokemon.pokemonentwa }}
</div>
</div>
</ion-content>
<div class="footer-fab-bar">
<a class="md-button md-accent md-fab fab-footer" ng-click="showListBottomSheet($event,contractForm)"
aria-label="Contract Form Actions">
<i class="ion-android-star"></i>
</a>
</div>
</form><!--end contract detail section-->
<!--end Pokemon detail section-->
<!--angular template section-->
<script type="text/ng-template" id="contract-actions-template">
@ -68,7 +166,7 @@
ng-class="{ 'disabled-link': disableSaveBtn}"
ng-click="saveContract(contract,$event)">
<i class="ion-android-list"></i>
<span>Save Contract</span>
<span>Als Favorit speichern</span>
</a>
</md-list-item>
@ -76,7 +174,7 @@
<a class="md-default-theme md-bottom-sheet-list-item"
ng-click="deleteContract(contract,$event)">
<i class="ion-android-delete"></i>
<span>Remove Contract</span>
<span>Als Lesezeichen speichern</span>
</a>
</md-list-item>
<!--end md bottom sheet list item-->

View File

@ -84,8 +84,7 @@ appControllers.controller('pokemonListCtrl', function ($scope, $stateParams,$fil
$scope.navigateTo = function (targetPage, objectData) {
$timeout(function(){
$state.go(targetPage, {
pokemondetail: objectData,
actionDelete: (objectData == null ? false : true)
pokemondetail: objectData
});
},400);
};// End navigateTo.
@ -103,7 +102,7 @@ appControllers.controller('pokemonListCtrl', function ($scope, $stateParams,$fil
});// End of Pokemon List Page Controller.
// Controller of pokemon Detail Page.
appControllers.controller('pokemonDetailCtrl', function ($mdBottomSheet, $mdToast, $scope, $stateParams, $filter, $mdDialog, $ionicHistory, pokedexDB, $ionicHistory) {
appControllers.controller('pokemonDetailCtrl', function ($mdBottomSheet, $mdToast, $scope, $stateParams, $filter, $mdDialog, $ionicHistory, pokedexDB) {
// initialForm is the first activity in the controller.
// It will initial all variable data and let the function works when page load.
@ -116,7 +115,7 @@ appControllers.controller('pokemonDetailCtrl', function ($mdBottomSheet, $mdToas
// 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.actionDelete, $stateParams.pokemondetail);
$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.
@ -124,7 +123,7 @@ appControllers.controller('pokemonDetailCtrl', function ($mdBottomSheet, $mdToas
}; //End initialForm.
// getPokemonData is for get pokemon detail data.
$scope.getPokemonData = function (actionDelete, pokemonDetail) {
$scope.getPokemonData = function (pokemonDetail) {
// tempPokemon is temporary pokemon data detail.
var tempPokemon = {
id: null,
@ -137,10 +136,11 @@ appControllers.controller('pokemonDetailCtrl', function ($mdBottomSheet, $mdToas
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 (actionDelete ? angular.copy(pokemonDetail) : tempPokemon);
return (pokemonDetail);
};//End get pokemon detail data.
// savePokemon is for save pokemon.

View File

@ -88,7 +88,32 @@ appServices.factory('pokedexDB', function ($cordovaSQLite)
pokemontypa : res.rows.item(i).POKEMONTYPA ,
pokemontypb : res.rows.item(i).POKEMONTYPB ,
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 ,
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 ,
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);