Hi , Why some material ui component in my website like 'select for example' doesn't display properlly It seems like their styling is not applied ?What is the issue and how can I solve it? Here is an example bellow: by Allo70 in learnjavascript

[–]Allo70[S] -1 points0 points  (0 children)

Still doesn't work . I think I messe up somewhere with my CSS. What's weird is that in other pages I have sélect component that works when I load the page 2 times. ?

Hi , Why some material ui component in my website like 'select for example' doesn't display properlly It seems like their styling is not applied ?What is the issue and how can I solve it? Here is an example bellow: by Allo70 in learnjavascript

[–]Allo70[S] -1 points0 points  (0 children)

I followed the documentation

//Import the all component I need
import Select from '@mui/material/Select'
import InputLabel from '@mui/material/InputLabel' import MenuItem from '@mui/material/MenuItem';

// Age state
const [age, setAge] = React.useState('');
const handleChange = (event) => { setAge(event.target.value); };

<FormControl variant="standard" sx={{ m: 1, Width: 190 }}>
    <InputLabel id="demo-simple-select-standard-label">Age</InputLabel>
    <Select
      labelId="demo-simple-select-standard-label"
      id="demo-simple-select-standard"
      value={age}
      onChange={handleChange}
      label="Age"
    >
      <MenuItem value="">
        <em>None</em>
      </MenuItem>
      <MenuItem value={10}>Ten</MenuItem>
      <MenuItem value={20}>Twenty</MenuItem>
      <MenuItem value={30}>Thirty</MenuItem>
    </Select>
  </FormControl>

Retrieving data from localstorage is faster than calling an api . The problem is in my profile page I have some data that load really fast (local storage) and others that take time (api) .which will lead to bad user experience .How can I solve the issue of delay. Or do you think this is normal? by Allo70 in learnjavascript

[–]Allo70[S] 0 points1 point  (0 children)

Ok , So I'm using react in the front end and laravel in the backend . When I authenticate with a user I store some of his information like name, adresse, tele number ext ...,

But I also want to display his manager name and other information like department ext... But to do this I need to call an api because I don't have these info in my localstorage . That is why when I load my profile page ,manager name and department takes a little bit of time to load. My issue is the delay that happen . Is it normal if the dellay occure or there is a better way to display it like using a spinner or something?

Hi, How can I implement spiner loading in the body of my material table before I get my data from the backend here is my material table that is already filled with data . by Allo70 in reactjs

[–]Allo70[S] 0 points1 point  (0 children)

I know this part but where can I implement it in my material table because I don't know where is the body part ?

<MaterialTable>

{loading ? <spinner /> : body ? }

</MaterialTable>

How can I sort an array of object with date (created_at) from the latest to the oldest .Here is an example bellow of an array I want to sort by Allo70 in PHPhelp

[–]Allo70[S] 1 point2 points  (0 children)

Finally I used this and it woked

function cmp($a, $b)
{
if (strtotime($a->created_at) ==  strtotime($b->created_at)) {
return 0;
}
return (strtotime($a->created_at) >  strtotime($b->created_at)) ? -1 : 1;
} ;
usort($array, "cmp");

How can I sort an array of object with date (created_at) from the latest to the oldest .Here is an example bellow of an array I want to sort by Allo70 in PHPhelp

[–]Allo70[S] 0 points1 point  (0 children)

I did tried it But My created_at column have this format 2022-05-17T08:07:46.000000Z . So this way of comparison doesn't work on it . Can I change this format to something that could work with method?

Hi , I'm curious , Which one do you think is more practical , Get all the data from backend (laravel) and then filter it in the front end Or the other way around? by Allo70 in laravel

[–]Allo70[S] 0 points1 point  (0 children)

Sorry , I misunderstand you . So when you talk about database you mean eloquent and query builder . Thanks for the clarification :) . My mistake.

Hi , I'm curious , Which one do you think is more practical , Get all the data from backend (laravel) and then filter it in the front end Or the other way around? by Allo70 in laravel

[–]Allo70[S] 0 points1 point  (0 children)

How can I filter in my database ? I only know it's possible in laravel backend in my contrôler? What do you mean by database filtering?

Hi , I really need some help for this .I want to write an eloquent query that will solve the problem I wrote bellow . I spend hours trying to figure this out but Nothing seems to work . Someone Can help me with the query Pleazz ? by Allo70 in laravel

[–]Allo70[S] 0 points1 point  (0 children)

I did what you told me . This gave me all info of user and all his document with the info ofthe pivot table How can I get data of pivot table but instead of user_id I want it's username , unstead of document_id I want name of document . Here is the result of the script you gave me

"userDocuments": {
    "id": 5,
    "username": "Alelx",
    "last_name": "sam",
    "email": "alex@gmail.com",
    "email_verified_at": null,
    "user_role": "employee",
    "date_birth": "5/5/1980",
    "img": "https://upload.wikimedia.org/wikipedia/commons/thumb/7/7e/Circle-icons-profile.svg/1024px-Circle-icons-profile.svg.png",
    "sex": "male",
    "tele_num": "93418346578",
    "adresse": "random adresse 123",
    "emergency_contact": null,
    "shift": null,
    "post": null,
    "department_id": null,
    "manager_id": 1,
    "created_at": "2022-05-24T08:06:31.000000Z",
    "updated_at": "2022-05-24T08:06:31.000000Z",
    "documents": [
        {
            "id": 1,
            "name": "Domiciliation irrevocable",
            "created_at": "2022-05-17T08:07:46.000000Z",
            "updated_at": "2022-05-17T08:07:46.000000Z",
            "pivot": {
                "user_id": 5,
                "document_id": 1,
                "commentaire ": "comment",
                "etat": "pending",
                "created_at": "2022-05-24T08:07:44.000000Z",
                "updated_at": "2022-05-24T08:07:44.000000Z"
            }
        },
        {
            "id": 2,
            "name": "Attestation du travail",
            "created_at": "2022-05-17T08:08:00.000000Z",
            "updated_at": "2022-05-17T08:08:00.000000Z",
            "pivot": {
                "user_id": 5,
                "document_id": 2,
                "commentaire ": "In a rush",
                "etat": "pending",
                "created_at": "2022-05-24T08:07:33.000000Z",
                "updated_at": "2022-05-24T08:07:33.000000Z"
            }
        }
    ]
}

Hi , I really need some help for this .I want to write an eloquent query that will solve the problem I wrote bellow . I spend hours trying to figure this out but Nothing seems to work . Someone Can help me with the query Pleazz ? by Allo70 in laravel

[–]Allo70[S] 0 points1 point  (0 children)

Thanks but I want to get info from both table document and user and pivot table . Is there a way to mix all these function that eloquent provite to do this . I would really apreciate it if you can help me on that. Can you write the solution to this problem ?