In foreach JSonResult return value ajax

Is it possible to return value in loop ?

i call Jsonresult to generate excel file. I create one page per person in my excel file.

For exemple i have 5 people. I want to dislpay

1/5
2/5
…

on my loading div.

foreach (Personnel o in pers19a)
            {
              count++
             //display count/5
            }
       

i use this ajax function:

function CallMe() {
    $.ajax({
        type: "POST",
        url: '@Url.Action("RHS", "Personnels")',
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (recData) {
            alert('Success');
            if (recData.fileName != "") {
    //use window.location.href for redirect to download action for download the file
                window.location.href = "@Url.RouteUrl(new { Controller = "Personnels", Action = "DownloadRHSSOL"})/?file=" + recData.fileName;
}},
        error: function () { alert('A error'); }
    });
}

Thanks in advance.

blocked by CORS policy with nginx docker

Hello I’m trying to fetch data from an API “restCountries”, and it’s blocked by the CORS policy. I don’t undersant why, I’ve tried to set headers in the index.php file with the header() function, but it has been a fail.

Im working with a docker-compose file “php, php-fpm, mysql, nginx”

My request :

 const getlistOfAllCountries = async () => {
//    const myHeaders = new Headers()
    const responseFromWorldApi = await fetch("https://restcountries.com/v3.1/all", {
        method: 'POST',
    
        headers : {
             'Access-Control-Allow-Origin' : '*',
            "Content-Type": "application/json"
        }
        
    }); 
    const listOfAllCountries = await responseFromWorldApi.json(); 

    
}

my default.conf file

server {
 server_name ~.*;


 
 location / {
  root /usr/src/app;
  try_files $uri /index.php$is_args$args;


 }



 location ~ ^/.+.php(/|$) {
  
  client_max_body_size 50m;
  fastcgi_pass php:9000;
  fastcgi_buffers 16 16k;
  fastcgi_buffer_size 32k;
  include fastcgi_params;
  fastcgi_param SCRIPT_FILENAME /usr/src/app/public$fastcgi_script_name;
     if ($request_method = 'OPTIONS') {
        add_header 'Access-Control-Allow-Origin' '*';
        #
        # Om nom nom cookies
        #
        add_header 'Access-Control-Allow-Credentials' 'true';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        #
        # Custom headers and headers various browsers *should* be OK with but aren't
        #
        add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
        #
        # Tell client that this pre-flight info is valid for 20 days
        #
        add_header 'Access-Control-Max-Age' 1728000;
        add_header 'Content-Type' 'text/plain charset=UTF-8';
        add_header 'Content-Length' 0;
        return 204;
     }
     if ($request_method = 'POST') {
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Credentials' 'true';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
     }

 }

 error_log /dev/stderr debug;
 access_log /dev/stdout;
}

Adding 00’s at the end of a number in Material UI Datagrid

I’m right now working on a React.js app which uses the DataGrid component from Material UI (MUI) library to show data. My problem is that I need to make full numbers to be displayed in full form with zeroes at the end, so for example 625 should display as 625.00, and 1,687.5 needs to be displayed as 1,687.50 and so on.

My current code:

import React, { useState } from "react";
import { DataGrid, enUS, GridColDef, GridRowId } from "@mui/x-data-grid";
import Grid from "@mui/material/Grid";
import Box from "@mui/material/Box";

import ContextMenu from "../../Components/Debtors/ContextMenu";
import MailerDialog from "../MassMailer/MailerDialog";
import SetupFollowUp from "../FollowUp/SetupFollowUpDialog";
import ClearFollowUp from "../FollowUp/ClearFollowUpDialog";
import OpenItems from "../../Pages/OpenItems";

const columns: GridColDef[] = [
  {
    field: "CustomerName",
    headerName: "Customer Name",
    width: 150,
    editable: false,
    align: "right",

  },
  {
    field: "CustomerNumber",
    headerName: "Customer Number",
    width: 150,
    editable: false,
    align: "right",

  },
  {
    field: "FollowUp",
    headerName: "Follow Up",
    type: "date",
    width: 150,
    editable: true,
    align: "right",

  },
  {
    field: "Overdue",
    headerName: "Overdue",
    width: 150,
    align: "right",
    type: 'number',

  },
  {
    field: "NotDue",
    headerName: "Not due",
    width: 150,
    align: "right",
    type: 'number',

  },
  {
    field: "Range1",
    headerName: "1-7",
    width: 150,
    align: "right",
    type: 'number',

  },
  {
    field: "Range2",
    headerName: "8-30",
    width: 150,
    align: "right",
    type: 'number',

  },
  {
    field: "Range3",
    headerName: "31-60",
    width: 150,
    align: "right",
    type: 'number',

  },
  {
    field: "Range4",
    headerName: "61-90",
    width: 150,
    align: "right",
    type: 'number',

  },
  {
    field: "Range5",
    headerName: "91-120",
    width: 150,
    align: "right",
    type: 'number',

  },
  {
    field: "Range6",
    headerName: "121-∞",
    width: 150,
    align: "right",
    type: 'number',

  },
  {
    field: "SourceDbName",
    headerName: "sourceDbName",
    width: 150,
    align: "right",

  },
  {
    field: "Free1",
    headerName: "Free1",
    width: 150,
    align: "right",

  },
  {
    field: "PersonResponsible",
    headerName: "Person Responsible",
    width: 150,
    align: "right",

  },
  {
    field: "SalesResponsible",
    headerName: "Sales Responsible",
    width: 150,
    align: "right",

  },
  {
    field: "PaymentTerms",
    headerName: "Payment Terms",
    width: 150,
    align: "right",

  },
];

export default function DataGridDemo(props) {
  const [currentRow, setCurrentRow] = useState<GridRowId>();
  const [currentSourceDbName, setCurrentSourceDbName] = useState<Number>();
  const [currentCustomerName, setCurrentCustomerName] = useState<string>();
  const [x, setX] = useState<number>(0);
  const [y, setY] = useState<number>(0);
  const [contextMenuVisible, setContextMenuVisible] = useState<Boolean>(false);
  const [openCustomerProfile, setOpenCustomerProfile] =
    useState<Boolean>(false);
  const [openMassMailerDialog, setOpenMassMailerDialog] =
    useState<Boolean>(false);
  const [selectedRows, setSelectedRows] = useState([]);
  const [selectedCustomerNumbers, setSselectedCustomerNumbers] = useState([]);
  const [openFollowUpDialog, setOpenFollowUpDialog] = useState<boolean>(false);
  const [openClearFollowUpDialog, setOpenClearFollowUpDialog] =
    useState<boolean>(false);

  function getSelectedRows(newSelection) {
    setSselectedCustomerNumbers(newSelection);
    let checkedRow = props.debtors.filter((item) =>
      newSelection.includes(item.CustomerNumber)
    );
    setSelectedRows(checkedRow);
  }

  return (
    <div>
      <ContextMenu
        x={x}
        y={y}
        id={currentRow}
        visible={contextMenuVisible}
        setContextMenuVisible={setContextMenuVisible}
        currentSourceDbName={currentSourceDbName}
        setOpenCustomerProfile={setOpenCustomerProfile}
        setOpenMassMailerDialog={setOpenMassMailerDialog}
        setOpenFollowUpDialog={setOpenFollowUpDialog}
        setOpenClearFollowUpDialog={setOpenClearFollowUpDialog}
      />
      <OpenItems
        id={currentRow}
        ageDate={props.ageDate}
        dbName={currentSourceDbName}
        openCustomerProfile={openCustomerProfile}
        setOpenCustomerProfile={setOpenCustomerProfile}
        getCustostomersReport={props.getCustostomersReport}
        currentCustomerName={currentCustomerName}
      />
      <SetupFollowUp
        openFollowUpDialog={openFollowUpDialog}
        setOpenFollowUpDialog={setOpenFollowUpDialog}
        sourceDbName={currentSourceDbName}
        custNumber={selectedCustomerNumbers}
        getCustostomersReport={props.getCustostomersReport}
      />
      <ClearFollowUp
        openClearFollowUpDialog={openClearFollowUpDialog}
        setOpenClearFollowUpDialog={setOpenClearFollowUpDialog}
        sourceDbName={currentSourceDbName}
        custNumber={selectedCustomerNumbers}
        getCustostomersReport={props.getCustostomersReport}
      />
      <MailerDialog
        ageDate={props.ageDate}
        selectedCoCodes={props.selectedCoCodes}
        open={openMassMailerDialog}
        setOpenMassMailerDialog={setOpenMassMailerDialog}
        selectedRows={selectedRows}
      />
      <Box px={3}>
        <Grid container>
          <Grid item xs={12} md={12}>
            <DataGrid
              onRowDoubleClick={(row, event) => {
                setCurrentSourceDbName(row.row.SourceDbName);
                setCurrentRow(row.id);
                setCurrentCustomerName(row.row.CustomerName);
                setX(event.clientX);
                setY(event.clientY);
                setContextMenuVisible(true);
              }}
              loading={props.loading}
              getRowId={(row) => row.CustomerNumber}
              rows={props.debtors}
              columns={columns}
              pageSize={30}
              rowsPerPageOptions={[100]}
              checkboxSelection
              disableSelectionOnClick
              autoHeight
              rowHeight={20}
              onSelectionModelChange={(newSelection) => {
                getSelectedRows(newSelection);
              }}
            />
          </Grid>
        </Grid>
      </Box>
    </div>
  );
}

