Created
June 13, 2019 09:54
-
-
Save bharathbommidala/2ceb0aa7ff4b42f69de8ad4033a7fd2f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sound = new Audio('https://s3.amazonaws.com/simbla-static-2/2019/06/5a7e88dea903db001a35240b/5a86d537903bc0001a743e74/hNkQYzW2lSrMK9GMS552pBqn.mp3'); | |
//-----------------TRANSCATIONS ----------- | |
function insite_notification_close_tx() | |
{ | |
$('#insite_notification_tx').hide(); | |
} | |
insite_notification_runForever_tx(); | |
function insite_notification_runForever_tx() | |
{ | |
insite_notification_display_function_tx(); | |
setTimeout(insite_notification_runForever_tx, 1000); | |
} | |
function insite_notification_display_function_tx() | |
{ | |
var x = Simbla.User.current().id; | |
var database = Simbla.Object.extend("transaction_history"); | |
var query = new Simbla.Query(database); | |
query.equalTo("user_id", x); | |
query.first( | |
{ | |
success: function (database) | |
{ | |
var notification_read = database.get("read"); | |
//alert(notification_read); | |
if (notification_read == 1) | |
{ | |
sound.play(); | |
for (var i = 1; i < 2; i++) | |
{ | |
var notification_temp = database.get("tx1"); | |
var array = notification_temp.split('^'); | |
var heading = array[0]; | |
var desc = array[1]; | |
var link = "wallet"; | |
var insite_notification_display_tx = '<div style=" padding: 0px; color: white;position: fixed;width: 100%; top: 0; z-index: 100; " >' + | |
' <div id="insite_notification_tx" class=" row simblaEL rDivider" data-drag="P3444" data-title="Row" data-border-type="All" style="z-index:10px; background-color: rgb(39, 196, 125); border-radius: 0px; position: relative; padding-top: 15px;">' + | |
'<div onClick="window.open(\'' + link + '\' )" >' + '<div class="sDivider col-xs-10 index0" data-colsize="10" data-title="Column">' + | |
' <div class="simblaEL tc" data-drag="P3442" id="P3442">' + | |
' <div class="textContainer" style="cursor: text; line-height: 0px;">' + | |
' <p style="line-height: 0px;"><font face="Montserrat" style="font-size: 14px;" color="#ffffff"><b style="">' + heading + '</b></font></p>' + | |
' </div>' + | |
' </div>' + | |
' <div class="simblaEL tc" data-drag="P3443" id="P3443">' + | |
' <div class="textContainer" style="cursor: text; line-height: 12px;">' + | |
' <p style="line-height: 12px;"><font face="Montserrat" style="font-size: 8px;" color="#ffffff"><b style="">' + desc + '</b></font></p>' + | |
' </div>' + | |
' </div>' + | |
' </div>' + '</div>' + | |
' <div class="sDivider col-xs-2 index1" data-colsize="2" data-title="Column">' + | |
' ' + | |
' ' + | |
' ' + | |
' <div onclick="insite_notification_close_tx()" class="simblaEL iconElm" data-drag="P3445" id="P3445">' + | |
' ' + | |
' <i class="fa fa-close" style="color: rgb(255, 255, 255); font-size: 26px; text-shadow: none; box-sizing: content-box; line-height: 36px; text-align: center; display: inline-block; overflow: hidden;" data-color="#ffffff" data-bgcolor="" data-shadow="ns" data-border="circle"></i>' + | |
' ' + | |
' ' + | |
' ' + | |
' </div>' + | |
' </div>' + | |
'</div>' + | |
' ' + | |
'</div>'; | |
$("#insite_notification_display_tx").html(insite_notification_display_tx); | |
} | |
insite_notification_mark_all_as_read_tx(); | |
} | |
}, | |
error: function (database, error) | |
{ | |
// The object was not retrieved successfully. | |
alert("Error - The object was not retrieved successfully" + error.message); | |
} | |
}); | |
} | |
function insite_notification_mark_all_as_read_tx() | |
{ | |
var x = Simbla.User.current().id; | |
var database = Simbla.Object.extend("transaction_history"); | |
var query = new Simbla.Query(database); | |
query.equalTo("user_id", x); | |
query.first( | |
{ | |
success: function (database) | |
{ | |
var current_user_query_id = database.id; | |
//------------------ | |
var databasef = Simbla.Object.extend("transaction_history"); | |
var queryf = new Simbla.Query(databasef); | |
queryf.get(current_user_query_id, | |
{ | |
success: function (databasef) | |
{ | |
databasef.set("read", 0); | |
databasef.save(null, | |
{ | |
success: function (databasef) | |
{ | |
// alert(" succeeded to reset to zero"); | |
}, | |
error: function (databasef, error) | |
{ | |
alert("Error - update failed" + error.message); | |
} | |
}); | |
}, | |
error: function (databasef, error) | |
{ | |
alert("Error - The object was not retrieved successfully" + error.message); | |
} | |
}); | |
//------------------------------------------------ | |
}, | |
error: function (database, error) | |
{ | |
// The object was not retrieved successfully. | |
alert("Error - The object was not retrieved successfully" + error.message); | |
} | |
}); | |
} | |
//--------------------NOTIFICATIONS ----------------- | |
function insite_notification_close() | |
{ | |
$('#insite_notification').hide(); | |
} | |
insite_notification_runForever(); | |
function insite_notification_runForever() | |
{ | |
insite_notification_display_function(); | |
setTimeout(insite_notification_runForever, 1000); | |
} | |
function insite_notification_display_function() | |
{ | |
var x = Simbla.User.current().id; | |
var database = Simbla.Object.extend("user_notifications"); | |
var query = new Simbla.Query(database); | |
query.equalTo("user_id", x); | |
query.first( | |
{ | |
success: function (database) | |
{ | |
var notification_read = database.get("read"); | |
if (notification_read == 1) | |
{ | |
sound.play(); | |
for (var i = 1; i < 2; i++) | |
{ | |
var notification_temp = database.get("notification1"); | |
var array = notification_temp.split('+'); | |
var heading = array[0]; | |
var desc = array[1]; | |
var link = array[4]; | |
var insite_notification_display = '<div style=" padding: 0px; color: white;position: fixed;width: 100%; top: 0; z-index: 100; " >' + | |
' <div id="insite_notification" class=" row simblaEL rDivider" data-drag="P3444" data-title="Row" data-border-type="All" style="z-index:10px; background-color: rgb(39, 196, 125); border-radius: 0px; position: relative; padding-top: 15px;">' + | |
'<div onClick="window.open(\'' + link + '\' )" >' + '<div class="sDivider col-xs-10 index0" data-colsize="10" data-title="Column">' + | |
' <div class="simblaEL tc" data-drag="P3442" id="P3442">' + | |
' <div class="textContainer" style="cursor: text; line-height: 0px;">' + | |
' <p style="line-height: 0px;"><font face="Montserrat" style="font-size: 14px;" color="#ffffff"><b style="">' + heading + '</b></font></p>' + | |
' </div>' + | |
' </div>' + | |
' <div class="simblaEL tc" data-drag="P3443" id="P3443">' + | |
' <div class="textContainer" style="cursor: text; line-height: 12px;">' + | |
' <p style="line-height: 12px;"><font face="Montserrat" style="font-size: 8px;" color="#ffffff"><b style="">' + desc + '</b></font></p>' + | |
' </div>' + | |
' </div>' + | |
' </div>' + '</div>' + | |
' <div class="sDivider col-xs-2 index1" data-colsize="2" data-title="Column">' + | |
' ' + | |
' ' + | |
' ' + | |
' <div onclick="insite_notification_close()" class="simblaEL iconElm" data-drag="P3445" id="P3445">' + | |
' ' + | |
' <i class="fa fa-close" style="color: rgb(255, 255, 255); font-size: 26px; text-shadow: none; box-sizing: content-box; line-height: 36px; text-align: center; display: inline-block; overflow: hidden;" data-color="#ffffff" data-bgcolor="" data-shadow="ns" data-border="circle"></i>' + | |
' ' + | |
' ' + | |
' ' + | |
' </div>' + | |
' </div>' + | |
'</div>' + | |
' ' + | |
'</div>'; | |
$("#insite_notification_display").html(insite_notification_display); | |
} | |
insite_notification_mark_all_as_read(); | |
} | |
}, | |
error: function (database, error) | |
{ | |
// The object was not retrieved successfully. | |
alert("Error - The object was not retrieved successfully" + error.message); | |
} | |
}); | |
} | |
function insite_notification_mark_all_as_read() | |
{ | |
var x = Simbla.User.current().id; | |
var database = Simbla.Object.extend("user_notifications"); | |
var query = new Simbla.Query(database); | |
query.equalTo("user_id", x); | |
query.first( | |
{ | |
success: function (database) | |
{ | |
var current_user_query_id = database.id; | |
//------------------ | |
var databasef = Simbla.Object.extend("user_notifications"); | |
var queryf = new Simbla.Query(databasef); | |
queryf.get(current_user_query_id, | |
{ | |
success: function (databasef) | |
{ | |
databasef.set("read", 0); | |
databasef.save(null, | |
{ | |
success: function (databasef) | |
{ | |
// alert(" succeeded to reset to zero"); | |
}, | |
error: function (databasef, error) | |
{ | |
alert("Error - update failed" + error.message); | |
} | |
}); | |
}, | |
error: function (databasef, error) | |
{ | |
alert("Error - The object was not retrieved successfully" + error.message); | |
} | |
}); | |
//------------------------------------------------ | |
}, | |
error: function (database, error) | |
{ | |
// The object was not retrieved successfully. | |
alert("Error - The object was not retrieved successfully" + error.message); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment