Guest User

Untitled

a guest
Jan 20th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var App = Em.Application.create();
  2.  
  3. //Put classes here:
  4. //This creates a class "ProductsController" which subclasses ArrayController -> can be used by handlebars to print each element.
  5. App.ProductsController = Em.ArrayController.create();
  6. App.UsersController = Em.ArrayController.create();
  7. App.CustomersController = Em.ArrayController.create();
  8. App.StoragesController = Em.ArrayController.create();
  9. App.QuantitiesController = Em.ArrayController.create();
  10. App.TransactionsController = Em.ArrayController.create();
  11. App.ReservationsController = Em.ArrayController.create();
  12. App.StoresController = Em.ArrayController.create();
  13. App.TransactionProductController = Em.ArrayController.create();
  14.  
  15. //Product class
  16. //Add all functions we want to manipulate product data with here.
  17. App.Product = Em.Object.extend();
  18. App.User = Em.Object.extend();
  19. App.Customer = App.User.extend();
  20. App.Storage = Em.Object.extend();
  21. App.Quantity = Em.Object.extend();
  22. App.Transaction = Em.Object.extend();
  23. App.Reservation = Em.Object.extend();
  24. App.Store = Em.Object.extend();
  25. App.TransactionProduct = App.Product.extend({
  26.     quantity: 1
  27. });
  28.  
  29. //Views go here. They specify the naming types and such which is mapped directly to the html.
  30. App.ProductView = Em.View.extend({
  31.   tagName: 'div',
  32.   templateName: 'product-template',
  33.   classNames: ["product"]
  34. });
  35.  
  36. App.UserView = Em.View.extend({
  37.   tagName: 'div',
  38.   templateName: 'user-template',
  39.   classNames: ["user"]
  40. });
  41.  
  42. App.CustomerView = Em.View.extend({
  43.   tagName: 'div',
  44.   templateName: 'customer-template',
  45.   classNames: ["customer"]
  46. });
  47.  
  48. App.MainView = Em.View.extend({
  49.     tagName: 'div',
  50.     templateName: 'main-template',
  51.     classNames: ["main"]
  52. });
  53.  
  54. App.TransactionProductView = Em.View.extend({
  55.     tagName: 'div',
  56.     templateName: 'transaction-product-template',
  57.     classNames: ["transaction-products"]
  58. });
  59.  
  60. App.ReservationView = Em.View.extend({
  61.     tagName: 'div',
  62.     templateName: 'reserve-product-template',
  63.     classNames: ["reserve-products"]
  64. });
  65.  
  66. //This maps to the words "Add Product" in the html. Does a "POST" call to the database. If you look at app.rb, the command inserts the new product into the database.
  67. /*App.InsertProductView = Em.View.extend({
  68.   tagName: 'div',
  69.   templateName: 'product-insert-template',
  70.   classNames: ["product-insert"],
  71.   mouseDown: function() {
  72.     //Hardcoding data for products.
  73.     var newProduct = {
  74.       name: "Fantastic Stuff",
  75.       productPrice: 99
  76.     }
  77.     $.post("/products", {product: newProduct}, function(data, s, x) {
  78.       App.ProductsController.pushObject(App.Product.create(newProduct));
  79.     });
  80.   }
  81. });*/
  82.  
  83. $.get('/products', function(data) {
  84.   var products = $.map(JSON.parse(data), function(o, i) {
  85.       var p = App.Product.create();
  86.       p.setProperties(o.product);
  87.     return p;
  88.   });
  89.   App.ProductsController.set('content', products);
  90. });
  91.  
  92. $.get('/customers', function(data) {
  93.   var customers = $.map(JSON.parse(data), function(o, i) {
  94.       var c = App.Customer.create();
  95.       c.setProperties(o.customer);
  96.     return c;
  97.   });
  98.   App.CustomersController.set('content', customers);
  99. });
  100.  
  101. $.get('/users', function(data) {
  102.   var users = $.map(JSON.parse(data), function(o, i) {
  103.       var u = App.User.create();
  104.       u.setProperties(o.user);
  105.     return u;
  106.   });
  107.   App.UsersController.set('content', users);
  108. });
  109.  
  110. $.get('/storages', function(data) {
  111.     var storages = $.map(JSON.parse(data), function(o, i) {
  112.         var s = App.Storage.create();
  113.         s.setProperties(o.storage);
  114.         return s;
  115.     });
  116.     App.StoragesController.set('content', storages);
  117. });
  118.  
  119. $.get('/quantities', function(data) {
  120.     var quantities = $.map(JSON.parse(data), function(o, i) {
  121.         var q = App.Quantity.create();
  122.         q.setProperties(o.quantity);
  123.         return q;
  124.     });
  125.     App.QuantitiesController.set('content', quantities);
  126. });
  127.  
  128. $.get('/transactions', function(data) {
  129.     var transactions = $.map(JSON.parse(data), function(o, i) {
  130.         var t = App.Transaction.create();
  131.         t.setProperties(o.transaction);
  132.         return t;
  133.     });
  134.     App.TransactionsController.set('content', transactions);
  135. });
  136.  
  137. $.get('/reservations', function(data) {
  138.     var reservations = $.map(JSON.parse(data), function(o, i) {
  139.         var r = App.Reservation.create();
  140.         r.setProperties(o.reservation);
  141.         return r;
  142.     });
  143.     App.ReservationsController.set('content', reservations);
  144. });
  145.  
  146. $.get('/stores', function(data) {
  147.     var stores = $.map(JSON.parse(data), function(o, i) {
  148.         var s = App.Store.create();
  149.         s.setProperties(o.store);
  150.         return s;
  151.     });
  152.     App.StoresController.set('content', stores);
  153. });
  154.  
  155. App.UpdateProductView = Em.View.extend({
  156.     tagName: 'div',
  157.     templateName: 'product-update-template',
  158.     classNames: ["product-update"],
  159.     mouseDown: function() {
  160.         var productToUpdate = this.get('element');
  161.         console.log(productToUpdate);
  162.         if (false) {
  163.             var productToUpdate = {
  164.                 name: "Newer Stuff",
  165.                 productPrice: 33
  166.             }
  167.             $.ajax ({
  168.                 type: 'PUT',
  169.                 url: '/products/' + product.id,
  170.                 data: productToUpdate,
  171.                 success: function(data) {
  172.                
  173.                 }
  174.             })
  175.         }
  176.     }
  177. });
  178.  
  179. //this is for users, new user
  180. App.InsertUserView = Em.View.extend({
  181.   tagName: 'div',
  182.   templateName: 'user-insert-template',
  183.   classNames: ["user-insert"],
  184.   mouseDown: function() {
  185.     //Hardcoding data for user.
  186.     var newUser = {
  187.        firstName: "Fantastic",
  188.         lastName: "User"
  189.      }
  190.      $.post("/users", {user: newUser}, function(data, s, x) {
  191.        App.UsersController.pushObject(App.User.create(newUser));
  192.      });  
  193.   }
  194. });
  195.  
  196. App.LoginFormView = Em.View.extend({
  197.     tagName: "div",
  198.     templateName: "login-form-template",
  199.     classNames: ["basic-form"],
  200.     firstName: '',
  201.     password: '',
  202.    
  203.     submit: function(event) {
  204.         var loginUser = {
  205.             firstName: this.get('firstName'),
  206.             password: this.get('password')
  207.         }
  208.         $.post("/login/" + loginUser.firstName + "/" + loginUser.password, {user: loginUser}, function(data, s, x) {
  209.             var d = JSON.parse(data);
  210.             if (d.error) {
  211.                 //Show error "wrong password"
  212.                 alert(d.error);
  213.             } else {
  214.                 //Show label "logged in"
  215.                 $(".not-logged-in").hide();
  216.                 $(".logged-in").show();
  217.             }
  218.         });
  219.     }
  220. });
  221.  
  222. /* SALES FORMS */
  223. /* -------------------------------------------------------------------------------------------- */
  224. App.TransactionView = Em.View.extend({
  225.     tagName: "div",
  226.     templateName: "transaction-form-template",
  227.     classNames: ["basic-form"],
  228.     ProductID: '',
  229.     Quantity: '',
  230.     CustomerID: '',
  231.     discount: 1,
  232.    
  233.     addProduct: function(event) {
  234.         var prodID = this.get('ProductID');
  235.         var prodQuant = this.get('Quantity');
  236.         var CustomerID = this.get('CustomerID');
  237.         var numProducts = $(".num-products").val();
  238.         var discount = this.get('discount');
  239.         function getProduct() {
  240.             $.get('/products/' + prodID, function(data) {
  241.                 var product = App.TransactionProduct.create();
  242.                 var tProdData = JSON.parse(data);
  243.                 tProdData.product.quantity = prodQuant;
  244.                 tProdData.product.productPrice = prodQuant*tProdData.product.productPrice*discount;
  245.                 product.setProperties(tProdData);
  246.                 App.TransactionProductController.pushObject(product.product);
  247.                 ++numProducts;
  248.                 $(".num-products").val(numProducts);
  249.                 updatePrice(numProducts);
  250.             });
  251.         }
  252.         function updatePrice(numProducts) {
  253.             var p = App.TransactionProductController.get('content').get(numProducts-1);
  254.             var totalPrice = $(".total-price").val();
  255.             var price = parseFloat(totalPrice) + p.productPrice;
  256.             $(".total-price").val(price);
  257.         }
  258.         getProduct();
  259.     },
  260.     applyDiscount: function(event) {
  261.         var discount = 1 - $(".discount-price").val()/100;
  262.         this.set('discount', discount);
  263.         var newTotal = parseFloat($(".total-price").val())*discount;
  264.         $(".total-price").val(newTotal);
  265.     },
  266.     submit: function(event) {
  267.     }
  268. });
  269.  
  270. App.RemoveFromTransactionView =Em.View.extend({
  271.     tagName: "div",
  272.     templateName: "remove-product-form-template",
  273.     classNames: ["basic-form"],
  274.     ProductName: '',
  275.     Quantity: '',
  276.     CustomerID: '',
  277.    
  278.     submit: function(event) {
  279.         var pName = this.get('ProductName');
  280.         var quantity = this.get('Quantity');
  281.         var customerID = this.get('CustomerID');
  282.     }
  283. });
  284.  
  285. App.RefundProductView =Em.View.extend({
  286.     tagName: "div",
  287.     templateName: "refund-product-form-template",
  288.     classNames: ["basic-form"],
  289.     ProductName: '',
  290.     Quantity: '',
  291.     Reason: '',
  292.    
  293.     submit: function(event) {
  294.         var pName = this.get('ProductName');
  295.         var quantity = this.get('Quantity');
  296.     }
  297. });
  298. /* -------------------------------------------------------------------------------------------- */
  299.  
  300. /* ORDERING FORMS */
  301. /* -------------------------------------------------------------------------------------------- */
  302. App.ThresholdView = Em.View.extend({
  303.     tagName: "div",
  304.     templateName: "threshold-form-template",
  305.     classNames: ["basic-form"],
  306.     ProductID: '',
  307.     NewThreshold: '',
  308.    
  309.     submit: function(event){
  310.         var ProductID=this.get('ProductID');
  311.         var NewThreshold=this.get('NewThreshold');
  312.         console.log(ProductID + '' + NewThreshold);
  313.     }
  314. });
  315.  
  316. App.AddProductView = Em.View.extend({
  317.     tagName: "div",
  318.     templateName: "add-product-form-template",
  319.     classNames: ["basic-form"],
  320.     ProductName: '',
  321.     Price: '',
  322.     Threshold: '',
  323.    
  324.     submit: function(event) {
  325.         var newProduct = {
  326.             name: this.get('ProductName'),
  327.             productPrice: this.get('Price'),
  328.             productThreshold: this.get('Threshold')
  329.         }
  330.     $.post("/products", {product: newProduct}, function(data, s, x) {
  331.             var d = JSON.parse(data);
  332.             if (d.error) {
  333.                 alert(d.error);
  334.                 if (d.error.name) {
  335.                     $.map(d.error.name, function(x) {
  336.                         alert(x);
  337.                     });
  338.                 }
  339.             } else {
  340.                 App.ProductsController.pushObject(App.Product.create(JSON.parse(data).product));
  341.             }
  342.     });
  343.         this.set('ProductName', '');
  344.         this.set('Price', '');
  345.         this.set('Threshold', '');
  346.     }
  347. });
  348.  
  349. App.ToggleOrderableView =Em.View.extend({
  350.     tagName: "div",
  351.     templateName: "toggle-orderable-form-template",
  352.     classNames: ["basic-form"],
  353.     ProductName: '',
  354.     Quantity: '',
  355.     Orderable: '',
  356.    
  357.     submit: function(event) {
  358.         var pName = this.get('ProductName');
  359.         var quantity = this.get('Quantity');
  360.         var order = this.get('Orderable');
  361.     }
  362. });
  363.  
  364. App.OrderProductsView = Em.View.extend({
  365.     tagName: "div",
  366.     templateName: "order-products-form-template",
  367.     classNames: ["basic-form"],
  368.     ProductID: '',
  369.     Quantity: '',
  370.    
  371.     submit: function(event){
  372.         var ProductID=this.get('ProductID');
  373.         var Quantity=this.get('Quantity');
  374.         console.log(ProductID + '' + NewThreshold);
  375.     }
  376. });
  377.  
  378.  
  379.  
  380. /* -------------------------------------------------------------------------------------------- */
  381.  
  382. /* CUSTOMER FORMS */
  383. /* -------------------------------------------------------------------------------------------- */
  384. App.NewUserView = Em.View.extend ({
  385.     tagName: "div",
  386.     templateName: "new-user-form-template",
  387.     classNames: ["basic-form"],
  388.     FirstName: '',
  389.     LastName: '',
  390.     AccessLevel: '',
  391.    
  392.     submit: function(event){
  393.         if (this.get('AccessLevel') == '') {
  394.             this.set('AccessLevel', 'customer')
  395.             var typeOfUser = 'customer';
  396.         } else {
  397.             typeOfUser = 'user';
  398.         }
  399.         var nUser = {
  400.             firstName: this.get('FirstName'),
  401.             lastName: this.get('LastName'),
  402.             accessLevel: this.get('AccessLevel')
  403.         }
  404.         if (typeOfUser == 'customer') {
  405.             $.post("/users", {user: nUser}, function(data, s, x) {
  406.                 App.UsersController.pushObject(App.User.create(JSON.parse(data).user));
  407.             });
  408.         } else {
  409.            
  410.         }
  411.     }
  412. });
  413.  
  414. App.RemoveCustomerView = Em.View.extend({
  415.     tagName: "div",
  416.     templateName: "removeCustomer-form-template",
  417.     classNames: ["basic-form"],
  418.     firstName: '',
  419.     lastName: '',
  420.    
  421.     submit: function(event) {
  422.         var fName = this.get('firstName');
  423.         var lName = this.get('lastName');
  424.         console.log(fName + ' ' + lName);
  425.     }
  426. });
  427.  
  428. App.ReserveView = Em.View.extend({
  429.     tagName: "div",
  430.     templateName: "reserve-form-template",
  431.     classNames: ["basic-form"],
  432.     ProductID: '',
  433.     Quantity: '',
  434.    
  435.     submit: function(event) {
  436.         var newReservation = {
  437.          product_id: this.get('ProductID'),
  438.          //Hardcoded user atm.
  439.          user_id: "1",
  440.          count: this.get('Quantity')
  441.         }
  442.         $.post("/reservations", {reservation: newReservation}, function(data, s, x) {
  443.             App.ReservationsController.pushObject(App.Reservation.create(JSON.parse(data).reservation));
  444.         });
  445.         this.set('ProductID', '');
  446.         this.set('Quantity', '');
  447.     }
  448. });
  449.  
  450. App.CancelReservationView = Em.View.extend({
  451.     tagName: "div",
  452.     templateName: "cancelReservation-form-template",
  453.     classNames: ["basic-form"],
  454.     productToCancel: '',
  455.     Quantity: '',
  456.    
  457.     submit: function(event) {
  458.         var prodtoCan = this.get('productToCancel');
  459.         var quantity = this.get('quantity');
  460.     }
  461. });
  462.  
  463. /* -------------------------------------------------------------------------------------------- */
  464.  
  465. /* STOCK MOVEMENT FORMS */
  466. /* -------------------------------------------------------------------------------------------- */
  467. App.MoveProductView =Em.View.extend({
  468.     tagName: "div",
  469.     templateName: "MoveProduct-form-template",
  470.     classNames: ["basic-form"],
  471.     StorageOrigin: '',
  472.     StorageDest: '',
  473.     ProductID: '',
  474.     Quantity: '',
  475.    
  476.     submit: function(event){
  477.         var storageOrgin = this.get('StorageOrigin');
  478.         var StorageDest = this.get('StorageDest');
  479.         var ProductID = this.get('ProductID');
  480.         var Quantity = this.get('Quantity');
  481.     }
  482. });
  483.  
  484. App.ToggleSellableView =Em.View.extend({
  485.     tagName: "div",
  486.     templateName: "toggle-sellable-form-template",
  487.     classNames: ["basic-form"],
  488.     ProductName: '',
  489.     Quantity: '',
  490.     Sellable: '',
  491.    
  492.     submit: function(event) {
  493.         var pName = this.get('ProductName');
  494.         var quantity = this.get('Quantity');
  495.         var sell = this.get('Sellable');
  496.     }
  497. });
  498.  
  499. App.NewPriceView = Em.View.extend ({
  500.     tagName: "div",
  501.     templateName: "ModifyPrice-form-template",
  502.     classNames: ["basic-form"],
  503.     ProductID: '',
  504.     NewPrice: '',
  505.    
  506.     submit: function(event){
  507.         var ProductID= this.get('ProductID');
  508.         var NewPrice = this.get('NewPrice');
  509.         console.log(ProductID + '' + newPrice);
  510.     }
  511. });
  512.  
  513. App.ShelfProductView =Em.View.extend({
  514.     tagName: "div",
  515.     templateName: "shelf-product-form-template",
  516.     classNames: ["basic-form"],
  517.     ProductName: '',
  518.     Quantity: '',
  519.     LocationID: '',
  520.    
  521.     submit: function(event) {
  522.         var pName = this.get('ProductName');
  523.         var quantity = this.get('Quantity');
  524.         var lID = this.get('LocationID');
  525.     }
  526. });
  527.  
  528. /* -------------------------------------------------------------------------------------------- */
  529.  
  530. /* SETTINGS FORMS */
  531. /* -------------------------------------------------------------------------------------------- */
  532.  
  533. App.ChangePasswordView =Em.View.extend({
  534.     tagName: "div",
  535.     templateName: "change-password-form-template",
  536.     classNames: ["basic-form"],
  537.     FirstName: '',
  538.     OldPassword: '',
  539.     NewPassword: '',
  540.    
  541.     submit: function(event) {
  542.         var FirstName = this.get('FirstName');
  543.         var oldPass = this.get('OldPassword');
  544.        
  545.     }
  546. });
  547.  
  548.  
  549. /* -------------------------------------------------------------------------------------------- */
  550.  
  551. /* UNUSED FORMS */
  552. /* -------------------------------------------------------------------------------------------- */
  553. App.MoveToStorageView =Em.View.extend({
  554.     tagName: "div",
  555.     templateName: "move-to-storage-template",
  556.     classNames: ["basic-form"],
  557.     ProductName: '',
  558.     Quantity: '',
  559.     LocationID: '',
  560.    
  561.     submit: function(event) {
  562.         var pName = this.get('ProductName');
  563.         var quantity = this.get('Quantity');
  564.         var lID = this.get('LocationID');
  565.     }
  566. });
  567. /* -------------------------------------------------------------------------------------------- */
  568.  
  569. /* Form hide and show functions: */
  570. /* -------------------------------------------------------------------------------------------- */
  571. App.HomeSidebarView = Em.View.extend ({
  572.     templateName: "home-sidebar-template",
  573.    
  574.     welcome: function(event) {
  575.     }
  576. });
  577.  
  578. App.SalesSidebarView = Em.View.extend ({
  579.     templateName: "sales-sidebar-template",
  580.    
  581.     refundProduct: function(event) {
  582.         hideAll();
  583.         $(".refund-product-form").show();
  584.     },
  585.     removeFromTransaction: function(event) {
  586.         hideAll();
  587.         $(".remove-product-form").show();
  588.     },
  589.     transaction: function(event) {
  590.         hideAll();
  591.         $(".transaction-form").show();
  592.         initializeTransaction();
  593.     }
  594. });
  595.  
  596. App.OrderingSidebarView = Em.View.extend ({
  597.     templateName: "ordering-sidebar-template",
  598.    
  599.     addProduct: function(event) {
  600.         hideAll();
  601.         $(".add-product-form").show();
  602.     },
  603.     changeThreshold: function(event) {
  604.         hideAll();
  605.         $(".threshold-form").show();
  606.     },
  607.     toggleOrderable: function(event) {
  608.         hideAll();
  609.         $(".toggle-orderable-form").show();
  610.     },
  611.     discontinueProduct: function(event) {
  612.         hideAll();
  613.         $(".discontinue-product-form").show();
  614.     },
  615.     orderProduct: function(event) {
  616.         hideAll();
  617.         $(".order-products-form").show();
  618.     }
  619. });
  620.  
  621. App.CustomerSidebarView = Em.View.extend ({
  622.     templateName: "customer-sidebar-template",
  623.    
  624.     newUser: function(event) {
  625.         hideAll();
  626.         $(".new-user-form").show();
  627.     },
  628.     removeCustomer: function(event) {
  629.         hideAll();
  630.         $(".remove-customer-form").show();
  631.     },
  632.     reserveProduct: function(event) {
  633.         hideAll();
  634.         $(".reserve-form").show();
  635.     },
  636.     cancelReservation: function(event) {
  637.         hideAll();
  638.         $(".cancel-reservation-form").show();
  639.     }
  640. });
  641.  
  642. App.StockSidebarView = Em.View.extend ({
  643.     templateName: "stock-sidebar-template",
  644.    
  645.     moveProduct: function(event) {
  646.         hideAll();
  647.         $(".move-product-form").show();
  648.     },
  649.     toggleSellabe: function(event) {
  650.         hideAll();
  651.         $(".toggle-sellable-form").show();
  652.     },
  653.     changePrice: function(event) {
  654.         hideAll();
  655.         $(".price-form").show();
  656.     },
  657.     shelfProduct: function(event) {
  658.         hideAll();
  659.         $(".shelf-product-form").show();
  660.     },
  661. });
  662.  
  663. App.SettingsSidebarView = Em.View.extend ({
  664.     templateName: "settings-sidebar-template",
  665.    
  666.     changePassword: function(event) {
  667.         hideAll();
  668.         $(".change-password-form").show();
  669.     },
  670. });
  671.  
  672. App.TabView = Em.View.extend ({
  673.     templateName: "tab-template",
  674.    
  675.     home: function(event) {
  676.         hideAll();
  677.         hideSideBars();
  678.         $(".home-sidebar").show();
  679.         $(".initial-form").show();
  680.     },
  681.     sales: function(event) {
  682.         hideAll();
  683.         hideSideBars();
  684.         $(".sales-sidebar").show();
  685.         $(".transaction-form").show();
  686.         initializeTransaction();
  687.     },
  688.     ordering: function(event) {
  689.         hideAll();
  690.         hideSideBars();
  691.         $(".ordering-sidebar").show();
  692.         $(".add-product-form").show();
  693.     },
  694.     customer: function(event) {
  695.         hideAll();
  696.         hideSideBars();
  697.         $(".customer-sidebar").show();
  698.         $(".new-user-form").show();
  699.     },
  700.     stockmovement: function(event) {
  701.         hideAll();
  702.         hideSideBars();
  703.         $(".stockmovement-sidebar").show();
  704.         $(".move-product-form").show();
  705.     },
  706.     settings: function(event) {
  707.         hideAll();
  708.         hideSideBars();
  709.         $(".settings-sidebar").show();
  710.         $(".change-password-form").show();
  711.     }
  712. });
  713.  
  714. function hideAll() {
  715.     $(".initial-form").hide();
  716.     $(".reserve-form").hide();
  717.     $(".transaction-form").hide();
  718.     $(".threshold-form").hide();
  719.     $(".price-form").hide();
  720.     $(".add-product-form").hide();
  721.     $(".cancel-reservation-form").hide();
  722.     $(".remove-customer-form").hide();
  723.     $(".refund-product-form").hide();
  724.     $(".move-product-form").hide();
  725.     $(".new-user-form").hide();
  726.     $(".toggle-sellable-form").hide(); 
  727.     $(".ModifyPrice-form").hide();
  728.     $(".shelf-product-form").hide();
  729.     $(".toggle-orderable-form").hide();
  730.     $(".discontinue-product-form").hide();
  731.     $(".change-password-form").hide();
  732.     $(".order-products-form").hide();
  733.     $(".remove-product-form").hide();
  734. }
  735.  
  736. function hideSideBars() {
  737.     $(".home-sidebar").hide();
  738.     $(".sales-sidebar").hide();
  739.     $(".ordering-sidebar").hide();
  740.     $(".customer-sidebar").hide();
  741.     $(".stockmovement-sidebar").hide();
  742.     $(".settings-sidebar").hide();
  743. }
  744.  
  745. function initializeTransaction() {
  746.     var transactionProduct = {
  747.         id: 0,
  748.         name: 'noprod',
  749.         quantity: 1,
  750.         productPrice: 1
  751.     }
  752.     var tProducts = new Array();
  753.     tProducts.push(transactionProduct);
  754.     App.TransactionProductController.set('content', tProducts);
  755.     App.TransactionProductController.clear();
  756. }
  757. /* -------------------------------------------------------------------------------------------- */
Add Comment
Please, Sign In to add comment