Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*global angular*/
  2.  
  3. var app = angular.module("myApp", ['ui.router']);
  4.  
  5. app.service('User', function(){
  6.     var Acc;
  7.     var User;
  8.     this.save = function(Acc,User){
  9.         this.Acc=Acc;
  10.         this.User=User;
  11.     }
  12.    
  13.     this.getAcc = function(){
  14.         return Acc;
  15.     }
  16.    
  17.     this.getUser = function(){
  18.         return User;
  19.     }
  20. })
  21.  
  22. app.directive('yearDrop',function(){
  23.     function getYears(offset){
  24.         var currentYear = 1990;
  25.         var range = new Date().getFullYear()-currentYear;
  26.         var years = [];
  27.         for (var i = 0; i < range + 1; i++){
  28.             years.push(currentYear + offset + i);
  29.         }
  30.         return years;
  31.     }
  32.     return {
  33.         link: function(scope,element,attrs){
  34.             scope.years = getYears(+attrs.offset);
  35.         },
  36.         template: 'Year:<select class="form-control" data-ng-model="selectedYear" data-ng-options="y for y in years" data-ng-change="updateYear(selectedYear)"></select>'
  37.     }
  38. });
  39.  
  40. app.directive('yearDrop2',function(){
  41.     function getYears(offset){
  42.         var currentYear = 1990;
  43.         var range = new Date().getFullYear()-currentYear;
  44.         var years = [];
  45.         for (var i = 0; i < range + 1; i++){
  46.             years.push(currentYear + offset + i);
  47.         }
  48.         return years;
  49.     }
  50.     return {
  51.         link: function(scope,element,attrs){
  52.             scope.years = getYears(+attrs.offset);
  53.         },
  54.         template: 'Year:<select class="form-control" data-ng-model="selectedYear2" data-ng-options="y for y in years" data-ng-change="updateYear2(selectedYear2)"></select>'
  55.     }
  56. });
  57.  
  58. app.value("acc",'Officer');
  59.  
  60. document.addEventListener('DOMContentLoaded', function () {
  61.     if (!Notification) {
  62.       alert('Desktop notifications not available in your browser. Try Chromium.');
  63.       return;
  64.     }
  65.     if (Notification.permission !== "granted")
  66.         Notification.requestPermission();
  67.     });
  68.  
  69. app.controller("myCtrl", function ($scope, $http,$state,acc, User) {
  70.     'use strict';
  71.    
  72.    
  73.     $scope.required = true;
  74.  
  75.     $scope.invenMode = 'add';
  76.     $scope.salesMode = 'add';
  77.    
  78.     $scope.chngInvenMode  = function (id) {
  79.         $scope.invenMode = 'edit';
  80.         $scope.iid = id;
  81.     };
  82.    
  83.     $scope.chngSalesMode  = function (id) {
  84.         $scope.salesMode = 'edit';
  85.         $scope.sid = id;
  86.     };
  87.    
  88.     $scope.addMode  = function () {
  89.         $scope.salesMode = 'add';
  90.     };
  91.    
  92.     $scope.addMode2 = function () {
  93.         $scope.invenMode = 'add';
  94.     }
  95.    
  96.     $scope.rCode = "";
  97.     $scope.codeIsCorrect=false;
  98.    
  99.     $scope.temp="";
  100.    
  101.     $scope.IDu = "";
  102.     $scope.Acc = "";
  103.    
  104.     $scope.notifyMe = function(message) {
  105.         if (Notification.permission !== "granted")
  106.             Notification.requestPermission();
  107.         else {
  108.             for(var i=0;i<message.length;i++)
  109.             {
  110.                 var diff = 5 - message[i].units;
  111.                 var notification = new Notification('Low Stock Notification', {
  112.                 icon: 'http://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png',
  113.                 body: message[i].itemName + " is below minimum amount of stock " + "for "+ diff + " units" ,
  114.                 });  
  115.             }
  116.  
  117.             notification.onclick = function () {
  118.               $state.go("InvenMan");      
  119.             };
  120.         }
  121.     }
  122.    
  123.     $scope.checkInven = function(){
  124.         $http.get('php/notification.php')
  125.         .then (
  126.         function(response) {
  127.             $scope.lowStocks = response.data;
  128.             $scope.notifyMe($scope.lowStocks);
  129.         },
  130.         function(response) {
  131.         // error handling routine
  132.         });    
  133.     }
  134.  
  135.    
  136.     $scope.adminCheck = function(adminID,adminPW){
  137.     $scope.stopSession();
  138.     var url = "php/loginCheck.php";
  139.     var data = $.param({adminID:adminID, adminPW:adminPW});
  140.     var config = {
  141.         headers:{
  142.             'Content-Type':'application/x-www-form-urlencoded;charset=utf-8;'
  143.         }
  144.     };
  145.    
  146.     $http.post(url,data,config)
  147.         .then(
  148.             function(response){
  149.                 if (response.data)
  150.                 {
  151.                     $scope.admin = response.data;
  152.                     if($scope.admin == 'Invalid Admin ID or Password')
  153.                         $scope.adminProceed = false;
  154.                     else
  155.                         {
  156.                         $scope.adminProceed = true;
  157.                         $scope.IDu = $scope.admin;
  158.                         console.log($scope.IDu);
  159.                         $scope.adminGet(adminID);
  160.                         window.location.href="home.html";  
  161.                        
  162.                         }
  163.                    // console.log($scope.adminProceed);
  164.                 }
  165.             }, function (response)
  166.             {  
  167.             });
  168.     };
  169.    
  170.     $scope.adminGet = function(adminID){
  171.     var url = "php/getAcc.php";
  172.     var data = $.param({adminID:adminID});
  173.     var config = {
  174.         headers:{
  175.             'Content-Type':'application/x-www-form-urlencoded;charset=utf-8;'
  176.         }
  177.     };
  178.    
  179.     $http.post(url,data,config)
  180.         .then(
  181.             function(response){
  182.                 if (response.data)
  183.                 {
  184.                    
  185.                     $scope.get = [];
  186.                     $scope.get = response.data;
  187.                    
  188.                     $scope.IDu = $scope.get[0].UserID;
  189.                     $scope.Acc = $scope.get[0].AccountType;
  190.                    
  191.                    
  192.                     $scope.startSession($scope.IDu, $scope.Acc);
  193.                     console.log($scope.get);
  194.                     console.log($scope.IDu);
  195.                     console.log($scope.Acc);
  196.                 }
  197.             }, function (response)
  198.             {  
  199.                
  200.             });
  201.     };
  202.    
  203.     $scope.startSession = function (userID,Acc){
  204.         var url = "php/session.php";
  205.         var data = $.param({userID:userID, Acc:Acc});
  206.         var config = {
  207.         headers:{
  208.             'Content-Type':'application/x-www-form-urlencoded;charset=utf-8;'
  209.         }
  210.         };
  211.        
  212.         $http.post(url,data,config)
  213.             .then(
  214.             function(response){
  215.                 if(response.data)
  216.                 {
  217.                      $scope.temp = response.data;
  218.                     console.log($scope.temp);
  219.                 }
  220.             }
  221.         )
  222.    
  223.     };
  224.    
  225.     $scope.stopSession = function(){
  226.         var url = "php/logout.php";
  227.         var data = null;
  228.         var config = {
  229.         headers:{
  230.             'Content-Type':'application/x-www-form-urlencoded;charset=utf-8;'
  231.         }
  232.         };
  233.        
  234.         $http.post(url,data,config)
  235.             .then(
  236.             function(response){
  237.                 if(response.data)
  238.                 {
  239.                      $scope.temp = response.data;
  240.                     console.log($scope.temp);
  241.                 }
  242.             }
  243.         )
  244.    
  245.     };
  246.    
  247.    
  248.     $scope.adminRegis = function (userName,password,account){
  249.         if($scope.codeIsCorrect == true){
  250.         var url = "php/register.php"
  251.         var data = $.param({
  252.             UserID : userName,
  253.             UserPassword : password,
  254.             AccountType : account
  255.         });
  256.        
  257.         var config = {
  258.         headers:{
  259.             'Content-Type':'application/x-www-form-urlencoded;charset=utf-8;'
  260.             }
  261.         };
  262.        
  263.         $http.post(url,data,config)
  264.         .then(
  265.                 function (response) {
  266.                     $scope.msg3 = response.data;
  267.  
  268.                 },
  269.                 function (response) {
  270.                     $scope.msg3 = response.data;
  271.                 }
  272.             );
  273.         } else{
  274.             $scope.msg3 = "Please double check your field";
  275.         }
  276.        
  277.     };
  278.    
  279.     $scope.logout = function(){
  280.         window.location.href="index.html";
  281.         $scope.stopSession();
  282.     }
  283.    
  284.     $scope.checkcode = function(input){
  285.                          
  286.         if(input!='' && input == $scope.rCode)
  287.         {
  288.             $scope.codemsg ="Your code is correct, please proceed";
  289.             $scope.codeIsCorrect = true;
  290.         }
  291.        
  292.         if(input!='' && input != $scope.rCode)
  293.         {
  294.             $scope.codemsg ="Your code is incorrect, please check with your supervisor";
  295.  
  296.         }
  297.     };
  298.        
  299.     $scope.getCode = function(acctype){
  300.         $scope.inputcode ="";
  301.         $scope.codemsg ="";
  302.         $scope.codeIsCorrect=false;
  303.  
  304.         console.log(acctype);
  305.         if(acctype=="Admin"){
  306.             $http.get('php/getCode1.php')  
  307.             .then(
  308.                 function (response) {
  309.                     $scope.codes = [];
  310.                     $scope.codes= response.data;
  311.                    
  312.                     $scope.rCode = $scope.codes[0].Code;
  313.                     console.log($scope.rCode);
  314.                 },
  315.                 function (response) {
  316.                     alert(response.data);
  317.                 }
  318.             );    
  319.            
  320.         }
  321.         else if (acctype == "Officer")
  322.         {
  323.             $http.get('php/getCode2.php')  
  324.             .then(
  325.                 function (response) {
  326.                     $scope.codes = [];
  327.                     $scope.codes= response.data;
  328.                    
  329.                     $scope.rCode = $scope.codes[0].Code;
  330.                     console.log($scope.rCode);
  331.  
  332.                 },
  333.                 function (response) {
  334.                     alert(response.data);
  335.                 }
  336.             );  
  337.            
  338.         }
  339.         else{
  340.             $http.get('php/getCode3.php')  
  341.             .then(
  342.                 function (response) {
  343.                     $scope.codes = [];
  344.                     $scope.codes= response.data;
  345.                    
  346.                     $scope.rCode = $scope.codes[0].Code;
  347.                     console.log($scope.rCode);
  348.  
  349.                 },
  350.                 function (response) {
  351.                     alert(response.data);
  352.                 }
  353.             );
  354.         }      
  355.        
  356.        
  357.     }
  358.    
  359. });
  360.  
  361. app.controller("salesCtrl",function($scope,$http,$window,$stateParams,acc, User){
  362.     'use strict';
  363.    
  364.  
  365.    
  366.     //$scope.sid = 0;
  367.     console.log($scope.sid);
  368.     console.log($stateParams.id);
  369.    /* $scope.sales= [
  370.         {"sID":"1", itemName:"Pills", "itemUnit":"1", "clientName":"????", "clientContact":"123","uID":"1","sDate":"11-11-1111"}
  371.     ];*/
  372.    
  373.    
  374.     $scope.temp1 ='';
  375.     $scope.temp2 ='';
  376.    
  377.     $scope.updatetemp1 = function(i){
  378.         $scope.temp1 = i;
  379.     }
  380.    
  381.     $scope.updatetemp2 = function(i){
  382.         $scope.temp2 = i;
  383.     }
  384.      
  385.    
  386.     $scope.type = acc;
  387.     $scope.IDuser = 'Ambrose';
  388.  
  389.    
  390.  
  391.    
  392.  
  393.     $scope.selectedMonth="";
  394.     $scope.filtermode="Month";
  395.    
  396.     $scope.selectedMonthFilter = function(element) {
  397.        
  398.         if(!$scope.selectedMonth)
  399.         {
  400.             return true;
  401.         }
  402.         console.log($scope.selectedMonth);
  403.         return element.SalesDate.split("-")[1] == $scope.selectedMonth;        
  404.        
  405.     }
  406.    
  407.     $scope.updateMonth = function(a) {
  408.         $scope.selectedMonth=a;
  409.     }
  410.    
  411.     $scope.selectedYearFilter = function(element) {
  412.        
  413.         if(!$scope.selectedYear)
  414.         {
  415.             return true;
  416.         }
  417.         console.log($scope.selectedYear);
  418.         return element.SalesDate.split("-")[0] == $scope.selectedYear;        
  419.     }
  420.    
  421.     $scope.updateYear = function(a) {
  422.         $scope.selectedYear=a;
  423.     }
  424.    
  425.    
  426.    
  427.     $scope.getSales = function(){
  428.         $http.get('php/phpapi.php/sales')
  429.         .then (
  430.         function(response) {
  431.             $scope.salesData = response.data;
  432.             $scope.currentID = $scope.salesData.length;
  433.  
  434.         },
  435.         function(response) {
  436.         // error handling routine
  437.         });    
  438.     }
  439.     $scope.getSales();
  440.    
  441.     $scope.accGet = function(){
  442.     var url = "php/getInfo.php";
  443.     var data = null;
  444.     var config = {
  445.         headers:{
  446.             'Content-Type':'application/x-www-form-urlencoded;charset=utf-8;'
  447.         }
  448.     };
  449.    
  450.     $http.post(url,data,config)
  451.         .then(
  452.             function(response){
  453.                 if (response.data)
  454.                 {
  455.                    
  456.                     $scope.get = [];
  457.                     $scope.get = response.data;
  458.                    
  459.                     $scope.IDu = $scope.get[0].UserID;
  460.                     $scope.Acc = $scope.get[0].AccountType;
  461.  
  462.                    
  463.                     $scope.updatetemp1 = $scope.IDu;
  464.                     $scope.updatetemp2 = $scope.Acc;
  465.                    
  466.                     console.log($scope.temp1);
  467.                     //console.log($scope.get);
  468.                     console.log($scope.IDu);
  469.                     console.log($scope.Acc);
  470.                 }
  471.             }, function (response)
  472.             {  
  473.                
  474.             });
  475.     };
  476.    
  477.     $scope.accGet();
  478.    
  479.     console.log($scope.temp1);
  480.     console.log($scope.temp2);
  481.    
  482.    
  483.    
  484.    
  485.     $scope.getInven = function(){
  486.         $http.get('php/phpapi.php/inventory')
  487.         .then (
  488.         function(response) {
  489.             $scope.inventoryData = response.data;
  490.            
  491.         },
  492.         function(response) {
  493.         // error handling routine
  494.         });    
  495.     }
  496.     $scope.getInven();
  497.    
  498.     $scope.addSales = function (itemName,itemUnit,clientName,clientContact,sDate, tPrice) {
  499.        var url = "php/salesAdd.php"
  500.         console.log(itemName);
  501.                 console.log(itemUnit);
  502.  
  503.  
  504.         $scope.currentID+=1;
  505.         var data = $.param({
  506.             SalesID : $scope.currentID,
  507.             ItemName: itemName,
  508.             ItemUnitsOrder: itemUnit,
  509.             ClientName: clientName,
  510.             ClientContact: clientContact,
  511.             UserID:'Lester',
  512.             SalesDate:sDate,
  513.             TotalPrice:tPrice
  514.         });
  515.        
  516.         var config = {
  517.         headers:{
  518.             'Content-Type':'application/x-www-form-urlencoded;charset=utf-8;'
  519.             }
  520.         };
  521.        
  522.         $http.post(url,data,config)
  523.         .then(
  524.         function(response){
  525.             if (response.data)
  526.             {
  527.                 $scope.salesData = response.data;
  528.                 console.log("kappa");
  529.             }
  530.         }, function (response)
  531.         {
  532.            
  533.         });
  534.  
  535.         $window.location.reload();
  536.    };
  537.    
  538.    $scope.getSalesQty = function(year,month){
  539.         var url = "php/getSalesQty.php"
  540.        
  541.         $scope.currentID+=1;
  542.         var data = $.param({
  543.             Year : year,
  544.             Month: month
  545.         });
  546.        
  547.         var config = {
  548.         headers:{
  549.             'Content-Type':'application/x-www-form-urlencoded;charset=utf-8;'
  550.             }
  551.         };
  552.        
  553.         $http.post(url,data,config)
  554.         .then(
  555.         function(response){
  556.             if (response.data)
  557.             {
  558.                 $scope.qtyItem = response.data;
  559.                 $scope.callPieChart($scope.qtyItem);
  560.                 console.log($scope.qtyItem);
  561.             }
  562.         }, function (response)
  563.         {
  564.            
  565.         });
  566.    }
  567.    
  568.    $scope.getSalesQtyMonth = function(year){
  569.             var url = "php/getSalesQtyMonth.php"
  570.  
  571.             var data = $.param({
  572.                 Year : year
  573.             });
  574.  
  575.             var config = {
  576.             headers:{
  577.                 'Content-Type':'application/x-www-form-urlencoded;charset=utf-8;'
  578.                 }
  579.             };
  580.  
  581.             $http.post(url,data,config)
  582.             .then(
  583.             function(response){
  584.                 if (response.data)
  585.                 {
  586.                     $scope.qtyItemMonth = response.data;
  587.                     $scope.callLineChart($scope.qtyItemMonth);
  588.                     console.log($scope.qtyItemMonth);
  589.                 }
  590.             }, function (response)
  591.             {
  592.  
  593.             });
  594.    }
  595.  
  596.    $scope.callPieChart = function(item){
  597.         Chart.defaults.global.responsive = true;
  598.         // pie chart data
  599.        
  600.         var pieData = item;
  601.         console.log(pieData);
  602.         var pieOptions = {
  603.             segmentShowStroke : false,
  604.             animateScale : true
  605.         }
  606.         var salesqty= document.getElementById("totalqty").getContext("2d");
  607.         new Chart(salesqty).Pie(pieData, pieOptions);
  608.    }
  609.    
  610.    $scope.callLineChart = function(item){
  611.        Chart.defaults.global.responsive = true;
  612.        var datasets=[];
  613.        function getRandomColor() {
  614.            var letters = '0123456789ABCDEF'.split('');
  615.            var color = '#';
  616.            for (var i = 0; i < 6; i++ ) {
  617.                color += letters[Math.floor(Math.random() * 16)];
  618.            }
  619.            return color;
  620.        }
  621.        
  622.        for (var i = 0; i < item.length; i++) {
  623.           var color = getRandomColor();
  624.           datasets.push({});
  625.           datasets[i].labels= item[i].name;
  626.           datasets[i].fillColor = "rgba(172,194,132,0.4)";
  627.           datasets[i].strokeColor = color;
  628.           datasets[i].pointColor = color;
  629.           datasets[i].pointStrokeColor = color;
  630.           datasets[i].data= item[i].data;
  631.        }
  632.        
  633.         var SalesData = {
  634.             labels : ["Jan","Feb","Mar","Apr","May","Jun","July","Aug","Sep","Oct","Nov","Dec"],
  635.             datasets
  636.         }
  637.         var sales = document.getElementById('totalqtyYear').getContext('2d');
  638.         new Chart(sales).Line(SalesData);
  639.    }
  640.    
  641.    
  642.    $scope.removeSales = function (salesID) {
  643.    //     $scope.sales.splice($index, 1);
  644.        var url = "php/deleteSales.php", data = $.param({sID:salesID}), config ={
  645.            headers : {
  646.                'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
  647.            }
  648.        };
  649.        
  650.        $http.put(url, data, config)
  651.             .then(
  652.                 function(response){
  653.                     $scope.msg = response.data;
  654.                 },
  655.                 function(response) {
  656.                     $scope.msg = response.data;
  657.                 }
  658.                          
  659.        );
  660.        $window.location.reload();
  661.    };
  662.    
  663.   $scope.LoadData = function(iname,iorder,cname,ccontact,cDate){
  664.       $scope.itemName2=iname;
  665.       $scope.itemUnit2=parseInt(iorder);
  666.       $scope.clientName2=cname;
  667.       $scope.clientContact2=ccontact;
  668.       $scope.sDate2=cDate;
  669.   }
  670.  
  671.   $scope.editSales = function(name,unit,client,contact){
  672.       var url = "php/salesEdit.php";
  673.       var data = $.param({
  674.           snm : name,
  675.           iord : unit,
  676.           cnm : client,
  677.           ccn : contact,
  678.           sID : $scope.sid
  679.       });
  680.       console.log($scope.itemName2);
  681.       var config = {
  682.           headers : {
  683.               'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
  684.           }
  685.       };
  686.      
  687.       $http.put(url, data, config)
  688.             .then(
  689.                 function (response) {
  690.                     $scope.msg2 = response.data;
  691.  
  692.                 },
  693.                 function (response) {
  694.                     $scope.msg2 = response.data;
  695.                 }
  696.             );
  697.       $window.location.reload();
  698.      
  699.   }  
  700.  
  701.  
  702.  
  703. });
  704.  
  705. app.controller("invenCtrl",function($scope,$http,$window, acc){
  706.    
  707.     $scope.type = acc;
  708.     console.log($scope.type);
  709.    
  710.     'use strict';
  711.     $scope.getInven = function(){
  712.         $http.get('php/phpapi.php/inventory')
  713.         .then (
  714.         function(response) {
  715.             $scope.inventoryData = response.data;
  716.             console.log(response.data);
  717.            
  718.         },
  719.         function(response) {
  720.         // error handling routine
  721.         });    
  722.     }
  723.     $scope.getInven();
  724.    
  725.     $scope.addInven = function (itemName,itemAmount,itemDescription,itemPrice,UnitsOrder) {
  726.         var url = "php/invenAdd.php";
  727.         var data = $.param({itemName:itemName, itemAmount:itemAmount,itemDescription:itemDescription,itemPrice:itemPrice,UnitsOrder:UnitsOrder});
  728.         var config = {
  729.         headers:{
  730.             'Content-Type':'application/x-www-form-urlencoded;charset=utf-8;'
  731.         }
  732.         };
  733.    
  734.         $http.post(url,data,config)
  735.         .then(
  736.         function(response){
  737.             if (response.data)
  738.             {
  739.                 $scope.add = response.data;
  740.                 $scope.getInven();
  741.             }
  742.         }, function (response)
  743.         {
  744.            
  745.         });
  746.         $window.location.reload();
  747.     };
  748.    
  749.     $scope.removeInventory = function (itemName) {
  750.        var url = "php/removeInven.php", data = $.param({iID:itemName}), config ={
  751.            headers : {
  752.                'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
  753.            }
  754.        };
  755.        
  756.        $http.put(url, data, config)
  757.             .then(
  758.                 function(response){
  759.                     $scope.msg = response.data;
  760.                 },
  761.                 function(response) {
  762.                     $scope.msg = response.data;
  763.                 }
  764.                          
  765.        );
  766.        $window.location.reload();
  767.    };
  768.    
  769.     $scope.LoadData = function(idesc,iamount,iprice,uorder){
  770.       $scope.itemEditDesc=idesc;
  771.       $scope.itemEditAmount=parseInt(iamount);
  772.       $scope.itemEditPrice=parseInt(iprice);
  773.       $scope.itemEditOrder=parseInt(uorder);
  774.   }
  775.    
  776.     $scope.manageInven = function(desc,amount,price,unitorder){
  777.       var url = "php/invenManage.php";
  778.       var data = $.param({
  779.           dsc : desc,
  780.           amn : amount,
  781.           prc : price,
  782.           uio : unitorder,
  783.           iID : $scope.iid
  784.       });
  785.      
  786.       var config = {
  787.           headers : {
  788.               'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
  789.           }
  790.       };
  791.      
  792.       $http.put(url, data, config)
  793.             .then(
  794.                 function (response) {
  795.                     $scope.msg2 = response.data;
  796.  
  797.                 },
  798.                 function (response) {
  799.                     $scope.msg2 = response.data;
  800.                 }
  801.             );
  802.       $window.location.reload();
  803.      
  804.   }
  805.    
  806. //   $scope.inven= [
  807. //        {itemName:"Pills", "itemAmount":3, "itemDescription":"A powerful pill", "itemPrice":10.00,"UnitsOrder":1}
  808. //    ];
  809. //    $scope.addInven = function (itemName,itemAmount,itemDescription,itemPrice,UnitsOrder) {
  810. //
  811. //       var input = {itemName: itemName,
  812. //                 itemAmount:itemAmount,
  813. //                 itemDescription:itemDescription,
  814. //                 itemPrice:itemPrice,
  815. //                 UnitsOrder:UnitsOrder,
  816. //                 };      
  817. //
  818. //        $scope.inven.push(input);      
  819. //
  820. //
  821. //        $scope.itemName ="";
  822. //      
  823. //   };
  824.    
  825.    
  826.    
  827.    
  828. });
  829.  
  830.  
  831. //routing for ui-router
  832. app.config(function ($stateProvider, $urlRouterProvider) {
  833.     'use strict';
  834.     $urlRouterProvider.otherwise("/");
  835.    
  836.     $stateProvider
  837.        
  838.         .state('/', {
  839.             url: '/',
  840.             templateUrl: "homecontent.html"
  841.        
  842.         })        
  843.        
  844.         .state('SalesMan', {
  845.             url: '/SalesManagement',
  846.             templateUrl: "sales.html"
  847.        
  848.         }) 
  849.        
  850.         .state('SalesAnalyse', {
  851.             url: '/SalesAnalyse',
  852.             templateUrl: "graph.html"
  853.        
  854.         }) 
  855.    
  856.         .state('InvenMan', {
  857.             url: '/InvenManagement',
  858.             templateUrl: "inven.html"
  859.        
  860.         })
  861.    
  862. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement