Advertisement
Guest User

Progammer newbie

a guest
Mar 27th, 2017
589
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  
  3.  * Licensed to the Apache Software Foundation (ASF) under one
  4.  
  5.  * or more contributor license agreements.  See the NOTICE file
  6.  
  7.  * distributed with this work for additional information
  8.  
  9.  * regarding copyright ownership.  The ASF licenses this file
  10.  
  11.  * to you under the Apache License, Version 2.0 (the
  12.  
  13.  * "License"); you may not use this file except in compliance
  14.  
  15.  * with the License.  You may obtain a copy of the License at
  16.  
  17.  *
  18.  
  19.  * http://www.apache.org/licenses/LICENSE-2.0
  20.  
  21.  *
  22.  
  23.  * Unless required by applicable law or agreed to in writing,
  24.  
  25.  * software distributed under the License is distributed on an
  26.  
  27.  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  28.  
  29.  * KIND, either express or implied.  See the License for the
  30.  
  31.  * specific language governing permissions and limitations
  32.  
  33.  * under the License.
  34.  
  35.  */
  36.  
  37.  
  38.  
  39. var app = {
  40.  
  41.     // Application Constructor
  42.  
  43.     initialize: function() {
  44.  
  45.  
  46.  
  47.         this.bindEvents();
  48.  
  49.     },
  50.  
  51.     // Bind Event Listeners
  52.  
  53.     //
  54.  
  55.     // Bind any events that are required on startup. Common events are:
  56.  
  57.     // 'load', 'deviceready', 'offline', and 'online'.
  58.  
  59.     bindEvents: function() {
  60.  
  61.         document.addEventListener('deviceready', this.onDeviceReady, false);
  62.  
  63.     },
  64.  
  65.    
  66.  
  67.  
  68.  
  69.  
  70.  
  71.     // deviceready Event Handler
  72.  
  73.     //
  74.  
  75.     // The scope of 'this' is the event. In order to call the 'receivedEvent'
  76.  
  77.     // function, we must explicitly call 'app.receivedEvent(...);'
  78.  
  79.     onDeviceReady: function() {
  80.  
  81.     console.log("urlREDADASDADASDSADSADASDSADASDADSA");
  82.     console.log("Device Platform = "+device.platform);
  83.        
  84.  
  85.       //  app.receivedEvent('deviceready');
  86.  
  87.     },
  88.  
  89.     // Update DOM on a Received Event
  90.  
  91.     receivedEvent: function(id) {
  92.  
  93.         var parentElement = document.getElementById(id);
  94.  
  95.         var listeningElement = parentElement.querySelector('.listening');
  96.  
  97.         var receivedElement = parentElement.querySelector('.received');
  98.  
  99.  
  100.  
  101.         listeningElement.setAttribute('style', 'display:none;');
  102.  
  103.         receivedElement.setAttribute('style', 'display:block;');
  104.  
  105.  
  106.  
  107.         console.log('Received Event: ' + id);
  108.  
  109.     }
  110.  
  111. };
  112.  
  113.  
  114.  
  115.  
  116.  
  117. app.initialize();
  118.  
  119. var airlines = [{"fs":"LCI","iata":"LF","icao":"LCI","name":"Lao Central Airlines ","active":true},{"fs":"TGU","iata":"5U","icao":"TGU","name":"TAG","active":true},{"fs":"BT","iata":"BT","icao":"BTI","name":"Air Baltic","active":true},{"fs":"9J","iata":"9J","icao":"DAN","name":"Dana Airlines","active":true},{"fs":"2O","iata":"2O","icao":"RNE","name":"Island Air Service","active":true},{"fs":"NPT","icao":"NPT","name":"Atlantic Airlines","active":true},{"fs":"C8","iata":"C8","icao":"ICV","name":"Cargolux Italia","active":true},{"fs":"FK","iata":"FK","icao":"WTA","name":"Africa West","active":true},{"fs":"8K","iata":"8K","icao":"EVS","name":"EVAS Air Charters","active":true},{"fs":"W8","iata":"W8","icao":"CJT","name":"Cargojet","active":true},{"fs":"JBW","iata":"3J","icao":"JBW","name":"Jubba Airways (Kenya)","active":true},{"fs":"TNU","iata":"M8","icao":"TNU","name":"TransNusa","active":true},{"fs":"HCC","iata":"HC","icao":"HCC","name":"Holidays Czech Airlines","active":true},{"fs":"APJ","iata":"MM","icao":"APJ","name":"Peach Aviation","active":true},{"fs":"TUY","iata":"L4","icao":"TUY","name":"LTA","active":true},{"fs":"LAE","iata":"L7","icao":"LAE","name":"LANCO","active":true},{"fs":"L5*","iata":"L5","icao":"LTR","name":"Lufttransport","active":true},{"fs":"QA","iata":"QA","icao":"CIM","name":"Cimber","active":true},{"fs":"KBZ","iata":"K7","icao":"KBZ","name":"Air KBZ","active":true},{"fs":"L2","iata":"L2","icao":"LYC","name":"Lynden Air Cargo","active":true},{"fs":"MPK","iata":"I6","icao":"MPK","name":"Air Indus","active":true},{"fs":"CAO","icao":"CAO","name":"Air China Cargo ","active":true},{"fs":"BEK","iata":"Z9","icao":"BEK","name":"Bek Air","active":true},{"fs":"IAE","iata":"IO","icao":"IAE","name":"IrAero","active":true},{"fs":"GL*","iata":"GL","name":"Airglow Aviation Services","active":true},{"fs":"ATN","iata":"8C","icao":"ATN","name":"ATI","active":true},{"fs":"GU","iata":"GU","icao":"GUG","name":"Aviateca Guatemala","active":true},{"fs":"GHY","icao":"GHY","name":"German Sky Airlines ","active":true},{"fs":"SS","iata":"SS","icao":"CRL","name":"Corsair","active":true},{"fs":"XK","iata":"XK","icao":"CCM","name":"Air Corsica","active":true},{"fs":"W9*","iata":"W9","icao":"JAB","name":"Air Bagan","active":true},{"fs":"Z8*","iata":"Z8","icao":"AZN","name":"Amaszonas","active":true},{"fs":"D2","iata":"D2","icao":"SSF","name":"Severstal Aircompany","active":true},{"fs":"SNC","iata":"2Q","icao":"SNC","name":"Air Cargo Carriers","active":true},{"fs":"PST","iata":"7P","icao":"PST","name":"Air Panama","active":true},{"fs":"VV","iata":"VV","icao":"AEW","name":"Aerosvit Airlines","active":true},{"fs":"UJ","iata":"UJ","icao":"LMU","name":"AlMasria","active":true},{"fs":"9U","iata":"9U","icao":"MLD","name":"Air Moldova","active":true},{"fs":"NF","iata":"NF","icao":"AVN","name":"Air Vanuatu","phoneNumber":"678 238 48","active":true},{"fs":"NJS","iata":"NC","icao":"NJS","name":"Cobham Aviation","active":true}];
  120.  
  121. airlines = airlines.sort(function(a, b) {
  122.  
  123.     var airlineA = a.name.toLowerCase();
  124.     var airlineB = b.name.toLowerCase();
  125.  
  126.     if(airlineA > airlineB) return 1;
  127.     if(airlineA < airlineB) return -1;
  128.     return 0;
  129. });
  130.  
  131.  
  132.  
  133. //Section - Angular Navigation
  134.  
  135. //angular.module('dxplor', ['ionic','ngStorage','ngCart','ionic-autocomplete'])
  136.  
  137. angular.module('dxplor', ['ionic','ngCordova','ngStorage','autocomplete', 'ngCordovaOauth'])
  138.  
  139.  
  140.  
  141. .config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
  142.  
  143.  
  144.  
  145.     $stateProvider
  146.  
  147.         .state('root', {
  148.  
  149.             url : '/root',
  150.  
  151.             templateUrl : 'root.html',
  152.  
  153.             controller : 'RootPageController'
  154.  
  155.         })
  156.  
  157.  
  158.  
  159.         .state('fst', {
  160.  
  161.             url : '/fst',
  162.  
  163.             templateUrl : 'fst-abstract.html',
  164.  
  165.             abstract : true,
  166.  
  167.             controller : 'FstController'
  168.  
  169.         })
  170.  
  171.         .state('fst.home', {
  172.  
  173.             url: '/home',
  174.  
  175.             views: {
  176.  
  177.                 'fst': {
  178.  
  179.                     templateUrl: 'fst-home.html',
  180.  
  181.                     controller : 'FstHomePageController'
  182.  
  183.                 }
  184.  
  185.             }
  186.  
  187.         })
  188.  
  189.         .state('fst.first', {
  190.  
  191.             url: '/first',
  192.  
  193.             views: {
  194.  
  195.                 'fst': {
  196.  
  197.                     templateUrl: 'fst-first.html',
  198.  
  199.                     controller : 'FstFirstPageController'
  200.  
  201.                 }
  202.  
  203.             }
  204.  
  205.         })
  206.  
  207.         .state('fst.second', {
  208.  
  209.             url: '/second',
  210.  
  211.             views: {
  212.  
  213.                 'fst': {
  214.  
  215.                     templateUrl: 'fst-second.html',
  216.  
  217.                     controller : 'FstSecondPageController'
  218.  
  219.                 }
  220.  
  221.             }
  222.  
  223.         })
  224.  
  225.  
  226.  
  227.         .state('snd', {
  228.  
  229.             url : '/snd',
  230.  
  231.             templateUrl : 'snd-abstract.html',
  232.  
  233.             abstract : true,
  234.  
  235.             controller : 'SndController'
  236.  
  237.         })
  238.  
  239.         .state('snd.home', {
  240.  
  241.             url: '/home',
  242.  
  243.             views: {
  244.  
  245.                 'snd': {
  246.  
  247.                     templateUrl: 'home.html',
  248.  
  249.                     controller : 'SndHomePageController'
  250.  
  251.                 }
  252.  
  253.             }
  254.  
  255.         })
  256.  
  257.         .state('snd.chat', {
  258.  
  259.             url: '/chat',
  260.  
  261.             views: {
  262.  
  263.                 'snd': {
  264.  
  265.                     templateUrl: 'snd-chat.html',
  266.  
  267.                     controller : 'SndChatPageController'
  268.  
  269.                 }
  270.  
  271.             }
  272.  
  273.         })
  274.  
  275.         .state('snd.chat-single', {
  276.  
  277.           url: '/chat-single',
  278.  
  279.           views: {
  280.  
  281.             'snd': {
  282.  
  283.               templateUrl: 'snd-chat-single.html',
  284.  
  285.               controller : 'SndChatSinglePageController'
  286.  
  287.             }
  288.  
  289.           }
  290.  
  291.         })
  292.  
  293.         .state('snd.account', {
  294.  
  295.             url: '/account',
  296.  
  297.             views: {
  298.  
  299.                 'snd': {
  300.  
  301.                     templateUrl: 'account.html',
  302.  
  303.                     controller : 'SndAccountPageController'
  304.  
  305.                 }
  306.  
  307.             }
  308.  
  309.         })
  310.        
  311.        
  312.          .state('snd.shopdashboard', {
  313.  
  314.             url: '/shopdashboard',
  315.  
  316.             views: {
  317.  
  318.                 'snd': {
  319.  
  320.                     templateUrl: 'shopdashboard.html',
  321.  
  322.                     controller : 'ShopDashboardController'
  323.  
  324.                 }
  325.  
  326.             }
  327.  
  328.         })
  329.          .state('snd.editdashboard', {
  330.  
  331.             url: '/editdashboard',
  332.  
  333.             views: {
  334.  
  335.                 'snd': {
  336.  
  337.                     templateUrl: 'editdashboard.html',
  338.  
  339.                     controller : 'EditDashboardController'
  340.  
  341.                 }
  342.  
  343.             }
  344.  
  345.         })
  346.        
  347.        
  348.          .state('snd.addproduct', {
  349.  
  350.             url: '/addproduct',
  351.  
  352.             views: {
  353.  
  354.                 'snd': {
  355.  
  356.                     templateUrl: 'addproduct.html',
  357.  
  358.                     controller : 'AddProductController'
  359.  
  360.                 }
  361.  
  362.             }
  363.  
  364.         })
  365.        
  366.          
  367.        
  368.            .state('snd.editproduct/:productid', {
  369.  
  370.             url: '/editproduct/:productid',
  371.  
  372.             views: {
  373.  
  374.                 'snd': {
  375.  
  376.                     templateUrl: 'editproduct.html',
  377.  
  378.                     controller : 'EditProductController'
  379.  
  380.                 }
  381.  
  382.             }
  383.  
  384.         })
  385.  
  386.        
  387.        
  388.        
  389.         .state('snd.signup', {
  390.  
  391.             url: '/signup',
  392.  
  393.             views: {
  394.  
  395.                 'snd': {
  396.  
  397.                     templateUrl: 'signup.html',
  398.  
  399.                     controller : 'SndSignupPageController'
  400.  
  401.                 }
  402.  
  403.             }
  404.  
  405.         })
  406.  
  407.        
  408.           .state('snd.history_balance', {
  409.  
  410.             url: '/history_balance',
  411.  
  412.             views: {
  413.  
  414.                 'snd': {
  415.  
  416.                     templateUrl: 'history_balance.html',
  417.  
  418.                     controller : 'HistoryBalanceController'
  419.  
  420.                 }
  421.  
  422.             }
  423.  
  424.         })
  425.  
  426.           .state('snd.mobile', {
  427.  
  428.             url: '/mobile',
  429.  
  430.             views: {
  431.  
  432.                 'snd': {
  433.  
  434.                     templateUrl: 'mobile.html',
  435.  
  436.                     controller : 'MobileController'
  437.  
  438.                 }
  439.  
  440.             }
  441.  
  442.         })
  443.  
  444.        
  445.  
  446.        
  447.  
  448.          .state('snd.mobilepacket', {
  449.  
  450.             url: '/mobilepacket',
  451.  
  452.             views: {
  453.  
  454.                 'snd': {
  455.  
  456.                     templateUrl: 'mobilepacket.html',
  457.  
  458.                     controller : 'MobilePacketController'
  459.  
  460.                 }
  461.  
  462.             }
  463.  
  464.         })
  465.  
  466.                
  467.  
  468.          .state('snd.mobilecategory', {
  469.  
  470.             url: '/mobilecategory',
  471.  
  472.             views: {
  473.  
  474.                 'snd': {
  475.  
  476.                     templateUrl: 'mobilecategory.html',
  477.  
  478.                     controller : 'MobileCategoryController'
  479.  
  480.                 }
  481.  
  482.             }
  483.  
  484.         })
  485.  
  486.        
  487.        
  488.  
  489.          .state('snd.mobileconfirmation/:number/:code/:harga', {
  490.  
  491.             url: '/mobileconfirmation/:number/:code/:harga',
  492.  
  493.             views: {
  494.  
  495.                 'snd': {
  496.  
  497.                     templateUrl: 'mobilemobileconfirmation.html',
  498.  
  499.                     controller : 'MobileconfirmationController'
  500.  
  501.                 }
  502.  
  503.             }
  504.  
  505.         })
  506.  
  507.        
  508.  
  509.         .state('snd.login', {
  510.  
  511.             url: '/login',
  512.  
  513.             views: {
  514.  
  515.                 'snd': {
  516.  
  517.                     templateUrl: 'login.html',
  518.  
  519.                     controller : 'SndLoginPageController'
  520.  
  521.                 }
  522.  
  523.             }
  524.  
  525.         })
  526.        
  527.        
  528.            .state('snd.forgot_password', {
  529.  
  530.             url: '/forgot_password',
  531.  
  532.             views: {
  533.  
  534.                 'snd': {
  535.  
  536.                     templateUrl: 'forgot_password.html',
  537.  
  538.                     controller : 'ForgotPasswordPageController'
  539.  
  540.                 }
  541.  
  542.             }
  543.  
  544.         })
  545.  
  546.        
  547.          .state('snd.change_password', {
  548.  
  549.             url: '/change_password',
  550.  
  551.             views: {
  552.  
  553.                 'snd': {
  554.  
  555.                     templateUrl: 'change_password.html',
  556.  
  557.                     controller : 'ChangePasswordPageController'
  558.  
  559.                 }
  560.  
  561.             }
  562.  
  563.         })
  564.  
  565.        
  566.  
  567.        
  568.  
  569.         .state('snd.marketplace', {
  570.  
  571.             url: '/marketplace',
  572.  
  573.             views: {
  574.  
  575.                 'snd': {
  576.  
  577.                     templateUrl: 'marketplace.html',
  578.  
  579.                     controller : 'MarketPlaceController'
  580.  
  581.                 }
  582.  
  583.             }
  584.  
  585.         })
  586.  
  587.        
  588.  
  589.           .state('snd.products/:productid', {
  590.  
  591.             url: '/products/:productid',
  592.  
  593.             views: {
  594.  
  595.                 'snd': {
  596.  
  597.                     templateUrl: 'products.html',
  598.  
  599.                     controller : 'ProductsController'
  600.  
  601.                 }
  602.  
  603.             }
  604.  
  605.         })
  606.  
  607.        
  608.  
  609.           .state('snd.productsdetail/:productid', {
  610.  
  611.             url: '/productsdetail/:productid',
  612.  
  613.             views: {
  614.  
  615.                 'snd': {
  616.  
  617.                     templateUrl: 'productsdetail.html',
  618.  
  619.                     controller : 'ProductsDetailController'
  620.  
  621.                 }
  622.  
  623.             }
  624.  
  625.         })
  626.  
  627.        
  628.  
  629.            .state('snd.cart', {
  630.  
  631.             url: '/cart',
  632.  
  633.             views: {
  634.  
  635.                 'snd': {
  636.  
  637.                     templateUrl: 'cart.html',
  638.  
  639.                     controller : 'ShoppingCartController'
  640.  
  641.                 }
  642.  
  643.             }
  644.  
  645.         })
  646.        
  647.        
  648.          .state('snd.lawyer', {
  649.  
  650.             url: '/lawyer',
  651.  
  652.             views: {
  653.  
  654.                 'snd': {
  655.  
  656.                     templateUrl: 'lawyer.html',
  657.  
  658.                     controller : 'LawyerController'
  659.  
  660.                 }
  661.  
  662.             }
  663.  
  664.         })
  665.        
  666.        
  667.          .state('snd.gadget', {
  668.  
  669.             url: '/gadget',
  670.  
  671.             views: {
  672.  
  673.                 'snd': {
  674.  
  675.                     templateUrl: 'gadget.html',
  676.  
  677.                     controller : 'GadgetController'
  678.  
  679.                 }
  680.  
  681.             }
  682.  
  683.         })
  684.        
  685.         .state('snd.gadget_content/:id', {
  686.  
  687.             url: '/gadget_content/:id',
  688.  
  689.             views: {
  690.  
  691.                 'snd': {
  692.  
  693.                     templateUrl: 'gadget_content.html',
  694.  
  695.                     controller : 'GadgetContentController'
  696.  
  697.                 }
  698.  
  699.             }
  700.  
  701.         })
  702.        
  703.        
  704.             .state('snd.resto', {
  705.  
  706.             url: '/resto',
  707.  
  708.             views: {
  709.  
  710.                 'snd': {
  711.  
  712.                     templateUrl: 'resto.html',
  713.  
  714.                     controller : 'RestoController'
  715.  
  716.                 }
  717.  
  718.             }
  719.  
  720.         })
  721.        
  722.         .state('snd.resto_content/:id', {
  723.  
  724.             url: '/resto_content/:id',
  725.  
  726.             views: {
  727.  
  728.                 'snd': {
  729.  
  730.                     templateUrl: 'resto_content.html',
  731.  
  732.                     controller : 'RestoContentController'
  733.  
  734.                 }
  735.  
  736.             }
  737.  
  738.         })
  739.        
  740.        
  741.          .state('snd.travel', {
  742.  
  743.             url: '/travel',
  744.  
  745.             views: {
  746.  
  747.                 'snd': {
  748.  
  749.                     templateUrl: 'travel.html',
  750.  
  751.                     controller : 'TravelController'
  752.  
  753.                 }
  754.  
  755.             }
  756.  
  757.         })
  758.        
  759.         .state('snd.travel_content/:id', {
  760.  
  761.             url: '/travel_content/:id',
  762.  
  763.             views: {
  764.  
  765.                 'snd': {
  766.  
  767.                     templateUrl: 'travel_content.html',
  768.  
  769.                     controller : 'TravelContentController'
  770.  
  771.                 }
  772.  
  773.             }
  774.  
  775.         })
  776.        
  777.        
  778.           .state('snd.health', {
  779.  
  780.             url: '/health',
  781.  
  782.             views: {
  783.  
  784.                 'snd': {
  785.  
  786.                     templateUrl: 'health.html',
  787.  
  788.                     controller : 'HealthController'
  789.  
  790.                 }
  791.  
  792.             }
  793.  
  794.         })
  795.        
  796.         .state('snd.health_content/:id', {
  797.  
  798.             url: '/health_content/:id',
  799.  
  800.             views: {
  801.  
  802.                 'snd': {
  803.  
  804.                     templateUrl: 'health_content.html',
  805.  
  806.                     controller : 'HealthContentController'
  807.  
  808.                 }
  809.  
  810.             }
  811.  
  812.         })
  813.        
  814.        
  815.           .state('snd.medical', {
  816.  
  817.             url: '/medical',
  818.  
  819.             views: {
  820.  
  821.                 'snd': {
  822.  
  823.                     templateUrl: 'medical.html',
  824.  
  825.                     controller : 'MedicalController'
  826.  
  827.                 }
  828.  
  829.             }
  830.  
  831.         })
  832.        
  833.         .state('snd.medical_content/:id', {
  834.  
  835.             url: '/medical_content/:id',
  836.  
  837.             views: {
  838.  
  839.                 'snd': {
  840.  
  841.                     templateUrl: 'medical_content.html',
  842.  
  843.                     controller : 'MedicalContentController'
  844.  
  845.                 }
  846.  
  847.             }
  848.  
  849.         })
  850.        
  851.        
  852.              .state('snd.others', {
  853.  
  854.             url: '/others',
  855.  
  856.             views: {
  857.  
  858.                 'snd': {
  859.  
  860.                     templateUrl: 'others.html',
  861.  
  862.                     controller : 'OthersController'
  863.  
  864.                 }
  865.  
  866.             }
  867.  
  868.         })
  869.        
  870.         .state('snd.others_content/:id', {
  871.  
  872.             url: '/others_content/:id',
  873.  
  874.             views: {
  875.  
  876.                 'snd': {
  877.  
  878.                     templateUrl: 'others_content.html',
  879.  
  880.                     controller : 'OthersContentController'
  881.  
  882.                 }
  883.  
  884.             }
  885.  
  886.         })
  887.        
  888.        
  889.  .state('snd.electronic', {
  890.  
  891.             url: '/electronic',
  892.  
  893.             views: {
  894.  
  895.                 'snd': {
  896.  
  897.                     templateUrl: 'electronic.html',
  898.  
  899.                     controller : 'ElectronicController'
  900.  
  901.                 }
  902.  
  903.             }
  904.  
  905.         })
  906.        
  907. .state('snd.electronic_content/:id', {
  908.  
  909.             url: '/electronic_content/:id',
  910.  
  911.             views: {
  912.  
  913.                 'snd': {
  914.  
  915.                     templateUrl: 'electronic_content.html',
  916.  
  917.                     controller : 'ElectronicContentController'
  918.  
  919.                 }
  920.  
  921.             }
  922.  
  923.         })
  924.        
  925.        
  926.  .state('snd.fashion', {
  927.  
  928.             url: '/fashion',
  929.  
  930.             views: {
  931.  
  932.                 'snd': {
  933.  
  934.                     templateUrl: 'fashion.html',
  935.  
  936.                     controller : 'FashionController'
  937.  
  938.                 }
  939.  
  940.             }
  941.  
  942.         })
  943.        
  944. .state('snd.fashion_content/:id', {
  945.  
  946.             url: '/fashion_content/:id',
  947.  
  948.             views: {
  949.  
  950.                 'snd': {
  951.  
  952.                     templateUrl: 'fashion_content.html',
  953.  
  954.                     controller : 'FashionContentController'
  955.  
  956.                 }
  957.  
  958.             }
  959.  
  960.         })
  961.        
  962.  
  963.          .state('snd.topup', {
  964.  
  965.             url: '/topup',
  966.  
  967.             views: {
  968.  
  969.                 'snd': {
  970.  
  971.                     templateUrl: 'topup.html',
  972.  
  973.                     controller : 'TopupController'
  974.  
  975.                 }
  976.  
  977.             }
  978.  
  979.         })
  980.        
  981.        
  982.        
  983.  
  984.           .state('snd.transfer_dpay_confirmation/:email/:amount', {
  985.  
  986.             url: '/transfer_dpay_confirmation/:email/:amount',
  987.  
  988.             views: {
  989.  
  990.                 'snd': {
  991.  
  992.                     templateUrl: 'transfer_dpay_confirmation.html',
  993.  
  994.                     controller : 'TransferDpayConfirmController'
  995.  
  996.                 }
  997.  
  998.             }
  999.  
  1000.         })
  1001.  
  1002.      
  1003.  
  1004.         .state('snd.topup_order/:amount/:bank', {
  1005.  
  1006.             url: '/topup_order/:amount/:bank',
  1007.  
  1008.             views: {
  1009.  
  1010.                 'snd': {
  1011.  
  1012.                     templateUrl: 'topup_order.html',
  1013.  
  1014.                     controller : 'TopupOrderController'
  1015.  
  1016.                 }
  1017.  
  1018.             }
  1019.  
  1020.         })
  1021.  
  1022.        
  1023.  
  1024.  
  1025.          .state('snd.transfer_dpay', {
  1026.  
  1027.             url: '/transfer_dpay',
  1028.  
  1029.             views: {
  1030.  
  1031.                 'snd': {
  1032.  
  1033.                     templateUrl: 'transfer_dpay.html',
  1034.  
  1035.                     controller : 'TransferDpayController'
  1036.  
  1037.                 }
  1038.  
  1039.             }
  1040.  
  1041.         })
  1042.        
  1043.  
  1044.        
  1045.        
  1046.           .state('snd.help', {
  1047.  
  1048.             url: '/help',
  1049.  
  1050.             views: {
  1051.  
  1052.                 'snd': {
  1053.  
  1054.                     templateUrl: 'help.html',
  1055.  
  1056.                     controller : 'HelpController'
  1057.  
  1058.                 }
  1059.  
  1060.             }
  1061.  
  1062.         })
  1063.        
  1064.        
  1065.             .state('snd.program_referensi', {
  1066.  
  1067.             url: '/program_referensi',
  1068.  
  1069.             views: {
  1070.  
  1071.                 'snd': {
  1072.  
  1073.                     templateUrl: 'program_referensi.html',
  1074.  
  1075.                     controller : 'ProgramReferensiController'
  1076.  
  1077.                 }
  1078.  
  1079.             }
  1080.  
  1081.         })
  1082.  
  1083.  
  1084.          .state('snd.topup_confirmation', {
  1085.  
  1086.             url: '/topup_confirmation',
  1087.  
  1088.             views: {
  1089.  
  1090.                 'snd': {
  1091.  
  1092.                     templateUrl: 'topup_confirmation.html',
  1093.  
  1094.                     controller : 'TopupConfirmationController'
  1095.  
  1096.                 }
  1097.  
  1098.             }
  1099.  
  1100.         })
  1101.  
  1102.        
  1103.  
  1104.        
  1105.  
  1106.        
  1107.  
  1108.           .state('snd.flight', {
  1109.  
  1110.             url: '/flight',
  1111.  
  1112.             views: {
  1113.  
  1114.                 'snd': {
  1115.  
  1116.                     templateUrl: 'flight.html',
  1117.  
  1118.                     controller : 'FlightController'
  1119.  
  1120.                 }
  1121.  
  1122.             }
  1123.  
  1124.         })
  1125.  
  1126.        
  1127.  
  1128.           .state('snd.flight_search', {
  1129.  
  1130.             url: '/flight_search',
  1131.  
  1132.             views: {
  1133.  
  1134.                 'snd': {
  1135.  
  1136.                     templateUrl: 'flight_search.html',
  1137.  
  1138.                     controller : 'FlightSearchController'
  1139.  
  1140.                 }
  1141.  
  1142.             }
  1143.  
  1144.         })
  1145.  
  1146.        
  1147.  
  1148.        
  1149.  
  1150.           .state('snd.flight_search2', {
  1151.  
  1152.             url: '/flight_search2',
  1153.  
  1154.             views: {
  1155.  
  1156.                 'snd': {
  1157.  
  1158.                     templateUrl: 'flight_search2.html',
  1159.  
  1160.                     controller : 'FlightSearch2Controller'
  1161.  
  1162.                 }
  1163.  
  1164.             }
  1165.  
  1166.         })
  1167.  
  1168.        
  1169.  
  1170.        
  1171.  
  1172.         /*  .state('snd.flight_schedule/:flight_id', {
  1173.  
  1174.             url: '/flight_schedule/:flight_id',
  1175.  
  1176.             views: {
  1177.  
  1178.                 'snd': {
  1179.  
  1180.                     templateUrl: 'flight_schedule.html',
  1181.  
  1182.                     controller : 'FlightScheduleController'
  1183.  
  1184.                 }
  1185.  
  1186.             }
  1187.  
  1188.         })
  1189.  
  1190.         */
  1191.  
  1192.        
  1193.  
  1194.          .state('snd.flight_schedule', {
  1195.  
  1196.             url: '/flight_schedule',
  1197.  
  1198.             views: {
  1199.  
  1200.                 'snd': {
  1201.  
  1202.                     templateUrl: 'flight_schedule.html',
  1203.  
  1204.                     controller : 'FlightScheduleController'
  1205.  
  1206.                 }
  1207.  
  1208.             }
  1209.  
  1210.         })
  1211.  
  1212.        
  1213.  
  1214.         /*  .state('snd.flight_book/:flight_id', {
  1215.  
  1216.             url: '/flight_book/:flight_id',
  1217.  
  1218.             views: {
  1219.  
  1220.                 'snd': {
  1221.  
  1222.                     templateUrl: 'flight_book.html',
  1223.  
  1224.                     controller : 'FlightBookController'
  1225.  
  1226.                 }
  1227.  
  1228.             }
  1229.  
  1230.         })
  1231.  
  1232.         */
  1233.  
  1234.        
  1235.  
  1236.           .state('snd.flight_book', {
  1237.  
  1238.             url: '/flight_book',
  1239.  
  1240.             views: {
  1241.  
  1242.                 'snd': {
  1243.  
  1244.                     templateUrl: 'flight_book.html',
  1245.  
  1246.                     controller : 'FlightBookController'
  1247.  
  1248.                 }
  1249.  
  1250.             }
  1251.  
  1252.         })
  1253.  
  1254.        
  1255.  
  1256.      /*    .state('snd.flight_issued/:booking_code', {
  1257.  
  1258.             url: '/flight_issued/:booking_code',
  1259.  
  1260.             views: {
  1261.  
  1262.                 'snd': {
  1263.  
  1264.                     templateUrl: 'flight_issued.html',
  1265.  
  1266.                     controller : 'FlightIssuedController'
  1267.  
  1268.                 }
  1269.  
  1270.             }
  1271.  
  1272.         })
  1273.  
  1274.        
  1275.  
  1276.         */
  1277.  
  1278.        
  1279.  
  1280.          .state('snd.flight_issued', {
  1281.  
  1282.             url: '/flight_issued',
  1283.  
  1284.             views: {
  1285.  
  1286.                 'snd': {
  1287.  
  1288.                     templateUrl: 'flight_issued.html',
  1289.  
  1290.                     controller : 'FlightIssuedController'
  1291.  
  1292.                 }
  1293.  
  1294.             }
  1295.  
  1296.         })
  1297.  
  1298.        
  1299.  
  1300.        
  1301.  
  1302.          .state('snd.ppob', {
  1303.  
  1304.             url: '/ppob',
  1305.  
  1306.             views: {
  1307.  
  1308.                 'snd': {
  1309.  
  1310.                     templateUrl: 'ppob.html',
  1311.  
  1312.                     controller : 'PPOBController'
  1313.  
  1314.                 }
  1315.  
  1316.             }
  1317.  
  1318.         })
  1319.        
  1320.             .state('snd.telkom', {
  1321.  
  1322.             url: '/telkom',
  1323.  
  1324.             views: {
  1325.  
  1326.                 'snd': {
  1327.  
  1328.                     templateUrl: 'telkom.html',
  1329.  
  1330.                     controller : 'TelkomController'
  1331.  
  1332.                 }
  1333.  
  1334.             }
  1335.  
  1336.         })
  1337.  
  1338.        
  1339.  
  1340.          .state('snd.telkom_confirm', {
  1341.  
  1342.             url: '/telkom_confirm',
  1343.  
  1344.             views: {
  1345.  
  1346.                 'snd': {
  1347.  
  1348.                     templateUrl: 'telkom_confirm.html',
  1349.  
  1350.                     controller : 'TelkomConfirmController'
  1351.  
  1352.                 }
  1353.  
  1354.             }
  1355.  
  1356.         })
  1357.        
  1358.            
  1359.        
  1360.  
  1361.          .state('snd.telkom_summary', {
  1362.  
  1363.             url: '/telkom_summary',
  1364.  
  1365.             views: {
  1366.  
  1367.                 'snd': {
  1368.  
  1369.                     templateUrl: 'telkom_summary.html',
  1370.  
  1371.                     controller : 'Telkom_summaryController'
  1372.  
  1373.                 }
  1374.  
  1375.             }
  1376.  
  1377.         })
  1378.        
  1379.        
  1380.            .state('snd.speedy', {
  1381.  
  1382.             url: '/speedy',
  1383.  
  1384.             views: {
  1385.  
  1386.                 'snd': {
  1387.  
  1388.                     templateUrl: 'speedy.html',
  1389.  
  1390.                     controller : 'SpeedyController'
  1391.  
  1392.                 }
  1393.  
  1394.             }
  1395.  
  1396.         })
  1397.  
  1398.        
  1399.  
  1400.          .state('snd.speedy_confirm', {
  1401.  
  1402.             url: '/speedy_confirm',
  1403.  
  1404.             views: {
  1405.  
  1406.                 'snd': {
  1407.  
  1408.                     templateUrl: 'speedy_confirm.html',
  1409.  
  1410.                     controller : 'SpeedyConfirmController'
  1411.  
  1412.                 }
  1413.  
  1414.             }
  1415.  
  1416.         })
  1417.        
  1418.            
  1419.        
  1420.  
  1421.          .state('snd.speedy_summary', {
  1422.  
  1423.             url: '/speedy_summary',
  1424.  
  1425.             views: {
  1426.  
  1427.                 'snd': {
  1428.  
  1429.                     templateUrl: 'speedy_summary.html',
  1430.  
  1431.                     controller : 'Speedy_summaryController'
  1432.  
  1433.                 }
  1434.  
  1435.             }
  1436.  
  1437.         })
  1438.        
  1439.        
  1440.        
  1441.            .state('snd.bpjs', {
  1442.  
  1443.             url: '/bpjs',
  1444.  
  1445.             views: {
  1446.  
  1447.                 'snd': {
  1448.  
  1449.                     templateUrl: 'bpjs.html',
  1450.  
  1451.                     controller : 'BPJSController'
  1452.  
  1453.                 }
  1454.  
  1455.             }
  1456.  
  1457.         })
  1458.  
  1459.        
  1460.  
  1461.          .state('snd.bpjs_confirm', {
  1462.  
  1463.             url: '/bpjs_confirm',
  1464.  
  1465.             views: {
  1466.  
  1467.                 'snd': {
  1468.  
  1469.                     templateUrl: 'bpjs_confirm.html',
  1470.  
  1471.                     controller : 'BPJSConfirmController'
  1472.  
  1473.                 }
  1474.  
  1475.             }
  1476.  
  1477.         })
  1478.        
  1479.            
  1480.        
  1481.  
  1482.          .state('snd.bpjs_summary', {
  1483.  
  1484.             url: '/bpjs_summary',
  1485.  
  1486.             views: {
  1487.  
  1488.                 'snd': {
  1489.  
  1490.                     templateUrl: 'bpjs_summary.html',
  1491.  
  1492.                     controller : 'BPJS_summaryController'
  1493.  
  1494.                 }
  1495.  
  1496.             }
  1497.  
  1498.         })
  1499.        
  1500.  
  1501.        
  1502.  
  1503.          .state('snd.pln', {
  1504.  
  1505.             url: '/pln',
  1506.  
  1507.             views: {
  1508.  
  1509.                 'snd': {
  1510.  
  1511.                     templateUrl: 'pln.html',
  1512.  
  1513.                     controller : 'PLNController'
  1514.  
  1515.                 }
  1516.  
  1517.             }
  1518.  
  1519.         })
  1520.  
  1521.        
  1522.  
  1523.          .state('snd.pln_confirm', {
  1524.  
  1525.             url: '/pln_confirm',
  1526.  
  1527.             views: {
  1528.  
  1529.                 'snd': {
  1530.  
  1531.                     templateUrl: 'pln_confirm.html',
  1532.  
  1533.                     controller : 'PLN_confirmController'
  1534.  
  1535.                 }
  1536.  
  1537.             }
  1538.  
  1539.         })
  1540.        
  1541.            
  1542.        
  1543.  
  1544.          .state('snd.pln_summary', {
  1545.  
  1546.             url: '/pln_summary',
  1547.  
  1548.             views: {
  1549.  
  1550.                 'snd': {
  1551.  
  1552.                     templateUrl: 'pln_summary.html',
  1553.  
  1554.                     controller : 'PLN_summaryController'
  1555.  
  1556.                 }
  1557.  
  1558.             }
  1559.  
  1560.         })
  1561.        
  1562.        
  1563.         .state('snd.pln_prepaid', {
  1564.  
  1565.             url: '/pln_prepaid',
  1566.  
  1567.             views: {
  1568.  
  1569.                 'snd': {
  1570.  
  1571.                     templateUrl: 'pln_prepaid.html',
  1572.  
  1573.                     controller : 'PLN_prepaidController'
  1574.  
  1575.                 }
  1576.  
  1577.             }
  1578.  
  1579.         })
  1580.  
  1581.        
  1582.  
  1583.          .state('snd.pln_prepaidconfirm', {
  1584.  
  1585.             url: '/pln_prepaidconfirm',
  1586.  
  1587.             views: {
  1588.  
  1589.                 'snd': {
  1590.  
  1591.                     templateUrl: 'pln_prepaidconfirm.html',
  1592.  
  1593.                     controller : 'PLN_prepaidconfirmController'
  1594.  
  1595.                 }
  1596.  
  1597.             }
  1598.  
  1599.         })
  1600.  
  1601.         .state('snd.plnprepaid_summary', {
  1602.  
  1603.             url: '/pln_prepaidsummary',
  1604.  
  1605.             views: {
  1606.  
  1607.                 'snd': {
  1608.  
  1609.                     templateUrl: 'pln_prepaidsummary.html',
  1610.  
  1611.                     controller : 'PLN_prepaidsummaryController'
  1612.  
  1613.                 }
  1614.  
  1615.             }
  1616.  
  1617.         })
  1618.        
  1619.  
  1620.          .state('snd.pam', {
  1621.  
  1622.             url: '/pam',
  1623.  
  1624.             views: {
  1625.  
  1626.                 'snd': {
  1627.  
  1628.                     templateUrl: 'pam.html',
  1629.  
  1630.                     controller : 'PAMController'
  1631.  
  1632.                 }
  1633.  
  1634.             }
  1635.  
  1636.         })
  1637.  
  1638.        
  1639.  
  1640.         .state('snd.pam_confirm', {
  1641.  
  1642.             url: '/pam_confirm',
  1643.  
  1644.             views: {
  1645.  
  1646.                 'snd': {
  1647.  
  1648.                     templateUrl: 'pam_confirm.html',
  1649.  
  1650.                     controller : 'PAM_confirmController'
  1651.  
  1652.                 }
  1653.  
  1654.             }
  1655.  
  1656.         })
  1657.  
  1658.        
  1659.  
  1660.          .state('snd.pam_summary', {
  1661.  
  1662.             url: '/pam_summary',
  1663.  
  1664.             views: {
  1665.  
  1666.                 'snd': {
  1667.  
  1668.                     templateUrl: 'pam_summary.html',
  1669.  
  1670.                     controller : 'PAM_summaryController'
  1671.  
  1672.                 }
  1673.  
  1674.             }
  1675.  
  1676.         })
  1677.  
  1678.        
  1679.  
  1680.        
  1681.  
  1682.        
  1683.  
  1684.        
  1685.  
  1686.        
  1687.  
  1688.         .state('snd.comingsoon', {
  1689.  
  1690.             url: '/comingsoon',
  1691.  
  1692.             views: {
  1693.  
  1694.                 'snd': {
  1695.  
  1696.                     templateUrl: 'comingsoon.html',
  1697.  
  1698.                     controller : 'ComingsoonController'
  1699.  
  1700.                 }
  1701.  
  1702.             }
  1703.  
  1704.         })
  1705.  
  1706.        
  1707.  
  1708.        
  1709.  
  1710.    
  1711.  
  1712.            
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.     $urlRouterProvider.otherwise('/root');
  1719.  
  1720. }])
  1721.  
  1722. .controller('RootPageController', function($scope, $ionicSideMenuDelegate,$state) {
  1723.  
  1724. console.log("di root");
  1725.  
  1726. $state.go('snd.home');
  1727.  
  1728. })
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736. .controller('NavController', function($scope, $ionicSideMenuDelegate) {
  1737.  
  1738.   $scope.toggleLeft = function() {
  1739.  
  1740.     $ionicSideMenuDelegate.toggleLeft();
  1741.  
  1742.   };
  1743.  
  1744. })
  1745.  
  1746. .controller('FstController', function($scope, $ionicSideMenuDelegate) {
  1747.  
  1748. })
  1749.  
  1750. .controller('FstHomePageController', function($scope, $ionicSideMenuDelegate) {
  1751.  
  1752. })
  1753.  
  1754. .controller('FstFirstPageController', function($scope, $ionicSideMenuDelegate) {
  1755.  
  1756. })
  1757.  
  1758. .controller('FstSecondPageController', function($scope,$localStorage, $ionicSideMenuDelegate) {
  1759.  
  1760. })
  1761.  
  1762.  
  1763.  
  1764. .controller('SndController', function($scope, $ionicSideMenuDelegate) {
  1765.  
  1766. })
  1767.  
  1768. .controller('SndHomePageController', function($scope,$http,$localStorage, $ionicSideMenuDelegate,$ionicPopup) {
  1769.  
  1770. var version="4.0";
  1771.    
  1772.    
  1773. $http.post('http://dxplor.com/dxplor/Mo_balance/get_balance/'+ $localStorage.customerid)
  1774.  
  1775.    
  1776.  
  1777.    
  1778.  
  1779.      .success(function(data, status, headers,config){
  1780.  
  1781.        console.log('data success');
  1782.  
  1783.        console.log(data); // for browser console
  1784.  
  1785.        
  1786.  
  1787.        $scope.balance =  data;
  1788.  
  1789.        
  1790.  
  1791.        
  1792.  
  1793.  
  1794.      
  1795.  
  1796.      })
  1797.  
  1798.      .error(function(data, status, headers,config){
  1799.  
  1800.        console.log('data error');
  1801.  
  1802.        
  1803.  
  1804.    
  1805.  
  1806.      })
  1807.  
  1808.      .then(function(result){
  1809.  
  1810.        things = result.data;
  1811.  
  1812.      });
  1813.  
  1814.  
  1815.  
  1816. $http.get('http://dxplor.com/dxplor/Mo_balance/get_version/')
  1817.  
  1818.    
  1819.  
  1820.    
  1821.  
  1822.      .success(function(data, status, headers,config){
  1823.  
  1824.        console.log('data success');
  1825.  
  1826.        console.log(data); // for browser console
  1827.  
  1828.        
  1829.  
  1830.        $scope.version =  data;
  1831.        
  1832.  
  1833.        console.log('version-->'+version);
  1834.        console.log('version2-->'+$scope.version);
  1835.  
  1836.        if(version!=$scope.version)
  1837.        {
  1838.        console.log("VERSION MISMATCH");
  1839.  
  1840.        var alertPopup = $ionicPopup.alert({
  1841.  
  1842.            title: 'Info',
  1843.  
  1844.            template: 'New DXplor Version Available in App Store, Please update your apps!'
  1845.  
  1846.          });
  1847.  
  1848.        }
  1849.  
  1850.      })
  1851.  
  1852.      .error(function(data, status, headers,config){
  1853.  
  1854.        console.log('data error');
  1855.  
  1856.        
  1857.  
  1858.    
  1859.  
  1860.      })
  1861.  
  1862.      .then(function(result){
  1863.  
  1864.        things = result.data;
  1865.  
  1866.      });
  1867.  
  1868.  
  1869. })
  1870.  
  1871. .controller('SndChatPageController', function($scope, $ionicSideMenuDelegate) {
  1872.  
  1873. })
  1874.  
  1875. .controller('SndChatSinglePageController', function($scope, $ionicSideMenuDelegate) {
  1876.  
  1877. })
  1878.  
  1879. .controller('SndAccountPageController', function($scope,  $state,$ionicSideMenuDelegate,$localStorage,$ionicPopup) {
  1880.  
  1881. console.log("di account");
  1882.  
  1883.  
  1884. if($localStorage.email==null)
  1885.  
  1886. {
  1887.  
  1888. console.log("kosong");
  1889.  
  1890. $scope.login = true;
  1891.  
  1892.  
  1893.  
  1894. }
  1895.  
  1896. else
  1897.  
  1898. {
  1899.  
  1900. console.log("udah login");
  1901.  
  1902. console.log($localStorage.customername);
  1903.  
  1904. $scope.udahlogin = true;
  1905.  
  1906. $scope.nama=$localStorage.customername;
  1907.  
  1908. $scope.email=$localStorage.email;
  1909.  
  1910.  
  1911. }
  1912.  
  1913.  
  1914.  
  1915. $scope.logout = function(){
  1916.  
  1917.  
  1918. $localStorage.$reset();
  1919.  
  1920.  
  1921.   var alertPopup = $ionicPopup.alert({
  1922.  
  1923.            title: 'Info',
  1924.  
  1925.            template: 'Logout Success'
  1926.  
  1927.          });
  1928.  
  1929.    
  1930.  
  1931.   $state.go($state.current, {}, {reload: true});
  1932.  
  1933.  
  1934.  
  1935.        
  1936.  
  1937. }
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945. })
  1946.  
  1947. .controller('SndSignupPageController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$cordovaOauth) {
  1948.  
  1949.  
  1950.  
  1951.  
  1952.  
  1953. $scope.signup = function(fname,lname,email,password,mobile) {
  1954.  
  1955.         console.log('SIGNUP');
  1956.  
  1957.         console.log('fname-->'+fname); // for browser console
  1958.  
  1959.         console.log('lname-->'+lname); // for browser console
  1960.  
  1961.         console.log('email-->'+email); // for browser console
  1962.  
  1963.         console.log('password-->'+password); // for browser console
  1964.  
  1965.         console.log('mobiles-->'+mobile); // for browser console        
  1966.        
  1967.         if(angular.isUndefined(fname))
  1968.         {
  1969.  
  1970.         var alertPopup = $ionicPopup.alert({
  1971.  
  1972.                 title: 'Info',
  1973.  
  1974.                 template: 'First Name  harus diisi'
  1975.  
  1976.               });
  1977.  
  1978.             return false;
  1979.  
  1980.         }
  1981.        
  1982.         if(angular.isUndefined(lname))
  1983.         {
  1984.  
  1985.         var alertPopup = $ionicPopup.alert({
  1986.  
  1987.                 title: 'Info',
  1988.  
  1989.                 template: 'Last Name  harus diisi'
  1990.  
  1991.               });
  1992.  
  1993.             return false;
  1994.  
  1995.         }
  1996.        
  1997.         if(angular.isUndefined(email))
  1998.  
  1999.         {
  2000.  
  2001.         var alertPopup = $ionicPopup.alert({
  2002.  
  2003.                 title: 'Info',
  2004.  
  2005.                 template: 'Email harus diisi'
  2006.  
  2007.               });
  2008.  
  2009.             return false;
  2010.  
  2011.         }
  2012.        
  2013.         if(angular.isUndefined(password))
  2014.  
  2015.         {
  2016.  
  2017.         var alertPopup = $ionicPopup.alert({
  2018.  
  2019.                 title: 'Info',
  2020.  
  2021.                 template: 'Password harus diisi'
  2022.  
  2023.               });
  2024.  
  2025.             return false;
  2026.  
  2027.         }
  2028.        
  2029.         if(angular.isUndefined(mobile))
  2030.  
  2031.         {
  2032.  
  2033.         var alertPopup = $ionicPopup.alert({
  2034.  
  2035.                 title: 'Info',
  2036.  
  2037.                 template: 'Mobile  harus diisi'
  2038.  
  2039.               });
  2040.  
  2041.             return false;
  2042.  
  2043.         }
  2044.  
  2045.           if (/^[0-9]+$/.test(mobile))  
  2046.  
  2047.           {  
  2048.    
  2049.           }  
  2050.  
  2051.           else
  2052.  
  2053.           {
  2054.  
  2055.           var alertPopup = $ionicPopup.alert({
  2056.  
  2057.                 title: 'Info',
  2058.  
  2059.                 template: 'Mobile harus angka'
  2060.  
  2061.               });
  2062.  
  2063.           return false;
  2064.  
  2065.           }
  2066.        
  2067.     $scope.result = "";
  2068.  
  2069.     $http.post('http://dxplor.com/dxplor/index.php/Mo_customer/register', {fname : fname,lname : lname,email : email,password : password,mobile:mobile})
  2070.  
  2071.       .success(function(data, status, headers,config){
  2072.  
  2073.         console.log('data success');
  2074.  
  2075.         console.log(data); // for browser console
  2076.  
  2077.         if(data=="ok")
  2078.  
  2079.         {
  2080.       var alertPopup = $ionicPopup.alert({
  2081.  
  2082.             title: 'Info',
  2083.  
  2084.             template: 'Sign Up Success, Please check your email to activate your account (Please check Spam folder also)'
  2085.  
  2086.           });
  2087.  
  2088. /*    $localStorage.email =email;
  2089.  
  2090.     $http.post('http://dxplor.com/dxplor/Mo_customer/getcustomerid', {email : email})
  2091.  
  2092.   .success(function(data, status, headers,config){
  2093.  
  2094.     console.log('data success');
  2095.  
  2096.     console.log(data); // for browser console
  2097.  
  2098.     $localStorage.customerid = data;
  2099.  
  2100.     console.log('sessionid-->'+$localStorage.customerid)
  2101.  
  2102.   })
  2103.  
  2104.   .error(function(data, status, headers,config){
  2105.  
  2106.     console.log('data error');
  2107.  
  2108.   })
  2109.  
  2110.   .then(function(result){
  2111.  
  2112.     things = result.data;
  2113.  
  2114.   });
  2115.  
  2116.     $http.post('http://dxplor.com/dxplor/Mo_customer/getcustomername', {email : email})
  2117.  
  2118.   .success(function(data, status, headers,config){
  2119.  
  2120.     console.log('data success');
  2121.  
  2122.     console.log(data); // for browser console
  2123.  
  2124.     $localStorage.customername = data;
  2125.  
  2126.     console.log('customername-->'+$localStorage.customername)
  2127.  
  2128.   })
  2129.  
  2130.   .error(function(data, status, headers,config){
  2131.  
  2132.     console.log('data error');
  2133.  
  2134.   })
  2135.  
  2136.   .then(function(result){
  2137.  
  2138.     things = result.data;
  2139.  
  2140.   });
  2141.  
  2142.         $state.go('snd.account');
  2143.  
  2144.         }
  2145.  
  2146.         else
  2147.  
  2148.         {
  2149.  
  2150.         console.log('data-->'+data);
  2151.  
  2152.          
  2153.  
  2154.         var alertPopup = $ionicPopup.alert({
  2155.  
  2156.             title: 'Info',
  2157.  
  2158.             template: 'Sign Up Error (Email Already Exist)'
  2159.  
  2160.           });
  2161.          
  2162.           */
  2163.  
  2164.       $state.go('snd.login');
  2165.  
  2166.         }
  2167.  
  2168.        
  2169.  
  2170.       })
  2171.  
  2172.       .error(function(data, status, headers,config){
  2173.  
  2174.         console.log('data error');
  2175.  
  2176.       })
  2177.  
  2178.       .then(function(result){
  2179.  
  2180.         things = result.data;
  2181.  
  2182.       });
  2183.  
  2184.  
  2185.  
  2186.  
  2187.  
  2188.  
  2189. }
  2190.  
  2191. $scope.googleauth2 = function(){
  2192.     var clientId = "228202475750-485lpunkfcc727uuth3e9midm25qfoln.apps.googleusercontent.com";
  2193.     var clientSecret = "iTH2t9BlpcTTAR64C3Ua3s-5";
  2194.    
  2195.     $cordovaOauth.google(clientId, ["https://www.googleapis.com/auth/urlshortener", "https://www.googleapis.com/auth/userinfo.email"]).then(function(result) {
  2196.         //console.log(clientId + JSON.stringify(result));
  2197.         alert(JSON.stringify(result));
  2198.     }, function(error) {
  2199.         //console.log("Error -> " + error);
  2200.         alert('Error: '+error);
  2201.     });
  2202. }
  2203.  
  2204.  
  2205.  
  2206. $scope.googleauth = function() {
  2207.     $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
  2208.  
  2209. console.log('di googleauth');
  2210.     var requestToken = "";
  2211.     var accessToken = "";
  2212.     //var clientId = "484353778777-0mbklbbdtcmkds5a55bovnht3tfhsokb.apps.googleusercontent.com";
  2213.     //var clientSecret = "DjDDKcTeIWhJLoLilkmlMBPh";
  2214.     var clientId = "228202475750-485lpunkfcc727uuth3e9midm25qfoln.apps.googleusercontent.com";
  2215.     var clientSecret = "iTH2t9BlpcTTAR64C3Ua3s-5";
  2216.  
  2217.      var ref = window.open('https://accounts.google.com/o/oauth2/auth?client_id=' + clientId + '&redirect_uri=http://localhost/callback&scope=email&approval_prompt=force&response_type=code&access_type=offline', '_blank', 'location=no');
  2218.      ref.addEventListener('loadstart', function(event) {
  2219.          if((event.url).startsWith("http://localhost/callback")) {
  2220.              requestToken = (event.url).split("code=")[1];
  2221.             console.log("requestToken-->"+requestToken);
  2222.  
  2223.            
  2224.             $http({method: "post", url: "https://accounts.google.com/o/oauth2/token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=http://localhost/callback" + "&grant_type=authorization_code" + "&code=" + requestToken })
  2225.                  .success(function(data) {
  2226.                      accessToken = data.access_token;
  2227.                         console.log("ACCESSTOKEN-->"+accessToken);
  2228.                         $scope.datates=accessToken;
  2229.                        
  2230.                         $http.get('https://www.googleapis.com/plus/v1/people/me?access_token='+accessToken)
  2231.  
  2232.                         .success(function(data, status, headers,config){
  2233.  
  2234.                           console.log('data success');
  2235.  
  2236.                           console.log(data); // for browser console
  2237.                                    //.success(function(data) {
  2238.                                  
  2239.                                         $scope.datates=data;
  2240.                                         console.log("data-->"+data);
  2241.                                          /*var param = {
  2242.                                                    provider: 'google',
  2243.                                                      google: {
  2244.                                                                    uid: data["id"],
  2245.                                                                    provider: 'google',
  2246.                                                                    first_name: data["name"]["givenName"],
  2247.                                                                    last_name: data["name"]["familyName"],
  2248.                                                                    email: data.emails[0]["value"],
  2249.                                                                    image: data.image.url
  2250.                                                                }
  2251.                                                    };
  2252.                                                    console.log(param);
  2253.                                                    */
  2254.                                        
  2255.                                         console.log("fname-->"+data["name"]["givenName"]);
  2256.                                         console.log("lastname-->"+data["name"]["familyName"]);
  2257.                                         console.log("email-->"+data.emails[0]["value"]);
  2258.                                        
  2259.                                         var name=data["name"]["givenName"]+' '+data["name"]["familyName"];
  2260.                                         var email=data.emails[0]["value"];
  2261.                                         //Check email exist
  2262.                                         $http.post('http://dxplor.com/dxplor/Mo_customer/checkemailexist', {email : data.emails[0]["value"]})
  2263.                                         .success(function(data, status, headers,config){
  2264.                                           console.log('data success');
  2265.                                           console.log(data); // for browser console
  2266.                                          if(data!="notexist")
  2267.                                              {
  2268.                                              
  2269.  
  2270.                                                 var res = data.split(";");
  2271.                                                 $localStorage.customerid = res[0];
  2272.                                                 console.log("custid-->"+$localStorage.customerid);  
  2273.                                                 $localStorage.customername = res[1];
  2274.                                                 console.log("custname-->"+$localStorage.customername);
  2275.                                                 $localStorage.email =  res[2];
  2276.                                                 console.log("custemail-->"+$localStorage.email);
  2277.                                                 $state.go('snd.account');
  2278.  
  2279.                                              
  2280.                                              }
  2281.                                          else
  2282.                                              {
  2283.                                              // Signup Google
  2284.                                              
  2285.                                              console.log("Signup Google");
  2286.                                              $localStorage.email=email;
  2287.                                              console.log("Signup Google Email"+$localStorage.email);
  2288.  
  2289.                                              $http.post('http://dxplor.com/dxplor/index.php/Mo_customer/register_social', {fname : name,email : email})
  2290.  
  2291.                                              .success(function(data, status, headers,config){
  2292.  
  2293.                                                console.log('data success register_social');
  2294.  
  2295.                                                console.log(data); // for browser console
  2296.  
  2297.                                                if(data=="ok")
  2298.  
  2299.                                                {
  2300.                                              var alertPopup = $ionicPopup.alert({
  2301.  
  2302.                                                    title: 'Info',
  2303.  
  2304.                                                    template: 'Sign Up Success'
  2305.  
  2306.                                                  });
  2307.  
  2308.                                            $localStorage.email =email;
  2309.  
  2310.                                          //  $http.post('http://dxplor.com/dxplor/Mo_balance/confirm_topup', {customerid : $localStorage.customerid,tobank : tobank,amount : amount,todate : todate,fromname : fromname,fromno : fromno,frombank : frombank})
  2311.  
  2312.                                            $http.post('http://dxplor.com/dxplor/Mo_customer/getcustomerid', {email : email})
  2313.  
  2314.                                          .success(function(data, status, headers,config){
  2315.  
  2316.                                            console.log('data success');
  2317.  
  2318.                                            console.log(data); // for browser console
  2319.  
  2320.                                            $localStorage.customerid = data;
  2321.  
  2322.                                            console.log('sessionid-->'+$localStorage.customerid)
  2323.                                            
  2324.                                            $http.post('http://dxplor.com/dxplor/Mo_customer/getcustomername', {email : email})
  2325.  
  2326.                                            .success(function(data, status, headers,config){
  2327.  
  2328.                                              console.log('data success');
  2329.  
  2330.                                              console.log(data); // for browser console
  2331.  
  2332.                                              $localStorage.customername = data;
  2333.  
  2334.                                              console.log('customername-->'+$localStorage.customername)
  2335.                                              $state.go('snd.account');
  2336.  
  2337.                                            })
  2338.  
  2339.                                            .error(function(data, status, headers,config){
  2340.  
  2341.                                              console.log('data error');
  2342.  
  2343.                                            })
  2344.  
  2345.                                            .then(function(result){
  2346.  
  2347.                                              things = result.data;
  2348.  
  2349.                                            });
  2350.                                              
  2351.  
  2352.                                          })
  2353.  
  2354.                                          .error(function(data, status, headers,config){
  2355.  
  2356.                                            console.log('data error');
  2357.  
  2358.                                          })
  2359.  
  2360.                                          .then(function(result){
  2361.  
  2362.                                            things = result.data;
  2363.  
  2364.                                          });
  2365.  
  2366.                                            ///////////
  2367.                                          
  2368.                                              
  2369.                                              // END Signup Facebook
  2370.                                                }
  2371.                                              })
  2372.                                              
  2373.  
  2374.                                              .error(function(data, status, headers,config){
  2375.  
  2376.                                                console.log('data error');
  2377.  
  2378.                                              })
  2379.  
  2380.                                              .then(function(result){
  2381.  
  2382.                                                things = result.data;
  2383.  
  2384.                                              });
  2385.                                              }
  2386.  
  2387.                                          
  2388.                                         })
  2389.                                         .error(function(data, status, headers,config){
  2390.                                         console.log('data error');
  2391.                                         })
  2392.                                         .then(function(result){
  2393.                                           things = result.data;
  2394.                                         });
  2395.  
  2396.                                         ref.close();
  2397.                                    })
  2398.                                    .error(function(data, status) {
  2399.                                        console.log("ERROR: " + data);
  2400.                                         $scope.datates="eeee";
  2401.                                          ref.close();
  2402.                                    });
  2403.                                    
  2404.                  })
  2405.                  .error(function(data, status) {
  2406.                      console.log("ERROR: " + data);
  2407.                     $scope.datates="ccc";
  2408.                     ref.close();
  2409.                  });
  2410.            
  2411.              
  2412.            //  $http.get('https://www.googleapis.com/plus/v1/people/me?access_token=ya29.Ci9eA7uJ9pVM61aB_oz85FvL6xtai2PkUlpklpFSXfsD6AOe7R5wRyjtAcWLXxz0Ug')
  2413.  
  2414.              
  2415.             // $http({method: "get", url: "https://www.googleapis.com/plus/v1/people/me", data: "access_token=" + accessToken})
  2416.           //  accessToken= "ya29.Ci-wAzSnDI0hY3iwmXpiFXIxoPsrvhzborCZRfLlvgtqt0jPrCZ0VUbRKDQ_2knaLw";
  2417.    
  2418.          
  2419.          }
  2420.    
  2421.     });
  2422.    
  2423.    
  2424.    
  2425. }
  2426.  
  2427.  
  2428. //Facebook Auth
  2429.  
  2430. $scope.facebookauth = function() {
  2431.  
  2432. console.log('di facebookauth');
  2433.    
  2434.          
  2435.    
  2436. $cordovaOauth.facebook("1079162598831487", ["email", "user_website", "user_location", "user_relationships"]).then(function(result) {
  2437. $localStorage.accessToken = result.access_token;
  2438. console.log("accesstoken-->"+$localStorage.accessToken);
  2439.  
  2440. console.log("accesstoken2-->"+$localStorage.accessToken);
  2441.  
  2442. console.log("cek accesstoken4")
  2443.  
  2444. if($localStorage.accessToken) {
  2445.     $http.get("https://graph.facebook.com/v2.2/me", { params: { access_token: $localStorage.accessToken, fields: "id,name,gender,email", format: "json" }}).then(function(result) {
  2446.         $scope.profileData = result.data;
  2447.         console.log("ProfileData-->"+$scope.profileData);
  2448.         console.log("name-->"+$scope.profileData.name);
  2449.         console.log("name2-->"+$scope.profileData['name']);
  2450.         console.log("email-->"+$scope.profileData.email);
  2451.        
  2452.         //Check email exist
  2453.         $http.post('http://dxplor.com/dxplor/Mo_customer/checkemailexist', {email : $scope.profileData.email})
  2454.         .success(function(data, status, headers,config){
  2455.           console.log('data success');
  2456.           console.log(data); // for browser console
  2457.          if(data!="notexist")
  2458.              {
  2459.              
  2460.  
  2461.                 var res = data.split(";");
  2462.                 $localStorage.customerid = res[0];
  2463.                 console.log("custid-->"+$localStorage.customerid);  
  2464.                 $localStorage.customername = res[1];
  2465.                 console.log("custname-->"+$localStorage.customername);
  2466.                 $localStorage.email =  res[2];
  2467.                 console.log("custemail-->"+$localStorage.email);
  2468.                 $state.go('snd.account');
  2469.  
  2470.              
  2471.              }
  2472.          else
  2473.              {
  2474.              // Signup Facebook
  2475.              
  2476.              $localStorage.email=$scope.profileData.email;
  2477.              $http.post('http://dxplor.com/dxplor/index.php/Mo_customer/register_social', {fname : $scope.profileData.name,email : $scope.profileData.email})
  2478.  
  2479.              .success(function(data, status, headers,config){
  2480.  
  2481.                console.log('data success');
  2482.  
  2483.                console.log(data); // for browser console
  2484.  
  2485.                if(data=="ok")
  2486.  
  2487.                {
  2488.              var alertPopup = $ionicPopup.alert({
  2489.  
  2490.                    title: 'Info',
  2491.  
  2492.                    template: 'Sign Up Success'
  2493.  
  2494.                  });
  2495.  
  2496.            $localStorage.email =$scope.profileData.email;
  2497.  
  2498.          //  $http.post('http://dxplor.com/dxplor/Mo_balance/confirm_topup', {customerid : $localStorage.customerid,tobank : tobank,amount : amount,todate : todate,fromname : fromname,fromno : fromno,frombank : frombank})
  2499.  
  2500.            $http.post('http://dxplor.com/dxplor/Mo_customer/getcustomerid', {email : $scope.profileData.email})
  2501.  
  2502.          .success(function(data, status, headers,config){
  2503.  
  2504.            console.log('data success');
  2505.  
  2506.            console.log(data); // for browser console
  2507.  
  2508.            $localStorage.customerid = data;
  2509.  
  2510.            console.log('sessionid-->'+$localStorage.customerid)
  2511.            
  2512.            $http.post('http://dxplor.com/dxplor/Mo_customer/getcustomername', {email : $scope.profileData.email})
  2513.  
  2514.            .success(function(data, status, headers,config){
  2515.  
  2516.              console.log('data success');
  2517.  
  2518.              console.log(data); // for browser console
  2519.  
  2520.              $localStorage.customername = data;
  2521.  
  2522.              console.log('customername-->'+$localStorage.customername)
  2523.              $state.go('snd.account');
  2524.  
  2525.            })
  2526.  
  2527.            .error(function(data, status, headers,config){
  2528.  
  2529.              console.log('data error');
  2530.  
  2531.            })
  2532.  
  2533.            .then(function(result){
  2534.  
  2535.              things = result.data;
  2536.  
  2537.            });
  2538.              
  2539.  
  2540.          })
  2541.  
  2542.          .error(function(data, status, headers,config){
  2543.  
  2544.            console.log('data error');
  2545.  
  2546.          })
  2547.  
  2548.          .then(function(result){
  2549.  
  2550.            things = result.data;
  2551.  
  2552.          });
  2553.  
  2554.            ///////////
  2555.          
  2556.              
  2557.              // END Signup Facebook
  2558.                }
  2559.              })
  2560.              
  2561.  
  2562.              .error(function(data, status, headers,config){
  2563.  
  2564.                console.log('data error');
  2565.  
  2566.              })
  2567.  
  2568.              .then(function(result){
  2569.  
  2570.                things = result.data;
  2571.  
  2572.              });
  2573.              }
  2574.  
  2575.          
  2576.         })
  2577.         .error(function(data, status, headers,config){
  2578.         console.log('data error');
  2579.         })
  2580.         .then(function(result){
  2581.           things = result.data;
  2582.         });
  2583.  
  2584.     }, function(error) {
  2585.         alert("There was a problem getting your profile.  Check the logs for details.");
  2586.         console.log(error);
  2587.     });
  2588. } else {
  2589.     alert("Not signed in");
  2590.  //   $location.path("/login");
  2591. }
  2592.  
  2593. //   $location.path("/profile");
  2594. }, function(error) {
  2595. alert("There was a problem signing in!  See the console for logs");
  2596. console.log(error);
  2597. });
  2598.  
  2599.    
  2600.    
  2601. }
  2602.  
  2603.  
  2604. //End Facebook Auth
  2605.  
  2606.  
  2607. })
  2608.  
  2609.  
  2610.  
  2611. .controller('TransferDpayController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state) {
  2612.  
  2613. console.log('Di Transfer DPAY');
  2614.  
  2615. $scope.paramro=true;
  2616.  
  2617. $scope.radiochange= function(value){
  2618. console.log("radiochangeaa"+value);
  2619. $scope.paramro=true;
  2620. $scope.amount=value;
  2621. if(value=='other')
  2622.     {
  2623.  
  2624. $scope.paramro=false;
  2625.     }
  2626. }
  2627.  
  2628. $scope.transfer = function(amount,email,password) {
  2629.  
  2630.  
  2631.  
  2632. console.log('amount-->'+amount)
  2633. console.log('email-->'+email)
  2634.  
  2635.  
  2636.  
  2637.   if($localStorage.email==null)
  2638.  
  2639.     {
  2640.  
  2641.     console.log("belum login");
  2642.  
  2643.        
  2644.  
  2645.         var alertPopup = $ionicPopup.alert({
  2646.  
  2647.             title: 'Info',
  2648.  
  2649.             template: 'Please Login first to Transfer Dpay'
  2650.  
  2651.           });
  2652.  
  2653.    
  2654.  
  2655.         $state.go('snd.login');
  2656.  
  2657. return false;}
  2658.  
  2659.  
  2660.  
  2661.     if(angular.isUndefined(amount))
  2662.  
  2663.   {
  2664.  
  2665.  
  2666.  
  2667.        
  2668.  
  2669.         var alertPopup = $ionicPopup.alert({
  2670.  
  2671.             title: 'Info',
  2672.  
  2673.             template: 'Amount harus diisi'
  2674.  
  2675.           });
  2676.  
  2677.    
  2678.  
  2679. return false;
  2680.  
  2681.   }
  2682.  
  2683.    
  2684.     if(angular.isUndefined(email))
  2685.  
  2686.     {
  2687.  
  2688.    
  2689.  
  2690.          
  2691.  
  2692.           var alertPopup = $ionicPopup.alert({
  2693.  
  2694.               title: 'Info',
  2695.  
  2696.               template: 'Email tujuan harus diisi'
  2697.  
  2698.             });
  2699.  
  2700.      
  2701.  
  2702.   return false;
  2703.  
  2704.     }
  2705.  
  2706.     if(email==$localStorage.email)
  2707.  
  2708.     {
  2709.  
  2710.    
  2711.  
  2712.          
  2713.  
  2714.           var alertPopup = $ionicPopup.alert({
  2715.  
  2716.               title: 'Info',
  2717.  
  2718.               template: 'Email tujuan tidak boleh email sendiri'
  2719.  
  2720.             });
  2721.  
  2722.      
  2723.  
  2724.   return false;
  2725.  
  2726.     }
  2727.    
  2728.    
  2729.     if(angular.isUndefined(password))
  2730.  
  2731.  
  2732.  
  2733.     {
  2734.  
  2735.     var alertPopup = $ionicPopup.alert({
  2736.  
  2737.             title: 'Info',
  2738.  
  2739.             template: 'Password harus diisi'
  2740.           });
  2741.  
  2742.         return false;
  2743.  
  2744.     }
  2745.  
  2746.    
  2747.    
  2748.    
  2749.  
  2750.     $http.post('http://dxplor.com/dxplor/Mo_customer/login', {uname : $localStorage.email,password : password})
  2751.  
  2752.     .success(function(data, status, headers,config){
  2753.  
  2754.     console.log('data success');
  2755.  
  2756.     console.log(data); // for browser console
  2757.  
  2758.     var res = data.split(",");
  2759.  
  2760.     console.log(res[0]);
  2761.  
  2762.     if(res[0]=="ok")
  2763.  
  2764.     {
  2765.  
  2766.            
  2767.  
  2768.         $http.post('http://dxplor.com/dxplor/Mo_balance/get_balance/'+ $localStorage.customerid)
  2769.  
  2770.                
  2771.  
  2772.                
  2773.  
  2774.                 .success(function(data, status, headers,config){
  2775.  
  2776.                   console.log(data); // for browser console
  2777.  
  2778.                  
  2779.  
  2780.                   $scope.balance =  data;
  2781.  
  2782.                  
  2783.  
  2784.                 console.log("balance-->"+$scope.balance);
  2785.  
  2786.                 console.log("balance yang mau ditransfer-->"+amount);
  2787.                
  2788.  
  2789.                  
  2790.  
  2791.                if(parseInt($scope.balance) < parseInt(amount))
  2792.  
  2793.                    {
  2794.  
  2795.                  
  2796.                    var alertPopup = $ionicPopup.alert({
  2797.  
  2798.                        title: 'Info',
  2799.  
  2800.                        template: 'Saldo Dpay tidak cukup untuk melakukan transfer'
  2801.  
  2802.                      });
  2803.  
  2804.                    return false;
  2805.  
  2806.                    console.log("didnt have enough balance");
  2807.  
  2808.  
  2809.  
  2810.                    }
  2811.                else
  2812.                    {
  2813.                    
  2814.                     console.log("cukup balance");
  2815.                    if((parseInt($scope.balance)  - parseInt(amount)) < 10000)
  2816.  
  2817.                    {
  2818.  
  2819.                     console.log("cukup balance");
  2820.  
  2821.                    var alertPopup = $ionicPopup.alert({
  2822.  
  2823.                        title: 'Info',
  2824.  
  2825.                        template: 'Minimum sisa saldo Dpay untuk transfer adalah Rp 10,000'
  2826.  
  2827.                      });
  2828.  
  2829.                    return false;
  2830.  
  2831.  
  2832.  
  2833.                    
  2834.  
  2835.                    }
  2836.                    $state.go('snd.transfer_dpay_confirmation/:email/:amount',{email:email,amount:amount});
  2837.  
  2838.                    }
  2839.  
  2840.                 })
  2841.                   .error(function(data, status, headers,config){
  2842.  
  2843.           console.log('data error');
  2844.           var alertPopup = $ionicPopup.alert({
  2845.  
  2846.               title: 'Info',
  2847.  
  2848.               template: 'Transfer Error, Plese contact dxplor Admin'
  2849.  
  2850.             });
  2851.           return false;
  2852.  
  2853.  
  2854.         })
  2855.  
  2856.         .then(function(result){
  2857.  
  2858.           things = result.data;
  2859.  
  2860.         });
  2861.  
  2862.  
  2863.     }
  2864.  
  2865.     else
  2866.  
  2867.     {
  2868.  
  2869.     console.log("Login error");
  2870.  
  2871.     var alertPopup = $ionicPopup.alert({
  2872.  
  2873.         title: 'Info',
  2874.  
  2875.         template: 'Wrong Password'
  2876.  
  2877.       });
  2878.     return false;
  2879.    
  2880.  
  2881.     }
  2882.  
  2883.   })
  2884.  
  2885.   .error(function(data, status, headers,config){
  2886.  
  2887.     console.log('data error');
  2888.    
  2889.     var alertPopup = $ionicPopup.alert({
  2890.  
  2891.         title: 'Info',
  2892.  
  2893.         template: 'Transfer Error, Plese contact dxplor Admin'
  2894.  
  2895.       });
  2896.  
  2897.   })
  2898.  
  2899.   .then(function(result){
  2900.  
  2901.     things = result.data;
  2902.  
  2903.   });
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.      
  2911.  
  2912.  
  2913.  
  2914.  
  2915.  
  2916.  
  2917.  
  2918.  
  2919. }
  2920.  
  2921.  
  2922.  
  2923.  
  2924. })
  2925.  
  2926.  
  2927.  
  2928.  
  2929. .controller('TransferDpayConfirmController', function($scope, $stateParams,$localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state) {
  2930.  
  2931.  
  2932. $scope.isDisabled = false;
  2933.  
  2934. console.log("di Transfer Dpay confirm controllers");
  2935.  
  2936. $scope.amount=$stateParams.amount;
  2937. $scope.email=$stateParams.email;
  2938.  
  2939.  
  2940. $http.post('http://dxplor.com/dxplor/Mo_balance/get_balance/'+ $localStorage.customerid)
  2941.  
  2942.    
  2943.  
  2944.  
  2945.  
  2946. .success(function(data, status, headers,config){
  2947.  
  2948.   console.log(data); // for browser console
  2949.  
  2950.  
  2951.  
  2952.   $scope.balance =  data;
  2953.  
  2954.  
  2955.  
  2956.     console.log("balance-->"+$scope.balance);
  2957.  
  2958.     console.log("balance yang mau ditransfer-->"+$scope.amount);
  2959.    
  2960.  
  2961.  
  2962.  
  2963. if(parseInt($scope.balance) < parseInt($scope.amount))
  2964.  
  2965.    {
  2966.  
  2967.      
  2968.    var alertPopup = $ionicPopup.alert({
  2969.  
  2970.        title: 'Info',
  2971.  
  2972.        template: 'Saldo Dpay tidak cukup untuk melakukan transfer'
  2973.  
  2974.      });
  2975.  
  2976.     $state.go('snd.home');
  2977.     return false;
  2978.    console.log("didnt have enough balance");
  2979.    }
  2980. else
  2981.    {
  2982.    
  2983.    console.log("cukup balance");
  2984.    if((parseInt($scope.balance)  - parseInt($scope.amount)) < 10000)
  2985.  
  2986.    {
  2987.  
  2988.         console.log("cukup balance");
  2989.  
  2990.    var alertPopup = $ionicPopup.alert({
  2991.  
  2992.        title: 'Info',
  2993.  
  2994.        template: 'Minimum sisa saldo Dpay untuk transfer adalah Rp 10,000'
  2995.  
  2996.      });
  2997.  
  2998.     $state.go('snd.home');
  2999.    return false;
  3000.  
  3001.  
  3002.  
  3003.    
  3004.  
  3005.    }
  3006.    $state.go('snd.transfer_dpay_confirmation/:email/:amount',{email:email,amount:amount});
  3007.  
  3008.    }
  3009.  
  3010. })
  3011.   .error(function(data, status, headers,config){
  3012.  
  3013. console.log('data error');
  3014. var alertPopup = $ionicPopup.alert({
  3015.  
  3016. title: 'Info',
  3017.  
  3018. template: 'Transfer Error, Plese contact dxplor Admin'
  3019.  
  3020. });
  3021. return false;
  3022.  
  3023.  
  3024. })
  3025.  
  3026. .then(function(result){
  3027.  
  3028. things = result.data;
  3029.  
  3030. });
  3031.  
  3032.  
  3033.  
  3034. $http.post('http://dxplor.com/dxplor/Mo_customer/checkemailid',{email : $stateParams.email})
  3035.  
  3036.     .success(function(data, status, headers,config){
  3037.  
  3038.       console.log('data success');
  3039.  
  3040.       console.log(data); // for browser console
  3041.  
  3042.      
  3043.      
  3044.  
  3045.       if(data=="notexist")    
  3046.  
  3047.       {
  3048.  
  3049.         var alertPopup = $ionicPopup.alert({
  3050.  
  3051.             title: 'Info',
  3052.  
  3053.             template: 'Email Tujuan tidak ada, silahkan cek kembali'
  3054.  
  3055.           });
  3056.  
  3057.         $state.go('snd.transfer_dpay');
  3058.  
  3059.       }
  3060.       else
  3061.           {
  3062.          
  3063.           var res = data.split("-");
  3064.  
  3065. $scope.name=res[0]+" "+res[1];
  3066.  
  3067. $scope.custid=res[2];
  3068.  
  3069.  
  3070. $scope.actid=res[3];
  3071.  
  3072. if($scope.actid!="VIP")
  3073.     {
  3074.     $scope.actid="REGULAR";
  3075.     }
  3076.  
  3077. console.log('customer id to-->'+$scope.custid);
  3078.  
  3079.            
  3080. console.log('act id -->'+$scope.actid);
  3081.  
  3082.  
  3083.          
  3084.          
  3085.           }
  3086.  
  3087.      
  3088.  
  3089.  
  3090.     })
  3091.  
  3092.     .error(function(data, status, headers,config){
  3093.  
  3094.       console.log('data error');
  3095.  
  3096.     })
  3097.  
  3098.     .then(function(result){
  3099.  
  3100.       things = result.data;
  3101.  
  3102.     });
  3103.  
  3104.  
  3105.  
  3106. $scope.transfer = function() {
  3107.  
  3108.  
  3109.       $scope.isDisabled = true;
  3110.  
  3111.   if($localStorage.email==null)
  3112.  
  3113.     {
  3114.  
  3115.     console.log("belum login");
  3116.  
  3117.        
  3118.  
  3119.         var alertPopup = $ionicPopup.alert({
  3120.  
  3121.             title: 'Info',
  3122.  
  3123.             template: 'Please Login first to Confirm Transfer Dpay'
  3124.  
  3125.           });
  3126.  
  3127.    
  3128.  
  3129.         $state.go('snd.login');
  3130.  
  3131.         $scope.login=false;
  3132.  
  3133.     }
  3134.  
  3135.  
  3136.  
  3137.     $scope.result = "";
  3138.  
  3139.     $http.post('http://dxplor.com/dxplor/Mo_balance/transfer_dpay', {custidto : $scope.custid,amount : $scope.amount,customerid : $localStorage.customerid,custidtotype : $scope.actid})
  3140.  
  3141.       .success(function(data, status, headers,config){
  3142.  
  3143.             $scope.isDisabled = false;
  3144.  
  3145.          
  3146.         console.log('data success');
  3147.  
  3148.         console.log(data); // for browser console
  3149.  
  3150.  
  3151.         if(data=="ok")
  3152.  
  3153.         {
  3154.  
  3155.          
  3156.  
  3157.         var alertPopup = $ionicPopup.alert({
  3158.  
  3159.             title: 'Info',
  3160.  
  3161.             template: 'Transfer Dpay Success'
  3162.  
  3163.           });
  3164.  
  3165.  
  3166.  
  3167.         $state.go('snd.home');
  3168.        
  3169.        
  3170.  
  3171.         }
  3172.  
  3173.         else
  3174.  
  3175.         {
  3176.  
  3177.          
  3178.  
  3179.         var alertPopup = $ionicPopup.alert({
  3180.  
  3181.             title: 'Info',
  3182.  
  3183.             template: 'Transfer Dpay Error, please contact admin'
  3184.  
  3185.           });
  3186.  
  3187.         }
  3188.  
  3189.        
  3190.  
  3191.       })
  3192.  
  3193.       .error(function(data, status, headers,config){
  3194.             $scope.isDisabled = false;
  3195.  
  3196.           var alertPopup = $ionicPopup.alert({
  3197.  
  3198.               title: 'Info',
  3199.  
  3200.               template: 'Transfer Dpay Error, please contact admin'
  3201.  
  3202.             });
  3203.          
  3204.         console.log('data error');
  3205.  
  3206.       })
  3207.  
  3208.       .then(function(result){
  3209.             $scope.isDisabled = false;
  3210.  
  3211.         things = result.data;
  3212.  
  3213.       });
  3214.  
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220. }
  3221.  
  3222.  
  3223. $scope.cancel = function() {
  3224.  
  3225.     $scope.isDisabled = false;
  3226.  
  3227.  
  3228.   $state.go('snd.transfer_dpay');
  3229.  
  3230.  
  3231.  
  3232.   }
  3233.  
  3234.  
  3235.  
  3236. })
  3237.  
  3238.  
  3239. .controller('TopupController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state) {
  3240.  
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246. $http.get('http://dxplor.com/dxplor/Mo_balance/get_topup_order/'+$localStorage.customerid)
  3247.  
  3248.     .success(function(data, status, headers,config){
  3249.  
  3250.       console.log('data success');
  3251.  
  3252.       console.log(data); // for browser console
  3253.  
  3254.      
  3255.  
  3256.     //  var res = data.split(",");
  3257.  
  3258.      
  3259.  
  3260.       if(data=="exist")
  3261.  
  3262.      
  3263.  
  3264.       {
  3265.  
  3266.       /*    var alertPopup = $ionicPopup.alert({
  3267.  
  3268.             title: 'Info',
  3269.  
  3270.             template: 'Anda sudah melakukan request topup, harap menunggu sampai admin melakukan approval'
  3271.  
  3272.           });
  3273. */
  3274.         $state.go('snd.topup_confirmation');
  3275.  
  3276.       }
  3277.  
  3278.  
  3279.  
  3280.      
  3281.  
  3282.     //  $scope.amount =  res[0];
  3283.  
  3284.      // $scope.id=res[1];
  3285.  
  3286.      // console.log(data[0].NAME);
  3287.  
  3288.     })
  3289.  
  3290.     .error(function(data, status, headers,config){
  3291.  
  3292.       console.log('data error');
  3293.  
  3294.     })
  3295.  
  3296.     .then(function(result){
  3297.  
  3298.       things = result.data;
  3299.  
  3300.     });
  3301.  
  3302.  
  3303. /*
  3304. $http.get('http://dxplor.com/dxplor/Mo_balance/get_topup_value')
  3305.  
  3306. .success(function(data, status, headers,config){
  3307.  
  3308.   console.log('data success');
  3309.  
  3310.   console.log(data); // for browser console
  3311.  
  3312. $scope.topupvalue=data;
  3313.  
  3314.  
  3315.  
  3316.  
  3317.  
  3318. })
  3319.  
  3320. .error(function(data, status, headers,config){
  3321.  
  3322.   console.log('data error');
  3323.  
  3324. })
  3325.  
  3326. .then(function(result){
  3327.  
  3328.   things = result.data;
  3329.  
  3330. });
  3331. */
  3332.  
  3333.  
  3334. $scope.paramro=true;
  3335.  
  3336. $scope.radiochange= function(value){
  3337. console.log("radiochangeaa"+value);
  3338. $scope.paramro=true;
  3339. $scope.amount=value;
  3340. if(value=='other')
  3341.     {
  3342.  
  3343. $scope.paramro=false;
  3344.     }
  3345. }
  3346.  
  3347. $scope.topup = function(amount,tobank) {
  3348.  
  3349.  
  3350.  
  3351. console.log('amount-->'+amount)
  3352.  
  3353.  
  3354.  
  3355.   if($localStorage.email==null)
  3356.  
  3357.     {
  3358.  
  3359.     console.log("belum login");
  3360.  
  3361.        
  3362.  
  3363.         var alertPopup = $ionicPopup.alert({
  3364.  
  3365.             title: 'Info',
  3366.  
  3367.             template: 'Please Login first to Topup'
  3368.  
  3369.           });
  3370.  
  3371.    
  3372.  
  3373.         $state.go('snd.login');
  3374.  
  3375. return false;}
  3376.  
  3377.  
  3378.  
  3379.     if(angular.isUndefined(amount))
  3380.  
  3381.   {
  3382.  
  3383.  
  3384.  
  3385.        
  3386.  
  3387.         var alertPopup = $ionicPopup.alert({
  3388.  
  3389.             title: 'Info',
  3390.  
  3391.             template: 'Amount harus diisi'
  3392.  
  3393.           });
  3394.  
  3395.    
  3396.  
  3397. return false;
  3398.  
  3399.   }
  3400.  
  3401.      
  3402.  
  3403.     console.log('tobank-->'+tobank);
  3404.  
  3405.      
  3406.  
  3407.     if(angular.isUndefined(tobank) || tobank=="")
  3408.  
  3409.   {
  3410.  
  3411.  
  3412.  
  3413.        
  3414.  
  3415.         var alertPopup = $ionicPopup.alert({
  3416.  
  3417.             title: 'Info',
  3418.  
  3419.             template: 'To Dxplor Bank Account harus dipilih'
  3420.  
  3421.           });
  3422.  
  3423.    
  3424.  
  3425. return false;
  3426.  
  3427.   }
  3428.  
  3429.  
  3430.  
  3431.   if(parseInt(amount)<20000)
  3432.  
  3433.   {
  3434.  
  3435.  
  3436.  
  3437.        
  3438.  
  3439.         var alertPopup = $ionicPopup.alert({
  3440.  
  3441.             title: 'Info',
  3442.  
  3443.             template: 'Min Topup is Rp 20,000'
  3444.  
  3445.           });
  3446.  
  3447.    
  3448.  
  3449. return false;
  3450.  
  3451.   }
  3452.  
  3453. //  var x = 5;
  3454. //  var y = 2;
  3455.     var z = parseInt(amount) % 10000;
  3456.    
  3457.     console.log("Z--->"+z);
  3458.     if(parseInt(z)!=0)
  3459.     {
  3460.           var alertPopup = $ionicPopup.alert({
  3461.  
  3462.                 title: 'Info',
  3463.  
  3464.                 template: 'Amount Topup harus kelipatan Rp 10,000'
  3465.  
  3466.               });  
  3467.          
  3468.           return false;
  3469.     }
  3470.    
  3471.  
  3472.  
  3473.   var min = 1;
  3474.  
  3475.   var max = 1000;
  3476.  
  3477.   var num = Math.floor(Math.random() * (max - min + 1)) + min;
  3478.  
  3479.   console.log("random number-->"+num);
  3480.  
  3481.   $scope.amount=parseInt(amount)+parseInt(num);
  3482.  
  3483.  
  3484.   $http.post('http://dxplor.com/dxplor/Mo_balance/topup_new', {tobank : tobank,checksum : num,amount :  $scope.amount,customerid : $localStorage.customerid})
  3485.  
  3486.   .success(function(data, status, headers,config){
  3487.  
  3488.     console.log('data success');
  3489.  
  3490.     console.log(data); // for browser console
  3491.  
  3492.    
  3493.     $scope.isDisabled = false;
  3494.  
  3495.    
  3496.  
  3497.    
  3498.  
  3499.     if(data=="ok")
  3500.  
  3501.     {
  3502.  
  3503.      
  3504.  
  3505.    /* var alertPopup = $ionicPopup.alert({
  3506.  
  3507.         title: 'Info',
  3508.  
  3509.         template: 'Topup Request Success'
  3510.  
  3511.       });
  3512. */
  3513.    
  3514.  
  3515.    
  3516.  
  3517.    
  3518.  
  3519.  
  3520.  
  3521.  
  3522.  
  3523.    
  3524.  
  3525.     $state.go('snd.topup_confirmation');
  3526.    
  3527.    
  3528.  
  3529.     }
  3530.  
  3531.     else
  3532.  
  3533.     {
  3534.  
  3535.      
  3536.  
  3537.     var alertPopup = $ionicPopup.alert({
  3538.  
  3539.         title: 'Info',
  3540.  
  3541.         template: 'Topup Request Error'
  3542.  
  3543.       });
  3544.  
  3545.     }
  3546.  
  3547.    
  3548.  
  3549.   })
  3550.  
  3551.   .error(function(data, status, headers,config){
  3552.  
  3553.     console.log('data error');
  3554.    
  3555.     $scope.isDisabled = false;
  3556.  
  3557.     var alertPopup = $ionicPopup.alert({
  3558.  
  3559.         title: 'Info',
  3560.  
  3561.         template: 'Topup Request Error'
  3562.  
  3563.       });
  3564.  
  3565.   })
  3566.  
  3567.   .then(function(result){
  3568.       $scope.isDisabled = false;
  3569.  
  3570.     things = result.data;
  3571.  
  3572.   });
  3573.  
  3574.  
  3575.  
  3576.   //$state.go('snd.topup_order/:amount/:bank',{amount:amount,bank:tobank});
  3577.  
  3578.  
  3579.  
  3580.  
  3581. }
  3582.  
  3583.  
  3584.  
  3585.  
  3586. })
  3587.  
  3588.  
  3589.  
  3590.  
  3591.  
  3592.  
  3593.  
  3594. .controller('TopupOrderController', function($scope, $stateParams,$localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state) {
  3595.  
  3596.  
  3597.  
  3598. console.log("di topup order");
  3599.  
  3600.  
  3601. var min = 1;
  3602.  
  3603. var max = 1000;
  3604.  
  3605. var num = Math.floor(Math.random() * (max - min + 1)) + min;
  3606.  
  3607. console.log("random number-->"+num);
  3608.  
  3609.  
  3610.  
  3611. if($stateParams.bank=="BCA")
  3612.  
  3613. {
  3614.  
  3615. $scope.tobank="BCA";
  3616.  
  3617. }
  3618.  
  3619. if($stateParams.bank=="MANDIRI")
  3620.  
  3621. {
  3622.  
  3623. $scope.tobank="MANDIRI";
  3624.  
  3625. }
  3626.  
  3627. if($stateParams.bank=="BRI")
  3628.  
  3629. {
  3630.  
  3631. $scope.tobank="BRI";
  3632.  
  3633. }
  3634.  
  3635. console.log('Scope to bank-->'+$scope.tobank);
  3636.  
  3637. /*
  3638. else
  3639.  
  3640. {
  3641.  
  3642. $scope.tobank=false;
  3643.  
  3644.  
  3645.  
  3646. }
  3647.  
  3648. */
  3649.  
  3650.  
  3651. $scope.amount=parseInt($stateParams.amount)+parseInt(num);
  3652.  
  3653.  
  3654.  
  3655.  
  3656.  
  3657. $scope.topup = function(amount) {
  3658.  
  3659.        
  3660.  
  3661.  
  3662.  
  3663.   if($localStorage.email==null)
  3664.  
  3665.     {
  3666.  
  3667.     console.log("belum login");
  3668.  
  3669.        
  3670.  
  3671.         var alertPopup = $ionicPopup.alert({
  3672.  
  3673.             title: 'Info',
  3674.  
  3675.             template: 'Please Login first to Confirm Topup'
  3676.  
  3677.           });
  3678.  
  3679.    
  3680.  
  3681.         $state.go('snd.login');
  3682.  
  3683.         $scope.login=false;
  3684.  
  3685.     }
  3686.  
  3687.  
  3688.  
  3689.     $scope.result = "";
  3690.  
  3691.     $http.post('http://dxplor.com/dxplor/Mo_balance/topup_new', {tobank : $stateParams.bank,checksum : num,amount : amount,customerid : $localStorage.customerid})
  3692.  
  3693.       .success(function(data, status, headers,config){
  3694.  
  3695.         console.log('data success');
  3696.  
  3697.         console.log(data); // for browser console
  3698.  
  3699.        
  3700.  
  3701.        
  3702.  
  3703.        
  3704.  
  3705.         if(data=="ok")
  3706.  
  3707.         {
  3708.  
  3709.          
  3710.  
  3711.         var alertPopup = $ionicPopup.alert({
  3712.  
  3713.             title: 'Info',
  3714.  
  3715.             template: 'Topup Request Success'
  3716.  
  3717.           });
  3718.  
  3719.        
  3720.  
  3721.        
  3722.  
  3723.        
  3724.  
  3725.    
  3726.  
  3727.  
  3728.  
  3729.        
  3730.  
  3731.         $state.go('snd.topup_confirmation');
  3732.        
  3733.        
  3734.  
  3735.         }
  3736.  
  3737.         else
  3738.  
  3739.         {
  3740.  
  3741.          
  3742.  
  3743.         var alertPopup = $ionicPopup.alert({
  3744.  
  3745.             title: 'Info',
  3746.  
  3747.             template: 'Topup Request Error'
  3748.  
  3749.           });
  3750.  
  3751.         }
  3752.  
  3753.        
  3754.  
  3755.       })
  3756.  
  3757.       .error(function(data, status, headers,config){
  3758.  
  3759.         console.log('data error');
  3760.  
  3761.       })
  3762.  
  3763.       .then(function(result){
  3764.  
  3765.         things = result.data;
  3766.  
  3767.       });
  3768.  
  3769.  
  3770.  
  3771.  
  3772.  
  3773.  
  3774. }
  3775.  
  3776.  
  3777.  
  3778. })
  3779.  
  3780.  
  3781.  
  3782.  
  3783.  
  3784. .controller('TopupConfirmationController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state) {
  3785.  
  3786.  
  3787.  
  3788. console.log("di topup confirmation-->"+$localStorage.customerid);
  3789.  
  3790.  
  3791.  
  3792. //$scope.amount="123";
  3793.  
  3794.   $http.get('http://dxplor.com/dxplor/Mo_balance/get_topup_order_new/'+$localStorage.customerid)
  3795.  
  3796.       .success(function(data, status, headers,config){
  3797.  
  3798.         console.log('data success');
  3799.  
  3800.         console.log(data); // for browser console
  3801.  
  3802.        
  3803.  
  3804.         var res = data.split(";");
  3805.  
  3806.        
  3807.  
  3808.         if(data=="notexist" || data=="0")
  3809.  
  3810.        
  3811.  
  3812.         {
  3813.  
  3814.             var alertPopup = $ionicPopup.alert({
  3815.  
  3816.                 title: 'Error',
  3817.  
  3818.                 template: 'Topup Error, Hubungi Dxplor Admin'
  3819.  
  3820.               });
  3821.  
  3822.  
  3823.             $state.go('snd.home');
  3824.  
  3825.         }
  3826.      
  3827.         else
  3828.             {
  3829.  
  3830.         $scope.amount =  res[0];
  3831.  
  3832.         $scope.tobank=res[1];
  3833.         $scope.id=res[2];
  3834.        
  3835.         console.log("ID Topup confirmation-->"+$scope.id);
  3836.  
  3837.             }
  3838.  
  3839.  
  3840.       })
  3841.  
  3842.       .error(function(data, status, headers,config){
  3843.  
  3844.         console.log('data error');
  3845.  
  3846.       })
  3847.  
  3848.       .then(function(result){
  3849.  
  3850.         things = result.data;
  3851.  
  3852.       });
  3853.  
  3854.  
  3855.  
  3856.  
  3857. console.log("masih di topup confirmatino");
  3858.  
  3859.    
  3860. $scope.cancel = function() {
  3861.  
  3862. $http.post('http://dxplor.com/dxplor/Mo_balance/topup_cancel', {id :  $scope.id})
  3863.  
  3864. .success(function(data, status, headers,config){
  3865.  
  3866.   console.log('data success');
  3867.  
  3868.   console.log(data); // for browser console
  3869.  
  3870.  
  3871.  
  3872.   if(data=="ok")
  3873.  
  3874.   {
  3875.  
  3876.  
  3877.   var alertPopup = $ionicPopup.alert({
  3878.  
  3879.       title: 'Info',
  3880.  
  3881.       template: 'Topup Cancel Success'
  3882.  
  3883.     });
  3884.  
  3885.  
  3886.  
  3887.   $state.go('snd.home');
  3888.  
  3889.   }
  3890.  
  3891.   else
  3892.  
  3893.   {
  3894.  
  3895.    
  3896.  
  3897.   var alertPopup = $ionicPopup.alert({
  3898.  
  3899.       title: 'Info',
  3900.  
  3901.       template: 'Topup Cancel Error, Hubungi Dxplor Admin'
  3902.  
  3903.     });
  3904.  
  3905.   }
  3906.  
  3907.  
  3908.  
  3909. })
  3910.  
  3911. .error(function(data, status, headers,config){
  3912.  
  3913.   console.log('data error');
  3914.  
  3915. })
  3916.  
  3917. .then(function(result){
  3918.  
  3919.   things = result.data;
  3920.  
  3921. });
  3922.  
  3923. }
  3924.  
  3925.  
  3926. $scope.confirm = function() {
  3927.  
  3928.     $http.post('http://dxplor.com/dxplor/Mo_balance/topup_confirm', {id :  $scope.id})
  3929.  
  3930.     .success(function(data, status, headers,config){
  3931.  
  3932.       console.log('data success');
  3933.  
  3934.       console.log(data); // for browser console
  3935.  
  3936.      
  3937.  
  3938.       if(data=="ok")
  3939.  
  3940.       {
  3941.  
  3942.  
  3943.       var alertPopup = $ionicPopup.alert({
  3944.  
  3945.           title: 'Info',
  3946.  
  3947.           template: 'Topup Confirmation Success, please wait for Approval'
  3948.  
  3949.         });
  3950.  
  3951.      
  3952.  
  3953.       $state.go('snd.home');
  3954.  
  3955.       }
  3956.  
  3957.       else
  3958.  
  3959.       {
  3960.  
  3961.        
  3962.  
  3963.       var alertPopup = $ionicPopup.alert({
  3964.  
  3965.           title: 'Info',
  3966.  
  3967.           template: 'Topup Cancel Error, Hubungi Dxplor Admin'
  3968.  
  3969.         });
  3970.  
  3971.       }
  3972.  
  3973.      
  3974.  
  3975.     })
  3976.  
  3977.     .error(function(data, status, headers,config){
  3978.  
  3979.       console.log('data error');
  3980.  
  3981.     })
  3982.  
  3983.     .then(function(result){
  3984.  
  3985.       things = result.data;
  3986.  
  3987.     });
  3988.  
  3989.     }
  3990.  
  3991.  
  3992.  
  3993.  
  3994. })
  3995.  
  3996.  
  3997.  
  3998.  
  3999. .factory('FlightDataService', function($q, $timeout) {
  4000.  
  4001.     var searchAirlines = function(searchFilter) {
  4002.          
  4003.         console.log('Searching airlines for ' + searchFilter);
  4004.  
  4005.         var deferred = $q.defer();
  4006.  
  4007.         var matches = airlines.filter( function(airline) {
  4008.             if(airline.name.toLowerCase().indexOf(searchFilter.toLowerCase()) !== -1 ) return true;
  4009.         })
  4010.  
  4011.         $timeout( function(){
  4012.        
  4013.            deferred.resolve( matches );
  4014.  
  4015.         }, 100);
  4016.  
  4017.         return deferred.promise;
  4018.  
  4019.     };
  4020.  
  4021.     return {
  4022.  
  4023.         searchAirlines : searchAirlines
  4024.  
  4025.     }
  4026. })
  4027.  
  4028. .controller('LawyerController', function($scope,FlightDataService, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  4029.  
  4030.  
  4031. $http.get('http://dxplor.com/dxplor/Mo_lawyer/getContentLawyer')
  4032.  
  4033. .success(function(data, status, headers,config){
  4034.  
  4035.   console.log('data success');
  4036.  
  4037.   console.log(data); // for browser console
  4038.  
  4039.  
  4040.  
  4041.   $scope.contentlawyer =  data;
  4042.  
  4043.  
  4044. })
  4045.  
  4046. .error(function(data, status, headers,config){
  4047.  
  4048.   console.log('data error');
  4049.  
  4050. })
  4051.  
  4052. .then(function(result){
  4053.  
  4054.   things = result.data;
  4055.  
  4056. })
  4057. })
  4058.  
  4059.  
  4060.  
  4061. .controller('GadgetController', function($scope,FlightDataService, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  4062.  
  4063.  
  4064. $http.get('http://dxplor.com/dxplor/Mo_gadget/getGadget')
  4065.  
  4066. .success(function(data, status, headers,config){
  4067.  
  4068.   console.log('data success');
  4069.  
  4070.   console.log(data); // for browser console
  4071.  
  4072.  
  4073.  
  4074.   $scope.gadgets =  data;
  4075.  
  4076.  
  4077. })
  4078.  
  4079. .error(function(data, status, headers,config){
  4080.  
  4081.   console.log('data error');
  4082.  
  4083. })
  4084.  
  4085. .then(function(result){
  4086.  
  4087.   things = result.data;
  4088.  
  4089. })
  4090. })
  4091.  
  4092.  
  4093.  
  4094. .controller('GadgetContentController', function($scope, $stateParams, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  4095.  
  4096. $http.post('http://dxplor.com/dxplor/Mo_gadget/getContentGadget',{id : $stateParams.id})
  4097.  
  4098. .success(function(data, status, headers,config){
  4099.  
  4100.   console.log('data success');
  4101.  
  4102.   console.log(data); // for browser console
  4103.  
  4104.  
  4105.  
  4106.   $scope.contentgadget =  data;
  4107.  
  4108.  
  4109. })
  4110.  
  4111. .error(function(data, status, headers,config){
  4112.  
  4113.   console.log('data error');
  4114.  
  4115. })
  4116.  
  4117. .then(function(result){
  4118.  
  4119.   things = result.data;
  4120.  
  4121. })
  4122.  
  4123.  
  4124.  
  4125. $http.post('http://dxplor.com/dxplor/Mo_gadget/getImgGadget',{id : $stateParams.id})
  4126.  
  4127. .success(function(data, status, headers,config){
  4128.  
  4129.   console.log('data success');
  4130.  
  4131.   console.log('asdada'+data); // for browser console
  4132.  
  4133.   var data2 = data.split(",");
  4134.  
  4135.   $scope.img1=data2[0];
  4136.   $scope.img2=data2[1];
  4137.   $scope.img3=data2[2];
  4138.  
  4139.  
  4140. })
  4141.  
  4142. .error(function(data, status, headers,config){
  4143.  
  4144.   console.log('data error');
  4145.  
  4146. })
  4147.  
  4148. .then(function(result){
  4149.  
  4150.   things = result.data;
  4151.  
  4152. })
  4153. })
  4154.  
  4155.  
  4156.  
  4157.  
  4158.  
  4159. .controller('TravelController', function($scope,FlightDataService, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  4160.  
  4161.  
  4162. $http.get('http://dxplor.com/dxplor/Mo_travel/getTravel')
  4163.  
  4164. .success(function(data, status, headers,config){
  4165.  
  4166.   console.log('data success');
  4167.  
  4168.   console.log(data); // for browser console
  4169.  
  4170.  
  4171.  
  4172.   $scope.travel =  data;
  4173.  
  4174.  
  4175. })
  4176.  
  4177. .error(function(data, status, headers,config){
  4178.  
  4179.   console.log('data error');
  4180.  
  4181. })
  4182.  
  4183. .then(function(result){
  4184.  
  4185.   things = result.data;
  4186.  
  4187. })
  4188. })
  4189.  
  4190.  
  4191.  
  4192. .controller('TravelContentController', function($scope, $stateParams, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  4193.  
  4194. $http.post('http://dxplor.com/dxplor/Mo_travel/getContentTravel',{id : $stateParams.id})
  4195.  
  4196. .success(function(data, status, headers,config){
  4197.  
  4198.   console.log('data success');
  4199.  
  4200.   console.log(data); // for browser console
  4201.  
  4202.  
  4203.  
  4204.   $scope.contenttravel =  data;
  4205.  
  4206.  
  4207. })
  4208.  
  4209. .error(function(data, status, headers,config){
  4210.  
  4211.   console.log('data error');
  4212.  
  4213. })
  4214.  
  4215. .then(function(result){
  4216.  
  4217.   things = result.data;
  4218.  
  4219. })
  4220.  
  4221.  
  4222.  
  4223. $http.post('http://dxplor.com/dxplor/Mo_travel/getImgTravel',{id : $stateParams.id})
  4224.  
  4225. .success(function(data, status, headers,config){
  4226.  
  4227.   console.log('data success');
  4228.  
  4229.   console.log('asdada'+data); // for browser console
  4230.  
  4231.   var data2 = data.split(",");
  4232.  
  4233.   $scope.img1=data2[0];
  4234.   $scope.img2=data2[1];
  4235.   $scope.img3=data2[2];
  4236.  
  4237.  
  4238. })
  4239.  
  4240. .error(function(data, status, headers,config){
  4241.  
  4242.   console.log('data error');
  4243.  
  4244. })
  4245.  
  4246. .then(function(result){
  4247.  
  4248.   things = result.data;
  4249.  
  4250. })
  4251. })
  4252.  
  4253.  
  4254.  
  4255.  
  4256. .controller('HealthController', function($scope,FlightDataService, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  4257.  
  4258.  
  4259. $http.get('http://dxplor.com/dxplor/Mo_health/getHealth')
  4260.  
  4261. .success(function(data, status, headers,config){
  4262.  
  4263.   console.log('data success');
  4264.  
  4265.   console.log(data); // for browser console
  4266.  
  4267.  
  4268.  
  4269.   $scope.health =  data;
  4270.  
  4271.  
  4272. })
  4273.  
  4274. .error(function(data, status, headers,config){
  4275.  
  4276.   console.log('data error');
  4277.  
  4278. })
  4279.  
  4280. .then(function(result){
  4281.  
  4282.   things = result.data;
  4283.  
  4284. })
  4285. })
  4286.  
  4287.  
  4288.  
  4289. .controller('HealthContentController', function($scope, $stateParams, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  4290.  
  4291. $http.post('http://dxplor.com/dxplor/Mo_health/getContentHealth',{id : $stateParams.id})
  4292.  
  4293. .success(function(data, status, headers,config){
  4294.  
  4295.   console.log('data success');
  4296.  
  4297.   console.log(data); // for browser console
  4298.  
  4299.  
  4300.  
  4301.   $scope.contenthealth =  data;
  4302.  
  4303.  
  4304. })
  4305.  
  4306. .error(function(data, status, headers,config){
  4307.  
  4308.   console.log('data error');
  4309.  
  4310. })
  4311.  
  4312. .then(function(result){
  4313.  
  4314.   things = result.data;
  4315.  
  4316. })
  4317.  
  4318.  
  4319.  
  4320. $http.post('http://dxplor.com/dxplor/Mo_health/getImgHealth',{id : $stateParams.id})
  4321.  
  4322. .success(function(data, status, headers,config){
  4323.  
  4324.   console.log('data success');
  4325.  
  4326.   console.log('asdada'+data); // for browser console
  4327.  
  4328.   var data2 = data.split(",");
  4329.  
  4330.   $scope.img1=data2[0];
  4331.   $scope.img2=data2[1];
  4332.   $scope.img3=data2[2];
  4333.  
  4334.  
  4335. })
  4336.  
  4337. .error(function(data, status, headers,config){
  4338.  
  4339.   console.log('data error');
  4340.  
  4341. })
  4342.  
  4343. .then(function(result){
  4344.  
  4345.   things = result.data;
  4346.  
  4347. })
  4348. })
  4349.  
  4350.  
  4351.  
  4352.  
  4353. .controller('MedicalController', function($scope,FlightDataService, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  4354.  
  4355.  
  4356. $http.get('http://dxplor.com/dxplor/Mo_medical/getMedical')
  4357.  
  4358. .success(function(data, status, headers,config){
  4359.  
  4360.   console.log('data success');
  4361.  
  4362.   console.log(data); // for browser console
  4363.  
  4364.  
  4365.  
  4366.   $scope.medical =  data;
  4367.  
  4368.  
  4369. })
  4370.  
  4371. .error(function(data, status, headers,config){
  4372.  
  4373.   console.log('data error');
  4374.  
  4375. })
  4376.  
  4377. .then(function(result){
  4378.  
  4379.   things = result.data;
  4380.  
  4381. })
  4382. })
  4383.  
  4384.  
  4385.  
  4386. .controller('MedicalContentController', function($scope, $stateParams, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  4387.  
  4388. $http.post('http://dxplor.com/dxplor/Mo_medical/getContentMedical',{id : $stateParams.id})
  4389.  
  4390. .success(function(data, status, headers,config){
  4391.  
  4392.   console.log('data success');
  4393.  
  4394.   console.log(data); // for browser console
  4395.  
  4396.  
  4397.  
  4398.   $scope.contentmedical =  data;
  4399.  
  4400.  
  4401. })
  4402.  
  4403. .error(function(data, status, headers,config){
  4404.  
  4405.   console.log('data error');
  4406.  
  4407. })
  4408.  
  4409. .then(function(result){
  4410.  
  4411.   things = result.data;
  4412.  
  4413. })
  4414.  
  4415.  
  4416.  
  4417. $http.post('http://dxplor.com/dxplor/Mo_medical/getImgMedical',{id : $stateParams.id})
  4418.  
  4419. .success(function(data, status, headers,config){
  4420.  
  4421.   console.log('data success');
  4422.  
  4423.   console.log('asdada'+data); // for browser console
  4424.  
  4425.   var data2 = data.split(",");
  4426.  
  4427.   $scope.img1=data2[0];
  4428.   $scope.img2=data2[1];
  4429.   $scope.img3=data2[2];
  4430.  
  4431.  
  4432. })
  4433.  
  4434. .error(function(data, status, headers,config){
  4435.  
  4436.   console.log('data error');
  4437.  
  4438. })
  4439.  
  4440. .then(function(result){
  4441.  
  4442.   things = result.data;
  4443.  
  4444. })
  4445. })
  4446.  
  4447.  
  4448.  
  4449.  
  4450. .controller('OthersController', function($scope,FlightDataService, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  4451.  
  4452.  
  4453. $http.get('http://dxplor.com/dxplor/Mo_others/getOthers')
  4454.  
  4455. .success(function(data, status, headers,config){
  4456.  
  4457.   console.log('data success');
  4458.  
  4459.   console.log(data); // for browser console
  4460.  
  4461.  
  4462.  
  4463.   $scope.others =  data;
  4464.  
  4465.  
  4466. })
  4467.  
  4468. .error(function(data, status, headers,config){
  4469.  
  4470.   console.log('data error');
  4471.  
  4472. })
  4473.  
  4474. .then(function(result){
  4475.  
  4476.   things = result.data;
  4477.  
  4478. })
  4479. })
  4480.  
  4481.  
  4482.  
  4483. .controller('OthersContentController', function($scope, $stateParams, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  4484.  
  4485. $http.post('http://dxplor.com/dxplor/Mo_others/getContentOthers',{id : $stateParams.id})
  4486.  
  4487. .success(function(data, status, headers,config){
  4488.  
  4489.   console.log('data success');
  4490.  
  4491.   console.log(data); // for browser console
  4492.  
  4493.  
  4494.  
  4495.   $scope.contentothers =  data;
  4496.  
  4497.  
  4498. })
  4499.  
  4500. .error(function(data, status, headers,config){
  4501.  
  4502.   console.log('data error');
  4503.  
  4504. })
  4505.  
  4506. .then(function(result){
  4507.  
  4508.   things = result.data;
  4509.  
  4510. })
  4511.  
  4512.  
  4513.  
  4514. $http.post('http://dxplor.com/dxplor/Mo_others/getImgOthers',{id : $stateParams.id})
  4515.  
  4516. .success(function(data, status, headers,config){
  4517.  
  4518.   console.log('data success');
  4519.  
  4520.   console.log('asdada'+data); // for browser console
  4521.  
  4522.   var data2 = data.split(",");
  4523.  
  4524.   $scope.img1=data2[0];
  4525.   $scope.img2=data2[1];
  4526.   $scope.img3=data2[2];
  4527.  
  4528.  
  4529. })
  4530.  
  4531. .error(function(data, status, headers,config){
  4532.  
  4533.   console.log('data error');
  4534.  
  4535. })
  4536.  
  4537. .then(function(result){
  4538.  
  4539.   things = result.data;
  4540.  
  4541. })
  4542. })
  4543.  
  4544. .controller('RestoController', function($scope,FlightDataService, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  4545.  
  4546.  
  4547. $http.get('http://dxplor.com/dxplor/Mo_resto/getResto')
  4548.  
  4549. .success(function(data, status, headers,config){
  4550.  
  4551.   console.log('data success');
  4552.  
  4553.   console.log(data); // for browser console
  4554.  
  4555.  
  4556.  
  4557.   $scope.resto =  data;
  4558.  
  4559.  
  4560. })
  4561.  
  4562. .error(function(data, status, headers,config){
  4563.  
  4564.   console.log('data error');
  4565.  
  4566. })
  4567.  
  4568. .then(function(result){
  4569.  
  4570.   things = result.data;
  4571.  
  4572. })
  4573. })
  4574.  
  4575.  
  4576.  
  4577. .controller('RestoContentController', function($scope, $stateParams, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  4578.  
  4579. $http.post('http://dxplor.com/dxplor/Mo_resto/getContentResto',{id : $stateParams.id})
  4580.  
  4581. .success(function(data, status, headers,config){
  4582.  
  4583.   console.log('data success');
  4584.  
  4585.   console.log(data); // for browser console
  4586.  
  4587.  
  4588.  
  4589.   $scope.contentresto =  data;
  4590.  
  4591.  
  4592. })
  4593.  
  4594. .error(function(data, status, headers,config){
  4595.  
  4596.   console.log('data error');
  4597.  
  4598. })
  4599.  
  4600. .then(function(result){
  4601.  
  4602.   things = result.data;
  4603.  
  4604. })
  4605.  
  4606.  
  4607.  
  4608. $http.post('http://dxplor.com/dxplor/Mo_resto/getImgResto',{id : $stateParams.id})
  4609.  
  4610. .success(function(data, status, headers,config){
  4611.  
  4612.   console.log('data success');
  4613.  
  4614.   console.log('asdada'+data); // for browser console
  4615.  
  4616.   var data2 = data.split(",");
  4617.  
  4618.   $scope.img1=data2[0];
  4619.   $scope.img2=data2[1];
  4620.   $scope.img3=data2[2];
  4621.  
  4622.  
  4623. })
  4624.  
  4625. .error(function(data, status, headers,config){
  4626.  
  4627.   console.log('data error');
  4628.  
  4629. })
  4630.  
  4631. .then(function(result){
  4632.  
  4633.   things = result.data;
  4634.  
  4635. })
  4636. })
  4637.  
  4638.  
  4639.  
  4640. .controller('ElectronicController', function($scope,FlightDataService, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  4641.  
  4642.  
  4643. $http.get('http://dxplor.com/dxplor/Mo_electronic/getElectronic')
  4644.  
  4645. .success(function(data, status, headers,config){
  4646.  
  4647.   console.log('data success');
  4648.  
  4649.   console.log(data); // for browser console
  4650.  
  4651.  
  4652.  
  4653.   $scope.electronics =  data;
  4654.  
  4655.  
  4656. })
  4657.  
  4658. .error(function(data, status, headers,config){
  4659.  
  4660.   console.log('data error');
  4661.  
  4662. })
  4663.  
  4664. .then(function(result){
  4665.  
  4666.   things = result.data;
  4667.  
  4668. })
  4669. })
  4670.  
  4671.  
  4672.  
  4673. .controller('ElectronicContentController', function($scope, $stateParams, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  4674.  
  4675. console.log('Content Electronic-->'+ $stateParams.id)
  4676. $http.post('http://dxplor.com/dxplor/Mo_electronic/getContentElectronic',{id : $stateParams.id})
  4677.  
  4678. .success(function(data, status, headers,config){
  4679.  
  4680.   console.log('data success');
  4681.  
  4682.  
  4683.  
  4684.  
  4685.   $scope.contentelectronic =  data;
  4686.  
  4687.  
  4688. })
  4689.  
  4690. .error(function(data, status, headers,config){
  4691.  
  4692.   console.log('data error');
  4693.  
  4694. })
  4695.  
  4696. .then(function(result){
  4697.  
  4698.   things = result.data;
  4699.  
  4700. })
  4701.  
  4702.  
  4703. $http.post('http://dxplor.com/dxplor/Mo_electronic/getImgElectronic',{id : $stateParams.id})
  4704.  
  4705. .success(function(data, status, headers,config){
  4706.  
  4707.   console.log('data success');
  4708.  
  4709.   console.log('asdada'+data); // for browser console
  4710.  
  4711.   var data2 = data.split(",");
  4712.  
  4713.   $scope.img1=data2[0];
  4714.   $scope.img2=data2[1];
  4715.   $scope.img3=data2[2];
  4716.  
  4717.  
  4718. })
  4719.  
  4720. .error(function(data, status, headers,config){
  4721.  
  4722.   console.log('data error');
  4723.  
  4724. })
  4725.  
  4726. .then(function(result){
  4727.  
  4728.   things = result.data;
  4729.  
  4730. })
  4731.  
  4732.  
  4733. })
  4734.  
  4735.  
  4736.  
  4737. .controller('FashionController', function($scope,FlightDataService, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  4738.  
  4739.  
  4740. $http.get('http://dxplor.com/dxplor/Mo_fashion/getFashion')
  4741.  
  4742. .success(function(data, status, headers,config){
  4743.  
  4744.   console.log('data success');
  4745.  
  4746.   console.log(data); // for browser console
  4747.  
  4748.  
  4749.  
  4750.   $scope.electronics =  data;
  4751.  
  4752.  
  4753. })
  4754.  
  4755. .error(function(data, status, headers,config){
  4756.  
  4757.   console.log('data error');
  4758.  
  4759. })
  4760.  
  4761. .then(function(result){
  4762.  
  4763.   things = result.data;
  4764.  
  4765. })
  4766.  
  4767.  
  4768. })
  4769.  
  4770.  
  4771.  
  4772. .controller('FashionContentController', function($scope, $stateParams, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  4773.  
  4774. console.log('Content Fashion-->'+ $stateParams.id)
  4775. $http.post('http://dxplor.com/dxplor/Mo_fashion/getContentFashion',{id : $stateParams.id})
  4776.  
  4777. .success(function(data, status, headers,config){
  4778.  
  4779.   console.log('data success');
  4780.  
  4781.   console.log('asdada'+data); // for browser console
  4782.  
  4783.  
  4784.  
  4785.   $scope.contentfashion =  data;
  4786.  
  4787.  
  4788. })
  4789.  
  4790. .error(function(data, status, headers,config){
  4791.  
  4792.   console.log('data error');
  4793.  
  4794. })
  4795.  
  4796. .then(function(result){
  4797.  
  4798.   things = result.data;
  4799.  
  4800. })
  4801.  
  4802.  
  4803.  
  4804. $http.post('http://dxplor.com/dxplor/Mo_fashion/getImgFashion',{id : $stateParams.id})
  4805.  
  4806. .success(function(data, status, headers,config){
  4807.  
  4808.   console.log('data success');
  4809.  
  4810.   console.log('asdada'+data); // for browser console
  4811.  
  4812.   var data2 = data.split(",");
  4813.  
  4814.   $scope.img1=data2[0];
  4815.   $scope.img2=data2[1];
  4816.   $scope.img3=data2[2];
  4817.  
  4818.  
  4819. })
  4820.  
  4821. .error(function(data, status, headers,config){
  4822.  
  4823.   console.log('data error');
  4824.  
  4825. })
  4826.  
  4827. .then(function(result){
  4828.  
  4829.   things = result.data;
  4830.  
  4831. })
  4832.  
  4833. })
  4834.  
  4835.  
  4836. .controller('FlightController', function($scope,FlightDataService, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  4837.  
  4838.  
  4839.  
  4840. console.log("di flight");
  4841. $scope.isDisabled = false;
  4842.  
  4843. /*$scope.movies = ["Lord of the Rings",
  4844.                  "Drive",
  4845.                  "Science of Sleep",
  4846.                  "Back to the Future",
  4847.                  "Oldboy"];
  4848. */
  4849.  
  4850.  
  4851. $http.get('http://dxplor.com/dxplor/Mo_flight/getairportautocomplete')
  4852.  
  4853. .success(function(data, status, headers,config){
  4854.  
  4855.   console.log('data success');
  4856.  
  4857.   console.log(data); // for browser console
  4858.  
  4859.  
  4860.  
  4861.   $scope.airport =  data;
  4862.  
  4863.   $scope.airportautofrom=data;
  4864.   $scope.airportautoto=data;
  4865.  
  4866.  
  4867.  console.log(data);
  4868.  
  4869. })
  4870.  
  4871. .error(function(data, status, headers,config){
  4872.  
  4873.   console.log('data error');
  4874.  
  4875. })
  4876.  
  4877. .then(function(result){
  4878.  
  4879.   things = result.data;
  4880.  
  4881. });
  4882.  
  4883.  
  4884.  // gives another movie array on change
  4885. /*
  4886.  $scope.updateMovies = function(typed){
  4887.      console.log('typed-->'+typed);
  4888.      // MovieRetriever could be some service returning a promise
  4889.      $scope.newmovies = MovieRetriever.getmovies(typed);
  4890.      $scope.newmovies.then(function(data){
  4891.      $scope.movies = data;
  4892.      });
  4893.    
  4894.  }
  4895.  */
  4896. /*
  4897.  
  4898. $scope.data = { "airlines" : [], "search" : '' };
  4899.  
  4900. $scope.search = function() {
  4901.  
  4902.     FlightDataService.searchAirlines($scope.data.search).then(
  4903.         function(matches) {
  4904.             $scope.data.airlines = matches;
  4905.         }
  4906.     )
  4907. }
  4908. */
  4909.  
  4910.  
  4911. /* $scope.autocompleteInput = {
  4912.  
  4913.  
  4914.  
  4915.       'propNameToDisplay': 'name',
  4916.  
  4917.       'ID':'AutoComplete',
  4918.  
  4919.       'itemSelectCallback' : foo ,
  4920.  
  4921.       'searchlist' : {}, // list where search needs to be done.
  4922.  
  4923.       'isAsyncSearch': false, // optional - Default :False
  4924.  
  4925.       'asyncHttpCall' : httpFoo, // Required when isAsyncSearch is true
  4926.  
  4927.       'textBoxClass':['size-16'], // optional custom classes for search text box
  4928.  
  4929.       'placeholder': 'Search Organzations', // optional placeholder to be displayed in box
  4930.  
  4931.       'listClass': ['border-energized'], //optional cutsom classes for matched items
  4932.  
  4933.       'labelContainerClass': ['bottom-border'] //optional
  4934.  
  4935.     };
  4936.  
  4937. */
  4938.  
  4939.    
  4940.  
  4941.    
  4942.  
  4943.  
  4944.  
  4945.  
  4946.    
  4947.  
  4948. $scope.search_flight = function(rute,from,to,fromdate,todate,adult,child,infant) {
  4949.  
  4950.         console.log('flight');
  4951.  
  4952.        
  4953.  
  4954.         if(rute==true)
  4955.  
  4956.         {
  4957.  
  4958.         rute='RT';
  4959.  
  4960.         $localStorage.rutesearch=true;
  4961.  
  4962.         }
  4963.  
  4964.         else
  4965.  
  4966.         {
  4967.  
  4968.         rute='OW';
  4969.  
  4970.         $localStorage.rutesearch=false;
  4971.  
  4972.  
  4973.  
  4974.         }
  4975.  
  4976.        
  4977.  
  4978.        
  4979.  
  4980.      
  4981.        
  4982.        
  4983.  
  4984.     //   fromdate='11/07/2016';
  4985.  
  4986.    //     todate='09/08/2016';
  4987.  
  4988.        
  4989.  
  4990.     //    fromdate='2016-09-28';
  4991.  
  4992.      //  todate='2016-09-30';
  4993.  
  4994.      //   console.log('fromdate-->'+fromdate); // for browser console
  4995.  
  4996.      //  console.log('todate-->'+todate); // for browser console
  4997.  
  4998.        
  4999.  
  5000.     if(angular.isUndefined(child))
  5001.  
  5002.  
  5003.  
  5004. {
  5005.  
  5006.     child="0";
  5007.  
  5008.      
  5009.  
  5010. }
  5011.  
  5012.      
  5013.  
  5014.     if(angular.isUndefined(adult))
  5015.  
  5016.  
  5017.  
  5018. {
  5019.  
  5020.     adult="1";
  5021.  
  5022.      
  5023.  
  5024. }
  5025.  
  5026.      
  5027.  
  5028.     if(angular.isUndefined(infant))
  5029.  
  5030.  
  5031.  
  5032. {
  5033.  
  5034.     infant="0";
  5035.  
  5036.      
  5037.  
  5038. }
  5039.  
  5040.      
  5041.  
  5042.      
  5043.  
  5044.     if(angular.isUndefined(from))
  5045.  
  5046.  
  5047.  
  5048. {
  5049.  
  5050.     var alertPopup = $ionicPopup.alert({
  5051.  
  5052.             title: 'Info',
  5053.  
  5054.             template: 'Origin harus diisi'
  5055.  
  5056.           });
  5057.  
  5058.     return false;    
  5059.  
  5060.    
  5061.  
  5062.  //     from="CGK";
  5063.  
  5064. }
  5065.  
  5066.      
  5067.  
  5068.     if(angular.isUndefined(to))
  5069.  
  5070.  
  5071.  
  5072. {
  5073.  
  5074.      var alertPopup = $ionicPopup.alert({
  5075.  
  5076.             title: 'Info',
  5077.  
  5078.             template: 'Destination harus diisi'
  5079.  
  5080.           });
  5081.  
  5082.     return false;    
  5083.  
  5084.    
  5085.  
  5086.     //to="DPS";
  5087.  
  5088. }
  5089.  
  5090.        
  5091.  
  5092.      if(parseInt(infant) > parseInt(adult))
  5093.  
  5094.      {
  5095.  
  5096.      
  5097.  
  5098.     var alertPopup = $ionicPopup.alert({
  5099.  
  5100.             title: 'Info',
  5101.  
  5102.             template: 'Jumlah Bayi tidak boleh > Jumlah Orang Dewasa'
  5103.  
  5104.           });
  5105.  
  5106.      return false;
  5107.  
  5108.      
  5109.  
  5110.      }
  5111.  
  5112.      
  5113.  
  5114.      
  5115.  
  5116.    if(parseInt(adult)==0)
  5117.  
  5118.   {
  5119.  
  5120.  
  5121.  
  5122. var alertPopup = $ionicPopup.alert({
  5123.  
  5124.           title: 'Info',
  5125.  
  5126.           template: 'Jumlah Dewasa tidak boleh 0'
  5127.  
  5128.         });
  5129.  
  5130.   return false;
  5131.  
  5132.  
  5133.  
  5134.   }
  5135.    
  5136.    
  5137.    console.log('rutee-->'+rute); // for browser console
  5138.  
  5139.    console.log('from-->'+from); // for browser console
  5140.  
  5141.    console.log('to-->'+to); // for browser console
  5142.    
  5143.    
  5144.    
  5145.  
  5146.           console.log('from code-->'+from); // for browser console
  5147.  
  5148.           console.log('to code-->'+to); // for browser console
  5149.  
  5150.  
  5151.     console.log('fromdate-->'+fromdate); // for browser console
  5152.  
  5153.     console.log('todate-->'+todate); // for browser console
  5154.  
  5155.     console.log('adult-->'+adult); // for browser console
  5156.  
  5157.     console.log('child-->'+child); // for browser console
  5158.  
  5159.     console.log('infant-->'+infant); // for browser console
  5160.  
  5161.    
  5162.  
  5163.      console.log('mulai call service searcha');
  5164.  
  5165.         $scope.isDisabled = true;
  5166.  
  5167.         $scope.finderloader=true;
  5168.  
  5169.  
  5170.  
  5171.  
  5172.  
  5173.    
  5174.  
  5175.     //    $http.get('path/to/service', {timeout: 5000});
  5176.  
  5177.  
  5178.  
  5179.     $scope.result = "";
  5180.  
  5181.     $http.post('http://dxplor.com/dxplor/index.php/Mo_flight/search2', {rute : rute,from : from,to : to,fromdate : fromdate,todate : todate,
  5182.  
  5183.     adult : adult,child : child,infant : infant})
  5184.  
  5185.    
  5186.  
  5187. //   $http.post('http://dxplor.com/dxplor/index.php/Mo_flight/search2', {rute : rute,from : from,to : to,fromdate : fromdate,todate : todate,
  5188.  
  5189.   // }, {timeout: 40000})
  5190.  
  5191.       .success(function(data, status, headers,config){
  5192.  
  5193.             $scope.isDisabled = false;
  5194.  
  5195.             $scope.finderloader=false;
  5196.  
  5197.         console.log('data success');
  5198.  
  5199.        
  5200.  
  5201.        
  5202.  
  5203.        
  5204.  
  5205.         console.log(data); // for browser console
  5206.  
  5207.         console.log(data.toString());
  5208.  
  5209.         console.log( JSON.stringify(data) );
  5210.  
  5211.        
  5212.  
  5213.        
  5214.  
  5215.         if(JSON.stringify(data) == "" || JSON.stringify(data)==" " || JSON.stringify(data)=="\"null\"")
  5216.  
  5217.         {
  5218.  
  5219.           var alertPopup = $ionicPopup.alert({
  5220.  
  5221.               title: 'Info',
  5222.  
  5223.               template: 'Server Busy, please Try Again Later'
  5224.  
  5225.             });
  5226.  
  5227.           return false;
  5228.  
  5229.          
  5230.  
  5231.          
  5232.  
  5233.         }
  5234.  
  5235.        
  5236.  
  5237.         if(JSON.stringify(data).indexOf("Search Not Found") != -1)
  5238.  
  5239.         {
  5240.  
  5241.        
  5242.  
  5243.         var alertPopup = $ionicPopup.alert({
  5244.  
  5245.             title: 'Info',
  5246.  
  5247.             template: 'Search Not Found'
  5248.  
  5249.           });
  5250.  
  5251.         return false;
  5252.  
  5253.         }
  5254.  
  5255.        
  5256.  
  5257.         if(JSON.stringify(data).indexOf("error_message") != -1)
  5258.  
  5259.         {
  5260.  
  5261.        
  5262.  
  5263.             var alertPopup = $ionicPopup.alert({
  5264.  
  5265.                 title: 'Info',
  5266.  
  5267.                 template: data['error_message']
  5268.  
  5269.               });
  5270.  
  5271.             return false;
  5272.  
  5273.         }
  5274.  
  5275.  
  5276.  
  5277.         //return false;
  5278.  
  5279.         $scope.result =  data;
  5280.  
  5281.        
  5282.  
  5283.         $localStorage.adultcount=adult;
  5284.  
  5285.         $localStorage.childcount=child;
  5286.  
  5287.         $localStorage.infantcount=infant;
  5288.  
  5289.         $localStorage.to=to;
  5290.  
  5291.        console.log("$localStorage to -->"+$localStorage.to);
  5292.  
  5293.         console.log('Departure Flights-->'+data['departure']['flights']);
  5294.  
  5295.     //   console.log(data['return']['flights']);
  5296.  
  5297.  
  5298.  
  5299.         $localStorage.flightsearchdeparture =data['departure']['flights'];
  5300.  
  5301.     //  if (data.indexOf('return') < 0) {
  5302.  
  5303.        
  5304.  
  5305.        
  5306.  
  5307.        
  5308.  
  5309.        
  5310.  
  5311.       if('return' in data)
  5312.  
  5313.  
  5314.  
  5315.       {
  5316.  
  5317.        
  5318.  
  5319.       console.log('ada returnnya')
  5320.  
  5321.           $localStorage.flightsearchreturn =data['return']['flights'];
  5322.  
  5323.         $localStorage.togglereturn=true;
  5324.  
  5325.  
  5326.  
  5327.        
  5328.  
  5329.        
  5330.  
  5331.         }
  5332.  
  5333.         else
  5334.  
  5335.         {
  5336.  
  5337.         $localStorage.togglereturn=false;
  5338.  
  5339.           console.log('one wayy');
  5340.  
  5341.         //  console.log(data['return']['flights']);
  5342.  
  5343.         }
  5344.  
  5345.         $state.go('snd.flight_search');
  5346.  
  5347.  
  5348.  
  5349.  
  5350.        
  5351.  
  5352.       })
  5353.  
  5354.       .error(function(data, status, headers,config){
  5355.  
  5356.         console.log('data error1-->'+data);
  5357.  
  5358.       //  console.log('data error2-->'+data.toString());
  5359.  
  5360.       // console.log( 'data error3-->'+JSON.stringify(data) );
  5361.  
  5362.         $scope.isDisabled = false;
  5363.  
  5364.             $scope.finderloader=false;
  5365.  
  5366.        
  5367.  
  5368.         var alertPopup = $ionicPopup.alert({
  5369.  
  5370.             title: 'Info',
  5371.  
  5372.             template: 'Please Try Again Later'
  5373.  
  5374.           });
  5375.  
  5376.        
  5377.  
  5378.        
  5379.  
  5380.       })
  5381.  
  5382.       .then(function(result){
  5383.  
  5384.         things = result.data;
  5385.  
  5386.      
  5387.  
  5388.       });
  5389.  
  5390.  
  5391.  
  5392.  
  5393.  
  5394.  
  5395. }
  5396.  
  5397.  
  5398.  
  5399. })
  5400.  
  5401.  
  5402.  
  5403.  
  5404.  
  5405.  
  5406.  
  5407.  
  5408.  
  5409. .controller('FlightSearchController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state) {
  5410.  
  5411.  
  5412.  
  5413. console.log("di flight search");
  5414.  
  5415. console.log("rute search-->"+$localStorage.rutesearch);
  5416.  
  5417. console.log("returnflight-->"+$localStorage.flightsearchdeparture);
  5418.  
  5419.  
  5420. //var res = $localStorage.flightsearch.split("||");
  5421.  
  5422.  
  5423.  
  5424.     //console.log(res[0]);
  5425.  
  5426.  
  5427.  
  5428.  
  5429. $scope.returnsearch=$localStorage.rutesearch;
  5430.  
  5431.     $scope.departure = $localStorage.flightsearchdeparture ;
  5432.  
  5433.    
  5434.  
  5435.    
  5436.  
  5437.     $scope.chooseoutbound = function(flight_id) {
  5438.  
  5439.     console.log('outboundflightid-->'+flight_id);
  5440.  
  5441.     $localStorage.outboundflightid=flight_id;
  5442.  
  5443.     if($localStorage.togglereturn==true)
  5444.  
  5445.     {
  5446.  
  5447.     $state.go('snd.flight_search2');
  5448.  
  5449.     }
  5450.  
  5451.     else
  5452.  
  5453.     {
  5454.  
  5455.     $state.go('snd.flight_schedule');
  5456.  
  5457.     }
  5458.  
  5459.    
  5460.  
  5461.     }
  5462.  
  5463.    
  5464.  
  5465.    
  5466.  
  5467.  
  5468.  
  5469.  
  5470.  
  5471. })
  5472.  
  5473.  
  5474.  
  5475.  
  5476.  
  5477. .controller('FlightSearch2Controller', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state) {
  5478.  
  5479.  
  5480.  
  5481. console.log("di flight search 2");
  5482.  
  5483. console.log("rute search-->"+$localStorage.rutesearch);
  5484.  
  5485. console.log("returnflight-->"+$localStorage.flightsearchreturn);
  5486.  
  5487.  
  5488.  
  5489.  
  5490.  
  5491.  
  5492.    
  5493.  
  5494. $scope.returnsearch=$localStorage.rutesearch;
  5495.  
  5496.     $scope.returnflight = $localStorage.flightsearchreturn ;
  5497.  
  5498.    
  5499.  
  5500.    
  5501.  
  5502.     $scope.chooseinbound = function(flight_id) {
  5503.  
  5504.     console.log('inboundflightid-->'+flight_id);
  5505.  
  5506.     $localStorage.inboundflightid=flight_id;
  5507.  
  5508.     $state.go('snd.flight_schedule');
  5509.  
  5510.  
  5511.  
  5512.    
  5513.  
  5514.     }
  5515.  
  5516.  
  5517.  
  5518.  
  5519.  
  5520. })
  5521.  
  5522.  
  5523.  
  5524.  
  5525.  
  5526. .controller('FlightScheduleController', function($scope, $stateParams,$localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state) {
  5527.  
  5528.  
  5529.  
  5530. console.log("di flight schedule");
  5531.  
  5532.  
  5533.  
  5534. console.log('aa'+$localStorage.outboundflightid);
  5535.  
  5536.  
  5537. console.log('ab'+$localStorage.inboundflightid);
  5538.  
  5539.  
  5540.  
  5541.  
  5542.  
  5543. $scope.isreturn=false;
  5544.  
  5545.  
  5546. if($localStorage.togglereturn==true)
  5547.  
  5548. {
  5549.  
  5550. $scope.isreturn=true;
  5551.  
  5552. }
  5553.  
  5554.  
  5555.  
  5556.     $scope.result = "";
  5557.  
  5558.     $http.post('http://dxplor.com/dxplor/Mo_flight/get_schedule/'+$localStorage.outboundflightid)
  5559.  
  5560.    
  5561.  
  5562.    
  5563.  
  5564.       .success(function(data, status, headers,config){
  5565.  
  5566.         console.log('data success');
  5567.  
  5568.         console.log(data); // for browser console
  5569.  
  5570.        
  5571.  
  5572.         $scope.result =  data;
  5573.  
  5574.        
  5575.  
  5576.        
  5577.  
  5578.        
  5579.  
  5580.         $scope.parJson = function (json) {
  5581.  
  5582.             return JSON.parse(json);
  5583.  
  5584.         }
  5585.  
  5586.        
  5587.  
  5588.         $scope.tes=data[0].flight_schedule;
  5589.  
  5590.        
  5591.  
  5592.        
  5593.  
  5594.         $scope.from_city=data[0].flight_schedule[0].from_name;
  5595.  
  5596.         $scope.to_city=data[0].flight_schedule[0].to_name;
  5597.  
  5598.         $scope.departure_time=data[0].flight_schedule[0].departure_time;
  5599.  
  5600.         $scope.arrival_time=data[0].flight_schedule[0].arrival_time;
  5601.  
  5602.         $scope.departure_date=data[0].flight_schedule[0].departure_date;
  5603.  
  5604.         $scope.arrival_date=data[0].flight_schedule[0].arrival_date;
  5605.  
  5606.         $scope.image=data[0].flight_schedule[0].airline_image;
  5607.  
  5608.        
  5609.  
  5610.         $scope.airline_name=data[0].airline_name;
  5611.  
  5612.         $scope.airline_code=data[0].flight_schedule[0].airline_code;
  5613.  
  5614.         $scope.flight_number=data[0].flight_schedule[0].flight_number;
  5615.  
  5616.         $scope.total_price=data[0].lowest_price;
  5617.  
  5618.         $scope.flight_id=$localStorage.outboundflightid;
  5619.  
  5620.  
  5621.  
  5622.        
  5623.  
  5624.         $localStorage.outboundsupplierid=data[0].supplier_id;
  5625.  
  5626.        
  5627.  
  5628.         $localStorage.airlineairasia=false;
  5629.  
  5630.         if( $localStorage.outboundsupplierid=='3')
  5631.  
  5632.         {
  5633.  
  5634.         $localStorage.airlineairasia=true;
  5635.  
  5636.        
  5637.  
  5638.         }
  5639.  
  5640.       // $scope._city=JSON.parse(data[0].flight_id);
  5641.  
  5642.  
  5643.  
  5644.       //  console.log('a'+JSON.parse(data[0].flight_schedule[0].to_name));
  5645.  
  5646.       //  $state.go('snd.flight_search');
  5647.  
  5648.  
  5649.  
  5650.  
  5651.        
  5652.  
  5653.       })
  5654.  
  5655.       .error(function(data, status, headers,config){
  5656.  
  5657.         console.log('data error');
  5658.  
  5659.        
  5660.  
  5661.        
  5662.  
  5663.       })
  5664.  
  5665.       .then(function(result){
  5666.  
  5667.         things = result.data;
  5668.  
  5669.       });
  5670.  
  5671.    
  5672.  
  5673.    
  5674.  
  5675.    
  5676.  
  5677.    
  5678.  
  5679.     if($localStorage.togglereturn==true)
  5680.  
  5681. {
  5682.  
  5683.    
  5684.  
  5685.     $http.post('http://dxplor.com/dxplor/Mo_flight/get_schedule/'+$localStorage.inboundflightid)
  5686.  
  5687.        
  5688.  
  5689.        
  5690.  
  5691.       .success(function(data, status, headers,config){
  5692.  
  5693.         console.log('data success');
  5694.  
  5695.         console.log(data); // for browser console
  5696.  
  5697.        
  5698.  
  5699.        
  5700.  
  5701.         $scope.tesinbound=data[0].flight_schedule;
  5702.  
  5703.        
  5704.  
  5705.        
  5706.  
  5707.         $scope.from_cityinbound=data[0].flight_schedule[0].from_name;
  5708.  
  5709.         $scope.to_cityinbound=data[0].flight_schedule[0].to_name;
  5710.  
  5711.         $scope.departure_timeinbound=data[0].flight_schedule[0].departure_time;
  5712.  
  5713.         $scope.arrival_timeinbound=data[0].flight_schedule[0].arrival_time;
  5714.  
  5715.         $scope.departure_dateinbound=data[0].flight_schedule[0].departure_date;
  5716.  
  5717.         $scope.arrival_dateinbound=data[0].flight_schedule[0].arrival_date;
  5718.  
  5719.         $scope.imageinbound=data[0].flight_schedule[0].airline_image;
  5720.  
  5721.         $scope.airline_nameinbound=data[0].airline_name;
  5722.  
  5723.         $scope.airline_codeinbound=data[0].flight_schedule[0].airline_code;
  5724.  
  5725.         $scope.flight_numberinbound=data[0].flight_schedule[0].flight_number;
  5726.  
  5727.         $scope.total_priceinbound=data[0].lowest_price;
  5728.  
  5729.         $scope.flight_idinbound=$localStorage.inboundflightid;
  5730.  
  5731.        
  5732.  
  5733.        
  5734.  
  5735.         $localStorage.inboundsupplierid=data[0].supplier_id;
  5736.  
  5737.        
  5738.  
  5739.         if( $localStorage.inboundsupplierid=='3')
  5740.  
  5741.         {
  5742.  
  5743.         $localStorage.airlineairasia=true;
  5744.  
  5745.        
  5746.  
  5747.         }
  5748.  
  5749.  
  5750.  
  5751.       // $scope._city=JSON.parse(data[0].flight_id);
  5752.  
  5753.  
  5754.  
  5755.       //  console.log('a'+JSON.parse(data[0].flight_schedule[0].to_name));
  5756.  
  5757.       //  $state.go('snd.flight_search');
  5758.  
  5759.  
  5760.  
  5761.  
  5762.        
  5763.  
  5764.       })
  5765.  
  5766.       .error(function(data, status, headers,config){
  5767.  
  5768.         console.log('data error');
  5769.  
  5770.        
  5771.  
  5772.        
  5773.  
  5774.       })
  5775.  
  5776.       .then(function(result){
  5777.  
  5778.         things = result.data;
  5779.  
  5780.       });
  5781.  
  5782. }
  5783.  
  5784.    
  5785.  
  5786.    
  5787.  
  5788.  
  5789.     $localStorage.to="DPS";
  5790.     $http.get('http://dxplor.com/dxplor/Mo_flight/getform/'+$localStorage.to)
  5791.  
  5792.     .success(function(data, status, headers,config){
  5793.  
  5794.       console.log('data success getform');
  5795.  
  5796.       console.log(data); // for browser console
  5797.  
  5798.      
  5799.  
  5800.       if(data=='local')
  5801.  
  5802.  
  5803.  
  5804.     {
  5805.  
  5806.       console.log("ok");
  5807.  
  5808.       $localStorage.rutetujuan=data;
  5809.  
  5810.     }
  5811.  
  5812.        
  5813.  
  5814.      
  5815.  
  5816.     })
  5817.  
  5818.     .error(function(data, status, headers,config){
  5819.  
  5820.       console.log('data error');
  5821.  
  5822.     })
  5823.  
  5824.     .then(function(result){
  5825.  
  5826.       things = result.data;
  5827.  
  5828.      
  5829.  
  5830.     });
  5831.  
  5832.  
  5833.  
  5834.     $scope.pesan = function() {
  5835.  
  5836.     /* var alertPopup = $ionicPopup.alert({
  5837.  
  5838.             title: 'Info',
  5839.  
  5840.             template: 'Balance Tidak Cukup'
  5841.  
  5842.           });
  5843.  
  5844.           */
  5845.  
  5846.     //  $state.go('snd.flight_book/:flight_id',{flight_id:$stateParams.flight_id});
  5847.  
  5848.  
  5849.  
  5850.     $state.go('snd.flight_book');
  5851.  
  5852.     }
  5853.  
  5854.  
  5855.  
  5856. })
  5857.  
  5858.  
  5859.  
  5860.  
  5861.  
  5862. .controller('FlightBookController', function($scope, $stateParams,$localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state) {
  5863.  
  5864.  
  5865.  
  5866.  
  5867.  
  5868.  
  5869. console.log("di flight book");
  5870.  
  5871.  
  5872.     $scope.isDisabled = false;
  5873.  
  5874.  
  5875.  
  5876. $scope.adultcount=$localStorage.adultcount;
  5877.  
  5878. $scope.childcount=$localStorage.childcount;
  5879.  
  5880. $scope.infantcount=$localStorage.infantcount;
  5881.  
  5882.  
  5883.  
  5884.  
  5885.  
  5886. console.log("adult count-->"+ $scope.adultcount);
  5887.  
  5888. console.log("child count-->"+ $scope.childcount);
  5889.  
  5890. console.log("infant count-->"+$scope.infantcount);
  5891.  
  5892.  
  5893.  
  5894. console.log("airline air esia-->"+$localStorage.airlineairasia);
  5895.  
  5896.  
  5897.  
  5898.  
  5899.  
  5900.  
  5901. $scope.airesia=$localStorage.airlineairasia;
  5902.  
  5903.  
  5904.  
  5905. $scope.user_first_name="";
  5906.  
  5907. $scope.user_last_name="";
  5908.  
  5909. $scope.user_email="";
  5910.  
  5911. $scope.user_mobile="";
  5912.  
  5913.  
  5914.  
  5915.   $scope.myArray = [{label:'a'},{label:'b'},{label:'c'}];
  5916.  
  5917.  
  5918.  
  5919.  
  5920.  
  5921.   //var jsonStr =' [{"adult":[{"adult_first_name":"1","adult_last_name":"1"},{"adult_first_name":"2","adult_last_name":"2"} ] }]';
  5922.  
  5923.  
  5924.  
  5925.  
  5926.  
  5927.  
  5928.  
  5929. var awal='[';
  5930.  
  5931. var awal2='[';
  5932.  
  5933. var awal3='[';
  5934.  
  5935.  
  5936.  
  5937. var ulangan='';
  5938.  
  5939. var ulangan2='';
  5940.  
  5941. var ulangan3='';
  5942.  
  5943.  
  5944.  
  5945. //var jsonStrAdult =' [{"first_name":"1","last_name":"1"},{"first_name":"2","last_name":"2"}]';
  5946.  
  5947.  
  5948.  
  5949. var jsonStrAdult =' [{"first_name":"1","last_name":"1"}]';
  5950.  
  5951. var locale='';
  5952.  
  5953. $scope.forminternational=true;
  5954.  
  5955.  
  5956.  
  5957. console.log("rute tujuan-->"+$localStorage.rutetujuan);
  5958.  
  5959.    if($localStorage.rutetujuan=='local')
  5960.  
  5961.  
  5962.  
  5963. {
  5964.  
  5965.   $scope.forminternational=false;
  5966.  
  5967. console.log("MASUK LOCAL");
  5968.  
  5969. //ADULT
  5970.  
  5971.   var d=1;
  5972.  
  5973. while (d <= $scope.adultcount) {
  5974.  
  5975. //ulangan=ulangan+'{"first_name":"'+d+'","last_name":"'+d+'"},';
  5976.  
  5977. // ulangan=ulangan+'{"title":"","first_name":"","last_name":"","dob":"","nationality":"ID","nationality_name":"","issuing_country_name":"","id_issuing_country":"ID","id_number":"","id_number_expire":"","departure_baggage":"","return_baggage":""},';
  5978.  
  5979.  
  5980.  
  5981. if( $localStorage.airlineairasia)
  5982.  
  5983. {
  5984.  
  5985.  
  5986. ulangan=ulangan+'{"title":"","first_name":"","last_name":"","dob":"1979-11-12","nationality":"ID","nationality_name":"","departure_baggage":"","return_baggage":""},';
  5987.  
  5988.  
  5989.  
  5990. }
  5991.  
  5992. else
  5993.  
  5994. {
  5995.  
  5996. ulangan=ulangan+'{"title":"","first_name":"","last_name":"","dob":"1979-11-12","departure_baggage":"","return_baggage":""},';
  5997.  
  5998.  
  5999.  
  6000. }
  6001.  
  6002. d++;
  6003.  
  6004. }
  6005.  
  6006.  
  6007.  
  6008.  
  6009.  
  6010. var str = ulangan.slice(0, -1);
  6011.  
  6012.  
  6013.  
  6014.  
  6015. var akhir=awal+str+']';
  6016.  
  6017.  
  6018. console.log(akhir);
  6019.  
  6020.  
  6021.  
  6022.   var objAdult = JSON.parse(jsonStrAdult);
  6023.  
  6024.  
  6025.  
  6026.   var responseAdult=angular.fromJson(akhir);
  6027.  
  6028.  
  6029.  
  6030.     $scope.adultloop2 = responseAdult;
  6031.  
  6032.    
  6033.  
  6034. // $scope.adultloop2=obj;
  6035.  
  6036.    
  6037.  
  6038.  
  6039.     //CHILD
  6040.  
  6041.    
  6042.  
  6043.     var e=1;
  6044.  
  6045. while (e <= $scope.childcount) {
  6046.  
  6047. //ulangan=ulangan+'{"first_name":"'+d+'","last_name":"'+d+'"},';
  6048.  
  6049. // ulangan=ulangan+'{"title":"","first_name":"","last_name":"","dob":"","nationality":"ID","nationality_name":"","issuing_country_name":"","id_issuing_country":"ID","id_number":"","id_number_expire":"","departure_baggage":"","return_baggage":""},';
  6050.  
  6051.  
  6052.  
  6053.  
  6054.  
  6055. if( $localStorage.airlineairasia)
  6056.  
  6057. {
  6058.  
  6059.  
  6060. ulangan2=ulangan2+'{"title":"","first_name":"","last_name":"","dob":"2005-08-15","nationality":"ID","nationality_name":"","departure_baggage":"","return_baggage":""},';
  6061.  
  6062.  
  6063.  
  6064. }
  6065.  
  6066. else
  6067.  
  6068. {
  6069.  
  6070. ulangan2=ulangan2+'{"title":"","first_name":"","last_name":"","dob":"2005-08-15","departure_baggage":"","return_baggage":""},';
  6071.  
  6072.  
  6073.  
  6074. }
  6075.  
  6076. e++;
  6077.  
  6078. }
  6079.  
  6080.  
  6081.  
  6082.  
  6083.  
  6084. var str2 = ulangan2.slice(0, -1);
  6085.  
  6086.  
  6087.  
  6088.  
  6089. var akhir2=awal2+str2+']';
  6090.  
  6091.  
  6092. console.log(akhir2);
  6093.  
  6094.  
  6095.  
  6096.  
  6097.  
  6098.   var responseAdult2=angular.fromJson(akhir2);
  6099.  
  6100.  
  6101.  
  6102.     $scope.childloop = responseAdult2;
  6103.  
  6104.    
  6105.  
  6106.    
  6107.  
  6108.   //INFANT
  6109.  
  6110.    
  6111.  
  6112.     var f=1;
  6113.  
  6114. while (f <= $scope.infantcount) {
  6115.  
  6116. //ulangan=ulangan+'{"first_name":"'+d+'","last_name":"'+d+'"},';
  6117.  
  6118. // ulangan=ulangan+'{"title":"","first_name":"","last_name":"","dob":"","nationality":"ID","nationality_name":"","issuing_country_name":"","id_issuing_country":"ID","id_number":"","id_number_expire":"","departure_baggage":"","return_baggage":""},';
  6119.  
  6120.  
  6121.  
  6122. if( $localStorage.airlineairasia)
  6123.  
  6124. {
  6125.  
  6126.  
  6127. ulangan3=ulangan3+'{"title":"","first_name":"","last_name":"","dob":"2015-08-15","nationality":"ID","nationality_name":"","departure_baggage":"","return_baggage":""},';
  6128.  
  6129.  
  6130.  
  6131. }
  6132.  
  6133. else
  6134.  
  6135. {
  6136.  
  6137. ulangan3=ulangan3+'{"title":"","first_name":"","last_name":"","dob":"2015-08-15","departure_baggage":"","return_baggage":""},';
  6138.  
  6139.  
  6140.  
  6141. }
  6142.  
  6143.  
  6144.  
  6145.  
  6146.  
  6147. f++;
  6148.  
  6149. }
  6150.  
  6151.  
  6152.  
  6153.  
  6154.  
  6155. var str3 = ulangan3.slice(0, -1);
  6156.  
  6157.  
  6158.  
  6159.  
  6160. var akhir3=awal3+str3+']';
  6161.  
  6162.  
  6163. console.log(akhir3);
  6164.  
  6165.  
  6166.  
  6167.  
  6168.  
  6169.   var responseAdult3=angular.fromJson(akhir3);
  6170.  
  6171.  
  6172.  
  6173.     $scope.infantloop = responseAdult3;
  6174.  
  6175. }
  6176.  
  6177. else
  6178.  
  6179. {
  6180.  
  6181. //ADULT
  6182.  
  6183.   var d=1;
  6184.  
  6185. while (d <= $scope.adultcount) {
  6186.  
  6187. //ulangan=ulangan+'{"first_name":"'+d+'","last_name":"'+d+'"},';
  6188.  
  6189. // ulangan=ulangan+'{"title":"","first_name":"","last_name":"","dob":"","nationality":"ID","nationality_name":"","issuing_country_name":"","id_issuing_country":"ID","id_number":"","id_number_expire":"","departure_baggage":"","return_baggage":""},';
  6190.  
  6191.  
  6192.  
  6193.  
  6194.  
  6195. if( $localStorage.airlineairasia)
  6196.  
  6197. {
  6198.  
  6199.  
  6200. ulangan=ulangan+'{"title":"","first_name":"","last_name":"","dob":"1988-08-15","nationality":"ID","nationality_name":"","issuing_country_name":"","id_issuing_country":"ID","id_number":"","id_number_expire":"2018-08-15","departure_baggage":"","return_baggage":""},';
  6201.  
  6202.  
  6203.  
  6204. }
  6205.  
  6206. else
  6207.  
  6208. {
  6209.  
  6210. ulangan=ulangan+'{"title":"","first_name":"","last_name":"","dob":"1988-08-15","issuing_country_name":"","id_issuing_country":"ID","id_number":"","id_number_expire":"2018-08-15","departure_baggage":"","return_baggage":""},';
  6211.  
  6212.  
  6213.  
  6214. }
  6215.  
  6216.  
  6217.  
  6218. d++;
  6219.  
  6220. }
  6221.  
  6222.  
  6223.  
  6224.  
  6225.  
  6226. var str = ulangan.slice(0, -1);
  6227.  
  6228.  
  6229.  
  6230.  
  6231. var akhir=awal+str+']';
  6232.  
  6233.  
  6234. console.log(akhir);
  6235.  
  6236.  
  6237.  
  6238.   var objAdult = JSON.parse(jsonStrAdult);
  6239.  
  6240.  
  6241.  
  6242.   var responseAdult=angular.fromJson(akhir);
  6243.  
  6244.  
  6245.  
  6246.     $scope.adultloop2 = responseAdult;
  6247.  
  6248.    
  6249.  
  6250. // $scope.adultloop2=obj;
  6251.  
  6252.    
  6253.  
  6254.  
  6255.     //CHILD
  6256.  
  6257.    
  6258.  
  6259.     var e=1;
  6260.  
  6261. while (e <= $scope.childcount) {
  6262.  
  6263. //ulangan=ulangan+'{"first_name":"'+d+'","last_name":"'+d+'"},';
  6264.  
  6265. // ulangan=ulangan+'{"title":"","first_name":"","last_name":"","dob":"","nationality":"ID","nationality_name":"","issuing_country_name":"","id_issuing_country":"ID","id_number":"","id_number_expire":"","departure_baggage":"","return_baggage":""},';
  6266.  
  6267. //ulangan2=ulangan2+'{"title":"","first_name":"","last_name":"","dob":"2005-08-15","nationality":"ID","nationality_name":"","issuing_country_name":"","id_issuing_country":"ID","id_number":"","id_number_expire":"2018-08-15","departure_baggage":"","return_baggage":""},';
  6268.  
  6269.  
  6270.  
  6271. if( $localStorage.airlineairasia)
  6272.  
  6273. {
  6274.  
  6275.  
  6276. ulangan2=ulangan2+'{"title":"","first_name":"","last_name":"","dob":"2005-08-15","nationality":"ID","nationality_name":"","issuing_country_name":"","id_issuing_country":"ID","id_number":"","id_number_expire":"2018-08-15","departure_baggage":"","return_baggage":""},';
  6277.  
  6278.  
  6279.  
  6280. }
  6281.  
  6282. else
  6283.  
  6284. {
  6285.  
  6286. ulangan2=ulangan2+'{"title":"","first_name":"","last_name":"","dob":"2005-08-15","issuing_country_name":"","id_issuing_country":"ID","id_number":"","id_number_expire":"2018-08-15","departure_baggage":"","return_baggage":""},';
  6287.  
  6288.  
  6289.  
  6290. }
  6291.  
  6292.  
  6293.  
  6294. e++;
  6295.  
  6296. }
  6297.  
  6298.  
  6299.  
  6300.  
  6301.  
  6302. var str2 = ulangan2.slice(0, -1);
  6303.  
  6304.  
  6305.  
  6306.  
  6307. var akhir2=awal2+str2+']';
  6308.  
  6309.  
  6310. console.log(akhir2);
  6311.  
  6312.  
  6313.  
  6314.  
  6315.  
  6316.   var responseAdult2=angular.fromJson(akhir2);
  6317.  
  6318.  
  6319.  
  6320.     $scope.childloop = responseAdult2;
  6321.  
  6322.    
  6323.  
  6324.    
  6325.  
  6326. //INFANT
  6327.  
  6328.    
  6329.  
  6330.     var f=1;
  6331.  
  6332. while (f <= $scope.infantcount) {
  6333.  
  6334. //ulangan=ulangan+'{"first_name":"'+d+'","last_name":"'+d+'"},';
  6335.  
  6336. // ulangan=ulangan+'{"title":"","first_name":"","last_name":"","dob":"","nationality":"ID","nationality_name":"","issuing_country_name":"","id_issuing_country":"ID","id_number":"","id_number_expire":"","departure_baggage":"","return_baggage":""},';
  6337.  
  6338. // ulangan3=ulangan3+'{"title":"","first_name":"","last_name":"","dob":"2015-08-15","nationality":"ID","nationality_name":"","issuing_country_name":"","id_issuing_country":"ID","id_number":"","id_number_expire":"2020-08-15","departure_baggage":"","return_baggage":""},';
  6339.  
  6340.  
  6341.  
  6342.  
  6343.  
  6344. if( $localStorage.airlineairasia)
  6345.  
  6346. {
  6347.  
  6348.  
  6349. ulangan3=ulangan3+'{"title":"","first_name":"","last_name":"","dob":"2015-08-15","nationality":"ID","nationality_name":"","issuing_country_name":"","id_issuing_country":"ID","id_number":"","id_number_expire":"2020-08-15","departure_baggage":"","return_baggage":""},';
  6350.  
  6351. }
  6352.  
  6353. else
  6354.  
  6355. {
  6356.  
  6357. ulangan3=ulangan3+'{"title":"","first_name":"","last_name":"","dob":"2015-08-15","issuing_country_name":"","id_issuing_country":"ID","id_number":"","id_number_expire":"2020-08-15","departure_baggage":"","return_baggage":""},';
  6358.  
  6359. }
  6360.  
  6361.  
  6362.  
  6363. f++;
  6364.  
  6365. }
  6366.  
  6367.  
  6368.  
  6369.  
  6370.  
  6371. var str3 = ulangan3.slice(0, -1);
  6372.  
  6373.  
  6374.  
  6375.  
  6376. var akhir3=awal3+str3+']';
  6377.  
  6378.  
  6379. console.log(akhir3);
  6380.  
  6381.  
  6382.  
  6383.  
  6384.  
  6385.   var responseAdult3=angular.fromJson(akhir3);
  6386.  
  6387.  
  6388.  
  6389.     $scope.infantloop = responseAdult3;
  6390.  
  6391.  
  6392. }
  6393.  
  6394.     ////////////////////
  6395.  
  6396.  
  6397.  
  6398. var fruits = [];
  6399.  
  6400. var i=1;
  6401.  
  6402. while (i <= $scope.adultcount) {
  6403.  
  6404. fruits.push("adult_last_name:"+i);
  6405.  
  6406. console.log(i);
  6407.  
  6408.     i++;
  6409.  
  6410. }
  6411.  
  6412.  
  6413.  
  6414.  
  6415.  
  6416.  
  6417.  
  6418.  
  6419.  
  6420. //$scope.book = function(user_first_name,user_last_name,user_email,user_mobile,adult_first_name,adult_last_name,adult_dob,adult_nationality,adult_passport,adult_passpord_end_date,adult_passpord_made_date,adult_country_passport) {
  6421.  
  6422. $scope.book = function(user_first_name,user_last_name,user_email,user_mobile,usertitle) {
  6423.  
  6424. console.log("book-->"+user_mobile);
  6425.  
  6426. console.log("user_title-->"+usertitle);
  6427.  
  6428.  
  6429.  
  6430. console.log("adultloop-->"+$scope.adultloop2);
  6431.  
  6432. console.log("childloop-->"+$scope.childloop);
  6433.  
  6434. console.log("infantloop-->"+$scope.infantloop);
  6435.  
  6436.  
  6437.  
  6438. $scope.login=true;
  6439.  
  6440.         if($localStorage.email==null)
  6441.  
  6442.     {
  6443.  
  6444.     console.log("belum login");
  6445.  
  6446.        
  6447.  
  6448.         var alertPopup = $ionicPopup.alert({
  6449.  
  6450.             title: 'Info',
  6451.  
  6452.             template: 'Please Login first to Book Flight'
  6453.  
  6454.           });
  6455.  
  6456.    
  6457.  
  6458.         $state.go('snd.login');
  6459.  
  6460.         $scope.login=false;
  6461.  
  6462.     }
  6463.  
  6464.        
  6465.  
  6466.  
  6467.  
  6468.         if($scope.login==false){
  6469.  
  6470.        
  6471.  
  6472.        
  6473.  
  6474.         }
  6475.  
  6476.         else
  6477.  
  6478.         {
  6479.  
  6480.  
  6481.  
  6482. //VALIDATION FIELD
  6483.  
  6484.        
  6485.  
  6486.         console.log("user title--->")+usertitle;
  6487.  
  6488.        
  6489.  
  6490.         console.log("user titlesssss-->"+$scope.usertitle);
  6491.  
  6492.        
  6493.  
  6494.           if(angular.isUndefined(usertitle))
  6495.  
  6496.  
  6497.  
  6498.         {
  6499.  
  6500.           var alertPopup = $ionicPopup.alert({
  6501.  
  6502.                 title: 'Info',
  6503.  
  6504.                 template: 'Title pemesan harus diisi'
  6505.  
  6506.               });
  6507.  
  6508.             return false;
  6509.  
  6510.            
  6511.  
  6512.         }
  6513.  
  6514.       /* if(angular.isUndefined($scope.user_title) || $scope.user_title=="")
  6515.  
  6516.  
  6517.  
  6518.         // if($scope.user_title=="")
  6519.  
  6520.  
  6521.  
  6522.         {
  6523.  
  6524.         var alertPopup = $ionicPopup.alert({
  6525.  
  6526.                 title: 'Info',
  6527.  
  6528.                 template: 'Title Pemesan harus dipilih'
  6529.  
  6530.               });
  6531.  
  6532.             return false;
  6533.  
  6534.         }
  6535.  
  6536.         */
  6537.  
  6538.          
  6539.  
  6540.             console.log("REGEXXXX")
  6541.  
  6542.  
  6543.  
  6544.             var regex2=/^[a-zA-Z]+$/;
  6545.  
  6546.             var regex = /^[a-zA-Z\s]+$/;
  6547.  
  6548.            
  6549.  
  6550.  
  6551.  
  6552.             if(user_first_name=="")
  6553.  
  6554.  
  6555.  
  6556.         {
  6557.  
  6558.         var alertPopup = $ionicPopup.alert({
  6559.  
  6560.                 title: 'Info',
  6561.  
  6562.                 template: 'Nama Depan Pemesan harus diisi'
  6563.  
  6564.               });
  6565.  
  6566.             return false;
  6567.  
  6568.         }
  6569.  
  6570.          
  6571.  
  6572.             if (!user_first_name.match(regex))
  6573.  
  6574.             {
  6575.  
  6576.             var alertPopup = $ionicPopup.alert({
  6577.  
  6578.                 title: 'Info',
  6579.  
  6580.                 template: 'Nama Depan hanya boleh mengandung huruf'
  6581.  
  6582.               });
  6583.  
  6584.             return false;
  6585.  
  6586.             }
  6587.  
  6588.          
  6589.  
  6590.         if(user_last_name=="")
  6591.  
  6592.  
  6593.  
  6594.         {
  6595.  
  6596.         var alertPopup = $ionicPopup.alert({
  6597.  
  6598.                 title: 'Info',
  6599.  
  6600.                 template: 'Nama Belakang Pemesan harus diisi'
  6601.  
  6602.               });
  6603.  
  6604.             return false;
  6605.  
  6606.         }
  6607.  
  6608.          
  6609.  
  6610.         if (!user_last_name.match(regex2))
  6611.  
  6612.             {
  6613.  
  6614.             var alertPopup = $ionicPopup.alert({
  6615.  
  6616.                 title: 'Info',
  6617.  
  6618.                 template: 'Nama Belakang hanya boleh mengandung huruf'
  6619.  
  6620.               });
  6621.  
  6622.             return false;
  6623.  
  6624.             }
  6625.  
  6626.          
  6627.  
  6628.          
  6629.  
  6630.         if(user_email=="")
  6631.  
  6632.  
  6633.  
  6634.         {
  6635.  
  6636.         var alertPopup = $ionicPopup.alert({
  6637.  
  6638.                 title: 'Info',
  6639.  
  6640.                 template: 'Email Pemesan harus diisi'
  6641.  
  6642.               });
  6643.  
  6644.             return false;
  6645.  
  6646.         }
  6647.  
  6648.          
  6649.  
  6650.        
  6651.  
  6652.          
  6653.  
  6654.        
  6655.  
  6656.           if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,10})+$/.test(user_email))  
  6657.  
  6658.           {  
  6659.  
  6660.          
  6661.  
  6662.           }  
  6663.  
  6664.           else
  6665.  
  6666.           {
  6667.  
  6668.           var alertPopup = $ionicPopup.alert({
  6669.  
  6670.                 title: 'Info',
  6671.  
  6672.                 template: 'Format Email tidak valid'
  6673.  
  6674.               });
  6675.  
  6676.           return false;
  6677.  
  6678.           }
  6679.  
  6680.          
  6681.  
  6682.          
  6683.  
  6684.           if(user_mobile=="")
  6685.  
  6686.  
  6687.  
  6688.         {
  6689.  
  6690.         var alertPopup = $ionicPopup.alert({
  6691.  
  6692.                 title: 'Info',
  6693.  
  6694.                 template: 'No HP Pemesan harus diisi'
  6695.  
  6696.               });
  6697.  
  6698.             return false;
  6699.  
  6700.         }
  6701.  
  6702.              
  6703.  
  6704.              
  6705.  
  6706.            
  6707.  
  6708.           if (/^[0-9]+$/.test(user_mobile))  
  6709.  
  6710.           {  
  6711.  
  6712.          
  6713.  
  6714.           }  
  6715.  
  6716.           else
  6717.  
  6718.           {
  6719.  
  6720.           var alertPopup = $ionicPopup.alert({
  6721.  
  6722.                 title: 'Info',
  6723.  
  6724.                 template: 'No HP harus angka'
  6725.  
  6726.               });
  6727.  
  6728.           return false;
  6729.  
  6730.           }
  6731.  
  6732.  
  6733.  
  6734.           if (user_mobile.length  < 6) {
  6735.  
  6736.           console.log('mobile lebih kecil dari 6')
  6737.  
  6738.           var alertPopup = $ionicPopup.alert({
  6739.  
  6740.                 title: 'Info',
  6741.  
  6742.                 template: 'No HP harus > 6 digit'
  6743.  
  6744.               });
  6745.  
  6746.             return false;            
  6747.  
  6748.         }
  6749.  
  6750.          
  6751.  
  6752.          
  6753.  
  6754.  
  6755.  
  6756.        
  6757.  
  6758.          
  6759.  
  6760.           var i=0;
  6761.  
  6762.           var j=1;
  6763.  
  6764.           while (i < $scope.adultloop2.length) {
  6765.  
  6766.      
  6767.  
  6768.          
  6769.  
  6770.           if ($scope.adultloop2[i].title=="") {
  6771.  
  6772.           var alertPopup = $ionicPopup.alert({
  6773.  
  6774.                 title: 'Info',
  6775.  
  6776.                 template: 'Title Dewasa ' + j +' harus dipilih'
  6777.  
  6778.               });
  6779.  
  6780.             return false;            
  6781.  
  6782.         }
  6783.  
  6784.          
  6785.  
  6786.          
  6787.  
  6788.           if ($scope.adultloop2[i].first_name=="") {
  6789.  
  6790.           var alertPopup = $ionicPopup.alert({
  6791.  
  6792.                 title: 'Info',
  6793.  
  6794.                 template: 'Nama depan Dewasa ' + j +' harus diisi'
  6795.  
  6796.               });
  6797.  
  6798.             return false;            
  6799.  
  6800.         }
  6801.  
  6802.          
  6803.  
  6804.          
  6805.  
  6806.           if (!$scope.adultloop2[i].first_name.match(regex))
  6807.  
  6808.             {
  6809.  
  6810.             var alertPopup = $ionicPopup.alert({
  6811.  
  6812.                 title: 'Info',
  6813.  
  6814.                 template: 'Nama Depan Dewasa ' + j + ' hanya boleh mengandung huruf'
  6815.  
  6816.               });
  6817.  
  6818.             return false;
  6819.  
  6820.             }
  6821.  
  6822.          
  6823.  
  6824.          
  6825.  
  6826.           if ($scope.adultloop2[i].last_name=="") {
  6827.  
  6828.           var alertPopup = $ionicPopup.alert({
  6829.  
  6830.                 title: 'Info',
  6831.  
  6832.                 template: 'Nama Belakang Dewasa ' + j +' harus diisi'
  6833.  
  6834.               });
  6835.  
  6836.             return false;            
  6837.  
  6838.         }
  6839.  
  6840.          
  6841.  
  6842.           if (!$scope.adultloop2[i].last_name.match(regex2))
  6843.  
  6844.             {
  6845.  
  6846.             var alertPopup = $ionicPopup.alert({
  6847.  
  6848.                 title: 'Info',
  6849.  
  6850.                 template: 'Nama Belakang Dewasa ' + j + ' hanya boleh mengandung huruf'
  6851.  
  6852.               });
  6853.  
  6854.             return false;
  6855.  
  6856.             }
  6857.  
  6858.          
  6859.  
  6860.          
  6861.  
  6862.         /*  if ($scope.adultloop2[i].nationality_name=="") {
  6863.  
  6864.           var alertPopup = $ionicPopup.alert({
  6865.  
  6866.                 title: 'Info',
  6867.  
  6868.                 template: 'Kewarganegaraan Dewasa ' + j +' harus dipilih'
  6869.  
  6870.               });
  6871.  
  6872.             return false;            
  6873.  
  6874.         }
  6875.  
  6876.           */
  6877.  
  6878.          
  6879.  
  6880.          
  6881.  
  6882.         i++;
  6883.  
  6884.         j++;
  6885.  
  6886.       }
  6887.  
  6888.          
  6889.  
  6890.          
  6891.  
  6892.          
  6893.  
  6894.           var k=0;
  6895.  
  6896.           var l=1;
  6897.  
  6898.           while (k < $scope.childloop.length) {
  6899.  
  6900.          
  6901.  
  6902.           if ($scope.childloop[k].title=="") {
  6903.  
  6904.           var alertPopup = $ionicPopup.alert({
  6905.  
  6906.                 title: 'Info',
  6907.  
  6908.                 template: 'Title Anak ' + l +' harus dipilih'
  6909.  
  6910.               });
  6911.  
  6912.             return false;            
  6913.  
  6914.         }
  6915.  
  6916.          
  6917.  
  6918.      
  6919.  
  6920.          
  6921.  
  6922.           if ($scope.childloop[k].first_name=="") {
  6923.  
  6924.           var alertPopup = $ionicPopup.alert({
  6925.  
  6926.                 title: 'Info',
  6927.  
  6928.                 template: 'Nama depan Anak ' + l +' harus diisi'
  6929.  
  6930.               });
  6931.  
  6932.             return false;            
  6933.  
  6934.         }
  6935.  
  6936.          
  6937.  
  6938.          
  6939.  
  6940.           if (!$scope.childloop[k].first_name.match(regex))
  6941.  
  6942.             {
  6943.  
  6944.             var alertPopup = $ionicPopup.alert({
  6945.  
  6946.                 title: 'Info',
  6947.  
  6948.                 template: 'Nama Depan Anak ' + l + ' hanya boleh mengandung huruf'
  6949.  
  6950.               });
  6951.  
  6952.             return false;
  6953.  
  6954.             }
  6955.  
  6956.          
  6957.  
  6958.          
  6959.  
  6960.           if ($scope.childloop[k].last_name=="") {
  6961.  
  6962.           var alertPopup = $ionicPopup.alert({
  6963.  
  6964.                 title: 'Info',
  6965.  
  6966.                 template: 'Nama Belakang Anak ' + l +' harus diisi'
  6967.  
  6968.               });
  6969.  
  6970.             return false;            
  6971.  
  6972.         }
  6973.  
  6974.          
  6975.  
  6976.           if (!$scope.childloop[k].last_name.match(regex2))
  6977.  
  6978.             {
  6979.  
  6980.             var alertPopup = $ionicPopup.alert({
  6981.  
  6982.                 title: 'Info',
  6983.  
  6984.                 template: 'Nama Belakang Anak ' + l + ' hanya boleh mengandung huruf'
  6985.  
  6986.               });
  6987.  
  6988.             return false;
  6989.  
  6990.             }
  6991.  
  6992.          
  6993.  
  6994.          
  6995.  
  6996.         /*  if ($scope.childloop[k].nationality_name=="") {
  6997.  
  6998.           var alertPopup = $ionicPopup.alert({
  6999.  
  7000.                 title: 'Info',
  7001.  
  7002.                 template: 'Kewarganegaraan Anak ' + l +' harus dipilih'
  7003.  
  7004.               });
  7005.  
  7006.             return false;            
  7007.  
  7008.         }
  7009.  
  7010.           */
  7011.  
  7012.          
  7013.  
  7014.          
  7015.  
  7016.         k++;
  7017.  
  7018.         l++;
  7019.  
  7020.       }
  7021.  
  7022.          
  7023.  
  7024.          
  7025.  
  7026.           var m=0;
  7027.  
  7028.           var n=1;
  7029.  
  7030.           while (m < $scope.infantloop.length) {
  7031.  
  7032.          
  7033.  
  7034.           if ($scope.infantloop[m].title=="") {
  7035.  
  7036.           var alertPopup = $ionicPopup.alert({
  7037.  
  7038.                 title: 'Info',
  7039.  
  7040.                 template: 'Title Bayi ' + n +' harus dipilih'
  7041.  
  7042.               });
  7043.  
  7044.             return false;            
  7045.  
  7046.         }
  7047.  
  7048.          
  7049.  
  7050.      
  7051.  
  7052.          
  7053.  
  7054.           if ($scope.infantloop[m].first_name=="") {
  7055.  
  7056.           var alertPopup = $ionicPopup.alert({
  7057.  
  7058.                 title: 'Info',
  7059.  
  7060.                 template: 'Nama depan Bayi ' + n +' harus diisi'
  7061.  
  7062.               });
  7063.  
  7064.             return false;            
  7065.  
  7066.         }
  7067.  
  7068.          
  7069.  
  7070.          
  7071.  
  7072.           if (!$scope.infantloop[m].first_name.match(regex))
  7073.  
  7074.             {
  7075.  
  7076.             var alertPopup = $ionicPopup.alert({
  7077.  
  7078.                 title: 'Info',
  7079.  
  7080.                 template: 'Nama Depan Bayi ' + n + ' hanya boleh mengandung huruf'
  7081.  
  7082.               });
  7083.  
  7084.             return false;
  7085.  
  7086.             }
  7087.  
  7088.          
  7089.  
  7090.          
  7091.  
  7092.           if ($scope.infantloop[m].last_name=="") {
  7093.  
  7094.           var alertPopup = $ionicPopup.alert({
  7095.  
  7096.                 title: 'Info',
  7097.  
  7098.                 template: 'Nama Belakang Bayi ' + n +' harus diisi'
  7099.  
  7100.               });
  7101.  
  7102.             return false;            
  7103.  
  7104.         }
  7105.  
  7106.          
  7107.  
  7108.           if (!$scope.infantloop[m].last_name.match(regex2))
  7109.  
  7110.             {
  7111.  
  7112.             var alertPopup = $ionicPopup.alert({
  7113.  
  7114.                 title: 'Info',
  7115.  
  7116.                 template: 'Nama Belakang Bayi ' + n + ' hanya boleh mengandung huruf'
  7117.  
  7118.               });
  7119.  
  7120.             return false;
  7121.  
  7122.             }
  7123.  
  7124.          
  7125.  
  7126.          
  7127.  
  7128.         /*    if ($scope.infantloop[m].nationality_name=="") {
  7129.  
  7130.           var alertPopup = $ionicPopup.alert({
  7131.  
  7132.                 title: 'Info',
  7133.  
  7134.                 template: 'Kewarganegaraan Anak ' + n +' harus dipilih'
  7135.  
  7136.               });
  7137.  
  7138.             return false;            
  7139.  
  7140.         }
  7141.  
  7142.          
  7143.  
  7144.           */
  7145.  
  7146.          
  7147.  
  7148.         k++;
  7149.  
  7150.         l++;
  7151.  
  7152.       }
  7153.  
  7154.          
  7155.  
  7156.          
  7157.  
  7158.          
  7159.  
  7160.          
  7161.  
  7162.         /// END VALIDATION FIELD
  7163.  
  7164.             $scope.isDisabled = true;
  7165.  
  7166.            
  7167.  
  7168.             $scope.flight_id=   $localStorage.outboundflightid;
  7169.  
  7170.            
  7171.  
  7172.         $scope.supplierbeda=false;
  7173.  
  7174.  
  7175.  
  7176.             if($localStorage.togglereturn==true)
  7177.  
  7178.         {
  7179.  
  7180.            
  7181.  
  7182.            
  7183.  
  7184.             //jika supplier id sama
  7185.  
  7186.                
  7187.  
  7188.               if( $localStorage.outboundsupplierid== $localStorage.inboundsupplierid)
  7189.  
  7190. {
  7191.  
  7192.            
  7193.  
  7194.               console.log("SUPPLIER ID SAMA");
  7195.  
  7196.         $scope.flight_id='"'+$scope.flight_id+','+$localStorage.inboundflightid+'"';
  7197.  
  7198.        
  7199.  
  7200. }
  7201.  
  7202.            
  7203.  
  7204.               else
  7205.  
  7206.               {
  7207.  
  7208.            
  7209.  
  7210.               console.log("SUPPLIER ID BEDA");
  7211.  
  7212.         $scope.flight_id='"'+$scope.flight_id+'","'+$localStorage.inboundflightid+'"';
  7213.  
  7214.         $scope.supplierbeda=true;
  7215.  
  7216.               }
  7217.  
  7218.            
  7219.  
  7220.               console.log("hasil flight idnya-->"+$scope.flight_id);
  7221.  
  7222.            
  7223.  
  7224.         }
  7225.  
  7226.            
  7227.  
  7228.            
  7229.  
  7230.            
  7231.  
  7232.            
  7233.  
  7234.            
  7235.  
  7236.         //$http.post('http://dxplor.com/dxplor/Mo_flight/book_flight', {flight_id : $stateParams.flight_id,user_first_name : user_first_name,user_last_name : user_last_name,user_email : user_email,user_mobile : user_mobile,adult_first_name : adult_first_name,adult_last_name : adult_last_name,adult_dob : adult_dob,adult_nationality : adult_nationality,adult_passport : adult_passport,adult_passpord_end_date : adult_passpord_end_date,adult_passpord_made_date : adult_passpord_made_date,adult_country_passport : adult_country_passport})
  7237.     console.log({flight_id : $scope.flight_id,user_first_name : user_first_name,user_last_name : user_last_name,user_email : user_email,user_mobile : user_mobile,result : $scope.adultloop2,result2 : $scope.childloop, result3 : $scope.infantloop,customerid :  $localStorage.customerid});
  7238.   $http.post('http://dxplor.com/dxplor/Mo_flight/book_flight', {flight_id : $scope.flight_id,user_first_name : user_first_name,user_last_name : user_last_name,user_email : user_email,user_mobile : user_mobile,result : $scope.adultloop2,result2 : $scope.childloop, result3 : $scope.infantloop,customerid :  $localStorage.customerid})
  7239.  
  7240.  
  7241.  
  7242.       .success(function(data, status, headers,config){
  7243.  
  7244.         //console.log('data success-->'+data);
  7245.  
  7246.       // console.log(data); // for browser console
  7247.  
  7248.        
  7249.  
  7250.             $scope.isDisabled = false;
  7251.  
  7252.  
  7253.  
  7254.       //  alert(data);
  7255.  
  7256.                
  7257.  
  7258.        
  7259.  
  7260.         console.log( 'data success-->'+JSON.stringify(data) );
  7261.  
  7262.  
  7263.  
  7264.       // console.log( 'booking code-->'+data.booking_code );
  7265.  
  7266.  
  7267.  
  7268.    
  7269.  
  7270.  
  7271.      
  7272.  
  7273.  
  7274.  
  7275.     if(angular.isUndefined(data.booking_code))
  7276.  
  7277.     {
  7278.  
  7279.      
  7280.  
  7281.     console.log("Undefined Data.booking_code");
  7282.  
  7283.      
  7284.  
  7285.     if(angular.isUndefined(data[0].booking_code))
  7286.  
  7287.     {
  7288.  
  7289.      
  7290.  
  7291.     console.log("Undefined Data[0].booking_code");
  7292.  
  7293.  
  7294.  
  7295.  
  7296.  
  7297.      
  7298.  
  7299.  
  7300.  
  7301.             var alertPopup = $ionicPopup.alert({
  7302.  
  7303.                 title: 'Info',
  7304.  
  7305.                 template: 'Failed to book please contact Dxplor Admin'
  7306.  
  7307.               });
  7308.  
  7309.     }
  7310.  
  7311.     else
  7312.  
  7313.     {
  7314.  
  7315.     //  $state.go('snd.flight_issued/57756');
  7316.  
  7317.     console.log("masuk else Undefined Data[0].booking_code ");
  7318.  
  7319.  
  7320.  
  7321.     if($scope.supplierbeda==true)
  7322.  
  7323.     {
  7324.  
  7325.    
  7326.  
  7327.     console.log("masuk supplier bedas ");
  7328.  
  7329.      
  7330.  
  7331.     if(angular.isUndefined(data[1].booking_code))
  7332.  
  7333.     {
  7334.  
  7335.       var alertPopup = $ionicPopup.alert({
  7336.  
  7337.                 title: 'Info',
  7338.  
  7339.                 template: 'Failed to book please contact Dxplor Admin'
  7340.  
  7341.               });
  7342.  
  7343.     }
  7344.  
  7345.      
  7346.  
  7347.     else
  7348.  
  7349.     {
  7350.  
  7351.      
  7352.  
  7353.     $localStorage.bookingcode=data[0].booking_code+','+data[1].booking_code;
  7354.  
  7355.     $state.go('snd.flight_issued');
  7356.  
  7357.     }
  7358.  
  7359.  
  7360.  
  7361.    
  7362.  
  7363.  
  7364.  
  7365.     }
  7366.  
  7367.     else
  7368.  
  7369.     {
  7370.  
  7371.     console.log("masuk else =  supplier sama ");
  7372.  
  7373.  
  7374.  
  7375.     console.log("booking code "+data[0].booking_code);
  7376.  
  7377.     $localStorage.bookingcode=data[0].booking_code;
  7378.  
  7379.  
  7380.  
  7381.     //$state.go('snd.flight_issued/:booking_code',{booking_code:data[0].booking_code});
  7382.  
  7383.     $state.go('snd.flight_issued');
  7384.  
  7385.  
  7386.  
  7387.     }
  7388.  
  7389.      
  7390.  
  7391.    
  7392.  
  7393.     }
  7394.  
  7395.  
  7396.  
  7397.     }
  7398.  
  7399.      
  7400.  
  7401.     else
  7402.  
  7403.     {
  7404.  
  7405.       //  $state.go('snd.flight_issued/57756');
  7406.  
  7407.     console.log("masuk else gede ");
  7408.  
  7409.  
  7410.  
  7411.     console.log("booking code "+data.booking_code);
  7412.  
  7413.     $localStorage.bookingcode=data.booking_code;
  7414.  
  7415.  
  7416.  
  7417.     //$state.go('snd.flight_issued/:booking_code',{booking_code:data.booking_code});
  7418.  
  7419.     $state.go('snd.flight_issued');
  7420.  
  7421.  
  7422.  
  7423.       }
  7424.  
  7425.    
  7426.  
  7427.  
  7428.  
  7429.  
  7430.  
  7431.        
  7432.  
  7433.       })
  7434.  
  7435.       .error(function(data, status, headers,config){
  7436.  
  7437.         console.log('data error'+data);
  7438.  
  7439.         console.log( 'data error-->'+JSON.stringify(data) );
  7440.  
  7441.  
  7442.  
  7443.             $scope.isDisabled = false;
  7444.  
  7445.  
  7446.  
  7447.         var alertPopup = $ionicPopup.alert({
  7448.  
  7449.                 title: 'Info',
  7450.  
  7451.                 template: 'Failed to book please contact Dxplor Admin'
  7452.  
  7453.               });
  7454.  
  7455.       })
  7456.  
  7457.       .then(function(result){
  7458.  
  7459.         things = result.data;
  7460.  
  7461.             $scope.isDisabled = false;
  7462.  
  7463.  
  7464.  
  7465.       });
  7466.  
  7467.  
  7468.  
  7469.  
  7470. }
  7471.  
  7472. }
  7473.  
  7474.  
  7475.  
  7476. })
  7477.  
  7478.  
  7479.  
  7480.  
  7481.  
  7482.  
  7483.  
  7484. .controller('FlightIssuedController', function($scope, $stateParams,$localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state) {
  7485.  
  7486.  
  7487.  
  7488. console.log("di flight issued, booking code-->"+ $localStorage.bookingcode);
  7489.  
  7490.  
  7491.  
  7492. $scope.result = "";
  7493.  
  7494.   //    $http.get('http://dxplor.com/dxplor/Mo_flight/get_transaction_flight_detail/'+$stateParams.booking_code)
  7495.  
  7496.  
  7497. $scope.multiplecode=false;
  7498.  
  7499.  
  7500.  
  7501.     if($localStorage.bookingcode.indexOf(",") != -1)
  7502.  
  7503. {
  7504.  
  7505.  
  7506.     // MULTIPLE BOOKING CODE
  7507.  
  7508.    
  7509.  
  7510.     $scope.multiplecode=true;
  7511.  
  7512.    
  7513.  
  7514.  var res = $localStorage.bookingcode.split(",");
  7515.  
  7516.  
  7517.  
  7518.    
  7519.  
  7520.  $http.get('http://dxplor.com/dxplor/Mo_flight/get_transaction_flight_detail/'+ res[0])
  7521.  
  7522.  
  7523. //$http.get('http://dxplor.com/dxplor/Mo_flight/get_transaction_flight_detail/L85Y8Z')
  7524.  
  7525.  
  7526.    
  7527.  
  7528.  
  7529.  
  7530.    .success(function(data, status, headers,config){
  7531.  
  7532.      console.log('data success');
  7533.  
  7534.      console.log(data); // for browser console
  7535.  
  7536.      
  7537.  
  7538.      $scope.result =  data;
  7539.  
  7540.      
  7541.  
  7542.      
  7543.  
  7544.      $scope.transaction_id=data[0].transaction_flight_id;
  7545.  
  7546.      
  7547.  
  7548.      console.log("dsadas");
  7549.  
  7550.    //  console.log(data[0].contact.title);
  7551.  
  7552.      console.log('transaction flight id-->'+data[0].transaction_flight_id);
  7553.  
  7554.      console.log(data[0].booking_code);
  7555.  
  7556.      console.log(data[0].flight_schedule[0].from);
  7557.  
  7558.      
  7559.  
  7560.      // Flight Detail
  7561.  
  7562.      
  7563.  
  7564.      $scope.flight_detail=data[0].flight_schedule;
  7565.  
  7566.      $scope.from=data[0].flight_schedule[0].from;
  7567.  
  7568.      $scope.to=data[0].flight_schedule[0].to;
  7569.  
  7570.      $scope.from_time=data[0].flight_schedule[0].departure_time;
  7571.  
  7572.      $scope.to_time=data[0].flight_schedule[0].arrival_time;
  7573.  
  7574.      $scope.from_date=data[0].flight_schedule[0].departure_date;
  7575.  
  7576.      $scope.to_date=data[0].flight_schedule[0].arrival_date;
  7577.  
  7578.      $scope.booking_code=data[0].booking_code;
  7579.  
  7580.      $scope.total_price=data[0].total_price;
  7581.  
  7582.      $scope.nett_price=data[0].nett_price;
  7583.  
  7584.  
  7585.      
  7586.  
  7587.      // Data Pemesan
  7588.  
  7589.      
  7590.  
  7591.      $scope.pemesan_first_name=data[0].contact.first_name;
  7592.  
  7593.      $scope.pemesan_last_name=data[0].contact.last_name;
  7594.  
  7595.      $scope.pemesan_email=data[0].contact.email;
  7596.  
  7597.      $scope.pemesan_phone=data[0].contact.phone;
  7598.  
  7599.      
  7600.  
  7601.      // Data Adult
  7602.  
  7603.      console.log('asdad');
  7604.  
  7605.    //  console.log('adult-->'+data[0].pax.adult[0].first_name);
  7606.  
  7607.  
  7608.  
  7609.      $scope.loop_adult=data[0].pax.adult;
  7610.  
  7611.      $scope.adult_first_name=data[0].pax.adult[0].first_name;
  7612.  
  7613.      $scope.adult_last_name=data[0].pax.adult[0].last_name;
  7614.  
  7615.      $scope.adult_passport=data[0].pax.adult[0].id_number;
  7616.  
  7617.      
  7618.  
  7619.      console.log('aaa->'+$scope.adult_first_name);
  7620.  
  7621.  
  7622.  
  7623.      console.log('bbb->'+$scope.loop_adult);
  7624.  
  7625.  
  7626.  
  7627.      
  7628.  
  7629.      //Data Child
  7630.  
  7631.      if(angular.isUndefined(data[0].pax.child))
  7632.  
  7633. {
  7634.  
  7635.  
  7636.  
  7637.  
  7638.  
  7639.  
  7640.  
  7641.  
  7642.  
  7643. }
  7644.  
  7645.  
  7646.  
  7647. else
  7648.  
  7649. {
  7650.  
  7651.   $scope.loop_child=data[0].pax.child;
  7652.  
  7653.    $scope.child_first_name=data[0].pax.child[0].first_name;
  7654.  
  7655.    $scope.child_last_name=data[0].pax.child[0].last_name;
  7656.  
  7657.    $scope.child_passport=data[0].pax.child[0].id_number;
  7658.  
  7659.  
  7660.  
  7661. }
  7662.  
  7663.      
  7664.  
  7665.    //Data Infant
  7666.  
  7667.      if(angular.isUndefined(data[0].pax.infant))
  7668.  
  7669. {
  7670.  
  7671.  
  7672.  
  7673.  
  7674.  
  7675.  
  7676.  
  7677.  
  7678.  
  7679. }
  7680.  
  7681.  
  7682.  
  7683. else
  7684.  
  7685. {
  7686.  
  7687.   $scope.loop_infant=data[0].pax.infant;
  7688.  
  7689.    $scope.infant_first_name=data[0].pax.infant[0].first_name;
  7690.  
  7691.    $scope.infant_last_name=data[0].pax.infant[0].last_name;
  7692.  
  7693.    $scope.infant_passport=data[0].pax.infant[0].id_number;
  7694.  
  7695.  
  7696.  
  7697. }
  7698.  
  7699.      
  7700.  
  7701.      
  7702.  
  7703.      
  7704.  
  7705.      
  7706.  
  7707.      
  7708.  
  7709.      //Data Infant
  7710.  
  7711.  
  7712.  
  7713.    
  7714.  
  7715.    
  7716.  
  7717.    })
  7718.  
  7719.    .error(function(data, status, headers,config){
  7720.  
  7721.      console.log('data error');
  7722.  
  7723.      
  7724.  
  7725.  
  7726.  
  7727.    })
  7728.  
  7729.    .then(function(result){
  7730.  
  7731.      things = result.data;
  7732.  
  7733.    });
  7734.  
  7735.  
  7736.  
  7737.  //PAnggil yang return
  7738.  
  7739.  
  7740.  
  7741.  $http.get('http://dxplor.com/dxplor/Mo_flight/get_transaction_flight_detail/'+ res[1])
  7742.  
  7743.  
  7744. //$http.get('http://dxplor.com/dxplor/Mo_flight/get_transaction_flight_detail/L85Y8Z')
  7745.  
  7746.  
  7747.  
  7748.  
  7749.  
  7750.  
  7751. .success(function(data, status, headers,config){
  7752.  
  7753.   console.log('data success');
  7754.  
  7755.   console.log(data); // for browser console
  7756.  
  7757.  
  7758.  
  7759.   $scope.result =  data;
  7760.  
  7761.  
  7762.  
  7763.  
  7764.  
  7765.   $scope.transaction_id1=data[0].transaction_flight_id;
  7766.  
  7767.  
  7768.  
  7769.   console.log("dsadas");
  7770.  
  7771. //  console.log(data[0].contact.title);
  7772.  
  7773.   console.log('transaction flight id-->'+data[0].transaction_flight_id);
  7774.  
  7775.   console.log(data[0].booking_code);
  7776.  
  7777.   console.log(data[0].flight_schedule[0].from);
  7778.  
  7779.  
  7780.  
  7781.   // Flight Detail
  7782.  
  7783.  
  7784.  
  7785.   $scope.flight_detail1=data[0].flight_schedule;
  7786.  
  7787.   $scope.from1=data[0].flight_schedule[0].from;
  7788.  
  7789.   $scope.to1=data[0].flight_schedule[0].to;
  7790.  
  7791.   $scope.from_time1=data[0].flight_schedule[0].departure_time;
  7792.  
  7793.   $scope.to_time1=data[0].flight_schedule[0].arrival_time;
  7794.  
  7795.   $scope.from_date1=data[0].flight_schedule[0].departure_date;
  7796.  
  7797.   $scope.to_date1=data[0].flight_schedule[0].arrival_date;
  7798.  
  7799.   $scope.booking_code1=data[0].booking_code;
  7800.  
  7801.   $scope.total_price1=data[0].total_price;
  7802.  
  7803.   $scope.nett_price1=data[0].nett_price;
  7804.  
  7805.  
  7806.  
  7807.  
  7808.   // Data Pemesan
  7809.  
  7810.  
  7811.  
  7812.   $scope.pemesan_first_name1=data[0].contact.first_name;
  7813.  
  7814.   $scope.pemesan_last_name1=data[0].contact.last_name;
  7815.  
  7816.   $scope.pemesan_email1=data[0].contact.email;
  7817.  
  7818.   $scope.pemesan_phone1=data[0].contact.phone;
  7819.  
  7820.  
  7821.  
  7822.   // Data Adult
  7823.  
  7824.   console.log('asdad');
  7825.  
  7826. //  console.log('adult-->'+data[0].pax.adult[0].first_name);
  7827.  
  7828.  
  7829.  
  7830.   $scope.loop_adult1=data[0].pax.adult;
  7831.  
  7832.   $scope.adult_first_name1=data[0].pax.adult[0].first_name;
  7833.  
  7834.   $scope.adult_last_name1=data[0].pax.adult[0].last_name;
  7835.  
  7836.   $scope.adult_passport1=data[0].pax.adult[0].id_number;
  7837.  
  7838.  
  7839.  
  7840.  
  7841.   console.log('total_price-->'+$scope.total_price);
  7842.  
  7843.   console.log('nett_price-->'+$scope.nett_price);
  7844.  
  7845.   $scope.gap_total_price=parseInt($scope.total_price)-parseInt($scope.nett_price);
  7846.  
  7847.   console.log('gap_total_price-->'+$scope.gap_total_price);
  7848.  
  7849.  
  7850.   $scope.gap_25_total_price=$scope.gap_total_price*25/100;
  7851.  
  7852.   console.log('gap_25_total_price-->'+$scope.gap_25_total_price);
  7853.  
  7854.   $scope.final_total_price=parseInt($scope.nett_price)+parseInt($scope.gap_25_total_price);
  7855.  
  7856.   console.log('final_total_price-->'+$scope.final_total_price);
  7857.  
  7858.  
  7859.   console.log('total_price2-->'+$scope.total_price1);
  7860.  
  7861.   console.log('nett_price2-->'+$scope.nett_price1);
  7862.  
  7863.   $scope.gap_total_price1=parseInt($scope.total_price1)-parseInt($scope.nett_price1);
  7864.  
  7865.   console.log('gap_total_price2-->'+$scope.gap_total_price1);
  7866.  
  7867.  
  7868.   $scope.gap_25_total_price1=$scope.gap_total_price1*25/100;
  7869.  
  7870.   console.log('gap_25_total_price 2-->'+$scope.gap_25_total_price1);
  7871.  
  7872.   $scope.final_total_price1=parseInt($scope.nett_price)+parseInt($scope.gap_25_total_price1);
  7873.  
  7874.   console.log('final_total_price2-->'+$scope.final_total_price1);
  7875.  
  7876.   $scope.total_total_price=parseInt($scope.final_total_price)+parseInt($scope.final_total_price1);
  7877.  
  7878.  
  7879.   console.log('total_total_price-->'+$scope.total_total_price);
  7880.  
  7881.  
  7882.  
  7883.   console.log('aaa->'+$scope.adult_first_name1);
  7884.  
  7885.  
  7886.  
  7887.   console.log('bbb->'+$scope.loop_adult1);
  7888.  
  7889.  
  7890.  
  7891.  
  7892.  
  7893.   //Data Child
  7894.  
  7895.   if(angular.isUndefined(data[0].pax.child))
  7896.  
  7897. {
  7898.  
  7899.  
  7900.  
  7901.  
  7902.  
  7903.  
  7904.  
  7905.  
  7906.  
  7907. }
  7908.  
  7909.  
  7910.  
  7911. else
  7912.  
  7913. {
  7914.  
  7915.   $scope.loop_child1=data[0].pax.child;
  7916.  
  7917. $scope.child_first_name1=data[0].pax.child[0].first_name;
  7918.  
  7919. $scope.child_last_name1=data[0].pax.child[0].last_name;
  7920.  
  7921. $scope.child_passport1=data[0].pax.child[0].id_number;
  7922.  
  7923.  
  7924.  
  7925. }
  7926.  
  7927.  
  7928.  
  7929. //Data Infant
  7930.  
  7931.   if(angular.isUndefined(data[0].pax.infant))
  7932.  
  7933. {
  7934.  
  7935.  
  7936.  
  7937.  
  7938.  
  7939.  
  7940.  
  7941.  
  7942.  
  7943. }
  7944.  
  7945.  
  7946.  
  7947. else
  7948.  
  7949. {
  7950.  
  7951.   $scope.loop_infant1=data[0].pax.infant;
  7952.  
  7953. $scope.infant_first_name1=data[0].pax.infant[0].first_name;
  7954.  
  7955. $scope.infant_last_name1=data[0].pax.infant[0].last_name;
  7956.  
  7957. $scope.infant_passport1=data[0].pax.infant[0].id_number;
  7958.  
  7959.  
  7960.  
  7961. }
  7962.  
  7963.  
  7964.  
  7965.  
  7966.  
  7967.  
  7968.  
  7969.  
  7970.  
  7971.  
  7972.  
  7973.   //Data Infant
  7974.  
  7975.  
  7976.  
  7977.  
  7978.  
  7979.  
  7980.  
  7981. })
  7982.  
  7983. .error(function(data, status, headers,config){
  7984.  
  7985.   console.log('data error');
  7986.  
  7987.  
  7988.  
  7989.  
  7990. })
  7991.  
  7992. .then(function(result){
  7993.  
  7994.   things = result.data;
  7995.  
  7996. });
  7997.  
  7998.  
  7999.  
  8000. }
  8001.  
  8002.  
  8003.  
  8004.     else
  8005.  
  8006.     {
  8007.  
  8008. $http.get('http://dxplor.com/dxplor/Mo_flight/get_transaction_flight_detail/'+ $localStorage.bookingcode)
  8009.  
  8010.  
  8011. //$http.get('http://dxplor.com/dxplor/Mo_flight/get_transaction_flight_detail/L85Y8Z')
  8012.  
  8013.  
  8014.      
  8015.  
  8016.    
  8017.  
  8018.       .success(function(data, status, headers,config){
  8019.  
  8020.         console.log('data success');
  8021.  
  8022.         console.log(data); // for browser console
  8023.  
  8024.        
  8025.  
  8026.         $scope.result =  data;
  8027.  
  8028.        
  8029.  
  8030.        
  8031.  
  8032.         $scope.transaction_id=data[0].transaction_flight_id;
  8033.  
  8034.        
  8035.  
  8036.         console.log("dsadas");
  8037.  
  8038.       //  console.log(data[0].contact.title);
  8039.  
  8040.         console.log('transaction flight id-->'+data[0].transaction_flight_id);
  8041.  
  8042.         console.log(data[0].booking_code);
  8043.  
  8044.         console.log(data[0].flight_schedule[0].from);
  8045.  
  8046.        
  8047.  
  8048.         // Flight Detail
  8049.  
  8050.        
  8051.  
  8052.         $scope.flight_detail=data[0].flight_schedule;
  8053.  
  8054.         $scope.from=data[0].flight_schedule[0].from;
  8055.  
  8056.         $scope.to=data[0].flight_schedule[0].to;
  8057.  
  8058.         $scope.from_time=data[0].flight_schedule[0].departure_time;
  8059.  
  8060.         $scope.to_time=data[0].flight_schedule[0].arrival_time;
  8061.  
  8062.         $scope.from_date=data[0].flight_schedule[0].departure_date;
  8063.  
  8064.         $scope.to_date=data[0].flight_schedule[0].arrival_date;
  8065.  
  8066.         $scope.booking_code=data[0].booking_code;
  8067.  
  8068.         $scope.total_price=data[0].total_price;
  8069.  
  8070.         $scope.nett_price=data[0].nett_price;
  8071.  
  8072.         $scope.gap_total_price=parseInt($scope.total_price)-parseInt($scope.nett_price);
  8073.        
  8074.         console.log('gap_total_price-->'+$scope.gap_total_price);
  8075.  
  8076.        
  8077.         $scope.gap_25_total_price=$scope.gap_total_price*25/100;
  8078.  
  8079.         console.log('gap_25_total_price-->'+$scope.gap_25_total_price);
  8080.        
  8081.         $scope.final_total_price=parseInt($scope.nett_price)+parseInt($scope.gap_25_total_price);
  8082.        
  8083.         console.log('final_total_price-->'+$scope.final_total_price);
  8084.        
  8085.  
  8086.         $scope.total_total_price= $scope.final_total_price;
  8087.  
  8088.         // Data Pemesan
  8089.  
  8090.        
  8091.  
  8092.         $scope.pemesan_first_name=data[0].contact.first_name;
  8093.  
  8094.         $scope.pemesan_last_name=data[0].contact.last_name;
  8095.  
  8096.         $scope.pemesan_email=data[0].contact.email;
  8097.  
  8098.         $scope.pemesan_phone=data[0].contact.phone;
  8099.  
  8100.        
  8101.  
  8102.         // Data Adult
  8103.  
  8104.         console.log('asdad');
  8105.  
  8106.       //  console.log('adult-->'+data[0].pax.adult[0].first_name);
  8107.  
  8108.  
  8109.  
  8110.         $scope.loop_adult=data[0].pax.adult;
  8111.  
  8112.         $scope.adult_first_name=data[0].pax.adult[0].first_name;
  8113.  
  8114.         $scope.adult_last_name=data[0].pax.adult[0].last_name;
  8115.  
  8116.         $scope.adult_passport=data[0].pax.adult[0].id_number;
  8117.  
  8118.        
  8119.  
  8120.         console.log('aaa->'+$scope.adult_first_name);
  8121.  
  8122.  
  8123.  
  8124.         console.log('bbb->'+$scope.loop_adult);
  8125.  
  8126.  
  8127.  
  8128.        
  8129.  
  8130.         //Data Child
  8131.  
  8132.         if(angular.isUndefined(data[0].pax.child))
  8133.  
  8134. {
  8135.  
  8136.  
  8137.  
  8138.    
  8139.  
  8140.  
  8141.  
  8142.  
  8143.  
  8144. }
  8145.  
  8146.  
  8147.  
  8148. else
  8149.  
  8150. {
  8151.  
  8152.   $scope.loop_child=data[0].pax.child;
  8153.  
  8154.       $scope.child_first_name=data[0].pax.child[0].first_name;
  8155.  
  8156.       $scope.child_last_name=data[0].pax.child[0].last_name;
  8157.  
  8158.       $scope.child_passport=data[0].pax.child[0].id_number;
  8159.  
  8160.  
  8161.  
  8162.  }
  8163.  
  8164.        
  8165.  
  8166.       //Data Infant
  8167.  
  8168.         if(angular.isUndefined(data[0].pax.infant))
  8169.  
  8170. {
  8171.  
  8172.  
  8173.  
  8174.    
  8175.  
  8176.  
  8177.  
  8178.  
  8179.  
  8180. }
  8181.  
  8182.  
  8183.  
  8184. else
  8185.  
  8186. {
  8187.  
  8188.   $scope.loop_infant=data[0].pax.infant;
  8189.  
  8190.       $scope.infant_first_name=data[0].pax.infant[0].first_name;
  8191.  
  8192.       $scope.infant_last_name=data[0].pax.infant[0].last_name;
  8193.  
  8194.       $scope.infant_passport=data[0].pax.infant[0].id_number;
  8195.  
  8196.  
  8197.  
  8198.  }
  8199.  
  8200.        
  8201.  
  8202.        
  8203.  
  8204.        
  8205.  
  8206.        
  8207.  
  8208.        
  8209.  
  8210.         //Data Infant
  8211.  
  8212.  
  8213.  
  8214.      
  8215.  
  8216.        
  8217.  
  8218.       })
  8219.  
  8220.       .error(function(data, status, headers,config){
  8221.  
  8222.         console.log('data error');
  8223.  
  8224.        
  8225.  
  8226.    
  8227.  
  8228.       })
  8229.  
  8230.       .then(function(result){
  8231.  
  8232.         things = result.data;
  8233.  
  8234.       });
  8235.  
  8236.    
  8237.  
  8238.     }
  8239.  
  8240.    
  8241.  
  8242. $scope.issued = function() {
  8243.  
  8244. console.log("issuedd");
  8245.  
  8246.  
  8247. $http.post('http://dxplor.com/dxplor/Mo_balance/get_balance/'+ $localStorage.customerid)
  8248.  
  8249.        
  8250.  
  8251.        
  8252.  
  8253.         .success(function(data, status, headers,config){
  8254.  
  8255.           console.log(data); // for browser console
  8256.  
  8257.          
  8258.  
  8259.           $scope.balance =  data;
  8260.  
  8261.          
  8262.  
  8263.         console.log("balance-->"+$scope.balance);
  8264.  
  8265.         console.log("harga-->"+$scope.total_total_price);
  8266.        
  8267.      // $scope.final_price_new=$scope.total_total_price;
  8268.  
  8269.          
  8270.  
  8271.        if(parseInt($scope.balance) < parseInt($scope.total_total_price))
  8272.  
  8273.            {
  8274.  
  8275.          
  8276.            var alertPopup = $ionicPopup.alert({
  8277.  
  8278.                title: 'Info',
  8279.  
  8280.                template: 'You dont have enough balance'
  8281.  
  8282.              });
  8283.  
  8284.            $state.go($state.current, {}, {reload: true});
  8285.  
  8286.            console.log("didnt have enough balance");
  8287.  
  8288.  
  8289.  
  8290.            }
  8291.  
  8292.          
  8293.  
  8294.        else
  8295.  
  8296.        {
  8297.  
  8298.  
  8299.  
  8300.               console.log(" have enough balance");
  8301.  
  8302.              
  8303.  
  8304.            
  8305.  
  8306.  
  8307.  
  8308.     $http.post('http://dxplor.com/dxplor/Mo_flight/issued2', {customer_id : $localStorage.customerid,transaction_flight_id : $scope.transaction_id})
  8309.  
  8310.    
  8311.  
  8312.    
  8313.  
  8314.       .success(function(data, status, headers,config){
  8315.  
  8316.         console.log('data success');
  8317.  
  8318.         console.log('return issued-->'+data); // for browser console
  8319.  
  8320.        
  8321.  
  8322.        
  8323.  
  8324.  
  8325.  
  8326. console.log('status-->'+data.status);
  8327.  
  8328. console.log('message-->'+data.message);
  8329.  
  8330.  
  8331.  
  8332. if(data.status=='0')
  8333.  
  8334. {
  8335.  
  8336.  
  8337. var alertPopup = $ionicPopup.alert({
  8338.  
  8339.          title: 'Info',
  8340.  
  8341.          template: 'Issued Error, hubungi Dxplor Admin'
  8342.  
  8343.        });
  8344.  
  8345.  
  8346. }
  8347.  
  8348. else
  8349.  
  8350. {
  8351.  
  8352. if(data.message=="Request Sucess" || data.message=="Pending Issued" || data.message=="Issued on progress" )
  8353.  
  8354. {
  8355.  
  8356. console.log('potong balance flight');        
  8357.  
  8358.  
  8359.  
  8360.     $http.post('http://dxplor.com/dxplor/Mo_balance/potong_balance_flight', {transaction_flight_id : $scope.transaction_id,member_id : $localStorage.customerid,price : $scope.total_total_price})
  8361.  
  8362.    
  8363.  
  8364.    
  8365.  
  8366.       .success(function(data, status, headers,config){
  8367.  
  8368.  
  8369.  
  8370.       console.log('potong balance flight success');      
  8371.  
  8372.   })
  8373.  
  8374.       .error(function(data, status, headers,config){
  8375.  
  8376.         console.log('data error potong balance');
  8377.  
  8378.        
  8379.  
  8380.    
  8381.  
  8382.       })
  8383.  
  8384.       .then(function(result){
  8385.  
  8386.         things = result.data;
  8387.  
  8388.       });
  8389.  
  8390. }
  8391.  
  8392.  
  8393. }
  8394.  
  8395.       })
  8396.  
  8397.       .error(function(data, status, headers,config){
  8398.  
  8399.         console.log('data error');
  8400.  
  8401.  
  8402.       })
  8403.  
  8404.       .then(function(result){
  8405.  
  8406.         things = result.data;
  8407.  
  8408.       });
  8409.  
  8410.  
  8411.     if($localStorage.bookingcode.indexOf(",") != -1)
  8412.  
  8413.         {
  8414.  
  8415.        // Issued yang kedua
  8416.  
  8417.    
  8418.  
  8419.  
  8420.  
  8421.     $http.post('http://dxplor.com/dxplor/Mo_flight/issued2', {transaction_flight_id : $scope.transaction_id1})
  8422.  
  8423.    
  8424.  
  8425.    
  8426.  
  8427.       .success(function(data, status, headers,config){
  8428.  
  8429.         console.log('data success');
  8430.  
  8431.         console.log('return issued-->'+data); // for browser console
  8432.  
  8433.        
  8434.  
  8435.        
  8436.  
  8437.  
  8438.  
  8439. console.log('status-->'+data.status);
  8440.  
  8441. console.log('message-->'+data.message);
  8442.  
  8443.  
  8444.  
  8445. if(data.status=='0')
  8446.  
  8447. {
  8448.  
  8449.  
  8450. var alertPopup = $ionicPopup.alert({
  8451.  
  8452.         title: 'Info',
  8453.  
  8454.         template: 'Issued Error, hubungi Dxplor Admin'
  8455.  
  8456.       });
  8457.  
  8458.  
  8459. }
  8460.  
  8461. else
  8462.  
  8463. {
  8464.  
  8465. /*  if(data.message=="Request Sucess" || data.message=="Pending Issued" )
  8466.  
  8467. {
  8468.  
  8469.  
  8470. }
  8471.  
  8472. var alertPopup = $ionicPopup.alert({
  8473.  
  8474.         title: 'Info',
  8475.  
  8476.         template: 'Issued in Progress, silahkan cek email untuk E-ticket anda, Jika email tidak sampai hubungi admin Dxplor'
  8477.  
  8478.       });
  8479.  
  8480.  
  8481.  
  8482. console.log('go to home');
  8483.  
  8484. $state.go('snd.home');
  8485.  
  8486. */
  8487.  
  8488. }
  8489.  
  8490.  
  8491.  
  8492.  
  8493.        
  8494.  
  8495.       })
  8496.  
  8497.       .error(function(data, status, headers,config){
  8498.  
  8499.         console.log('data error');
  8500.  
  8501.        
  8502.  
  8503.    
  8504.  
  8505.       })
  8506.  
  8507.       .then(function(result){
  8508.  
  8509.         things = result.data;
  8510.  
  8511.       });
  8512.  
  8513.          
  8514.  
  8515.         }
  8516.  
  8517.    
  8518.  
  8519.     var alertPopup = $ionicPopup.alert({
  8520.  
  8521.             title: 'Info',
  8522.  
  8523.             template: 'Issued in Progress, silahkan cek email untuk E-ticket anda, Jika email tidak sampai hubungi admin Dxplor'
  8524.  
  8525.           });
  8526.  
  8527.    
  8528.  
  8529.     console.log('go to home');
  8530.  
  8531.    $state.go('snd.home');
  8532.  
  8533.  
  8534. }
  8535.  
  8536.      
  8537.  
  8538.  
  8539.         })
  8540.  
  8541.         .error(function(data, status, headers,config){
  8542.  
  8543.           console.log('data error');
  8544.  
  8545.          
  8546.  
  8547.      
  8548.  
  8549.         })
  8550.  
  8551.         .then(function(result){
  8552.  
  8553.           things = result.data;
  8554.  
  8555.         });
  8556.  
  8557. }
  8558.  
  8559.  
  8560.  
  8561. })
  8562.  
  8563.  
  8564. .controller('HelpController', function($scope) {
  8565.  
  8566.  
  8567.  
  8568. console.log("di Help");
  8569.  
  8570.  
  8571.  
  8572. })
  8573.  
  8574. .controller('ProgramReferensiController', function($scope) {
  8575.  
  8576.  
  8577.  
  8578. console.log("di Program Referensi");
  8579.  
  8580.  
  8581.  
  8582. })
  8583.  
  8584.  
  8585. .controller('PPOBController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  8586.  
  8587.  
  8588.  
  8589. console.log("di PPOB");
  8590.  
  8591.  
  8592.  
  8593. })
  8594.  
  8595.  
  8596. //BPJS
  8597.  
  8598.  
  8599. .controller('BPJSController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  8600.  
  8601.  
  8602.  
  8603. console.log("di BPJS");
  8604.  
  8605.  
  8606. $scope.required = true;
  8607.  
  8608.  
  8609. $scope.check_bill_bpjs = function(cust_id) {
  8610.  
  8611.  
  8612.  
  8613. $http.post('http://dxplor.com/dxplor/Mo_bpjs/check_bill_bpjs', {customer_id : cust_id})
  8614.  
  8615.  
  8616.  
  8617.     .success(function(data, status, headers,config){
  8618.  
  8619.       console.log('data success');
  8620.  
  8621.       console.log('data-->'+data); // for browser console
  8622.  
  8623.      
  8624.  
  8625.       if(data=="idempty")
  8626.  
  8627.       {
  8628.  
  8629.      
  8630.  
  8631.       var alertPopup = $ionicPopup.alert({
  8632.  
  8633.             title: 'Error',
  8634.  
  8635.             template: 'Customer ID is mandatory'
  8636.  
  8637.           });
  8638.  
  8639.          
  8640.  
  8641.       }
  8642.  
  8643.       else
  8644.  
  8645.       { // data not empty
  8646.  
  8647.          
  8648.  
  8649.       var res = data.split(";");
  8650.  
  8651.  
  8652.  
  8653.       //console.log(res[0]);
  8654.  
  8655.  
  8656.  
  8657.        
  8658.  
  8659.         if(res[0]=="$C")
  8660.  
  8661.         {
  8662.  
  8663.         var alertPopup = $ionicPopup.alert({
  8664.  
  8665.                 title: 'Error',
  8666.  
  8667.                 template: res[4]
  8668.  
  8669.               });
  8670.  
  8671.          
  8672.  
  8673.             $state.go($state.current, {}, {reload: true});
  8674.  
  8675.  
  8676.  
  8677.         }
  8678.  
  8679.        
  8680.  
  8681.         if(res[0]=="$D")
  8682.  
  8683.     {
  8684.  
  8685.          
  8686.  
  8687.         $localStorage.bpjs_confirm=data;
  8688.  
  8689.         $state.go('snd.bpjs_confirm');
  8690.  
  8691.  
  8692.  
  8693.     }
  8694.  
  8695.        
  8696.  
  8697.        
  8698.  
  8699.       }
  8700.  
  8701.    
  8702.  
  8703.      
  8704.  
  8705.  
  8706.     })
  8707.  
  8708.     .error(function(data, status, headers,config){
  8709.  
  8710.       console.log('data error');
  8711.  
  8712.       console.log('data-->'+data); // for browser console
  8713.  
  8714.  
  8715.  
  8716.  
  8717.  
  8718.     })
  8719.  
  8720.     .then(function(result){
  8721.  
  8722.       things = result.data;
  8723.  
  8724.     });
  8725.  
  8726.  
  8727. }
  8728.  
  8729. })
  8730.  
  8731.  
  8732.  
  8733. .controller('BPJSConfirmController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  8734.  
  8735.  
  8736.  
  8737. console.log("di BPJS Confirm-->"+$localStorage.bpjs_confirm);
  8738.  
  8739.  
  8740. //$D;3;BPJSKS;Nama :;DUM""MY BPJSKS-01;No Registrasi :;1234567890;Tagihan Rp :;59500;ADM Rp :;2500;
  8741. //Total :;62000;Nomor Invoice :;INV20170105232514;;Transaksi:;BPJS KESEHATAN;JAKARTA SELATAN;Tekan :;
  8742. //[OK] Untuk Bayar;[BACK] Kembali;*
  8743.  
  8744.  
  8745.  
  8746.   var res = $localStorage.bpjs_confirm.split(";");
  8747.  
  8748.  
  8749.  
  8750.   $scope.idpelanggan=res[6];
  8751.  
  8752.   $scope.namapelanggan=res[4];
  8753.  
  8754.   $scope.totalamount=res[12];
  8755.  
  8756.   $scope.noinvoice=res[14];
  8757.  
  8758.  
  8759.  
  8760.  
  8761.   $http.get('http://dxplor.com/dxplor/Mo_bpjs/get_cashback')
  8762.  
  8763.  
  8764.   // $http({method: "get", url: "https://www.googleapis.com/plus/v1/people/me", data: "access_token=" + accessToken})
  8765.    .success(function(data) {
  8766.  
  8767.         $scope.cashback=data;
  8768.         console.log("get cashback data bpjs-->"+$scope.cashback);
  8769.        
  8770.  
  8771.         var rescashback=$scope.cashback.split(";");
  8772.         $localStorage.bpjs_admin=rescashback[0];
  8773.         $localStorage.bpjs_cashback=rescashback[1];
  8774.  
  8775.  
  8776.  
  8777.           $scope.totalamountasli=res[12];
  8778.           console.log("total amount asli-->"+$scope.totalamountasli);
  8779.           $scope.totalamount=parseInt(res[8])+parseInt($localStorage.bpjs_admin);
  8780.           console.log("total amount dxplor-->"+$scope.totalamount);
  8781.  
  8782.        
  8783.    })
  8784.    .error(function(data, status) {
  8785.        console.log("ERROR: " + data);
  8786.  
  8787.    });
  8788.    
  8789.  
  8790.   //Scope clikck
  8791.  
  8792. $scope.confirm_pay_bpjs = function() {
  8793.  
  8794.   $scope.login=true;
  8795.  
  8796.        if($localStorage.email==null)
  8797.  
  8798.    {
  8799.  
  8800.    console.log("belum login");
  8801.  
  8802.        
  8803.  
  8804.        var alertPopup = $ionicPopup.alert({
  8805.  
  8806.            title: 'Info',
  8807.  
  8808.            template: 'Please Login first to Pay BPJS'
  8809.  
  8810.          });
  8811.  
  8812.    
  8813.  
  8814.        $state.go('snd.login');
  8815.  
  8816.        $scope.login=false;
  8817.  
  8818.    }
  8819.  
  8820.        if($scope.login==false){
  8821.  
  8822.        }
  8823.  
  8824.        else
  8825.  
  8826.        {    
  8827.  
  8828.        $http.post('http://dxplor.com/dxplor/Mo_balance/get_balance/'+ $localStorage.customerid)
  8829.  
  8830.            .success(function(data, status, headers,config){
  8831.  
  8832.              console.log(data); // for browser console
  8833.  
  8834.              $scope.balance =  data;
  8835.  
  8836.             console.log("balance-->"+$scope.balance);
  8837.  
  8838.             console.log("total bill-->"+$scope.totalamount);
  8839.  
  8840.           if(parseInt($scope.balance) < parseInt($scope.totalamount))
  8841.  
  8842.               {
  8843.              
  8844.               var alertPopup = $ionicPopup.alert({
  8845.  
  8846.                   title: 'Info',
  8847.  
  8848.                   template: 'You dont have enough balance, please topup first'
  8849.  
  8850.                 });
  8851.  
  8852.               $state.go($state.current, {}, {reload: true});
  8853.  
  8854.               console.log("didnt have enough balance");
  8855.  
  8856.               }          
  8857.  
  8858.           else
  8859.  
  8860.           {
  8861.  
  8862.                   console.log("have enough balance to pay BPJS");
  8863.  
  8864.                       //disable button
  8865.                       $scope.isDisabled = true;
  8866.  
  8867.                   $http.post('http://dxplor.com/dxplor/Mo_bpjs/pay_bpjs', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  8868.  
  8869.                 .success(function(data, status, headers,config){                 
  8870.  
  8871.                 $scope.isDisabled = false;
  8872.  
  8873.                 console.log("data-->"+data);
  8874.  
  8875.                 var res = data.split(";");
  8876.  
  8877.                 if(res[0]=="$7")
  8878.  
  8879.                 {
  8880.  
  8881.                 console.log("paybill BPJS ok");
  8882.  
  8883.                 $localStorage.bpjsrefid=data;
  8884.                  
  8885.                     var alertPopup = $ionicPopup.alert({
  8886.  
  8887.                               title: 'Info',
  8888.  
  8889.                               template: 'Payment success, please note the ref id!'
  8890.  
  8891.                             });
  8892.  
  8893.                           $state.go('snd.bpjs_summary');
  8894.                 }
  8895.  
  8896.                 else
  8897.  
  8898.                 {
  8899.  
  8900.                 console.log("paybill error data-->"+data);
  8901.                 //console.log("paybill error-->"+res[4]);
  8902.  
  8903.              // var errorcode = res[4].substring(7,9);
  8904.  
  8905.               //console.log("error codes-->"+errorcode);
  8906.  
  8907.               var alertPopup = $ionicPopup.alert({
  8908.  
  8909.                   title: 'Info',
  8910.  
  8911.                   template: 'Request error, Please try again in a few minutes'
  8912.  
  8913.                 });
  8914.               $state.go('snd.home');
  8915.  
  8916.              
  8917.                 }
  8918.  
  8919.                 })
  8920.  
  8921.           }
  8922.  
  8923.            })
  8924.  
  8925.            .error(function(data, status, headers,config){
  8926.  
  8927.              console.log('data error');
  8928.  
  8929.              $scope.isDisabled = false;
  8930.  
  8931.            })
  8932.  
  8933.            .then(function(result){
  8934.  
  8935.              things = result.data;
  8936.  
  8937.            });
  8938.  
  8939.        }
  8940.  
  8941. }
  8942.  
  8943. //end scope click
  8944.  
  8945. })
  8946.  
  8947.  
  8948.  
  8949.  
  8950.  
  8951. .controller('BPJS_summaryController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  8952.  
  8953. console.log("di BPJS summary-->"+$localStorage.bpjsrefid);
  8954.  
  8955.  
  8956. //$3;TELKOM;02175910049;Test telkom 210;20121023180340; 517.000,00; 2.500,00;E81E23AE26E4F0BF1C3B35D75F43AD36;
  8957. //519.500,00;-;INV121023170417;JUL 2011- 110.000,00#JUN 2011- 205.000,00#MEI 2011- 202.000,00#; REF;NAMA_BANK ;*
  8958.  
  8959.  
  8960. var res = $localStorage.bpjsrefid.split(";");
  8961.  
  8962.   $scope.idpelanggan=res[2];
  8963.  
  8964.   $scope.namapelanggan=res[3];
  8965.  
  8966.  
  8967.  
  8968.  
  8969.  
  8970.  
  8971.  
  8972.   $scope.totalharga=res[7];
  8973.  
  8974.   $scope.noinvoice=res[12];
  8975.  
  8976.   $scope.refid=res[6];
  8977.  
  8978.  
  8979.  
  8980.  
  8981.   $http.get('http://dxplor.com/dxplor/Mo_bpjs/get_cashback')
  8982.  
  8983.  
  8984.   // $http({method: "get", url: "https://www.googleapis.com/plus/v1/people/me", data: "access_token=" + accessToken})
  8985.    .success(function(data) {
  8986.  
  8987.         $scope.cashback=data;
  8988.         console.log("get cashback data bpjs-->"+$scope.cashback);
  8989.        
  8990.  
  8991.         var rescashback=$scope.cashback.split(";");
  8992.         $localStorage.bpjs_admin=rescashback[0];
  8993.         $localStorage.bpjs_cashback=rescashback[1];
  8994.  
  8995.  
  8996.        
  8997.  
  8998.        
  8999.         $scope.rptagihan=res[4];
  9000.  
  9001.         $scope.hargaadmin=$localStorage.bpjs_admin;
  9002.        
  9003.        // $scope.totaltagihan=res[7];
  9004.        
  9005.        
  9006.        
  9007.  
  9008.           $scope.totalamountasli=res[7];
  9009.           console.log("total amount asli-->"+$scope.totalamountasli);
  9010.           $scope.totaltagihan=parseInt(res[4])+parseInt($localStorage.bpjs_admin);
  9011.           console.log("total amount dxplor-->"+$scope.totaltagihan);
  9012.  
  9013.          
  9014.          
  9015.          
  9016.  
  9017.    })
  9018.    .error(function(data, status) {
  9019.        console.log("ERROR: " + data);
  9020.  
  9021.    });
  9022.  
  9023.  
  9024.  
  9025.  
  9026. })
  9027.  
  9028.  
  9029. //End BPJS SUMMARY
  9030.  
  9031. //Telkom
  9032.  
  9033.  
  9034. .controller('TelkomController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  9035.  
  9036.  
  9037.  
  9038. console.log("di Telkom");
  9039.  
  9040.  
  9041. $scope.required = true;
  9042.  
  9043.  
  9044. $scope.check_bill_telkom = function(cust_id) {
  9045.  
  9046.  
  9047.  
  9048. $http.post('http://dxplor.com/dxplor/Mo_telkom/check_bill_telkom', {customer_id : cust_id})
  9049.  
  9050.  
  9051.  
  9052.     .success(function(data, status, headers,config){
  9053.  
  9054.       console.log('data success');
  9055.  
  9056.       console.log('data-->'+data); // for browser console
  9057.  
  9058.      
  9059.  
  9060.       if(data=="idempty")
  9061.  
  9062.       {
  9063.  
  9064.      
  9065.  
  9066.       var alertPopup = $ionicPopup.alert({
  9067.  
  9068.             title: 'Error',
  9069.  
  9070.             template: 'Customer ID is mandatory'
  9071.  
  9072.           });
  9073.  
  9074.          
  9075.  
  9076.       }
  9077.  
  9078.       else
  9079.  
  9080.       { // data not empty
  9081.  
  9082.          
  9083.  
  9084.       var res = data.split(";");
  9085.  
  9086.  
  9087.  
  9088.       //console.log(res[0]);
  9089.  
  9090.  
  9091.  
  9092.        
  9093.  
  9094.         if(res[0]=="$C")
  9095.  
  9096.         {
  9097.  
  9098.         var alertPopup = $ionicPopup.alert({
  9099.  
  9100.                 title: 'Error',
  9101.  
  9102.                 template: res[4]
  9103.  
  9104.               });
  9105.  
  9106.          
  9107.  
  9108.             $state.go($state.current, {}, {reload: true});
  9109.  
  9110.  
  9111.  
  9112.         }
  9113.  
  9114.        
  9115.  
  9116.         if(res[0]=="$D")
  9117.  
  9118.     {
  9119.  
  9120.          
  9121.  
  9122.         $localStorage.telkom_confirm=data;
  9123.  
  9124.         $state.go('snd.telkom_confirm');
  9125.  
  9126.  
  9127.  
  9128.     }
  9129.  
  9130.        
  9131.  
  9132.        
  9133.  
  9134.       }
  9135.  
  9136.    
  9137.  
  9138.      
  9139.  
  9140.  
  9141.     })
  9142.  
  9143.     .error(function(data, status, headers,config){
  9144.  
  9145.       console.log('data error');
  9146.  
  9147.       console.log('data-->'+data); // for browser console
  9148.  
  9149.  
  9150.  
  9151.  
  9152.  
  9153.     })
  9154.  
  9155.     .then(function(result){
  9156.  
  9157.       things = result.data;
  9158.  
  9159.     });
  9160.  
  9161.  
  9162. }
  9163.  
  9164. })
  9165.  
  9166.  
  9167.  
  9168. .controller('TelkomConfirmController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  9169.  
  9170.  
  9171.  
  9172. console.log("di Telkom Confirm-->"+$localStorage.telkom_confirm);
  9173.  
  9174.  
  9175. //$D;3;TELKOM;Nama :;DUM""MY TELKOM IPN-01;No Tagihan :;02175910000;Tagihan Rp :;46355;ADM Rp :;3000;Total :;49355;
  9176. //Nomor Invoice :;INV20170105220259;JAN 2014;Tekan :;[OK] Untuk Bayar;[BACK] Kembali;*
  9177.  
  9178.  
  9179.  
  9180.   var res = $localStorage.telkom_confirm.split(";");
  9181.  
  9182.  
  9183.  
  9184.   $scope.idpelanggan=res[6];
  9185.  
  9186.   $scope.namapelanggan=res[4];
  9187.  
  9188.   $scope.totalamount=res[12];
  9189.  
  9190.   $scope.noinvoice=res[14];
  9191.  
  9192.  
  9193.  
  9194.  
  9195.   $http.get('http://dxplor.com/dxplor/Mo_telkom/get_cashback')
  9196.  
  9197.  
  9198.   // $http({method: "get", url: "https://www.googleapis.com/plus/v1/people/me", data: "access_token=" + accessToken})
  9199.    .success(function(data) {
  9200.  
  9201.         $scope.cashback=data;
  9202.         console.log("get cashback data telkom-->"+$scope.cashback);
  9203.        
  9204.  
  9205.         var rescashback=$scope.cashback.split(";");
  9206.         $localStorage.telkom_admin=rescashback[0];
  9207.         $localStorage.telkom_cashback=rescashback[1];
  9208.  
  9209.  
  9210.  
  9211.           $scope.totalamountasli=res[12];
  9212.           console.log("total amount asli-->"+$scope.totalamountasli);
  9213.           $scope.totalamount=parseInt(res[8])+parseInt($localStorage.telkom_admin);
  9214.           console.log("total amount dxplor-->"+$scope.totalamount);
  9215.  
  9216.        
  9217.    })
  9218.    .error(function(data, status) {
  9219.        console.log("ERROR: " + data);
  9220.  
  9221.    });
  9222.    
  9223.  
  9224.   //Scope clikck
  9225.  
  9226. $scope.confirm_pay_telkom = function() {
  9227.  
  9228.   $scope.login=true;
  9229.  
  9230.        if($localStorage.email==null)
  9231.  
  9232.    {
  9233.  
  9234.    console.log("belum login");
  9235.  
  9236.        
  9237.  
  9238.        var alertPopup = $ionicPopup.alert({
  9239.  
  9240.            title: 'Info',
  9241.  
  9242.            template: 'Please Login first to Pay Telkom'
  9243.  
  9244.          });
  9245.  
  9246.    
  9247.  
  9248.        $state.go('snd.login');
  9249.  
  9250.        $scope.login=false;
  9251.  
  9252.    }
  9253.  
  9254.        if($scope.login==false){
  9255.  
  9256.        }
  9257.  
  9258.        else
  9259.  
  9260.        {    
  9261.  
  9262.        $http.post('http://dxplor.com/dxplor/Mo_balance/get_balance/'+ $localStorage.customerid)
  9263.  
  9264.            .success(function(data, status, headers,config){
  9265.  
  9266.              console.log(data); // for browser console
  9267.  
  9268.              $scope.balance =  data;
  9269.  
  9270.             console.log("balance-->"+$scope.balance);
  9271.  
  9272.             console.log("total bill-->"+$scope.totalamount);
  9273.  
  9274.           if(parseInt($scope.balance) < parseInt($scope.totalamount))
  9275.  
  9276.               {
  9277.              
  9278.               var alertPopup = $ionicPopup.alert({
  9279.  
  9280.                   title: 'Info',
  9281.  
  9282.                   template: 'You dont have enough balance, please topup first'
  9283.  
  9284.                 });
  9285.  
  9286.               $state.go($state.current, {}, {reload: true});
  9287.  
  9288.               console.log("didnt have enough balance");
  9289.  
  9290.               }          
  9291.  
  9292.           else
  9293.  
  9294.           {
  9295.  
  9296.                   console.log("have enough balance to pay Telkom");
  9297.  
  9298.                       //disable button
  9299.                       $scope.isDisabled = true;
  9300.  
  9301.                   $http.post('http://dxplor.com/dxplor/Mo_telkom/pay_telkom', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  9302.  
  9303.                 .success(function(data, status, headers,config){                 
  9304.  
  9305.                 $scope.isDisabled = false;
  9306.  
  9307.                 console.log("data-->"+data);
  9308.  
  9309.                 var res = data.split(";");
  9310.  
  9311.                 if(res[0]=="$3")
  9312.  
  9313.                 {
  9314.  
  9315.                 console.log("paybill Telkom ok");
  9316.  
  9317.                 $localStorage.telkomrefid=data;
  9318.                  
  9319.                     var alertPopup = $ionicPopup.alert({
  9320.  
  9321.                               title: 'Info',
  9322.  
  9323.                               template: 'Payment success, please note the ref id!'
  9324.  
  9325.                             });
  9326.  
  9327.                           $state.go('snd.telkom_summary');
  9328.                 }
  9329.  
  9330.                 else
  9331.  
  9332.                 {
  9333.  
  9334.                 console.log("paybill error data-->"+data);
  9335.                 console.log("paybill error-->"+res[4]);
  9336.  
  9337.               var errorcode = res[4].substring(7,9);
  9338.  
  9339.               console.log("error codes-->"+errorcode);
  9340.  
  9341.               if(errorcode=="91" || errorcode=="77" ||errorcode=="48" ||errorcode=="96" ||errorcode=="14" ||errorcode=="48" ||
  9342.                       errorcode=="06" || errorcode=="18" || errorcode=="68" || errorcode=="99" || errorcode=="0028" || errorcode=="ER" || errorcode=="0005" )
  9343.  
  9344.               { // Reverse 1x
  9345.  
  9346.               console.log('masuk reverse 1');
  9347.  
  9348.               $http.post('http://dxplor.com/dxplor/Mo_telkom/pay_telkom_reverse1', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  9349.  
  9350.                           .success(function(data, status, headers,config){
  9351.  
  9352.                             $scope.isDisabled = false;
  9353.  
  9354.                           console.log("data-->"+data);
  9355.  
  9356.                           var res = data.split(";");
  9357.                          if(res[0]=="$3")
  9358.  
  9359.                          { //success reverse 1
  9360.  
  9361.                         console.log("paybill telkom ok");
  9362.  
  9363.                         $localStorage.telkomrefid=data;
  9364.  
  9365.                                 var alertPopup = $ionicPopup.alert({
  9366.  
  9367.                                        title: 'Info',
  9368.  
  9369.                                        template: 'Payment success, please note the ref id!'
  9370.  
  9371.                                      });
  9372.  
  9373.                                    $state.go('snd.telkom_summary');
  9374.  
  9375.  
  9376.                          }
  9377.  
  9378.                          else
  9379.  
  9380.                          { //gagal reverse 1
  9381.  
  9382.                          
  9383.                          console.log("paybill error reverse1 data-->"+data);
  9384.  
  9385.                          console.log("paybills error reverse1-->"+res[4]);
  9386.                          
  9387.                        var errorcoderev1 = res[4].substring(7,9);
  9388.  
  9389.                        console.log("error codes rev12-->"+errorcoderev1);                  
  9390.  
  9391.                        if(errorcoderev1=="91" || errorcoderev1=="77" ||errorcoderev1=="48" ||errorcoderev1=="96" ||errorcoderev1=="14" ||errorcoderev1=="48" ||  errorcoderev1=="06" || errorcoderev1=="18" || errorcoderev1=="68" || errorcoderev1=="99" || errorcoderev1=="0028" || errorcoderev1=="ER" || errorcoderev1=="0005" )
  9392.  
  9393.                   { // Reverse 1x
  9394.                  
  9395.                   console.log('masuk reverse repeat1 1');
  9396.                  
  9397.                   $http.post('http://dxplor.com/dxplor/Mo_telkom/pay_telkom_reverse_repeat1', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  9398.  
  9399.                               .success(function(data, status, headers,config){
  9400.                                  
  9401.                               $scope.isDisabled = false;
  9402.  
  9403.                               console.log("data-->"+data);
  9404.                              
  9405.                               var res = data.split(";");
  9406.                                
  9407.                                   if(res[0]=="$3")
  9408.  
  9409.                              { //success reverse repeat 1
  9410.  
  9411.                             console.log("paybill telkom reverse repeat1 ok");
  9412.  
  9413.                             $localStorage.telkomrefid=data;
  9414.  
  9415.                                     var alertPopup = $ionicPopup.alert({
  9416.  
  9417.                                            title: 'Info',
  9418.  
  9419.                                            template: 'Payment success, please note the ref id!'
  9420.  
  9421.                                          });
  9422.  
  9423.                                        $state.go('snd.telkom_summary');
  9424.                              }
  9425.  
  9426.                              else
  9427.  
  9428.                              { //gagal reverse repeat 1
  9429.  
  9430.                              
  9431.  
  9432.                              console.log("paybills error reverse repeat 11 data-->"+data);
  9433.  
  9434.                              console.log("paybills error reverse repeat 1-->"+res[4]);
  9435.  
  9436.                           var errorcoderev1 = res[4].substring(7,9);
  9437.  
  9438.                           console.log("error codes rev repeat 11-->"+errorcoderev1);
  9439.  
  9440.                           ////start reverse repeat
  9441.  
  9442.                           if(errorcoderev1=="91" || errorcoderev1=="77" ||errorcoderev1=="48" ||errorcoderev1=="96" ||errorcoderev1=="14" ||errorcoderev1=="48" ||                                    errorcoderev1=="06" || errorcoderev1=="18" || errorcoderev1=="68" || errorcoderev1=="99" || errorcoderev1=="0028" || errorcoderev1=="ER" || errorcoderev1=="0005" )
  9443.  
  9444.  
  9445.                              
  9446.                              
  9447.                              
  9448.                       { // Reverserepeeat 1x
  9449.  
  9450.                       console.log('masuk reverse  repeat 2');
  9451.  
  9452.                       $http.post('http://dxplor.com/dxplor/Mo_telkom/pay_telkom_reverse_repeat2', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  9453.  
  9454.                                   .success(function(data, status, headers,config){
  9455.                            
  9456.                                   $scope.isDisabled = false;
  9457.  
  9458.                                   console.log("data reverse repeat repeat2-->"+data);
  9459.  
  9460.                                   var res = data.split(";");
  9461.  
  9462.                                       if(res[0]=="$3")
  9463.  
  9464.                                  { //success reverse 1
  9465.  
  9466.                                 console.log("paybill telkom reverse repeat2 ok");
  9467.  
  9468.                                 $localStorage.telkomrefid=data;
  9469.  
  9470.                                 var alertPopup = $ionicPopup.alert({
  9471.  
  9472.                                                title: 'Info',
  9473.  
  9474.                                                template: 'Payment success, please note the ref id!'
  9475.  
  9476.                                              });
  9477.  
  9478.                                            $state.go('snd.telkom_summary');                  
  9479.  
  9480.                                  }
  9481.  
  9482.                                  else
  9483.  
  9484.                                  { //gagal reverse repeat 2
  9485.                                
  9486.                                  console.log("paybill error reverse repeat 2 data-->"+data);
  9487.                                  console.log("paybill error reverse repeat 2-->"+res[4]);                                
  9488.  
  9489.                                var errorcoderevrepeat1 = res[4].substring(7,9);
  9490.  
  9491.                               console.log("error codes rev repeeat2-->"+errorcoderevrepeat1);
  9492.  
  9493.                               if(errorcoderevrepeat1=="91" || errorcoderevrepeat1=="77" ||errorcoderevrepeat1=="48" ||errorcoderevrepeat1=="96" ||errorcoderevrepeat1=="14" ||errorcoderevrepeat1=="48" ||                                       errorcoderevrepeat1=="06" || errorcoderevrepeat1=="18" || errorcoderevrepeat1=="68" || errorcoderevrepeat1=="99" || errorcoderevrepeat1=="0028" || errorcoderevrepeat1=="ER" || errorcoderevrepeat1=="0005" )
  9494.  
  9495.  
  9496.                           { // Reverse repeat 2x
  9497.  
  9498.                           console.log('masuk reverse  2 trakhir');
  9499.  
  9500.                           $http.post('http://dxplor.com/dxplor/Mo_telkom/pay_telkom_reverse2', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  9501.  
  9502.                                       .success(function(data, status, headers,config){
  9503.  
  9504.                                       $scope.isDisabled = false;
  9505.                                       console.log("data-->"+data);
  9506.                                       var res = data.split(";");
  9507.                                       if(res[0]=="$3")
  9508.  
  9509.                                      { //success reverse  2
  9510.                                     console.log("paybill telkom rev 2 ok");
  9511.  
  9512.                                     $localStorage.telkomrefid=data;
  9513.  
  9514.                                     var alertPopup = $ionicPopup.alert({
  9515.  
  9516.                                                    title: 'Info',
  9517.  
  9518.                                                    template: 'Payment success, please note the ref id!'
  9519.  
  9520.                                                  });
  9521.  
  9522.                                                $state.go('snd.telkom_summary');
  9523.  
  9524.                                      }
  9525.  
  9526.                                      else
  9527.  
  9528.                                      { //gagal reverse  2
  9529.  
  9530.                                      console.log("paybill error reverse repeat 21 data-->"+data);
  9531.                                      console.log("paybill error reverse repeat 21-->"+res[4]);
  9532.  
  9533.                                      
  9534.  
  9535.                                    var alertPopup = $ionicPopup.alert({
  9536.  
  9537.                                                 title: 'Info',
  9538.  
  9539.                                                 template: 'Request error, Please try again in a few minutes'
  9540.  
  9541.                                               });
  9542.                                      }
  9543.  
  9544.                                       })
  9545.  
  9546.                           .error(function(data, status, headers,config){
  9547.  
  9548.                           console.log('data error reverse repeat 2x');
  9549.  
  9550.                           $scope.isDisabled = false;
  9551.  
  9552.                           })
  9553.                          
  9554.                           //end if reverse 1x
  9555.  
  9556.                               }                          
  9557.  
  9558.                           else
  9559.                          
  9560.                           {//else kalo gagal reverse 1 dan ga masuk if
  9561.  
  9562.                             var alertPopup = $ionicPopup.alert({
  9563.  
  9564.                                         title: 'Info',
  9565.  
  9566.                                         template: 'Request error, Please try again in a few minutes'
  9567.  
  9568.                                       });
  9569.  
  9570. //                              $state.go('snd.home');
  9571.  
  9572.                           }
  9573.  
  9574.                                  }
  9575.  
  9576.                                   })
  9577.  
  9578.                       .error(function(data, status, headers,config){
  9579.  
  9580.                       console.log('data error reverse 1x');
  9581.  
  9582.                       $scope.isDisabled = false;
  9583.                     })
  9584.  
  9585.                       //end if reverse 1x
  9586.  
  9587.                           }
  9588.  
  9589.                       else
  9590.                       {//else kalo gagal reverse 1 dan ga masuk if
  9591.                         var alertPopup = $ionicPopup.alert({
  9592.  
  9593.                                     title: 'Info',
  9594.  
  9595.                                     template: 'Request error, Please try again in a few minutes'
  9596.  
  9597.                                   });
  9598.  
  9599. //                          $state.go('snd.home');
  9600.                       }
  9601.                           //////////end reverse repeat
  9602.  
  9603.                              }
  9604.  
  9605.                              var res = data.split(";");
  9606.  
  9607.                               })
  9608.                          
  9609.  
  9610.                   .error(function(data, status, headers,config){
  9611.  
  9612.                   console.log('data error reverse 1x');
  9613.  
  9614.                   $scope.isDisabled = false;          
  9615.  
  9616.                   })
  9617.  
  9618.                   //end if reverse 1x
  9619.  
  9620.                       }
  9621.  
  9622.                       else
  9623.                          
  9624.                   {//else kalo gagal reverse 1 dan ga masuk if
  9625.  
  9626.                     var alertPopup = $ionicPopup.alert({
  9627.  
  9628.                                 title: 'Info',
  9629.  
  9630.                                 template: 'Request error, Please try again in a few minutes'
  9631.  
  9632.                               });
  9633.  
  9634. //                      $state.go('snd.home');
  9635.  
  9636.                   }
  9637.                        }                      
  9638.  
  9639.                           })
  9640.  
  9641.               .error(function(data, status, headers,config){
  9642.  
  9643.               console.log('data error reverse 1x');
  9644.  
  9645.               $scope.isDisabled = false;
  9646.  
  9647.               })
  9648.  
  9649.               //end if reverse 1x
  9650.  
  9651.                   }
  9652.  
  9653.               else
  9654.                  
  9655.               {//else kalo gagal reverse 1 dan ga masuk if
  9656.  
  9657.                 var alertPopup = $ionicPopup.alert({
  9658.  
  9659.                             title: 'Info',
  9660.  
  9661.                             template: 'Request error, Please try again in a few minutes'
  9662.  
  9663.                           });
  9664.  
  9665. //                  $state.go('snd.home');
  9666.  
  9667.               }
  9668.  
  9669.                 }
  9670.  
  9671.                 })
  9672.  
  9673.           }
  9674.  
  9675.            })
  9676.  
  9677.            .error(function(data, status, headers,config){
  9678.  
  9679.              console.log('data error');
  9680.  
  9681.              $scope.isDisabled = false;
  9682.  
  9683.            })
  9684.  
  9685.            .then(function(result){
  9686.  
  9687.              things = result.data;
  9688.  
  9689.            });
  9690.  
  9691.        }
  9692.  
  9693. }
  9694.  
  9695. //end scope click
  9696.  
  9697. })
  9698.  
  9699.  
  9700.  
  9701.  
  9702.  
  9703. .controller('Telkom_summaryController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  9704.  
  9705. console.log("di Telkom summary-->"+$localStorage.telkomrefid);
  9706.  
  9707.  
  9708. //$3;TELKOM;02175910049;Test telkom 210;20121023180340; 517.000,00; 2.500,00;E81E23AE26E4F0BF1C3B35D75F43AD36;
  9709. //519.500,00;-;INV121023170417;JUL 2011- 110.000,00#JUN 2011- 205.000,00#MEI 2011- 202.000,00#; REF;NAMA_BANK ;*
  9710.  
  9711.  
  9712. var res = $localStorage.telkomrefid.split(";");
  9713.  
  9714.  
  9715.  
  9716.  
  9717.   $scope.idpelanggan=res[2];
  9718.  
  9719.   $scope.namapelanggan=res[3];
  9720.  
  9721.   $scope.detailtagihan=res[11];
  9722.  
  9723.  
  9724.  
  9725.  
  9726.   $scope.standmeter=res[8];
  9727.  
  9728.   $scope.harga=res[4];
  9729.  
  9730.  
  9731.   $scope.tgllunas=res[9];
  9732.  
  9733.   $scope.totalharga=res[10];
  9734.  
  9735.   $scope.noinvoice=res[14];
  9736.  
  9737.   $scope.refid=res[7];
  9738.  
  9739.  
  9740.  
  9741.   $http.get('http://dxplor.com/dxplor/Mo_telkom/get_cashback')
  9742.  
  9743.  
  9744.   // $http({method: "get", url: "https://www.googleapis.com/plus/v1/people/me", data: "access_token=" + accessToken})
  9745.    .success(function(data) {
  9746.  
  9747.         $scope.cashback=data;
  9748.         console.log("get cashback data telkom-->"+$scope.cashback);
  9749.        
  9750.  
  9751.         var rescashback=$scope.cashback.split(";");
  9752.         $localStorage.telkom_admin=rescashback[0];
  9753.         $localStorage.telkom_cashback=rescashback[1];
  9754.  
  9755.  
  9756.        
  9757.         $scope.rptagihan=res[5];
  9758.  
  9759.         $scope.hargaadmin=$localStorage.telkom_admin;
  9760.        
  9761.         //$scope.totaltagihan=res[8];
  9762.  
  9763.           $scope.totalamountasli=res[8];
  9764.           console.log("total amount asli-->"+$scope.totalamountasli);
  9765.           $scope.totaltagihan=parseInt(res[5])+parseInt($localStorage.telkom_admin);
  9766.           console.log("total amount dxplor-->"+$scope.totaltagihan);
  9767.  
  9768.          
  9769.          
  9770.          
  9771.  
  9772.    })
  9773.    .error(function(data, status) {
  9774.        console.log("ERROR: " + data);
  9775.  
  9776.    });
  9777.  
  9778.  
  9779.  
  9780. })
  9781.  
  9782.  
  9783. //End Telkom
  9784.  
  9785.  
  9786.  
  9787.  
  9788.  
  9789. //Speedy
  9790.  
  9791.  
  9792. .controller('SpeedyController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  9793.  
  9794.  
  9795.  
  9796. console.log("di Speedy");
  9797.  
  9798.  
  9799. $scope.required = true;
  9800.  
  9801.  
  9802. $scope.check_bill_speedy = function(cust_id) {
  9803.  
  9804.  
  9805.  
  9806. $http.post('http://dxplor.com/dxplor/Mo_speedy/check_bill_speedy', {customer_id : cust_id})
  9807.  
  9808.  
  9809.  
  9810.     .success(function(data, status, headers,config){
  9811.  
  9812.       console.log('data success');
  9813.  
  9814.       console.log('data-->'+data); // for browser console
  9815.  
  9816.      
  9817.  
  9818.       if(data=="idempty")
  9819.  
  9820.       {
  9821.  
  9822.      
  9823.  
  9824.       var alertPopup = $ionicPopup.alert({
  9825.  
  9826.             title: 'Error',
  9827.  
  9828.             template: 'Customer ID is mandatory'
  9829.  
  9830.           });
  9831.  
  9832.          
  9833.  
  9834.       }
  9835.  
  9836.       else
  9837.  
  9838.       { // data not empty
  9839.  
  9840.          
  9841.  
  9842.       var res = data.split(";");
  9843.  
  9844.  
  9845.  
  9846.       //console.log(res[0]);
  9847.  
  9848.  
  9849.  
  9850.        
  9851.  
  9852.         if(res[0]=="$C")
  9853.  
  9854.         {
  9855.  
  9856.         var alertPopup = $ionicPopup.alert({
  9857.  
  9858.                 title: 'Error',
  9859.  
  9860.                 template: res[4]
  9861.  
  9862.               });
  9863.  
  9864.          
  9865.  
  9866.             $state.go($state.current, {}, {reload: true});
  9867.  
  9868.  
  9869.  
  9870.         }
  9871.  
  9872.        
  9873.  
  9874.         if(res[0]=="$D")
  9875.  
  9876.     {
  9877.  
  9878.          
  9879.  
  9880.         $localStorage.speedy_confirm=data;
  9881.  
  9882.         $state.go('snd.speedy_confirm');
  9883.  
  9884.  
  9885.  
  9886.     }
  9887.  
  9888.        
  9889.  
  9890.        
  9891.  
  9892.       }
  9893.  
  9894.    
  9895.  
  9896.      
  9897.  
  9898.  
  9899.     })
  9900.  
  9901.     .error(function(data, status, headers,config){
  9902.  
  9903.       console.log('data error');
  9904.  
  9905.       console.log('data-->'+data); // for browser console
  9906.  
  9907.  
  9908.  
  9909.  
  9910.  
  9911.     })
  9912.  
  9913.     .then(function(result){
  9914.  
  9915.       things = result.data;
  9916.  
  9917.     });
  9918.  
  9919.  
  9920. }
  9921.  
  9922. })
  9923.  
  9924.  
  9925.  
  9926. .controller('SpeedyConfirmController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  9927.  
  9928.  
  9929.  
  9930. console.log("di Speedy Confirm-->"+$localStorage.speedy_confirm);
  9931.  
  9932.  
  9933. //$D;3;SPEEDY;Nama :;DUM""MY SPEEDY IPN-01;No Tagihan :;02175910000;Tagihan Rp :;46355;ADM Rp :;3000;Total :;49355;
  9934. //Nomor Invoice :;INV20170105220259;JAN 2014;Tekan :;[OK] Untuk Bayar;[BACK] Kembali;*
  9935.  
  9936.  
  9937.  
  9938.   var res = $localStorage.speedy_confirm.split(";");
  9939.  
  9940.  
  9941.  
  9942.   $scope.idpelanggan=res[6];
  9943.  
  9944.   $scope.namapelanggan=res[4];
  9945.  
  9946.   $scope.totalamount=res[12];
  9947.  
  9948.   $scope.noinvoice=res[14];
  9949.  
  9950.  
  9951.   //Scope clikck
  9952.  
  9953. $scope.confirm_pay_speedy = function() {
  9954.  
  9955.   $scope.login=true;
  9956.  
  9957.        if($localStorage.email==null)
  9958.  
  9959.    {
  9960.  
  9961.    console.log("belum login");
  9962.  
  9963.        
  9964.  
  9965.        var alertPopup = $ionicPopup.alert({
  9966.  
  9967.            title: 'Info',
  9968.  
  9969.            template: 'Please Login first to Pay Speedy'
  9970.  
  9971.          });
  9972.  
  9973.    
  9974.  
  9975.        $state.go('snd.login');
  9976.  
  9977.        $scope.login=false;
  9978.  
  9979.    }
  9980.  
  9981.        if($scope.login==false){
  9982.  
  9983.        }
  9984.  
  9985.        else
  9986.  
  9987.        {    
  9988.  
  9989.        $http.post('http://dxplor.com/dxplor/Mo_balance/get_balance/'+ $localStorage.customerid)
  9990.  
  9991.            .success(function(data, status, headers,config){
  9992.  
  9993.              console.log(data); // for browser console
  9994.  
  9995.              $scope.balance =  data;
  9996.  
  9997.             console.log("balance-->"+$scope.balance);
  9998.  
  9999.             console.log("total bill-->"+$scope.totalamount);
  10000.  
  10001.           if(parseInt($scope.balance) < parseInt($scope.totalamount))
  10002.  
  10003.               {
  10004.              
  10005.               var alertPopup = $ionicPopup.alert({
  10006.  
  10007.                   title: 'Info',
  10008.  
  10009.                   template: 'You dont have enough balance, please topup first'
  10010.  
  10011.                 });
  10012.  
  10013.               $state.go($state.current, {}, {reload: true});
  10014.  
  10015.               console.log("didnt have enough balance");
  10016.  
  10017.               }          
  10018.  
  10019.           else
  10020.  
  10021.           {
  10022.  
  10023.                   console.log("have enough balance to pay Speedy");
  10024.  
  10025.                       //disable button
  10026.                       $scope.isDisabled = true;
  10027.  
  10028.                   $http.post('http://dxplor.com/dxplor/Mo_speedy/pay_speedy', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  10029.  
  10030.                 .success(function(data, status, headers,config){                 
  10031.  
  10032.                 $scope.isDisabled = false;
  10033.  
  10034.                 console.log("data-->"+data);
  10035.  
  10036.                 var res = data.split(";");
  10037.  
  10038.                 if(res[0]=="$3")
  10039.  
  10040.                 {
  10041.  
  10042.                 console.log("paybill Speedy ok");
  10043.  
  10044.                 $localStorage.speedyrefid=data;
  10045.                  
  10046.                     var alertPopup = $ionicPopup.alert({
  10047.  
  10048.                               title: 'Info',
  10049.  
  10050.                               template: 'Payment success, please note the ref id!'
  10051.  
  10052.                             });
  10053.  
  10054.                           $state.go('snd.speedy_summary');
  10055.                 }
  10056.  
  10057.                 else
  10058.  
  10059.                 {
  10060.  
  10061.                 console.log("paybill error data-->"+data);
  10062.                 console.log("paybill error-->"+res[4]);
  10063.  
  10064.               var errorcode = res[4].substring(7,9);
  10065.  
  10066.               console.log("error codes-->"+errorcode);
  10067.  
  10068.               if(errorcode=="91" || errorcode=="77" ||errorcode=="48" ||errorcode=="96" ||errorcode=="14" ||errorcode=="48" ||
  10069.                       errorcode=="06" || errorcode=="18" || errorcode=="68" || errorcode=="99" || errorcode=="0028" || errorcode=="ER" || errorcode=="0005" )
  10070.  
  10071.               { // Reverse 1x
  10072.  
  10073.               console.log('masuk reverse 1');
  10074.  
  10075.               $http.post('http://dxplor.com/dxplor/Mo_speedy/pay_speedy_reverse1', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  10076.  
  10077.                           .success(function(data, status, headers,config){
  10078.  
  10079.                             $scope.isDisabled = false;
  10080.  
  10081.                           console.log("data-->"+data);
  10082.  
  10083.                           var res = data.split(";");
  10084.                          if(res[0]=="$3")
  10085.  
  10086.                          { //success reverse 1
  10087.  
  10088.                         console.log("paybill speedy ok");
  10089.  
  10090.                         $localStorage.speedyrefid=data;
  10091.  
  10092.                                 var alertPopup = $ionicPopup.alert({
  10093.  
  10094.                                        title: 'Info',
  10095.  
  10096.                                        template: 'Payment success, please note the ref id!'
  10097.  
  10098.                                      });
  10099.  
  10100.                                    $state.go('snd.speedy_summary');
  10101.  
  10102.  
  10103.                          }
  10104.  
  10105.                          else
  10106.  
  10107.                          { //gagal reverse 1
  10108.  
  10109.                          
  10110.                          console.log("paybill error reverse1 data-->"+data);
  10111.  
  10112.                          console.log("paybills error reverse1-->"+res[4]);
  10113.                          
  10114.                        var errorcoderev1 = res[4].substring(7,9);
  10115.  
  10116.                        console.log("error codes rev12-->"+errorcoderev1);                  
  10117.  
  10118.                        if(errorcoderev1=="91" || errorcoderev1=="77" ||errorcoderev1=="48" ||errorcoderev1=="96" ||errorcoderev1=="14" ||errorcoderev1=="48" ||  errorcoderev1=="06" || errorcoderev1=="18" || errorcoderev1=="68" || errorcoderev1=="99" || errorcoderev1=="0028" || errorcoderev1=="ER" || errorcoderev1=="0005" )
  10119.  
  10120.                   { // Reverse 1x
  10121.                  
  10122.                   console.log('masuk reverse repeat1 1');
  10123.                  
  10124.                   $http.post('http://dxplor.com/dxplor/Mo_speedy/pay_speedy_reverse_repeat1', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  10125.  
  10126.                               .success(function(data, status, headers,config){
  10127.                                  
  10128.                               $scope.isDisabled = false;
  10129.  
  10130.                               console.log("data-->"+data);
  10131.                              
  10132.                               var res = data.split(";");
  10133.                                
  10134.                                   if(res[0]=="$3")
  10135.  
  10136.                              { //success reverse repeat 1
  10137.  
  10138.                             console.log("paybill speedy reverse repeat1 ok");
  10139.  
  10140.                             $localStorage.speedyrefid=data;
  10141.  
  10142.                                     var alertPopup = $ionicPopup.alert({
  10143.  
  10144.                                            title: 'Info',
  10145.  
  10146.                                            template: 'Payment success, please note the ref id!'
  10147.  
  10148.                                          });
  10149.  
  10150.                                        $state.go('snd.speedy_summary');
  10151.                              }
  10152.  
  10153.                              else
  10154.  
  10155.                              { //gagal reverse repeat 1
  10156.  
  10157.                              
  10158.  
  10159.                              console.log("paybills error reverse repeat 11 data-->"+data);
  10160.  
  10161.                              console.log("paybills error reverse repeat 1-->"+res[4]);
  10162.  
  10163.                           var errorcoderev1 = res[4].substring(7,9);
  10164.  
  10165.                           console.log("error codes rev repeat 11-->"+errorcoderev1);
  10166.  
  10167.                           ////start reverse repeat
  10168.  
  10169.                           if(errorcoderev1=="91" || errorcoderev1=="77" ||errorcoderev1=="48" ||errorcoderev1=="96" ||errorcoderev1=="14" ||errorcoderev1=="48" ||                                    errorcoderev1=="06" || errorcoderev1=="18" || errorcoderev1=="68" || errorcoderev1=="99" || errorcoderev1=="0028" || errorcoderev1=="ER" || errorcoderev1=="0005" )
  10170.  
  10171.  
  10172.                              
  10173.                              
  10174.                              
  10175.                       { // Reverserepeeat 1x
  10176.  
  10177.                       console.log('masuk reverse  repeat 2');
  10178.  
  10179.                       $http.post('http://dxplor.com/dxplor/Mo_speedy/pay_speedy_reverse_repeat2', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  10180.  
  10181.                                   .success(function(data, status, headers,config){
  10182.                            
  10183.                                   $scope.isDisabled = false;
  10184.  
  10185.                                   console.log("data reverse repeat repeat2-->"+data);
  10186.  
  10187.                                   var res = data.split(";");
  10188.  
  10189.                                       if(res[0]=="$3")
  10190.  
  10191.                                  { //success reverse 1
  10192.  
  10193.                                 console.log("paybill speedy reverse repeat2 ok");
  10194.  
  10195.                                 $localStorage.speedyrefid=data;
  10196.  
  10197.                                 var alertPopup = $ionicPopup.alert({
  10198.  
  10199.                                                title: 'Info',
  10200.  
  10201.                                                template: 'Payment success, please note the ref id!'
  10202.  
  10203.                                              });
  10204.  
  10205.                                            $state.go('snd.speedy_summary');                  
  10206.  
  10207.                                  }
  10208.  
  10209.                                  else
  10210.  
  10211.                                  { //gagal reverse repeat 2
  10212.                                
  10213.                                  console.log("paybill error reverse repeat 2 data-->"+data);
  10214.                                  console.log("paybill error reverse repeat 2-->"+res[4]);                                
  10215.  
  10216.                                var errorcoderevrepeat1 = res[4].substring(7,9);
  10217.  
  10218.                               console.log("error codes rev repeeat2-->"+errorcoderevrepeat1);
  10219.  
  10220.                               if(errorcoderevrepeat1=="91" || errorcoderevrepeat1=="77" ||errorcoderevrepeat1=="48" ||errorcoderevrepeat1=="96" ||errorcoderevrepeat1=="14" ||errorcoderevrepeat1=="48" ||                                       errorcoderevrepeat1=="06" || errorcoderevrepeat1=="18" || errorcoderevrepeat1=="68" || errorcoderevrepeat1=="99" || errorcoderevrepeat1=="0028" || errorcoderevrepeat1=="ER" || errorcoderevrepeat1=="0005" )
  10221.  
  10222.  
  10223.                           { // Reverse repeat 2x
  10224.  
  10225.                           console.log('masuk reverse  2 trakhir');
  10226.  
  10227.                           $http.post('http://dxplor.com/dxplor/Mo_speedy/pay_speedy_reverse2', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  10228.  
  10229.                                       .success(function(data, status, headers,config){
  10230.  
  10231.                                       $scope.isDisabled = false;
  10232.                                       console.log("data-->"+data);
  10233.                                       var res = data.split(";");
  10234.                                       if(res[0]=="$3")
  10235.  
  10236.                                      { //success reverse  2
  10237.                                     console.log("paybill speedy rev 2 ok");
  10238.  
  10239.                                     $localStorage.speedyrefid=data;
  10240.  
  10241.                                     var alertPopup = $ionicPopup.alert({
  10242.  
  10243.                                                    title: 'Info',
  10244.  
  10245.                                                    template: 'Payment success, please note the ref id!'
  10246.  
  10247.                                                  });
  10248.  
  10249.                                                $state.go('snd.speedy_summary');
  10250.  
  10251.                                      }
  10252.  
  10253.                                      else
  10254.  
  10255.                                      { //gagal reverse  2
  10256.  
  10257.                                      console.log("paybill error reverse repeat 21 data-->"+data);
  10258.                                      console.log("paybill error reverse repeat 21-->"+res[4]);
  10259.  
  10260.                                      
  10261.  
  10262.                                    var alertPopup = $ionicPopup.alert({
  10263.  
  10264.                                                 title: 'Info',
  10265.  
  10266.                                                 template: 'Request error, Please try again in a few minutes'
  10267.  
  10268.                                               });
  10269.                                      }
  10270.  
  10271.                                       })
  10272.  
  10273.                           .error(function(data, status, headers,config){
  10274.  
  10275.                           console.log('data error reverse repeat 2x');
  10276.  
  10277.                           $scope.isDisabled = false;
  10278.  
  10279.                           })
  10280.                          
  10281.                           //end if reverse 1x
  10282.  
  10283.                               }                          
  10284.  
  10285.                           else
  10286.                          
  10287.                           {//else kalo gagal reverse 1 dan ga masuk if
  10288.  
  10289.                             var alertPopup = $ionicPopup.alert({
  10290.  
  10291.                                         title: 'Info',
  10292.  
  10293.                                         template: 'Request error, Please try again in a few minutes'
  10294.  
  10295.                                       });
  10296.  
  10297. //                              $state.go('snd.home');
  10298.  
  10299.                           }
  10300.  
  10301.                                  }
  10302.  
  10303.                                   })
  10304.  
  10305.                       .error(function(data, status, headers,config){
  10306.  
  10307.                       console.log('data error reverse 1x');
  10308.  
  10309.                       $scope.isDisabled = false;
  10310.                     })
  10311.  
  10312.                       //end if reverse 1x
  10313.  
  10314.                           }
  10315.  
  10316.                       else
  10317.                       {//else kalo gagal reverse 1 dan ga masuk if
  10318.                         var alertPopup = $ionicPopup.alert({
  10319.  
  10320.                                     title: 'Info',
  10321.  
  10322.                                     template: 'Request error, Please try again in a few minutes'
  10323.  
  10324.                                   });
  10325.  
  10326. //                          $state.go('snd.home');
  10327.                       }
  10328.                           //////////end reverse repeat
  10329.  
  10330.                              }
  10331.  
  10332.                              var res = data.split(";");
  10333.  
  10334.                               })
  10335.                          
  10336.  
  10337.                   .error(function(data, status, headers,config){
  10338.  
  10339.                   console.log('data error reverse 1x');
  10340.  
  10341.                   $scope.isDisabled = false;          
  10342.  
  10343.                   })
  10344.  
  10345.                   //end if reverse 1x
  10346.  
  10347.                       }
  10348.  
  10349.                       else
  10350.                          
  10351.                   {//else kalo gagal reverse 1 dan ga masuk if
  10352.  
  10353.                     var alertPopup = $ionicPopup.alert({
  10354.  
  10355.                                 title: 'Info',
  10356.  
  10357.                                 template: 'Request error, Please try again in a few minutes'
  10358.  
  10359.                               });
  10360.  
  10361. //                      $state.go('snd.home');
  10362.  
  10363.                   }
  10364.                        }                      
  10365.  
  10366.                           })
  10367.  
  10368.               .error(function(data, status, headers,config){
  10369.  
  10370.               console.log('data error reverse 1x');
  10371.  
  10372.               $scope.isDisabled = false;
  10373.  
  10374.               })
  10375.  
  10376.               //end if reverse 1x
  10377.  
  10378.                   }
  10379.  
  10380.               else
  10381.                  
  10382.               {//else kalo gagal reverse 1 dan ga masuk if
  10383.  
  10384.                 var alertPopup = $ionicPopup.alert({
  10385.  
  10386.                             title: 'Info',
  10387.  
  10388.                             template: 'Request error, Please try again in a few minutes'
  10389.  
  10390.                           });
  10391.  
  10392. //                  $state.go('snd.home');
  10393.  
  10394.               }
  10395.  
  10396.                 }
  10397.  
  10398.                 })
  10399.  
  10400.           }
  10401.  
  10402.            })
  10403.  
  10404.            .error(function(data, status, headers,config){
  10405.  
  10406.              console.log('data error');
  10407.  
  10408.              $scope.isDisabled = false;
  10409.  
  10410.            })
  10411.  
  10412.            .then(function(result){
  10413.  
  10414.              things = result.data;
  10415.  
  10416.            });
  10417.  
  10418.        }
  10419.  
  10420. }
  10421.  
  10422. //end scope click
  10423.  
  10424. })
  10425.  
  10426.  
  10427.  
  10428.  
  10429.  
  10430. .controller('Speedy_summaryController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  10431.  
  10432. console.log("di Speedy summary-->"+$localStorage.speedyrefid);
  10433.  
  10434.  
  10435. //$3;SPEEDY;02175910049;Test speedy 210;20121023180340; 517.000,00; 2.500,00;E81E23AE26E4F0BF1C3B35D75F43AD36;
  10436. //519.500,00;-;INV121023170417;JUL 2011- 110.000,00#JUN 2011- 205.000,00#MEI 2011- 202.000,00#; REF;NAMA_BANK ;*
  10437.  
  10438.  
  10439. var res = $localStorage.speedyrefid.split(";");
  10440.  
  10441.   $scope.idpelanggan=res[2];
  10442.  
  10443.   $scope.namapelanggan=res[3];
  10444.  
  10445.   $scope.detailtagihan=res[11];
  10446.  
  10447.   $scope.rptagihan=res[5];
  10448.  
  10449.   $scope.hargaadmin=res[6];
  10450.  
  10451.   $scope.totaltagihan=res[8];
  10452.  
  10453.  
  10454.   $scope.standmeter=res[8];
  10455.  
  10456.   $scope.harga=res[4];
  10457.  
  10458.  
  10459.   $scope.tgllunas=res[9];
  10460.  
  10461.   $scope.totalharga=res[10];
  10462.  
  10463.   $scope.noinvoice=res[14];
  10464.  
  10465.   $scope.refid=res[7];
  10466.  
  10467.  
  10468.  
  10469. })
  10470.  
  10471.  
  10472. //End Speedy
  10473.  
  10474. .controller('PLNController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  10475.  
  10476.  
  10477.  
  10478. console.log("di PLN");
  10479.  
  10480.  
  10481. $scope.required = true;
  10482.  
  10483.  
  10484. $scope.check_bill_pln = function(cust_id) {
  10485.  
  10486.  
  10487.  
  10488. $http.post('http://dxplor.com/dxplor/Mo_pln/check_bill_pln', {customer_id : cust_id})
  10489.  
  10490.  
  10491.  
  10492.     .success(function(data, status, headers,config){
  10493.  
  10494.       console.log('data success');
  10495.  
  10496.       console.log('data-->'+data); // for browser console
  10497.  
  10498.      
  10499.  
  10500.       if(data=="idempty")
  10501.  
  10502.       {
  10503.  
  10504.      
  10505.  
  10506.       var alertPopup = $ionicPopup.alert({
  10507.  
  10508.             title: 'Error',
  10509.  
  10510.             template: 'Customer ID is mandatory'
  10511.  
  10512.           });
  10513.  
  10514.          
  10515.  
  10516.       }
  10517.  
  10518.       else
  10519.  
  10520.       { // data not empty
  10521.  
  10522.          
  10523.  
  10524.       var res = data.split(";");
  10525.  
  10526.  
  10527.  
  10528.       //console.log(res[0]);
  10529.  
  10530.  
  10531.  
  10532.        
  10533.  
  10534.         if(res[0]=="$C")
  10535.  
  10536.         {
  10537.  
  10538.         var alertPopup = $ionicPopup.alert({
  10539.  
  10540.                 title: 'Error',
  10541.  
  10542.                 template: res[4]
  10543.  
  10544.               });
  10545.  
  10546.          
  10547.  
  10548.             $state.go($state.current, {}, {reload: true});
  10549.  
  10550.  
  10551.  
  10552.         }
  10553.  
  10554.        
  10555.  
  10556.         if(res[0]=="$D")
  10557.  
  10558.     {
  10559.  
  10560.          
  10561.  
  10562.         $localStorage.pln_confirm=data;
  10563.  
  10564.         $state.go('snd.pln_confirm');
  10565.  
  10566.  
  10567.  
  10568.     }
  10569.  
  10570.        
  10571.  
  10572.        
  10573.  
  10574.       }
  10575.  
  10576.    
  10577.  
  10578.      
  10579.  
  10580.  
  10581.     })
  10582.  
  10583.     .error(function(data, status, headers,config){
  10584.  
  10585.       console.log('data error');
  10586.  
  10587.       console.log('data-->'+data); // for browser console
  10588.  
  10589.  
  10590.  
  10591.  
  10592.  
  10593.     })
  10594.  
  10595.     .then(function(result){
  10596.  
  10597.       things = result.data;
  10598.  
  10599.     });
  10600.  
  10601.  
  10602. }
  10603.  
  10604. })
  10605.  
  10606.  
  10607.  
  10608. .controller('PLN_confirmController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  10609.  
  10610.  
  10611.  
  10612. console.log("di PLN Confirm-->"+$localStorage.pln_confirm);
  10613.  
  10614.  
  10615. //$D;3;PLN;Nama :;DUM""MY IPN-01;Id Pelanggan :;211111125251;
  10616.  
  10617. //Tagihan Rp :;192048;ADM Rp :;1600;Total :;193648;
  10618.  
  10619. //Nomor Invoice :;INV20160821131714;Tarif/Daya :;  R1/900 VA;BL/TH :;0314;
  10620.  
  10621. //Stand Meter :;02681700-02782500;Rp Subsidi :;0;
  10622.  
  10623. //Total Lembar Tagihan : 1 Bulan;201403#192048#1600; ;Tekan :;[OK] Untuk Bayar;[BACK] Kembali;*
  10624.  
  10625.  
  10626.  
  10627.   var res = $localStorage.pln_confirm.split(";");
  10628.  
  10629.  
  10630.  
  10631.   $scope.idpelanggan=res[6];
  10632.  
  10633.   $scope.namapelanggan=res[4];
  10634.  
  10635.   $scope.totalamount=res[12];
  10636.  
  10637.   $scope.noinvoice=res[14];
  10638.  
  10639.  
  10640.   //Scope clikck
  10641.  
  10642.  
  10643.   $http.get('http://dxplor.com/dxplor/Mo_pln/get_cashback')
  10644.  
  10645.  
  10646.   // $http({method: "get", url: "https://www.googleapis.com/plus/v1/people/me", data: "access_token=" + accessToken})
  10647.    .success(function(data) {
  10648.  
  10649.         $scope.cashback=data;
  10650.         console.log("get cashback data PLN-->"+$scope.cashback);
  10651.        
  10652.  
  10653.         var rescashback=$scope.cashback.split(";");
  10654.         $localStorage.pln_admin=rescashback[0];
  10655.         $localStorage.pln_cashback=rescashback[1];
  10656.  
  10657.  
  10658.  
  10659.           $scope.totalamountasli=res[12];
  10660.           console.log("total amount asli-->"+$scope.totalamountasli);
  10661.           $scope.totalamount=parseInt(res[8])+parseInt($localStorage.pln_admin);
  10662.           console.log("total amount dxplor-->"+$scope.totalamount);
  10663.  
  10664.        
  10665.    })
  10666.    .error(function(data, status) {
  10667.        console.log("ERROR: " + data);
  10668.  
  10669.    });
  10670.  
  10671.  
  10672. $scope.confirm_pay_pln = function() {
  10673.  
  10674.   $scope.login=true;
  10675.  
  10676.        if($localStorage.email==null)
  10677.  
  10678.    {
  10679.  
  10680.    console.log("belum login");
  10681.  
  10682.        
  10683.  
  10684.        var alertPopup = $ionicPopup.alert({
  10685.  
  10686.            title: 'Info',
  10687.  
  10688.            template: 'Please Login first to Pay PLN'
  10689.  
  10690.          });
  10691.  
  10692.    
  10693.  
  10694.        $state.go('snd.login');
  10695.  
  10696.        $scope.login=false;
  10697.  
  10698.    }
  10699.  
  10700.        if($scope.login==false){
  10701.  
  10702.        }
  10703.  
  10704.        else
  10705.  
  10706.        {    
  10707.  
  10708.        $http.post('http://dxplor.com/dxplor/Mo_balance/get_balance/'+ $localStorage.customerid)
  10709.  
  10710.            .success(function(data, status, headers,config){
  10711.  
  10712.              console.log(data); // for browser console
  10713.  
  10714.              $scope.balance =  data;
  10715.  
  10716.             console.log("balance-->"+$scope.balance);
  10717.  
  10718.             console.log("total bill-->"+$scope.totalamount);
  10719.  
  10720.           if(parseInt($scope.balance) < parseInt($scope.totalamount))
  10721.  
  10722.               {
  10723.              
  10724.               var alertPopup = $ionicPopup.alert({
  10725.  
  10726.                   title: 'Info',
  10727.  
  10728.                   template: 'You dont have enough balance, please topup first'
  10729.  
  10730.                 });
  10731.  
  10732.               $state.go($state.current, {}, {reload: true});
  10733.  
  10734.               console.log("didnt have enough balance");
  10735.  
  10736.               }          
  10737.  
  10738.           else
  10739.  
  10740.           {
  10741.  
  10742.                   console.log("have enough balance to pay pln");
  10743.  
  10744.                       //disable button
  10745.                       $scope.isDisabled = true;
  10746.  
  10747.                   $http.post('http://dxplor.com/dxplor/Mo_pln/pay_pln', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  10748.  
  10749.                 .success(function(data, status, headers,config){                 
  10750.  
  10751.                 $scope.isDisabled = false;
  10752.  
  10753.                 console.log("data-->"+data);
  10754.  
  10755.                 var res = data.split(";");
  10756.  
  10757.                 if(res[0]=="$1")
  10758.  
  10759.                 {
  10760.  
  10761.                 console.log("paybill pln ok");
  10762.  
  10763.                 $localStorage.plnrefid=data;
  10764.                  
  10765.                     var alertPopup = $ionicPopup.alert({
  10766.  
  10767.                               title: 'Info',
  10768.  
  10769.                               template: 'Payment success, please note the ref id!'
  10770.  
  10771.                             });
  10772.  
  10773.                           $state.go('snd.pln_summary');
  10774.                 }
  10775.  
  10776.                 else
  10777.  
  10778.                 {
  10779.  
  10780.                 console.log("paybill error data-->"+data);
  10781.                 console.log("paybill error-->"+res[4]);
  10782.  
  10783.               var errorcode = res[4].substring(7,9);
  10784.  
  10785.               console.log("error codes-->"+errorcode);
  10786.  
  10787.               if(errorcode=="06" || errorcode=="18" || errorcode=="68" || errorcode=="99" || errorcode=="0028" || errorcode=="ER" || errorcode=="0005" )
  10788.  
  10789.               { // Reverse 1x
  10790.  
  10791.               console.log('masuk reverse 1');
  10792.  
  10793.               $http.post('http://dxplor.com/dxplor/Mo_pln/pay_pln_reverse1', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  10794.  
  10795.                           .success(function(data, status, headers,config){
  10796.  
  10797.                             $scope.isDisabled = false;
  10798.  
  10799.                           console.log("data-->"+data);
  10800.  
  10801.                           var res = data.split(";");
  10802.                          if(res[0]=="$1")
  10803.  
  10804.                          { //success reverse 1
  10805.  
  10806.                         console.log("paybill pln ok");
  10807.  
  10808.                         $localStorage.plnrefid=data;
  10809.  
  10810.                                 var alertPopup = $ionicPopup.alert({
  10811.  
  10812.                                        title: 'Info',
  10813.  
  10814.                                        template: 'Payment success, please note the ref id!'
  10815.  
  10816.                                      });
  10817.  
  10818.                                    $state.go('snd.pln_summary');
  10819.  
  10820.  
  10821.                          }
  10822.  
  10823.                          else
  10824.  
  10825.                          { //gagal reverse 1
  10826.  
  10827.                          
  10828.                          console.log("paybill error reverse1 data-->"+data);
  10829.  
  10830.                          console.log("paybills error reverse1-->"+res[4]);
  10831.                          
  10832.                        var errorcoderev1 = res[4].substring(7,9);
  10833.  
  10834.                        console.log("error codes rev1-->"+errorcoderev1);                  
  10835.  
  10836.                       if(errorcoderev1=="06" || errorcoderev1=="18" || errorcoderev1=="68" || errorcoderev1=="99" || errorcoderev1=="0028" || errorcoderev1=="ER" || errorcoderev1=="0005" )
  10837.  
  10838.                   { // Reverse 1x
  10839.                  
  10840.                   console.log('masuk reverse repeat1 1');
  10841.                  
  10842.                   $http.post('http://dxplor.com/dxplor/Mo_pln/pay_pln_reverse_repeat1', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  10843.  
  10844.                               .success(function(data, status, headers,config){
  10845.                                  
  10846.                               $scope.isDisabled = false;
  10847.  
  10848.                               console.log("data-->"+data);
  10849.                              
  10850.                               var res = data.split(";");
  10851.                                
  10852.                                   if(res[0]=="$1")
  10853.  
  10854.                              { //success reverse repeat 1
  10855.  
  10856.                             console.log("paybill pln reverse repeat1 ok");
  10857.  
  10858.                             $localStorage.plnrefid=data;
  10859.  
  10860.                                     var alertPopup = $ionicPopup.alert({
  10861.  
  10862.                                            title: 'Info',
  10863.  
  10864.                                            template: 'Payment success, please note the ref id!'
  10865.  
  10866.                                          });
  10867.  
  10868.                                        $state.go('snd.pln_summary');
  10869.                              }
  10870.  
  10871.                              else
  10872.  
  10873.                              { //gagal reverse repeat 1
  10874.  
  10875.                              
  10876.  
  10877.                              console.log("paybills error reverse repeat 11 data-->"+data);
  10878.  
  10879.                              console.log("paybills error reverse repeat 1-->"+res[4]);
  10880.  
  10881.                           var errorcoderev1 = res[4].substring(7,9);
  10882.  
  10883.                           console.log("error codes rev repeat 11-->"+errorcoderev1);
  10884.  
  10885.                           ////start reverse repeat
  10886.  
  10887.                           if(errorcoderev1=="06" || errorcoderev1=="18" || errorcoderev1=="68" || errorcoderev1=="99" || errorcoderev1=="0028" || errorcoderev1=="ER" || errorcoderev1=="0005" )
  10888.  
  10889.                       { // Reverserepeeat 1x
  10890.  
  10891.                       console.log('masuk reverse  repeat 2');
  10892.  
  10893.                       $http.post('http://dxplor.com/dxplor/Mo_pln/pay_pln_reverse_repeat2', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  10894.  
  10895.                                   .success(function(data, status, headers,config){
  10896.                            
  10897.                                   $scope.isDisabled = false;
  10898.  
  10899.                                   console.log("data reverse repeat repeat2-->"+data);
  10900.  
  10901.                                   var res = data.split(";");
  10902.  
  10903.                                       if(res[0]=="$1")
  10904.  
  10905.                                  { //success reverse 1
  10906.  
  10907.                                 console.log("paybill pln reverse repeat2 ok");
  10908.  
  10909.                                 $localStorage.plnrefid=data;
  10910.  
  10911.                                 var alertPopup = $ionicPopup.alert({
  10912.  
  10913.                                                title: 'Info',
  10914.  
  10915.                                                template: 'Payment success, please note the ref id!'
  10916.  
  10917.                                              });
  10918.  
  10919.                                            $state.go('snd.pln_summary');                
  10920.  
  10921.                                  }
  10922.  
  10923.                                  else
  10924.  
  10925.                                  { //gagal reverse repeat 2
  10926.                                
  10927.                                  console.log("paybill error reverse repeat 2 data-->"+data);
  10928.                                  console.log("paybill error reverse repeat 2-->"+res[4]);                                
  10929.  
  10930.                                var errorcoderevrepeat1 = res[4].substring(7,9);
  10931.  
  10932.                               console.log("error codes rev repeeat2-->"+errorcoderevrepeat1);
  10933.  
  10934.                               if(errorcoderevrepeat1=="06" || errorcoderevrepeat1=="18" || errorcoderevrepeat1=="68" || errorcoderevrepeat1=="99" || errorcoderevrepeat1=="0028" || errorcoderevrepeat1=="ER" || errorcoderevrepeat1=="0005" )
  10935.  
  10936.                           { // Reverse repeat 2x
  10937.  
  10938.                           console.log('masuk reverse  2 trakhir');
  10939.  
  10940.                           $http.post('http://dxplor.com/dxplor/Mo_pln/pay_pln_reverse2', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  10941.  
  10942.                                       .success(function(data, status, headers,config){
  10943.  
  10944.                                       $scope.isDisabled = false;
  10945.                                       console.log("data-->"+data);
  10946.                                       var res = data.split(";");
  10947.                                       if(res[0]=="$1")
  10948.  
  10949.                                      { //success reverse  2
  10950.                                     console.log("paybill pln rev 2 ok");
  10951.  
  10952.                                     $localStorage.plnrefid=data;
  10953.  
  10954.                                     var alertPopup = $ionicPopup.alert({
  10955.  
  10956.                                                    title: 'Info',
  10957.  
  10958.                                                    template: 'Payment success, please note the ref id!'
  10959.  
  10960.                                                  });
  10961.  
  10962.                                                $state.go('snd.pln_summary');
  10963.  
  10964.                                      }
  10965.  
  10966.                                      else
  10967.  
  10968.                                      { //gagal reverse  2
  10969.  
  10970.                                      console.log("paybill error reverse repeat 21 data-->"+data);
  10971.                                      console.log("paybill error reverse repeat 21-->"+res[4]);
  10972.  
  10973.                                      
  10974.  
  10975.                                    var alertPopup = $ionicPopup.alert({
  10976.  
  10977.                                                 title: 'Info',
  10978.  
  10979.                                                 template: 'Request error, Please try again in a few minutes'
  10980.  
  10981.                                               });
  10982.                                      }
  10983.  
  10984.                                       })
  10985.  
  10986.                           .error(function(data, status, headers,config){
  10987.  
  10988.                           console.log('data error reverse repeat 2x');
  10989.  
  10990.                           $scope.isDisabled = false;
  10991.  
  10992.                           })
  10993.                          
  10994.                           //end if reverse 1x
  10995.  
  10996.                               }                          
  10997.  
  10998.                           else
  10999.                          
  11000.                           {//else kalo gagal reverse 1 dan ga masuk if
  11001.  
  11002.                             var alertPopup = $ionicPopup.alert({
  11003.  
  11004.                                         title: 'Info',
  11005.  
  11006.                                         template: 'Request error, Please try again in a few minutes'
  11007.  
  11008.                                       });
  11009.  
  11010. //                              $state.go('snd.home');
  11011.  
  11012.                           }
  11013.  
  11014.                                  }
  11015.  
  11016.                                   })
  11017.  
  11018.                       .error(function(data, status, headers,config){
  11019.  
  11020.                       console.log('data error reverse 1x');
  11021.  
  11022.                       $scope.isDisabled = false;
  11023.                     })
  11024.  
  11025.                       //end if reverse 1x
  11026.  
  11027.                           }
  11028.  
  11029.                       else
  11030.                       {//else kalo gagal reverse 1 dan ga masuk if
  11031.                         var alertPopup = $ionicPopup.alert({
  11032.  
  11033.                                     title: 'Info',
  11034.  
  11035.                                     template: 'Request error, Please try again in a few minutes'
  11036.  
  11037.                                   });
  11038.  
  11039. //                          $state.go('snd.home');
  11040.                       }
  11041.                           //////////end reverse repeat
  11042.  
  11043.                              }
  11044.  
  11045.                              var res = data.split(";");
  11046.  
  11047.                               })
  11048.                          
  11049.  
  11050.                   .error(function(data, status, headers,config){
  11051.  
  11052.                   console.log('data error reverse 1x');
  11053.  
  11054.                   $scope.isDisabled = false;          
  11055.  
  11056.                   })
  11057.  
  11058.                   //end if reverse 1x
  11059.  
  11060.                       }
  11061.  
  11062.                       else
  11063.                          
  11064.                   {//else kalo gagal reverse 1 dan ga masuk if
  11065.  
  11066.                     var alertPopup = $ionicPopup.alert({
  11067.  
  11068.                                 title: 'Info',
  11069.  
  11070.                                 template: 'Request error, Please try again in a few minutes'
  11071.  
  11072.                               });
  11073.  
  11074. //                      $state.go('snd.home');
  11075.  
  11076.                   }
  11077.                        }                      
  11078.  
  11079.                           })
  11080.  
  11081.               .error(function(data, status, headers,config){
  11082.  
  11083.               console.log('data error reverse 1x');
  11084.  
  11085.               $scope.isDisabled = false;
  11086.  
  11087.               })
  11088.  
  11089.               //end if reverse 1x
  11090.  
  11091.                   }
  11092.  
  11093.               else
  11094.                  
  11095.               {//else kalo gagal reverse 1 dan ga masuk if
  11096.  
  11097.                 var alertPopup = $ionicPopup.alert({
  11098.  
  11099.                             title: 'Info',
  11100.  
  11101.                             template: 'Request error, Please try again in a few minutes'
  11102.  
  11103.                           });
  11104.  
  11105. //                  $state.go('snd.home');
  11106.  
  11107.               }
  11108.  
  11109.                 }
  11110.  
  11111.                 })
  11112.  
  11113.           }
  11114.  
  11115.            })
  11116.  
  11117.            .error(function(data, status, headers,config){
  11118.  
  11119.              console.log('data error');
  11120.  
  11121.              $scope.isDisabled = false;
  11122.  
  11123.            })
  11124.  
  11125.            .then(function(result){
  11126.  
  11127.              things = result.data;
  11128.  
  11129.            });
  11130.  
  11131.        }
  11132.  
  11133. }
  11134.  
  11135. //end scope click
  11136.  
  11137. })
  11138.  
  11139.  
  11140.  
  11141.  
  11142.  
  11143. .controller('PLN_summaryController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  11144.  
  11145. console.log("di PLN summary-->"+$localStorage.plnrefid);
  11146.  
  11147.  
  11148. //$D;3;PLN;Nama :;DUM""MY IPN-01;Id Pelanggan :;211111125251;
  11149.  
  11150. //Tagihan Rp :;192048;ADM Rp :;1600;Total :;193648;
  11151.  
  11152. //Nomor Invoice :;INV20160821131714;Tarif/Daya :;  R1/900 VA;BL/TH :;0314;
  11153.  
  11154. //Stand Meter :;02681700-02782500;Rp Subsidi :;0;
  11155.  
  11156. //Total Lembar Tagihan : 1 Bulan;201403#192048#1600; ;Tekan :;[OK] Untuk Bayar;[BACK] Kembali;*
  11157.  
  11158. //$1;211111125251;DUM""MY IPN-01;R1/900 VA;778834;6400;1113,1213,0114,0214;35464C87AD7DFE8D4301D685D50E7DA3;02681700-02782500;0,00;785234;1;123;Rincian Tagihan dapat diakses di www.pln.co.id atau PLN terdekat :;INV20160901112715;REF;-;*
  11159.  
  11160.   var res = $localStorage.plnrefid.split(";");
  11161.  
  11162.   $scope.idpelanggan=res[1];
  11163.  
  11164.   $scope.namapelanggan=res[2];
  11165.  
  11166.   $scope.daya=res[3];
  11167.  
  11168.   $scope.standmeter=res[8];
  11169.  
  11170.   $scope.harga=res[4];
  11171.  
  11172.   $scope.tagihanbulan=res[6];
  11173.  
  11174.   $scope.tgllunas=res[9];
  11175.  
  11176.   $scope.totalharga=res[10];
  11177.  
  11178.   $scope.noinvoice=res[14];
  11179.  
  11180.   $scope.refid=res[7];
  11181.  
  11182.   $scope.hargaadmin=res[5];
  11183.  
  11184.   $scope.tagihan=res[3];
  11185.  
  11186.  
  11187.  
  11188.   $http.get('http://dxplor.com/dxplor/Mo_pln/get_cashback')
  11189.  
  11190.  
  11191.   // $http({method: "get", url: "https://www.googleapis.com/plus/v1/people/me", data: "access_token=" + accessToken})
  11192.    .success(function(data) {
  11193.  
  11194.         $scope.cashback=data;
  11195.         console.log("get cashback data PLN-->"+$scope.cashback);
  11196.        
  11197.  
  11198.         var rescashback=$scope.cashback.split(";");
  11199.         $localStorage.pln_admin=rescashback[0];
  11200.         $localStorage.pln_cashback=rescashback[1];
  11201.  
  11202.  
  11203.        
  11204.  
  11205.         $scope.hargaadmin=$localStorage.pln_admin;
  11206.        
  11207.         //$scope.totaltagihan=res[8];
  11208.  
  11209.           $scope.totalamountasli=res[10];
  11210.           console.log("total amount asli-->"+$scope.totalamountasli);
  11211.           $scope.totalharga=parseInt(res[4])+parseInt($localStorage.pln_admin);
  11212.           console.log("total amount dxplor-->"+$scope.totalharga);
  11213.  
  11214.          
  11215.          
  11216.          
  11217.  
  11218.    })
  11219.    .error(function(data, status) {
  11220.        console.log("ERROR: " + data);
  11221.  
  11222.    });
  11223.  
  11224.  
  11225. })
  11226.  
  11227. // PLN Prepaid Token
  11228.  
  11229. .controller('PLN_prepaidController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  11230.  
  11231. console.log("di PLN Prepaid");
  11232.  
  11233. $scope.required = true;
  11234.  
  11235. $scope.check_pln_prepaid = function(cust_id,amount) {
  11236.    
  11237.    
  11238.    
  11239.    
  11240.     if(angular.isUndefined(cust_id))
  11241.  
  11242.  
  11243.  
  11244.     {
  11245.  
  11246.     var alertPopup = $ionicPopup.alert({
  11247.  
  11248.             title: 'Info',
  11249.  
  11250.             template: 'ID Pelanggan harus diisi'
  11251.  
  11252.           });
  11253.  
  11254.         return false;
  11255.  
  11256.     }
  11257.    
  11258.    
  11259.     if(angular.isUndefined(amount))
  11260.  
  11261.  
  11262.  
  11263.     {
  11264.  
  11265.     var alertPopup = $ionicPopup.alert({
  11266.  
  11267.             title: 'Info',
  11268.  
  11269.             template: 'Nominal Token harus dipilih'
  11270.  
  11271.           });
  11272.  
  11273.         return false;
  11274.  
  11275.     }
  11276.    
  11277.  
  11278. $http.post('http://dxplor.com/dxplor/Mo_pln_prepaid/check_pln_prepaid', {customer_id : cust_id,amount : amount})
  11279.  
  11280.     .success(function(data, status, headers,config){
  11281.  
  11282.       console.log('data success');
  11283.  
  11284.       console.log('data-->'+data); // for browser console
  11285.  
  11286.       if(data=="idempty")
  11287.  
  11288.       {
  11289.  
  11290.       var alertPopup = $ionicPopup.alert({
  11291.  
  11292.             title: 'Error',
  11293.  
  11294.             template: 'Customer ID is mandatory'
  11295.  
  11296.           });
  11297.  
  11298.       }
  11299.  
  11300.       else
  11301.  
  11302.       { // data not empty
  11303.  
  11304.       var res = data.split(";");
  11305.  
  11306.       //console.log(res[0]);
  11307.  
  11308.         if(res[0]=="$C")
  11309.  
  11310.         {
  11311.  
  11312.         var alertPopup = $ionicPopup.alert({
  11313.  
  11314.                 title: 'Error',
  11315.  
  11316.                 template: res[4]
  11317.  
  11318.               });
  11319.  
  11320.             $state.go($state.current, {}, {reload: true});
  11321.  
  11322.         }
  11323.  
  11324.         if(res[0]=="$D")
  11325.  
  11326.     {
  11327.  
  11328.         $localStorage.pln_prepaidconfirm=data;
  11329.  
  11330.         $state.go('snd.pln_prepaidconfirm');
  11331.  
  11332.     }
  11333.  
  11334.       }
  11335.  
  11336.     })
  11337.  
  11338.     .error(function(data, status, headers,config){
  11339.  
  11340.       console.log('data error');
  11341.  
  11342.       console.log('data-->'+data); // for browser console
  11343.  
  11344.  
  11345.  
  11346.  
  11347.  
  11348.     })
  11349.  
  11350.     .then(function(result){
  11351.  
  11352.       things = result.data;
  11353.  
  11354.     });
  11355.  
  11356.  
  11357. }
  11358.  
  11359. })
  11360.  
  11361.  
  11362.  
  11363. .controller('PLN_prepaidconfirmController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  11364.  
  11365.  
  11366.  
  11367. console.log("di PLN Prepaid Confirmm-->"+$localStorage.pln_prepaidconfirm);
  11368.  
  11369.  
  11370. //$D;3;PLNPREPAID;Nama :;TESTING PRE""PAID 7891;No Meter :;14234567891;Rp Beli :;20000;Rp Admin :;0;Rp Bayar :
  11371. //;20000;Nomor Invoice :;INV20161030155502;Id Pel :;551111111111;Tarif/Daya :;R1  /2200 VA;JenisToken :;Token Baru
  11372. //;Token Unsold :;0;-; ;Tekan :;[OK] Untuk Bayar;[BACK] Kembali;*
  11373.  
  11374. $http.get('http://dxplor.com/dxplor/Mo_pln_prepaid/get_cashback')
  11375.  
  11376.  
  11377. // $http({method: "get", url: "https://www.googleapis.com/plus/v1/people/me", data: "access_token=" + accessToken})
  11378.  .success(function(data) {
  11379.  
  11380.         $scope.cashback=data;
  11381.         console.log("get cashback data prepaid1-->"+$scope.cashback);
  11382.        
  11383.  
  11384.         var rescashback=$scope.cashback.split(";");
  11385.         $localStorage.pln_prepaid_admin=rescashback[0];
  11386.         $localStorage.pln_prepaid_cashback=rescashback[1];
  11387.  
  11388.           var res = $localStorage.pln_prepaidconfirm.split(";");
  11389.  
  11390.          
  11391.  
  11392.           $scope.nometer=res[6];
  11393.  
  11394.           $scope.idpelanggan=res[16];
  11395.  
  11396.           $scope.namapelanggan=res[4];
  11397.  
  11398.           $scope.nominaltoken=res[8];
  11399.  
  11400.           $scope.totalamountasli=res[12];
  11401.           console.log("total amount asli-->"+$scope.totalamountasli);
  11402.           $scope.totalamount=parseInt(res[8])+parseInt($localStorage.pln_prepaid_admin);
  11403.           console.log("total amount dxplor-->"+$scope.totalamount);
  11404.  
  11405.           $scope.noinvoice=res[14];
  11406.        
  11407.  })
  11408.  .error(function(data, status) {
  11409.      console.log("ERROR: " + data);
  11410.  
  11411.  });
  11412.  
  11413.  
  11414.  
  11415.  
  11416.   //Scope clikck
  11417.  
  11418. $scope.confirm_pay_plnprepaid = function() {
  11419.  
  11420.   $scope.login=true;
  11421.  
  11422.        if($localStorage.email==null)
  11423.  
  11424.    {
  11425.  
  11426.    console.log("belum login");
  11427.  
  11428.        
  11429.  
  11430.        var alertPopup = $ionicPopup.alert({
  11431.  
  11432.            title: 'Info',
  11433.  
  11434.            template: 'Please Login first to Buy PLN Token'
  11435.  
  11436.          });
  11437.  
  11438.    
  11439.  
  11440.        $state.go('snd.login');
  11441.  
  11442.        $scope.login=false;
  11443.  
  11444.    }
  11445.  
  11446.        if($scope.login==false){
  11447.  
  11448.        }
  11449.  
  11450.        else
  11451.  
  11452.        {    
  11453.  
  11454.        $http.post('http://dxplor.com/dxplor/Mo_balance/get_balance/'+ $localStorage.customerid)
  11455.  
  11456.            .success(function(data, status, headers,config){
  11457.  
  11458.              console.log(data); // for browser console
  11459.  
  11460.              $scope.balance =  data;
  11461.  
  11462.             console.log("balance-->"+$scope.balance);
  11463.  
  11464.             console.log("total bill-->"+$scope.totalamount);
  11465.  
  11466.           if(parseInt($scope.balance) < parseInt($scope.totalamount))
  11467.  
  11468.               {
  11469.              
  11470.               var alertPopup = $ionicPopup.alert({
  11471.  
  11472.                   title: 'Info',
  11473.  
  11474.                   template: 'You dont have enough balance, please topup first'
  11475.  
  11476.                 });
  11477.  
  11478.               $state.go($state.current, {}, {reload: true});
  11479.  
  11480.               console.log("didnt have enough balance");
  11481.  
  11482.               }          
  11483.  
  11484.           else
  11485.  
  11486.           {
  11487.  
  11488.                   console.log("have enough balance to buy pln token");
  11489.  
  11490.                       //disable button
  11491.                       $scope.isDisabled = true;
  11492.                      
  11493.                       //secret
  11494.  
  11495.                   $http.post('http://dxplor.com/dxplor/Mo_pln_prepaid/pay_pln_prepaid2', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid,secret: '3-6-1-2-3-1-2'})
  11496.  
  11497.                 .success(function(data, status, headers,config){                 
  11498.  
  11499.                 $scope.isDisabled = false;
  11500.  
  11501.                 console.log("data-->"+data);
  11502.                
  11503.                 //$2;14234567891!551111111111;TESTING PRE""PAID 7891;R1  /2200 VA;DA8F4EEAC9DE42651D0D26B8EBC86A9D;
  11504.                 //3052 2016 5530 1628 2028;20000;1600;2184.62;1456.41;3094.87;2708.01;8956.09;870,50;1600;20000
  11505.                 //;123            ;Informasi Hubungi Call Center 123 Atau hubungi PLN Terdekat ;INV20161030162028;REF;-;*
  11506.  
  11507.  
  11508.                 var res = data.split(";");
  11509.  
  11510.                 if(res[0]=="$2")
  11511.  
  11512.                 {
  11513.  
  11514.                 console.log("Buy pln Token ok");
  11515.  
  11516.                 $localStorage.plnprepaidrefid=data;
  11517.                  
  11518.                     var alertPopup = $ionicPopup.alert({
  11519.  
  11520.                               title: 'Info',
  11521.  
  11522.                               template: 'Pembelian Token Sukses, silahkan catat nomor STROOM / TOKEN'
  11523.  
  11524.                             });
  11525.  
  11526.                           $state.go('snd.plnprepaid_summary');
  11527.                 }
  11528.  
  11529.                 else
  11530.  
  11531.                 {
  11532.  
  11533.                 console.log("paybill error data-->"+data);
  11534.                 console.log("paybill error-->"+res[4]);
  11535.                
  11536.                 $scope.isDisabled = true;
  11537.  
  11538.  
  11539.               var errorcode = res[4].substring(7,9);
  11540.  
  11541.               console.log("error codes-->"+errorcode);
  11542.  
  11543.               if(errorcode=="06" || errorcode=="18" || errorcode=="68" || errorcode=="99" || errorcode=="0028" || errorcode=="ER" || errorcode=="0005" )
  11544.  
  11545.               { // Reverse 1x
  11546.  
  11547.               console.log('masuk reverse 1');
  11548.  
  11549.               $http.post('http://dxplor.com/dxplor/Mo_pln_prepaid/pay_pln_prepaid_reverse13', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  11550.  
  11551.                           .success(function(data, status, headers,config){
  11552.  
  11553.                             $scope.isDisabled = false;
  11554.  
  11555.                           console.log("data-->"+data);
  11556.  
  11557.                           var res = data.split(";");
  11558.                          if(res[0]=="$2")
  11559.  
  11560.                          { //success reverse 1
  11561.  
  11562.                         console.log("paybill pln ok");
  11563.  
  11564.                         $localStorage.plnprepaidrefid=data;
  11565.  
  11566.                                 var alertPopup = $ionicPopup.alert({
  11567.  
  11568.                                        title: 'Info',
  11569.  
  11570.                                        template: 'Pembelian Token Sukses, silahkan catat nomor STROOM / TOKEN'
  11571.  
  11572.                                      });
  11573.  
  11574.                                    $state.go('snd.plnprepaid_summary');
  11575.  
  11576.  
  11577.                          }
  11578.  
  11579.                          else
  11580.  
  11581.                          { //gagal reverse 1
  11582.  
  11583.                             $scope.isDisabled = true;
  11584.  
  11585.                          console.log("paybill error reverse1 data-->"+data);
  11586.  
  11587.                          console.log("paybills error reverse1-->"+res[4]);
  11588.                          
  11589.                        var errorcoderev1 = res[4].substring(7,9);
  11590.  
  11591.                        console.log("error codes rev1-->"+errorcoderev1);                  
  11592.  
  11593.                       if(errorcode=="06" || errorcode=="18" || errorcode=="68" || errorcode=="99" || errorcode=="0028" || errorcode=="ER" || errorcode=="0005" )
  11594.  
  11595.                   { // Reverse 1x
  11596.                  
  11597.                   console.log('masuk reverse repeat1 1');
  11598.                  
  11599.                   $http.post('http://dxplor.com/dxplor/Mo_pln_prepaid/pay_pln_prepaid_reverse_repeat1', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  11600.  
  11601.                               .success(function(data, status, headers,config){
  11602.                                  
  11603.                               $scope.isDisabled = false;
  11604.  
  11605.                               console.log("data-->"+data);
  11606.                              
  11607.                               var res = data.split(";");
  11608.                                
  11609.                                   if(res[0]=="$2")
  11610.  
  11611.                              { //success reverse repeat 1
  11612.  
  11613.                             console.log("paybill pln reverse repeat1 ok");
  11614.  
  11615.                             $localStorage.plnprepaidrefid=data;
  11616.  
  11617.                                     var alertPopup = $ionicPopup.alert({
  11618.  
  11619.                                            title: 'Info',
  11620.  
  11621.                                            template: 'Pembelian Token Sukses, silahkan catat nomor STROOM / TOKEN'
  11622.  
  11623.                                          });
  11624.  
  11625.                                        $state.go('snd.plnprepaid_summary');
  11626.                              }
  11627.  
  11628.                              else
  11629.  
  11630.                              { //gagal reverse repeat 1
  11631.  
  11632.                                 $scope.isDisabled = true;
  11633.  
  11634.  
  11635.                              console.log("paybills error reverse repeat 11 data-->"+data);
  11636.  
  11637.                              console.log("paybills error reverse repeat 1-->"+res[4]);
  11638.  
  11639.                           var errorcoderev1 = res[4].substring(7,9);
  11640.  
  11641.                           console.log("error codes rev repeat 11-->"+errorcoderev1);
  11642.  
  11643.                           ////start reverse repeat
  11644.  
  11645.                           if(errorcoderev1=="06" || errorcoderev1=="18" || errorcoderev1=="68" || errorcoderev1=="99" || errorcoderev1=="0028" || errorcoderev1=="ER" || errorcoderev1=="0005" )
  11646.  
  11647.                       { // Reverserepeeat 1x
  11648.  
  11649.                       console.log('masuk reverse  repeat 2');
  11650.  
  11651.                       $http.post('http://dxplor.com/dxplor/Mo_pln_prepaid/pay_pln_prepaid_reverse_repeat2', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  11652.  
  11653.                                   .success(function(data, status, headers,config){
  11654.                            
  11655.                                   $scope.isDisabled = false;
  11656.  
  11657.                                   console.log("data reverse repeat repeat2-->"+data);
  11658.  
  11659.                                   var res = data.split(";");
  11660.  
  11661.                                       if(res[0]=="$2")
  11662.  
  11663.                                  { //success reverse 1
  11664.  
  11665.                                 console.log("paybill pln reverse repeat2 ok");
  11666.  
  11667.                                 $localStorage.plnprepaidrefid=data;
  11668.  
  11669.                                 var alertPopup = $ionicPopup.alert({
  11670.  
  11671.                                                title: 'Info',
  11672.  
  11673.                                                template: 'Pembelian Token Sukses, silahkan catat nomor STROOM / TOKEN'
  11674.  
  11675.                                              });
  11676.  
  11677.                                            $state.go('snd.plnprepaid_summary');                  
  11678.  
  11679.                                  }
  11680.  
  11681.                                  else
  11682.  
  11683.                                  { //gagal reverse repeat 2
  11684.                                
  11685.                                     $scope.isDisabled = true;
  11686.  
  11687.                                  console.log("paybill error reverse repeat 2 data-->"+data);
  11688.                                  console.log("paybill error reverse repeat 2-->"+res[4]);                                
  11689.  
  11690.                                var errorcoderevrepeat1 = res[4].substring(7,9);
  11691.  
  11692.                               console.log("error codes rev repeeat2-->"+errorcoderevrepeat1);
  11693.  
  11694.                               if(errorcoderevrepeat1=="06" || errorcoderevrepeat1=="18" || errorcoderevrepeat1=="68" || errorcoderevrepeat1=="99" || errorcoderevrepeat1=="0028" || errorcoderevrepeat1=="ER" || errorcoderevrepeat1=="0005" )
  11695.  
  11696.                           { // Reverse repeat 2x
  11697.  
  11698.                           console.log('masuk reverse  2 trakhir');
  11699.  
  11700.                           $http.post('http://dxplor.com/dxplor/Mo_pln_prepaid/pay_pln_prepaid_reverse2', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  11701.  
  11702.                                       .success(function(data, status, headers,config){
  11703.  
  11704.                                       $scope.isDisabled = false;
  11705.                                       console.log("data-->"+data);
  11706.                                       var res = data.split(";");
  11707.                                       if(res[0]=="$2")
  11708.  
  11709.                                      { //success reverse  2
  11710.                                     console.log("paybill pln rev 2 ok");
  11711.  
  11712.                                     $localStorage.plnprepaidrefid=data;
  11713.  
  11714.                                     var alertPopup = $ionicPopup.alert({
  11715.  
  11716.                                                    title: 'Info',
  11717.  
  11718.                                                    template: 'Pembelian Token Sukses, silahkan catat nomor STROOM / TOKEN'
  11719.  
  11720.                                                  });
  11721.  
  11722.                                                $state.go('snd.plnprepaid_summary');
  11723.  
  11724.                                      }
  11725.  
  11726.                                      else
  11727.  
  11728.                                      { //gagal reverse  2
  11729.                                         $scope.isDisabled = true;
  11730.  
  11731.                                      console.log("paybill error reverse repeat 21 data-->"+data);
  11732.                                      console.log("paybill error reverse repeat 21-->"+res[4]);
  11733.  
  11734.                                      
  11735.  
  11736.                                    var alertPopup = $ionicPopup.alert({
  11737.  
  11738.                                                 title: 'Info',
  11739.  
  11740.                                                 template: 'Request error, Please try again in a few minutes'
  11741.  
  11742.                                               });
  11743.                                      }
  11744.  
  11745.                                       })
  11746.  
  11747.                           .error(function(data, status, headers,config){
  11748.  
  11749.                           console.log('data error reverse repeat 2x');
  11750.  
  11751.                           $scope.isDisabled = false;
  11752.  
  11753.                           })
  11754.                          
  11755.                           //end if reverse 1x
  11756.  
  11757.                               }                          
  11758.  
  11759.                           else
  11760.                          
  11761.                           {//else kalo gagal reverse 1 dan ga masuk if
  11762.  
  11763.                             var alertPopup = $ionicPopup.alert({
  11764.  
  11765.                                         title: 'Info',
  11766.  
  11767.                                         template: 'Request error, Please try again in a few minutes'
  11768.  
  11769.                                       });
  11770.  
  11771. //                              $state.go('snd.home');
  11772.  
  11773.                           }
  11774.  
  11775.                                  }
  11776.  
  11777.                                   })
  11778.  
  11779.                       .error(function(data, status, headers,config){
  11780.  
  11781.                       console.log('data error reverse 1x');
  11782.  
  11783.                       $scope.isDisabled = false;
  11784.                     })
  11785.  
  11786.                       //end if reverse 1x
  11787.  
  11788.                           }
  11789.  
  11790.                       else
  11791.                       {//else kalo gagal reverse 1 dan ga masuk if
  11792.                         var alertPopup = $ionicPopup.alert({
  11793.  
  11794.                                     title: 'Info',
  11795.  
  11796.                                     template: 'Request error, Please try again in a few minutes'
  11797.  
  11798.                                   });
  11799.  
  11800. //                          $state.go('snd.home');
  11801.                       }
  11802.                           //////////end reverse repeat
  11803.  
  11804.                              }
  11805.  
  11806.                              var res = data.split(";");
  11807.  
  11808.                               })
  11809.                          
  11810.  
  11811.                   .error(function(data, status, headers,config){
  11812.  
  11813.                   console.log('data error reverse 1x');
  11814.  
  11815.                   $scope.isDisabled = false;          
  11816.  
  11817.                   })
  11818.  
  11819.                   //end if reverse 1x
  11820.  
  11821.                       }
  11822.  
  11823.                       else
  11824.                          
  11825.                   {//else kalo gagal reverse 1 dan ga masuk if
  11826.  
  11827.                     var alertPopup = $ionicPopup.alert({
  11828.  
  11829.                                 title: 'Info',
  11830.  
  11831.                                 template: 'Request error, Please try again in a few minutes'
  11832.  
  11833.                               });
  11834.  
  11835. //                      $state.go('snd.home');
  11836.  
  11837.                   }
  11838.                        }                      
  11839.  
  11840.                           })
  11841.  
  11842.               .error(function(data, status, headers,config){
  11843.  
  11844.               console.log('data error reverse 1x');
  11845.  
  11846.               $scope.isDisabled = false;
  11847.  
  11848.               })
  11849.  
  11850.               //end if reverse 1x
  11851.  
  11852.                   }
  11853.  
  11854.               else
  11855.                  
  11856.               {//else kalo gagal reverse 1 dan ga masuk if
  11857.  
  11858.                 var alertPopup = $ionicPopup.alert({
  11859.  
  11860.                             title: 'Info',
  11861.  
  11862.                             template: 'Request error, Please try again in a few minutes'
  11863.  
  11864.                           });
  11865.  
  11866. //                  $state.go('snd.home');
  11867.  
  11868.               }
  11869.  
  11870.                 }
  11871.  
  11872.                 })
  11873.  
  11874.           }
  11875.  
  11876.            })
  11877.  
  11878.            .error(function(data, status, headers,config){
  11879.  
  11880.              console.log('data error');
  11881.  
  11882.              $scope.isDisabled = false;
  11883.  
  11884.            })
  11885.  
  11886.            .then(function(result){
  11887.  
  11888.              things = result.data;
  11889.  
  11890.            });
  11891.  
  11892.        }
  11893.  
  11894. }
  11895.  
  11896. //end scope click
  11897.  
  11898. })
  11899.  
  11900.  
  11901.  
  11902.  
  11903.  
  11904. .controller('PLN_prepaidsummaryController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  11905.  
  11906. console.log("di PLN Prepaid summary-->"+$localStorage.plnprepaidrefid);
  11907.  
  11908.  
  11909. //$2;14234567891!551111111111;TESTING PRE""PAID 7891;R1  /2200 VA;DA0CDFC18FD4319C260F1B90BA8F6C4E;
  11910. //3052 2016 5530 2028 5348;20000;1600;2184.62;1456.41;3094.87;2708.01;8956.09;870,50;1600;20000;123            ;
  11911. //Informasi Hubungi Call Center 123 Atau hubungi PLN Terdekat ;INV20161030205348;REF;-;*
  11912.  
  11913.   var res = $localStorage.plnprepaidrefid.split(";");
  11914.  
  11915.   var res2 = res[1].split("!");
  11916.  
  11917.   $scope.idpelanggan=res2[1];
  11918.  
  11919.   $scope.nometer=res2[0];
  11920.  
  11921.  
  11922.   $scope.namapelanggan=res[2];
  11923.  
  11924.   $scope.daya=res[3];
  11925.  
  11926.   $scope.harga=res[15];
  11927.  
  11928.   $scope.noref=res[4];
  11929.  
  11930.   $scope.adminca=res[14];
  11931.  
  11932.   $scope.materai=res[8];
  11933.  
  11934.   $scope.ppn=res[9];
  11935.  
  11936.   $scope.ppj=res[10];
  11937.  
  11938.   $scope.angsuran=res[11];
  11939.  
  11940.   $scope.rptoken=res[12];
  11941.  
  11942.   $scope.kwh=res[13];
  11943.  
  11944.   $scope.token=res[5];
  11945.  
  11946.  
  11947. })
  11948.  
  11949. // End PLN Prepaid Token
  11950.  
  11951. //PAM
  11952.  
  11953. .controller('PAMController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  11954.  
  11955.  
  11956.  
  11957. console.log("di PAM");
  11958.  
  11959.  
  11960. $scope.required = true;
  11961.  
  11962.  
  11963. $scope.check_bill_pam = function(cust_id,location) {
  11964.  
  11965.  
  11966.  
  11967. $http.post('http://dxplor.com/dxplor/Mo_pam/check_bill_pam', {customer_id : cust_id, location : location })
  11968.  
  11969.  
  11970.  
  11971.     .success(function(data, status, headers,config){
  11972.  
  11973.       console.log('data success');
  11974.  
  11975.       console.log('data-->'+data); // for browser console
  11976.  
  11977.      
  11978.  
  11979.       if(data=="idempty")
  11980.  
  11981.       {
  11982.  
  11983.      
  11984.  
  11985.       var alertPopup = $ionicPopup.alert({
  11986.  
  11987.             title: 'Error',
  11988.  
  11989.             template: 'Customer ID is mandatory'
  11990.  
  11991.           });
  11992.  
  11993.          
  11994.  
  11995.       }
  11996.  
  11997.       else
  11998.  
  11999.       { // data not empty
  12000.  
  12001.          
  12002.  
  12003.       var res = data.split(";");
  12004.  
  12005.  
  12006.  
  12007.       //console.log(res[0]);
  12008.  
  12009.  
  12010.  
  12011.        
  12012.  
  12013.         if(res[0]=="$C")
  12014.  
  12015.         {
  12016.  
  12017.         var alertPopup = $ionicPopup.alert({
  12018.  
  12019.                 title: 'Error',
  12020.  
  12021.                 template: res[4]
  12022.  
  12023.               });
  12024.  
  12025.          
  12026.  
  12027.             $state.go($state.current, {}, {reload: true});
  12028.  
  12029.  
  12030.  
  12031.         }
  12032.  
  12033.        
  12034.  
  12035.         if(res[0]=="$D")
  12036.  
  12037.     {
  12038.  
  12039.          
  12040.  
  12041.         $localStorage.pam_confirm=data;
  12042.  
  12043.         $state.go('snd.pam_confirm');
  12044.  
  12045.  
  12046.  
  12047.     }
  12048.  
  12049.        
  12050.  
  12051.        
  12052.  
  12053.       }
  12054.  
  12055.    
  12056.  
  12057.      
  12058.  
  12059.  
  12060.     })
  12061.  
  12062.     .error(function(data, status, headers,config){
  12063.  
  12064.       console.log('data error');
  12065.  
  12066.      
  12067.  
  12068.  
  12069.  
  12070.     })
  12071.  
  12072.     .then(function(result){
  12073.  
  12074.       things = result.data;
  12075.  
  12076.     });
  12077.  
  12078.  
  12079. }
  12080.  
  12081. })
  12082.  
  12083.  
  12084.  
  12085. .controller('PAM_confirmController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  12086.  
  12087.  
  12088.  
  12089. console.log("di PAM Confirm-->"+$localStorage.pam_confirm);
  12090.  
  12091.  
  12092. //$D;3;PLN;Nama :;DUM""MY IPN-01;Id Pelanggan :;211111125251;
  12093.  
  12094. //Tagihan Rp :;192048;ADM Rp :;1600;Total :;193648;
  12095.  
  12096. //Nomor Invoice :;INV20160821131714;Tarif/Daya :;  R1/900 VA;BL/TH :;0314;
  12097.  
  12098. //Stand Meter :;02681700-02782500;Rp Subsidi :;0;
  12099.  
  12100. //Total Lembar Tagihan : 1 Bulan;201403#192048#1600; ;Tekan :;[OK] Untuk Bayar;[BACK] Kembali;*
  12101.  
  12102.  
  12103.  
  12104.   var res = $localStorage.pam_confirm.split(";");
  12105.  
  12106.  
  12107.  
  12108.   $scope.idpelanggan=res[6];
  12109.  
  12110.   $scope.namapelanggan=res[4];
  12111.  
  12112.   $scope.totalamount=res[12];
  12113.  
  12114.   $scope.noinvoice=res[14];
  12115.  
  12116.  
  12117.   $http.get('http://dxplor.com/dxplor/Mo_pam/get_cashback')
  12118.  
  12119.  
  12120.   // $http({method: "get", url: "https://www.googleapis.com/plus/v1/people/me", data: "access_token=" + accessToken})
  12121.    .success(function(data) {
  12122.  
  12123.         $scope.cashback=data;
  12124.         console.log("get cashback data PAM-->"+$scope.cashback);
  12125.        
  12126.  
  12127.         var rescashback=$scope.cashback.split(";");
  12128.         $localStorage.pam_admin=rescashback[0];
  12129.         $localStorage.pam_cashback=rescashback[1];
  12130.  
  12131.  
  12132.  
  12133.           $scope.totalamountasli=res[12];
  12134.           console.log("total amount asli-->"+$scope.totalamountasli);
  12135.           $scope.totalamount=parseInt(res[8])+parseInt($localStorage.pam_admin);
  12136.           console.log("total amount dxplor-->"+$scope.totalamount);
  12137.  
  12138.        
  12139.    })
  12140.    .error(function(data, status) {
  12141.        console.log("ERROR: " + data);
  12142.  
  12143.    });
  12144.  
  12145.  
  12146.  
  12147.   //Scope clikck
  12148.  
  12149. $scope.confirm_pay_pam = function() {
  12150.  
  12151.  
  12152.  
  12153.   $scope.login=true;
  12154.  
  12155.        if($localStorage.email==null)
  12156.  
  12157.    {
  12158.  
  12159.    console.log("belum login");
  12160.  
  12161.        
  12162.  
  12163.        var alertPopup = $ionicPopup.alert({
  12164.  
  12165.            title: 'Info',
  12166.  
  12167.            template: 'Please Login first to Pay PAM'
  12168.  
  12169.          });
  12170.  
  12171.    
  12172.  
  12173.        $state.go('snd.login');
  12174.  
  12175.        $scope.login=false;
  12176.  
  12177.    }
  12178.  
  12179.        
  12180.  
  12181.  
  12182.  
  12183.        if($scope.login==false){
  12184.  
  12185.        
  12186.  
  12187.        
  12188.  
  12189.        }
  12190.  
  12191.        else
  12192.  
  12193.        {
  12194.  
  12195.        
  12196.  
  12197.        $http.post('http://dxplor.com/dxplor/Mo_balance/get_balance/'+ $localStorage.customerid)
  12198.  
  12199.            
  12200.  
  12201.            
  12202.  
  12203.            .success(function(data, status, headers,config){
  12204.  
  12205.              console.log(data); // for browser console
  12206.  
  12207.              
  12208.  
  12209.              $scope.balance =  data;
  12210.  
  12211.              
  12212.  
  12213.              
  12214.  
  12215.              
  12216.  
  12217.  
  12218.  
  12219.             console.log("balance-->"+$scope.balance);
  12220.  
  12221.             console.log("total bill-->"+$scope.totalamount);
  12222.  
  12223.            
  12224.  
  12225.           if(parseInt($scope.balance) < parseInt($scope.totalamount))
  12226.  
  12227.               {
  12228.  
  12229.              
  12230.  
  12231.          
  12232.  
  12233.  
  12234.  
  12235.               var alertPopup = $ionicPopup.alert({
  12236.  
  12237.                   title: 'Info',
  12238.  
  12239.                   template: 'You dont have enough balance, please topup first'
  12240.  
  12241.                 });
  12242.  
  12243.               $state.go($state.current, {}, {reload: true});
  12244.  
  12245.               console.log("didnt have enough balance");
  12246.  
  12247.  
  12248.  
  12249.               }
  12250.  
  12251.              
  12252.  
  12253.           else
  12254.  
  12255.           {
  12256.  
  12257.                   console.log("have enough balance to pay pam");
  12258.  
  12259.              
  12260.  
  12261. //disable button
  12262.  
  12263.                       $scope.isDisabled = true;
  12264.  
  12265.                  
  12266.  
  12267.  
  12268.  
  12269.                   $http.post('http://dxplor.com/dxplor/Mo_pam/pay_pam', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  12270.  
  12271.                 .success(function(data, status, headers,config){
  12272.  
  12273.  
  12274.  
  12275.                 console.log("data-->"+data);
  12276.  
  12277.                  
  12278.  
  12279.               var res = data.split(";");
  12280.  
  12281.  
  12282.  
  12283.                   //console.log(res[0]);
  12284.  
  12285.  
  12286.  
  12287.                    
  12288.  
  12289.                     if(res[0]=="$9")
  12290.  
  12291.                 {
  12292.  
  12293.                  
  12294.  
  12295.                    
  12296.  
  12297.                 console.log("paybill pam ok");
  12298.  
  12299.                 $localStorage.pamrefid=data;
  12300.  
  12301.                  
  12302.  
  12303.                     var alertPopup = $ionicPopup.alert({
  12304.  
  12305.                               title: 'Info',
  12306.  
  12307.                               template: 'Payment success, please note the ref id!'
  12308.  
  12309.                             });
  12310.  
  12311.                           $state.go('snd.pam_summary');
  12312.  
  12313.                          
  12314.  
  12315.                  
  12316.  
  12317.                 }
  12318.  
  12319.              
  12320.  
  12321.                     else
  12322.  
  12323.           {
  12324.  
  12325.              
  12326.  
  12327.           console.log("paybill error data-->"+data);
  12328.  
  12329.  
  12330.  
  12331.           console.log("paybill error-->"+res[4]);
  12332.  
  12333.              
  12334.  
  12335.         var errorcode = res[4].substring(7,9);
  12336.  
  12337.         console.log("error codes-->"+errorcode);
  12338.  
  12339.        
  12340.  
  12341.         if(errorcode=="68" || errorcode=="18" || errorcode=="Q4" || errorcode=="77" || errorcode==$scope.noinvoice)
  12342.  
  12343.         { // Reverse 1x
  12344.  
  12345.        
  12346.  
  12347.         console.log('masuk reverse 1');
  12348.  
  12349.        
  12350.  
  12351.         $http.post('http://dxplor.com/dxplor/Mo_pam/pay_pam_reverse1', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  12352.  
  12353.                     .success(function(data, status, headers,config){
  12354.  
  12355.                      
  12356.  
  12357.                     $scope.isDisabled = false;
  12358.  
  12359.  
  12360.  
  12361.                     console.log("data-->"+data);
  12362.  
  12363.                      
  12364.  
  12365.                     var res = data.split(";");
  12366.  
  12367.                      
  12368.  
  12369.                       if(res[0]=="$1")
  12370.  
  12371.                    { //success reverse 1
  12372.  
  12373.                      
  12374.  
  12375.                        
  12376.  
  12377.                    console.log("paybill pam ok");
  12378.  
  12379.                     $localStorage.pamrefid=data;
  12380.  
  12381.                      
  12382.  
  12383.                         var alertPopup = $ionicPopup.alert({
  12384.  
  12385.                                  title: 'Info',
  12386.  
  12387.                                  template: 'Payment success, please note the ref id!'
  12388.  
  12389.                                });
  12390.  
  12391.                              $state.go('snd.pam_summary');
  12392.  
  12393.                            
  12394.  
  12395.                      
  12396.  
  12397.                    }
  12398.  
  12399.                    else
  12400.  
  12401.                    { //gagal reverse 1
  12402.  
  12403.                      
  12404.  
  12405.                    console.log("paybill error reverse1 data-->"+data);
  12406.  
  12407.  
  12408.  
  12409.                    console.log("paybills error reverse1-->"+res[4]);
  12410.  
  12411.                      
  12412.  
  12413.                  var errorcoderev1 = res[4].substring(7,9);
  12414.  
  12415.                 console.log("error codes rev1-->"+errorcoderev1);
  12416.  
  12417.                
  12418.  
  12419.                 if(errorcode=="68" || errorcode=="18" || errorcode=="Q4" || errorcode=="77" || errorcode==$scope.noinvoice)
  12420.  
  12421.             { // Reverse 1x
  12422.  
  12423.            
  12424.  
  12425.             console.log('masuk reverse repeat1 1');
  12426.  
  12427.            
  12428.  
  12429.             $http.post('http://dxplor.com/dxplor/Mo_pam/pay_pam_reverse_repeat1', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  12430.  
  12431.                         .success(function(data, status, headers,config){
  12432.  
  12433.                          
  12434.  
  12435.                         $scope.isDisabled = false;
  12436.  
  12437.  
  12438.  
  12439.                         console.log("data-->"+data);
  12440.  
  12441.                          
  12442.  
  12443.                         var res = data.split(";");
  12444.  
  12445.                          
  12446.  
  12447.                           if(res[0]=="$1")
  12448.  
  12449.                        { //success reverse repeat 1
  12450.  
  12451.                          
  12452.  
  12453.                            
  12454.  
  12455.                        console.log("paybill pam reverse repeat1 ok");
  12456.  
  12457.                         $localStorage.pamrefid=data;
  12458.  
  12459.                          
  12460.  
  12461.                             var alertPopup = $ionicPopup.alert({
  12462.  
  12463.                                      title: 'Info',
  12464.  
  12465.                                      template: 'Payment success, please note the ref id!'
  12466.  
  12467.                                    });
  12468.  
  12469.                                  $state.go('snd.pam_summary');
  12470.  
  12471.                                
  12472.  
  12473.                          
  12474.  
  12475.                        }
  12476.  
  12477.                        else
  12478.  
  12479.                        { //gagal reverse repeat 1
  12480.  
  12481.                          
  12482.  
  12483.                        console.log("paybills error reverse repeat 11 data-->"+data);
  12484.  
  12485.  
  12486.  
  12487.                        console.log("paybills error reverse repeat 1-->"+res[4]);
  12488.  
  12489.                          
  12490.  
  12491.                      var errorcoderev1 = res[4].substring(7,9);
  12492.  
  12493.                     console.log("error codes rev repeat 11-->"+errorcoderev1);
  12494.  
  12495.                    
  12496.  
  12497.                     ////start reverse repeat
  12498.  
  12499.                    
  12500.  
  12501.                     if(errorcode=="68" || errorcode=="18" || errorcode=="Q4" || errorcode=="77" || errorcode==$scope.noinvoice)
  12502.  
  12503.                 { // Reverserepeeat 1x
  12504.  
  12505.                
  12506.  
  12507.                 console.log('masuk reverse  repeat 2');
  12508.  
  12509.                
  12510.  
  12511.                 $http.post('http://dxplor.com/dxplor/Mo_pam/pay_pam_reverse_repeat2', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  12512.  
  12513.                             .success(function(data, status, headers,config){
  12514.  
  12515.                              
  12516.  
  12517.                             $scope.isDisabled = false;
  12518.  
  12519.  
  12520.  
  12521.                             console.log("data reverse repeat repeat2-->"+data);
  12522.  
  12523.                              
  12524.  
  12525.                             var res = data.split(";");
  12526.  
  12527.                              
  12528.  
  12529.                               if(res[0]=="$1")
  12530.  
  12531.                            { //success reverse 1
  12532.  
  12533.                              
  12534.  
  12535.                                
  12536.  
  12537.                            console.log("paybill pam reverse repeat2 ok");
  12538.  
  12539.                             $localStorage.pamrefid=data;
  12540.  
  12541.                              
  12542.  
  12543.                                 var alertPopup = $ionicPopup.alert({
  12544.  
  12545.                                          title: 'Info',
  12546.  
  12547.                                          template: 'Payment success, please note the ref id!'
  12548.  
  12549.                                        });
  12550.  
  12551.                                      $state.go('snd.pam_summary');
  12552.  
  12553.                                    
  12554.  
  12555.                              
  12556.  
  12557.                            }
  12558.  
  12559.                            else
  12560.  
  12561.                            { //gagal reverse repeat 2
  12562.  
  12563.                              
  12564.  
  12565.                            console.log("paybill error reverse repeat 2 data-->"+data);
  12566.  
  12567.  
  12568.  
  12569.                            console.log("paybill error reverse repeat 2-->"+res[4]);
  12570.  
  12571.                              
  12572.  
  12573.                          var errorcoderevrepeat1 = res[4].substring(7,9);
  12574.  
  12575.                         console.log("error codes rev repeeat2-->"+errorcoderevrepeat1);
  12576.  
  12577.                        
  12578.  
  12579.                         if(errorcode=="68" || errorcode=="18" || errorcode=="Q4" || errorcode=="77" || errorcode==$scope.noinvoice)
  12580.  
  12581.                     { // Reverse repeat 2x
  12582.  
  12583.                    
  12584.  
  12585.                     console.log('masuk reverse  2 trakhir');
  12586.  
  12587.                    
  12588.  
  12589.                     $http.post('http://dxplor.com/dxplor/Mo_pam/pay_pam_reverse2', {invoice_no : $scope.noinvoice,memberid :  $localStorage.customerid})
  12590.  
  12591.                                 .success(function(data, status, headers,config){
  12592.  
  12593.                                  
  12594.  
  12595.                                 $scope.isDisabled = false;
  12596.  
  12597.  
  12598.  
  12599.                                 console.log("data-->"+data);
  12600.  
  12601.                                  
  12602.  
  12603.                                 var res = data.split(";");
  12604.  
  12605.                                  
  12606.  
  12607.                                   if(res[0]=="$1")
  12608.  
  12609.                                { //success reverse  2
  12610.  
  12611.                                  
  12612.  
  12613.                                    
  12614.  
  12615.                                console.log("paybill pam rev 2 ok");
  12616.  
  12617.                                 $localStorage.pamrefid=data;
  12618.  
  12619.                                  
  12620.  
  12621.                                     var alertPopup = $ionicPopup.alert({
  12622.  
  12623.                                              title: 'Info',
  12624.  
  12625.                                              template: 'Payment success, please note the ref id!'
  12626.  
  12627.                                            });
  12628.  
  12629.                                          $state.go('snd.pam_summary');
  12630.  
  12631.                                        
  12632.  
  12633.                                  
  12634.  
  12635.                                }
  12636.  
  12637.                                else
  12638.  
  12639.                                { //gagal reverse  2
  12640.  
  12641.                                  
  12642.  
  12643.                                console.log("paybill error reverse repeat 21 data-->"+data);
  12644.  
  12645.  
  12646.  
  12647.                                console.log("paybill error reverse repeat 21-->"+res[4]);
  12648.  
  12649.                                  
  12650.  
  12651.                              var alertPopup = $ionicPopup.alert({
  12652.  
  12653.                                           title: 'Info',
  12654.  
  12655.                                           template: 'Request error, Please try again in a few minutes'
  12656.  
  12657.                                         });
  12658.  
  12659.                                }
  12660.  
  12661.                                  
  12662.  
  12663.                                 })
  12664.  
  12665.                                  
  12666.  
  12667.                                  
  12668.  
  12669.                     .error(function(data, status, headers,config){
  12670.  
  12671.                     console.log('data error reverse repeat 2x');
  12672.  
  12673.                     $scope.isDisabled = false;
  12674.  
  12675.                    
  12676.  
  12677.                
  12678.  
  12679.                     })
  12680.  
  12681.                    
  12682.  
  12683.                    
  12684.  
  12685.                     //end if reverse 1x
  12686.  
  12687.                         }
  12688.  
  12689.                    
  12690.  
  12691.                     else
  12692.  
  12693.                    
  12694.  
  12695.                     {//else kalo gagal reverse 1 dan ga masuk if
  12696.  
  12697.                          
  12698.  
  12699.                         var alertPopup = $ionicPopup.alert({
  12700.  
  12701.                                   title: 'Info',
  12702.  
  12703.                                   template: 'Request error, Please try again in a few minutes'
  12704.  
  12705.                                 });
  12706.  
  12707. //                      $state.go('snd.home');
  12708.  
  12709.  
  12710.  
  12711.                     }
  12712.  
  12713.                        
  12714.  
  12715.                            }
  12716.  
  12717.                              
  12718.  
  12719.                          
  12720.  
  12721.                             })
  12722.  
  12723.                              
  12724.  
  12725.                              
  12726.  
  12727.                 .error(function(data, status, headers,config){
  12728.  
  12729.                 console.log('data error reverse 1x');
  12730.  
  12731.                 $scope.isDisabled = false;
  12732.  
  12733.                
  12734.  
  12735.            
  12736.  
  12737.                 })
  12738.  
  12739.                
  12740.  
  12741.                
  12742.  
  12743.                 //end if reverse 1x
  12744.  
  12745.                     }
  12746.  
  12747.                
  12748.  
  12749.                 else
  12750.  
  12751.                
  12752.  
  12753.                 {//else kalo gagal reverse 1 dan ga masuk if
  12754.  
  12755.                      
  12756.  
  12757.                     var alertPopup = $ionicPopup.alert({
  12758.  
  12759.                               title: 'Info',
  12760.  
  12761.                               template: 'Request error, Please try again in a few minutes'
  12762.  
  12763.                             });
  12764.  
  12765. //                  $state.go('snd.home');
  12766.  
  12767.  
  12768.  
  12769.                 }
  12770.  
  12771.                  
  12772.  
  12773.                    
  12774.  
  12775.                    
  12776.  
  12777.                    
  12778.  
  12779.                     //////////end reverse repeat
  12780.  
  12781.                        }
  12782.  
  12783.                          
  12784.  
  12785.                       var res = data.split(";");
  12786.  
  12787.                         })
  12788.  
  12789.                          
  12790.  
  12791.                          
  12792.  
  12793.             .error(function(data, status, headers,config){
  12794.  
  12795.             console.log('data error reverse 1x');
  12796.  
  12797.             $scope.isDisabled = false;
  12798.  
  12799.            
  12800.  
  12801.        
  12802.  
  12803.             })
  12804.  
  12805.            
  12806.  
  12807.            
  12808.  
  12809.             //end if reverse 1x
  12810.  
  12811.                 }
  12812.  
  12813.            
  12814.  
  12815.             else
  12816.  
  12817.            
  12818.  
  12819.             {//else kalo gagal reverse 1 dan ga masuk if
  12820.  
  12821.                  
  12822.  
  12823.                 var alertPopup = $ionicPopup.alert({
  12824.  
  12825.                           title: 'Info',
  12826.  
  12827.                           template: 'Request error, Please try again in a few minutes'
  12828.  
  12829.                         });
  12830.  
  12831. //              $state.go('snd.home');
  12832.  
  12833.  
  12834.  
  12835.             }
  12836.  
  12837.                
  12838.  
  12839.                    }
  12840.  
  12841.                      
  12842.  
  12843.                  
  12844.  
  12845.                     })
  12846.  
  12847.                      
  12848.  
  12849.                      
  12850.  
  12851.         .error(function(data, status, headers,config){
  12852.  
  12853.         console.log('data error reverse 1x'+data);
  12854.  
  12855.         $scope.isDisabled = false;
  12856.  
  12857.        
  12858.  
  12859.             var alertPopup = $ionicPopup.alert({
  12860.  
  12861.                               title: 'Info',
  12862.  
  12863.                               template: 'Request error, Please try again in a few minutes'
  12864.  
  12865.                             });
  12866.  
  12867.    
  12868.  
  12869.         })
  12870.  
  12871.        
  12872.  
  12873.        
  12874.  
  12875.         //end if reverse 1x
  12876.  
  12877.             }
  12878.  
  12879.        
  12880.  
  12881.         else
  12882.  
  12883.        
  12884.  
  12885.         {//else kalo gagal reverse 1 dan ga masuk if
  12886.  
  12887.              
  12888.  
  12889.             var alertPopup = $ionicPopup.alert({
  12890.  
  12891.                       title: 'Info',
  12892.  
  12893.                       template: 'Request error, Please try again in a few minutes'
  12894.  
  12895.                     });
  12896.  
  12897. //          $state.go('snd.home');
  12898.  
  12899.  
  12900.  
  12901.         }
  12902.  
  12903.          
  12904.  
  12905.           }
  12906.  
  12907.                  
  12908.  
  12909.                 })
  12910.  
  12911.                  
  12912.  
  12913.                      
  12914.  
  12915.           }
  12916.  
  12917.              
  12918.  
  12919.      
  12920.  
  12921.            
  12922.  
  12923.            })
  12924.  
  12925.            .error(function(data, status, headers,config){
  12926.  
  12927.              console.log('data error');
  12928.  
  12929.              
  12930.  
  12931.          
  12932.  
  12933.            })
  12934.  
  12935.            .then(function(result){
  12936.  
  12937.              things = result.data;
  12938.  
  12939.            });
  12940.  
  12941.        
  12942.  
  12943.        
  12944.  
  12945.        
  12946.  
  12947.                
  12948.  
  12949.        }
  12950.  
  12951.  
  12952.  
  12953. }
  12954.  
  12955. //end scope click
  12956.  
  12957.  
  12958.  
  12959.  
  12960. })
  12961.  
  12962.  
  12963.  
  12964.  
  12965.  
  12966. .controller('PAM_summaryController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  12967.  
  12968.  
  12969.  
  12970. console.log("di PAM summary-->"+$localStorage.pamrefid);
  12971.  
  12972.  
  12973. //$D;3;PLN;Nama :;DUM""MY IPN-01;Id Pelanggan :;211111125251;
  12974.  
  12975. //Tagihan Rp :;192048;ADM Rp :;1600;Total :;193648;
  12976.  
  12977. //Nomor Invoice :;INV20160821131714;Tarif/Daya :;  R1/900 VA;BL/TH :;0314;
  12978.  
  12979. //Stand Meter :;02681700-02782500;Rp Subsidi :;0;
  12980.  
  12981. //Total Lembar Tagihan : 1 Bulan;201403#192048#1600; ;Tekan :;[OK] Untuk Bayar;[BACK] Kembali;*
  12982.  
  12983.  
  12984.  
  12985.   var res = $localStorage.pamrefid.split(";");
  12986.  
  12987.   console.log('data->'+$localStorage.pamrefid);
  12988.  
  12989.  
  12990.  
  12991.   $scope.idpelanggan=res[1];
  12992.  
  12993.   $scope.namapelanggan=res[2];
  12994.  
  12995.   $scope.tagihanbulan=res[5];
  12996.  
  12997.  
  12998.  
  12999.   console.log('asdasd->'+$scope.tagihanbulan);
  13000.  
  13001.   $scope.tgllunas = res[10].replace("%",":");
  13002.  
  13003.   $scope.tgllunas = $scope.tgllunas.replace("%",":");
  13004.  
  13005.  
  13006.  
  13007. // $scope.tgllunas=res[10];
  13008.  
  13009.   console.log('asdasd->'+$scope.tgllunas);
  13010.  
  13011.  
  13012.  
  13013.  
  13014.  
  13015.   $scope.totalamount=res[7];
  13016.  
  13017.   $scope.noinvoice=res[14];
  13018.  
  13019.  
  13020.  
  13021.   $scope.refid=res[6];
  13022.  
  13023.  
  13024.  
  13025.   $scope.hargaadmin=res[4];
  13026.  
  13027.   $scope.tagihan=res[3];
  13028.  
  13029.  
  13030.   $http.get('http://dxplor.com/dxplor/Mo_pam/get_cashback')
  13031.  
  13032.  
  13033.   // $http({method: "get", url: "https://www.googleapis.com/plus/v1/people/me", data: "access_token=" + accessToken})
  13034.    .success(function(data) {
  13035.  
  13036.         $scope.cashback=data;
  13037.         console.log("get cashback data PAM-->"+$scope.cashback);
  13038.        
  13039.  
  13040.         var rescashback=$scope.cashback.split(";");
  13041.         $localStorage.pam_admin=rescashback[0];
  13042.         $localStorage.pam_cashback=rescashback[1];
  13043.  
  13044.  
  13045.        
  13046.  
  13047.         $scope.hargaadmin=$localStorage.pam_admin;
  13048.        
  13049.         //$scope.totaltagihan=res[8];
  13050.  
  13051.           $scope.totalamountasli=res[7];
  13052.           console.log("total amount asli-->"+$scope.totalamountasli);
  13053.           $scope.totalamount=parseInt(res[3])+parseInt($localStorage.pam_admin);
  13054.           console.log("total amount dxplorss-->"+$scope.totalamount);
  13055.  
  13056.          
  13057.          
  13058.          
  13059.  
  13060.    })
  13061.    .error(function(data, status) {
  13062.        console.log("ERROR: " + data);
  13063.  
  13064.    });
  13065.  
  13066.  
  13067.       $scope.date = new Date();
  13068.  
  13069.       $scope.AssignedDate = Date;
  13070.  
  13071.  
  13072.  
  13073.  
  13074.  
  13075. })
  13076.  
  13077. .controller('ShoppingCartController',  function($scope, $ionicSideMenuDelegate,$http, ngCart) {
  13078.  
  13079.     ngCart.setTaxRate(7.5);
  13080.  
  13081.     ngCart.setShipping(2.99);    
  13082.  
  13083. })
  13084.  
  13085.  
  13086.  
  13087. .controller('SndLoginPageController', function($scope,$state, $ionicSideMenuDelegate,$http,$ionicPopup,$localStorage,$cordovaOauth) {
  13088.  
  13089.   $scope.data = {};
  13090.  
  13091.  
  13092.  
  13093.     $scope.login = function() {
  13094.  
  13095.        console.log("LOGIN new user: " + $scope.data.username + " - PW: " + $scope.data.password);
  13096.  
  13097.        
  13098.  
  13099.        
  13100.  
  13101.         $http.post('http://dxplor.com/dxplor/Mo_customer/login_new', {uname : $scope.data.username,password : $scope.data.password})
  13102.  
  13103.       .success(function(data, status, headers,config){
  13104.  
  13105.         console.log('data success');
  13106.  
  13107.         console.log(data); // for browser console
  13108.  
  13109.        
  13110.  
  13111.        
  13112.  
  13113.         var res = data.split(",");
  13114.  
  13115.  
  13116.  
  13117.         console.log(res[0]);
  13118.  
  13119.    
  13120.  
  13121.        
  13122.  
  13123.         if(res[0]=="ok")
  13124.  
  13125.         {
  13126.  
  13127.          
  13128.  
  13129.         var alertPopup = $ionicPopup.alert({
  13130.  
  13131.             title: 'Info',
  13132.  
  13133.             template: 'Login Success'
  13134.  
  13135.           });
  13136.  
  13137.        
  13138.  
  13139.        
  13140.  
  13141.        
  13142.  
  13143.     $localStorage.customerid = res[1];
  13144.  
  13145.     console.log("custid-->"+$localStorage.customerid);
  13146.  
  13147.    
  13148.  
  13149.     $localStorage.customername = res[2];
  13150.  
  13151.     console.log("custname-->"+$localStorage.customername);
  13152.  
  13153.  
  13154.  
  13155.  
  13156.  
  13157.     $localStorage.email = $scope.data.username;
  13158.  
  13159.  
  13160.  
  13161.        
  13162.  
  13163.         $state.go('snd.account');
  13164.  
  13165.         }
  13166.  
  13167.         else if(res[0]=="notok")
  13168.  
  13169.         {
  13170.  
  13171.         console.log("Login error");
  13172.  
  13173.         var alertPopup = $ionicPopup.alert({
  13174.  
  13175.             title: 'Info',
  13176.  
  13177.             template: 'Invalid Username / Password'
  13178.  
  13179.           });
  13180.  
  13181.         }
  13182.        
  13183.         else if(res[0]=="user not active")
  13184.  
  13185.         {
  13186.  
  13187.         console.log("Login error");
  13188.  
  13189.         var alertPopup = $ionicPopup.alert({
  13190.  
  13191.             title: 'Info',
  13192.  
  13193.             template: 'User is Not Active, please activate first'
  13194.  
  13195.           });
  13196.  
  13197.         }
  13198.  
  13199.  
  13200.  
  13201.       })
  13202.  
  13203.       .error(function(data, status, headers,config){
  13204.  
  13205.         console.log('data error');
  13206.  
  13207.       })
  13208.  
  13209.       .then(function(result){
  13210.  
  13211.         things = result.data;
  13212.  
  13213.       });
  13214.  
  13215.    
  13216.  
  13217.    
  13218.  
  13219.    
  13220.  
  13221.     }
  13222.  
  13223.  
  13224.     $scope.datates="asdada";
  13225.  
  13226.     $scope.googleauth = function() {
  13227.         $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
  13228.  
  13229. console.log('di googleauth');
  13230.         var requestToken = "";
  13231.         var accessToken = "";
  13232.         //var clientId = "484353778777-0mbklbbdtcmkds5a55bovnht3tfhsokb.apps.googleusercontent.com";
  13233.         //var clientSecret = "DjDDKcTeIWhJLoLilkmlMBPh";
  13234.         var clientId = "228202475750-485lpunkfcc727uuth3e9midm25qfoln.apps.googleusercontent.com";
  13235.         var clientSecret = "iTH2t9BlpcTTAR64C3Ua3s-5";
  13236.  
  13237.          var ref = window.open('https://accounts.google.com/o/oauth2/auth?client_id=' + clientId + '&redirect_uri=http://localhost/callback&scope=email&approval_prompt=force&response_type=code&access_type=offline', '_blank', 'location=no');
  13238.          ref.addEventListener('loadstart', function(event) {
  13239.              if((event.url).startsWith("http://localhost/callback")) {
  13240.                  requestToken = (event.url).split("code=")[1];
  13241.                 console.log("requestToken-->"+requestToken);
  13242.  
  13243.                
  13244.                 $http({method: "post", url: "https://accounts.google.com/o/oauth2/token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=http://localhost/callback" + "&grant_type=authorization_code" + "&code=" + requestToken })
  13245.                      .success(function(data) {
  13246.                          accessToken = data.access_token;
  13247.                             console.log("ACCESSTOKEN-->"+accessToken);
  13248.                             $scope.datates=accessToken;
  13249.                            
  13250.                             $http.get('https://www.googleapis.com/plus/v1/people/me?access_token='+accessToken)
  13251.  
  13252.                             .success(function(data, status, headers,config){
  13253.  
  13254.                               console.log('data success');
  13255.  
  13256.                               console.log(data); // for browser console
  13257.                                        //.success(function(data) {
  13258.                                      
  13259.                                             $scope.datates=data;
  13260.                                             console.log("data-->"+data);
  13261.                                              /*var param = {
  13262.                                                        provider: 'google',
  13263.                                                          google: {
  13264.                                                                        uid: data["id"],
  13265.                                                                        provider: 'google',
  13266.                                                                        first_name: data["name"]["givenName"],
  13267.                                                                        last_name: data["name"]["familyName"],
  13268.                                                                        email: data.emails[0]["value"],
  13269.                                                                        image: data.image.url
  13270.                                                                    }
  13271.                                                        };
  13272.                                                        console.log(param);
  13273.                                                        */
  13274.                                            
  13275.                                             console.log("fname-->"+data["name"]["givenName"]);
  13276.                                             console.log("lastname-->"+data["name"]["familyName"]);
  13277.                                             console.log("email-->"+data.emails[0]["value"]);
  13278.                                            
  13279.                                             var name=data["name"]["givenName"]+' '+data["name"]["familyName"];
  13280.                                             var email=data.emails[0]["value"];
  13281.                                             //Check email exist
  13282.                                             $http.post('http://dxplor.com/dxplor/Mo_customer/checkemailexist', {email : data.emails[0]["value"]})
  13283.                                             .success(function(data, status, headers,config){
  13284.                                               console.log('data success');
  13285.                                               console.log(data); // for browser console
  13286.                                              if(data!="notexist")
  13287.                                                  {
  13288.                                                  
  13289.  
  13290.                                                     var res = data.split(";");
  13291.                                                     $localStorage.customerid = res[0];
  13292.                                                     console.log("custid-->"+$localStorage.customerid);  
  13293.                                                     $localStorage.customername = res[1];
  13294.                                                     console.log("custname-->"+$localStorage.customername);
  13295.                                                     $localStorage.email =  res[2];
  13296.                                                     console.log("custemail-->"+$localStorage.email);
  13297.                                                     $state.go('snd.account');
  13298.  
  13299.                                                  
  13300.                                                  }
  13301.                                              else
  13302.                                                  {
  13303.                                                  // Signup Google
  13304.                                                  
  13305.                                                  console.log("Signup Google");
  13306.                                                  $localStorage.email=email;
  13307.                                                  console.log("Signup Google Email"+$localStorage.email);
  13308.  
  13309.                                                  $http.post('http://dxplor.com/dxplor/index.php/Mo_customer/register_social', {fname : name,email : email})
  13310.  
  13311.                                                  .success(function(data, status, headers,config){
  13312.  
  13313.                                                    console.log('data success register_social');
  13314.  
  13315.                                                    console.log(data); // for browser console
  13316.  
  13317.                                                    if(data=="ok")
  13318.  
  13319.                                                    {
  13320.                                                  var alertPopup = $ionicPopup.alert({
  13321.  
  13322.                                                        title: 'Info',
  13323.  
  13324.                                                        template: 'Sign Up Success'
  13325.  
  13326.                                                      });
  13327.  
  13328.                                                $localStorage.email =email;
  13329.  
  13330.                                              //  $http.post('http://dxplor.com/dxplor/Mo_balance/confirm_topup', {customerid : $localStorage.customerid,tobank : tobank,amount : amount,todate : todate,fromname : fromname,fromno : fromno,frombank : frombank})
  13331.  
  13332.                                                $http.post('http://dxplor.com/dxplor/Mo_customer/getcustomerid', {email : email})
  13333.  
  13334.                                              .success(function(data, status, headers,config){
  13335.  
  13336.                                                console.log('data success');
  13337.  
  13338.                                                console.log(data); // for browser console
  13339.  
  13340.                                                $localStorage.customerid = data;
  13341.  
  13342.                                                console.log('sessionid-->'+$localStorage.customerid)
  13343.                                                
  13344.                                                $http.post('http://dxplor.com/dxplor/Mo_customer/getcustomername', {email : email})
  13345.  
  13346.                                                .success(function(data, status, headers,config){
  13347.  
  13348.                                                  console.log('data success');
  13349.  
  13350.                                                  console.log(data); // for browser console
  13351.  
  13352.                                                  $localStorage.customername = data;
  13353.  
  13354.                                                  console.log('customername-->'+$localStorage.customername)
  13355.                                                  $state.go('snd.account');
  13356.  
  13357.                                                })
  13358.  
  13359.                                                .error(function(data, status, headers,config){
  13360.  
  13361.                                                  console.log('data error');
  13362.  
  13363.                                                })
  13364.  
  13365.                                                .then(function(result){
  13366.  
  13367.                                                  things = result.data;
  13368.  
  13369.                                                });
  13370.                                                  
  13371.  
  13372.                                              })
  13373.  
  13374.                                              .error(function(data, status, headers,config){
  13375.  
  13376.                                                console.log('data error');
  13377.  
  13378.                                              })
  13379.  
  13380.                                              .then(function(result){
  13381.  
  13382.                                                things = result.data;
  13383.  
  13384.                                              });
  13385.  
  13386.                                                ///////////
  13387.                                              
  13388.                                                  
  13389.                                                  // END Signup Facebook
  13390.                                                    }
  13391.                                                  })
  13392.                                                  
  13393.  
  13394.                                                  .error(function(data, status, headers,config){
  13395.  
  13396.                                                    console.log('data error');
  13397.  
  13398.                                                  })
  13399.  
  13400.                                                  .then(function(result){
  13401.  
  13402.                                                    things = result.data;
  13403.  
  13404.                                                  });
  13405.                                                  }
  13406.  
  13407.                                              
  13408.                                             })
  13409.                                             .error(function(data, status, headers,config){
  13410.                                             console.log('data error');
  13411.                                             })
  13412.                                             .then(function(result){
  13413.                                               things = result.data;
  13414.                                             });
  13415.  
  13416.                                             ref.close();
  13417.                                        })
  13418.                                        .error(function(data, status) {
  13419.                                            console.log("ERROR: " + data);
  13420.                                             $scope.datates="eeee";
  13421.                                              ref.close();
  13422.                                        });
  13423.                                        
  13424.                      })
  13425.                      .error(function(data, status) {
  13426.                          console.log("ERROR: " + data);
  13427.                         $scope.datates="ccc";
  13428.                         ref.close();
  13429.                      });
  13430.                
  13431.                  
  13432.                //  $http.get('https://www.googleapis.com/plus/v1/people/me?access_token=ya29.Ci9eA7uJ9pVM61aB_oz85FvL6xtai2PkUlpklpFSXfsD6AOe7R5wRyjtAcWLXxz0Ug')
  13433.  
  13434.                  
  13435.                 // $http({method: "get", url: "https://www.googleapis.com/plus/v1/people/me", data: "access_token=" + accessToken})
  13436.               //  accessToken= "ya29.Ci-wAzSnDI0hY3iwmXpiFXIxoPsrvhzborCZRfLlvgtqt0jPrCZ0VUbRKDQ_2knaLw";
  13437.        
  13438.              
  13439.              }
  13440.        
  13441.         });
  13442.        
  13443.        
  13444.        
  13445.     }
  13446.    
  13447.    
  13448.     //Facebook Auth
  13449.    
  13450.     $scope.facebookauth = function() {
  13451.  
  13452. console.log('di facebookauth');
  13453.        
  13454.              
  13455.        
  13456. $cordovaOauth.facebook("1079162598831487", ["email", "user_website", "user_location", "user_relationships"]).then(function(result) {
  13457.     $localStorage.accessToken = result.access_token;
  13458.     console.log("accesstoken-->"+$localStorage.accessToken);
  13459.  
  13460.     console.log("accesstoken2-->"+$localStorage.accessToken);
  13461.  
  13462.     console.log("cek accesstoken4")
  13463.  
  13464.     if($localStorage.accessToken) {
  13465.         $http.get("https://graph.facebook.com/v2.2/me", { params: { access_token: $localStorage.accessToken, fields: "id,name,gender,email", format: "json" }}).then(function(result) {
  13466.             $scope.profileData = result.data;
  13467.             console.log("ProfileData-->"+$scope.profileData);
  13468.             console.log("name-->"+$scope.profileData.name);
  13469.             console.log("name2-->"+$scope.profileData['name']);
  13470.             console.log("email-->"+$scope.profileData.email);
  13471.            
  13472.             //Check email exist
  13473.             $http.post('http://dxplor.com/dxplor/Mo_customer/checkemailexist', {email : $scope.profileData.email})
  13474.             .success(function(data, status, headers,config){
  13475.               console.log('data success');
  13476.               console.log(data); // for browser console
  13477.              if(data!="notexist")
  13478.                  {
  13479.                  
  13480.  
  13481.                     var res = data.split(";");
  13482.                     $localStorage.customerid = res[0];
  13483.                     console.log("custid-->"+$localStorage.customerid);  
  13484.                     $localStorage.customername = res[1];
  13485.                     console.log("custname-->"+$localStorage.customername);
  13486.                     $localStorage.email =  res[2];
  13487.                     console.log("custemail-->"+$localStorage.email);
  13488.                     $state.go('snd.account');
  13489.  
  13490.                  
  13491.                  }
  13492.              else
  13493.                  {
  13494.                  // Signup Facebook
  13495.                  
  13496.                  $localStorage.email=$scope.profileData.email;
  13497.                  $http.post('http://dxplor.com/dxplor/index.php/Mo_customer/register_social', {fname : $scope.profileData.name,email : $scope.profileData.email})
  13498.  
  13499.                  .success(function(data, status, headers,config){
  13500.  
  13501.                    console.log('data success');
  13502.  
  13503.                    console.log(data); // for browser console
  13504.  
  13505.                    if(data=="ok")
  13506.  
  13507.                    {
  13508.                  var alertPopup = $ionicPopup.alert({
  13509.  
  13510.                        title: 'Info',
  13511.  
  13512.                        template: 'Sign Up Success'
  13513.  
  13514.                      });
  13515.  
  13516.                $localStorage.email =$scope.profileData.email;
  13517.  
  13518.              //  $http.post('http://dxplor.com/dxplor/Mo_balance/confirm_topup', {customerid : $localStorage.customerid,tobank : tobank,amount : amount,todate : todate,fromname : fromname,fromno : fromno,frombank : frombank})
  13519.  
  13520.                $http.post('http://dxplor.com/dxplor/Mo_customer/getcustomerid', {email : $scope.profileData.email})
  13521.  
  13522.              .success(function(data, status, headers,config){
  13523.  
  13524.                console.log('data success');
  13525.  
  13526.                console.log(data); // for browser console
  13527.  
  13528.                $localStorage.customerid = data;
  13529.  
  13530.                console.log('sessionid-->'+$localStorage.customerid)
  13531.                
  13532.                $http.post('http://dxplor.com/dxplor/Mo_customer/getcustomername', {email : $scope.profileData.email})
  13533.  
  13534.                .success(function(data, status, headers,config){
  13535.  
  13536.                  console.log('data success');
  13537.  
  13538.                  console.log(data); // for browser console
  13539.  
  13540.                  $localStorage.customername = data;
  13541.  
  13542.                  console.log('customername-->'+$localStorage.customername)
  13543.                  $state.go('snd.account');
  13544.  
  13545.                })
  13546.  
  13547.                .error(function(data, status, headers,config){
  13548.  
  13549.                  console.log('data error');
  13550.  
  13551.                })
  13552.  
  13553.                .then(function(result){
  13554.  
  13555.                  things = result.data;
  13556.  
  13557.                });
  13558.                  
  13559.  
  13560.              })
  13561.  
  13562.              .error(function(data, status, headers,config){
  13563.  
  13564.                console.log('data error');
  13565.  
  13566.              })
  13567.  
  13568.              .then(function(result){
  13569.  
  13570.                things = result.data;
  13571.  
  13572.              });
  13573.  
  13574.                ///////////
  13575.              
  13576.                  
  13577.                  // END Signup Facebook
  13578.                    }
  13579.                  })
  13580.                  
  13581.  
  13582.                  .error(function(data, status, headers,config){
  13583.  
  13584.                    console.log('data error');
  13585.  
  13586.                  })
  13587.  
  13588.                  .then(function(result){
  13589.  
  13590.                    things = result.data;
  13591.  
  13592.                  });
  13593.                  }
  13594.  
  13595.              
  13596.             })
  13597.             .error(function(data, status, headers,config){
  13598.             console.log('data error');
  13599.             })
  13600.             .then(function(result){
  13601.               things = result.data;
  13602.             });
  13603.  
  13604.         }, function(error) {
  13605.             alert("There was a problem getting your profile.  Check the logs for details.");
  13606.             console.log(error);
  13607.         });
  13608.     } else {
  13609.         alert("Not signed in");
  13610.      //   $location.path("/login");
  13611.     }
  13612.  
  13613.  //   $location.path("/profile");
  13614. }, function(error) {
  13615.     alert("There was a problem signing in!  See the console for logs");
  13616.     console.log(error);
  13617. });
  13618.  
  13619.        
  13620.        
  13621.     }
  13622.    
  13623.    
  13624.     //End Facebook Auth
  13625.    
  13626.  
  13627.  //////
  13628.  
  13629.     if (typeof String.prototype.startsWith != 'function') {
  13630.         String.prototype.startsWith = function (str){
  13631.             return this.indexOf(str) == 0;
  13632.         };
  13633.     }
  13634.  
  13635. })
  13636.  
  13637.  
  13638.  
  13639.  
  13640. .controller('ForgotPasswordPageController', function($scope,$state, $ionicSideMenuDelegate,$http,$ionicPopup,$localStorage) {
  13641.  
  13642.   $scope.data = {};
  13643.  
  13644.  
  13645.  
  13646.     $scope.forgot_password = function() {
  13647.  
  13648.       //  console.log("LOGIN user: " + $scope.data.username + " - PW: " + $scope.data.password);
  13649.  
  13650.        
  13651.  
  13652.        console.log("email-->"+$scope.data.email);
  13653.  
  13654.         $http.post('http://dxplor.com/dxplor/Mo_customer/forgotpassword', {email : $scope.data.email})
  13655.  
  13656.       .success(function(data, status, headers,config){
  13657.  
  13658.         console.log('data success');
  13659.  
  13660.         console.log(data); // for browser console
  13661.  
  13662.        
  13663.  
  13664.        
  13665.  
  13666.  
  13667.        
  13668.  
  13669.         if(data=="ok")
  13670.  
  13671.         {
  13672.  
  13673.          
  13674.  
  13675.         var alertPopup = $ionicPopup.alert({
  13676.  
  13677.             title: 'Success',
  13678.  
  13679.             template: 'Please check your email'
  13680.  
  13681.           });
  13682.  
  13683.        
  13684.  
  13685.         $state.go('snd.login');
  13686.  
  13687.  
  13688.        
  13689.  
  13690.  
  13691.        
  13692.  
  13693.  
  13694.         }
  13695.  
  13696.         else
  13697.  
  13698.         {
  13699.  
  13700.         console.log("Forgot Password error");
  13701.  
  13702.         var alertPopup = $ionicPopup.alert({
  13703.  
  13704.             title: 'Sorry',
  13705.  
  13706.             template: 'Email not found'
  13707.  
  13708.           });
  13709.  
  13710.         }
  13711.  
  13712.        
  13713.  
  13714.        
  13715.  
  13716.          
  13717.  
  13718.        
  13719.  
  13720.       })
  13721.  
  13722.       .error(function(data, status, headers,config){
  13723.  
  13724.         console.log('data error');
  13725.         var alertPopup = $ionicPopup.alert({
  13726.  
  13727.             title: 'Sorry',
  13728.  
  13729.             template: 'Reset Password Error'
  13730.  
  13731.           });
  13732.  
  13733.        
  13734.  
  13735.       })
  13736.  
  13737.       .then(function(result){
  13738.  
  13739.         things = result.data;
  13740.  
  13741.       });
  13742.  
  13743.    
  13744.  
  13745.    
  13746.  
  13747.    
  13748.  
  13749.     }
  13750.  
  13751.    
  13752.  
  13753.    
  13754.  
  13755.  
  13756.  
  13757.    
  13758.  
  13759. })
  13760.  
  13761.  
  13762.  
  13763. .controller('ChangePasswordPageController', function($scope,$state, $ionicSideMenuDelegate,$http,$ionicPopup,$localStorage) {
  13764.  
  13765.   $scope.data = {};
  13766.  
  13767.   $scope.oldpasswordtrue=true;
  13768.  
  13769.   $http.post('http://dxplor.com/dxplor/Mo_customer/getcustomerfirstname', {email : $localStorage.email})
  13770.  
  13771.   .success(function(data, status, headers,config){
  13772.  
  13773.     console.log('data success');
  13774.  
  13775.     console.log(data); // for browser console
  13776.  
  13777.     $scope.fname=data;
  13778.  
  13779. /// get md5
  13780.    
  13781.     $http.post('http://dxplor.com/dxplor/Mo_customer/getdefaultpassword', {email : $localStorage.email, fname : $scope.fname})
  13782.  
  13783.     .success(function(data, status, headers,config){
  13784.  
  13785.       console.log('data success');
  13786.  
  13787.       console.log(data); // for browser console
  13788.  
  13789.  
  13790.       if(data=="default")
  13791.          
  13792.           {
  13793.           console.log("password default true");
  13794.           $scope.oldpasswordtrue=false;
  13795.          
  13796.           }
  13797.      
  13798.       else
  13799.           {
  13800.           console.log("password default false");
  13801.          
  13802.  
  13803.          
  13804.           }
  13805.  
  13806.    
  13807.  
  13808.     })
  13809.  
  13810.     .error(function(data, status, headers,config){
  13811.  
  13812.       console.log('data error');
  13813.      
  13814.  
  13815.     })
  13816.  
  13817.     .then(function(result){
  13818.  
  13819.       things = result.data;
  13820.  
  13821.     });
  13822.  
  13823.    
  13824.    
  13825.     //end get md5
  13826.  
  13827.  
  13828.   })
  13829.  
  13830.   .error(function(data, status, headers,config){
  13831.  
  13832.     console.log('data error');
  13833.    
  13834.   })
  13835.  
  13836.   .then(function(result){
  13837.  
  13838.     things = result.data;
  13839.  
  13840.   });
  13841.  
  13842.  
  13843.  
  13844.  
  13845.     $scope.change_password = function() {
  13846.  
  13847.       //  console.log("LOGIN user: " + $scope.data.username + " - PW: " + $scope.data.password);
  13848.  
  13849.        
  13850.  
  13851.        console.log("ChangePassword");
  13852.        
  13853.        if($scope.oldpasswordtrue)
  13854.            {
  13855.            if(angular.isUndefined($scope.data.oldpassword))
  13856.  
  13857.  
  13858.  
  13859.            {
  13860.  
  13861.             var alertPopup = $ionicPopup.alert({
  13862.  
  13863.                    title: 'Info',
  13864.  
  13865.                    template: 'Old Password harus diisi'
  13866.  
  13867.                  });
  13868.  
  13869.                 return false;
  13870.  
  13871.            }
  13872.            }
  13873.        else
  13874.            {
  13875.        
  13876.            }
  13877.        if(angular.isUndefined($scope.data.newpassword))
  13878.  
  13879.  
  13880.  
  13881.        {
  13882.  
  13883.         var alertPopup = $ionicPopup.alert({
  13884.  
  13885.                title: 'Info',
  13886.  
  13887.                template: 'New Password harus diisi'
  13888.  
  13889.              });
  13890.  
  13891.             return false;
  13892.  
  13893.        }
  13894.        
  13895.        if(angular.isUndefined($scope.data.confirmnewpassword))
  13896.  
  13897.  
  13898.  
  13899.        {
  13900.  
  13901.         var alertPopup = $ionicPopup.alert({
  13902.  
  13903.                title: 'Info',
  13904.  
  13905.                template: 'Confirm New Password harus diisi'
  13906.  
  13907.              });
  13908.  
  13909.             return false;
  13910.  
  13911.        }
  13912.        
  13913.        if($scope.data.confirmnewpassword!=$scope.data.newpassword)
  13914.  
  13915.  
  13916.  
  13917.        {
  13918.  
  13919.         var alertPopup = $ionicPopup.alert({
  13920.  
  13921.                title: 'Info',
  13922.  
  13923.                template: 'New Password dan Confirm New Password harus sama'
  13924.  
  13925.              });
  13926.  
  13927.             return false;
  13928.  
  13929.        }
  13930.  
  13931.         $http.post('http://dxplor.com/dxplor/Mo_customer/changepassword', {uname : $localStorage.email,oldpassword : $scope.data.oldpassword,newpassword : $scope.data.newpassword})
  13932.  
  13933.       .success(function(data, status, headers,config){
  13934.  
  13935.         console.log('data success');
  13936.  
  13937.         console.log(data); // for browser console
  13938.  
  13939.        
  13940.  
  13941.         if(data=="oldpasswordwrong")
  13942.  
  13943.         {
  13944.              var alertPopup = $ionicPopup.alert({
  13945.  
  13946.                  title: 'Info',
  13947.  
  13948.                  template: 'Wrong Old Password'
  13949.  
  13950.                });
  13951.  
  13952.         }
  13953.        
  13954.  
  13955.         if(data=="ok")
  13956.  
  13957.         {
  13958.  
  13959.          
  13960.  
  13961.         var alertPopup = $ionicPopup.alert({
  13962.  
  13963.             title: 'Success',
  13964.  
  13965.             template: 'Change Password Success'
  13966.  
  13967.           });
  13968.  
  13969.        
  13970.  
  13971.  
  13972.         }
  13973.  
  13974.         $state.go('snd.account');
  13975.  
  13976.        
  13977.  
  13978.        
  13979.  
  13980.          
  13981.  
  13982.        
  13983.  
  13984.       })
  13985.  
  13986.       .error(function(data, status, headers,config){
  13987.  
  13988.         console.log('data error');
  13989.         var alertPopup = $ionicPopup.alert({
  13990.  
  13991.             title: 'Sorry',
  13992.  
  13993.             template: 'Change Password Error'
  13994.  
  13995.           });
  13996.  
  13997.        
  13998.  
  13999.       })
  14000.  
  14001.       .then(function(result){
  14002.  
  14003.         things = result.data;
  14004.  
  14005.       });
  14006.  
  14007.    
  14008.  
  14009.    
  14010.  
  14011.    
  14012.  
  14013.     }
  14014.  
  14015.    
  14016.  
  14017.    
  14018.  
  14019.  
  14020.  
  14021.    
  14022.  
  14023. })
  14024.  
  14025.  
  14026.  
  14027.  
  14028.  
  14029. .controller('HistoryBalanceController', function($scope,$state, $ionicSideMenuDelegate,$http,$ionicPopup,$localStorage) {
  14030.  
  14031.  
  14032.  
  14033.        
  14034.  
  14035. console.log("di history balance");
  14036.  
  14037.  
  14038. $http.post('http://dxplor.com/dxplor/Mo_balance/get_balance/'+ $localStorage.customerid)
  14039.  
  14040.    
  14041.  
  14042.    
  14043.  
  14044.      .success(function(data, status, headers,config){
  14045.  
  14046.        console.log('data success');
  14047.  
  14048.        console.log(data); // for browser console
  14049.  
  14050.        
  14051.  
  14052.        $scope.balance =  data;
  14053.  
  14054.        
  14055.  
  14056.        
  14057.  
  14058.  
  14059.      
  14060.  
  14061.      })
  14062.  
  14063.      .error(function(data, status, headers,config){
  14064.  
  14065.        console.log('data error');
  14066.  
  14067.        
  14068.  
  14069.    
  14070.  
  14071.      })
  14072.  
  14073.      .then(function(result){
  14074.  
  14075.        things = result.data;
  14076.  
  14077.      });
  14078.  
  14079.  
  14080.        
  14081.  
  14082.         $http.get('http://dxplor.com/dxplor/Mo_customer/gethistory/'+$localStorage.customerid)
  14083.  
  14084.       .success(function(data, status, headers,config){
  14085.  
  14086.         console.log('data success');
  14087.  
  14088.         console.log(data); // for browser console
  14089.  
  14090.        
  14091.  
  14092.        
  14093.  
  14094.     $scope.result =  data;
  14095.  
  14096.  
  14097.  
  14098.          
  14099.  
  14100.        
  14101.  
  14102.       })
  14103.  
  14104.       .error(function(data, status, headers,config){
  14105.  
  14106.         console.log('data error');
  14107.  
  14108.       })
  14109.  
  14110.       .then(function(result){
  14111.  
  14112.         things = result.data;
  14113.  
  14114.       });
  14115.  
  14116.    
  14117.  
  14118.    
  14119.  
  14120.    
  14121.  
  14122.    
  14123.  
  14124.    
  14125.  
  14126.    
  14127.  
  14128.  
  14129.  
  14130.    
  14131.  
  14132. })
  14133.  
  14134. .controller('MarketPlaceController', function($scope,$http, $ionicSideMenuDelegate) {
  14135.  
  14136. console.log("di marketplace");
  14137.  
  14138.  
  14139.  
  14140.  
  14141. $http.get('http://dxplor.com/dxplor/Mo_category')
  14142.  
  14143.   .success(function(data, status, headers,config){
  14144.  
  14145.     console.log('data success');
  14146.  
  14147.     console.log(data); // for browser console
  14148.  
  14149.    
  14150.  
  14151.     $scope.result =  data;
  14152.  
  14153.   })
  14154.  
  14155.   .error(function(data, status, headers,config){
  14156.  
  14157.     console.log('data error');
  14158.  
  14159.   })
  14160.  
  14161.   .then(function(result){
  14162.  
  14163.     things = result.data;
  14164.  
  14165.   });
  14166.  
  14167.  
  14168. })
  14169.  
  14170.  
  14171.  
  14172. .controller('MobileCategoryController', function($scope, $ionicSideMenuDelegate,$http,$state,$location,$ionicPopup,$localStorage) {
  14173.  
  14174. console.log('Mobile Category');
  14175.  
  14176.  
  14177.  
  14178. })
  14179.  
  14180.  
  14181.  
  14182. .controller('MobileController', function($scope, $ionicSideMenuDelegate,$http,$state,$location,$ionicPopup,$localStorage) {
  14183.  
  14184.  
  14185. console.log('dimobile');
  14186.  
  14187.     $scope.isDisabled = false;
  14188.  
  14189.    
  14190.  
  14191. $scope.handlePaste= function(myvalue){
  14192.  
  14193.  
  14194. console.log("handlepaste");
  14195. $scope.pastevalue=myvalue.length;
  14196.  
  14197. var aaa=myvalue.toString();
  14198.  
  14199. $scope.prefixvalue=aaa.substring(0, 4);
  14200.  
  14201.  
  14202.  
  14203.  
  14204.  
  14205. $http.get('http://dxplor.com/dxplor/Mo_operator/'+$scope.prefixvalue)
  14206.  
  14207. .success(function(data, status, headers,config){
  14208.  
  14209.  
  14210.  
  14211.  
  14212.  
  14213.   var res = data.split(",");
  14214.  
  14215.  
  14216.  
  14217.   console.log(res[1]);
  14218.  
  14219.   $scope.image = res[1];
  14220.  
  14221.   $scope.operatorid = res[0];
  14222.  
  14223. $scope.imagetrue = true;
  14224.  
  14225.  
  14226.  
  14227. //Get Package
  14228.  
  14229. $http.get('http://dxplor.com/dxplor/Mo_operator_package/'+$scope.operatorid)
  14230.  
  14231.   .success(function(data, status, headers,config){
  14232.  
  14233.  
  14234.  
  14235.     console.log(data);
  14236.  
  14237.     $scope.paket=data;
  14238.  
  14239.  
  14240.  
  14241.   })
  14242.  
  14243.   .error(function(data, status, headers,config){
  14244.  
  14245.     console.log('data error');
  14246.  
  14247.   })
  14248.  
  14249.   .then(function(result){
  14250.  
  14251.     things = result.data;
  14252.  
  14253.   });
  14254.  
  14255.  
  14256. })
  14257.  
  14258. .error(function(data, status, headers,config){
  14259.  
  14260.   console.log('data error');
  14261.  
  14262. })
  14263.  
  14264. .then(function(result){
  14265.  
  14266.   things = result.data;
  14267.  
  14268. });
  14269.  
  14270.  
  14271.  
  14272.  
  14273.  
  14274. }
  14275.  
  14276.  
  14277.  
  14278.  
  14279.  
  14280. $scope.mobilechange= function(myvalue){
  14281.  
  14282.  
  14283.    
  14284.  
  14285.  
  14286.  
  14287.     $scope.count=myvalue;
  14288.  
  14289.     $scope.count=(''+$scope.count).length;
  14290.  
  14291.  
  14292.  
  14293.    console.log('value yang diisi'+myvalue);
  14294.    console.log('value yang diisi string'+myvalue.toString());
  14295.  
  14296.    
  14297.  
  14298.     console.log($scope.count);
  14299.  
  14300.     if($scope.count==4.0){
  14301.  
  14302.    
  14303.  
  14304.     console.log($scope.mobileno);
  14305.  
  14306.     $http.get('http://dxplor.com/dxplor/Mo_operator/'+myvalue)
  14307.  
  14308.       .success(function(data, status, headers,config){
  14309.  
  14310.  
  14311.  
  14312.        
  14313.  
  14314.         var res = data.split(",");
  14315.  
  14316.  
  14317.  
  14318.         console.log(res[1]);
  14319.  
  14320.         $scope.image = res[1];
  14321.  
  14322.         $scope.operatorid = res[0];
  14323.  
  14324.     $scope.imagetrue = true;
  14325.  
  14326.  
  14327.  
  14328.     //Get Package
  14329.  
  14330.     $http.get('http://dxplor.com/dxplor/Mo_operator_package/'+$scope.operatorid)
  14331.  
  14332.       .success(function(data, status, headers,config){
  14333.  
  14334.  
  14335.  
  14336.        
  14337.  
  14338.  
  14339.  
  14340.         console.log(data);
  14341.  
  14342.         $scope.paket=data;
  14343.  
  14344.  
  14345.  
  14346.  
  14347.  
  14348.       })
  14349.  
  14350.       .error(function(data, status, headers,config){
  14351.  
  14352.         console.log('data error');
  14353.  
  14354.       })
  14355.  
  14356.       .then(function(result){
  14357.  
  14358.         things = result.data;
  14359.  
  14360.       });
  14361.  
  14362.    
  14363.  
  14364.       })
  14365.  
  14366.       .error(function(data, status, headers,config){
  14367.  
  14368.         console.log('data error');
  14369.  
  14370.       })
  14371.  
  14372.       .then(function(result){
  14373.  
  14374.         things = result.data;
  14375.  
  14376.       });
  14377.  
  14378. }
  14379.  
  14380.    
  14381.  
  14382.     if($scope.count<4.0)
  14383.  
  14384.     {
  14385.  
  14386.     console.log("resetting..");
  14387.  
  14388.     $scope.imagetrue = false;
  14389.  
  14390.     $scope.paket="";
  14391.  
  14392.     $scope.selected_id='';
  14393.  
  14394.     }
  14395.  
  14396.    
  14397.  
  14398. }
  14399.  
  14400.  
  14401. $scope.topup = function(mobilenomodel,operatorid,selected_id) {
  14402.  
  14403.         console.log("topup user: "+mobilenomodel+" asdda"+ operatorid+" adsad"+selected_id);
  14404.  
  14405.        
  14406.  
  14407.         $scope.login=true;
  14408.  
  14409.         if($localStorage.email==null)
  14410.  
  14411.     {
  14412.  
  14413.     console.log("belum login");
  14414.  
  14415.        
  14416.  
  14417.         var alertPopup = $ionicPopup.alert({
  14418.  
  14419.             title: 'Info',
  14420.  
  14421.             template: 'Please Login first to Topup Pulsa'
  14422.  
  14423.           });
  14424.  
  14425.    
  14426.  
  14427.         $state.go('snd.login');
  14428.  
  14429.         $scope.login=false;
  14430.  
  14431.     }
  14432.  
  14433.        
  14434.  
  14435.  
  14436.  
  14437.         if($scope.login==false){
  14438.  
  14439.        
  14440.  
  14441.        
  14442.  
  14443.         }
  14444.  
  14445.         else
  14446.  
  14447.         {
  14448.  
  14449.        
  14450.  
  14451.         $http.post('http://dxplor.com/dxplor/Mo_balance/get_balance/'+ $localStorage.customerid)
  14452.  
  14453.            
  14454.  
  14455.            
  14456.  
  14457.             .success(function(data, status, headers,config){
  14458.  
  14459.               console.log(data); // for browser console
  14460.  
  14461.              
  14462.  
  14463.               $scope.balance =  data;
  14464.  
  14465.              
  14466.  
  14467.              
  14468.  
  14469.              
  14470.  
  14471.  
  14472.  
  14473.             console.log("balance-->"+$scope.balance);
  14474.  
  14475.       console.log("harga-->"+selected_id);
  14476.  
  14477.       console.log("mobilenomodel-->"+mobilenomodel);
  14478.  
  14479.       console.log("operatorid-->"+operatorid);
  14480.  
  14481.       console.log("selected_id-->"+selected_id);
  14482.  
  14483.  
  14484.  
  14485.            if(parseInt($scope.balance) < parseInt(selected_id))
  14486.  
  14487.                {
  14488.  
  14489.            
  14490.                var alertPopup = $ionicPopup.alert({
  14491.  
  14492.                    title: 'Info',
  14493.  
  14494.                    template: 'You dont have enough balance, please topup first'
  14495.  
  14496.                  });
  14497.  
  14498.                $state.go($state.current, {}, {reload: true});
  14499.  
  14500.                console.log("didnt have enough balance");
  14501.  
  14502.  
  14503.  
  14504.                }
  14505.  
  14506.              
  14507.  
  14508.            else
  14509.  
  14510.            {
  14511.  
  14512.                    console.log("have enough balance");
  14513.  
  14514.              
  14515.  
  14516. //disable button
  14517.  
  14518.                        $scope.isDisabled = true;
  14519.  
  14520.                    
  14521.  
  14522.  
  14523.  
  14524.                   $http.get('http://dxplor.com/dxplor/Mo_pulsa3/'+mobilenomodel+'/'+operatorid+'/'+selected_id+'/'+$localStorage.customerid+'/3-6-1-2-3-1-1')
  14525.  
  14526.                  .success(function(data, status, headers,config){
  14527.  
  14528.  
  14529.  
  14530.                  console.log("data-->"+data);
  14531.  
  14532.  
  14533.  
  14534.                  if(data=="ok")
  14535.  
  14536.                  {
  14537.  
  14538.                  
  14539.  
  14540.                  console.log("topup ok");
  14541.  
  14542.                  
  14543.  
  14544.                         var alertPopup = $ionicPopup.alert({
  14545.  
  14546.                                title: 'Info',
  14547.  
  14548.                                template: 'Your request is being processed'
  14549.  
  14550.                              });
  14551.  
  14552.                            $state.go('snd.home');
  14553.  
  14554.                          
  14555.  
  14556.                  
  14557.  
  14558.                  }
  14559.  
  14560.                  else
  14561.  
  14562.                  {
  14563.  
  14564.  
  14565.  
  14566.                  console.log("topup error");
  14567.  
  14568.  
  14569.  
  14570.                  
  14571.  
  14572.                 var alertPopup = $ionicPopup.alert({
  14573.  
  14574.                              title: 'Info',
  14575.  
  14576.                              template: 'Request error, Please try again in a few minutes'
  14577.  
  14578.                            });
  14579.  
  14580.                 $state.go('snd.home');
  14581.  
  14582.  
  14583.  
  14584.                
  14585.  
  14586.                  }
  14587.  
  14588.                
  14589.  
  14590.                  
  14591.  
  14592.                  })
  14593.  
  14594.                  
  14595.  
  14596.                        /*var alertPopup = $ionicPopup.alert({
  14597.  
  14598.                            title: 'Info',
  14599.  
  14600.                            template: 'Topup Pulsa Success'
  14601.  
  14602.                          });  
  14603.  
  14604.                   */
  14605.  
  14606.            }
  14607.  
  14608.              
  14609.  
  14610.        
  14611.  
  14612.              
  14613.  
  14614.             })
  14615.  
  14616.             .error(function(data, status, headers,config){
  14617.  
  14618.               console.log('data error');
  14619.  
  14620.              
  14621.  
  14622.          
  14623.  
  14624.             })
  14625.  
  14626.             .then(function(result){
  14627.  
  14628.               things = result.data;
  14629.  
  14630.             });
  14631.  
  14632.        
  14633.  
  14634.        
  14635.  
  14636.          
  14637.  
  14638.                  
  14639.  
  14640.         }
  14641.  
  14642.        
  14643.  
  14644.      
  14645.  
  14646.        
  14647.  
  14648.      
  14649.  
  14650.    
  14651.  
  14652.    
  14653.  
  14654.        
  14655.  
  14656.        
  14657.  
  14658.        
  14659.  
  14660.      
  14661.  
  14662.  
  14663.  
  14664.        
  14665.  
  14666. }
  14667.  
  14668.  
  14669.  
  14670.  
  14671.  
  14672.  
  14673. })
  14674.  
  14675.  
  14676.  
  14677.  
  14678.  
  14679.  
  14680.  
  14681. .controller('MobilePacketController', function($scope, $ionicSideMenuDelegate,$http,$state,$location,$ionicPopup,$localStorage) {
  14682.  
  14683.  
  14684. console.log('dimobile packet');
  14685.  
  14686.     $scope.isDisabled = false;
  14687.  
  14688.    
  14689.  
  14690. $scope.handlePaste= function(myvalue){
  14691.  
  14692.  
  14693.  
  14694. $scope.pastevalue=myvalue.length;
  14695.  
  14696. var aaa=myvalue.toString();
  14697.  
  14698. $scope.prefixvalue=aaa.substring(0, 4);
  14699.  
  14700.  
  14701.  
  14702.  
  14703.  
  14704. $http.get('http://dxplor.com/dxplor/Mo_operator_packet/'+$scope.prefixvalue)
  14705.  
  14706. .success(function(data, status, headers,config){
  14707.  
  14708.  
  14709.  
  14710.  
  14711.  
  14712.   var res = data.split(",");
  14713.  
  14714.  
  14715.  
  14716.   console.log(res[1]);
  14717.  
  14718.   $scope.image = res[1];
  14719.  
  14720.   $scope.operatorid = res[0];
  14721.  
  14722. $scope.imagetrue = true;
  14723.  
  14724.  
  14725.  
  14726. //Get Package
  14727.  
  14728. $http.get('http://dxplor.com/dxplor/Mo_operator_packet_data/'+$scope.operatorid)
  14729.  
  14730.   .success(function(data, status, headers,config){
  14731.  
  14732.  
  14733.  
  14734.     console.log(data);
  14735.  
  14736.     $scope.paket=data;
  14737.  
  14738.  
  14739.  
  14740.   })
  14741.  
  14742.   .error(function(data, status, headers,config){
  14743.  
  14744.     console.log('data error');
  14745.  
  14746.   })
  14747.  
  14748.   .then(function(result){
  14749.  
  14750.     things = result.data;
  14751.  
  14752.   });
  14753.  
  14754.  
  14755. })
  14756.  
  14757. .error(function(data, status, headers,config){
  14758.  
  14759.   console.log('data error');
  14760.  
  14761. })
  14762.  
  14763. .then(function(result){
  14764.  
  14765.   things = result.data;
  14766.  
  14767. });
  14768.  
  14769.  
  14770.  
  14771.  
  14772.  
  14773. }
  14774.  
  14775.  
  14776.  
  14777.  
  14778.  
  14779. $scope.mobilechange= function(myvalue){
  14780.  
  14781.  
  14782.    
  14783.  
  14784.  
  14785.  
  14786.     $scope.count=myvalue;
  14787.  
  14788.     $scope.count=(''+$scope.count).length;
  14789.  
  14790.  
  14791.  
  14792.    
  14793.  
  14794.     console.log($scope.count);
  14795.  
  14796.     if($scope.count==4.0){
  14797.  
  14798.    
  14799.  
  14800.     console.log($scope.mobileno);
  14801.  
  14802.     $http.get('http://dxplor.com/dxplor/Mo_operator_packet/'+myvalue)
  14803.  
  14804.       .success(function(data, status, headers,config){
  14805.  
  14806.  
  14807.  
  14808.        
  14809.  
  14810.         var res = data.split(",");
  14811.  
  14812.  
  14813.  
  14814.         console.log(res[1]);
  14815.  
  14816.         $scope.image = res[1];
  14817.  
  14818.         $scope.operatorid = res[0];
  14819.  
  14820.     $scope.imagetrue = true;
  14821.  
  14822.  
  14823.  
  14824.     //Get Package
  14825.  
  14826.     $http.get('http://dxplor.com/dxplor/Mo_operator_packet_data/'+$scope.operatorid)
  14827.  
  14828.       .success(function(data, status, headers,config){
  14829.  
  14830.  
  14831.  
  14832.        
  14833.  
  14834.  
  14835.  
  14836.         console.log(data);
  14837.  
  14838.         $scope.paket=data;
  14839.  
  14840.  
  14841.  
  14842.  
  14843.  
  14844.       })
  14845.  
  14846.       .error(function(data, status, headers,config){
  14847.  
  14848.         console.log('data error');
  14849.  
  14850.       })
  14851.  
  14852.       .then(function(result){
  14853.  
  14854.         things = result.data;
  14855.  
  14856.       });
  14857.  
  14858.    
  14859.  
  14860.       })
  14861.  
  14862.       .error(function(data, status, headers,config){
  14863.  
  14864.         console.log('data error');
  14865.  
  14866.       })
  14867.  
  14868.       .then(function(result){
  14869.  
  14870.         things = result.data;
  14871.  
  14872.       });
  14873.  
  14874. }
  14875.  
  14876.    
  14877.  
  14878.     if($scope.count<4.0)
  14879.  
  14880.     {
  14881.  
  14882.     console.log("resetting..");
  14883.  
  14884.     $scope.imagetrue = false;
  14885.  
  14886.     $scope.paket="";
  14887.  
  14888.     $scope.selected_id='';
  14889.  
  14890.     }
  14891.  
  14892.    
  14893.  
  14894. }
  14895.  
  14896.  
  14897. $scope.topup = function(mobilenomodel,operatorid,selected_id) {
  14898.  
  14899.         console.log("topup user: "+mobilenomodel+" asdda"+ operatorid+" adsad"+selected_id);
  14900.  
  14901.        
  14902.  
  14903.         $scope.login=true;
  14904.  
  14905.         if($localStorage.email==null)
  14906.  
  14907.     {
  14908.  
  14909.     console.log("belum login");
  14910.  
  14911.        
  14912.  
  14913.         var alertPopup = $ionicPopup.alert({
  14914.  
  14915.             title: 'Info',
  14916.  
  14917.             template: 'Please Login first to Topup Pulsa'
  14918.  
  14919.           });
  14920.  
  14921.    
  14922.  
  14923.         $state.go('snd.login');
  14924.  
  14925.         $scope.login=false;
  14926.  
  14927.     }
  14928.  
  14929.        
  14930.  
  14931.  
  14932.  
  14933.         if($scope.login==false){
  14934.  
  14935.        
  14936.  
  14937.        
  14938.  
  14939.         }
  14940.  
  14941.         else
  14942.  
  14943.         {
  14944.  
  14945.        
  14946.  
  14947.         $http.post('http://dxplor.com/dxplor/Mo_balance/get_balance/'+ $localStorage.customerid)
  14948.  
  14949.            
  14950.  
  14951.            
  14952.  
  14953.             .success(function(data, status, headers,config){
  14954.  
  14955.               console.log(data); // for browser console
  14956.  
  14957.              
  14958.  
  14959.               $scope.balance =  data;
  14960.  
  14961.              
  14962.  
  14963.              
  14964.  
  14965.              
  14966.  
  14967.  
  14968.  
  14969.             console.log("balance-->"+$scope.balance);
  14970.  
  14971.       console.log("harga-->"+selected_id);
  14972.  
  14973.       console.log("mobilenomodel-->"+mobilenomodel);
  14974.  
  14975.       console.log("operatorid-->"+operatorid);
  14976.  
  14977.       console.log("selected_id-->"+selected_id);
  14978.  
  14979.  
  14980.  
  14981.            if(parseInt($scope.balance) < parseInt(selected_id))
  14982.  
  14983.                {
  14984.  
  14985.              
  14986.  
  14987.          
  14988.  
  14989.  
  14990.  
  14991.                var alertPopup = $ionicPopup.alert({
  14992.  
  14993.                    title: 'Info',
  14994.  
  14995.                    template: 'You dont have enough balance, please topup first'
  14996.  
  14997.                  });
  14998.  
  14999.                $state.go($state.current, {}, {reload: true});
  15000.  
  15001.                console.log("didnt have enough balance");
  15002.  
  15003.  
  15004.  
  15005.                }
  15006.  
  15007.              
  15008.  
  15009.            else
  15010.  
  15011.            {
  15012.  
  15013.                    console.log("have enough balancesssssafff");
  15014.  
  15015.              
  15016.  
  15017. //disable button
  15018.  
  15019.                        $scope.isDisabled = true;
  15020.  
  15021.                    
  15022.  
  15023.  
  15024.  
  15025.                   $http.get('http://dxplor.com/dxplor/Mo_pulsa3/'+mobilenomodel+'/'+operatorid+'/'+selected_id+'/'+$localStorage.customerid+'/3-6-1-2-3-1-1')
  15026.  
  15027.                  .success(function(data, status, headers,config){
  15028.  
  15029.  
  15030.  
  15031.                  console.log("data-->"+data);
  15032.  
  15033.  
  15034.  
  15035.                  if(data=="ok")
  15036.  
  15037.                  {
  15038.  
  15039.                  
  15040.  
  15041.                  console.log("topup ok");
  15042.  
  15043.                  
  15044.  
  15045.                         var alertPopup = $ionicPopup.alert({
  15046.  
  15047.                                title: 'Info',
  15048.  
  15049.                                template: 'Your request is being processed'
  15050.  
  15051.                              });
  15052.  
  15053.                            $state.go('snd.home');
  15054.  
  15055.                          
  15056.  
  15057.                  
  15058.  
  15059.                  }
  15060.  
  15061.                  else
  15062.  
  15063.                  {
  15064.  
  15065.  
  15066.  
  15067.                  console.log("topup error");
  15068.  
  15069.  
  15070.  
  15071.                  
  15072.  
  15073.                 var alertPopup = $ionicPopup.alert({
  15074.  
  15075.                              title: 'Info',
  15076.  
  15077.                              template: 'Request error, Please try again in a few minutes'
  15078.  
  15079.                            });
  15080.  
  15081.                 $state.go('snd.home');
  15082.  
  15083.  
  15084.  
  15085.                
  15086.  
  15087.                  }
  15088.  
  15089.                
  15090.  
  15091.                  
  15092.  
  15093.                  })
  15094.  
  15095.                  
  15096.  
  15097.                      
  15098.  
  15099.            }
  15100.  
  15101.              
  15102.  
  15103.        
  15104.  
  15105.              
  15106.  
  15107.             })
  15108.  
  15109.             .error(function(data, status, headers,config){
  15110.  
  15111.               console.log('data error');
  15112.  
  15113.               var alertPopup = $ionicPopup.alert({
  15114.  
  15115.                   title: 'Info',
  15116.  
  15117.                   template: 'Request error, Please try again in a few minutes'
  15118.  
  15119.                 });
  15120.  
  15121.              
  15122.  
  15123.          
  15124.  
  15125.             })
  15126.  
  15127.             .then(function(result){
  15128.  
  15129.               things = result.data;
  15130.  
  15131.             });
  15132.  
  15133.        
  15134.  
  15135.                                  
  15136.  
  15137.         }
  15138.  
  15139.                
  15140.  
  15141. }
  15142.  
  15143.  
  15144. })
  15145.  
  15146.  
  15147.  
  15148.  
  15149.  
  15150.  
  15151.  
  15152. .controller('MobileConfirmationController',  function($scope, $ionicSideMenuDelegate,$http,$stateParams) {
  15153.  
  15154. console.log("di mobile confirmation");
  15155.  
  15156. console.log("mobileno "+$stateParams.mobilenomodel);
  15157.  
  15158. console.log("operatorid "+$stateParams.operatorid);
  15159.  
  15160. console.log("selected_id "+$stateParams.selected_id);
  15161.  
  15162.  
  15163.  
  15164. /*
  15165.  
  15166. $http.get('http://dxplor.com/dxplor/Mo_product_detail/'+$stateParams.productid)
  15167.  
  15168. .success(function(data, status, headers,config){
  15169.  
  15170. console.log(data);
  15171.  
  15172.  
  15173.  
  15174.   var res = data.split(",");
  15175.  
  15176.  
  15177.  
  15178.   $scope.id = res[0];
  15179.  
  15180.   $scope.name = res[1];
  15181.  
  15182.   $scope.price = res[2];
  15183.  
  15184.  
  15185.  
  15186.   $scope.description = res[3];
  15187.  
  15188.   $scope.image = res[4];
  15189.  
  15190.  
  15191.  
  15192.  
  15193.  
  15194. })
  15195.  
  15196.  
  15197.  
  15198. */
  15199.  
  15200. })
  15201.  
  15202. .controller('ProductsController', function($scope, $ionicSideMenuDelegate,$http,$localStorage,$stateParams) {
  15203.  
  15204. console.log("di product");
  15205.  
  15206.  
  15207.  
  15208. /*$scope.tasks = [
  15209.  
  15210.                 { title: 'Collect coins' },
  15211.  
  15212.                 { title: 'Eat mushrooms' },
  15213.  
  15214.                 { title: 'Get high enough to grab the flag' },
  15215.  
  15216.                 { title: 'Find the Princess' }
  15217.  
  15218.               ];
  15219.  
  15220. */
  15221.  
  15222.  
  15223.  
  15224.  
  15225.  
  15226. console.log($stateParams.productid);
  15227.  
  15228. $scope.result = "";
  15229.  
  15230. $http.get('http://dxplor.com/dxplor/Mo_product/'+$stateParams.productid)
  15231.  
  15232.   .success(function(data, status, headers,config){
  15233.  
  15234.     console.log('data success');
  15235.  
  15236.     console.log(data); // for browser console
  15237.  
  15238.    
  15239.  
  15240.     $scope.result =  data;
  15241.  
  15242.   })
  15243.  
  15244.   .error(function(data, status, headers,config){
  15245.  
  15246.     console.log('data error');
  15247.  
  15248.   })
  15249.  
  15250.   .then(function(result){
  15251.  
  15252.     things = result.data;
  15253.  
  15254.   });
  15255.  
  15256.  
  15257.  
  15258.  
  15259.  
  15260.  
  15261.  
  15262. /*
  15263.  
  15264. $scope.save = function() {
  15265.  
  15266.     $localStorage.message = $scope.email;
  15267.  
  15268.     console.log($scope.email);
  15269.  
  15270. }
  15271.  
  15272.  
  15273.  
  15274. $scope.load = function() {
  15275.  
  15276.     $scope.data = $localStorage.message;
  15277.  
  15278. }
  15279.  
  15280. */
  15281.  
  15282.  
  15283.  
  15284. })
  15285.  
  15286. .controller('ProductsDetailController',  function($scope, $ionicSideMenuDelegate,$http,$stateParams) {
  15287.  
  15288. console.log("di product detail");
  15289.  
  15290. console.log($stateParams.productid);
  15291.  
  15292.  
  15293.  
  15294.  
  15295.  
  15296. $http.get('http://dxplor.com/dxplor/Mo_product_detail/'+$stateParams.productid)
  15297.  
  15298. .success(function(data, status, headers,config){
  15299.  
  15300. console.log(data);
  15301.  
  15302.  
  15303.  
  15304.   var res = data.split(",");
  15305.  
  15306.  
  15307.  
  15308.   $scope.id = res[0];
  15309.  
  15310.   $scope.name = res[1];
  15311.  
  15312.   $scope.price = res[2];
  15313.  
  15314.  
  15315.  
  15316.   $scope.description = res[3];
  15317.  
  15318.   $scope.image = res[4];
  15319.  
  15320.  
  15321.  
  15322. });
  15323.  
  15324.  
  15325.  
  15326. })
  15327.  
  15328.  
  15329.  
  15330. .controller('ComingsoonController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state) {
  15331.  
  15332. console.log("di comingsoon");
  15333.  
  15334.     $scope.result =  $localStorage.comingsoon;
  15335.  
  15336. })
  15337.  
  15338.  
  15339. .controller('ShopDashboardController', function($scope, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  15340.  
  15341. console.log("di Shop Dashboard");
  15342.  
  15343. $scope.showAlert = function(title, msg) {
  15344.       var alertPopup = $ionicPopup.alert({
  15345.         title: title,
  15346.         template: msg
  15347.       });
  15348.     };
  15349.  
  15350. $http.post('http://dxplor.com/dxplor/Mo_customer/getshopname', {userid : $localStorage.customerid})
  15351.  
  15352. .success(function(data, status, headers,config){
  15353.  
  15354. console.log('data success');
  15355.  
  15356. console.log(data); // for browser console
  15357.  
  15358. console.log('shopdata-->'+data)
  15359.  
  15360.  
  15361. if(data=="not exists")
  15362.     {
  15363.    
  15364.     $scope.shopname="";
  15365.     }
  15366. else{
  15367.    
  15368.  
  15369.     var res = data.split(";");
  15370.  
  15371.    $scope.shopname=res[0];
  15372.    $scope.location=res[1];
  15373.    $scope.description=res[2];
  15374. }
  15375.  
  15376. })
  15377.  
  15378. .error(function(data, status, headers,config){
  15379.  
  15380. console.log('data error');
  15381.  
  15382. })
  15383.  
  15384. .then(function(result){
  15385.  
  15386. things = result.data;
  15387.  
  15388. });
  15389.  
  15390.  
  15391.  
  15392. $scope.result = "";
  15393.  
  15394. //$http.get('http://dxplor.com/dxplor/Mo_product/'+$stateParams.productid)
  15395. $http.get('http://dxplor.com/dxplor/Mo_product/getproductbycustomer/'+$localStorage.customerid)
  15396.  
  15397.   .success(function(data, status, headers,config){
  15398.  
  15399.     console.log('data success');
  15400.  
  15401.     console.log(data); // for browser console
  15402.  
  15403.    
  15404.  
  15405.     $scope.result =  data;
  15406.  
  15407.   })
  15408.  
  15409.   .error(function(data, status, headers,config){
  15410.  
  15411.     console.log('data error');
  15412.  
  15413.   })
  15414.  
  15415.   .then(function(result){
  15416.  
  15417.     things = result.data;
  15418.  
  15419.   });
  15420.  
  15421.  
  15422. $scope.deleteprod = function(prod_id) {
  15423.    
  15424.     console.log('delete product id-->'+prod_id);
  15425.  
  15426. //  return false;
  15427.     $http.post('http://dxplor.com/dxplor/Mo_marketplace/delete_prod', {prod_id : prod_id})
  15428.  
  15429.       .success(function(data, status, headers,config){
  15430.  
  15431.         console.log('data success');
  15432.  
  15433.         console.log(data);
  15434.         if(data=="ok"){
  15435.         $scope.showAlert('Success', 'Delete product success');
  15436.        // $state.go('snd.shopdashboard');
  15437.         $state.go($state.current, {}, {reload: true});
  15438.  
  15439.         }
  15440.         else
  15441.             {
  15442.             $scope.showAlert('Success', 'Delete product failed');
  15443.  
  15444.             }
  15445.  
  15446.       })
  15447.  
  15448.      
  15449.  
  15450.   .error(function(data, status, headers,config){
  15451.  
  15452.     console.log('data error');
  15453.     console.log(data);
  15454.  
  15455.   })
  15456.  
  15457.   .then(function(result){
  15458.  
  15459.     things = result.data;
  15460.  
  15461.   });
  15462.      
  15463.      
  15464.  
  15465. }
  15466.  
  15467. })
  15468.  
  15469.  
  15470.  
  15471. .controller('EditDashboardController', function($scope,$cordovaFile,$cordovaActionSheet,$cordovaFileTransfer ,$cordovaDevice,$cordovaCamera, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  15472.  
  15473. console.log("di Edit Dashboard");
  15474. $scope.image = null;
  15475.  
  15476.  
  15477.  
  15478. $http.post('http://dxplor.com/dxplor/Mo_customer/getshopname', {userid : $localStorage.customerid})
  15479.  
  15480. .success(function(data, status, headers,config){
  15481.  
  15482. console.log('data success');
  15483.  
  15484. console.log(data); // for browser console
  15485.  
  15486. console.log('shopdata-->'+data)
  15487.  
  15488.  
  15489. if(data=="not exists")
  15490.     {
  15491.      $scope.shopname="";
  15492.        $scope.location="";
  15493.        $scope.description="";
  15494.     }
  15495. else{
  15496.    
  15497.  
  15498.     var res = data.split(";");
  15499.  
  15500.    $scope.shopname=res[0];
  15501.    $scope.location=res[1];
  15502.    $scope.description=res[2];
  15503. }
  15504.  
  15505. })
  15506.  
  15507. .error(function(data, status, headers,config){
  15508.  
  15509. console.log('data error');
  15510.  
  15511. })
  15512.  
  15513. .then(function(result){
  15514.  
  15515. things = result.data;
  15516.  
  15517. });
  15518.  
  15519.  
  15520.             $scope.edit = function(shop_name,location,description) {
  15521.                  
  15522.                      
  15523.                       $http.post('http://dxplor.com/dxplor/Mo_marketplace/edit_shop', {customer_id:$localStorage.customerid,shop_name : shop_name,location : location,description : description})
  15524.  
  15525.                       .success(function(data, status, headers,config){
  15526.  
  15527.                         console.log('data success');
  15528.  
  15529.                         console.log(data);
  15530.                        
  15531.                       //  $scope.showAlert('Success', 'Add new product success');
  15532.                         $state.go('snd.shopdashboard');
  15533.  
  15534.  
  15535.  
  15536.                       })
  15537.  
  15538.                      
  15539.  
  15540.                   .error(function(data, status, headers,config){
  15541.  
  15542.                     console.log('data error');
  15543.                     console.log(data);
  15544.  
  15545.                   })
  15546.  
  15547.                   .then(function(result){
  15548.  
  15549.                     things = result.data;
  15550.  
  15551.                   });
  15552.                      
  15553.                      
  15554.                      
  15555.                 //    }
  15556.                 }
  15557.    
  15558.    
  15559. })
  15560.  
  15561.  
  15562.  
  15563. .controller('AddProductController', function($scope,$cordovaFile,$cordovaActionSheet,$cordovaFileTransfer ,$cordovaDevice,$cordovaCamera, $localStorage,$ionicSideMenuDelegate,$http,$ionicPopup,$state,$ionicLoading) {
  15564.  
  15565. console.log("di Add Product");
  15566.  
  15567.  
  15568.  
  15569.  
  15570. $http.get('http://dxplor.com/dxplor/Mo_category')
  15571.  
  15572.   .success(function(data, status, headers,config){
  15573.  
  15574.     console.log('data success');
  15575.  
  15576.     console.log(data); // for browser console
  15577.  
  15578.    
  15579.  
  15580.     $scope.result =  data;
  15581.  
  15582.   })
  15583.  
  15584.   .error(function(data, status, headers,config){
  15585.  
  15586.     console.log('data error');
  15587.  
  15588.   })
  15589.  
  15590.   .then(function(result){
  15591.  
  15592.     things = result.data;
  15593.  
  15594.   });
  15595.  
  15596.  
  15597.  
  15598.  
  15599. $scope.image = null;
  15600.  
  15601. $scope.showAlert = function(title, msg) {
  15602.   var alertPopup = $ionicPopup.alert({
  15603.     title: title,
  15604.     template: msg
  15605.   });
  15606. };
  15607.  
  15608. $scope.loadImage = function() {
  15609.       var options = {
  15610.         title: 'Select Image Source',
  15611.         buttonLabels: ['Load from Library', 'Use Camera'],
  15612.         addCancelButtonWithLabel: 'Cancel',
  15613.         androidEnableCancelButton : true,
  15614.       };
  15615.       $cordovaActionSheet.show(options).then(function(btnIndex) {
  15616.         var type = null;
  15617.         if (btnIndex === 1) {
  15618.           type = Camera.PictureSourceType.PHOTOLIBRARY;
  15619.         } else if (btnIndex === 2) {
  15620.           type = Camera.PictureSourceType.CAMERA;
  15621.         }
  15622.         if (type !== null) {
  15623.           $scope.selectPicture(type);
  15624.         }
  15625.       });
  15626.     };
  15627.  
  15628.  
  15629.     //android
  15630.     $scope.selectPicture = function(sourceType) {
  15631.           var options = {
  15632.             quality: 100,
  15633.             destinationType: Camera.DestinationType.FILE_URI,
  15634.             sourceType: sourceType,
  15635.             saveToPhotoAlbum: false
  15636.           };
  15637.          
  15638.           $cordovaCamera.getPicture(options).then(function(imagePath) {
  15639.             // Grab the file name of the photo in the temporary directory
  15640.             var currentName = imagePath.replace(/^.*[\\\/]/, '');
  15641.          
  15642.             //Create a new name for the photo
  15643.             var d = new Date(),
  15644.             n = d.getTime(),
  15645.             newFileName =  n + ".jpg";
  15646.          
  15647.             // If you are trying to load image from the gallery on Android we need special treatment!
  15648.            
  15649.            
  15650.             if ($cordovaDevice.getPlatform() == 'Android' && sourceType === Camera.PictureSourceType.PHOTOLIBRARY) {
  15651.               window.FilePath.resolveNativePath(imagePath, function(entry) {
  15652.                 window.resolveLocalFileSystemURL(entry, success, fail);
  15653.                 function fail(e) {
  15654.                   console.error('Error: ', e);
  15655.                 }
  15656.          
  15657.                 function success(fileEntry) {
  15658.                   var namePath = fileEntry.nativeURL.substr(0, fileEntry.nativeURL.lastIndexOf('/') + 1);
  15659.                   // Only copy because of access rights
  15660.                   $cordovaFile.copyFile(namePath, fileEntry.name, cordova.file.dataDirectory, newFileName).then(function(success){
  15661.                     $scope.image = newFileName;
  15662.                   }, function(error){
  15663.                     $scope.showAlert('Error', error.exception);
  15664.                   });
  15665.                 };
  15666.               }
  15667.             );
  15668.             } else {
  15669.               var namePath = imagePath.substr(0, imagePath.lastIndexOf('/') + 1);
  15670.               // Move the file to permanent storage
  15671.               $cordovaFile.moveFile(namePath, currentName, cordova.file.dataDirectory, newFileName).then(function(success){
  15672.                 $scope.image = newFileName;
  15673.               }, function(error){
  15674.                 $scope.showAlert('Error', error.exception);
  15675.               });
  15676.             }
  15677.           },
  15678.           function(err){
  15679.             // Not always an error, maybe cancel was pressed...
  15680.           })
  15681.         };
  15682.        
  15683.         $scope.pathForImage = function(image) {
  15684.               if (image === null) {
  15685.                 return '';
  15686.               } else {
  15687.                 return cordova.file.dataDirectory + image;
  15688.               }
  15689.             };
  15690.            
  15691.        
  15692.            
  15693.             $scope.uploadImage = function(product_id,product_name,category,price,img,description) {
  15694.                   // Destination URL
  15695.                   var url = "http://dxplor.com/dxplor/assets/upload.php";
  15696.                  
  15697.                   var targetPath = $scope.pathForImage($scope.image);
  15698.                  
  15699.                   var filename = $scope.image;
  15700.                  
  15701.                   var options = {
  15702.                     fileKey: "file",
  15703.                     fileName: filename,
  15704.                     chunkedMode: false,
  15705.                     mimeType: "multipart/form-data",
  15706.                     params : {'fileName': filename}
  15707.                   };
  15708.                  
  15709.                   var uploadsuccess=false;
  15710.                  
  15711.                   $cordovaFileTransfer.upload(url, targetPath, options).then(function(result) {
  15712.                       uploadsuccess=true;
  15713.                   });
  15714.            
  15715.                   console.log("uploadsuccess->"+uploadsuccess);
  15716.                 //  if(uploadsuccess)
  15717.                     //  {
  15718.                      
  15719.                       $http.post('http://dxplor.com/dxplor/Mo_marketplace/do_upload', {product_id : product_id,product_name : product_name,category : category,price : price,img:filename,
  15720.                           description:description,idfleamarket:$localStorage.customerid})
  15721.  
  15722.                       .success(function(data, status, headers,config){
  15723.  
  15724.                         console.log('data success');
  15725.  
  15726.                         console.log(data);
  15727.                        
  15728.                         $scope.showAlert('Success', 'Add new product success');
  15729.                         $state.go('snd.shopdashboard');
  15730.  
  15731.  
  15732.  
  15733.                       })
  15734.  
  15735.                      
  15736.  
  15737.                   .error(function(data, status, headers,config){
  15738.  
  15739.                     console.log('data error');
  15740.                     console.log(data);
  15741.  
  15742.                   })
  15743.  
  15744.                   .then(function(result){
  15745.  
  15746.                     things = result.data;
  15747.  
  15748.                   });
  15749.                      
  15750.                      
  15751.                      
  15752.                 //    }
  15753.                 }
  15754.    
  15755.    
  15756. })
  15757.  
  15758.  
  15759.  
  15760. .controller('EditProductController',  function($scope, $ionicPopup, $state,$ionicSideMenuDelegate,$http,$stateParams) {
  15761.  
  15762. console.log("di Edit Product");
  15763.  
  15764. console.log($stateParams.productid);
  15765.  
  15766. $http.get('http://dxplor.com/dxplor/Mo_product_detail/'+$stateParams.productid)
  15767.  
  15768. .success(function(data, status, headers,config){
  15769.  
  15770. console.log(data);
  15771.  
  15772.  
  15773.  
  15774.   var res = data.split(",");
  15775.  
  15776.  
  15777.  
  15778.   $scope.product_id = res[0];
  15779.  
  15780.   $scope.product_name = res[1];
  15781.  
  15782.   $scope.price = parseInt(res[2]);
  15783.  
  15784.   $scope.description = res[3];
  15785.  
  15786.   $scope.image = res[4];
  15787.  
  15788.   $scope.category_id = res[5];
  15789.  
  15790.   $scope.category_name = res[6];
  15791.  
  15792.  
  15793.  
  15794.   $http.get('http://dxplor.com/dxplor/Mo_category')
  15795.  
  15796.     .success(function(data, status, headers,config){
  15797.  
  15798.       console.log('data success');
  15799.  
  15800.       console.log(data); // for browser console
  15801.  
  15802.      
  15803.  
  15804.       $scope.result =  data;
  15805.  
  15806.     })
  15807.  
  15808.     .error(function(data, status, headers,config){
  15809.  
  15810.       console.log('data error');
  15811.  
  15812.     })
  15813.  
  15814.     .then(function(result){
  15815.  
  15816.       things = result.data;
  15817.  
  15818.     });
  15819.  
  15820.   $scope.showAlert = function(title, msg) {
  15821.       var alertPopup = $ionicPopup.alert({
  15822.         title: title,
  15823.         template: msg
  15824.       });
  15825.     };
  15826.  
  15827. });
  15828.  
  15829.  
  15830. $scope.uploadImage = function(product_name,category,price,img,description) {
  15831.       // Destination URL
  15832.      /* var url = "http://dxplor.com/dxplor/assets/upload.php";
  15833.      
  15834.       var targetPath = $scope.pathForImage($scope.image);
  15835.      
  15836.       var filename = $scope.image;
  15837.      
  15838.       var options = {
  15839.         fileKey: "file",
  15840.         fileName: filename,
  15841.         chunkedMode: false,
  15842.         mimeType: "multipart/form-data",
  15843.         params : {'fileName': filename}
  15844.       };
  15845.      
  15846.       var uploadsuccess=false;
  15847.      
  15848.       $cordovaFileTransfer.upload(url, targetPath, options).then(function(result) {
  15849.           uploadsuccess=true;
  15850.       });
  15851. */
  15852.  
  15853.         //  $http.post('http://dxplor.com/dxplor/Mo_marketplace/do_upload', {product_id : product_id,product_name : product_name,category : category,price : price,img:filename,
  15854.            
  15855.       $http.post('http://dxplor.com/dxplor/Mo_marketplace/edit_product', {product_id : $stateParams.productid,product_name : product_name,price : price,
  15856.       description:description})
  15857.  
  15858.            .success(function(data, status, headers,config){
  15859.  
  15860.             console.log('data success');
  15861.             console.log(data);
  15862.            
  15863.             $scope.showAlert('Success', 'Edit product success');
  15864.             $state.go('snd.shopdashboard');
  15865.  
  15866.           })
  15867.  
  15868.       .error(function(data, status, headers,config){
  15869.  
  15870.         console.log('data error');
  15871.         console.log(data);
  15872.  
  15873.       })
  15874.  
  15875.       .then(function(result){
  15876.  
  15877.         things = result.data;
  15878.  
  15879.       });
  15880.          
  15881.          
  15882.     }
  15883.  
  15884.  
  15885.  
  15886. })
  15887.  
  15888.  
  15889.  
  15890. /* start slideshow */
  15891.  
  15892. $scope.options = {
  15893.  
  15894.   loop: true,
  15895.  
  15896.   effect: 'fade',
  15897.  
  15898.   speed: 500,
  15899.  
  15900.  
  15901.  
  15902. }
  15903.  
  15904.  
  15905.  
  15906. $scope.$on("$ionicSlides.sliderInitialized", function(event, data){
  15907.  
  15908.   // data.slider is the instance of Swiper
  15909.  
  15910.   $scope.slider = data.slider;
  15911.  
  15912. });
  15913.  
  15914.  
  15915.  
  15916. $scope.$on("$ionicSlides.slideChangeStart", function(event, data){
  15917.  
  15918.   console.log('Slide change is beginning');
  15919.  
  15920. });
  15921.  
  15922.  
  15923.  
  15924. $scope.$on("$ionicSlides.slideChangeEnd", function(event, data){
  15925.  
  15926.   // note: the indexes are 0-based
  15927.  
  15928.   $scope.activeIndex = data.slider.activeIndex;
  15929.  
  15930.   $scope.previousIndex = data.slider.previousIndex;
  15931.  
  15932. });
  15933.  
  15934.  
  15935.  
  15936. /* end slideshow */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement