how to filter records using C# and vue js with sql server

front end (https://i.stack.imgur.com/MrWtS.png),

values in drop down are coming from database (SQL Server),

i want to display(filter) records according to selected options, from the list below (mentioned in png attachment)

request that i created for drop downs,

[HttpGet]
        [Route("api/web/GetFilterYear")]
        public List<Years> GetFilterRecords(string year)
        {
            using (ApplicationDbContext db = new ApplicationDbContext())
            {
                List<Years> xx = new List<Years>();
                xx = db.Database.SqlQuery<Years>("GetYears").*/ToList();
                return xx;
            }
        }

        [HttpGet]
        [Route("api/web/GetFilterMonth")]
        public List<Years> GetFilterMonth(string month)
        {
            using (ApplicationDbContext db = new ApplicationDbContext())
            {
                List<Years> xx = new List<Years>();
                xx = db.Database.SqlQuery<Years>("GetFM").ToList();
                return xx;
            }
        }

filter button

<div class="col-sm-2"><button class="btn btn-sm btn-primary" style="margin-top:2px" onclick="GenerateTable()">Filter</button></div>
                   

how can write generate table function using javascript for this code

Format v data table vuetify vue2

how could I format the header from v-data-table to appear like it:
[Right Header and values]

enter image description here

And group two values in one line, like in the image above.

I tried with templates but it does not work, I don’t know how to do it.

my code sandbox:
codesandbox

And I need an explanation of how to do it and if it’s possible.

Why does catch in the calling function is never executed?

I have a simple use case that I want to execute a statement inside the catch blog inside catch block of calling function. Somehow in my code there is no execution of catch block statement inside calling function

async function main() {

  try {
    console.log('jatin')
    const hello = await second()
    console.log(hello) //ok
    console.log('yes boy') //ok
  } catch (e) {
    console.log('cm') //not ok
    console.log(e) //not ok
  }
}

async function second() {
  try {
    console.log('in second') //ok
    throw new Error()
  } catch (error) {
    console.log('trial') //ok
    console.log(error) //ok
    return error
  }
}

main()

how to multiply slice an array using lodash javascript library

this.listSelectProjectStages = _.map(
                        _.values(_.get(map, 'PROJECT_STAGE', [])).slice(0, 5),
                        (e) => ({
                            value: e?.name,
                            label: e?.label,
                        })
                    ); 

as per the above lodash mapping the values from index 0 to 5 is fetched from PROJECT_STAGE array and pushe to the ‘this.listSelectProjectStages’ variable. I have a requirement change. I want to get 0 to 5 index and also last two values of the particular array and push to the ‘this.listSelectProjectStages’ variable. please help me.? how can I manipulate this code for that.?

Can i change selected row’s selection on ant-design table?

If I want to select a row in the ‘Ant Design’ table and click the ‘previous move’ button, the upper row of the selected row is selected, and if I click the ‘next move’ button, I want to code the lower row to be selected, how can I make it?

For example, if ‘Jim Green’ is selected on the code and ‘previous move’ is clicked, ‘John Brown’ will be selected, and if ‘next move’ button is clicked, ‘Joe Black’ will be selected.

it’s example code from ant-design, i make a button simple and under the code, example image exist.

    import React from 'react';
import 'antd/dist/antd.css';
import './index.css';
import { Table } from 'antd';

const columns = [
  {
    title: 'Name',
    dataIndex: 'name',
    filters: [
      {
        text: 'Joe',
        value: 'Joe',
      },
      {
        text: 'Category 1',
        value: 'Category 1',
        children: [
          {
            text: 'Yellow',
            value: 'Yellow',
          },
          {
            text: 'Pink',
            value: 'Pink',
          },
        ],
      },
      {
        text: 'Category 2',
        value: 'Category 2',
        children: [
          {
            text: 'Green',
            value: 'Green',
          },
          {
            text: 'Black',
            value: 'Black',
          },
        ],
      },
    ],
    filterMode: 'tree',
    filterSearch: true,
    onFilter: (value, record) => record.name.includes(value),
    width: '30%',
  },
  {
    title: 'Age',
    dataIndex: 'age',
    sorter: (a, b) => a.age - b.age,
  },
  {
    title: 'Address',
    dataIndex: 'address',
    filters: [
      {
        text: 'London',
        value: 'London',
      },
      {
        text: 'New York',
        value: 'New York',
      },
    ],
    onFilter: (value, record) => record.address.startsWith(value),
    filterSearch: true,
    width: '40%',
  },
];
const data = [
  {
    key: '1',
    name: 'John Brown',
    age: 32,
    address: 'New York No. 1 Lake Park',
  },
  {
    key: '2',
    name: 'Jim Green',
    age: 42,
    address: 'London No. 1 Lake Park',
  },
  {
    key: '3',
    name: 'Joe Black',
    age: 32,
    address: 'Sidney No. 1 Lake Park',
  },
  {
    key: '4',
    name: 'Jim Red',
    age: 32,
    address: 'London No. 2 Lake Park',
  },
];
const onChange = (pagination, filters, sorter, extra) => {
  console.log('params', pagination, filters, sorter, extra);
};

const onClickPrev = () => {};
const onClickNext = () => {};

const App = () => (
  <div>
    <button onClick={onClickPrev}>previous move</button>
    <button onClick={onClickNext}>next move</button>
    <Table columns={columns} dataSource={data} onChange={onChange} />;
  </div>
);
export default App;

enter image description here

it is example codesandbox
https://codesandbox.io/s/filter-in-tree-antd-4-24-8-forked-49sy6e?file=/demo.js:1544-1548

Module Parse Failed – Webpack React JS

I am trying to solve the web pack configuration for the last 2 days, But I can not resolve the issue. I’ve followed the configuration in the package.json file. Also, I’ve tried to do manually downgrading the dependencies but I ended up in more issues only.

Dependencies
"react": "^16.13.1",
"os-browserify": "^0.3.0",
"path-browserify": "^1.0.1",


Dev Dependencies
"@babel/core": "^7.21.0",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1",
"webpack-dev-server": "^4.11.1"

My webpack.config.js file

const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');

module.exports = {
  entry: path.resolve(__dirname, 'src', 'index.js'),
  module: {
    rules: [
      {
        test: /.jsx?$/,
        use: {
          loader: 'babel-loader',
        },
      },
      {
        test: /.s(a|c)ss$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'style-loader',
          },
          {
            loader: 'css-loader',
            // options: {
            //   modules: true,
            //   url: true,
            // },
          },
          {
            loader: 'sass-loader',
          },
        ],
      },
      {
        test: /.svg$/,
        use: [
          {
            loader: 'svg-url-loader',
            options: {
              limit: 10000,
            },
          },
        ],
      },
      {
        test: /.(png|svg|jpg|jpeg|gif|ico)$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'file-loader',
          },
        ],
      },
      {
        test: /.m?js$/,
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: [['@babel/preset-env', { targets: 'defaults' }]],
          },
        },
      },
      // {
      //   test: /.js$/,
      //   exclude: /node_modules/,
      //   use: {
      //     loader: 'babel-loader',
      //     options: { presets: ['react', 'es2015', 'stage-1'] },
      //   },
      // },
      // {
      //   test: /.css$/,
      //   use: {
      //     options: 'style-loader!css-loader',
      //   },
      // },
    ],
  },
  resolve: {
    extensions: ['.js', '.jsx', '.css'],
    alias: {
      path: require.resolve('path-browserify'),
    },
    modules: ['node_modules'],
    fallback: {
      os: require.resolve('os-browserify/browser'),
      fs: false,
    },
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: path.resolve(__dirname, 'public', 'index.html'),
      favicon: path.resolve(__dirname, 'public', 'favicon.ico'),
    }),
  ],
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist'),
  },
  mode: 'development',
  devServer: {
    static: {
      directory: path.join(__dirname, 'public'),
    },
    port: 3000,
  },
};

