PageSourceSearch

https://static.sponsr.ru/js/page/admin/project_commissions.js

js sponsr.ru collected 2026-09-24 18:23:10 UTC 1,939 bytes, 56 lines download raw bytes

1'use strict';
2
3var Ajax = require('../../core/ajax.js');
4var ProgressBar = require('../../core/progressBar.js');
5
6function NVEL(v, d) {
7    return v > 0 ? v : (d == undefined ? null : d);
8}
9
10$('#save_commissions').click(function(e) {
11    e.preventDefault();
12    var _id = ProgressBar.show();
13
14    var commissions = [];
15    $('.project-commission').each(function(i, e) {
16        var $commission = $(e);
17        if ($commission) {
18            var value = NVEL($commission.find('[name="commission_payment_value"]').val(), 0);
19            var type = $commission.find('[name="commission_payment_type"]').val();
20            var $checked = $commission.find('[name="commission_enable"]');
21            commissions.push({
22                commission_system_id : $commission.data('commission'),
23                commission_payment_percent: type === 'percent' ? value : null,
24                commission_payment_fix: type === 'fix' ? value : null,
25                commission_payment_min: NVEL($commission.find('[name="commission_payment_min"]').val()),
26                commission_payment_max: NVEL($commission.find('[name="commission_payment_max"]').val()),
27                enable: !$checked[0] || $checked.is(':checked') ? 'active' : 'archive'
28            });
29        }
30    });
31
32    let is_licensed = $('input[name="is_licensed"]:checked').val();
33
34    if (commissions.length === 0) {
35        ProgressBar.hide(_id);
36    } else {
37        Ajax.postJSON($('#form').attr('action'), {'project_id': $('#form').data('project-id'), 'commissions': JSON.stringify(commissions), is_licensed}, function() {
38            ProgressBar.hide(_id);
39            window.location.reload();
40        });
41    }
42});
43
44
45$('.default-value').on('click', function () {
46    var _this   = $(this),
47        parent  = _this.parent(),
48        value   = _this.data('value'),
49        type    = _this.data('type');
50
51    $('input', parent).val(value);
52    $('select', parent).val(type);
53
54
55
56});

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.