@@ -96,13 +96,13 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';
96
96
97
97
//Search grid - instance ref property.
98
98
let productSearchGridInstance = useRef < GridComponent > ( null ) ;
99
- const searchGridToolbarOptions = [ "Search" ] ;
99
+ const searchGridToolbarOptions : any = [ "Search" ] ;
100
100
const animationSettings : AnimationSettingsModel = { effect : "None" } ;
101
- const selectionSettings = { mode : "Row" , type : "Multiple" , checkboxOnly : true } ;
102
- const searchGridSelectionSettings = { mode : "Row" , type : "Multiple" } ;
103
- const toolbarOptions = [ "Delete" ] ;
104
- const wrapSettings = { text : "Header" , value : "Header" } ;
105
- const editSettings = {
101
+ const selectionSettings : any = { mode : "Row" , type : "Multiple" , checkboxOnly : true } ;
102
+ const searchGridSelectionSettings : any = { mode : "Row" , type : "Multiple" } ;
103
+ const toolbarOptions : any = [ "Delete" ] ;
104
+ const wrapSettings : any = { text : "Header" , value : "Header" } ;
105
+ const editSettings : any = {
106
106
allowEditing : true ,
107
107
allowAdding : true ,
108
108
allowDeleting : true ,
@@ -121,7 +121,7 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';
121
121
const [ currentDateTime , setCurrentDateTime ] = useState ( new Date ( ) ) ;
122
122
let balanceAmount = "" ;
123
123
let cashPaidAmount = "" ;
124
- const commands = [
124
+ const commands : any = [
125
125
{
126
126
type : "Cancel" ,
127
127
buttonOption : {
@@ -224,7 +224,7 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';
224
224
} ;
225
225
226
226
useEffect ( ( ) => {
227
- const generatedBillNo = generateBillNo ( ) ;
227
+ const generatedBillNo : any = generateBillNo ( ) ;
228
228
// Set Bill No to the input field
229
229
const billNoInput = document . getElementById ( "billNoInput" ) ;
230
230
if ( billNoInput ) {
@@ -249,7 +249,7 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';
249
249
//function to handle customer id input element changes - change event.
250
250
const handleCustomerIDChange = ( event ) : void => {
251
251
const enteredID : number = parseInt ( event . value ) ;
252
- const foundCustomer = customerDatabase . find (
252
+ const foundCustomer : any = customerDatabase . find (
253
253
( customer ) => ( customer as any ) . id === enteredID
254
254
) ;
255
255
if ( foundCustomer ) {
@@ -286,7 +286,7 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';
286
286
287
287
// Grid component's Events and Functions
288
288
//Grid action complete event.
289
- const actionComplete = ( args ) : void => {
289
+ const actionComplete = ( args : any ) : void => {
290
290
if ( args . action === "add" && args . requestType === "save" ) {
291
291
const lastRowIndex = gridInstance . current . getRows ( ) . length - 1 ; // Get the index of the last row
292
292
productSearchGridInstance . current . clearSelection ( ) ;
@@ -329,14 +329,14 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';
329
329
} ;
330
330
331
331
//Grid created event.
332
- const createdGrid = ( args ?) : void => {
332
+ const createdGrid = ( args ?: any ) : void => {
333
333
gridInstance . current . getContent ( ) . querySelector ( ".e-addedrow .e-rowcell .e-checkbox-wrapper" ) . classList . add ( 'e-checkbox-disabled' ) ;
334
334
}
335
335
336
336
//Function to Calculate total savings of the bill amount
337
- function computeSavings ( dataSource ) : number {
337
+ function computeSavings ( dataSource : any ) : number {
338
338
let savings = 0 ;
339
- dataSource . forEach ( ( item ) => {
339
+ dataSource . forEach ( ( item : any ) => {
340
340
const MRP = item . MRP ;
341
341
const Price = item . Price ;
342
342
const Qty = parseFloat ( item . Quantity ) || 0 ;
@@ -346,9 +346,9 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';
346
346
return savings ;
347
347
}
348
348
349
- function totalNetAmount ( dataSource ) : void {
349
+ function totalNetAmount ( dataSource : any ) : void {
350
350
let totalAmount = 0 ;
351
- dataSource . forEach ( ( item ) => {
351
+ dataSource . forEach ( ( item : any ) => {
352
352
if ( item . Qty !== 0 ) {
353
353
totalAmount += item . Total ;
354
354
}
@@ -357,14 +357,14 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';
357
357
}
358
358
359
359
//Function to Update savings card element with proper savings amount.
360
- function updateSavingsDisplay ( dataSource ) : void {
360
+ function updateSavingsDisplay ( dataSource : any ) : void {
361
361
const computedSavings = computeSavings ( dataSource ) ;
362
362
( document . querySelector ( "#yourSavings" ) as HTMLElement ) . innerHTML =
363
363
"$" + computedSavings . toFixed ( 2 ) ;
364
364
}
365
365
366
366
//Grid action begin event
367
- const actionBegin = ( args ) : void => {
367
+ const actionBegin = ( args : any ) : void => {
368
368
if ( args . requestType === 'save' ) {
369
369
args . index = ( gridInstance . current . pageSettings . currentPage * gridInstance . current . pageSettings . pageSize ) - 1 ;
370
370
productSearchGridInstance . current . clearSelection ( ) ;
@@ -373,7 +373,7 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';
373
373
} ;
374
374
375
375
//Grid before print event.
376
- const beforePrint = ( args ) : void => {
376
+ const beforePrint = ( args : any ) : void => {
377
377
// Cancel default Grid print action
378
378
args . cancel = true ;
379
379
@@ -390,16 +390,16 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';
390
390
? true
391
391
: false ;
392
392
function printTable (
393
- gridInstance ,
394
- shopName ,
395
- billNo ,
396
- customerName ,
397
- phoneNumber ,
398
- address ,
399
- formattedDateTime ,
400
- totalAmount ,
401
- savings ,
402
- isDoorDelivery ,
393
+ gridInstance : any ,
394
+ shopName : any ,
395
+ billNo : any ,
396
+ customerName : any ,
397
+ phoneNumber : any ,
398
+ address : any ,
399
+ formattedDateTime : any ,
400
+ totalAmount : any ,
401
+ savings : any ,
402
+ isDoorDelivery : any ,
403
403
) {
404
404
let data = gridInstance . dataSource ;
405
405
let columnConfig = gridInstance . columns ;
@@ -474,7 +474,7 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';
474
474
475
475
// Header row
476
476
let headerRow = "<thead><tr>" ;
477
- columnConfig . forEach ( ( column ) => {
477
+ columnConfig . forEach ( ( column : any ) => {
478
478
if (
479
479
column . headerText !== "" &&
480
480
column . headerText !== "Product ID" &&
@@ -513,9 +513,9 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';
513
513
514
514
// Data rows
515
515
printWindow . document . write ( "<tbody>" ) ;
516
- data . forEach ( ( item ) => {
516
+ data . forEach ( ( item : any ) => {
517
517
let row = "<tr>" ;
518
- columnConfig . forEach ( ( column ) => {
518
+ columnConfig . forEach ( ( column : any ) => {
519
519
if (
520
520
column . headerText !== "" &&
521
521
column . headerText !== "Product ID" &&
@@ -662,7 +662,7 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';
662
662
} ;
663
663
664
664
//Grid command column delete button - Click event.
665
- const commandClick = ( args ) : void => {
665
+ const commandClick = ( args : any ) : void => {
666
666
const rowIndex = parseInt (
667
667
args . target . closest ( "tr" ) . getAttribute ( "data-rowindex" ) ,
668
668
10
@@ -694,7 +694,7 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';
694
694
) ;
695
695
if ( product ) {
696
696
const isProductExists = ( gridInstance . current . dataSource as any ) . some (
697
- ( item ) => ( item as any ) . ProductID === ( product as any ) . ProductID
697
+ ( item : any ) => ( item as any ) . ProductID === ( product as any ) . ProductID
698
698
) ;
699
699
if ( isProductExists ) {
700
700
alert ( "Product has already been added." ) ;
@@ -704,7 +704,7 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';
704
704
( gridInstance . current . dataSource as any ) . length === 0
705
705
? 0
706
706
: ( gridInstance . current . dataSource as any ) . length - 1 ;
707
- let editedRowIndex = ( gridInstance as any ) . current . editModule . editModule . editRowIndex ;
707
+ let editedRowIndex : any = ( gridInstance as any ) . current . editModule . editModule . editRowIndex ;
708
708
if ( ! isNullOrUndefined ( editedRowIndex ) ) {
709
709
updateRecord ( product , editedRowIndex ) ;
710
710
} else {
@@ -719,7 +719,7 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';
719
719
}
720
720
} ;
721
721
722
- const updateRecord = ( product , editedRowIndex ) => {
722
+ const updateRecord = ( product : any , editedRowIndex : any ) => {
723
723
( document . getElementById ( gridInstance . current . element . id + 'ProductID' ) as any ) . value = product . ProductID ;
724
724
( document . getElementById ( gridInstance . current . element . id + 'ProductName' ) as any ) . value = product . ProductName ;
725
725
( document . getElementById ( gridInstance . current . element . id + 'Price' ) as any ) . value = product . Price ;
@@ -755,11 +755,11 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';
755
755
}
756
756
} ;
757
757
758
- const readProductIDFn = ( args ) => {
758
+ const readProductIDFn = ( args : any ) => {
759
759
return args . value ;
760
760
} ;
761
761
762
- const writeProductIDFn = ( args ) => {
762
+ const writeProductIDFn = ( args : any ) => {
763
763
autocompleteIns = new AutoComplete ( {
764
764
dataSource : productData . map ( product => ( { ProductID : ( product as any ) . ProductID , ProductName : ( product as any ) . ProductName } ) ) , // Provide your data source
765
765
fields : { value : 'ProductID' } ,
@@ -818,7 +818,7 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';
818
818
return args . value ;
819
819
} ;
820
820
821
- const writeProductNameFn = ( args ) => {
821
+ const writeProductNameFn = ( args : any ) => {
822
822
productNameTextBoxIns = new TextBox ( {
823
823
value : args . rowData [ args . column . field ] ,
824
824
placeholder : "Enter product name" ,
@@ -888,7 +888,7 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';
888
888
return "" ;
889
889
} ;
890
890
891
- const writeQuantityFn = ( args ) => {
891
+ const writeQuantityFn = ( args : any ) => {
892
892
quantityTextBoxIns = new TextBox ( {
893
893
value : args . rowData [ args . column . field ] ,
894
894
placeholder : "Enter quantity" ,
@@ -1014,11 +1014,11 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base';
1014
1014
}
1015
1015
1016
1016
//Primary Grid component - Declaration to prevent re-rener on unwanted state changes.
1017
- const MemorizedGridComponent = React . useMemo (
1017
+ const MemorizedGridComponent : any = React . useMemo (
1018
1018
( ) => (
1019
1019
< GridComponent
1020
1020
ref = { gridInstance }
1021
- emptyRecordTemplate = { ( ) => null }
1021
+ emptyRecordTemplate = { ( ) : any => null }
1022
1022
gridLines = "Both"
1023
1023
height = "435px"
1024
1024
width = '100%'
0 commit comments