react recursive accordion component throwing an error each child in a list should have a unique key prop

I’m writing custom nested recursive accordion component to display objects, In that component I’m getting an error each child in a list should have a unique key prop, not sure where I need to put the key property

how to resolve the same.

accordion.js:

import React, { useState, useCallback } from 'react'
import { Container, Grid } from '@material-ui/core'
import './styles.css'


function Accodian({ explorer }) {
    const [ expand, setExpand ] = useState(false)
    const handleExpand = useCallback(() => {
        setExpand(prevState => !prevState)
    })
    if (explorer.children) {
        return (
            <div style={{ width: '100%' }} className={'tabs'} key={explorer.label}>
                {explorer.children ? (
                    <>
                        <div className='tab' onClick={handleExpand}>
                            <label className={ expand ? 'tab-label-expanded' : 'tab-label' }>
                                {explorer.label}
                            </label>
                        </div>
                        {expand ? (
                            <Container className='tab-content'>
                                <Grid container spacing={1}>
                                    {explorer.children.map(child => {
                                        return (
                                            <React.Fragment>
                                                {Array.isArray(child.children) ? (
                                                    <Accodian explorer={child}/>
                                                ) : (
                                                    <Grid item xs={12} sm={6} md={6} lg={4} xl={3}>
                                                        <li>
                                                            <b>{child.label}</b>{' '}: {child.value}
                                                        </li>
                                                    </Grid>
                                                )}
                                            </React.Fragment>
                                        )
                                    })}
                                </Grid>
                            </Container>
                        ) : null}
                    </>
                ) : null}
            </div>
        )
    } else {
        return <div style={{ paddingLeft: '20px' }}>{explorer.label}</div>
    }
}

export default Accodian

I would like to add data to object without deleting the previous values

Basically I have an object (obj) and I have several if statement to push value into this object. In the first if statement I am creating an object (links) and adding an array (movie) and push the data from the map into it. Then I have a second if where I create another array(serie) after the movie array and push some other data into it. I am repeating this execution twice. My issue now is that I think it is recreating a new array each time which means that the data from the previous if statement is deleteted. How do I achieve this ?

const obj = {
projet,
file:
};

//1
if (....) {
const arr1 = Object.entries(....).map((entry) => ({
  modelid: entry[0].substring(6, entry[0].length),
  id: entry[1],
}));
obj.links.movie = arr1;
}

//2
if (...) {
 const arr2 = Object.entries(...).map(([key, value]) => ({
   modelId: key.substring(6),
   ids: value,
   }));
obj.links.serie = arr2;
 }

this is is the output expected.

const obj = {
projet,
file:,
links: {
  movie: [],
  serie: [],
};

Disable click on tag when drag and drop?

I have a carousel that contains tags that link to details of movie. However, if you drag the mouse to rotate the carousel, when you drop it will redirect. How to prevent this?
carousel

I using ReactJs and my code look like:

   <Link
        to={"/detailfilm/" + data._id + "/" + data.title}
        draggable="false"
      >
      ...
   </Link>

How to load data from one html file to another html file present in subfolder using jquery

I wanted to fetch the count from the table footer in analysis/index.html
and wanted to show it in dashboard/index.html I am using the load function of jquery
and I am getting the error saying:
enter image description here

          //here is analysis/index.html file code 
               <table  id="recent" class="table table-striped table-responsive recent_table">
                                        <thead ></thead>
                                        <tbody ></tbody>
                                        <tfoot ></tfoot>
                                    </table>
            //and here is dashboard/index.html file
                <script>
                $(document).ready(function()
                `enter code here`{
                  $("#btn1").click(function(){
                    $("#div1").load("/analysis/index.html table#recent tfoot")
                    
                  });
                });
                </script>
    // can anyone please guide me How can I do this in Jquery .
      

Facing error while upgrading from Jetty 8 to Jetty 9

I am facing errors while upgrading from Jetty 8 to Jetty 9 so I replaced the following:
1)SelectChannelConnector and SocketConnector with ServerConnector
2)HashSessionIdManager with DefaultSessionIdManager
Afer replacing I am getting

java.lang.AssertionError: System properties invariant violated. New
keys: jetty.git.hash=bc17a0369a11ecf40bb92c839b9ef0a8ac50ea18

How to wait till a task runs to completion in Node JS [duplicate]

I have an array of image urls.
Once I download all the images successfully, post completion, I want to write output to a separate file in Node/Express.

funtion extractImages(elems) {

Array.from(elems).filter((url) => {
            console.log("url tried", url);
            var _name = url.split('/').pop(-1).toLowerCase().replace("%20", "-");
            console.log("_name tried", _name);
            var file = fs.createWriteStream(_name);
            https.get(url, function(response) {
                console.log("*******downloaded********");
                response.pipe(file);
                file.on("finish", () => {
                    file.close();
                    console.log("Download Completed, set image now *****", `url(${_name})`);
                });
            });
    })
}
router.post('/api/stuff', async (req, res, next) => {
    // .....
    // .....
    var arr = ['...','...'];
    extractImages(arr);
    // only do it post images are downloaded
            filename = uuid();
        fs.writeFile(`${filename}.html`, dom.serialize(), function (err) {
            if (err) throw err;               
            console.log('Results Received, file writen');
            res.setHeader('Content-Type', 'application/json');
            res.end(JSON.stringify({ done: "test" }));
        }); 

But because images downloading takes some time, fs.writeFile runs before.
I could wait by setTimeout and passing a delay, but in this scenario what’s a better approach to handle the same?

UPDATE

If I put the writeFile inside file.on("finish", callback that runs multiple times for all elements in the array.
I want to run and write the file only once.

How can make a HTTPS post to URL with Firebase Functions (Node js)

I am trying to create a firebase cloud function to automatically submit an online Microsoft Office Form. I have written the following:

exports.covidForm = functions.pubsub.schedule('every 1 hours').onRun((context) => {

    var data = `{
  "startDate": "2022-07-04T05:27:42.157Z",
  "submitDate": "2022-07-04T05:31:30.748Z",
  "answers": "[{"questionId":"rc4588b6d25e8418b9dc6ead534c83ae9","answer1":"Name"},{"questionId":"r3e87261178f94361b4fa8b61bb6d62e4","answer1":"ID"},{"questionId":"r357b74d9ed964c3da24f0586f8cb7332","answer1":"email"},{"questionId":"r14db4cece08b49a09f249e7e87d06c51","answer1":"site"},{"questionId":"rc85571bd0c0b4027833c7d2f18f38b53","answer1":"No"},{"questionId":"ra9a3c908d3204e21b37c08bec50f983d","answer1":"No"},{"questionId":"rcf571f318ea54bffa41364a4f967d88c","answer1":"No"},{"questionId":"ra09058c8546e489e865cd6ffd862c23c","answer1":"No"}]"
}`;

fetch("https://forms.office.com/formapi/api/.../forms('...')/responses", {
    method: 'POST',
    body: data,
    headers: {
        'Content-Type': 'application/json'
    }
})
    .then(res => res.json())
    .then(json => functions.logger.log(json))
    .catch (err => functions.logger.log(err))
});

When I run the function it returns an error:

{"errors":{"":["The input was not valid."]},"type":"https://tools.ietf.org/html/rfc7231#section-6.5.1","title":"One or more validation errors occurred.","status":400,"traceId":"00-e52550913c0d8961deb46df79763ae95-06127511b66b74a6-00"} 

I was able to successfully send a HTTP post with reqbin.com with data as JSON. So I’m not understanding why it is failing with my function.reqbin POST

Want my data to be fixed on button click – php

My html page :

<!doctype html>
<html lang="en">
    <head>
        <title>Vikram</title>
        <meta charset="utf-8" />
        <meta name="developer" content="Sanmitha V S" />
        <link rel="stylesheet" href="../css/showtimes.css" />
        <script src="../js/showtimes.js"></script>
        
    </head>

    <body>
    
            <form action="../php/action.php" method="post" onsubmit="return check()">
        <nav>
        <h2 class="h1" name="h2">Vikram</h2>
        <img src="../img/movie1.jpg" alt="vikram_movie" id="vikram" />
    
            <h2>Showtimes : </h2> 
            <ul>
            <li><a href="#"> 12:00 </a></li>
            <li><a href="movie1_s2.html"> 15:30 </a></li>
            <li><a href="movie1_s3.html"> 19:00 </a></li>
            </ul>
            
            <button type="submit" name="submit">Book Tickets</button>
            <br><br>
            <a href="../index.html">Back to Home Page</a>
        </nav>
        
        <div id="left">
        
        <header>
            <h1 class="h1">Jazz Film City </h1>
        </header>
        
            
            <label for="no_seats">No. of seats </label>
                <select id="no_seats"  name="no_seats">
                    <option>1</option>
                    <option>2</option>
                    <option>3</option>
                    <option>4</option>
                    <option>5</option>
                    <option>6</option>
                    <option>7</option>
                    <option>8</option>
                    <option>9</option>
                    <option>10</option>
                </select>
            
                <label for="selected">Selected slot</label>
                <input type="text" id="st" name="st" value="12:00" size=5 readonly />
                
                <label for="selected">Selected seats</label>
                <textarea id="selected" name="selected" readonly></textarea>
                <br><br>
        
        <div id="seat_ar">
        <br>
            Platinum section : Rs. 220<br><br>
            <img src="../img/vaccant.jpg" id="a1" onclick="select(a1)" alt="a1" class="seats">
            <img src="../img/vaccant.jpg" id="a2" onclick="select(a2)" alt="a2" class="seats">
            <img src="../img/vaccant.jpg" id="a3" onclick="select(a3)" alt="a3" class="seats">
            <img src="../img/vaccant.jpg" id="a4" onclick="select(a4)" alt="a4" class="seats">
            <img src="../img/vaccant.jpg" id="a5" onclick="select(a5)" alt="a5" class="seats">
            <img src="../img/vaccant.jpg" id="a6" onclick="select(a6)" alt="a6" class="seats">
            <img src="../img/vaccant.jpg" id="a7" onclick="select(a7)" alt="a7" class="seats">
            <img src="../img/vaccant.jpg" id="a8" onclick="select(a8)" alt="a8" class="seats">
            <img src="../img/vaccant.jpg" id="a9" onclick="select(a9)" alt="a9" class="seats">
            <img src="../img/vaccant.jpg" id="a10" onclick="select(a10)" alt="a10" class="seats">
            <img src="../img/vaccant.jpg" id="a11" onclick="select(a11)" alt="a11" class="seats">
            <img src="../img/vaccant.jpg" id="a12" onclick="select(a12)" alt="a12" class="seats">
            <img src="../img/vaccant.jpg" id="a13" onclick="select(a13)" alt="a13" class="seats">
            <img src="../img/vaccant.jpg" id="a14" onclick="select(a14)" alt="a14" class="seats">
            <img src="../img/vaccant.jpg" id="a15" onclick="select(a15)" alt="a15" class="seats">
            <br>
            <img src="../img/vaccant.jpg" id="b1" onclick="select(b1)" alt="b1" class="seats">
            <img src="../img/vaccant.jpg" id="b2" onclick="select(b2)" alt="b2" class="seats">
            <img src="../img/vaccant.jpg" id="b3" onclick="select(b3)" alt="b3" class="seats">
            <img src="../img/vaccant.jpg" id="b4" onclick="select(b4)" alt="b4" class="seats">
            <img src="../img/vaccant.jpg" id="b5" onclick="select(b5)" alt="b5" class="seats">
            <img src="../img/vaccant.jpg" id="b6" onclick="select(b6)" alt="b6" class="seats">
            <img src="../img/vaccant.jpg" id="b7" onclick="select(b7)" alt="b7" class="seats">
            <img src="../img/vaccant.jpg" id="b8" onclick="select(b8)" alt="b8" class="seats">
            <img src="../img/vaccant.jpg" id="b9" onclick="select(b9)" alt="b9" class="seats">
            <img src="../img/vaccant.jpg" id="b10" onclick="select(b10)" alt="b10" class="seats">
            <img src="../img/vaccant.jpg" id="b11" onclick="select(b11)" alt="b11" class="seats">
            <img src="../img/vaccant.jpg" id="b12" onclick="select(b12)" alt="b12" class="seats">
            <img src="../img/vaccant.jpg" id="b13" onclick="select(b13)" alt="b13" class="seats">
            <img src="../img/vaccant.jpg" id="b14" onclick="select(b14)" alt="b14" class="seats">
            <img src="../img/vaccant.jpg" id="b15" onclick="select(b15)" alt="b15" class="seats">
            <br>
            Gold section : Rs. 180<br><br>
            <img src="../img/vaccant.jpg" id="c1" onclick="select(c1)" alt="c1" class="seats">
            <img src="../img/vaccant.jpg" id="c2" onclick="select(c2)" alt="c2" class="seats">
            <img src="../img/vaccant.jpg" id="c3" onclick="select(c3)" alt="c3" class="seats">
            <img src="../img/vaccant.jpg" id="c4" onclick="select(c4)" alt="c4" class="seats">
            <img src="../img/vaccant.jpg" id="c5" onclick="select(c5)" alt="c5" class="seats">
            <img src="../img/vaccant.jpg" id="c6" onclick="select(c6)" alt="c6" class="seats">
            <img src="../img/vaccant.jpg" id="c7" onclick="select(c7)" alt="c7" class="seats">
            <img src="../img/vaccant.jpg" id="c8" onclick="select(c8)" alt="c8" class="seats">
            <img src="../img/vaccant.jpg" id="c9" onclick="select(c9)" alt="c9" class="seats">
            <img src="../img/vaccant.jpg" id="c10" onclick="select(c10)" alt="c10" class="seats">
            <img src="../img/vaccant.jpg" id="c11" onclick="select(c11)" alt="c11" class="seats">
            <img src="../img/vaccant.jpg" id="c12" onclick="select(c12)" alt="c12" class="seats">
            <img src="../img/vaccant.jpg" id="c13" onclick="select(c13)" alt="c13" class="seats">
            <img src="../img/vaccant.jpg" id="c14" onclick="select(c14)" alt="c14" class="seats">
            <img src="../img/vaccant.jpg" id="c15" onclick="select(c15)" alt="c15" class="seats">
            <br>
            <img src="../img/vaccant.jpg" id="d1" onclick="select(d1)" alt="d1" class="seats">
            <img src="../img/vaccant.jpg" id="d2" onclick="select(d2)" alt="d2" class="seats">
            <img src="../img/vaccant.jpg" id="d3" onclick="select(d3)" alt="d3" class="seats">
            <img src="../img/vaccant.jpg" id="d4" onclick="select(d4)" alt="d4" class="seats">
            <img src="../img/vaccant.jpg" id="d5" onclick="select(d5)" alt="d5" class="seats">
            <img src="../img/vaccant.jpg" id="d6" onclick="select(d6)" alt="d6" class="seats">
            <img src="../img/vaccant.jpg" id="d7" onclick="select(d7)" alt="d7" class="seats">
            <img src="../img/vaccant.jpg" id="d8" onclick="select(d8)" alt="d8" class="seats">
            <img src="../img/vaccant.jpg" id="d9" onclick="select(d9)" alt="d9" class="seats">
            <img src="../img/vaccant.jpg" id="d10" onclick="select(d10)" alt="d10" class="seats">
            <img src="../img/vaccant.jpg" id="d11" onclick="select(d11)" alt="d11" class="seats">
            <img src="../img/vaccant.jpg" id="d12" onclick="select(d12)" alt="d12" class="seats">
            <img src="../img/vaccant.jpg" id="d13" onclick="select(d13)" alt="d13" class="seats">
            <img src="../img/vaccant.jpg" id="d14" onclick="select(d14)" alt="d14" class="seats">
            <img src="../img/vaccant.jpg" id="d15" onclick="select(d15)" alt="d15" class="seats">
            <br>
            <img src="../img/vaccant.jpg" id="e1" onclick="select(e1)" alt="e1" class="seats">
            <img src="../img/vaccant.jpg" id="e2" onclick="select(e2)" alt="e2" class="seats">
            <img src="../img/vaccant.jpg" id="e3" onclick="select(e3)" alt="e3" class="seats">
            <img src="../img/vaccant.jpg" id="e4" onclick="select(e4)" alt="e4" class="seats">
            <img src="../img/vaccant.jpg" id="e5" onclick="select(e5)" alt="e5" class="seats">
            <img src="../img/vaccant.jpg" id="e6" onclick="select(e6)" alt="e6" class="seats">
            <img src="../img/vaccant.jpg" id="e7" onclick="select(e7)" alt="e7" class="seats">
            <img src="../img/vaccant.jpg" id="e8" onclick="select(e8)" alt="e8" class="seats">
            <img src="../img/vaccant.jpg" id="e9" onclick="select(e9)" alt="e9" class="seats">
            <img src="../img/vaccant.jpg" id="e10" onclick="select(e10)" alt="e10" class="seats">
            <img src="../img/vaccant.jpg" id="e11" onclick="select(e11)" alt="e11" class="seats">
            <img src="../img/vaccant.jpg" id="e12" onclick="select(e12)" alt="e12" class="seats">
            <img src="../img/vaccant.jpg" id="e13" onclick="select(e13)" alt="e13" class="seats">
            <img src="../img/vaccant.jpg" id="e14" onclick="select(e14)" alt="e14" class="seats">
            <img src="../img/vaccant.jpg" id="e15" onclick="select(e15)" alt="e15" class="seats">
            <br>
            <img src="../img/vaccant.jpg" id="f1" onclick="select(f1)" alt="f1" class="seats">
            <img src="../img/vaccant.jpg" id="f2" onclick="select(f2)" alt="f2" class="seats">
            <img src="../img/vaccant.jpg" id="f3" onclick="select(f3)" alt="f3" class="seats">
            <img src="../img/vaccant.jpg" id="f4" onclick="select(f4)" alt="f4" class="seats">
            <img src="../img/vaccant.jpg" id="f5" onclick="select(f5)" alt="f5" class="seats">
            <img src="../img/vaccant.jpg" id="f6" onclick="select(f6)" alt="f6" class="seats">
            <img src="../img/vaccant.jpg" id="f7" onclick="select(f7)" alt="f7" class="seats">
            <img src="../img/vaccant.jpg" id="f8" onclick="select(f8)" alt="f8" class="seats">
            <img src="../img/vaccant.jpg" id="f9" onclick="select(f9)" alt="f9" class="seats">
            <img src="../img/vaccant.jpg" id="f10" onclick="select(f10)" alt="f10" class="seats">
            <img src="../img/vaccant.jpg" id="f11" onclick="select(f11)" alt="f11" class="seats">
            <img src="../img/vaccant.jpg" id="f12" onclick="select(f12)" alt="f12" class="seats">
            <img src="../img/vaccant.jpg" id="f13" onclick="select(f13)" alt="f13" class="seats">
            <img src="../img/vaccant.jpg" id="f14" onclick="select(f14)" alt="f14" class="seats">
            <img src="../img/vaccant.jpg" id="f15" onclick="select(f15)" alt="f15" class="seats">
            <br>
            Silver section : Rs. 100<br><br>
            <img src="../img/vaccant.jpg" id="g1" onclick="select(g1)" alt="g1" class="seats">
            <img src="../img/vaccant.jpg" id="g2" onclick="select(g2)" alt="g2" class="seats">
            <img src="../img/vaccant.jpg" id="g3" onclick="select(g3)" alt="g3" class="seats">
            <img src="../img/vaccant.jpg" id="g4" onclick="select(g4)" alt="g4" class="seats">
            <img src="../img/vaccant.jpg" id="g5" onclick="select(g5)" alt="g5" class="seats">
            <img src="../img/vaccant.jpg" id="g6" onclick="select(g6)" alt="g6" class="seats">
            <img src="../img/vaccant.jpg" id="g7" onclick="select(g7)" alt="g7" class="seats">
            <img src="../img/vaccant.jpg" id="g8" onclick="select(g8)" alt="g8" class="seats">
            <img src="../img/vaccant.jpg" id="g9" onclick="select(g9)" alt="g9" class="seats">
            <img src="../img/vaccant.jpg" id="g10" onclick="select(g10)" alt="g10" class="seats">
            <img src="../img/vaccant.jpg" id="g11" onclick="select(g11)" alt="g11" class="seats">
            <img src="../img/vaccant.jpg" id="g12" onclick="select(g12)" alt="g12" class="seats">
            <img src="../img/vaccant.jpg" id="g13" onclick="select(g13)" alt="g13" class="seats">
            <img src="../img/vaccant.jpg" id="g14" onclick="select(g14)" alt="g14" class="seats">
            <img src="../img/vaccant.jpg" id="g15" onclick="select(g15)" alt="g15" class="seats">
            <br>
            <img src="../img/vaccant.jpg" id="h1" onclick="select(h1)" alt="h1" class="seats">
            <img src="../img/vaccant.jpg" id="h2" onclick="select(h2)" alt="h2" class="seats">
            <img src="../img/vaccant.jpg" id="h3" onclick="select(h3)" alt="h3" class="seats">
            <img src="../img/vaccant.jpg" id="h4" onclick="select(h4)" alt="h4" class="seats">
            <img src="../img/vaccant.jpg" id="h5" onclick="select(h5)" alt="h5" class="seats">
            <img src="../img/vaccant.jpg" id="h6" onclick="select(h6)" alt="h6" class="seats">
            <img src="../img/vaccant.jpg" id="h7" onclick="select(h7)" alt="h7" class="seats">
            <img src="../img/vaccant.jpg" id="h8" onclick="select(h8)" alt="h8" class="seats">
            <img src="../img/vaccant.jpg" id="h9" onclick="select(h9)" alt="h9" class="seats">
            <img src="../img/vaccant.jpg" id="h10" onclick="select(h10)" alt="h10" class="seats">
            <img src="../img/vaccant.jpg" id="h11" onclick="select(h11)" alt="h11" class="seats">
            <img src="../img/vaccant.jpg" id="h12" onclick="select(h12)" alt="h12" class="seats">
            <img src="../img/vaccant.jpg" id="h13" onclick="select(h13)" alt="h13" class="seats">
            <img src="../img/vaccant.jpg" id="h14" onclick="select(h14)" alt="h14" class="seats">
            <img src="../img/vaccant.jpg" id="h15" onclick="select(h15)" alt="h15" class="seats">
            <br>
            <img src="../img/vaccant.jpg" id="i1" onclick="select(i1)" alt="i1" class="seats">
            <img src="../img/vaccant.jpg" id="i2" onclick="select(i2)" alt="i2" class="seats">
            <img src="../img/vaccant.jpg" id="i3" onclick="select(i3)" alt="i3" class="seats">
            <img src="../img/vaccant.jpg" id="i4" onclick="select(i4)" alt="i4" class="seats">
            <img src="../img/vaccant.jpg" id="i5" onclick="select(i5)" alt="i5" class="seats">
            <img src="../img/vaccant.jpg" id="i6" onclick="select(i6)" alt="i6" class="seats">
            <img src="../img/vaccant.jpg" id="i7" onclick="select(i7)" alt="i7" class="seats">
            <img src="../img/vaccant.jpg" id="i8" onclick="select(i8)" alt="i8" class="seats">
            <img src="../img/vaccant.jpg" id="i9" onclick="select(i9)" alt="i9" class="seats">
            <img src="../img/vaccant.jpg" id="i10" onclick="select(i10)" alt="i10" class="seats">
            <img src="../img/vaccant.jpg" id="i11" onclick="select(i11)" alt="i11" class="seats">
            <img src="../img/vaccant.jpg" id="i12" onclick="select(i12)" alt="i12" class="seats">
            <img src="../img/vaccant.jpg" id="i13" onclick="select(i13)" alt="i13" class="seats">
            <img src="../img/vaccant.jpg" id="i14" onclick="select(i14)" alt="i14" class="seats">
            <img src="../img/vaccant.jpg" id="i15" onclick="select(i15)" alt="i15" class="seats">
            <br>
            <img src="../img/vaccant.jpg" id="j1" onclick="select(j1)" alt="j1" class="seats">
            <img src="../img/vaccant.jpg" id="j2" onclick="select(j2)" alt="j2" class="seats">
            <img src="../img/vaccant.jpg" id="j3" onclick="select(j3)" alt="j3" class="seats">
            <img src="../img/vaccant.jpg" id="j4" onclick="select(j4)" alt="j4" class="seats">
            <img src="../img/vaccant.jpg" id="j5" onclick="select(j5)" alt="j5" class="seats">
            <img src="../img/vaccant.jpg" id="j6" onclick="select(j6)" alt="j6" class="seats">
            <img src="../img/vaccant.jpg" id="j7" onclick="select(j7)" alt="j7" class="seats">
            <img src="../img/vaccant.jpg" id="j8" onclick="select(j8)" alt="j8" class="seats">
            <img src="../img/vaccant.jpg" id="j9" onclick="select(j9)" alt="j9" class="seats">
            <img src="../img/vaccant.jpg" id="j10" onclick="select(j10)" alt="j10" class="seats">
            <img src="../img/vaccant.jpg" id="j11" onclick="select(j11)" alt="j11" class="seats">
            <img src="../img/vaccant.jpg" id="j12" onclick="select(j12)" alt="j12" class="seats">
            <img src="../img/vaccant.jpg" id="j13" onclick="select(j13)" alt="j13" class="seats">
            <img src="../img/vaccant.jpg" id="j14" onclick="select(j14)" alt="j14" class="seats">
            <img src="../img/vaccant.jpg" id="j15" onclick="select(j15)" alt="j15" class="seats">
            <br><br><br>
            <img src="../img/screen_this_way.png" alt="Screen this way" id="stw" />
        </div>
        </div>
        
        </form>
    </body>
</html>

My js file :

var i=1;
var res=new Array();
function select(seat){
    n=document.getElementById("no_seats");
    n1=parseInt(n.options[n.selectedIndex].text);
    if((seat.getAttribute("src")=="../img/vaccant.jpg") &&(i<=n1)){
        seat.src="../img/select.jpg";
            i++;
            res.push(seat.alt);
    }
    else if(seat.getAttribute("src")=="../img/select.jpg"){
        seat.src="../img/vaccant.jpg";
            i--;
            for(j in res){
            if(res[j]==seat.alt)
                res.splice(j,1);
        }
        
    }
    document.getElementById("selected").value=res;
}

function check(){
    var n =document.getElementById("selected").value;
    if(n.length ==0){
        alert("Please select your seats");
        return false;
    }
}

My php file :

<!doctype html>
<?php
    session_start();
?>
<!doctype html>
<html lang="en">
    <head>
        <title>Personal details</title>
        <meta charset="utf-8" />
        <meta name="developer" content="Sanmitha V S" />
        <link rel="stylesheet" href="../css/action.css" />
    </head>

    <body>
        <header>
            <h1>Your details : </h1>
        </header>
        
        <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
            <fieldset>
            <legend>Personal Details</legend>
            
            <label for="firstName">First Name : </label>
            <input type="text" id="firstName" name="firstName" maxlength="20" placeholder="Your first name" required />
            
            <label for="lastName">Last Name : </label>
            <input type="text" id="lastName" name="lastName" maxlength="20" placeholder="Your last name" required />
            <br><br>
            
            <label for="email">Email id:  </label>
            <input type="email" id="email" name="email"  placeholder="Your email id" required />
        
            <label for="phone">Phone:  </label>
            <input type="tel" id="phone" name="phone"  placeholder="Your phone number" pattern="[0-9]{5} [0-9]{5}" required />
            <br>
        </fieldset>
        
        <fieldset>
            <legend>Slot and seating </legend>
            <?php
            $s=$_POST["selected"];
            $a=explode(',',$s);
            if((count($a)==1) && ($a[0]=="")){
                unset($a[0]);
            }
            $n=count($a);
            echo "Selected slot : ".$_POST["st"]."<br><br>";
            echo "Number of seats : ".$n."<br><br>";
            echo "Selected seats : ".$_POST["selected"]."<br><br>";
            $p=array();
            foreach($a as $i){
                switch($i[0])
                {
                    case 'a':
                    case 'b':
                        array_push($p,220);
                        break;
                    case 'c':
                    case 'd':
                    case 'e':
                    case 'f':
                        array_push($p,180);
                        break;
                    case 'g':
                    case 'h':
                    case 'i':
                    case 'j':
                        array_push($p,100);
                        break;
                }
            }
            ?>
            </fieldset>
            
            <fieldset>
            <legend>Total Amount to be payed</legend>
            
            <table>
                <thead>
                <tr>
                <th>Seat</th>
                <th>Price</th>
                </tr>
                </thead>
                
                <tbody>
            <?php
            for($i=0;$i<count($p);$i++){
                echo "<tr>";
                echo "<td>".$a[$i]."</td>";
                echo "<td>".$p[$i]."</td>";
                echo "</tr>";
            }
            echo "</tbody></table>";
            
                $sum=array_sum($p);
                $gst=(15*$sum)/100;
                echo "Total Amount to be payed : ".($sum+$gst)."<br>";
                echo " Ticket amount : ".$sum."<br>";
                echo "%12 gst : ".$gst;
                
            ?>
            <button name="go_pay" id="go_pay">Go to Payment</button>
            <?php
            
                if (isset($_POST['go_pay'])){
                $fn=$_POST["firstName"];
                $ln=$_POST["lastName"];
                $_SESSION[$fn." ".$ln]=array($a, $sum+$gst);
                print_r($_SESSION[$fn." ".$ln]);
                }
                ?>
            </form>
        </fieldset>
        
        </form>
    </body>
</html>

The js file and php file are perfectly linked with the html file.
When I click the button Go to payment, the data stored in the html page gets erased. Whereas I want my data to stay there when I click the button. I tried various methods but I couldn’t achieve the desired results. I used various arrays, sessions to accomplish but it ended in vain. Is there any simple way to accomplish the task ? Please help !

How to rearrange table td [duplicate]

I have this problem, is there a way to change the order of the td and th with “testing” class such that it will be the first column on mobile but moves to the last column on desktop? thanks.

<table class="table">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col" class="testing">Handle</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td class="testing">@mdo</td>
   </tr>
   <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td class="testing">@fat</td>
    </tr>
  </tbody>
 </table>

Stream chat keyboard render error (“stream-chat-react-native”). React Native

Hi i am using stream chat react native sdk, all the setup are done and working fine. Currently facing an issue, when clicking the message input, keyboard appears but my screen flows up above the safearea. I’ve tried all the way of solutions.

But its working in my sample app,I have looked all the configurations but i cant find what was the problem.

This is my Message screen Message screen and this is when clicking message input after keyboard pop up.

Javascript Split and Match the pattern array

I am trying to get the pattern from a string in javascript, where my string is 01-01-2000 - 01-01-2010 here I want to make these both date separate like date1 = 01-01-2000 and date2 = 01-01-2010.

I have tried this code

var date = "01-01-2000 - 01-01-2010";
var date2 = date.match(/([0-9]{2})-([0-9]{2})-([0-9]{4})/);
console.log(date2[0]);

output: 01-01-2000 [correct]

but I using console.log(date2[1]) it displaying 01 only.

Please help how to achieve the goal make this function.

expecting output:

date[0]: 01-01-2000
date[1]: 01-01-2010

Analyze production bundle for specific modules usage

I have a couple of Angular UI libraries used in many applications. These libraries have more than 50 modules in them but the applications usually do a barrel import. I want to analyze their production bundle and find out which of the modules are used in the build.

When I use source-map-explorer or webpack-bundle-analyzer I get to see the library’s root module only, is there any way from there to drill down further? Alternatively, I am thinking of creating a custom decorator in the library to print a message to console when used but the drawback I see is that the message will appear only on runtime not from build.

Is there a good way to derive this statistic?

TodoList.map is not a function? [duplicate]

I had a functioning app although on some refreshes I receive the following error:

TypeError: todoList.map is not a function
TodoList
src/components/TodoList.tsx:43
  40 |   onChange={handleChange}
  41 |   value={task}
  42 | />
> 43 | <Button onClick={addTask} data-testid="add">
     | ^  44 |   Add Task
  45 | </Button>
  46 | {todoList.map((todo, key) => (
View compiled
▶ 17 stack frames were collapsed.

I’d like to know why I’m receiving this. I previously ‘fixed’ it by removing the map saving and then pasting it in again although now when I try to make changes in the code elsewhere it will not render the app and throw this error. Below is my code.

todoList:

import { useEffect, useState } from 'react';
import { Container, TextInput, Button, List } from '@mantine/core';
import { Tasks } from '../types';

const TodoList = () => {
  const [task, setTask] = useState('');
  const [todoList, setTodoList] = useState<Tasks[]>([]);

  const handleChange = (event: any): void => {
    setTask(event.target.value);
  };

  const handleDelete = (taskToDelete: any) => {
    const deleted = todoList.filter((t) => t.taskName !== taskToDelete);
    setTodoList(deleted);
    localStorage.setItem('localTasks', JSON.stringify(deleted));
  };

  useEffect(() => {
    if (localStorage.getItem('localTasks')) {
      const storedList = JSON.parse(localStorage.getItem('localTasks') || '{}');
      setTodoList(storedList);
    }
  }, []);

  const addTask = () => {
    const newTask = {
      taskName: task,
    };
    setTodoList([...todoList, newTask]);
    localStorage.setItem('localTasks', JSON.stringify([...todoList, newTask]));
    setTask('');
  };
  return (
    <Container>
      <TextInput
        type="text"
        name="task"
        placeholder="enter a task"
        onChange={handleChange}
        value={task}
      />
      <Button onClick={addTask} data-testid="add">
        Add Task
      </Button>
      {todoList.map((todo, key) => (
        <Container key={key}>
          <List
            data-testid="todos"
            icon={
              <Button
                data-testid="remove"
                onClick={() => {
                  handleDelete(todo.taskName);
                }}
              >
                X
              </Button>
            }
          >
            <List.Item>{todo.taskName}</List.Item>
          </List>
        </Container>
      ))}
    </Container>
  );
};

export default TodoList;

any help with this would be great.