I’ve also configured the .babelrc file.

    "presets": [
        "@babel/preset-env",
        "@babel/preset-react"
    ]
}

After much trial and error, I ended up with the following errors.

You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|  *  Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome
|  *  License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)

Module not found: Error: Can't resolve './fonts/slick.ttf'
Module not found: Error: Can't resolve './fonts/slick.eot'
Module not found: Error: Can't resolve './ajax-loader.gif
Module not found: Error: Can't resolve 'module' in '~/node_modules/resolve-from'

ERROR in ./node_modules/rc-input-number/assets/index.css 1:0
Module parse failed: Unexpected token (1:0)

ERROR in ./node_modules/react-bootstrap-table-next/dist/react-bootstrap-table2.min.css 1:0
Module parse failed: Unexpected token (1:0)

ERROR in ./node_modules/react-input-range/lib/css/index.css 1:0
Module parse failed: Unexpected token (1:0)

ERROR in ./node_modules/react-datepicker/dist/react-datepicker.css 1:0
Module parse failed: Unexpected token (1:0)

ERROR in ./node_modules/slick-carousel/slick/slick.css 2:0
Module parse failed: Unexpected token (2:0)

Regarding PayPal Api with Form

I have generate following form with Single-select-List options from paypal

paypal-1

Now I Need Few Input To be Added on This Form like below.

