import wixData from “wix-data” ;
import wixLocation from ‘wix-location’ ;
import { deleteParam } from ‘backend/projectSQL.jsw’ ;
import { insertParams } from ‘backend/projectSQL.jsw’ ;
let tablSelectID ;
/* API Reference: Introduction - Velo API Reference - Wix.com
// “Hello, World!” Example: Velo Learning Center
*/
$w . onReady ( function () {
$w ( “#dataset6” ). onReady (() => {
$w(‘#dropdown1’).value);
$w ( “#dataset6” ). setFilter ( wixData . filter ()
. eq ( “statusRequete” , $w ( ‘#dropdown1’ ). value ));
});
});
async function createParam () {
const toInsert = {
Xtitle : “ProjectSelection” ,
Xparams : tablSelectID
};
try {
insertParams ( toInsert );
// await fetchData();
} catch ( error ) {
console . error ( error );
}
}
async function selectionParam () {
//export function sql(sqlStr: String);
let myJSON = null ;
**try** {
deleteParam ( "ProjectSelection" );
} catch ( error ) {
console . error ( error );
console . log ( "ERROR ERROR delete Param " );
}
**try** {
createParam ();
} catch ( error ) {
console . error ( error );
console . log ( "ERROR ERROR insert Param " );
}
}
export function dropdown1_change ( event ) {
let newFilter = wixData . filter ();
newFilter = newFilter . contains ( ‘statusRequete’ , $w ( ‘#dropdown1’ ). value );
$w ( “#table1” ). refresh ();
$w ( ‘#dataset6’ ). setFilter ( newFilter );
}
export function table1_dblClick ( event ) {
let myJSON = null ;
let res = selectionParam ();
wixLocation . to ( “/blank” + “?&ProjectName=” + tablSelectID );
}
export function table1_rowSelect ( event ) {
let rowData = event.rowData ;
let myJSON = null ;
myJSON = JSON . stringify ( rowData );
tablSelectID = rowData.projectName ;
}
export function dataset6_currentIndexChanged () {
let itemData = $w ( “#dataset6” ). getCurrentItem ();
let myJSON = null ;
myJSON = JSON . stringify ( itemData );
}
export function button1_click ( event ) {
let res = selectionParam ();
wixLocation . to ( “/participantdisplay” + “?&ProjectName=” + tablSelectID );
}