With my current solution, it’s displaying like this:
With my current solution, it's displaying like this:

Does anyone knows how to do that?

How to increase security of “Login with Facebook” API for database?

We have a “Login with Facebook” button on a website and when a user logs in for the first time, we register them as a new user using their Facebook generated userID as the unique key.

“Login with Facebook” returns a userID and accessToken for the current user on the front end which we then pass to the backend.

The backend verifies the accessToken by calling the Facebook API at /me?access_token=xxx to see if the accessToken belongs to userID. Then we consider them logged in or register them as a new user.

Overall this does NOT seem secure.

Any foreign website that also uses “Login with Facebook” can take the accessToken from their users on their website and send it to our backend to log in as that them.

The accessToken does not encode the website that invoked the sign in, so I cannot even verify that it was generated from my website.

Is there any way to increase security for this?

Is it possible to work around CORS while trying to Authenticate on Forge?

We are building a WebGL application in Unity, and we want to use Forge’s Design Automation API in it. As most of the Design Automation API is using a Websocket API, it’s pretty straightforward. BUT, Authentication is being done with a HTTP request, which is of course blocked by CORS.. The JS code looks like this:

    Authentication: function () {
    var postData = {
        'client_id': 'the id',
        'client_secret': 'the secret',
        'grant_type': 'client_credentials',
        'scope': 'code:all'
    };

    $.ajax({
        url: 'https://developer.api.autodesk.com/authentication/v1/authenticate',
        type: 'POST',
        contentType: 'application/x-www-form-urlencoded',
        data: postData,
    }).done(function (data, textStatus, jqXHR) {
        console.log("worked", data, textStatus, jqXHR);
        console.log("data", data);
        console.log(jqXHR.responseJSON);
    }).fail(function (jqXHR, textStatus, errorThrown) {
        console.log("failed", jqXHR, textStatus, errorThrown);
        console.log(jqXHR.responseJSON);
    })
}

The documentation for reference: https://forge.autodesk.com/en/docs/oauth/v1/reference/http/authenticate-POST/

We are not sure how to bypass CORS in this situation and how to get the bearer token from Forge..

NextJS /pages/api routes are compiled at runtime

I have a NextJS app which has API routes inside of pages/api. Each route reads from a Singleton, which holds 1 instance of a Redis server connection (ioredis) – so I can reuse 1 connection and not connect multiple times.

I’ve noticed that when I use these routes, the Singleton is recreated once per route. I can see that NextJS is compiling these at runtime, which makes me think that a new instance of the Singleton is being created for each route – that’s causing multiple instances of the Redis connection:

event - compiled client and server successfully in 174 ms (1201 modules)
wait  - compiling /api/rtmtoken...
event - compiled client and server successfully in 106 ms (1202 modules)
wait  - compiling /api/users...
event - compiled client and server successfully in 113 ms (1203 modules)

How do I turn off the compiling at runtime here? Alternatively, is there a better practice for holding 1 instance of a connection to Redis or similar?

Thanks!

Display table (affichage résultats de recherches)

Hello I have a search field and I would like to have the search results of the first API and the second but only the results of the second are displayed.
normally I must have the municipalities and the intermunicipalities
enter image description here

voici le code ci dessous:

