seller.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. 'use strict';
  2. angular.module('pos')
  3. .controller('SellerCtrl', function ($scope, $timeout, $http) {
  4. var webservice = 'api/?a=sellers';
  5. $scope.generateSellers = function (count) {
  6. return _.map(_.range(1, count + 1), function (num) {
  7. return {
  8. 'project_id': "1",
  9. 'seller_id': num.toString().padLeft('0', 3),
  10. 'name': "",
  11. 'address': "",
  12. 'place': "",
  13. 'mail': "",
  14. 'phone': ""
  15. };
  16. });
  17. };
  18. $scope.sellers = []; // $scope.generateSellers(85);
  19. $scope.save = function () {
  20. $http.post(webservice, { 'project_id': "1", 'sellers': $scope.sellers }).then(function (response) {
  21. $scope.sellers = response.data;
  22. });
  23. };
  24. $scope.load = function () {
  25. $http.post(webservice, { 'project_id': "1" }).then(function (response) {
  26. $scope.sellers = response.data;
  27. });
  28. };
  29. $scope.load();
  30. });