| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "init": "{ |
| 5 | $nom_AA = 'Consultes_Getons'; |
| 6 | |
| 7 | $args = trigger.data; |
| 8 | $_Portal = $args._Portal; |
| 9 | $refcons = $args.refcons; |
| 10 | |
| 11 | $__dada = $refval => { |
| 12 | data_feed[[ oracles = $args._Registre, feed_name = $refval, ifnone = false ]] |
| 13 | }; |
| 14 | }", |
| 15 | "messages": [ |
| 16 | { |
| 17 | "app": "state", |
| 18 | "state": "{ |
| 19 | response[ 'consulta' ] = $refcons; |
| 20 | $refgeto = |
| 21 | $args.nom ? |
| 22 | 'geto_' || $args.nom : |
| 23 | $__dada( 'refgeto_' || $args.idgeto ); |
| 24 | |
| 25 | if ( $refcons == 'Dades_Geto' ) { |
| 26 | |
| 27 | $resp = $args.nom ? 'getó amb nom ' || $args.nom : 'getó amb id ' || $args.idgeto; |
| 28 | |
| 29 | response[ 'Dades' ] = $resp; |
| 30 | |
| 31 | if ( ! $__dada( $refgeto ) ) |
| 32 | response[ $resp ] = 'Getó desconegut'; |
| 33 | |
| 34 | response[ 'Estat' ] = $__dada( $refgeto || '_estat' ); |
| 35 | |
| 36 | $pendent = var[ $_Portal ][ $refgeto || '_pendent' ]; |
| 37 | response[ 'Dotació pendent' ] = $pendent ? 'sí' : 'no'; |
| 38 | |
| 39 | response[ 'Total emissions' ] = $__dada( 'Total_emissions_' || $refgeto ); |
| 40 | |
| 41 | $refs = [ |
| 42 | 'id', 'estat', '_proposant', '_confirmant', 'data', |
| 43 | '_FOP', 'aportacio', 'topall', 'factor_conversio', |
| 44 | 'taxa_conversio', 'derivacio', 'import_activacio', |
| 45 | 'import_subscripcio', 'import_renovacio','cicles_diposit', |
| 46 | 'activacions_restringides', 'subscripcions_restringides', |
| 47 | 'recepcions_restringides', 'conversions_restringides', |
| 48 | 'valors_esmenables', 'llistats_editables', 'bloqueig_possible', |
| 49 | '_AUT_A', '_AUT_B', '_AUT_C' |
| 50 | ]; |
| 51 | |
| 52 | $__resposta = $r => { |
| 53 | response[ $r ] = $__dada( $refgeto || '_' || $r ); |
| 54 | }; |
| 55 | |
| 56 | $resps = map( $refs, 25, $__resposta ); |
| 57 | } |
| 58 | |
| 59 | if ( $refcons == 'Avis' ) { |
| 60 | $refavis = 'avis_' || $refgeto || '_' || $args.adr; |
| 61 | $temps_avis = $__dada( $refavis ); |
| 62 | $avis_es_actual = $temps_avis + ( $__dada( 'Lapse' ) * 2 ) < timestamp; |
| 63 | if ( $avis_es_actual ) { |
| 64 | response[ 'Avís' ] = $__dada( $refavis || '_text' ); |
| 65 | response[ 'Hora' ] = timestamp_to_string( $temps_avis, 'time' ); |
| 66 | response[ 'Data' ] = timestamp_to_string( $temps_avis, 'date' ); |
| 67 | response[ 'Rebot' ] = $__dada( $refavis || '_rebot' ); |
| 68 | } else { |
| 69 | response[ 'No hi ha cap avís per a' ] = $args.adr; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | if ( $refcons == 'Capacitacio' ) { |
| 74 | $ref_capacitacio = 'CPC_' || $refgeto || '_' || $args.accio || '_' || $args.adr; |
| 75 | $capacitada = $__dada( $ref_capacitacio ) otherwise ''; |
| 76 | $secc = $capacitada == 'capacitada' ? ' ' : ' NO '; |
| 77 | response[ 'Ref' ] = $ref_capacitacio; |
| 78 | response[ 'Capacitacio' ] = 'Adreça' || $secc || 'capacitada per a ' || $args.accio || 'ns'; |
| 79 | } |
| 80 | |
| 81 | if ( $refcons == 'Geto_Pendent' ) { |
| 82 | $getons_pendents = var[ $_Portal ][ 'getons_pendents' ]; |
| 83 | response[ "Getó pendent d'inscripció" ] = $getons_pendents[ $refgeto ]; |
| 84 | } |
| 85 | |
| 86 | if ( $refcons == 'Emissions_Geto' ) { |
| 87 | $total_emissions = $__dada( 'total_emissions_' || $refgeto ) otherwise 0; |
| 88 | response[ 'Emissions de ' || $refgeto ] = $total_emissions; |
| 89 | } |
| 90 | |
| 91 | if ( $refcons == 'Romanent_Geto' ) { |
| 92 | $idgeto = $__dada( $refgeto || '_id' ); |
| 93 | response[ 'Id ' || $refgeto ] = $idgeto; |
| 94 | response[ 'Romanent en ' || $args.nom ] = balance[ $args._Portal ][ $idgeto ]; |
| 95 | } |
| 96 | }" |
| 97 | } |
| 98 | ] |
| 99 | } |
| 100 | ] |