document.querySelector(‘#cp’).addEventListener(‘input’, function () {
let affichage = ”;
if (this.value.length > 0) {

let url = `https://eu-api.backendless.com/9E7A148A-BDD2-F600-FF8F-C6A7A2887400/B524C86C-5464-44D5-9508-370B6DD1D993/data/communes?where=nom%20LIKE%20'%25${this.value}%25'`;
fetch(url)
  .then((response) =>
    response.json().then((data1) => {
      for (let ville of data1) {
        console.log(ville.NOM.toString().toLowerCase());
        console.log(this.value.toString().toLowerCase());
          let coordonees=ville.geometry.coordinates;
          let polygon = turf.multiPolygon(coordonees);
          let pointOnPolygon = turf.pointOnFeature(polygon);
          //var area = turf.area(polygon);  
          let center = pointOnPolygon.geometry;
          //alert(center);
          //localStorage.setItem("coord",JSON.stringify(coordonees));
          let Tableau={
                          "type": "FeatureCollection",
                          "center":center,
                          "features": [
                          {                                                     
                                "type": "Feature",
                                "properties": {
                                    "name": ville.NOM
                                },
                                "geometry": {
                                    "type": "Polygon",
                                    "coordinates": coordonees[0]
                                }
                                }
                          ]
                        }
                      
              Tableau=JSON.stringify(Tableau);
              //alert(coordonees[0]);
              console.log();
      affichage +=  `<tr>`; 
      affichage +=  `<td class="donnees" style="display:none;">${Tableau}</td>`; 
      affichage +=  `<td class="list-group-item" data-id="1"><a  data-nom="${ville.NOM}" class="a"  href="map.php?cp=${ville.NOM}"><strong>${ville.NOM}</a></td>`; 
      affichage +=  `<td class="list-group-item" data-id="1"><a  data-nom="${ville.NOM}" class="a"  href="map.php?cp=${ville.NOM}"><strong>${ville.NOM}</a></td>`;
      affichage +=  `<td class="list-group-item" data-id="1"><a  data-nom="${ville.NOM}" class="a"  href="map.php?cp=${ville.NOM}"><strong>Communes</a></td>`;
            
     affichage +=  `</tr>`; 
}
    affichage += '</table>';
    document.querySelector('#villes').innerHTML = affichage;
  })
)
.catch((err) => console.log('Erreur : ' + err));

}

});

document.querySelector(‘#cp’).addEventListener(‘input’, function () {
let affichage = ”;
if (this.value.length > 0) {

let url = `https://eu-api.backendless.com/9E7A148A-BDD2-F600-FF8F-C6A7A2887400/B524C86C-5464-44D5-9508-370B6DD1D993/data/epci?where=nom%20LIKE%20'%25${this.value}%25'`;
fetch(url)
  .then((response) =>
    response.json().then((data2) => {
      for (let ville of data2) {
        console.log(ville.NOM.toString().toLowerCase());
        console.log(this.value.toString().toLowerCase());
          let coordonees=ville.geometry.coordinates;
          let polygon = turf.multiPolygon(coordonees);
          let pointOnPolygon = turf.pointOnFeature(polygon);
          //var area = turf.area(polygon);  
          let center = pointOnPolygon.geometry;
          //alert(center);
          //localStorage.setItem("coord",JSON.stringify(coordonees));
          let Tableau={
                          "type": "FeatureCollection",
                          "center":center,
                          "features": [
                          {                                                     
                                "type": "Feature",
                                "properties": {
                                    "name": ville.NOM
                                },
                                "geometry": {
                                    "type": "Polygon",
                                    "coordinates": coordonees[0]
                                }
                                }
                          ]
                        }
                      
              Tableau=JSON.stringify(Tableau);
              //alert(coordonees[0]);
              console.log();
      affichage +=  `<tr>`; 
      affichage +=  `<td class="donnees" style="display:none;">${Tableau}</td>`; 
      affichage +=  `<td class="list-group-item" data-id="1"><a  data-nom="${ville.NOM}" class="a"  href="map.php?cp=${ville.NOM}"><strong>${ville.NOM}</a></td>`; 
      affichage +=  `<td class="list-group-item" data-id="1"><a  data-nom="${ville.NOM}" class="a"  href="map.php?cp=${ville.NOM}"><strong>${ville.NOM}</a></td>`;
      affichage +=  `<td class="list-group-item" data-id="1"><a  data-nom="${ville.NOM}" class="a"  href="map.php?cp=${ville.NOM}"><strong>Intercomunalité</a></td>`;
            
     affichage +=  `</tr>`; 
}
    affichage += '</table>';
    document.querySelector('#villes').innerHTML = affichage;
  })
)
.catch((err) => console.log('Erreur : ' + err));

}

});

autocomplete for input field in quasar V2

How do I implement autocomplete (content proposal) functionality for a text-field in quasar? Basically typing in the text-field and after a 2 characters propose according content from a webservice.

There seems to be a component in older versions, but I can’t find reference in the current documentation:
https://v0-17.quasar-framework.org/components/autocomplete.html

