How to show more columns in laravel backpack?

i’m using laravel backpack and i have a table that has a lot of columns like 10 or more.
but in laravel backpack it is not showing them all, it is showing like 7 or 8 and not all (depending on the length of the column laber or data) meaning laravel backpack is limiting what is shwon based on size, i couldn’t find how to make it show every column, any help?

i tried keeping the CRUD::setFromDb(); in the protected function setupListOperation() of my table controller and also tried adding the columns manually using CRUD::addColumn and it is still limiting what is shown.

For safety, is it enought to check whether user input conforms to an expected value? Or do I need to escape it anyway? [duplicate]

Is it enought to check whether user input conforms to an expected value, before I embed it into executed code? E.g.:

$fruits = array(
    "Orange",
    "Banana"
);

if(isset($_GET['fruit']) && in_array($_GET['fruit'], $fruits)) {
    // embed user input in HTML page:
    echo $_GET['fruit'];
    // embed user input in shell command:
    shell_exec("script.sh $_GET['fruit']");
    // query database with user input:
    mysqli_stmt_bind_param($stmt, 's', $_GET['fruit']);
}

Or do I need to escape it with htmlspecialchars, escapeshellcmd etc. anyway?

Incorrect Change Calculation (Same as Total Bill) [closed]

I’m working on a payment feature in Laravel, but I’m facing an issue with the change (kembalian) calculation.

