@ -2,12 +2,32 @@
// For license information, please see license.txt
// For license information, please see license.txt
var original_display_order = 0 ;
var original_display_order = 0 ;
var vehicle_count = 0 ;
var vehicle_count = 0 ;
frappe . require ( 'assets/smart_service/js/boostrap_table.js' , ( ) => {
} )
frappe . require ( 'assets/smart_service/css/boostrap_table.css' , ( ) => {
} )
frappe . ui . form . on ( 'Torque Manual' , {
frappe . ui . form . on ( 'Torque Manual' , {
refresh : function ( frm ) {
refresh : function ( frm ) {
set_display_order ( frm )
set_display_order ( frm )
} ,
} ,
onload : function ( frm ) {
if ( frm . doc . vehicle ) {
get_column_data ( frm )
}
} ,
vehicle : function ( frm ) {
if ( frm . doc . vehicle ) {
get_column_data ( frm )
}
}
} ) ;
} ) ;
function set_display_order ( frm ) {
function set_display_order ( frm ) {
@ -31,4 +51,61 @@ function set_display_order(frm){
original_display_order = frm . doc . display_order ;
original_display_order = frm . doc . display_order ;
}
}
} ) ;
} ) ;
}
function get_column_data ( frm ) {
frappe . call ( {
method : "smart_service.phase_2.doctype.torque_manual.torque_manual.get_column_details" ,
args : { vehicle : frm . doc . vehicle }
} ) . done ( ( r ) => {
let details = [ ]
if ( r . message . success == 1 ) {
$ . each ( r . message . data , function ( _ i , e ) {
debugger
details . push ( { "columnid" : e . column_id , "column_name" : e . column_name } ) ;
debugger
} )
console . log ( details )
var res = $ ( cur_frm . fields_dict . column_details . wrapper ) . empty ( ) ;
var html = ""
html = '<div class="table-responsive"><table id="tblEmployee" class="table table-striped"></table></div>'
$ ( res ) . append ( html )
$ ( '#tblEmployee' ) . bootstrapTable ( {
data : details ,
// height: 500,
pagination : false ,
pageSize : 10 ,
// pageList: [],
search : false ,
showExport : false ,
exportTypes : [ 'json' , 'xml' , 'csv' , 'txt' , 'sql' , 'excel' , 'pdf' ] ,
columns : [ {
field : 'columnid' ,
title : 'Column Number' ,
align : 'center' ,
valign : 'bottom' ,
sortable : false ,
width : '10%'
} ,
{
field : 'column_name' ,
title : 'Column Name' ,
align : 'left' ,
valign : 'bottom' ,
sortable : false ,
width : '10%'
} ]
} )
}
} )
}
}