Also there is autocomplete handling for q-select but nothing for q-input:
https://quasar.dev/vue-components/select#native-attributes-with-use-input

Using:

  • Vue 3.0.0
  • Quasar 2.6.0

Disable incrementation of input type number

I got bunch of number typed inputs. I want to disable incrementation if the sum of all inputs reaches certain amount of number, lets say max_limit with jquery or javascript.

max_limit changes according to user input so it is not a fixed number and I have more than one inputs, incrementation should stop if sum of all input values reaches max.

I couldnt figure out how to do it.

jQuery("input[type=number]").click(function(e) {

if (jQuery(this).val() == mult_final) {
e.preventDefault();
} else {

} });

Not only this doesnt work, this idea only checks one input and disables one input..

Execute Javascript in selenium and return value

I am using javascript for selenium selenium-webdriver.

My code is:

 return_value = driver.execute_script(script)

But I don’t know, how to return value from my script.

const token = await grecaptcha.enterprise.execute('myKey',{})
return token

Illegal return statement

Thank you for any help.

React Native Search by 2 Dictionary Values

I have some JSON (see end) that contains two values. I need the search to filter based on either value. I documented every part of the search/display of code

Here is my useState variables:

const [dataBackup, setdataBackup] = useState([]) const [dataSource, setdataSource] = useState([])

Here is my FlatList:

 <SectionList
      contentContainerStyle={{ paddingHorizontal: 10}}
      stickySectionHeadersEnabled={false}
      sections={dataSource}
      keyExtractor={(item, index) => {
        return  index.toString();
       }}
      renderSectionHeader={({ section }) => (
        <>
          <Text style={styles.sectionHeader}>{section.title}</Text>
          {section.data ? (
            <OptimizedFlatList
              horizontal
              data={section.data} 
              keyExtractor={(item, index) => {
                return  index.toString();
               }}
              renderItem={({ item }) => <ListItem item={item} navigation={navigation} />}
              showsHorizontalScrollIndicator={false}
            />
          ) : null}
        </>
      )}
      renderItem={({ item, section, navigation }) => {
        if (section.data) {
          return null;
        }
        return <ListItem item={item} navigation={navigation}/>;
      }}
    />

Here is the NOT WORKING filtering logic:

    filterList = (text) => {
  for (let i = 0; i < dataBackup.length; i++) {
    const t = dataBackup[i];
    newData = t["data"].filter((item) => {
      const itemData = item["name"].toLowerCase();
      const textData = text.toLowerCase();
      setdataSource(itemData.indexOf(textData) > -1)
    });

  }

}

Here is what the data looks like:

    {
  "data": [
    {
      "bodyPart": "back",
      "broad_target": "back",
      "equipment": "cable",
      "gifUrl": "http://d205bpvrqc9yn1.cloudfront.net/0007.gif",
      "id": 1,
      "name": "alternate lateral pulldown",
      "ppl": "pull",
      "target": "lats",
      "thumbnail": "https://images.unsplash.com/photo-1640334554717-a7a4ce5d0045?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=296&q=20"
    },
    {
      "bodyPart": "back",
      "broad_target": "back",
      "equipment": "leverage machine",
      "gifUrl": "http://d205bpvrqc9yn1.cloudfront.net/0015.gif",
      "id": 6,
      "name": "assisted parallel close grip pull-up",
      "ppl": "pull",
      "target": "lats",
      "thumbnail": "https://images.unsplash.com/photo-1434596922112-19c563067271?ixid=MnwzMDc4NzN8MHwxfHNlYXJjaHwxfHxsZXZlcmFnZSUyMG1hY2hpbmUlMjB3b3Jrb3V0fGVufDB8fHx8MTY0NjYxODM1Nw&ixlib=rb-1.2.1&auto=format&fit=crop&w=296&q=20"
    },
    {
      "bodyPart": "back",
      "broad_target": "back",
      "equipment": "leverage machine",
      "gifUrl": "http://d205bpvrqc9yn1.cloudfront.net/0017.gif",
      "id": 9,
      "name": "assisted pull-up",
      "ppl": "pull",
      "target": "lats",
      "thumbnail": "https://images.unsplash.com/photo-1434596922112-19c563067271?ixid=MnwzMDc4NzN8MHwxfHNlYXJjaHwxfHxsZXZlcmFnZSUyMG1hY2hpbmUlMjB3b3Jrb3V0fGVufDB8fHx8MTY0NjYxODM1Nw&ixlib=rb-1.2.1&auto=format&fit=crop&w=296&q=20"
    },
    {
      "bodyPart": "back",
      "broad_target": "back",
      "equipment": "leverage machine",
      "gifUrl": "http://d205bpvrqc9yn1.cloudfront.net/1431.gif",
      "id": 12,
      "name": "assisted standing chin-up",
      "ppl": "pull",
      "target": "lats",
      "thumbnail": "https://images.unsplash.com/photo-1434596922112-19c563067271?ixid=MnwzMDc4NzN8MHwxfHNlYXJjaHwxfHxsZXZlcmFnZSUyMG1hY2hpbmUlMjB3b3Jrb3V0fGVufDB8fHx8MTY0NjYxODM1Nw&ixlib=rb-1.2.1&auto=format&fit=crop&w=296&q=20"
    }
  ]
}