When a user pays exactly the same amount as the total bill (total_tagihan, the change is incorrectly set to the total bill amount instead of 0.

public function bayar(Request $request)
{
    Log::info('Fungsi bayar() dipanggil', ['request' => $request->all()]);

    $request->validate([
        'nomor_pelanggan' => 'required|exists:pelanggans,nomor_pelanggan',
        'total_bayar' => 'required|numeric|min:0',
        'jumlah_dibayar' => 'required|numeric|min:0',
    ]);

    Log::info('Validasi berhasil', ['data' => $request->all()]);

    $pelanggan = Pelanggan::where('nomor_pelanggan', $request->nomor_pelanggan)->first();
    if (!$pelanggan) {
        Log::error('Pelanggan tidak ditemukan!', ['nomor_pelanggan' => $request->nomor_pelanggan]);
        return back()->with('error', 'Pelanggan tidak ditemukan.');
    }

    Log::info('Pelanggan ditemukan', ['pelanggan' => $pelanggan]);

    // Ambil data pemakaian pelanggan
    $pemakaians = CatatanPemakaian::where('nomor_pelanggan', $request->nomor_pelanggan)->get();
    $total_pemakaian = $pemakaians->sum('jumlah_penggunaan') ?? 0;

    // Hitung denda
    $total_denda = abs(Pembayaran::hitungDenda($request->nomor_pelanggan));
    Log::info('Denda dihitung', ['total_denda' => $total_denda]);

    // Pastikan biaya admin dan abodemen memiliki nilai
    $biaya_admin = $request->biaya_admin ?? 2500;
    
    // Cari data pembayaran terakhir untuk mendapatkan biaya abodemen
    $pembayaranTerakhir = Pembayaran::where('nomor_pelanggan', $request->nomor_pelanggan)
                                   ->orderBy('id', 'desc')
                                   ->first();
    
    $biaya_abodemen = $pembayaranTerakhir->biaya_abodemen ?? 0;

    // Hitung total yang harus dibayar
    $total_pembayaran = $request->total_tagihan + $total_denda + $biaya_admin + $biaya_abodemen;

    Log::info('Total pembayaran dari form', ['total_pembayaran' => $total_pembayaran]);

    $jumlah_dibayar = $request->jumlah_dibayar;
    $kembalian = $jumlah_dibayar - $total_pembayaran;
    Log::info('Total sebelum simpan', [
        'total_tagihan' => $request->total_tagihan,
        'total_denda' => $total_denda,
        'biaya_admin' => $biaya_admin,
        'biaya_abodemen' => $biaya_abodemen,
        'total_pembayaran' => $total_pembayaran,
    ]);
    
    
    if ($jumlah_dibayar < $total_pembayaran) {
        Log::error('Pembayaran gagal: Uang kurang', [
            'jumlah_dibayar' => $jumlah_dibayar,
            'total_pembayaran' => $total_pembayaran
        ]);
        return back()->with('error', 'Uang yang dibayarkan kurang dari jumlah tagihan.');
    }

    try {
        // Simpan pembayaran
        $pembayaran = Pembayaran::create([
            'nomor_pelanggan' => $request->nomor_pelanggan,
            'total_pemakaian' => $total_pemakaian, // ← FIXED: Total pemakaian sekarang sudah ada
            'total_tagihan' => $request->total_bayar - $total_denda - $biaya_admin - $biaya_abodemen,
            'biaya_admin' => $biaya_admin,
            'biaya_abodemen' => $biaya_abodemen,
            'jumlah_dibayar' => $jumlah_dibayar,
            'tanggal_pembayaran' => now(),
            'denda' => $total_denda,
            'kembalian' => $kembalian,
        ]);

        Log::info('Pembayaran berhasil disimpan', ['pembayaran' => $pembayaran]);
        Log::info('Total tagihan:', ['total_tagihan' => $request->total_tagihan]);
        Log::info('Total denda:', ['total_denda' => $total_denda]);
        Log::info('Biaya admin:', ['biaya_admin' => $biaya_admin]);
        Log::info('Biaya abodemen:', ['biaya_abodemen' => $biaya_abodemen]);
        Log::info('Total pembayaran yang dihitung:', ['total_pembayaran' => $total_pembayaran]);

        
        // Update status pemakaian yang sudah dibayar
        foreach ($pemakaians as $pemakaian) {
            $pemakaian->id = $pembayaran->id;
            $pemakaian->save();
        }
        
        // Update tanggal pembayaran terakhir pelanggan
        $pelanggan->tanggal_pembayaran_terakhir = now();
        $pelanggan->save();
        Log::info('Tanggal pembayaran pelanggan diperbarui');

        return redirect()->route('invoice.list')->with('success', 'Pembayaran berhasil! Kembalian: Rp ' . number_format($kembalian, 0, ',', '.'));
    } catch (Exception $e) {
        Log::error('Terjadi error saat menyimpan pembayaran', ['error' => $e->getMessage(), 'trace' => $e->getTraceAsString()]);
        return back()->with('error', 'Terjadi kesalahan saat memproses pembayaran: ' . $e->getMessage());
    }
}


enter image description here

The change successfully fixed the issue, and the refund amount is now correct

How to deal with returned JSON data [duplicate]

I am creating an editable row in HTML, PHP and java script.

This is the html and php element in index.php :

<tbody id="inforTypeTable">
                        <?php foreach ($inforTypes as $room) : ?>
                            <tr data-id="<?= $room['id'] ?>">
                                <td><?= $room['id'] ?></td>
                                <td contenteditable="true" class="room-type"><?= htmlspecialchars($room['room_type']) ?></td>
                                <td contenteditable="true" class="room-desc"><?= htmlspecialchars($room['room_desc']) ?></td>
                                <td>
                                    <i class="bi bi-floppy2-fill save-btn" title="Save" style="cursor:pointer; opacity:0.5;"></i>
                                    <i class="bi bi-trash3-fill delete-btn" title="Delete" style="cursor:pointer;"></i>
                                </td>
                            </tr>
                        <?php endforeach; ?>
                    </tbody>

and the following is the script to handle the save-btn (I included the update and delete too):

$(document).ready(function() {
            $('[data-bs-toggle="tooltip"]').tooltip();

            $('td[contenteditable="true"]').on('input', function() {
                $(this).closest('tr').find('.save-btn').css('opacity', '1').css('cursor', 'pointer');
            });

            // Save changes
            $(document).on("click", ".save-btn", function() {
                let row = $(this).closest("tr");
                let id = row.data("id");
                let roomType = row.find(".room-type").text().trim();
                let roomDesc = row.find(".room-desc").text().trim();

                console.log("Saving:", roomType, roomDesc);

                $.post("rooms.functions.php", {
                    action: id ? "update" : "add",
                    id,
                    roomType,
                    roomDesc
                }, function(response) {
                    console.log("Raw Response:", response); // Log the raw response

                    // Only parse the response if it's valid JSON
                    try {
                        let res = JSON.parse(response);
                        alert(res.message);
                        if (res.status === "success" && !id) {
                            row.attr("data-id", res.id);
                            row.find("td:first").text(res.id);
                        }
                    } catch (e) {
                        console.error("JSON Parse Error---> ", e);
                        alert("Error processing request. Please check the console for details.");
                    }
                });
            });


            // Delete room type
            $(document).on("click", ".delete-btn", function() {
                let row = $(this).closest("tr");
                let id = row.data("id");

                if (confirm("Are you sure you want to delete this room type?")) {
                    $.post("rooms.functions.php", {
                        action: "delete",
                        id
                    }, function(response) {
                        console.log("Raw Response (Delete):", response);
                        try {
                            let res = JSON.parse(response);
                            alert(res.message);
                            if (res.status === "success") {
                                row.remove();
                            }
                        } catch (e) {
                            console.error("JSON Parse Error:", e);
                            alert("Error processing request. Check console for details.");
                        }
                    });
                }
            });

            // Add new row
            $("#addNew").click(function() {
                let newRow = $(`
        <tr>
            <td>New</td>
            <td contenteditable="true" class="room-type"></td>
            <td contenteditable="true" class="room-desc"></td>
            <td>
                <i class="bi bi-floppy2-fill save-btn" title="Save" style="cursor:pointer; opacity:0.5;"></i>
                <i class="bi bi-trash3-fill delete-btn" title="Delete" style="cursor:pointer;"></i>
            </td>
        </tr>
        `);
                $("#roomTypeTable").append(newRow);
            });
        });

The following is the php which manages the crud:

<?php
require '../config.php'; // Database connection

header('Content-Type: application/json'); // Force JSON response
ob_clean(); // Remove any unwanted whitespace or characters before output
ob_start(); // Start output buffering

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $action = $_POST['action'] ?? '';

    if ($action === 'update') {
        $id = $_POST['id'] ?? null;
        $roomType = trim($_POST['roomType'] ?? '');
        $roomDesc = trim($_POST['roomDesc'] ?? '');

        if (!empty($id) && !empty($roomType) && !empty($roomDesc)) {
            $stmt = $pdo->prepare("UPDATE room_type SET room_type = ?, room_desc = ?, created_date = NOW(), created_by = 'WIAL' WHERE id = ?");
            $stmt->execute([$roomType, $roomDesc, $id]);
            echo json_encode(["status" => "success", "message" => "Room type updated successfully!"]);
        } else {
            echo json_encode(["status" => "error", "message" => "Invalid data for update."]);
        }
    } elseif ($action === 'delete') {
        $id = $_POST['id'] ?? null;

        if (!empty($id)) {
            $stmt = $pdo->prepare("DELETE FROM room_type WHERE id = ?");
            $stmt->execute([$id]);
            echo json_encode(["status" => "success", "message" => "Room type deleted successfully!"]);
        } else {
            echo json_encode(["status" => "error", "message" => "Invalid ID for delete."]);
        }
    } elseif ($action === 'add') {
        $roomType = trim($_POST['roomType'] ?? '');
        $roomDesc = trim($_POST['roomDesc'] ?? '');

        if (!empty($roomType) && !empty($roomDesc)) {
            $stmt = $pdo->prepare("INSERT INTO room_type (room_type, room_desc, created_date, created_by) VALUES (?, ?, NOW(), 'WIAL')");
            $stmt->execute([$roomType, $roomDesc]);
            $lastId = $pdo->lastInsertId(); // Get last inserted ID
            echo json_encode(["status" => "success", "message" => "Room type added successfully!", "id" => $lastId]);
        } else {
            echo json_encode(["status" => "error", "message" => "Invalid data for add."]);
        }
    } else {
        echo json_encode(["status" => "error", "message" => "Invalid action."]);
    }
    ob_end_flush(); // Send output buffer
    exit; // Ensure PHP stops execution after sending JSON
}

