231 lines
6.1 KiB
JavaScript
231 lines
6.1 KiB
JavaScript
export class QualificationViewController extends BaseViewController {
|
|
constructor( options = {} ) {
|
|
_.defaults( options, {
|
|
el: '#qualification_view_container',
|
|
|
|
|
|
|
|
type_array: null,
|
|
visibility_type_array: null,
|
|
source_type_array: null,
|
|
qualification_group_array: null,
|
|
|
|
qualification_group_api: null,
|
|
|
|
document_object_type_id: null
|
|
} );
|
|
|
|
super( options );
|
|
}
|
|
|
|
init( options ) {
|
|
//this._super('initialize', options );
|
|
this.edit_view_tpl = 'QualificationEditView.html';
|
|
this.permission_id = 'qualification';
|
|
this.viewId = 'Qualification';
|
|
this.script_name = 'QualificationView';
|
|
this.table_name_key = 'qualification';
|
|
this.context_menu_name = $.i18n._( 'Qualification' );
|
|
this.navigation_label = $.i18n._( 'Qualification' );
|
|
this.api = TTAPI.APIQualification;
|
|
this.qualification_group_api = TTAPI.APIQualificationGroup;
|
|
this.document_object_type_id = 120;
|
|
this.render();
|
|
this.buildContextMenu();
|
|
|
|
this.initData();
|
|
}
|
|
|
|
initOptions() {
|
|
var $this = this;
|
|
|
|
var options = [
|
|
{ option_name: 'type', api: this.api },
|
|
{ option_name: 'visibility_type', api: this.api },
|
|
{ option_name: 'source_type', api: this.api },
|
|
];
|
|
|
|
this.initDropDownOptions( options );
|
|
|
|
this.qualification_group_api.getQualificationGroup( '', false, false, {
|
|
onResult: function( res ) {
|
|
res = res.getResult();
|
|
|
|
res = Global.buildTreeRecord( res );
|
|
$this.qualification_group_array = res;
|
|
if ( !$this.sub_view_mode && $this.basic_search_field_ui_dic['group_id'] ) {
|
|
$this.basic_search_field_ui_dic['group_id'].setSourceData( res );
|
|
}
|
|
|
|
}
|
|
} );
|
|
}
|
|
|
|
buildEditViewUI() {
|
|
|
|
super.buildEditViewUI();
|
|
|
|
var $this = this;
|
|
|
|
var tab_model = {
|
|
'tab_qualification': { 'label': $.i18n._( 'Qualification' ) },
|
|
'tab_attachment': true,
|
|
'tab_audit': true,
|
|
};
|
|
this.setTabModel( tab_model );
|
|
|
|
this.navigation.AComboBox( {
|
|
api_class: TTAPI.APIQualification,
|
|
id: this.script_name + '_navigation',
|
|
allow_multiple_selection: false,
|
|
layout_name: 'global_qualification',
|
|
navigation_mode: true,
|
|
show_search_inputs: true
|
|
} );
|
|
|
|
this.setNavigation();
|
|
|
|
//Tab 0 start
|
|
|
|
var tab_qualification = this.edit_view_tab.find( '#tab_qualification' );
|
|
|
|
var tab_qualification_column1 = tab_qualification.find( '.first-column' );
|
|
|
|
this.edit_view_tabs[0] = [];
|
|
|
|
this.edit_view_tabs[0].push( tab_qualification_column1 );
|
|
|
|
//Name
|
|
var form_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );
|
|
|
|
form_item_input.TTextInput( { field: 'name', width: '100%' } );
|
|
this.addEditFieldToColumn( $.i18n._( 'Name' ), form_item_input, tab_qualification_column1, '' );
|
|
|
|
form_item_input.parent().width( '45%' );
|
|
|
|
//Type
|
|
form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
|
|
form_item_input.TComboBox( { field: 'type_id' } );
|
|
form_item_input.setSourceData( $this.type_array );
|
|
this.addEditFieldToColumn( $.i18n._( 'Type' ), form_item_input, tab_qualification_column1 );
|
|
|
|
//Group
|
|
form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );
|
|
|
|
form_item_input.AComboBox( {
|
|
tree_mode: true,
|
|
allow_multiple_selection: false,
|
|
layout_name: 'global_tree_column',
|
|
set_empty: true,
|
|
field: 'group_id'
|
|
} );
|
|
form_item_input.setSourceData( $this.qualification_group_array );
|
|
this.addEditFieldToColumn( $.i18n._( 'Qualification Group' ), form_item_input, tab_qualification_column1 );
|
|
|
|
//Visibility Type
|
|
form_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );
|
|
form_item_input.TComboBox( { field: 'visibility_type_id' } );
|
|
form_item_input.setSourceData( $this.visibility_type_array );
|
|
this.addEditFieldToColumn( $.i18n._( 'Visibility' ), form_item_input, tab_qualification_column1 );
|
|
|
|
// Description
|
|
form_item_input = Global.loadWidgetByName( FormItemType.TEXT_AREA );
|
|
form_item_input.TTextArea( { field: 'description', width: '100%' } );
|
|
this.addEditFieldToColumn( $.i18n._( 'Description' ), form_item_input, tab_qualification_column1, '', null, null, true );
|
|
|
|
form_item_input.parent().width( '45%' );
|
|
|
|
//Tags
|
|
form_item_input = Global.loadWidgetByName( FormItemType.TAG_INPUT );
|
|
|
|
form_item_input.TTagInput( { field: 'tag', object_type_id: 250 } );
|
|
this.addEditFieldToColumn( $.i18n._( 'Tags' ), form_item_input, tab_qualification_column1, '', null, null, true );
|
|
}
|
|
|
|
buildSearchFields() {
|
|
|
|
super.buildSearchFields();
|
|
this.search_fields = [
|
|
|
|
new SearchField( {
|
|
label: $.i18n._( 'Name' ),
|
|
in_column: 1,
|
|
field: 'name',
|
|
multiple: true,
|
|
basic_search: true,
|
|
adv_search: false,
|
|
form_item_type: FormItemType.TEXT_INPUT
|
|
} ),
|
|
|
|
new SearchField( {
|
|
label: $.i18n._( 'Type' ),
|
|
in_column: 1,
|
|
field: 'type_id',
|
|
multiple: true,
|
|
basic_search: true,
|
|
adv_search: false,
|
|
layout_name: 'global_option_column',
|
|
form_item_type: FormItemType.AWESOME_BOX
|
|
} ),
|
|
|
|
new SearchField( {
|
|
label: $.i18n._( 'Group' ),
|
|
in_column: 1,
|
|
multiple: true,
|
|
field: 'group_id',
|
|
layout_name: 'global_tree_column',
|
|
tree_mode: true,
|
|
basic_search: true,
|
|
adv_search: false,
|
|
form_item_type: FormItemType.AWESOME_BOX
|
|
} ),
|
|
|
|
new SearchField( {
|
|
label: $.i18n._( 'Source' ),
|
|
in_column: 2,
|
|
field: 'source_type_id',
|
|
multiple: true,
|
|
basic_search: true,
|
|
adv_search: false,
|
|
layout_name: 'global_option_column',
|
|
form_item_type: FormItemType.AWESOME_BOX
|
|
} ),
|
|
|
|
new SearchField( {
|
|
label: $.i18n._( 'Visibility' ),
|
|
in_column: 2,
|
|
field: 'visibility_type_id',
|
|
multiple: true,
|
|
basic_search: true,
|
|
adv_search: false,
|
|
layout_name: 'global_option_column',
|
|
form_item_type: FormItemType.AWESOME_BOX
|
|
} ),
|
|
|
|
new SearchField( {
|
|
label: $.i18n._( 'Created By' ),
|
|
in_column: 2,
|
|
field: 'created_by',
|
|
layout_name: 'global_user',
|
|
api_class: TTAPI.APIUser,
|
|
multiple: true,
|
|
basic_search: true,
|
|
adv_search: false,
|
|
form_item_type: FormItemType.AWESOME_BOX
|
|
} ),
|
|
|
|
new SearchField( {
|
|
label: $.i18n._( 'Updated By' ),
|
|
in_column: 2,
|
|
field: 'updated_by',
|
|
layout_name: 'global_user',
|
|
api_class: TTAPI.APIUser,
|
|
multiple: true,
|
|
basic_search: true,
|
|
adv_search: false,
|
|
form_item_type: FormItemType.AWESOME_BOX
|
|
} )
|
|
];
|
|
}
|
|
}
|