var app = angular.module('myApp', []);
app.controller('formHide', function($scope){
	$scope.buy = true;
	var storedData = myApp.formGetData('buyform');
	if (storedData){
	$scope.metreName = storedData.metreName;
	$scope.metre = storedData.metre;}
	$scope.switcher = true;
	$scope.regswitcher = true;
	$scope.changebtn = function(){
		if (($$("#select-metre").val() !== "") &&($$("#amt").val() !== "")){
		$scope.switcher = false;
		}
		else {
		$scope.switcher = true;
		}
	}
	
	$scope.regchangebtn = function(){
		if (($$("#metre").val() !== "") && ($$("#metreName").val() !== "")){
		$scope.regswitcher = false;
		}
		else {
		$scope.regswitcher = true;
		}
	}
	
	$scope.cancelbtn = function(){
		$$("#metre").val(parseInt('')).trigger('change');
		$$("#metreName").val('').trigger('change');
		$scope.reg = false;
		$scope.buy = true;
		loadOptions();
		$$('#regFab').html('&nbsp New<i class="icon icon-plus"></i>');
	}
	
	$scope.savebtn = function(){
		metreNumber = $$("#metre").val();
		metreName = $$("#metreName").val();
		db.transaction(function(tx) {tx.executeSql('INSERT INTO metreNumbers values(' + metreNumber +',"'+ metreName + '")');}, function(err) {alert ('failed'+err.code+ 'because'+ err.message);}, function(){});
		$scope.reg = false;
		$scope.buy = true;
		myApp.formDeleteData('buyform');
		loadOptions();
		$scope.metreName = '';
		$scope.metre = '';
		$$('#regFab').html('&nbsp New<i class="icon icon-plus"></i>');
	}
	
	$scope.openForm = function(){
		if ($scope.buy == true){
		$$('#regFab').html('buy');
		$scope.buy = false;
		$scope.reg = true;
		$$(".reg").removeClass("regdisappear");
		$scope.regchangebtn();
		loadSavedTables();
		}
		else{
		$$('#regFab').html('&nbsp New<i class="icon icon-plus"></i>');
		$$("#amt").val(parseInt('')).trigger('change');
		$scope.reg = false;
		$scope.buy = true;
		loadOptions();
		}
	}
	
		$scope.editbtn = function(){
		metreNumber = $$("#metre").val();
		metreName = $$("#metreName").val();
		db.transaction(function(tx) {tx.executeSql('UPDATE metreNumbers SET metreNumber =' + metreNumber +', metreName = "'+ metreName + '" where metreNumber ='+id);}, function(err) {alert ('failed'+err.code+ 'because'+ err.message);}, function(){});
		myApp.formDeleteData('buyform');
		$$("#metre").val('').trigger('change');
		$$("#metreName").val('').trigger('change');
		loadSavedTables();
		$$('#editbutton').hide();
		$$('#savebutton').show();
		
		
	}
	$scope.buyZESA = function(){
		amt = $$("#amt").val();
		metreNumber = $$("#select-metre").val();
                 switch (currentCarrier){
			case '04':
				 ussdnum = "*151*2*6*1*1*"+amt+"*"+metreNumber+"#";
				$scope.dialNum(ussdnum);
				break;
			case '03':
		 	        myApp.modal({title: 'enter telecash pin',
				              text: '<input type="password" class="modal-text-input" id="mypass">',
					     afterText: '<div class="floating-label">PIN</div>',
					     	
				              buttons: [{text: 'ok',
				                       onClick: function(value){
				                              mypass = $$('#mypass').val();
				                              if (mypass.replace(/^\s+|\s+$/g, "").length != 0){
				                              ussdnum = "*888*1*2*"+metreNumber+"*"+amt+"*"+mypass+"#";
				                              $scope.dialNum(ussdnum);
						}
					}
					},
				{text: 'cancel',
					}
					]
			
		});
				break;
			case '01':
				alert('onemoney');
				break;
			default :
				alert('Current carrier is' + currentCarrier);
				      }
	}
	
	$scope.dialNum = function(ussdnum){
	window.plugins.CallNumber.callNumber(onSuccess, onError, ussdnum, false);
function onSuccess(result){
  $$("#amt").val('').trigger('change');
}

function onError(result) {
  $$("#amt").val('').trigger('change');
  console.log("Error:"+result);
  alert ('sorry failed to purchase token this is because '+result);
}
	}
});
$$('.totop').on('click', function(){
	$$(".page-content").scrollTop(0);
});

@@ -2756,16 +2756,139 @@
 text: '%3C
+div class=%22item-content%22%3E%3Cdiv class=%22item-inner%22%3E%3Cdiv class=%22item-title floating-label%22%3EPIN%3C/div%3E%3Cdiv class =%22item-input%22%3E%3C
 input ty
@@ -2942,64 +2942,20 @@
 ss%22%3E
-',%0A%09%09%09%09%09     afterText: '%3Cdiv class=%22floating-label%22%3EPIN
+%3C/div%3E%3C/div%3E
 %3C/di

Update myapp.js