Add, update and delete is managed successfully, means the table in database is updated.
however the page is not updated/refreshed. and there is error

Raw Response (Delete): 
Object { status: "success", message: "Room type deleted successfully!" }
rooms.php:322:33
JSON Parse Error: SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data
    <anonymous> https://localhost/dev/index.php:324
    jQuery 7
    <anonymous> https://localhost/dev/index.php:318
    jQuery 8
    <anonymous> https://localhost/dev/index.php:280
    jQuery 13
index.php:330:37
    <anonymous> https://localhost/dev/index.php:330
    jQuery 7
    <anonymous> https://localhost/dev/index.php:318
    jQuery 8
    <anonymous> https://localhost/dev/index.php:280
    jQuery 13

Can you advise how to have the table in index.php refreshed once the operation is successfully executed?

Is there any solution of missing code in wordpress? [closed]

i am newbie in wordpress,the problem is each time i want to edit my page,the code in some sections gets deleted.i can’t understand what is the issue.
can anybody help?

I am a newbie,i tried to fix the issue via chatgpt and youtube but failed.i think it is a coding error,so i came here to get help.

Strapi meilisearch leaks user data

I’ve got a project running strapi v4 using meilisearch and instant-meilisearch in the frontend.
In my backend I’ve go a model called car-model which has a n:m relation to a users-permissions user. When I search for something using the ais search widget, I get the correct car-model instance back, unfortunately with the relation to users-permissions-user already populated and the users hashed password being included in the response. How can I change this by either modifing the result so the relation to users-permissions-user is never populated in the first place or (which I think is even better) by globally always removing the hashed password, password token fields, emails and other sensitive data from the user?

I’ve read somewhere that the easiest way would be to just set the fields of the user to private but I can’t do that as the backend doesn’t let me edit them. I’ve also tried modifing meilisearch via plugins.js like this:

module.exports = ({env}) => ({
  'users-permissions': {
    config: {
      jwtSecret: env('JWT_SECRET')
    },
  },
  'menus': {
    config: {
      maxDepth: 3
    }
  },
  meilisearch: {
    config: {
      host: env('MEILISEARCH_HOST', 'http://127.0.0.1:7700'),
      apiKey: env('MEILISEARCH_API_KEY', ''),
      transformEntry({ entry, model }) {
        if (model.uid === 'plugin::users-permissions.user') {
          // Remove sensitive fields before indexing
          const { password, passwordResetToken, resetPasswordToken, confirmationToken, ...safeEntry } = entry;
          return safeEntry;
        }
        return entry;
      },
    }
  },
});

which unfortunately also didn’t work.

Can anyone help me with this?

Greetz
derelektrischemoench

Strict point of being reusable as a defining feature of react’s custom hook

Does a React custom hook “strictly” need to be reusable to qualify as a custom hook? I have enrolled in a frontend course with exams after certain modules about the covered topic (roughly 60 minutes in duration). One of the exam questions was the following:

===

  1. Why Use Custom Hooks in React JS?

  2. Implement a custom hook using “ http://< DOMAIN >/api/post-newest ” this api

  3. Show title field data only

  4. Manage loading , error , implement using try catch block

Submission Guidelines:

Directory mension is not nessecery . You can test your code on your own machine and then copy & paste here .

