Greasy Fork is available in English.

1424_Uzdarbis_LT

1424 Sulietuvinta

Skrip ini tidak untuk dipasang secara langsung. Ini adalah pustaka skrip lain untuk disertakan dengan direktif meta // @require https://greasyfork.org/scripts/439399-1424-uzdarbis-lt/code/1424_Uzdarbis_LT.js?version=1031828

(function ()
{
	'use strict';

	GM_addStyle(`
@import url(https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css);@font-face{font-family:"Open Sans";font-style:normal;font-weight:400;src:local("Open Sans"),local(OpenSans),url(https://themes.googleusercontent.com/static/fonts/opensans/v6/K88pR3goAWT7BTt32Z01mz8E0i7KZn-EPnyo3HZu7kw.woff) format("woff")}
.fa{font-family:FontAwesome}.checkboxToggle b{cursor:pointer;position:relative;display:inline-block;width:54px;height:29px;background:#f2f2f2;border:1px solid #d0d0d0;border-radius:23px;vertical-align:text-bottom;transition:all .2s linear}.checkboxToggle b::after{content:"";position:absolute;left:0;width:25px;height:25px;background-color:#fff;border-radius:30px;box-shadow:0 0 2px rgb(0 0 0 / 50%);transform:translate3d(2px,2px,0);transition:all .2s ease-in-out}.checkboxToggle:active b::after{width:35px;transform:translate3d(2px,2px,0)}.checkboxToggle:active input:checked+b::after{transform:translate3d(17px,2px,0)}.checkboxToggle input{display:none}.checkboxToggle input:checked+b{background-color:#4bd763;border-color:#3aa24c}.checkboxToggle input:checked+b::after{transform:translate3d(27px,2px,0)}.ScriptSettingsContainer tbody>tr:hover td:nth-child(1){background-color:#f5f5f58c;border-radius:10px 0 0 10px;border-top-color:#d0d0d0;border-top-style:solid;border-top-width:1px;border-right-color:#f5f5f58c;border-bottom-color:#d0d0d0;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#d0d0d0;border-left-style:solid;border-left-width:1px}.ScriptSettingsContainer tbody>tr:hover td:nth-child(2){background-color:#f5f5f58c;border-radius:0 10px 10px 0;border-top-color:#d0d0d0;border-top-style:solid;border-top-width:1px;border-right-color:#d0d0d0;border-right-style:solid;border-right-width:1px;border-bottom-color:#d0d0d0;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#f5f5f58c}.ScriptSettingsContainer tbody>tr td:nth-child(1){border:1px solid #fff}.ScriptSettingsContainer tbody>tr td:nth-child(2){border:1px solid #fff;padding:4px 0}.swal2-styled.swal2-cancel,.swal2-styled.swal2-confirm,.swal2-styled.swal2-deny{font-family:"Open Sans";text-transform:uppercase;cursor:pointer;outline:0;padding:0 10px;font-weight:700;text-align:center;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;line-height:1.5;font-size:1.7rem;border-radius:.25rem;transition:all .1s;color:#fff;border:0;text-shadow:0 0 1px #000,1px 1px 1px #000}.swal2-html-container{font-style:normal;text-align:left;color:#000}.fnm-title{margin:auto;font-weight:700;font-family:Open Sans;text-transform:uppercase;font-size:35px;margin:0 0 10px 0;color:rgb(221 60 60);text-shadow:1px 1px 1px rgb(92 0 0),2px 2px 1px rgb(92 0 0)}.fnm-ads-title{font-weight:700;font-family:Open Sans;text-transform:uppercase;font-size:28px;text-align:center;padding:0 0 4px 0}.fnm-no-ads{color:rgb(0 153 0);text-shadow:1px 1px 1px rgb(0 78 0)}.fnm-with-ads{color:rgb(255 0 0);text-shadow:1px 1px 1px rgb(78 0 0)}.btn_tiny{transition:border-color .3s,box-shadow .3s;font-family:"Open Sans";text-transform:uppercase;cursor:pointer;outline:0;font-weight:700;text-align:center;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;line-height:1.5;font-size:14px;border-radius:.25rem;transition:all .1s;color:#fff;border:0;text-shadow:0 0 1px #000,1px 1px 1px #000;padding:revert}.btn_small{transition:border-color .3s,box-shadow .3s;font-family:"Open Sans";text-transform:uppercase;cursor:pointer;outline:0;font-weight:700;text-align:center;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;line-height:1.5;font-size:18px;border-radius:.25rem;transition:all .1s;color:#fff;border:0;text-shadow:0 0 1px #000,1px 1px 1px #000;padding:revert}.btn_normal{transition:border-color .3s,box-shadow .3s;font-family:"Open Sans";text-transform:uppercase;cursor:pointer;outline:0;font-weight:700;text-align:center;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;line-height:1.5;font-size:24px;border-radius:.25rem;transition:all .1s;color:#fff;border:0;text-shadow:0 0 1px #000,1px 1px 1px #000;padding:revert}.btn_big{transition:border-color .3s,box-shadow .3s;font-family:"Open Sans";text-transform:uppercase;cursor:pointer;outline:0;font-weight:700;text-align:center;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;line-height:1.5;font-size:30px;border-radius:.25rem;transition:all .1s;color:#fff;border:0;text-shadow:0 0 1px #000,1px 1px 1px #000;padding:revert}.btn_cred{color:#fff;background-color:#d92638}.btn_cred:hover{color:#fff;background-color:#c32232;box-shadow:0 0 0 .1rem rgba(225,83,97,.5)}.btn_cred:active,.btn_cred:focus{color:#fff;background-color:#ad1f2d;box-shadow:0 0 0 .2rem rgba(225,83,97,.5)}.btn_cblue{color:#fff;background-color:#2778c4}.btn_cblue:hover{color:#fff;background-color:#236cb0;box-shadow:0 0 0 .1rem rgba(35,108,176,.5)}.btn_cblue:active,.btn_cblue:focus{color:#fff;background-color:#1f609d;box-shadow:0 0 0 .2rem rgba(35,108,176,.5)}.btn_cgreen{color:#fff;background-color:#4fc823}.btn_cgreen:hover{color:#fff;background-color:#47b41f;box-shadow:0 0 0 .1rem rgba(79,200,35,.5)}.btn_cgreen:active,.btn_cgreen:focus{color:#fff;background-color:#3fa01c;box-shadow:0 0 0 .2rem rgba(79,200,35,.5)}.btn_corange{color:#fff;background-color:#d99d26}.btn_corange:hover{color:#fff;background-color:#c38d22;box-shadow:0 0 0 .1rem rgba(199,144,35,.5)}.btn_corange:active,.btn_corange:focus{color:#fff;background-color:#a0741c;box-shadow:0 0 0 .2rem rgba(199,144,35,.5)}.MT2{margin:2px}.MT4{margin:4px}.MT6{margin:6px}.MT8{margin:8px}.MT10{margin:10px}

#order-grid td:nth-of-type(11),#order-grid td:nth-of-type(n+0):nth-of-type(-n+2),#order-grid td:nth-of-type(n+14):nth-of-type(-n+22),#order-grid td:nth-of-type(n+5):nth-of-type(-n+7),#order-grid_c10,#order-grid_c11,#order-grid_c15,#order-grid_c19,#order-grid_c2,#order-grid_c20,#order-grid_c21,#order-grid_c22,#order-grid_c23,#order-grid_c24,#order-grid_c27,#order-grid_c28,#order-grid_c29,#order-grid_c5,#order-grid_c9,.filters,.page-size-wrap{display:none!important}

table.table b,table.table td{font-family:Arial!important}table.table th{font-weight:700!important}.table td,.table th{line-height:19px}.table-condensed td,.table-condensed th{padding:3px 2px}#main-menu-block #main-menu .ico-button-li{min-width:50px}#suma.table{width:auto;margin-bottom:20px}#modal-coordinates .modal-footer .map-pointers ul li{float:left!important;width:80px!important;margin-bottom:0!important;font-size:12px!important;text-align:center!important}#modal-coordinates .modal-footer .map-pointers ul{float:left!important;width:100%!important;margin:0!important}#modal-coordinates .modal-footer .map-pointers ul li img{float:none!important}#modal-coordinates .modal-footer .map-pointers ul li p{margin:0!important;text-align:center!important}#modal-coordinates .modal-body .order-modal-side-info{height:auto!important;overflow-y:scroll!important;width:auto!important}#modal-coordinates .modal-body .legend-wrapper{width:auto!important;float:left!important;height:auto!important}.modal.fade.in{top:30px!important}#modal-coordinates .modal-body .map-wrapper{width:70%!important;height:auto!important}.modal{top:10%!important;left:30px!important;width:90%!important;margin-left:unset!important}#filter_form{padding:0!important;float:left!important;margin:30px 0 0 20px!important}#ui-datepicker-div{width:auto;height:auto}#ui-datepicker-div {top: 130px!important;}.ui-datepicker th {padding: 10px!important;font-size: 18px!important;text-transform: uppercase!important;}.ui-datepicker .ui-datepicker-title {margin: 0px 0px!important;line-height: 26px!important;font-size: 20px!important;}.ui-datepicker .ui-datepicker-header {padding: 9px 0!important;}.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next {width: 38px!important;height: 38px!important;}.ui-datepicker td a,.ui-datepicker td span{text-align:center!important}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #dad55e!important;background:#fffa90!important;color:#777620!important;font-weight:700!important}.ui-datepicker td a,.ui-datepicker td span{display:block!important;font-size:24px;padding:8px!important;text-align:center!important;text-decoration:none!important}.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active, a.ui-button:active, .ui-button:active, .ui-button.ui-state-active:hover {border: 1px solid #5e9cda!important;background: #90bcff!important;color: #204777!important;font-weight: 700!important;}
`);
	function minusPercent(n, p)
	{
		return n - (n * (p / 100));
	}
	function colorFromRange(number)
	{
		var ranges = [
			{
				start: 0,
				end: 9,
				color: "#000"
			},
			{
				start: 10,
				end: 39,
				color: "#1fbd00"
			},
			{
				start: 40,
				end: 79,
				color: "#d69d00"
			},
			{
				start: 80,
				end: 119,
				color: "#d66400"
			},
			{
				start: 120,
				end: 160,
				color: "#d60000"
			}]
		var chosenColor = ranges.find(area => (number >= area.start && number <= area.end))
		return chosenColor.color + ';font-size: 16px;';
	}
	var nativeDate = Modernizr.inputtypes.date && Modernizr.touchevents;
	if (navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i))
	{
		nativeDate = true;
	}
	else
	{
		nativeDate = false;
	}
	if (!nativeDate)
	{
		$('#filter_form').html('<input placeholder="Data nuo" type="text" id="from_order" /><input placeholder="Data iki" type="text" id="to_order" />');
		$('#from_order').datepicker($.extend(
		{
			showMonthAfterYear: false
		},
		{
			firstDay: '1',
			dateFormat: "yy-mm-dd",
			monthNames: ['Sausis', 'Vasaris', 'Kovas', 'Balandis', 'Geguže', 'Birželis', 'Liepa', 'Rugpjūtis', 'Rugsėjis', 'Spalis', 'Lapkritis', 'Gruodis'],
			dayNamesMin: ['Sek', 'Pr', 'An', 'Tr', 'Ket', 'Pt', 'Št']
		}));
		$('#to_order').datepicker($.extend(
		{
			showMonthAfterYear: false
		},
		{
			firstDay: '1',
			dateFormat: "yy-mm-dd",
			monthNames: ['Sausis', 'Vasaris', 'Kovas', 'Balandis', 'Geguže', 'Birželis', 'Liepa', 'Rugpjūtis', 'Rugsėjis', 'Spalis', 'Lapkritis', 'Gruodis'],
			dayNamesMin: ['Sek', 'Pr', 'An', 'Tr', 'Ket', 'Pt', 'Št']
		}));
	}
	else
	{
		$('#filter_form').html('<input placeholder="Data nuo" type="date" id="from_order" /><input placeholder="Data iki" type="date" id="to_order" />');
	}


	$('#order-table').before(`
<div style="padding: 20px 0px 10px 25px;line-height: 23px;">
	<button class="btn_normal btn_cblue MT2" id="calculate">SKAIČIUOTI</button>
	<div id="suma" style="opacity: 1;"></div>
</div>
`);
	function calculate()
	{
		$.fn.yiiGridView.update("order-grid",
		{
			data:
			{
				from_order: $("#from_order").val(),
				to_order: $("#to_order").val(),
				pageSize: 500,
				"Order[status]": 6
			},
			complete: function ()
			{
				$("#info-orders-text").fadeOut();
				var griaznyje,
					procentai,
					svarus,
					kainaeur = 0,
					kilometrai = 0,
					daugiklis = 0,
					kaina1km = 0;
				$("#order-grid_c6").html("DATA").attr("width", "50px"),
				$("#order-grid_c7").html("LAIKAS").attr("width", "50px"),
				$("#order-grid_c12").html("NUO"),
				$("#order-grid_c13").html("IKI"),
				$("#order-grid_c14").html("SUMA").attr("width", "50px"),
				$("#order-grid_c16").html("NUVAŽIUOTA").attr("width", "50px"),
				$("#order-grid_c17").html("KAINA UŽ 1КМ").attr("width", "50px"),
				$("#order-grid_c30").html("KELIONE").attr("width", "50px");
				$("table tbody").find("tr").each(function (i, e)
				{
					$(e).find("td:nth-child(23) > a").html('<button type="button" class="btn_normal btn_cblue MT2" style="padding: 3px;"><i class="fa fa-eye"></i></button>'),
					kainaeur += +$(e).find("td:nth-child(10)").text(),
					kilometrai += +$(e).find("td:nth-child(12)").text(),
					daugiklis = $(e).find("td:nth-child(13)").text(),
					kaina1km = (daugiklis == 0 ? '' + (0.55).toFixed(2) + ' €/km' : '+ ' + daugiklis + ' %<br>' + (0.55 + (0.55 * daugiklis) / 100).toFixed(2) + ' €/km');

					$(e).find("td:nth-child(10)").html(parseFloat($(e).find("td:nth-child(10)").text()).toFixed(2) + " €").css(
					{
						"font-weight": "bold",
						"font-size": "14px",
						color: colorFromRange(daugiklis)
					});
					$(e).find("td:nth-child(12)").append(" km").css(
					{
						"font-weight": "bold",
						"font-size": "14px",
						color: "black"
					});
					$(e).find("td:nth-child(13)").html(kaina1km).css(
					{
						"font-weight": "bold",
						"font-size": "14px",
						color: colorFromRange(daugiklis)
					})
				});
				griaznyje = parseFloat(kainaeur).toFixed(2);
				kilometrai = kilometrai.toFixed(0);
				procentai = (griaznyje - minusPercent(griaznyje, 5)).toFixed(2);
				svarus = minusPercent(griaznyje, 5).toFixed(2);
				$('div#suma').animate({'opacity': 0}, 200, function ()
				{
					$(this).html(`<table class="items table1 table-striped table-bordered table-condensed" style="font-size: 20px;text-transform: uppercase;margin-bottom: 0px;margin-top: 20px;">
<tr><th colspan="2" style="font-weight: bold;color: red;">UŽDARBIS</th></tr>
<tr><th style="text-align: left;color: #3e94ff;">BRUTO:</th><td style="text-align: left;">${griaznyje} €</td></tr>
<tr><th style="text-align: left;color: #3e94ff;">KOMISIJA:</th><td style="text-align: left;">~ ${procentai} €</td></tr>
<tr><th style="text-align: left;color: #3e94ff;">NETO:</th><td style="text-align: left;">${svarus} €</td></tr>
<tr><th style="text-align: left;color: #3e94ff;">NUVAŽIUOTA:</th><td style="text-align: left;">${kilometrai} КМ</td></tr>
</table>`).animate({opacity: 1}, 200)
				});
			}
		})
	}
	document.getElementById('calculate').addEventListener('click', calculate, true);
	window.onload = calculate;
})();