TimeTrex Community Edition v16.2.0
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<div class="edit-view awesomeboxtest-edit-view">
|
||||
<div class="edit-view-tab-bar" id="awesomeboxtest_edit_view_tab_bar">
|
||||
<div class="navigation-div" style="display: none">
|
||||
<span class="navigation-label"></span>
|
||||
<img class="left-click arrow"/>
|
||||
<div class="navigation-widget-div"></div>
|
||||
<img class="right-click arrow"/>
|
||||
</div>
|
||||
<span class="close-icon">x</span>
|
||||
<ul class="edit-view-tab-bar-label">
|
||||
<li><a ref="tab_employee" href="#tab_employee"></a></li>
|
||||
</ul>
|
||||
<div id="tab_employee" class="edit-view-tab-outside">
|
||||
<div class="edit-view-tab" id="tab_employee_content_div">
|
||||
<div class="first-column full-width-column"></div>
|
||||
<div id="qunit_container" style="display:none;">
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@@ -0,0 +1,16 @@
|
||||
<script type="text/javascript">
|
||||
var awesomebox_test_view_controller = new AwesomeboxTestViewController();
|
||||
</script>
|
||||
<div class="view awesomebox-test-view" id="awesomebox_test_view_container">
|
||||
<div class="clear-both-div"></div>
|
||||
<div class="grid-div">
|
||||
<div class="total-number-div">
|
||||
<span class="total-number-span"></span>
|
||||
</div>
|
||||
<div class="grid-top-border"></div>
|
||||
<table id="grid"></table>
|
||||
<div class="bottom-div">
|
||||
<div class="grid-bottom-border"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
File diff suppressed because one or more lines are too long
20
interface/html5/views/developer_tools/GridTestEditView.html
Normal file
20
interface/html5/views/developer_tools/GridTestEditView.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<div class="edit-view gridtest-edit-view">
|
||||
<div class="edit-view-tab-bar" id="gridtest_edit_view_tab_bar">
|
||||
<div class="navigation-div" style="display: none">
|
||||
<span class="navigation-label"></span>
|
||||
<img class="left-click arrow"/>
|
||||
<div class="navigation-widget-div"></div>
|
||||
<img class="right-click arrow"/>
|
||||
</div>
|
||||
<span class="close-icon">x</span>
|
||||
<ul class="edit-view-tab-bar-label">
|
||||
<li><a ref="tab_employee" href="#tab_employee"></a></li>
|
||||
</ul>
|
||||
<div id="tab_employee" class="edit-view-tab-outside">
|
||||
<div class="edit-view-tab" id="tab_employee_content_div">
|
||||
<div class="first-column full-width-column">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
16
interface/html5/views/developer_tools/GridTestView.html
Normal file
16
interface/html5/views/developer_tools/GridTestView.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<script type="text/javascript">
|
||||
var grid_test_view_controller = new GridTestViewController();
|
||||
</script>
|
||||
<div class="view grid-test-view" id="grid_test_view_container">
|
||||
<div class="clear-both-div"></div>
|
||||
<div class="grid-div">
|
||||
<div class="total-number-div">
|
||||
<span class="total-number-span"></span>
|
||||
</div>
|
||||
<div class="grid-top-border"></div>
|
||||
<table id="grid"></table>
|
||||
<div class="bottom-div">
|
||||
<div class="grid-bottom-border"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
221
interface/html5/views/developer_tools/GridTestViewController.js
Normal file
221
interface/html5/views/developer_tools/GridTestViewController.js
Normal file
@@ -0,0 +1,221 @@
|
||||
import '@/global/widgets/filebrowser/TImage';
|
||||
import '@/global/widgets/filebrowser/TImageAdvBrowser';
|
||||
|
||||
export class GridTestViewController extends BaseViewController {
|
||||
constructor( options = {} ) {
|
||||
_.defaults( options, {
|
||||
el: '#grid_test_view_container',
|
||||
|
||||
// _required_files: ['TImage', 'TImageAdvBrowser'],
|
||||
|
||||
user_api: null,
|
||||
user_group_api: null,
|
||||
company_api: null,
|
||||
user_id_array: null,
|
||||
grid_container_id: null
|
||||
} );
|
||||
|
||||
super( options );
|
||||
}
|
||||
|
||||
init( options ) {
|
||||
this.edit_view_tpl = 'GridTestEditView.html';
|
||||
this.permission_id = 'user';
|
||||
this.viewId = 'GridTest';
|
||||
this.script_name = 'GridTestView';
|
||||
this.table_name_key = 'grid_test';
|
||||
this.context_menu_name = $.i18n._( 'Grid Test' );
|
||||
this.navigation_label = $.i18n._( 'AwesomBox Test' );
|
||||
this.api = TTAPI.APIUser;
|
||||
this.select_company_id = LocalCacheData.getCurrentCompany().id;
|
||||
this.user_group_api = TTAPI.APIUserGroup;
|
||||
this.company_api = TTAPI.APICompany;
|
||||
this.user_id_array = [];
|
||||
|
||||
this.edit_view_grid_array = [];
|
||||
|
||||
this.grid_container_id = TTUUID.generateUUID();
|
||||
this.render();
|
||||
this.buildContextMenu();
|
||||
this.initData();
|
||||
}
|
||||
|
||||
setCurrentEditRecordData() {
|
||||
this.collectUIDataToCurrentEditRecord();
|
||||
this.setEditViewDataDone();
|
||||
}
|
||||
|
||||
clearEditViewData() {
|
||||
return false;
|
||||
}
|
||||
|
||||
buildEditViewUI() {
|
||||
var $this = this;
|
||||
|
||||
if( ContextMenuManager.getMenu( this.determineContextMenuMountAttributes().id ) === undefined ) {
|
||||
this.buildContextMenu();
|
||||
} else {
|
||||
Debug.Warn( 'Context Menu ('+ this.determineContextMenuMountAttributes().id +') already exists for: '+ this.viewId, 'AwesomeBoxTestView.js', 'AwesomeBoxTestView', 'buildEditViewUI', 10 );
|
||||
}
|
||||
|
||||
var tab_model = {
|
||||
'tab_employee': { 'label': $.i18n._( 'AWESOMEBOX TESTING VIEW' ) },
|
||||
};
|
||||
this.setTabModel( tab_model );
|
||||
|
||||
//Tab 0 start
|
||||
|
||||
var tab_employee = this.edit_view_tab.find( '#tab_employee' );
|
||||
|
||||
var tab_employee_column1 = tab_employee.find( '.first-column' );
|
||||
|
||||
this.edit_view_tabs[0] = [];
|
||||
this.edit_view_tabs[0].push( tab_employee_column1 );
|
||||
|
||||
var $div_grid_container = $( '<div id="' + this.grid_container_id + '">' );
|
||||
tab_employee_column1.append( $div_grid_container );
|
||||
|
||||
/** build the test grids **/
|
||||
var $grid = this.addGrid( 1 );
|
||||
$div_grid_container.append( $grid );
|
||||
$grid.setData( this.getFakeData( 1 ) );
|
||||
|
||||
var column_header_text_array = [
|
||||
'column name',
|
||||
'column name2',
|
||||
'column name3',
|
||||
'column name4',
|
||||
'column name5',
|
||||
'column name6'
|
||||
];
|
||||
var $grid = this.addGrid( 6, column_header_text_array );
|
||||
$div_grid_container.append( $grid );
|
||||
$grid.setData( this.getFakeData( 6, true ) );
|
||||
|
||||
var $grid = this.addGrid( 12 );
|
||||
$div_grid_container.append( $grid );
|
||||
$grid.setData( this.getFakeData( 12 ) );
|
||||
|
||||
var $grid = this.addGrid( 40 );
|
||||
$div_grid_container.append( $grid );
|
||||
$grid.setData( this.getFakeData( 40 ) );
|
||||
|
||||
for ( var i = 0; i < this.edit_view_grid_array.length; i++ ) {
|
||||
this.edit_view_grid_array[i].setGridColumnsWidth();
|
||||
}
|
||||
|
||||
TTPromise.resolve( 'Gridtest', 'init' );
|
||||
}
|
||||
|
||||
getGridSetup() {
|
||||
var setup = {
|
||||
container_selector: '.edit-view-tab',
|
||||
sub_grid_mode: true,
|
||||
onResizeGrid: true,
|
||||
onSelectRow: function() {
|
||||
},
|
||||
onCellSelect: function() {
|
||||
},
|
||||
onSelectAll: function() {
|
||||
},
|
||||
ondblClickRow: function( e ) {
|
||||
},
|
||||
onRightClickRow: function( rowId ) {
|
||||
},
|
||||
height: 200
|
||||
};
|
||||
return setup;
|
||||
}
|
||||
|
||||
addGrid( column_count, column_header_text_array ) {
|
||||
var container_selector = 'test_grid_' + column_count;
|
||||
$( '#' + this.grid_container_id ).append( $( '<table id="' + container_selector + '" >' ) );
|
||||
|
||||
var column_info_array = [];
|
||||
for ( var n = 0; n < column_count; n++ ) {
|
||||
var letter = ( n + 10 ).toString( 36 );
|
||||
var text = 'Column ' + letter;
|
||||
if ( column_header_text_array ) {
|
||||
text = column_header_text_array[n];
|
||||
}
|
||||
column_info_array.push( {
|
||||
name: letter,
|
||||
index: letter,
|
||||
label: text,
|
||||
width: 100,
|
||||
sortable: false,
|
||||
title: false
|
||||
} );
|
||||
}
|
||||
|
||||
var $grid = new TTGrid( container_selector, this.getGridSetup(), column_info_array );
|
||||
this.edit_view_grid_array.push( $grid );
|
||||
return $grid;
|
||||
}
|
||||
|
||||
getFakeData( column_count, randomize ) {
|
||||
var data = [];
|
||||
for ( var n = 0; n < 4; n++ ) {
|
||||
var data_element = {};
|
||||
for ( var m = 0; m < column_count; m++ ) {
|
||||
var letter = ( m + 10 ).toString( 36 );
|
||||
if ( randomize ) {
|
||||
data_element[letter] = TTUUID.generateUUID();
|
||||
} else {
|
||||
data_element[letter] = 'content';
|
||||
}
|
||||
|
||||
}
|
||||
data.push( data_element );
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
buildSearchFields() {
|
||||
super.buildSearchFields();
|
||||
this.search_fields = [];
|
||||
}
|
||||
|
||||
getCustomContextMenuModel() {
|
||||
var context_menu_model = {
|
||||
exclude: ['default'],
|
||||
include: [
|
||||
'edit',
|
||||
'cancel'
|
||||
]
|
||||
};
|
||||
|
||||
return context_menu_model;
|
||||
}
|
||||
|
||||
//override that forces same data to grid at all times.
|
||||
search() {
|
||||
var result_data = JSON.parse( '[{"id":"11e85213-a799-d200-b041-123456abcdef","status":"Active","employee_number":100,"first_name":"Mr.","last_name":"FAKE","full_name":"Administrator, Mr.","home_phone":"471-438-3900","is_owner":true,"is_child":false},' +
|
||||
'{"id":"11e85213-ad34-e0e0-8541-123456abcdef","status":"Active","employee_number":13,"first_name":"Tristen","last_name":"Braun","full_name":"FAKE Braun, Tristen","home_phone":"527-500-4852","is_owner":false,"is_child":true},' +
|
||||
'{"id":"11e85213-af64-d0e0-9b00-123456abcdef","status":"Active","employee_number":20,"first_name":"Jane","last_name":"Doe","full_name":"FAKE Doe, Jane","home_phone":"477-443-9650","is_owner":false,"is_child":true},' +
|
||||
'{"id":"11e85213-ac44-1830-9908-123456abcdef","status":"Active","employee_number":10,"first_name":"John","last_name":"Doe","full_name":"FAKE Doe, John","home_phone":"464-547-9452","is_owner":false,"is_child":true}]' );
|
||||
this.user_id_array = result_data;
|
||||
result_data = this.processResultData( result_data );
|
||||
this.grid.setData( result_data );
|
||||
this.grid.setGridColumnsWidth();
|
||||
this.current_edit_record = result_data[0];
|
||||
this.setCurrentEditViewState( 'edit' );
|
||||
|
||||
TTPromise.add( 'Gridtest', 'init' );
|
||||
var $this = this;
|
||||
TTPromise.wait( 'Gridtest', 'init', function() {
|
||||
$this.initEditView();
|
||||
} );
|
||||
|
||||
this.initEditViewUI( this.viewId, this.edit_view_tpl );
|
||||
}
|
||||
|
||||
setEditViewDataDone() {
|
||||
var $this = this;
|
||||
setTimeout( function() {
|
||||
$this.setTabOVisibility( true );
|
||||
$( '.edit-view-tab-bar' ).css( 'opacity', 1 );
|
||||
}, 2500 );
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
<div class="edit-view awesomeboxtest-edit-view">
|
||||
<div class="edit-view-tab-bar" id="awesomeboxtest_edit_view_tab_bar">
|
||||
<div class="navigation-div" style="display: none">
|
||||
<span class="navigation-label"></span>
|
||||
<img class="left-click arrow"/>
|
||||
<div class="navigation-widget-div"></div>
|
||||
<img class="right-click arrow"/>
|
||||
</div>
|
||||
<span class="close-icon">x</span>
|
||||
<ul class="edit-view-tab-bar-label">
|
||||
<li><a ref="tab_employee" href="#tab_employee"></a></li>
|
||||
</ul>
|
||||
<div id="tab_employee" class="edit-view-tab-outside">
|
||||
<div class="edit-view-tab" id="tab_employee_content_div">
|
||||
<div class="first-column"></div>
|
||||
<div class="second-column">
|
||||
<div class="control-bar">
|
||||
<div class="date-chooser-div">
|
||||
</div>
|
||||
<div class="action-chooser-div">
|
||||
<div class="switch-button-div" id="all_employee">
|
||||
</div>
|
||||
<div class="switch-button-div" id="daily_totals">
|
||||
</div>
|
||||
<div class="switch-button-div" id="weekly_totals">
|
||||
</div>
|
||||
<div class="switch-button-div" id="strict_range">
|
||||
</div>
|
||||
</div>
|
||||
<div class="schedule-mode-div">
|
||||
<div class="toggle-button-div">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="qunit_container" style="display:none;">
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
16
interface/html5/views/developer_tools/WidgetTestView.html
Normal file
16
interface/html5/views/developer_tools/WidgetTestView.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<script type="text/javascript">
|
||||
var kitchen_sink_view_controller = new WidgetTestViewController();
|
||||
</script>
|
||||
<div class="view awesomebox-test-view" id="awesomebox_test_view_container">
|
||||
<div class="clear-both-div"></div>
|
||||
<div class="grid-div">
|
||||
<div class="total-number-div">
|
||||
<span class="total-number-span"></span>
|
||||
</div>
|
||||
<div class="grid-top-border"></div>
|
||||
<table id="grid"></table>
|
||||
<div class="bottom-div">
|
||||
<div class="grid-bottom-border"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@@ -0,0 +1,595 @@
|
||||
import '@/global/widgets/filebrowser/TImage';
|
||||
import '@/global/widgets/filebrowser/TImageAdvBrowser';
|
||||
import '@/global/widgets/color-picker/TColorPicker';
|
||||
import { SwitchButtonIcon } from '@/global/widgets/switch_button/SwitchButton';
|
||||
|
||||
export class WidgetTestViewController extends BaseViewController {
|
||||
constructor( options = {} ) {
|
||||
_.defaults( options, {
|
||||
el: '#awesomebox_test_view_container',
|
||||
|
||||
// _required_files: [
|
||||
// 'TColorPicker',
|
||||
// 'TImage',
|
||||
// 'TImageAdvBrowser'
|
||||
// ],
|
||||
|
||||
user_api: null,
|
||||
user_group_api: null,
|
||||
company_api: null,
|
||||
user_id_array: null
|
||||
} );
|
||||
|
||||
super( options );
|
||||
}
|
||||
|
||||
init( options ) {
|
||||
this.edit_view_tpl = 'WidgetTestEditView.html';
|
||||
this.permission_id = 'user';
|
||||
this.viewId = 'WidgetTest';
|
||||
this.script_name = 'WidgetTest';
|
||||
this.table_name_key = 'awesomebox_test';
|
||||
this.context_menu_name = $.i18n._( 'Widget Test' );
|
||||
this.navigation_label = $.i18n._( 'Widget Test' );
|
||||
this.api = TTAPI.APIUser;
|
||||
this.select_company_id = LocalCacheData.getCurrentCompany().id;
|
||||
this.user_group_api = TTAPI.APIUserGroup;
|
||||
this.company_api = TTAPI.APICompany;
|
||||
this.user_id_array = [];
|
||||
|
||||
this.render();
|
||||
this.buildContextMenu();
|
||||
this.initData();
|
||||
}
|
||||
|
||||
setCurrentEditRecordData() {
|
||||
this.collectUIDataToCurrentEditRecord();
|
||||
this.setEditViewDataDone();
|
||||
}
|
||||
|
||||
clearEditViewData() {
|
||||
return false;
|
||||
}
|
||||
|
||||
buildEditViewUI() {
|
||||
var $this = this;
|
||||
|
||||
if( ContextMenuManager.getMenu( this.determineContextMenuMountAttributes().id ) === undefined ) {
|
||||
this.buildContextMenu();
|
||||
} else {
|
||||
Debug.Warn( 'Context Menu ('+ this.determineContextMenuMountAttributes().id +') already exists for: '+ this.viewId, 'AwesomeBoxTestView.js', 'AwesomeBoxTestView', 'buildEditViewUI', 10 );
|
||||
}
|
||||
|
||||
var tab_model = {
|
||||
'tab_employee': { 'label': $.i18n._( 'Employee' ) },
|
||||
};
|
||||
this.setTabModel( tab_model );
|
||||
|
||||
//Tab 0 start
|
||||
|
||||
var tab_employee = this.edit_view_tab.find( '#tab_employee' );
|
||||
|
||||
var tab_employee_column1 = tab_employee.find( '.first-column' );
|
||||
var tab_employee_column2 = tab_employee.find( '.second-column' );
|
||||
|
||||
this.edit_view_tabs[0] = [];
|
||||
this.edit_view_tabs[0].push( tab_employee_column1 );
|
||||
|
||||
var form_item_input = Global.loadWidgetByName( FormItemType.SEPARATED_BOX );
|
||||
form_item_input.SeparatedBox( { label: $.i18n._( 'Separated_box: if you see this, the test is passing.' ) } );
|
||||
this.addEditFieldToColumn( null, form_item_input, tab_employee_column1 );
|
||||
|
||||
form_item_input = Global.loadWidgetByName( FormItemType.CHECKBOX );
|
||||
form_item_input.TCheckbox( { field: 'checkbox' } );
|
||||
this.addEditFieldToColumn( $.i18n._( 'TCheckbox' ), form_item_input, tab_employee_column1, '' );
|
||||
|
||||
form_item_input = Global.loadWidgetByName( FormItemType.COLOR_PICKER );
|
||||
form_item_input.TColorPicker( { field: 'color_picker' } );
|
||||
this.addEditFieldToColumn( $.i18n._( 'TColorPicker' ), form_item_input, tab_employee_column1 );
|
||||
|
||||
form_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );
|
||||
form_item_input.TDatePicker( { field: 'datepicker' } );
|
||||
this.addEditFieldToColumn( $.i18n._( 'TDatePicker' ), form_item_input, tab_employee_column1, '', null );
|
||||
|
||||
form_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );
|
||||
form_item_input.TRangePicker( { field: 'daterange', validation_field: 'date_stamp' } );
|
||||
this.addEditFieldToColumn( $.i18n._( 'TDateRange' ), form_item_input, tab_employee_column1, '', null, true );
|
||||
|
||||
form_item_input = Global.loadWidgetByName( FormItemType.TIME_PICKER );
|
||||
form_item_input.TTimePicker( { field: 'timepicker' } );
|
||||
this.addEditFieldToColumn( $.i18n._( 'TTimePicker' ), form_item_input, tab_employee_column1 );
|
||||
|
||||
form_item_input = Global.loadWidgetByName( FormItemType.IMAGE_AVD_BROWSER );
|
||||
this.file_browser = form_item_input.TImageAdvBrowser( {
|
||||
field: 'imagebrowser',
|
||||
default_width: 128,
|
||||
default_height: 128,
|
||||
enable_delete: true,
|
||||
callBack: function( form_data ) {
|
||||
new ServiceCaller().uploadFile( form_data, 'object_type=user_photo&object_id=' + $this.current_edit_record.id, {
|
||||
onResult: function( result ) {
|
||||
|
||||
if ( result.toLowerCase() === 'true' ) {
|
||||
$this.file_browser.setImage( ServiceCaller.getURLByObjectType( 'user_photo' ) + '&object_id=' + $this.current_edit_record.id );
|
||||
} else {
|
||||
TAlertManager.showAlert( result, 'Error' );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
},
|
||||
deleteImageHandler: function( e ) {
|
||||
$this.onDeleteImage();
|
||||
}
|
||||
} );
|
||||
this.addEditFieldToColumn( $.i18n._( 'TImageAdvBrowser' ), this.file_browser, tab_employee_column1, '', null, false, true );
|
||||
|
||||
Global.loadScript( 'global/widgets/formula_builder/FormulaBuilder.js', function() {
|
||||
// Dynamic Field 11
|
||||
form_item_input = Global.loadWidgetByName( FormItemType.FORMULA_BUILDER );
|
||||
form_item_input.FormulaBuilder( {
|
||||
field: 'formula', width: '100%', onFormulaBtnClick: function() {
|
||||
|
||||
var custom_column_api = TTAPI.APIReportCustomColumn;
|
||||
|
||||
custom_column_api.getOptions( 'formula_functions', {
|
||||
onResult: function( fun_result ) {
|
||||
var fun_res_data = fun_result.getResult();
|
||||
|
||||
$this.api.getOptions( 'formula_variables', { onResult: onColumnsResult } );
|
||||
|
||||
function onColumnsResult( col_result ) {
|
||||
var col_res_data = col_result.getResult();
|
||||
|
||||
var default_args = {};
|
||||
default_args.functions = Global.buildRecordArray( fun_res_data );
|
||||
default_args.variables = Global.buildRecordArray( col_res_data );
|
||||
default_args.formula = $this.current_edit_record.company_value1;
|
||||
default_args.current_edit_record = Global.clone( $this.current_edit_record );
|
||||
default_args.api = $this.api;
|
||||
|
||||
IndexViewController.openWizard( 'FormulaBuilderWizard', default_args, function( val ) {
|
||||
$this.current_edit_record.company_value1 = val;
|
||||
$this.edit_view_ui_dic.df_11.setValue( val );
|
||||
} );
|
||||
}
|
||||
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
$this.detachElement( 'df_11' );
|
||||
$this.addEditFieldToColumn( 'FormulaBuilder', form_item_input, tab_employee_column1, '', null, true );
|
||||
form_item_input.parent().width( '45%' );
|
||||
} );
|
||||
|
||||
//NO INSTANCES OF TList
|
||||
|
||||
//Create action switch buttons
|
||||
var action_chooser_div = $( '.control-bar .action-chooser-div' );
|
||||
this.all_employee_btn = action_chooser_div.find( '#all_employee' );
|
||||
this.daily_totals_btn = action_chooser_div.find( '#daily_totals' );
|
||||
this.weekly_totals_btn = action_chooser_div.find( '#weekly_totals' );
|
||||
this.strict_range_btn = action_chooser_div.find( '#strict_range' );
|
||||
this.all_employee_btn = this.all_employee_btn.SwitchButton( {
|
||||
icon: SwitchButtonIcon.all_employee,
|
||||
tooltip: $.i18n._( 'Show Unscheduled Employees' )
|
||||
} );
|
||||
this.daily_totals_btn = this.daily_totals_btn.SwitchButton( {
|
||||
icon: SwitchButtonIcon.daily_total,
|
||||
tooltip: $.i18n._( 'Daily Totals' )
|
||||
} );
|
||||
this.weekly_totals_btn = this.weekly_totals_btn.SwitchButton( {
|
||||
icon: SwitchButtonIcon.weekly_total,
|
||||
tooltip: $.i18n._( 'Weekly Totals' )
|
||||
} );
|
||||
this.strict_range_btn = this.strict_range_btn.SwitchButton( {
|
||||
icon: SwitchButtonIcon.strict_range,
|
||||
tooltip: $.i18n._( 'Strict Range' )
|
||||
} );
|
||||
this.all_employee_btn.click( function() {
|
||||
// $this.onShowEmployeeClick();
|
||||
} );
|
||||
this.daily_totals_btn.click( function() {
|
||||
// $this.onDailyTotalsClick();
|
||||
} );
|
||||
this.weekly_totals_btn.click( function() {
|
||||
// $this.onWeeklyTotalClick();
|
||||
} );
|
||||
this.strict_range_btn.setValue( true );
|
||||
this.strict_range_btn.click( function() {
|
||||
// $this.onStrictRangeClick();
|
||||
} );
|
||||
this.toggle_button = $( this.el ).find( '.toggle-button-div' );
|
||||
var data_provider = [
|
||||
{ label: $.i18n._( 'Day' ), value: 'day' },
|
||||
{ label: $.i18n._( 'Week' ), value: 'week' },
|
||||
{ label: $.i18n._( 'Month' ), value: 'month' },
|
||||
{ label: $.i18n._( 'Year' ), value: 'year' }
|
||||
];
|
||||
|
||||
this.toggle_button = this.toggle_button.TToggleButton( { data_provider: data_provider } );
|
||||
this.toggle_button.bind( 'change', function( e, result ) {
|
||||
$this.scroll_position = 0;
|
||||
$this.select_all_shifts_array = [];
|
||||
$this.select_shifts_array = [];
|
||||
$this.select_recurring_shifts_array = [];
|
||||
} );
|
||||
|
||||
form_item_input = Global.loadWidgetByName( FormItemType.TAG_INPUT );
|
||||
form_item_input.TTagInput( { field: 'tags', object_type_id: 930 } );
|
||||
this.addEditFieldToColumn( $.i18n._( 'TTagInput' ), form_item_input, tab_employee_column2, '', null, null, true );
|
||||
|
||||
//requires width manipulation or intermittently won't show.
|
||||
form_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
|
||||
form_item_input.TTextInput( { field: 'text', width: '100%' } );
|
||||
this.addEditFieldToColumn( $.i18n._( 'TText' ), form_item_input, tab_employee_column2 );
|
||||
form_item_input.parent().width( '45%' );
|
||||
|
||||
form_item_input = Global.loadWidgetByName( FormItemType.PASSWORD_INPUT );
|
||||
form_item_input.TPasswordInput( { field: 'password', width: 200 } );
|
||||
this.addEditFieldToColumn( $.i18n._( 'TPasswordInput' ), form_item_input, tab_employee_column2 );
|
||||
|
||||
form_item_input = Global.loadWidgetByName( FormItemType.TEXT_AREA );
|
||||
form_item_input.TTextArea( { field: 'textarea' } );
|
||||
this.addEditFieldToColumn( $.i18n._( 'TTextArea' ), form_item_input, tab_employee_column2, '', null, null, true );
|
||||
}
|
||||
|
||||
buildSearchFields() {
|
||||
super.buildSearchFields();
|
||||
var $this = this;
|
||||
this.search_fields = [];
|
||||
}
|
||||
|
||||
getCustomContextMenuModel() {
|
||||
var context_menu_model = {
|
||||
exclude: ['default'],
|
||||
include: [
|
||||
'edit',
|
||||
'cancel'
|
||||
]
|
||||
};
|
||||
|
||||
return context_menu_model;
|
||||
}
|
||||
|
||||
//override that forces same data to grid at all times.
|
||||
search() {
|
||||
var $this = this;
|
||||
this.api.getUser( {}, true, {
|
||||
onResult: function( r ) {
|
||||
var result_data = r.getResult();
|
||||
$this.user_id_array = result_data;
|
||||
result_data = $this.processResultData( result_data );
|
||||
$this.grid.setData( result_data );
|
||||
$this.grid.setGridColumnsWidth();
|
||||
$this.onEditClick( result_data[0].id );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
setEditViewDataDone() {
|
||||
var $this = this;
|
||||
setTimeout( function() {
|
||||
TAlertManager.showConfirmAlert( $.i18n._( 'Run tests?' ), null, function( result ) {
|
||||
if ( result == true ) {
|
||||
$this.runTests();
|
||||
}
|
||||
} );
|
||||
$this.setTabOVisibility( true );
|
||||
$( '.edit-view-tab-bar' ).css( 'opacity', 1 );
|
||||
TTPromise.resolve( 'init', 'init' );
|
||||
}, 2500 );
|
||||
|
||||
super.setEditViewDataDone();
|
||||
}
|
||||
|
||||
runTests() {
|
||||
var $this = this;
|
||||
if ( $( '#qunit_script' ).length == 0 ) {
|
||||
$( '<script id=\'qunit_script\' src=\'framework/qunit/qunit.js\'></script>' ).appendTo( 'head' );
|
||||
$( '<link rel=\'stylesheet\' type=\'text/css\' href=\'framework/qunit/qunit.css\'>' ).appendTo( 'head' );
|
||||
}
|
||||
;
|
||||
|
||||
QUnit.config.autostart = false;
|
||||
$( '#qunit_container' ).css( 'width', '100%' );
|
||||
$( '#qunit_container' ).css( 'height', 'auto' );
|
||||
$( '#qunit_container' ).css( 'overflow-y', 'scroll' );
|
||||
$( '#qunit_container' ).css( 'top', '0px' );
|
||||
$( '#qunit_container' ).css( 'left', '0px' );
|
||||
$( '#qunit_container' ).css( 'z-index', '100' );
|
||||
$( '#qunit_container' ).css( 'background', '#fff' );
|
||||
$( '#qunit_container' ).show();
|
||||
|
||||
$( '#tt_debug_console' ).remove();
|
||||
if ( !window.qunit_initiated ) {
|
||||
window.qunit_initiated = true;
|
||||
//QUnit.start(); //This causes a JavaScript exception, but does not seem to be required. Test ran without it.
|
||||
}
|
||||
|
||||
//select an item by clicking a td in the last row
|
||||
QUnit.module( 'Widgets' );
|
||||
this.testCheckbox();
|
||||
this.testColorPicker();
|
||||
|
||||
TTPromise.add( 'datetests', 'picker' );
|
||||
TTPromise.add( 'datetests', 'range' );
|
||||
this.testDatePicker();
|
||||
this.testDateRange();
|
||||
//as timepicker is a date picker with alt options enabled, it must be triggered after the date tests are done or the selectors will collide and possibly provide false positives
|
||||
TTPromise.wait( 'datetests', null, function() {
|
||||
$this.testTimePicker();
|
||||
} );
|
||||
|
||||
TTPromise.add( 'wizardtests', 'imagebrowser' );
|
||||
this.testImageBrowser();
|
||||
TTPromise.wait( 'wizardtests', 'imagebrowser', function() {
|
||||
$this.testFormulaBuilder();
|
||||
} );
|
||||
|
||||
TTPromise.wait( 'null', 'null', function() {
|
||||
$this.testTags();
|
||||
} );
|
||||
|
||||
this.testButtons();
|
||||
this.testText();
|
||||
this.testPassword();
|
||||
this.testTextarea();
|
||||
|
||||
//Extra tests that should be added to test non-form widgets
|
||||
//todo: TAlert
|
||||
//todo: inside_editor
|
||||
//todo: error tips
|
||||
//todo: test feedback widget
|
||||
//todo: live_chat
|
||||
//todo: paging
|
||||
//todo: search_panel
|
||||
//todo: top_notification
|
||||
//todo: view_min_tab
|
||||
}
|
||||
|
||||
testCheckbox() {
|
||||
var $this = this;
|
||||
QUnit.test( 'Checkbox tests', function( assert ) {
|
||||
var cb = $this.edit_view_ui_dic.checkbox;
|
||||
assert.ok( cb.getValue() == false, 'checkbox not checked' );
|
||||
cb.setValue( true );
|
||||
assert.ok( cb.getValue(), 'checkbox checked via code' );
|
||||
cb.setValue( false );
|
||||
assert.ok( cb.getValue() == false, 'checkbox unchecked via code' );
|
||||
$( cb ).click();
|
||||
assert.ok( cb.getValue(), 'checkbox checked via click' );
|
||||
$( cb ).click();
|
||||
assert.ok( cb.getValue() == false, 'checkbox unchecked via click' );
|
||||
} );
|
||||
}
|
||||
|
||||
testColorPicker() {
|
||||
var $this = this;
|
||||
QUnit.test( 'ColorPicker tests', function( assert ) {
|
||||
var done_testing = assert.async();
|
||||
var widget = $this.edit_view_ui_dic.color_picker;
|
||||
assert.ok( widget.getValue() == '', 'widget empty' );
|
||||
$( widget ).click();
|
||||
|
||||
setTimeout( function() {
|
||||
$( '.cp-color-picker' ).hide();
|
||||
assert.ok( widget.getValue() == 'FFFFFF', 'widget white after no select: ' + widget.getValue() );
|
||||
widget.setValue( 'FF0000' );
|
||||
assert.ok( widget.getValue() == 'FF0000', 'widget red after set value programatically' + widget.getValue() );
|
||||
|
||||
$( widget ).click();
|
||||
//there's no color selection by click because it's based on mouseup and mousedown events which can't be simulated at specific coordinates
|
||||
|
||||
$( '.cp-color-picker' ).hide();
|
||||
done_testing();
|
||||
}, 1000 );
|
||||
} );
|
||||
}
|
||||
|
||||
testDatePicker() {
|
||||
var $this = this;
|
||||
QUnit.test( 'DatePicker tests', function( assert ) {
|
||||
var done_testing = assert.async();
|
||||
var widget = $this.edit_view_ui_dic.datepicker;
|
||||
assert.ok( widget.getValue() == '', 'widget empty' );
|
||||
setTimeout( function() {
|
||||
widget.find( '#tDatePickerIcon' ).trigger( 'mouseup' );
|
||||
assert.ok( ( $( '#ui-datepicker-div:visible' ).length > 0 ), 'calendar visible after click' );
|
||||
$( $( '#ui-datepicker-div .ui-datepicker-calendar td' )[15] ).click();
|
||||
setTimeout( function() {
|
||||
assert.ok( ( $( '#ui-datepicker-div:visible' ).length == 0 ), 'calendar invisible after date selection' );
|
||||
assert.ok( widget.getValue() != '', 'value is not blank' );
|
||||
TTPromise.resolve( 'datetests', 'picker' );
|
||||
|
||||
done_testing();
|
||||
}, 1000 );
|
||||
}, 1000 );
|
||||
} );
|
||||
}
|
||||
|
||||
testDateRange() {
|
||||
var $this = this;
|
||||
QUnit.test( 'DateRange tests', function( assert ) {
|
||||
var done_testing = assert.async();
|
||||
var widget = $this.edit_view_ui_dic.daterange;
|
||||
assert.ok( typeof widget.getValue() == 'undefined', 'widget empty ' + widget.getValue() );
|
||||
widget.find( '#tDatePickerIcon' ).trigger( 'mouseup' );
|
||||
setTimeout( function() {
|
||||
assert.ok( ( $( '.t-range-picker-div:visible' ).length > 0 ), 'calendar visible after click' );
|
||||
$( $( '.t-range-picker-div .end-picker td' )[15] ).click();
|
||||
$( '.t-range-picker-div .close-icon' ).click();
|
||||
setTimeout( function() {
|
||||
assert.ok( ( $( '.t-range-picker-div:visible' ).length == 0 ), 'calendar invisible after closing' );
|
||||
assert.ok( widget.getValue() != '', 'value is not blank' );
|
||||
done_testing();
|
||||
TTPromise.resolve( 'datetests', 'range' );
|
||||
}, 1000 );
|
||||
}, 1000 );
|
||||
} );
|
||||
}
|
||||
|
||||
testTimePicker() {
|
||||
var $this = this;
|
||||
QUnit.test( 'TimePicker tests', function( assert ) {
|
||||
var widget = $this.edit_view_ui_dic.timepicker;
|
||||
assert.ok( widget.getValue() == '', 'widget empty: ' + widget.getValue() );
|
||||
widget.find( '#tTimePickerIcon' ).trigger( 'mouseup' );
|
||||
assert.ok( ( $( '#ui-datepicker-div:visible' ).length > 0 ), 'timepicker widget visible after click' );
|
||||
$( '#ui-datepicker-div:visible button[data-handler="today"]' ).click();
|
||||
assert.ok( ( $( '#ui-datepicker-div:visible' ).length > 0 ), 'timepicker widget visible after now click' );
|
||||
$( '#ui-datepicker-div:visible button[data-handler="hide"]' ).click();
|
||||
assert.ok( ( $( '#ui-datepicker-div:visible' ).length == 0 ), 'timepicker widget gone clicking close button' );
|
||||
assert.ok( widget.getValue() != '', 'value is not blank' );
|
||||
} );
|
||||
}
|
||||
|
||||
testImageBrowser() {
|
||||
var $this = this;
|
||||
TTPromise.add( '' );
|
||||
QUnit.test( 'ImageBrowser tests', function( assert ) {
|
||||
var done_testing = assert.async();
|
||||
var widget = $this.edit_view_ui_dic.imagebrowser;
|
||||
assert.ok( typeof widget.getValue() == 'undefined', 'widget empty: ' + widget.getValue() );
|
||||
widget.find( '#upload_image' ).click();
|
||||
setTimeout( function() {
|
||||
assert.ok( $( '.wizard:visible' ).length > 0, 'wizard visible' );
|
||||
$( '.wizard:visible .close-btn' ).click();
|
||||
assert.ok( $( '.wizard:visible' ).length == 0, 'wizard invisible' );
|
||||
done_testing();
|
||||
TTPromise.resolve( 'wizardtests', 'imagebrowser' );
|
||||
}, 1000 );
|
||||
} );
|
||||
}
|
||||
|
||||
testFormulaBuilder() {
|
||||
var $this = this;
|
||||
QUnit.test( 'FormulaBuilder tests', function( assert ) {
|
||||
var done_testing = assert.async();
|
||||
var widget = $this.edit_view_ui_dic.formula;
|
||||
assert.ok( widget.getValue() == '', 'widget empty: ' + widget.getValue() );
|
||||
widget.find( '.t-button.formula-btn' ).click();
|
||||
setTimeout( function() {
|
||||
assert.ok( $( '.wizard:visible' ).length > 0, 'wizard visible' );
|
||||
$( '.wizard:visible .close-btn' ).click();
|
||||
assert.ok( $( '.wizard:visible' ).length == 0, 'wizard invisible' );
|
||||
done_testing();
|
||||
}, 1000 );
|
||||
} );
|
||||
}
|
||||
|
||||
testButtons() {
|
||||
var $this = this;
|
||||
QUnit.test( 'TotalButtons tests', function( assert ) {
|
||||
var done_testing = assert.async();
|
||||
|
||||
var all_employee_btn = $( '.control-bar .action-chooser-div #all_employee .all-employee' );
|
||||
var daily_totals_btn = $( '.control-bar .action-chooser-div #daily_totals .daily' );
|
||||
var weekly_totals_btn = $( '.control-bar .action-chooser-div #weekly_totals .weekly' );
|
||||
var strict_range_btn = $( '.control-bar .action-chooser-div #strict_range .strict-range' );
|
||||
|
||||
assert.ok( strict_range_btn.hasClass( 'selected' ), 'strict range starts selected' );
|
||||
assert.ok( daily_totals_btn.hasClass( 'selected' ) == false, 'daily totals starts unselected' );
|
||||
assert.ok( weekly_totals_btn.hasClass( 'selected' ) == false, 'week total starts unselected' );
|
||||
assert.ok( all_employee_btn.hasClass( 'selected' ) == false, 'all employees starts unselected' );
|
||||
|
||||
strict_range_btn.click();
|
||||
setTimeout( function() {
|
||||
assert.ok( strict_range_btn.hasClass( 'selected' ) == false, 'strict range unselects on click' );
|
||||
daily_totals_btn.click();
|
||||
setTimeout( function() {
|
||||
assert.ok( daily_totals_btn.hasClass( 'selected' ), 'daily_totals_btn selects on click' );
|
||||
weekly_totals_btn.click();
|
||||
setTimeout( function() {
|
||||
assert.ok( weekly_totals_btn.hasClass( 'selected' ), 'weekly_totals_btn selects on click' );
|
||||
all_employee_btn.click();
|
||||
setTimeout( function() {
|
||||
assert.ok( all_employee_btn.hasClass( 'selected' ), 'all_employee_btn selects on click' );
|
||||
strict_range_btn.click();
|
||||
daily_totals_btn.click();
|
||||
weekly_totals_btn.click();
|
||||
all_employee_btn.click();
|
||||
setTimeout( function() {
|
||||
|
||||
//back to initial state
|
||||
assert.ok( strict_range_btn.hasClass( 'selected' ), 'strict range starts selected' );
|
||||
assert.ok( daily_totals_btn.hasClass( 'selected' ) == false, 'daily totals starts unselected' );
|
||||
assert.ok( weekly_totals_btn.hasClass( 'selected' ) == false, 'week total starts unselected' );
|
||||
assert.ok( all_employee_btn.hasClass( 'selected' ) == false, 'all employees starts unselected' );
|
||||
done_testing();
|
||||
}, 1500 );
|
||||
}, 1500 );
|
||||
}, 1500 );
|
||||
}, 1500 );
|
||||
}, 1500 );
|
||||
} );
|
||||
}
|
||||
|
||||
testTags() {
|
||||
var $this = this;
|
||||
QUnit.test( 'Tags tests', function( assert ) {
|
||||
var done_testing = assert.async();
|
||||
var el = $this.edit_view_ui_dic.tags.find( 'input.add-tag-input' );
|
||||
var val = $this.edit_view_ui_dic.tags.getValue();
|
||||
assert.ok( val == '', 'starts empty ' + val );
|
||||
|
||||
el.focus();
|
||||
$( el ).val( 'test1' );
|
||||
$( el ).trigger( { type: 'keydown', which: 32, keyCode: 32 } );
|
||||
$( el ).val( 'test2' );
|
||||
$( el ).trigger( { type: 'keydown', which: 32, keyCode: 32 } );
|
||||
|
||||
setTimeout( function() {
|
||||
var val = $this.edit_view_ui_dic.tags.getValue();
|
||||
assert.ok( val == 'test1,test2', '2 tags entered and return in value: ' + val );
|
||||
setTimeout( function() {
|
||||
//click the x's to remove them
|
||||
$( '.tag-span-div .close-btn' ).click();
|
||||
setTimeout( function() {
|
||||
var val = $this.edit_view_ui_dic.tags.getValue();
|
||||
assert.ok( val == '-test1,-test2', '2 tags entered and return (subtracted) in value: ' + val );
|
||||
done_testing();
|
||||
}, 1000 );
|
||||
}, 1000 );
|
||||
}, 1000 );
|
||||
} );
|
||||
}
|
||||
|
||||
testText() {
|
||||
var $this = this;
|
||||
QUnit.test( 'Text test', function( assert ) {
|
||||
//var done_testing = assert.async();
|
||||
var textbox = $this.edit_view_ui_dic.text;
|
||||
textbox.setValue( 'testing textbox' );
|
||||
assert.ok( textbox.getValue() == 'testing textbox', 'accepts text and returns value' );
|
||||
textbox.setValue( '' );
|
||||
assert.ok( textbox.getValue() == '', 'returned value updates when text is updated' );
|
||||
} );
|
||||
}
|
||||
|
||||
testPassword() {
|
||||
var $this = this;
|
||||
QUnit.test( 'Password box test', function( assert ) {
|
||||
//var done_testing = assert.async();
|
||||
var textbox = $this.edit_view_ui_dic.password;
|
||||
textbox.setValue( 'testing textbox' );
|
||||
assert.ok( textbox.getValue() == 'testing textbox', 'accepts text and returns value' );
|
||||
textbox.setValue( '' );
|
||||
assert.ok( textbox.getValue() == '', 'returned value updates when text is updated' );
|
||||
} );
|
||||
}
|
||||
|
||||
testTextarea() {
|
||||
var $this = this;
|
||||
QUnit.test( 'Password box test', function( assert ) {
|
||||
//var done_testing = assert.async();
|
||||
var textbox = $this.edit_view_ui_dic.textarea;
|
||||
textbox.setValue( 'testing textbox' );
|
||||
assert.ok( textbox.getValue() == 'testing textbox', 'accepts text and returns value' );
|
||||
textbox.setValue( '' );
|
||||
assert.ok( textbox.getValue() == '', 'returned value updates when text is updated' );
|
||||
} );
|
||||
}
|
||||
|
||||
}
|
1209
interface/html5/views/developer_tools/debugPanelController.js
Normal file
1209
interface/html5/views/developer_tools/debugPanelController.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
||||
$( '#Asdfa' );
|
||||
{
|
||||
}
|
||||
{
|
||||
{
|
||||
{
|
Reference in New Issue
Block a user