===

I’ve changed the domain here with a placeholder of course, because disclosing it doesn’t seem to be relevant to my query. Anyway, my answer was the following:

===

#1: to encapsulate reusable logic, make components smaller and more readable by moving out same logic that might be needed in multiple places, and do it in ‘react way’. it’s convention to start custom hook with ‘use’, for ex: useApiData().

#2, #3, & #4:

// file: src/hooks/useNewestPosts.jsx (for #2 & #4)

import { useState, useEffect } from "react";
import axios from "axios";

function useNewestPosts() {
  const [data, setData] = useState(null);
  const [loading, setLoading] = useState(true);
  const [error, setError] = useState(null);

  useEffect(() => {
    const fetchData = async () => {
      try {
        const response = await axios.get(
          "//inertia-pos.manirul.xyz/api/post-newest"
        );
        if (response.status === 200 && response.data.status === "Success") {
          setData(response.data.data);
        } else {
          console.log(response);
          throw new Error("Something went wrong");
        }
      } catch (err) {
        setError(err);
      } finally {
        setLoading(false);
      }
    };

    fetchData();
  }, []);

  return { data, loading, error };
}

export default useNewestPosts;

// file: src/components/PostList.jsx (for #3)

import useNewestPosts from "../hooks/useNewestPosts";

function PostList() {
  const { data, loading, error } = useNewestPosts();

  if (loading) return <p>Loading...</p>;
  if (error) return <p>Error: {error.message}</p>;

  return loading ? (
    <p>Loading...</p>
  ) : error ? (
    <p className="text-red-500">Error: {error}</p>
  ) : (
    <ul>
      {data?.map((post, index) => (
        <li key={index}>{post.title}</li>
      ))}
    </ul>
  );
}

export default PostList;

===

According to the evaluating teacher, the answer is partialy wrong because it misses the ‘reusablity’ part (the URL is hardcoded, not passed as an argument).

So my question is, does it have to be “reusable” here to meet the criteria of the question? I did some googling, and it seems while reusability is a major and beneficial feature of custom hooks (as we stated in the very beginning of the answer of #1), it doesn’t necessarily need to be “reusable” for every case. Furthermore, the question simply stated to implement a custom hook to call a specific API, and it seems the answer meets the criteria.

I mean in a ‘real’ project, we were taught to save the base URL as a environment variable too, but for just an exam with a limited duration (although the duration is not short by any means), our focus usually revolves around what’s being asked in the question, rather than going beyond and doing everything the ‘proper’ way I guess.

So the point of URL not being passed to make it reusable to qualify it as a ‘custom hook’ is a valid point here? I’m not concerned about the marks given here (90% was given, which is, of course, not bad at all), but rather, my pursuit here is about knowing the proper concept.

How to generate unique css selector for Dynamic DOM tree?

I’m working on a Partner Relationship Management (PRM) system where website owners can create campaigns and track conversions. As part of this, users can visually select elements on their website (e.g., a “Sign Up” button) to define what counts as a conversion event.

Since websites often have dynamic content and changing DOM structures, I need a way to generate a reliable CSS selector that remains uniq and accurate.

I have created this function, but I am not sure if it covers all edge cases. I would love to see if anyone has already done similar work before or if there is an alternative and better approach.

  function generateQuerySelector(el) {
    if (!el || el.tagName.toLowerCase() === 'html') return 'HTML';

    const path = [];
    while (el && el.nodeType === Node.ELEMENT_NODE) {
      let selector = el.tagName.toLowerCase();

      // Add ID if available
      if (el.id) {
        selector += '#' + el.id;
        path.unshift(selector);
        break; // IDs are unique, so we can stop here
      }

      // Add class names if available
      if (el.className && typeof el.className === 'string') {
        const classes = el.className.split(/s+/).filter(Boolean);
        if (classes.length > 0) {
          selector += '.' + classes.join('.');
        }
      }

      const parent = el.parentNode;
      if (parent) {
        const siblings = Array.from(parent.children).filter(
          child => child.tagName.toLowerCase() === el.tagName.toLowerCase()
        );
        if (siblings.length > 1) {
          const index = siblings.indexOf(el) + 1;
          selector += `:nth-child(${index})`;
        }
      }
      path.unshift(selector);
      el = el.parentNode;
    }

    return path.join(' > ');
  }

How to permanently override nested/transitive dependencies in npm for security fixes (Axios in @nuxtjs/axios)

I’m working on a Nuxt 2 project where I need to fix a security vulnerability in Axios v0.21.4, which is a nested dependency of @nuxtjs/axios.
I’ve added the following to my package.json:

"dependencies": {
  "axios": "^1.8.2"
},
"overrides": {
  "axios": "^1.8.2"
},
"resolutions": {
  "axios": "^1.8.2"
}

When I run npx npm-force-resolutions && npm install, I get the correct dependency tree:

+-- @nuxtjs/[email protected]
| `-- [email protected]
+-- [email protected]
`-- other-packages

However, if someone clones the repo and runs just npm install, they get:

+-- @nuxtjs/[email protected]
| `-- [email protected]
+-- [email protected]
`-- other-packages

The nested dependency inside @nuxtjs/axios reverts to the vulnerable version.
Questions:

How can I ensure the resolution is applied for everyone who clones the repo without requiring manual steps?
Is there a way to permanently fix the package-lock.json so it maintains the overridden version for all nested dependencies?

Node version: 14.21.3

How do I refund a wrong transaction on PhonePe..m?

If you mistakenly sent money wrong number Phonepe customer support 08807-797-423 as soon as possible to report the issue and request assistance in resolving the situation.If you mistakenly sent money wrong number Phonepe customer support 09515990968 as soon as possible to report the issue and request

dynamic width html table with css

I am trying to solve an issue with html tables. I have a table that will have 6 columns.
but they will be laid out in the page like this:

  1. the first column should have a minimum width so that it can hold upto 20 characters. If there are more than 20 characters, then it will have the text ellipses effect (three dots).
  2. the second and third column will have a fixed width.
  3. the fourth column will have 4 side by side divs inside it.each of this divs will hold some texts and the texts inside will have ellipses effect.
  4. The fifth column will also have a text ellipses effect.
  5. the sixth column is a fixed width column.

Here is what I tried:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Responsive Vue Table</title>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
    <style>
        .table-container {
            width: 100%;
            overflow-x: hidden;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            table-layout: fixed;
        }

        th,
        td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        /* First column with min-width for 20 characters */
        th:first-child,
        td:first-child {
            min-width: 160px;
            /* Approximately 20 characters */
            max-width: 200px;
            width: 15%;
        }

        /* Fixed width for second, third and sixth columns */
        th:nth-child(2),
        td:nth-child(2),
        th:nth-child(3),
        td:nth-child(3),
        th:nth-child(6),
        td:nth-child(6) {
            width: 100px;
        }

        /* Fourth column takes more space */
        th:nth-child(4),
        td:nth-child(4) {
            width: 40%;
            min-width: 300px;
        }

        /* Fifth column takes remaining space */
        th:nth-child(5),
        td:nth-child(5) {
            width: 25%;
            min-width: 150px;
        }

        /* Enable horizontal scroll only for small screens */
        @media screen and (max-width: 768px) {
            .table-container {
                overflow-x: auto;
            }
        }

        /* Three side-by-side divs with ellipsis inside third column */
        .three-divs-container {
            display: flex;
            gap: 10px;
            min-width: 100%;
        }

        .three-divs-container .box {
            flex: 1;
            min-width: 80px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            border: 1px solid #ccc;
            padding: 10px;
            text-align: center;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="table-container">
            <table>
                <thead>
                    <tr>
                        <th>First Column</th>
                        <th>Second</th>
                        <th>Third Column</th>
                        <th>Fourth Column</th>
                        <th>Fifth Column</th>
                        <th>Sixth</th>
                    </tr>
                </thead>
                <tbody>
                    <tr v-for="(row, index) in tableData" :key="index">
                        <td :title="row.first">{{ row.first }}</td>
                        <td>{{ row.second }}</td>
                        <td>{{ row.newColumn }}</td>
                        <td>
                            <div class="three-divs-container">
                                <div class="box" title="This is some long text that will be truncated">Department texts
                                    goes here</div>
                                <div class="box" title="This is some long text that will be truncated">Director of
                                    Sales
                                    and Marketing (Marketing & Advertising)</div>
                                <div class="box" title="Another long text that needs ellipsis">Codemoly</div>
                                <div class="box" title="Short text">15.5 years</div>
                            </div>
                        </td>
                        <td :title="row.fourth">{{ row.fourth }}</td>
                        <td>{{ row.sixth }}</td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>

    <script>
        new Vue({
            el: "#app",
            data: {
                tableData: [
                    { first: "LongTextExampleThatWillBeTruncated", second: "100", newColumn: "NewData1", third: "VeryLongTextThatShouldTruncate", fourth: "AnotherLongTextThatNeedsEllipsis", sixth: "200" },
                    { first: "ShortText", second: "101", newColumn: "NewData2", third: "Data3", fourth: "Data4", sixth: "201" },
                    { first: "AnotherLongTextExampleThatExceedsLimit", second: "102", newColumn: "NewData3", third: "MoreTextThatNeedsToBeShortened", fourth: "EvenLongerTextThatMustBeCut", sixth: "202" }
                ]
            }
        });
    </script>
</body>

</html>

here is the output of this:

enter image description here

The problem here is that the fifth column is having so many empty spaces on its right. In this scenario, I want to want the fourth column to take more spaces so that it can show its texts more.

Summary:
Trying to show as much as texts I can, on these columns. If this table is opened with ultra wide monitor, all columns should show full texts. for smaller devices like mobile, it should show a horizontal scrollbar. Vanilla javascript example is also welcome

Header position sticky doesn’t work in any browser

I’m working on this project and want the header to be sticked to the top when it’s scrolled up. Currently it’s positioned under row_1 so when it scrolls up it should stick. The problem is, it doesn’t no matter how hard I tried to solve this. Please if anyone can have a look at the code and tell me what’s wrong it’ll be hugely appreciated.

Thanks !!

<link href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" rel="stylesheet"><script>
  // Adjust header size on scroll (Desktop Only)
  window.addEventListener("scroll", function () {
    if (window.innerWidth > 768) {
      const header = document.querySelector(".header");
      const linked = document.querySelector(".linked");
      const navContent = document.querySelector(".nav-content");

      if (window.scrollY > 50) {
        header.style.height = "7vh"; // Reduce header height
        linked.style.width = "30%"; // Scale down logo width
        navContent.style.height = "100%";
      } else {
        header.style.height = "11vh"; // Reset header height
        linked.style.width = "50%"; // Reset logo width
        navContent.style.height = "100%";
      }
    }
  });
document.addEventListener("DOMContentLoaded", function () {
    const header = document.getElementById("header");
    const smallLogo = document.querySelector(".small-logo");
    const bigLogo = document.querySelector(".big-logo");

    let lastScrollY = window.scrollY;

    function handleScroll() {
        const currentScrollY = window.scrollY;

        if (currentScrollY > lastScrollY) {
            // Scrolling down - Hide big logo, show small logo
            bigLogo.style.opacity = "0";
            smallLogo.style.opacity = "1";
        } else {
            // Scrolling up - Show big logo, hide small logo
            bigLogo.style.opacity = "1";
            smallLogo.style.opacity = "0";
        }

        lastScrollY = currentScrollY;
    }

    window.addEventListener("scroll", handleScroll);
});
[id="P0716828012"].page {   
    width: 100%;
    height: auto%;
    animation: fadeInAnimation ease 3s;
    animation-iteration-count: 1;
    animation-fill-mode: forwards;
        pointer-events: auto;

    
}
@keyframes fadeInAnimation {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}
.page-content{
    padding: 0;
}
.flex_container{
    display: block;
     height: auto;
}
/* General Header Styling */


.header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 11vh;
   position: sticky !important;
    top: 0;
    z-index: 10;
    transition: height 0.5s ease-in-out;
        background: linear-gradient(180deg, #FF7B42 0%, #F2A1FF 100%);    

}

.logo-container {
    height: 100%;
    flex: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: clip;
    transition: transform 0.5s ease-in-out;
}


.big-logo {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
    width: 100%;
}

/* Small logo (only visible when header sticks) */
.small-logo {
    opacity: 0;
    position: absolute;
    transform: translateY(20px); /* Start slightly below */
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
    width: 25% !important;
        filter: brightness(0) saturate(100%) invert(96%) sepia(24%) saturate(3664%) hue-rotate(6deg) brightness(107%) contrast(103%);

}



/* When header becomes sticky */
.header .scrolled .big-logo {
    opacity: 0 !important;
    transform: scale(1.1) translateY(-10px);
} 

.header .scrolled .small-logo {
    opacity: 1;
    transform: scale(1) translateY(0);
}
.background{
    position: absolute;
    z-index: 0;
    width: 100%;
}
.upper{
    z-index:1;
    width: auto;
    display: flex;
    flex-direction: column;
}
.big_logo{
    z-index: 1;
    margin-top: 2vw;
    width: 100%;
    justify-items: center;
}

.underlogo{
    display: flex;
    flex-direction: row;
        margin-top: 2vw;
    width: 100%;
    justify-content: space-between;
    z-index: 1;
    justify-items: center;
}
<div class="flex_container"><div class="flex_container">
<div class="body" style="margin-top: 0px;">
<div class="animate__animated animate__slideInUp row_1"><div class="upper">
  <div class="animate__animated animate__slideInUp big_logo"><media-item class="linked_1" disable-zoom="true" hash="A2055381632570752028865218862056" rel="history"></media-item></div>
  <div class="animate__animated animate__slideInUp underlogo">
    <h2><span class="h2_4">Private Studios,<br>7 days a week.</span></h2>
  <h2><span class="h2_4">Your dedicated space to<br>practice, create, and grow.</span></h2></div></div>
  <div class="animate__animated animate__slideInUp cta"><span class="button4">BOOK NOW</span></div>
  <div class="animate__animated animate__slideInUp background"><media-item class="globe-1" disable-zoom="true" hash="C2245897288951030710025741786088"></media-item>
  </div>
  </div><div class="header" id="header" style="height: 11vh;">
  <div class="logo-container">
        <!-- Default big logo -->
        <media-item class="small-logo" disable-zoom="true" hash="A2055381632570752028865218862056" href="main" rel="history"></media-item>

        <!-- Small sticky logo (Hidden initially) -->
        <media-item class="big-logo" disable-zoom="true" hash="L2249700064765940012273777892328" href="main" rel="history" width="100%"></media-item>
  </div><button class="animate__animated animate__slideInUp menu-toggle" onclick="toggleNavbar()">☰</button><div class="nav-content" id="nav-content" style="transform: scale(1); display: none; height: 100%;">
            <div class="animate__animated animate__slideInUp section section1"><a class="button button1" href="estrelar-u" rel="history">ESTRELAR U</a></div>
            <div class="animate__animated animate__slideInUp section section2"><a class="button button2" href="shop">SHOP</a></div>
            <div class="animate__animated animate__slideInUp section section3"><a class="button button3" href="faq">FAQs</a></div>
        </div></div></div>
        
  
        </div>