Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery(document).ready( () => {
- let count = 10;
- let debug = true;
- let restore = true;
- let defaults = ( count ) => {
- let row_count = count;
- let rows = {};
- let row = [
- 0, 'Whole Foods', 'Whole Foods Yorkville - YRK', 0, '163.456.7890',
- '432.546.4325', 'sam@abc.com', 'address', '#745', 'M5R-3R9',
- 'Canada', 'Ontario', 'Toronto',
- 'This is a test message...'
- ];
- var mockup_data = {
- keys: [
- 'status_id', 'customer_id', 'branch_id', 'agent_id', 'phone1',
- 'phone2', 'email_address', 'address', 'unit', 'postalcode', 'country_id',
- 'zone_id', 'location_id', 'notes'
- ],
- head: {
- selector: 1,
- columns: {
- labels: [
- 'Status', 'Customer', 'Branch', 'Agent', 'Phone1', 'Phone2',
- 'Email Address', 'Address', 'Unit', 'Post Code', 'Country',
- 'State/Prov', 'City/Town', 'Notes'
- ],
- widths: []
- }
- },
- body: {
- selector: 0,
- rows: {}
- },
- children: {
- status_id: {
- type: 'option',
- children: { 0: '', 1: 'Active', 2: 'Prospect', 3: 'Pending', 4: 'On Hold' }
- },
- agent_id: {
- type: 'option',
- children: { 0: '', 1: 'Dan', 2: 'Danny', 3: 'Daniel', 4: 'Uno' }
- }
- }
- };
- for ( let id = 1; id < row_count + 1; id++ ) {
- let r = [ ...row ];
- r[ 0 ] = Math.floor( Math.random() * 4 ) + 1;
- r[ 2 ] = 'Whole Foods Store - [' + (
- Math.floor( Math.random() * 1000 ) + 1 ) + ']';
- r[ 3 ] = Math.floor( Math.random() * 4 ) + 1;
- rows[ id ] = r;
- }
- mockup_data.body.rows = rows;
- return [
- {
- id: 'tbl1',
- data: mockup_data,
- attrs: {
- index: true,
- selector: true,
- colorize: {
- th: {
- color: 'white',
- background: 'blue'
- }
- },
- sortable: true,
- context_menu: true,
- column_sizing: true
- },
- timestamp: new Date()
- },
- {
- id: 'tbl2',
- data: mockup_data,
- attrs: {
- index: true,
- selector: true,
- colorize: {
- th: {
- color: 'white',
- background: 'blue'
- }
- },
- sortable: true,
- context_menu: true,
- column_sizing: true
- },
- timestamp: new Date()
- },
- ];
- };
- // -------------------------
- let init = async ( cfg ) => {
- try {
- let app =
- await new App( cfg, restore, debug );
- await app.setup( { focus: cfg.focus } );
- await app.config( defaults( count ) );
- return await app.start();
- } catch( err ) {
- return [( 'ERROR: [init] Could not start app [' + cfg.name + ']' ), err ];
- }
- };
- init( {
- id: 1,
- name: 'Metta Tea CRM',
- focus: 'tbl1',
- db_name: 'mettatea',
- db_stores: [ 'app', 'table_magic', 'test' ],
- db_version: 1
- } );
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement