');
accountForm.find('div#cFirstName').insertAfter(accountForm.find('div#cLastName'));
accountForm.find('div#cMiddleName').hide();
break;
default:
// First Name
tblAccount.find('tr:eq(0)').replaceWith('
');
accountForm.find('div#cMiddleName').show();
accountForm.find('div#cFirstName').insertBefore(accountForm.find('div#cMiddleName'));
accountForm.find('div#cLastName').insertAfter(accountForm.find('div#cMiddleName'));
break;
}
break;
}
case 'signup.html':
{
// Render view depend user's country
var signupForm = $('div.form-signup form');
switch (lang) {
case 'ja':
case 'vi':
// First Name
signupForm.find('div:eq(0)').replaceWith('
' +
'
' +
'' +
'
');
// Last Name
signupForm.find('div:eq(3)').replaceWith('
' +
'
' +
'' +
'
');
break;
default:
// First Name
signupForm.find('div:eq(0)').replaceWith('
' +
'' + '
' +
'' +
'
');
// console.log(signupForm.find('div:eq(1)'), " cai quan que");
// Last Name
signupForm.find('div:eq(3)').replaceWith('
' +
'
' +
'' +
'
');
break;
}
break;
}
case 'recipientdetail.html':
case 'addrecipient.html':
{
// Render view depend user's country
var tblAccount = $('table.info');
switch (lang) {
case 'ja':
case 'vi':
$('#contents').find('div#dvMiddleName').hide();
$('#contents').find('div#dvFirstName').insertAfter($('#contents').find('div#dvLastName'));
break;
default:
$('#contents').find('div#dvMiddleName').show();
$('#contents').find('div#dvFirstName').insertBefore($('#contents').find('div#dvMiddleName'));
$('#contents').find('div#dvLastName').insertAfter($('#contents').find('div#cMiddleName'));
break;
}
break;
}
case 'admininformation.html':
case 'companydetail.html':
case 'distributoradmininformation.html':
case 'adddistributor.html':
case 'userdetail.html':
case 'adduser.html':
case 'distributordetail.html':
{
// Render view depend user's country
var accountForm = $('div#accountInfo');
switch (lang) {
case 'ja':
case 'vi':
accountForm.find('div#cFirstName').insertAfter(accountForm.find('div#cLastName'));
accountForm.find('div#cMiddleName').hide();
if (page === 'distributoradmininformation.html') {
var compNum = accountForm.find('div#numberComps');
compNum.find('.key').removeClass('col-md-4').addClass('col-md-3');
compNum.insertAfter(accountForm.find('div#compName'));
}
break;
default:
accountForm.find('div#cMiddleName').show();
accountForm.find('div#cFirstName').insertBefore(accountForm.find('div#cMiddleName'));
accountForm.find('div#cLastName').insertAfter(accountForm.find('div#cMiddleName'));
if (page === 'distributoradmininformation.html') {
var compNum = accountForm.find('div#numberComps');
compNum.find('.key').removeClass('col-md-3').addClass('col-md-4');
compNum.insertAfter(accountForm.find('div#dvCreateDate'));
}
break;
}
// rerender dropdown multi select
$('#ddBillingCycles').multipleSelect('refresh', {
selectAllText: i18n.t('myaccount.billing_cycle.select_all_text'),
allSelected: i18n.t('myaccount.billing_cycle.all_selected'),
countSelected: i18n.t('myaccount.billing_cycle.count_selected'),
noMatchesFound: i18n.t('myaccount.billing_cycle.no_matches_found')
});
break;
}
//check
case 'signupcom.html':
{
var accountForm = $('div#accountInfo');
switch (lang) {
case 'ja':
case 'vi':
accountForm.find('div#cFirstName').insertAfter(accountForm.find('div#cLastName'));
break;
default:
accountForm.find('div#cFirstName').insertBefore(accountForm.find('div#cLastName'));
break;
}
break;
}
case 'addservice.html':
{
var accountForm = $('div#accountInfo');
switch (lang) {
case 'ja':
case 'vi':
// First Name
accountForm.find('div#cFirstName').replaceWith('
' +
'' +
'
');
//middle name
accountForm.find('div#cMiddleName').hide();
// Last Name
accountForm.find('div#cLastName').replaceWith('
' +
'' +
'
');
break;
default:
// Last Name
accountForm.find('div#cLastName').replaceWith('
' +
'' +
'
');
//middle name
accountForm.find('div#cMiddleName').hide();
// First Name
accountForm.find('div#cFirstName').replaceWith('
' +
'' +
'
');
break;
}
break;
}
}
},
/**
* Write log message if user's browser supports console
* @param {type} message
* @returns {undefined}
*/
writeLog: function (message) {
if (typeof console !== 'undefined') {
// console.log(message);
}
},
/**
* Parse history code to meaningfultext
* @param {type} historyType
* @returns {String}
*/
parseHistoryTypeToText: function (historyType) {
switch (historyType) {
//405
case HoGoConst.DIRECT_SEND_TYPE:
return i18n.t('history.event.send_direct_type');
//406
case HoGoConst.CREATE_LINK_NONDOWNLOAD_TYPE:
return i18n.t('history.event.create_link_nondownload_type');
//407
case HoGoConst.CREATE_LINK_DOWNLOAD_TYPE:
return i18n.t('history.event.create_link_download_type');
//411
case HoGoConst.LINK_SPECIFY_CREATED_TYPE:
return i18n.t('history.event.create_link_specify_recipient');
//412
case HoGoConst.LINK_ANONYMOUS_CREATED_TYPE:
return i18n.t('history.event.create_link_anonymous');
//408
case HoGoConst.PURCHASE_POINTS_TYPE:
return i18n.t('history.event.package_purchase_type');
//504
case HoGoConst.ADMIN_REFUND_TYPE:
return i18n.t('history.event.admin_refund_type');
//505
case HoGoConst.ADMIN_ADD_POINTS:
return i18n.t('history.event.package_recieve_type');
//403 -- Login
case HoGoConst.LOGIN_TYPE:
return i18n.t('history.event.user_login_type');
//404 -- Logout
case HoGoConst.LOGOUT_TYPE:
return i18n.t('history.event.user_logout_type');
//604 -- Link expired
case HoGoConst.LINK_EXPIRED_TYPE:
return i18n.t('history.event.link_expired_type');
//603 -- Document expired
case HoGoConst.DOCUMENT_EXPIRED_TYPE:
return i18n.t('history.event.document_expired_type');
//200 -- Document added
case HoGoConst.DOCUMENT_ADDED_TYPE:
return i18n.t('history.event.add_document_type');
//202 -- Document deleted
case HoGoConst.DOCUMENT_DELETED_TYPE:
return i18n.t('history.event.delete_document_type');
//102 -- Package deleted
case HoGoConst.PACKAGE_DELETED_TYPE:
return i18n.t('history.event.delete_package_type');
// 601
case HoGoConst.DOCUMENT_VIEWED_TYPE:
return i18n.t('history.event.document_viewed');
// 602
case HoGoConst.DOCUMENT_DOWNLOADED_TYPE:
return i18n.t('history.event.document_downloaded');
// 606
case HoGoConst.DOCUMENT_OPENED_TYPE:
return i18n.t('history.event.document_opened');
//201
case HoGoConst.DOCUMENT_UPDATED_TYPE:
return i18n.t('history.event.document_edited');
// 300
case HoGoConst.RECIPIENT_ADDED_TYPE:
return i18n.t('history.event.recipient_added');
// 301
case HoGoConst.RECIPIENT_UPDATED_TYPE:
return i18n.t('history.event.recipient_edited');
default:
return historyType;//"N/A";
}
},
/**
* Get file extension based on its name
* @param {type} fileName
* @returns {unresolved}
*/
getFileExtension: function (fileName) {
var extension = fileName.substr((fileName.lastIndexOf('.') + 1));
return extension.toLowerCase();
},
/**
* Show document icon from document type
* @param {type} element jQuery object
* @param {type} type type {1, 2, 3, 4}. Refer to HoGoConst to know exactly what it is
*/
drawDocumentIconFromType: function (element, type) {
switch (parseInt(type)) {
case HoGoConst.FILE_PDF_TYPE:
element.addClass('pdf-icon').attr('title', i18n.t('mydocument.type_document.pdf'));
break;
case HoGoConst.FILE_WORD_TYPE:
element.addClass('word-icon').attr('title', i18n.t('mydocument.type_document.word'));
break;
case HoGoConst.FILE_EXCEL_TYPE:
case HoGoConst.FILE_XLSM_TYPE:
element.addClass('excel-icon').attr('title', i18n.t('mydocument.type_document.excel'));
break;
case HoGoConst.FILE_POWERPOINT_TYPE:
element.addClass('powerpoint-icon').attr('title', i18n.t('mydocument.type_document.powerpoint'));
break;
case HoGoConst.FILE_ORTHER_TYPE:
element.addClass('other-document-icon').attr('title', "Other document");
break;
}
},
/**
* Get file extension from file type
* @param {type} type {1, 2, 3, 4}. Refer to HoGoConst to know exactly what it is
* @returns {String}
*/
getExtFromFileType: function (type) {
var ext = null;
switch (parseInt(type)) {
case HoGoConst.FILE_PDF_TYPE:
ext = 'pdf';
break;
case HoGoConst.FILE_WORD_TYPE:
ext = 'docx';
break;
case HoGoConst.FILE_EXCEL_TYPE:
ext = 'xlsx';
break;
case HoGoConst.FILE_POWERPOINT_TYPE:
ext = 'pptx';
break;
case HoGoConst.FILE_XLSM_TYPE:
ext = 'xlsm';
break;
case HoGoConst.FILE_ORTHER_TYPE:
ext = "other";
break;
}
return ext;
},
/**
* Get user's local timezone. It supports from IE6 +
* @returns {Number}
*/
getLocalTimeZone: function () {
return (new Date().getTimezoneOffset( ) / 60) * (-1);
},
/**
* Check new node is existed on the list node
* @param {type} listNode
* @param {type} newNode
* @returns {Boolean}
*/
checkNodeExisted: function (listNode, newNode) {
var check = false;
$.each(listNode, function (index, v) {
if (v === newNode) {
check = true;
return check;
}
});
return check;
},
/**
* remove node on list node
* @param {type} listNode
* @param {type} node
* @returns {undefined}
*/
removeNode: function (listNode, node, attr) {
var index = -1;
if (!attr) {
index = $.inArray(node, listNode);
} else {
for (var i in listNode) {
var n = listNode[i];
// Check exist attr
if (attr in node && attr in n) {
// Compare
if (n[attr] == node[attr]) {
index = i;
}
}
}
}
// Push
if (index != -1) {
listNode.splice(index, 1);
}
},
/**
* add node into list node
* @param {type} listNode
* @param {type} node
* @param {type} attr
* @returns {undefined}
*/
addNode: function (listNode, node, attr) {
var index = -1;
if (!attr) {
index = $.inArray(node, listNode);
} else {
for (var i in listNode) {
var n = listNode[i];
// Check exist attr
if (node.hasOwnProperty(attr) && attr in n) {
// Compare
if (n[attr] == node[attr]) {
index = i;
}
}
}
}
// Push
if (index == -1) {
listNode.push(node);
}
},
loadPaymentPackage: function (currency) {
return $.ajax({
type: "POST",
url: "api/v1/GetPaymentPackage",
beforeSend: function () {
Modal.closeModal();
},
success: function (data) {
if (data.status === 'OK') {
var payPackages = data.list_package;
HoGoUtils.makePaymentPakageList(payPackages, currency);
} else {
Modal.showAlert({content: "Can not get payment package"});
}
}
});
},
makePaymentPakageList: function (packages, currency) {
// sort package by ID
_.sortBy(packages, 'paymentId');
var contentList = "";
$.each(packages, function (i, value) {
switch (parseInt(value.paymentId)) {
case 1:
var content = (currency === "yen") ? i18n.t('payment_package.package1_ja') : i18n.t('payment_package.package1');
contentList += '';
break;
case 2:
var content = (currency === "yen") ? i18n.t('payment_package.package2_ja') : i18n.t('payment_package.package2');
contentList += ''
+ '