Skip to content

Instantly share code, notes, and snippets.

@ducdhm
Last active August 31, 2017 05:30
Show Gist options
  • Save ducdhm/b5a8c6ccfe1276822a12f117981c0719 to your computer and use it in GitHub Desktop.
Save ducdhm/b5a8c6ccfe1276822a12f117981c0719 to your computer and use it in GitHub Desktop.
Creating example data in Kademi
$.each([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], function(index, value) {
setTimeout(function() {
$('#newQuickLeadModal').modal('show');
$('#newQuickLeadModal [name=notes]').val('Note for quick lead #' + value);
$('#newQuickLeadModal form').trigger('submit');
}, (2000 * value));
});
$.each([1, 2, 3, 4, 5], function(index, value) {
setTimeout(function() {
$('#addCategoryModal').modal('show');
$('[name=name]').val('CAT-' + value);
$('[name=newTitle]').val('Categories #' + value);
$('#addCategoryModal').find('form').trigger('submit');
}, (1000 * value));
});
$('[name=title]').val('Mah Journey');
$('[name=leadsGroup]').val('leads');
$('.btn-add-source').trigger('click').trigger('click').trigger('click');
$('[name=sources]').eq(0).val('facebook');
$('[name=sources]').eq(1).val('twitter');
$('[name=sources]').eq(2).val('googleplus');
$('.btn-add-stage').trigger('click').trigger('click').trigger('click');
$('[name=stageName]').eq(0).val('cold');
$('[name=stageDesc]').eq(0).val('Cold');
$('[name=stageName]').eq(1).val('warm');
$('[name=stageDesc]').eq(1).val('Warm');
$('[name=stageName]').eq(2).val('hot');
$('[name=stageDesc]').eq(2).val('Hot');
$('.btn-add-lostReason').trigger('click').trigger('click').trigger('click');
$('[name=lostReason]').eq(0).val('Can\'t contact');
$('[name=lostReason]').eq(1).val('Rejected');
$('[name=lostReason]').eq(2).val('Lost');
$('.form-properties').trigger('submit');
birthYear = formatter.getYear(profile.birthDate); currentYear = formatter.getYear(formatter.now); age = currentYear - birthYear; nextBirthDay = formatter.addYears(profile.birthDate, age); return nextBirthDay;
$.each([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], function(index, value) {
setTimeout(function() {
$('.btn-add-org').trigger('click');
$('[name=orgId]').val('organisation-' + value);
$('[name=title]').val('Organisation #' + value);
$('#modal-edit-org').find('form').trigger('submit');
}, (1000 * value));
});
$.each([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], function(index, value) {
setTimeout(function() {
$('#addProductModal').modal('show');
$('[name=name]').val('PROD-' + value);
$('[name=title]').val('Product ' + value);
$('[name=baseCost]').val(100 * value + value);
$('#addProductModal').find('form').trigger('submit');
}, (1000 * value));
});
$('#programModal').modal('show');
$('[name=programName]').val('p1');
$('[name=programTitle]').val('Program 1');
$('#programModal form').trigger('submit');
$('#courseModal').modal('show');
$('[name=courseName]').val('c1');
$('[name=courseTitle]').val('Course 1');
$('#courseModal form').trigger('submit');
$('#moduleModal').modal('show');
$('[name=moduleName]').val('m1');
$('[name=moduleTitle]').val('Module 1');
$('#moduleModal form').trigger('submit');
$('#modal-add-page').modal('show');
$('#modal-add-page [name=pageTitle]').val('Module page #1');
CKEDITOR.instances['body'].setData('Module page #1 content');
$('#modal-add-page .btn-save-close').trigger('click');
$.each([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], function(index, value) {
setTimeout(function() {
$('#modal-new-user').modal('show');
$('[name=nickName]').val('Test User #' + value);
$('[name=firstName]').val('Test User #' + value);
$('[name=email]').val('test-user-' + value + '@mailinator.com');
$('[name=group]').val('test-users');
$('#modal-new-user').find('.btn-add-and-close').trigger('click');
}, (1000 * value));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment