sajaniemi_variable_dataset_large / pool /shard007 /JavaScript /0044152_checkouts.client.controller.js
Download pool/shard007/JavaScript/0044152_checkouts.client.controller.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 2.73 kB
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard007/JavaScript/0044152_checkouts.client.controller.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard007/JavaScript/0044152_checkouts.client.controller.js
-
curl -L -o 0044152_checkouts.client.controller.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard007/JavaScript/0044152_checkouts.client.controller.js
2.73 kB
| ; | |
| // Checkouts controller | |
| angular.module('checkouts').controller('CheckoutsController', ['$scope', '$stateParams','$window', '$location', 'Authentication', 'Checkouts', | |
| function($scope, $stateParams, $window, $location, Authentication, Checkouts) { | |
| $scope.authentication = Authentication; | |
| $scope.currentPage = 1; | |
| $scope.pageSize = 10; | |
| $scope.offset = 0; | |
| $scope.uname = user.username; | |
| $scope.foo = ''; | |
| // Page changed handler | |
| $scope.pageChanged = function () { | |
| $scope.offset = ($scope.currentPage - 1) * $scope.pageSize; | |
| }; | |
| // Create new Checkout | |
| $scope.create = function () { | |
| // Create new Checkout object | |
| var checkout = new Checkouts({ | |
| PartNumber: this.PartNumber, | |
| PartType: this.PartType, | |
| Ecode: this.Ecode, | |
| Description:this.Description, | |
| Qty: this.Qty, | |
| Vendor: this.Vendor, | |
| Cost: this.Cost, | |
| RefDes: this.RefDes | |
| }); | |
| // Redirect after save | |
| checkout.$save(function (response) { | |
| $location.path('checkouts/' + response._id); | |
| // Clear form fields | |
| $scope.name = ''; | |
| }, function (errorResponse) { | |
| $scope.error = errorResponse.data.message; | |
| }); | |
| }; | |
| // Remove existing Checkout | |
| $scope.remove = function (checkout) { | |
| if (checkout) { | |
| checkout.$remove(); | |
| for (var i in $scope.checkouts) { | |
| if ($scope.checkouts [i] === checkout) { | |
| $scope.checkouts.splice(i, 1); | |
| } | |
| } | |
| } else { | |
| $scope.checkout.$remove(function () { | |
| $location.path('checkouts'); | |
| }); | |
| } | |
| }; | |
| // Update existing Checkout | |
| $scope.update = function () { | |
| var checkout = $scope.checkout; | |
| checkout.$update(function () { | |
| $location.path('carts/create'); | |
| }, function (errorResponse) { | |
| $scope.error = errorResponse.data.message; | |
| }); | |
| }; | |
| // Find a list of Checkouts | |
| $scope.find = function () { | |
| $scope.checkouts = Checkouts.query(); | |
| }; | |
| // Find existing Checkout | |
| $scope.findOne = function () { | |
| $scope.checkout = Checkouts.get({ | |
| checkoutId: $stateParams.checkoutId | |
| }); | |
| }; | |
| // Search for a checkout | |
| $scope.checkoutSearch = function (product) { | |
| $location.path('checkouts/' + product._id); | |
| }; | |
| //update with user checkout | |
| $scope.cqty = ""; | |
| $scope.console = function () { | |
| if($scope.checkout.Cost >= 100 && user.roles != 'edit'){ | |
| alert('Contact Manager'); | |
| $location.path('/'); | |
| return true; | |
| }; | |
| localStorage.setItem('qty', $scope.cqty); | |
| var adjqty = ($scope.checkout.Qty - $scope.cqty); | |
| $scope.checkout.Qty = adjqty; | |
| localStorage.setItem('pnum', $scope.checkout.PartNumber); | |
| $scope.update(); | |
| //$window.open("#!/carts/create", "_self"); | |
| }; | |
| $scope.capture = function () { | |
| localStorage.setItem('snum', $scope.foo); | |
| }; | |
| } | |
| ]); | |