paypal-2

Stacking Fee and Delivery Fee Have to insert. Delivery Fee will stay constant but Iron Bark and Stacking Fee charge will depend upon Qty that user select.

Iron bark price = $250 x QTY
Stacking Fee = $25 x QTY

So when user click paypal button for payment then at paypal check out page:
paypal 3

I try to Modify PayPal generate code but it’s not working, paypal doesnt allow to modify auto generated code:

function initPayPalButton() {
var shipping = 50;
//var stackfee = 25;
var itemOptions = document.querySelector("#smart-button-container #item-options");
var quantity = parseInt(10);
var quantitySelect = document.querySelector("#smart-button-container #quantitySelect");
if (!isNaN(quantity)) {
  quantitySelect.style.visibility = "visible";
}
var orderDescription = '';
if(orderDescription === '') {
  orderDescription = 'Item';
}
paypal.Buttons({
  style: {
    shape: 'rect',
    color: 'gold',
    layout: 'vertical',
    label: 'paypal',
    tagline: 'false',
    
  },
  createOrder: function(data, actions) {
    var selectedItemDescription = itemOptions.options[itemOptions.selectedIndex].value;
    var selectedItemPrice = parseFloat(itemOptions.options[itemOptions.selectedIndex].getAttribute("price"));
    var tax = (10 === 0 || false) ? 0 : (selectedItemPrice * (parseFloat(10)/100));
    if(quantitySelect.options.length > 0) {
      quantity = parseInt(quantitySelect.options[quantitySelect.selectedIndex].value);
    } else {
      quantity = 1;
    }

    tax *= quantity;
    tax = Math.round(tax * 100) / 100;
    var priceTotal = quantity * selectedItemPrice + parseFloat(shipping) + tax;
    priceTotal = Math.round(priceTotal * 100) / 100;
    var itemTotalValue = Math.round((selectedItemPrice * quantity) * 100) / 100;

    return actions.order.create({
      purchase_units: [{
        description: orderDescription,
        amount: {
          currency_code: 'AUD',
          value: priceTotal,
          breakdown: {
            item_total: {
              currency_code: 'AUD',
              value: itemTotalValue,
            },
            shipping: {
              currency_code: 'AUD',
              value: shipping,
            },
            
            tax_total: {
              currency_code: 'AUD',
              value: tax,
            }
          }
        },
        items: [{
          name: selectedItemDescription,
          unit_amount: {
            currency_code: 'AUD',
            value: selectedItemPrice,
          },
          quantity: quantity
        }]
      }]
    });
  },
  onApprove: function(data, actions) {
    return actions.order.capture().then(function(orderData) {
      
      // Full available details
      console.log('Capture result', orderData, JSON.stringify(orderData, null, 2));

      // Show a success message within this page, e.g.
      const element = document.getElementById('paypal-button-container');
      element.innerHTML = '';
      element.innerHTML = '<h3>Thank you for your payment!</h3>';

      // Or go to another URL:  actions.redirect('thank_you.html');

    });
  },
  onError: function(err) {
    console.log(err);
  },
}).render('#paypal-button-container');

}

using APi form google maps, I am unable to get the infowindow to work

I am following a tutorial on YouTube: https://www.youtube.com/watch?v=CdDXbvBFXLY&t=770s
however when it comes to creating a customer infowindow on a marker. I am unable to get the info window to appear. from what I can tell I am following along with the guide. I have been looking over the Google maps API documentation but no luck. I figure I would see if someone else has had any luck. I will post the code to the JavaScript file. I have left out the Map ID as it seems to be best practice not to have the info out on the internet. If someone had done a project like this before and can shine some light on what I may be missing, I would appreciate it. In the meantime I will keep trying and doing more research into this issue.

function initMap(){
const map = new google.maps.Map(document.getElementById('map'), {
    center: {lat: 39.82617376316351, lng: -85.83268148144886},
    zoom: 18,
    mapId: '############ '
});

 const marker = new google.maps.Marker({
    position: { lat: 39.82617376316351, lng: -85.83268148144886},
    map,
    title: "A building",

   
    // Animation for Marker
    animation: google.maps.Animation.DROP
});



    const infowindow = new google.maps.infowindow({
      content: "test string",
    });

    marker.addListener("click" , () =>{
      infowindow.open(map, marker);

      });
    
  }

Filtering a column in an AntD table using RangePicker

