12345678910111213141516171819202122232425262728293031323334353637 |
- 'use strict';
- angular.module('pos')
- .controller('SellerCtrl', function ($scope, $timeout, $http) {
- var webservice = 'api/?a=sellers';
-
- $scope.generateSellers = function (count) {
- return _.map(_.range(1, count + 1), function (num) {
- return {
- 'project_id': "1",
- 'seller_id': num.toString().padLeft('0', 3),
- 'name': "",
- 'address': "",
- 'place': "",
- 'mail': "",
- 'phone': ""
- };
- });
- };
- $scope.sellers = []; // $scope.generateSellers(85);
- $scope.save = function () {
- $http.post(webservice, { 'project_id': "1", 'sellers': $scope.sellers }).then(function (response) {
- $scope.sellers = response.data;
- });
- };
- $scope.load = function () {
- $http.post(webservice, { 'project_id': "1" }).then(function (response) {
- $scope.sellers = response.data;
- });
- };
- $scope.load();
- });
|