PageSourceSearch

https://zapchast-betononasos.ru/scripts/_partials/custom-options/services/customOptionsService.js

js zapchast-betononasos.ru collected 2026-10-05 00:22:37 UTC 2,372 bytes, 69 lines download raw bytes

1; (function (ng) {
2    'use strict';
3
4
5    var customOptionsService = function ($http) {
6        var service = this;
7
8        service.getData = function (productId) {
9            return $http.get('product/getcustomoptions', { params: { productId: productId } }).then(function (response) {
10                return response.data;
11            });
12        };
13
14        service.getXml = function (productId, selectedOptions) {
15            return $http.get('product/customoptionsxml', { params: { productId: productId, selectedOptions: selectedOptions } }).then(function (response) {
16                return response.data;
17            });
18        };
19
20        service.convertToQuery = function (customOptions) {
21            var arrayTemp = [],
22                item, val;
23
24            for (var i = customOptions.length - 1; i >= 0; i--) {
25
26                val = null;
27                item = customOptions[i];
28
29                if (item.SelectedOptions != null) {
30
31                    //DropDownList = 0,
32                    //RadioButton = 1,
33                    //CheckBox = 2,
34                    //TextBoxSingleLine = 3,
35                    //TextBoxMultiLine = 4
36
37                    switch (item.InputType) {
38                        case 0:
39                        case 1:
40                            val = item.SelectedOptions.ID;
41                            break;
42                        case 2:
43                            val = !item.SelectedOptions ? '0' : '1'; //item.SelectedOptions может содержать объект или true
44                            break;
45                        case 3:
46                        case 4:
47                            val = item.SelectedOptions.OptionText;
48                            break;
49                        default:
50                            throw Error('Not found InputType for custom options: ' + item.InputType);
51                            break;
52                    }
53
54                    if (val != null) {
55                        arrayTemp.push(i + '_' + val);
56                    }
57                }
58            }
59
60            return arrayTemp.join(';');
61        };
62    };
63
64    ng.module('customOptions')
65      .service('customOptionsService', customOptionsService);
66
67    customOptionsService.$inject = ['$http'];
68
69})(window.angular);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.