I want to filter a column in an AntD table using a RangePicker. For now what I am trying to accomplish is that within the onFilter function, I want to print on the console, the dates that were picked from the RangePicker. However, it only prints the “from” date that I picked from the RangePicker and not the “To” date. Here is the link to my codesandbox: https://codesandbox.io/s/customized-filter-panel-antd-5-3-0-forked-en9fxj?file=/demo.tsx:0-5545

Once I accomplish printing the picked dates, I can move on to filtering the rows based on these dates. How should I go about doing this?

Not getting response due to issue – Ensure CORS response header values are valid

I have a HTML page which takes a text from user and send a GET request to spring boot application which is appending some more text to it and returning back to HTML page and I need to show that text to text-area in HTML.

Here is the HTML

    <!DOCTYPE html>
<html>
  <body>
    <h1>Text</h1>
    <script type="text/javascript">
      function convert() {
      
        var host = 'http://localhost:8080/params/';
        var params = document.getElementById("text").value;
        var apiUrl = host+params;
        alert(apiUrl)
        fetch(apiUrl).then(response => {
          return response.json();
        }).then(data => {
          document.getElementById("output").textContent = data;
          console.log(data);
        }).catch(err => {
          // Do something for an error here
        });
      }
    </script>
    <input id="text" type="text" value="" style="Width:50%;height:200px" />
    <p></p>
    <div />
    <button id="btn" onclick="convert()"> Convert </button>
    <p></p>
    <h1>SQL</h1>
    <textarea id="output" rows="30" cols="150"></textarea>
  </body>
</html>

And here is the Spring boot Controller class

import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin(origins = "*")
public class HelloWorldController 
{
    @RequestMapping(value="/params/{textToSql}", method = RequestMethod.GET)
public String hello(@PathVariable String textToSql)
{

    return "New Hello Text - "+textToSql;
}
}

I can’t see the response is coming and browser is showing issue which says – ‘Ensure CORS response header values are valid’. I even tried to allow all as you can see at Spring bbot controller but still I am not getting any response @CrossOrigin(origins = "*");

Please suggest what needs to be done here to get the response back and show it in below text area.

Thanks

Javascript: “var” related doubts [duplicate]

    <button class="btn">aa</button>

    <script>
        var aBtn=document.getElementsByClassName('btn');

        var i = 0;

        while(i<aBtn.length){

            aBtn[i].onclick = function(){
                console.log(i);
                    // 1  ??????
            }            
            i++
        }

    </script>

I’d like to know why the console outcome is 1 in the end, instead of 0.

Typescript – How do you convert a list of integers into a list of strings? ex. [1,2,3,4,] => [‘1′,’2′,’3′,’4’] [duplicate]

For example, I have a list like this:

[ 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001]

But I would like to convert it to this:

[ '1980', '1981', '1982', '1983', '1984', '1985']

I tried to find a function to parse it similar to parseint or if there was a way to map it, but all I could find was converting a list of string numbers into integers.

Thanks in advance to whoever can help.

Issue getting JS Google Maps API to display map

When I search an address the map will never generate! Im going crazy trying to figure out why.

The element is there, the loader function is getting called, I have tried to take out side of the loader function & call the api from index.html to no avail.

Im stumped!

I would like it so when I search the address, the map pops up along with the rest of the content showing the location. However, only the property images from my API show up. Nothing else. The div element named “map” shows up but with no content what so ever.

  <div class="about">
    <div id="topInput">
      <div id="searchWrapper">
        <vue-google-autocomplete id="map" country="us" classname="form-control" placeholder="Type an address..."
          v-on:placechanged="getAddressData">
        </vue-google-autocomplete>
        <button @click="getRealestateData" class="searchButton">
          Go
        </button>
      </div>
    </div>
    <div id="topImages">
      <property-images v-if="getPropertyData" :propImages="getPropertyData.propertyData.property_detail.photos" />
      <div id="map"></div>
      <!-- <property-images v-if="getPropertyData" :propImages="getPropertyData.propertyData.property_detail.photos"/>
      <property-images v-if="getPropertyData" :propImages="getPropertyData.propertyData.property_detail.photos"/> -->
    </div>
    <div id="detailsContainer">
      <div id="detailsContent" v-if="getPropertyData">
        <span class="detailItem" v-for="dataPoint, key  in getPropertyData.propertyData.property_detail.prop_common">{{
          `${key}: ${dataPoint}` }}</span>
      </div>
    </div>





  </div>
</template>
<script>
// var map;
import VueGoogleAutocomplete from "vue-google-autocomplete";
import propertyImages from '@/components/propertyImages.vue'