I want it to filter by Title OR by name

Getting Value from a nested array in JavaScript [duplicate]

I’m trying to get a value from a nested array of objects in JavaScript.

report[i].rows[1].rows.[lenght - 1].cells[lenght - 2].value

I want this to return value from this below path.

report[i].rows[1].rows.[5].cells[4].value

But each report has different index for rows and cells. So

report[i].rows[1].rows.[last item].cells[second last item].value

I appreciate your responses. Thank you

Can we store smtp.js token in clear text in our code?

I am creating my portfolio (in html, css and js) which has a “contact” page with a form.
I would have liked it to be possible, from this form, to send me an email. So I did some research and I found an api that seems to do what I want: Smtp.js.
This api asks us to create a token in order not to enter the login and the password of our mailbox.
My question is: can we store this token in clear text in our code without risk and if not what to do?

PHP Week Days Secific Language

I’m Trying to make Conditional Delivery Notice based on Time and Date in Woocommerce
and want to display week days specific language.

   //Next Day Delivery Calculator
    add_action( 'woocommerce_before_checkout_form', 'next_day_delivery' );
    add_action( 'woocommerce_before_cart', 'next_day_delivery' );
    
    function next_day_delivery() {
        if( WC()->cart->is_empty() )
            return; // Exit
    
        // Set the time zone
        date_default_timezone_set('Asia/Tbilisi');
        
    
        // From Monday to Friday
        $is_week_days  = in_array( date('w'), array( 1, 2, 3, 4, 5 ) ) ? true : false;
        $end_time      = mktime('14', '00', '00', date('m'), date('d'), date('Y'));
        $now_time      = time();
        $after_tomorow = date('l', strtotime('+2 days'));
    
        $dateDiff      = intval(($end_time - $now_time)/60);
        $diff_hours    = intval($dateDiff/60);
        $diff_minutes  = $dateDiff%60;
        $hours_label   = _n( 'საათი', 'საათი', $diff_hours, 'wooocommerce' );
        $minutes_label = _n( 'წუთი', 'წუთი', $diff_minutes, 'wooocommerce' );
    
        
    
        if ( $end_time > $now_time && $is_week_days ) {
            
            // print text 
            $message = sprintf( __( '%s დარჩა შეკვეთის გასაფორმებლად თუ გსურთ ჩაგბარდეთ ხვალ!', 'woocommerce' ),
            $diff_hours.' '.$hours_label.' და '.$diff_minutes.' '.$minutes_label);
        }
        elseif ( $end_time <= $now_time && $is_week_days ) {
            
            $message = sprintf( __( 'თქვენ მიიღებთ შეკვეთას %s.', 'woocommerce' ), $after_tomorow );
        } else {
            $message = __( 'თქვენი შეკვეთა ფორმირდება ორშაბათს და ჩაგბარდებათ სამშაბათს.', 'woocommerce' );
        }
        wc_print_notice( $message, 'success' );
    }

also want to make conditional checkbox based shipping class. (if shipping class is express its same day delivery must hide notice about shipping date)

//Hide Delivery Message Express Shipping Checked

    add_action( 'woocommerce_after_checkout_form', 'show_notice_billing' );
    function show_notice_billing(){
        ?>
            <script>
            jQuery(function($){
               $(document).ready(function() {
        $(document).on("click", "#shipping_method_0_flat_rate-12", function(e) {
           var checked = $(this).find("input:checkbox").is(":checked");
           if (checked) {
               $('.woocommerce-message').hide(300);
           } else {
               $('.woocommerce-message').show(300);
           }
        });
    });
            });
        </script>
        <?php
    }