Oryginalny filtr powietrza do pilarek spalinowych:
Husqvarna:T435,
Zenoah: GZ3500T
Jonsered: CS2236T
$.fn.quickSearch = function(elem)
{
return {
SearchType: $("#SearchType").val(),
SearchTerm: $("#SearchTerm").val()
}
}
$.fn.partInfo = function (elem) {
return {
SearchType: "PN",
SearchTerm: parentsAttr($(this), 'data-search-term'),
//GsppId: $(this).parents('table').attr('data-gspp-id')
GenericSppLineID: $(this).parents('tr').attr('data-gsppline-id') || null,
Cmd: $(this).attr('data-cmd'),
servicePartsPageID: parentsAttr($(this), "data-ServicePartsPageID"),
genericServicePartsPageID: parentsAttr($(this), "data-GenericServicePartsPageID")
}
}
$.fn.simplePartInfo = function (elem) {
return {
SearchType: "PN",
SearchTerm: $(this).text(),
Cmd: $(this).attr('data-cmd')
}
}
function initDatepicker(selector) {
$(selector).datepicker(
{
showOn: "focus",
showOtherMonths: true,
selectOtherMonths: true,
changeMonth: true,
changeYear: true,
dateFormat: "dd M yy",
isBE: true,
autoConversionField: true
}
);
$(selector).keydown(function (e) {
var code = (e.keyCode ? e.keyCode : e.which);
if ((code == 8) || (code == 46)) {
$(this).val("");
}
});
}
function updateShoppingCart(url, requestData) {
$('#shopping-cart').addClass('loading');
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
cache: false,
url: url,
data: JSON.stringify(requestData),
success: function (data) {
$("#shopping-cart").html(data);
$('#shopping-cart').removeClass('loading');
$(initShoppingCart);
},
error: function (jqXHR, textStatus, errorThrow) {
alert("Request failed: " + textStatus + ", " + errorThrow);
}
});
}
function ReloadShoppingCart() {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
cache: false,
url: "/PickList/GetDefaultShoppingList",
async:false,
success: function (data) {
$("#shopping-cart").html(data);
$(initShoppingCart);
},
error: function (jqXHR, textStatus, errorThrow) {
alert("Request failed: " + textStatus + ", " + errorThrow);
},
});
}
function getShoppingCartRequest() {
return {
'SortingId': $("#SCItems").attr("data-sortingId"),
'SortingIsDesc': $("#SCItems").attr("data-sortingIsDesc"),
};
}
function initBom() {
$(".AddToShoppingCart").click(function() {
updateShoppingCart(
'/ProductCatalog/AddToShoppingCartWithGenericSppLineID',
{
shoppingCartID: parentsAttr($(this), "data-ShoppingCartID"),
partId: parentsAttr($(this), "data-part-id"),
genericSppLineID: parentsAttr($(this), "data-gsppline-id"),
servicePartsPageID: parentsAttr($(this), "data-ServicePartsPageID"),
genericServicePartsPageID: parentsAttr($(this), "data-GenericServicePartsPageID"),
shoppingCartRequest: getShoppingCartRequest()
});
});
}
function initSupersessions() {
$(".AddToShoppingCartOld").click(function () {
updateShoppingCart(
'/ProductCatalog/AddToShoppingCartWithoutGenericSppLineID',
{
shoppingCartID: parentsAttr($(this), "data-ShoppingCartID"),
partId: parentsAttr($(this), "data-part-id-old"),
servicePartsPageID: parentsAttr($(this), "data-ServicePartsPageID-old"),
genericServicePartsPageID: parentsAttr($(this), "data-GenericServicePartsPageID-old"),
shoppingCartRequest: getShoppingCartRequest()
});
});
$(".AddToShoppingCartNew").click(function () {
updateShoppingCart(
'/ProductCatalog/AddToShoppingCartWithoutGenericSppLineID',
{
shoppingCartID: parentsAttr($(this), "data-ShoppingCartID"),
partId: parentsAttr($(this), "data-part-id-new"),
servicePartsPageID: parentsAttr($(this), "data-ServicePartsPageID-old"),
genericServicePartsPageID: parentsAttr($(this), "data-GenericServicePartsPageID-old"),
shoppingCartRequest: getShoppingCartRequest()
});
});
}
function initShoppingCart() {
function flatRateTime(selector, url) {
$(selector).click(function() {
updateShoppingCart(
url,
{
shoppingCartID: parentsAttr($(this), "data-ShoppingCartID"),
servicePartsPageID: parentsAttr($(this), "data-ServicePartsPageID"),
genericServicePartsPageID: parentsAttr($(this), "data-GenericServicePartsPageID"),
shoppingCartRequest: getShoppingCartRequest()
});
});
}
flatRateTime(".LowFlatRateTime", '/ProductCatalog/LowFlatRateTime');
flatRateTime(".MiddleFlatRateTime", '/ProductCatalog/MiddleFlatRateTime');
flatRateTime(".HighFlatRateTime", '/ProductCatalog/HighFlatRateTime');
flatRateTime(".CustomJobLowFlatRateTime", '/ProductCatalog/CustomJobLowFlatRateTime');
flatRateTime(".CustomJobMiddleFlatRateTime", '/ProductCatalog/CustomJobMiddleFlatRateTime');
flatRateTime(".CustomJobHighFlatRateTime", '/ProductCatalog/CustomJobHighFlatRateTime');
$(".JobTime").change(function () {
updateShoppingCart(
'/ProductCatalog/JobTime',
{
shoppingCartID: parentsAttr($(this), "data-ShoppingCartID"),
jobTime: $(this).val(),
servicePartsPageID: parentsAttr($(this), "data-ServicePartsPageID"),
genericServicePartsPageID: parentsAttr($(this), "data-GenericServicePartsPageID"),
shoppingCartRequest: getShoppingCartRequest()
});
});
$(".SCItemQuantity").change(function () {
updateShoppingCart(
'/ProductCatalog/SCItemQuantity',
{
shoppingCartID: parentsAttr($(this), "data-ShoppingCartID"),
shoppingCartEntryID: parentsAttr($(this), "data-ShoppingCartEntryID"),
quantity: $(this).val(),
servicePartsPageID: parentsAttr($(this), "data-ServicePartsPageID"),
genericServicePartsPageID: parentsAttr($(this), "data-GenericServicePartsPageID"),
shoppingCartRequest: getShoppingCartRequest()
});
});
$(".JobName").change(function () {
updateShoppingCart(
'/ProductCatalog/JobName',
{
shoppingCartID: parentsAttr($(this), "data-ShoppingCartID"),
jobName: $(this).val(),
servicePartsPageID: parentsAttr($(this), "data-ServicePartsPageID"),
genericServicePartsPageID: parentsAttr($(this), "data-GenericServicePartsPageID"),
shoppingCartRequest: getShoppingCartRequest()
});
});
$(".ShoppingCartTab").click(function () {
updateShoppingCart(
'/ProductCatalog/ShoppingCartTab',
{
shoppingCartID: parentsAttr($(this), "data-ShoppingCartID"),
jobId: parentsAttr($(this), "data-jobId"),
servicePartsPageID: parentsAttr($(this), "data-ServicePartsPageID"),
genericServicePartsPageID: parentsAttr($(this), "data-GenericServicePartsPageID"),
shoppingCartRequest: getShoppingCartRequest()
});
});
$(".deleteSCPart").click(function () {
if (window.confirm("Czy na pewno chcesz usunąć tę pozycję?"))
updateShoppingCart(
'/ProductCatalog/DeleteSCPart',
{
shoppingCartID: parentsAttr($(this), "data-ShoppingCartID"),
shoppingCartEntryID: parentsAttr($(this), "data-ShoppingCartEntryID"),
servicePartsPageID: parentsAttr($(this), "data-ServicePartsPageID"),
genericServicePartsPageID: parentsAttr($(this), "data-GenericServicePartsPageID"),
shoppingCartRequest: getShoppingCartRequest()
});
});
$("#deleteAllJobs").click(function () {
if (window.confirm("Czy na pewno chcesz usunąć wszystkie zadania?"))
updateShoppingCart(
'/ProductCatalog/DeleteAllJobs',
{
shoppingCartID: parentsAttr($(this), "data-ShoppingCartID"),
servicePartsPageID: parentsAttr($(this), "data-ServicePartsPageID"),
genericServicePartsPageID: parentsAttr($(this), "data-GenericServicePartsPageID"),
shoppingCartRequest: getShoppingCartRequest()
});
});
$("#DeleteAllParts").click(function () {
if (window.confirm("Czy na pewno chcesz usunąć wszystkie części z Listy wyboru?"))
updateShoppingCart(
'/ProductCatalog/DeleteAllParts',
{
shoppingCartID: parentsAttr($(this), "data-ShoppingCartID"),
servicePartsPageID: parentsAttr($(this), "data-ServicePartsPageID"),
genericServicePartsPageID: parentsAttr($(this), "data-GenericServicePartsPageID"),
shoppingCartRequest: getShoppingCartRequest()
});
});
$("#SendToWebOrder").click(function() {
showPartDialog(
'/ProductCatalog/SendToWebOrder',
{
shoppingCartID: parentsAttr($(this), "data-ShoppingCartID")
});
});
$("#RefreshPrices").click(function () {
updateShoppingCart(
'/ProductCatalog/RefreshPrices',
{
shoppingCartID: parentsAttr($(this), "data-ShoppingCartID"),
servicePartsPageID: parentsAttr($(this), "data-ServicePartsPageID"),
genericServicePartsPageID: parentsAttr($(this), "data-GenericServicePartsPageID"),
shoppingCartRequest: getShoppingCartRequest()
});
});
$("#SCPage").click(function () {
updateShoppingCart(
'/ProductCatalog/SCPage',
{
shoppingCartID: parentsAttr($(this), "data-ShoppingCartID"),
servicePartsPageID: parentsAttr($(this), "data-ServicePartsPageID"),
genericServicePartsPageID: parentsAttr($(this), "data-GenericServicePartsPageID"),
shoppingCartRequest: getShoppingCartRequest()
});
});
$("#SCItems").find("[data-sortingId]").click(function () {
updateShoppingCart(
'/ProductCatalog/SCItemSorting',
{
shoppingCartID: parentsAttr($(this), "data-ShoppingCartID"),
servicePartsPageID: parentsAttr($(this), "data-ServicePartsPageID"),
genericServicePartsPageID: parentsAttr($(this), "data-GenericServicePartsPageID"),
sortingId: $(this).attr("data-sortingId"),
shoppingCartRequest: getShoppingCartRequest()
});
});
$("#CreateQuote").click(function() {
updateShoppingCart(
'/ProductCatalog/CreateQuote',
{
shoppingCartID: parentsAttr($(this), "data-ShoppingCartID"),
servicePartsPageID: parentsAttr($(this), "data-ServicePartsPageID"),
genericServicePartsPageID: parentsAttr($(this), "data-GenericServicePartsPageID"),
shoppingCartRequest: getShoppingCartRequest()
});
});
$(".SCProductName").click(function() {
showPartDialog(
'/QuickSearch/FindByID',
{
PartID: $(this).attr("data-PartID")
});
});
}
function initQuote() {
function updateQuote(url, requestData) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
cache: false,
url: url,
data: JSON.stringify(requestData),
success: function (data) {
$("#content").html(data);
},
error: function (jqXHR, textStatus, errorThrow) {
alert("Request failed: " + textStatus + ", " + errorThrow);
}
});
}
function getQuoteRequest() {
return {
'Name': $("#QuoteName").val(),
'QuoteDate': $("#QuoteDate").val(),
'ExpirationDate': $("#ExpirationDate").val(),
'PurchaseOrderNumber': $("#PurchaseOrderNumber").val(),
'AccountNumber': $("#AccountNumber").val(),
'Remarks': $("#QuoteRemarks").val(),
'QuoteID': $("#SaveQuote").attr("data-QuoteID"),
'CustomerName': $("#CustomerName").val(),
'CustomerContactName': $("#CustomerContactName").val(),
'CustomerPhone': $("#CustomerPhone").val(),
'CustomerFax': $("#CustomerFax").val(),
'CustomerAddress': $("#CustomerAddress").val(),
'CustomerCity': $("#CustomerCity").val(),
'CustomerState': $("#CustomerState").val(),
'CustomerZIPCode': $("#CustomerZIPCode").val(),
'CustomerCountry': $("#CustomerCountry").val(),
'DealerName': $("#DealerName").val(),
'DealerContactName': $("#DealerContactName").val(),
'DealerPhone': $("#DealerPhone").val(),
'DealerFax': $("#DealerFax").val(),
'DealerAddress': $("#DealerAddress").val(),
'DealerCity': $("#DealerCity").val(),
'DealerState': $("#DealerState").val(),
'DealerZIPCode': $("#DealerZIPCode").val(),
'DealerCountry': $("#DealerCountry").val(),
'Footer': $("#QuoteFooter").val(),
'LaborRate': $("#LaborRate").val(),
'LaborHours': $("#LaborHours").val(),
'ShippingAndHandlingCost': $("#ShippingAndHandlingCost").val(),
'ShippingMethod': $("#ShippingMethod").val(),
Jobs: $("[data-QuoteJobID]").toEnumerable()
.Select(function(job) {
return {
'QuoteJobID': job.attr("data-QuoteJobID"),
'JobTime': job.find(".JobTime").val(),
'FlatRateID': job.find(".flatRateList").val(),
'JobName': job.find(".JobName").val(),
'SortingId': job.find(".QuoteLines").attr("data-sortingId"),
'SortingIsDesc': job.find(".QuoteLines").attr("data-sortingIsDesc"),
'Lines': job.find("[data-QuoteLineID]").toEnumerable()
.Select(function (line) {
return {
'QuoteLineID': line.attr("data-QuoteLineID"),
'Quantity': line.find(".QuoteLineQuantity").val(),
'Price': line.find(".QuoteLinePrice").val(),
};
}).ToArray()
};
}).ToArray(),
OtherExpensess: $("[data-OtherExpensesID]").toEnumerable()
.Select(function (expenses) {
return {
'OtherExpensesID': expenses.attr("data-OtherExpensesID"),
'Description': expenses.find(".OtherExpensesDescription").val(),
'Quantity': expenses.find(".OtherExpensesQuantity").val(),
'Price': expenses.find(".OtherExpensesPrice").val(),
};
}).ToArray(),
};
}
$("[data-QuoteError]").click(function () {
errorRelatedElement(
$($(this).attr("data-ErrorSelector")));
});
$("[data-JobError]").click(function () {
errorRelatedElement(
$('[data-QuoteJobID="' + $(this).attr("data-ErrorQuoteJobID") + '"]').find($(this).attr("data-ErrorSelector")));
});
$("[data-QuoteLineError]").click(function () {
errorRelatedElement(
$('[data-QuoteLineID="' + $(this).attr("data-ErrorQuoteLineID") + '"]').find($(this).attr("data-ErrorSelector")));
});
$("[data-OtherExpensesError]").click(function () {
errorRelatedElement(
$('[data-OtherExpensesID="' + $(this).attr("data-ErrorOtherExpensesID") + '"]').find($(this).attr("data-ErrorSelector")));
});
$(".flatRateList").change(function () {
updateQuote(
'/ProductCatalog/UpdateQuote',
{
quoteRequest: getQuoteRequest()
}
);
});
function flatRateTime(selector, url) {
$(selector).click(function () {
updateQuote(
url,
{
QuoteJobID: parentsAttr($(this), "data-QuoteJobID"),
quoteRequest: getQuoteRequest()
});
});
}
flatRateTime(".LowFlatRateTime", '/ProductCatalog/QuoteLowFlatRateTime');
flatRateTime(".MiddleFlatRateTime", '/ProductCatalog/QuoteMiddleFlatRateTime');
flatRateTime(".HighFlatRateTime", '/ProductCatalog/QuoteHighFlatRateTime');
flatRateTime(".CustomJobLowFlatRateTime", '/ProductCatalog/QuoteCustomJobLowFlatRateTime');
flatRateTime(".CustomJobMiddleFlatRateTime", '/ProductCatalog/QuoteCustomJobMiddleFlatRateTime');
flatRateTime(".CustomJobHighFlatRateTime", '/ProductCatalog/QuoteCustomJobHighFlatRateTime');
$("#SaveQuote").click(function () {
updateQuote(
'/ProductCatalog/SaveQuote',
{
quoteRequest: getQuoteRequest()
}
);
});
$("#PrintQuote").click(function () {
updateQuote(
'/ProductCatalog/PrintQuote',
{
quoteRequest: getQuoteRequest()
}
);
});
$(".AddExpense").click(function () {
updateQuote(
'/ProductCatalog/AddExpense',
{
quoteRequest: getQuoteRequest()
}
);
});
$(".JobTime,.QuoteLineQuantity,.QuoteLinePrice,.OtherExpensesQuantity,.OtherExpensesPrice,.JobName").each(function () {
var content = $(this).val();
$(this).keyup(function () {
var updateButton = $(this).parent().find(".Update");
if ($(this).val() != content)
updateButton.show();
else
updateButton.hide();
});
});
$(".Update").click(function () {
updateQuote(
'/ProductCatalog/UpdateQuote',
{
quoteRequest: getQuoteRequest()
});
});
$(".DeleteQuotePart").click(function () {
if (window.confirm("Czy na pewno chcesz usunąć tę pozycję?"))
updateQuote(
'/ProductCatalog/DeleteQuotePart',
{
QuoteLineID: parentsAttr($(this), "data-QuoteLineID"),
quoteRequest: getQuoteRequest()
});
});
$(".ClearJob").click(function () {
updateQuote(
'/ProductCatalog/QuoteClearJob',
{
QuoteJobID: parentsAttr($(this), "data-QuoteJobID"),
quoteRequest: getQuoteRequest()
});
});
$(".QuotePage").click(function() {
updateQuote(
'/ProductCatalog/QuotePage',
{
QuoteJobID: parentsAttr($(this), "data-QuoteJobID"),
quoteRequest: getQuoteRequest()
});
});
$(".DeleteOtherExpenses").click(function () {
if (window.confirm("Czy na pewno chcesz usunąć tę pozycję?"))
updateQuote(
'/ProductCatalog/DeleteOtherExpenses',
{
OtherExpensesID: parentsAttr($(this), "data-OtherExpensesID"),
quoteRequest: getQuoteRequest()
});
});
$(".QuoteLines").each(function (index, value) {
$(value).find("[data-sortingId]").click(function () {
updateQuote(
'/ProductCatalog/QuoteLineSorting',
{
sortingId: $(this).attr("data-sortingId"),
QuoteJobID: parentsAttr($(this), "data-QuoteJobID"),
quoteRequest: getQuoteRequest()
});
});
});
initDatepicker("#QuoteDate");
initDatepicker("#ExpirationDate");
}
function initSendToWebOrder() {
function updateSendToWebOrderForm(elem, url, requestData) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
cache: false,
url: url,
data: JSON.stringify(requestData),
success: function (data) {
$(elem).closest('.ui-dialog-content').html(data);
$("#SCItems").empty();
},
error: function (jqXHR, textStatus, errorThrow) {
alert("Request failed: " + textStatus + ", " + errorThrow);
}
});
}
function getRequest() {
return {
'ShoppingCartID': $("#shopping-cart-id").val(),
'User': $("#User").val(),
'Password': $("#Password").val(),
'AsapChecked': $("#Asap").is(':checked'),
'RequestedShipDate': $("#RequestedShipDate").val(),
'YourOrderLineReference': $("#YourOrderLineReference").val(),
};
}
$("[data-QuoteError]").click(function () {
errorRelatedElement(
$($(this).attr("data-ErrorSelector")));
});
initDatepicker("#RequestedShipDate");
$("#SendToWebOrderCancel").click(function () {
$(this).closest('.ui-dialog-content').dialog('close');
});
$("#SendToWebOrder2").click(function () {
updateSendToWebOrderForm(
this,
'/ProductCatalog/SendToWebOrderOrder',
{
request: getRequest()
});
});
}