import axios from "axios";
import { mapActions, mapGetters, mapMutations } from "vuex";
import { Loader } from "@googlemaps/js-api-loader";
const loader = new Loader({
  apiKey: "AIzaSyB2blQxoDxnSYS2AB80m1k8nfLjeS0jtnU",
  version: "weekly",
  // ...additionalOptions,
});
export default {
  components: {
    VueGoogleAutocomplete,
    propertyImages
  },
  data() {
    return {
      street: "",
      zip: "",
      dataAPI: false,
      loading: false,
      qualifies: "-",
      isDisabled: true,
      address: ""
    };
  },
  computed: {
    ...mapGetters([
      'getPropertyData',
      'getAddressToSearch'
    ])
  },
  watch: {
    'errors.items'() {

      if (this.$validator.errors.items.length == 0) {
        this.isDisabled = false
      }
      else {
        this.isDisabled = true
      }
    }
  },
  methods: {
    ...mapActions([
      'getRealestateDataFromAddress'
    ]),
    getRealestateData() {
      console.log(this.address)
      console.log(this.getAddressToSearch)
      this.getRealestateDataFromAddress()
     

        loader.load().then(() => {
              var myLatLng = { lat: Number(this.getAddressToSearch.latitude), lng: Number(this.getAddressToSearch.longitude) };
              const map = new google.maps.Map(document.getElementById("map"), {
                center: { lat: Number(this.getAddressToSearch.latitude), lng: Number(this.getAddressToSearch.longitude) },
                zoomControl: false, 
                mapTypeControl: false,
                zoom: 10,
              });
              var marker = new google.maps.Marker({
                position: myLatLng,
                map: map,
              });
            });
    
    },
    ...mapMutations([
      'setAddressToSearch'
    ]),
    getAddressData: function (addressData, placeResultData, id) {
      this.address = addressData
      this.setAddressToSearch(addressData);
     
    },

    submit() {

    },
  },
  mounted() {
    this.$validator.validate();
    console.log()
  }
};
</script>

How to dynamically set the y-axis scale of the c3 chart

I am making a c3 line chart with multiple legends.

What I want to do is to dynamically set the scale of the y-axis so that the end of the value of the y-axis is

I want to mark it as 0 or 5.

jsfiddle

I proceeded to work by referring to the contents of the following jsfiddle, but the desired operation does not proceed.

The content of jsfiddle is written based on one legend in one array, but
My data has multiple legends in one array.

// data_test_original = ['data1', 10, 1, 1000, 3, 500, 50, 5, 3000]; 1 legend in 1 array

// My code has multiple legends in one array.
data_test_original = [["IPS",0,2,0,0,1,0,108],["EDR",4,4,4,4,4,4,4],["AV",0,0,0,0,2,5,0]];

How do I style one element from an array? [duplicate]

I am trying to change the text style of just one element of my array, and I can’t figure out how to do it. I am very new to all this, and this is actually for a class for a project that is due. I am about to have a mental breakdown. When the button is clicked ‘Jennifer Aniston’ (not my choice) is supposed to be pink, and ‘Clint Eastwood’ (again, not my choice) is supposed to be in italics. It can be done via inline HTML or CSS class. All help is appreciated.

<!doctype html>
<html lang="en">
<head>
    <title>Output Actors to the Screen using a button</title>
    
    <meta charset="utf-8" />
    <link rel="stylesheet" href="css/style.css">
</head>

<body>

    <div id="divcontacts" >
    <h1>Actors</h1>
    <!-- this div is the box seen in the images provided -->
        <p id="actors"></p>
    </div>

    <!-- button goes here  -->
        <button onclick="loopActors()">See Actors</button>
    <!-- link to your javascript -->
        <script src="js/skript.js"></script>

</body>
</html>
#divcontacts {
    width: 500px;
    height: 300px;
    border: 2px solid red;
    margin-left: 50px;
    padding: 20px;
    box-shadow: 1px 1px 5px red;
}

button {
    margin-left: 50px;
    margin-top: 50px;
    width: 100px;
    height: 100px;
    border: 2px solid red;
    border-radius: 50%;
    background-color: purple;
    box-shadow: 1px 1px 5px black;
    color: white;
}
/* JavaScript
*/

var listActors = '';



function loopActors() {
    const names = ['Jennifer Aniston', 'Clint Eastwood', 'Danny Kaye', 'Gene Wilder', 'Mel Brooks'];
    
    
    
    for (i = 0; i < names.length; i++) {
        listActors += names[i] + '<br>' + '<br>';
    }

        document.getElementById('actors').innerHTML = listActors;

            
        document.querySelector('button').disabled = true;
 }

I have spent the last 48 searching everywhere and have not found anything.