Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- angular.module('app.controllers', [])
- .controller('pageCtrl', ['$scope', '$stateParams', // The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller
- // You can include any angular dependencies as parameters for this function
- // TIP: Access Route Parameters for your page via $stateParams.parameterName
- function ($scope, $stateParams) {
- }])
- .controller('welcomescreenCtrl', ['$scope', '$stateParams', // The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller
- // You can include any angular dependencies as parameters for this function
- // TIP: Access Route Parameters for your page via $stateParams.parameterName
- function ($scope, $stateParams) {
- }])
- .controller('mainCtrl', ['$scope', '$stateParams',function ($scope, $stateParams) {
- }])
- .controller('updatepassCtrl',function ($scope,$http,$ionicPopup,$state,$ionicHistory,$stateParams,$ionicLoading) {
- $scope.reset= function(data){
- $ionicLoading.show({
- template: '<p>Please Wait ...</p><ion-spinner></ion-spinner>'
- });
- var link ='http://dewanstudio.biz/SIT//cms_begawan/api/updatepass/' ;
- $http.post(link, {d : localStorage.getItem('id_reset'), s : data.password})
- .then(function (res){
- $ionicLoading.hide();
- var alertPopup = $ionicPopup.alert({
- template: 'Password Berhasil di Update'
- });
- $state.go('login', {}, {location: "replace", reload: true});
- });
- };
- })
- .controller('forgetpassCtrl',function ($scope, $stateParams, $http, $state, $ionicPopup,$ionicHistory) {
- $scope.user = {};
- $scope.resetpass=function(){
- str="http://dewanstudio.biz/SIT/cms_begawan/api/resetpass/index.php?em="+$scope.user.email;
- $http.get(str)
- .success(function (response){
- $scope.user_details = response.records;
- localStorage.setItem('id_reset', $scope.user_details.id);
- var idres = $scope.user_details.id;
- $state.go('updatepass', {}, {id_reset : $scope.user_details.id});
- }).error(function() {
- var alertPopup = $ionicPopup.alert({
- title: '',
- template: 'Email Tidak Terdaftar'
- });
- });
- }
- })
- .controller('signupCtrl',function ($scope, $stateParams,$http,$ionicPopup,$state,$ionicHistory,$ionicPlatform ) {
- $scope.daftar=function(data){
- var link = 'http://dewanstudio.biz/SIT/cms_begawan/api/register/';
- //using http post as we are passing password.
- $http.post(link, {f : data.fullname, e : data.email,u : data.username, ps : data.password })
- .then(function (res){ //if a response is recieved from the server.
- $scope.response = res.data.result; //contains Register Result
- //Shows the respective popup and removes back link
- if($scope.response.created=="1"){
- $scope.title="Account Created!";
- $scope.template="Your account has been successfully created!";
- //no back option
- $ionicHistory.nextViewOptions({
- disableAnimate: true,
- disableBack: true
- });
- // the user is redirected to login page after sign up
- $state.go('login', {}, {location: "replace", reload: true});
- }else if($scope.response.exists=="1"){
- $scope.title="Email Already exists";
- $scope.template="Please click forgot password if necessary";
- }else{
- $scope.title="Failed";
- $scope.template="Contact Our Technical Team";
- }
- var alertPopup = $ionicPopup.alert({
- title: $scope.title,
- template: $scope.template
- });
- });
- }
- })
- .controller('loginCtrl', function ($scope, $stateParams, $http, $state, $ionicHistory, $ionicLoading, $ionicPlatform, $ionicPopup, $timeout,$rootScope) {
- $scope.show = function() {
- $ionicLoading.show({
- template: '<p>Please Wait ...</p><ion-spinner></ion-spinner>'
- });
- };
- $scope.hide = function(){
- $ionicLoading.hide();
- };
- $scope.user = {};
- $ionicPlatform.ready(function () {
- if(localStorage.loggedin_id){
- $scope.show($ionicLoading);
- $timeout(function() {
- $scope.hide($ionicLoading);
- }, 2000);
- $state.go('menu', {}, {location: "replace", reload: true});
- }
- $scope.login = function() {
- $scope.show($ionicLoading);
- str="http://dewanstudio.biz/SIT/cms_begawan/api/user_detil/index.php?e="+$scope.user.email+"&p="+$scope.user.password;
- $http.get(str)
- .success(function (response){
- $scope.user_details = response.records;
- console.log(response.records);
- sessionStorage.setItem('loggedin_id', $scope.user_details.id);
- sessionStorage.setItem('loggedin_fullname', $scope.user_details.fullname);
- sessionStorage.setItem('loggedin_email', $scope.user_details.email);
- sessionStorage.setItem('loggedin_username', $scope.user_details.username);
- $rootScope.loggedin_id = $scope.user_details.id;
- $ionicHistory.nextViewOptions({
- disableAnimate: true,
- disableBack: true
- });
- lastView = $ionicHistory.backView();
- console.log('Last View',lastView);
- $state.go('menu', {}, {location: "replace", reload: true});
- $timeout(function() {
- $scope.hide($ionicLoading);
- }, 2000);
- }).error(function() {
- var alertPopup = $ionicPopup.alert({
- title: 'Login failed!',
- template: 'Please check your Email & Password !'
- });
- $timeout(function() {
- $scope.hide($ionicLoading);
- }, 2000);
- });
- };
- });
- })
- .controller('menuCtrl', ['$scope', '$stateParams',function ($scope, $stateParams) {
- }])
- .controller('katasambutanCtrl', ['$scope', '$stateParams',function ($scope, $stateParams) {
- }])
- .controller('kawasanCtrl', ['$scope', '$stateParams',function ($scope, $stateParams) {
- }])
- .controller('minatbeliCtrl', ['$scope', '$stateParams',function ($scope, $stateParams) {
- }])
- .controller('detilminatbeliCtrl', ['$scope', '$stateParams',function ($scope, $stateParams) {
- }])
- .controller('detilminatbeli2Ctrl', ['$scope', '$stateParams',function ($scope, $stateParams) {
- }])
- .controller('paymentmbCtrl', ['$scope', '$stateParams',function ($scope, $stateParams) {
- }])
- .controller('kontakCtrl',function ($scope, $stateParams,$http,$ionicPopup,$ionicHistory,$state) {
- $scope.addpesan = function(data) {
- $http.post('http://dewanstudio.biz/SIT/cms_begawan/api/informasi_pemasaran/', {
- dnama: data.nama,
- demail: data.email,
- dtelp: data.notlp,
- dmessage: data.pesan,
- })
- .success(function(data, status, headers, config) {
- var alertPopup = $ionicPopup.alert({
- title: 'Thank You!',
- template: 'Laporan Anda Terkirim'
- });
- $ionicHistory.clearCache();
- $ionicHistory.clearHistory();
- $state.go('kontak', {}, { location: "replace", reload: true });
- });
- console.log(data);
- }
- })
- .controller('fasilitasCtrl',function ($scope, $stateParams,$ionicModal) {
- $scope.modalData = {};
- $scope.showAlert = function(konsep) {
- if(konsep == 1){
- $scope.modalData.textColor = '#acce22';
- $scope.modalData.Title = '';
- $scope.modalData.Desc = "";
- $scope.modalData.Image = './img/fasilitaspopup.png';
- }
- $scope.modalData.From = 'konsep';
- $scope.modalData.No = konsep;
- $ionicModal.fromTemplateUrl('templates/alert_modal.html', {
- scope: $scope,
- animation: 'none'
- }).then(function(modal) {
- $scope.modal = modal;
- $scope.modal.show();
- // window.plugins.nativepagetransitions.slide();
- });
- };
- // Close the modal
- $scope.closeModal = function() {
- $scope.modal.hide();
- $scope.modal.remove();
- };
- })
- .controller('promosiCtrl', function ($scope, $stateParams, $http,$filter,$ionicModal,$ionicLoading) {
- $ionicLoading.show({
- template: 'Mengambil Data Dari Server <br><br> <ion-spinner icon="android"></ion-spinner>'
- });
- $http.get("http://dewanstudio.biz/SIT/cms_begawan/api/promosi/")
- .success(function (data) {
- $scope.getpromosi = data.item;
- $ionicLoading.hide();
- });
- $scope.modalData = {};
- $scope.showAlert = function(konsep,id,file_name) {
- localStorage.setItem('promosi_id', id);
- localStorage.setItem('promosi_file_name', file_name);
- $scope.id = localStorage.getItem('promosi_id');
- console.log($scope.id);
- if(konsep == localStorage.getItem('promosi_id') ){
- $scope.modalData.textColor = '#acce22';
- $scope.modalData.Title = '';
- $scope.modalData.Desc = "";
- $scope.modalData.Image = 'http://dewanstudio.biz/SIT/cms_begawan/clients/promosi/'+localStorage.getItem('promosi_file_name');
- }
- $scope.modalData.From = 'konsep';
- $scope.modalData.No = konsep;
- $ionicModal.fromTemplateUrl('templates/alert_modal.html', {
- scope: $scope,
- animation: 'none'
- }).then(function(modal) {
- $scope.modal = modal;
- $scope.modal.show();
- // window.plugins.nativepagetransitions.slide();
- });
- };
- // Close the modal
- $scope.closeModal = function() {
- $scope.modal.hide();
- $scope.modal.remove();
- };
- })
- .controller('menupopupCtrl',function ($scope, $stateParams, $ionicModal) {
- $scope.modalData = {};
- $scope.showAlert = function(konsep) {
- if(konsep == 1){
- $scope.modalData.textColor = '#acce22';
- $scope.modalData.Title = '';
- $scope.modalData.Desc = "";
- $scope.modalData.Image = './img/menu_popup/lokasi.png';
- }else if(konsep == 2){
- $scope.modalData.textColor = '#fabf01';
- $scope.modalData.Title = '';
- $scope.modalData.Desc = "";
- $scope.modalData.Image = './img/menu_popup/akses_strategis.png';
- }else if(konsep == 3){
- $scope.modalData.textColor = '#1962ae';
- $scope.modalData.Title = '';
- $scope.modalData.Desc = "";
- $scope.modalData.Image = './img/menu_popup/peluangbisnis.png';
- }else if(konsep == 4){
- $scope.modalData.textColor = '#01aebc';
- $scope.modalData.Title = '';
- $scope.modalData.Desc = "";
- $scope.modalData.Image = './img/menu_popup/premium_student.png';
- }else if(konsep == 5){
- $scope.modalData.textColor = '#01aebc';
- $scope.modalData.Title = '';
- $scope.modalData.Desc = "";
- $scope.modalData.Image = './img/menu_popup/unit.png';
- }else if(konsep == 6){
- $scope.modalData.textColor = '#1962ae';
- $scope.modalData.Title = '';
- $scope.modalData.Desc = "";
- $scope.modalData.Image = './img/fasilitaspopup.png';
- }else if(konsep == 7){
- $scope.modalData.textColor = '#acce22';
- $scope.modalData.Title = '';
- $scope.modalData.Desc = "";
- $scope.modalData.Image = './img/menu_popup/harga_menarik.png';
- }else if(konsep == 8){
- $scope.modalData.textColor = '#fabf01';
- $scope.modalData.Title = '';
- $scope.modalData.Desc = "";
- $scope.modalData.Image = './img/menu_popup/developer.png';
- }
- $scope.modalData.From = 'konsep';
- $scope.modalData.No = konsep;
- $ionicModal.fromTemplateUrl('templates/alert_modal.html', {
- scope: $scope,
- animation: 'none'
- }).then(function(modal) {
- $scope.modal = modal;
- $scope.modal.show();
- // window.plugins.nativepagetransitions.slide();
- });
- };
- // Close the modal
- $scope.closeModal = function() {
- $scope.modal.hide();
- $scope.modal.remove();
- };
- })
- .controller('unitplanCtrl', ['$scope', '$stateParams',function ($scope, $stateParams) {
- }])
- .controller('unitplan2Ctrl', ['$scope', '$stateParams',function ($scope, $stateParams) {
- }])
- .controller('unitplan3Ctrl',function ($scope, $stateParams, $ionicModal) {
- $scope.modalData = {};
- $scope.showAlert = function(konsep) {
- if(konsep == 1){
- $scope.modalData.textColor = '#acce22';
- $scope.modalData.Title = '';
- $scope.modalData.Desc = "";
- $scope.modalData.Image = './img/flor_map.png';
- }
- $scope.modalData.From = 'konsep';
- $scope.modalData.No = konsep;
- $ionicModal.fromTemplateUrl('templates/alert_modal.html', {
- scope: $scope,
- animation: 'none'
- }).then(function(modal) {
- $scope.modal = modal;
- $scope.modal.show();
- // window.plugins.nativepagetransitions.slide();
- });
- };
- // Close the modal
- $scope.closeModal = function() {
- $scope.modal.hide();
- $scope.modal.remove();
- };
- })
- .controller('bisnispotensialCtrl',function ($scope, $stateParams) {
- })
- .controller('unitcustomizedCtrl',function ($scope, $stateParams, $ionicModal) {
- $scope.modalData = {};
- $scope.showAlert = function(konsep) {
- if(konsep == 1){
- $scope.modalData.textColor = '#acce22';
- $scope.modalData.Title = '';
- $scope.modalData.Desc = "";
- $scope.modalData.Image = './img/detil_unitcustomized.png';
- }
- $scope.modalData.From = 'konsep';
- $scope.modalData.No = konsep;
- $ionicModal.fromTemplateUrl('templates/alert_modal.html', {
- scope: $scope,
- animation: 'none'
- }).then(function(modal) {
- $scope.modal = modal;
- $scope.modal.show();
- // window.plugins.nativepagetransitions.slide();
- });
- };
- // Close the modal
- $scope.closeModal = function() {
- $scope.modal.hide();
- $scope.modal.remove();
- };
- })
- .controller('simulasipembayaranCtrl',function ($scope, $stateParams,$ionicModal,$ionicHistory,$state) {
- $scope.modalData = {};
- $scope.showAlert = function(konsep,data) {
- localStorage.setItem('jenis_pembayaran', data.pembayaran);
- localStorage.setItem('kpa_bank', data.kpa);
- localStorage.setItem('bank_konvensional', data.konvensional);
- localStorage.setItem('harga_unit', data.hargaunit);
- localStorage.setItem('diskon', data.diskon);
- localStorage.setItem('dp', data.dp);
- localStorage.setItem('utj', data.utj);
- localStorage.setItem('angsuran', data.angsuran);
- if(konsep == 1){
- $scope.modalData.textColor = '#acce22';
- $scope.modalData.jenis_pembayaran = data.pembayaran;
- $scope.modalData.hargaunit =parseInt(data.hargaunit);
- $scope.modalData.diskon = parseInt(data.diskon);
- $scope.modalData.dp = parseInt(data.dp);
- $scope.modalData.utj= parseInt(data.utj);
- $scope.modalData.angsuran=parseInt(data.angsuran);
- var tambah = $scope.modalData.hargaunit+$scope.modalData.diskon+$scope.modalData.dp+$scope.modalData.utj;
- $scope.modalData.hasil= tambah / $scope.modalData.angsuran;
- console.log(tambah/$scope.modalData.angsuran);
- $scope.modalData.Desc = "";
- $scope.modalData.Image = './img/detil_tipestudio.png';
- }
- $scope.modalData.From = 'konsep';
- $scope.modalData.No = konsep;
- $ionicModal.fromTemplateUrl('templates/result_simulasi.html', {
- scope: $scope,
- animation: 'none'
- }).then(function(modal) {
- $scope.modal = modal;
- $scope.modal.show();
- // window.plugins.nativepagetransitions.slide();
- });
- };
- // Close the modal
- $scope.closeModal = function() {
- $scope.modal.hide();
- $scope.modal.remove();
- $ionicHistory.clearCache();
- $ionicHistory.clearHistory();
- $state.go('simulasipembayaran', {}, { location: "replace", reload: true });
- };
- })
- .controller('resultsimulasiCtrl',function ($scope, $stateParams) {
- })
- .controller('eventCtrl',function ($scope, $stateParams,$http,$stateParams,$state,$ionicLoading) {
- $ionicLoading.show({
- template: 'Mohon Tunggu <br> <ion-spinner icon="android"></ion-spinner>'
- });
- $http.get("http://dewanstudio.biz/SIT/cms_begawan/api/event/")
- .success(function (data) {
- $scope.getevent = data.item;
- console.log(data);
- $ionicLoading.hide();
- });
- $scope.eventview = function(id, file_name, desc) {
- localStorage.setItem('event_id', id);
- localStorage.setItem('event_gambar', file_name);
- localStorage.setItem('event_deskripsi', desc);
- window.location.href = "#/eventview";
- console.log(id,desc,file_name);
- }
- })
- .controller('eventviewCtrl',function ($scope, $stateParams,$http,$state,$stateParams) {
- angular.element(document).ready(function() {
- $scope.id = localStorage.getItem('event_id');
- $scope.gambar = localStorage.getItem('event_gambar');
- $scope.deskripsi = localStorage.getItem('event_deskripsi');
- });
- })
- .controller('desainunitCtrl',function ($scope, $stateParams, $ionicModal) {
- $scope.modalData = {};
- $scope.showAlert = function(konsep) {
- if(konsep == 1){
- $scope.modalData.textColor = '#acce22';
- $scope.modalData.Title = '';
- $scope.modalData.Desc = "";
- $scope.modalData.Image = './img/detil_tipestudio.png';
- }else if(konsep == 2){
- $scope.modalData.textColor = '#fabf01';
- $scope.modalData.Title = '';
- $scope.modalData.Desc = "";
- $scope.modalData.Image = './img/detil_tipe2bedroom.png';
- }else if(konsep == 3){
- $scope.modalData.textColor = '#1962ae';
- $scope.modalData.Title = '';
- $scope.modalData.Desc = "";
- $scope.modalData.Image = './img/detil_tipe2bedroomcorner.png';
- }
- $scope.modalData.From = 'konsep';
- $scope.modalData.No = konsep;
- $ionicModal.fromTemplateUrl('templates/alert_modal.html', {
- scope: $scope,
- animation: 'none'
- }).then(function(modal) {
- $scope.modal = modal;
- $scope.modal.show();
- // window.plugins.nativepagetransitions.slide();
- });
- };
- // Close the modal
- $scope.closeModal = function() {
- $scope.modal.hide();
- $scope.modal.remove();
- };
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement