PageSourceSearch

https://order.part2print.cz/js/castPriceCal.js

js part2print.cz collected 2026-10-08 02:27:51 UTC 10,406 bytes, 183 lines download raw bytes

1function priceCastCalculation() {
2    $("html").on("change", '#castCalculationForm', function (e) {
3        var empty = true;
4        if ($('.castMaterial:visible').length) {
5            empty = false;
6            $(".castMaterial:visible").each(function (i) {
7                if ($(this).val() == null) {
8                    if (!$(this).closest('tr').hasClass('disabled')) {
9                        empty = true;
10                    }
11                }
12            });
13        }
14        if (!empty) {
15            $(".warningFile").remove();
16            $(".countFile").each(function () {
17                if ($(this).val() < 1) {
18                    $(this).val(1);
19                    if (!$(this).closest('tr').hasClass('disabled')) {
20                        alert(trans("castCreate1.atleast_count_one_file"));
21                        return false;
22                    }
23                }
24            });
25
26            var chosen = [];
27            $('.filesChoose:checked').each(function (i) {
28                chosen[i] = $(this).val();
29            });
30
31            if (chosen.length === 0) {
32                $("#bodyDiv").prepend('<div class="warningFile alert alert-danger text-center">' + trans("messages.atleast_one_file_chosen") + '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>');
33                $('#notPricedInfoDiv').show();
34                $('#preciseDiv').hide();
35                $('#notPreciseDiv').hide();
36                $(".filePiecePrices").html(trans('castCreate2.not_counted'));
37                $('html, body').scrollTop($(".warningFile").offset().top - 80);
38            } else {
39                var formData = new FormData(this);
40                $.ajax({
41                    url: '/cast/price/calculation',
42                    type: 'post',
43                    data: formData,
44                    contentType: false,
45                    cache: false,
46                    processData: false,
47                    headers: {
48                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
49                    },
50                    error: function (response) {
51                        console.log(response['responseText']);
52                    },
53                    complete: function (response) {
54                        var value = JSON.parse(response['responseText']);
55                        if (value['response'] != "error") {
56                            $('.priceDivs').hide();
57                            $('#notPreciseDiv').hide();
58                            $('#preciseDiv').hide();
59                            $('#estimatedCompleteDiv').hide();
60                            $('#estimatedMinDiv').hide();
61                            $('#estimatedMaxDiv').hide();
62                            $('#completeDiv').hide();
63                            $('#formDiv').hide();
64                            $('#notPricedInfoDiv').hide();
65                            $('#dphDiv').hide();
66                            $('#cleanDiv').hide();
67                            $('#productionDiv').hide();
68                            $('#timeDiv').hide();
69                            switch (value[0]) {
70                                case "notPrecise":
71                                    $(".filePiecePrices").html(trans('castCreate2.not_counted'));
72                                    $('#notPreciseDiv').show();
73                                    if (value[1] != null) {
74                                        $('#estimatedCompleteDiv').show();
75                                        $('#estimatedComplete').html(value[1]);
76                                    }
77                                    if (value[2] != null) {
78                                        $('#estimatedMinDiv').show();
79                                        $('#estimatedMin').html(value[2]);
80                                    }
81                                    if (value[3] != null) {
82                                        $('#estimatedMaxDiv').show();
83                                        $('#estimatedMax').html(value[3]);
84                                    }
85                                    $(".next").prop('disabled', false);
86                                    break;
87                                case "success":
88                                    $('#preciseDiv').show();
89                                    if (value[2] != null) {
90                                        $('#formDiv').show();
91                                        $('#formPrice').html(value[2]);
92                                    }
93                                    if (value[5] != null) {
94                                        $('#projectPrice').html(value[5]);
95                                    }
96                                    if (value[6] != null) {
97                                        $('#totalDiv').show();
98                                        $('#totalPrice').html(value[6]);
99                                        $(".next").prop('disabled', false);
100                                    }
101                                    if (value[7] != null) {
102                                        $.each(value[7], function (index, price) {
103                                            $("#filePiecePrice" + index).html(price);
104                                        });
105                                    }
106                                    if (value[8] != null) {
107                                        $('#dphDiv').show();
108                                        $('#dphPrice').html(value[8]);
109                                    }
110
111                                    if (value[9] != null) {
112                                        $('#cleanDiv').show();
113                                        $('#cleanPrice').html(value[9]);
114                                    }
115                                    if (value[10] != null && value[3] == 0) {
116                                        $('#productionDiv').show();
117                                        $('#productionPrice').html(value[10]);
118                                    }
119                                    if (value[11] != null) {
120                                        $.each(value[11], function (index, price) {
121                                            $("#fileFormPrice" + index).html(value[14][index] + " x " + price);
122                                        });
123                                    }
124                                    if (value[13] != null) {
125                                        $("#withoutDiscountDiv").show();
126                                        $("#discountDiv").show();
127                                        $("#withoutDiscount").html("" + value[12]);
128                                        $("#discount").html("-" + value[13]);
129                                    } else {
130                                        $("#withoutDiscountDiv").hide();
131                                        $("#discountDiv").hide();
132                                    }
133                                    if(value[15] != null){
134                                        $('#timeDiv').show();
135                                        $('#printTime').html(value[15] + " h");
136                                    }
137                                    break;
138                            }
139                        } else {
140                            $('.priceDivs').hide();
141                            $('#notPreciseDiv').hide();
142                            $('#preciseDiv').hide();
143                            $('#estimatedCompleteDiv').hide();
144                            $('#estimatedMinDiv').hide();
145                            $('#estimatedMaxDiv').hide();
146                            $('#completeDiv').hide();
147                            $('#formDiv').hide();
148                            $('#notPricedInfoDiv').hide();
149                            $('#timeDiv').hide();
150
151                            if (value['errorString']['time'] != null) {
152                                $("#bodyDiv").prepend('<div class="warningFile alert alert-danger text-center">' + value['errorString']['time'] + '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>');
153                            }
154                            if (value['errorString']['price'] != null) {
155                                $("#bodyDiv").prepend('<div class="warningFile alert alert-danger text-center">' + value['errorString']['price'] + '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>');
156                            }
157                            if (value['errorString']['surface'] != null) {
158                                $("#bodyDiv").prepend('<div class="warningFile alert alert-danger text-center">' + value['errorString']['surface'] + '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>');
159                            }
160                            if (value['errorString']['volume'] != null) {
161                                $("#bodyDiv").prepend('<div class="warningFile alert alert-danger text-center">' + value['errorString']['volume'] + '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button></div>');
162                            }
163
164                            $(".next").prop('disabled', false);
165                            $('#notPreciseDiv').show();
166                            $(".filePiecePrices").html(trans('castCreate2.not_counted'));
167                            $('html, body').scrollTop($(".warningFile").offset().top - 80);
168                        }
169                    }
170                });
171            }
172        } else {
173            $(".next").prop('disabled', true);
174            $('#notPricedInfoDiv').show();
175            $('#preciseDiv').hide();
176            $('#notPreciseDiv').hide();
177            $(".filePiecePrices").html(trans('castCreate2.not_counted'));
178        }
179    });
180}
181jQuery(function () {
182    priceCastCalculation();
183});

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.