mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 01:01:22 +00:00
chore(esx_identity): Upload New UI fully
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
@@ -23,12 +23,11 @@ client_scripts {
|
||||
'client/main.lua'
|
||||
}
|
||||
|
||||
ui_page 'html/index.html'
|
||||
files ({
|
||||
'dist/assets/**',
|
||||
'dist/**',
|
||||
})
|
||||
|
||||
files {
|
||||
'html/index.html',
|
||||
'html/js/script.js',
|
||||
'html/css/style.css',
|
||||
}
|
||||
ui_page 'dist/index.html'
|
||||
|
||||
dependency 'es_extended'
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous" />
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css"
|
||||
integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg=="
|
||||
crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||
<link href="css/style.css" rel="stylesheet" />
|
||||
|
||||
<title>ESX Identity</title>
|
||||
</head>
|
||||
|
||||
<body class="none" onkeydown="TriggeredKey(this)">
|
||||
<div class="dialog">
|
||||
<div class="dialog__header">
|
||||
<h1>CHARACTER <span>IDENTITY</span></h1>
|
||||
</div>
|
||||
<div class="dialog__body">
|
||||
<p class="dialog__body-hint">Start by creating your identity</p>
|
||||
<form class="dialog__body-form" id="register" action="#">
|
||||
<div class="dialog__form-group">
|
||||
<label for="firstname">Firstname</label>
|
||||
<div class="dialog__form-validation">
|
||||
<input id="firstname" type="text" placeholder="Firstname" />
|
||||
<!-- <i class="fas fa-check-circle" style="color: #478444;"></i> -->
|
||||
</div>
|
||||
<div class="dialog__form-message dialog__form-message--error"></div>
|
||||
</div>
|
||||
<div class="dialog__form-group">
|
||||
<label for="lastname">Lastname</label>
|
||||
<div class="dialog__form-validation">
|
||||
<input id="lastname" type="text" placeholder="Lastname" />
|
||||
<!-- <i class="fas fa-times-circle" style="color: #733838;"></i> -->
|
||||
</div>
|
||||
<div class="dialog__form-message dialog__form-message--error"></div>
|
||||
</div>
|
||||
<div class="dialog__form-group">
|
||||
<label for="dob">Date of birth</label>
|
||||
<input id="dob" type="text" placeholder="dd/mm/yy" />
|
||||
<div class="dialog__form-message dialog__form-message--error"></div>
|
||||
</div>
|
||||
<div class="dialog__form-group">
|
||||
<label for="gender">Gender</label>
|
||||
<div class="dialog__form-group dialog__form-group--radio">
|
||||
<div class="dialog__form-radio">
|
||||
<input type="radio" id="male" value="m" name="gender">
|
||||
<label for="male">
|
||||
<i class="fas fa-mars"></i>
|
||||
Male
|
||||
</label>
|
||||
</div>
|
||||
<div class="dialog__form-radio">
|
||||
<input type="radio" id="female" value="f" name="gender">
|
||||
<label for="female">
|
||||
<i class="fas fa-venus"></i>Female
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dialog__form-message dialog__form-message--error"></div>
|
||||
</div>
|
||||
<div class="dialog__form-group">
|
||||
<label for="height">Height</label>
|
||||
<input id="height" type="text" placeholder="175" />
|
||||
<div class="dialog__form-message dialog__form-message--error"></div>
|
||||
</div>
|
||||
<button class="dialog__form-submit" id="submit" type="submit">
|
||||
<i class="fas fa-user-plus"></i>CREATE
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function TriggeredKey(e) {
|
||||
var keycode;
|
||||
if (window.event) keycode = window.event.keyCode;
|
||||
if (window.event.keyCode === 13 || window.event.keyCode === 27) return false;
|
||||
}
|
||||
</script>
|
||||
<script src="js/script.js" defer></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,49 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous" />
|
||||
<link href="css/style.css" rel="stylesheet" />
|
||||
|
||||
<title>ESX Identity</title>
|
||||
</head>
|
||||
|
||||
<body class="none" onkeydown="TriggeredKey(this)">
|
||||
<div class="dialog">
|
||||
<div class="title"><b>IDENTITY</b></div>
|
||||
<form id="register" name="register" action="#">
|
||||
<div style="color: rgb(46, 187, 205); font-size: 12px; font-family: 'Gill Sans', sans-serif">First Name</div>
|
||||
<input id="firstname" type="text" class="" name="firstname" placeholder="First Name" minlength="3" maxlength="8" pattern="[a-zA-Z]*" /><br />
|
||||
<div style="color: rgb(46, 187, 205); font-size: 12px; font-family: 'Gill Sans', sans-serif">Last Name</div>
|
||||
<input id="lastname" type="text" class="" name="lastname" placeholder="Last Name" minlength="3" maxlength="10" pattern="[a-zA-Z]*" /><br />
|
||||
<div style="color: rgb(46, 187, 205); font-size: 12px; font-family: 'Gill Sans', sans-serif">Date of Birth (MM/DD/YYYY)</div>
|
||||
<input id="dateofbirth" type="date" name="dateofbirth" class="" min="1900-01-01" max="2010-01-01" onfocus="(this.type='date')" /><br />
|
||||
<div style="color: rgb(46, 187, 205); font-size: 12px; font-family: 'Gill Sans', sans-serif">Height</div>
|
||||
<input id="height" type="number" class="" name="height" min="120" max="220" placeholder="Height (cm)" /><br />
|
||||
<center>
|
||||
<div class="radio-toolbar">
|
||||
<input type="radio" id="radiom" name="sex" value="m" checked />
|
||||
<label for="radiom">Male</label>
|
||||
|
||||
<input type="radio" id="radiof" name="sex" value="f" />
|
||||
<label for="radiof">Female</label>
|
||||
</div>
|
||||
</center>
|
||||
<button id="submit" type="submit">
|
||||
<font size="4px">CREATE</font>
|
||||
</button>
|
||||
</form>
|
||||
<center>
|
||||
<font size="1px" color="green">If the submit button doesn't work, please ensure that you've entered the fields correctly.</font>
|
||||
</center>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function TriggeredKey(e) {
|
||||
var keycode;
|
||||
if (window.event) keycode = window.event.keyCode;
|
||||
if (window.event.keyCode === 13 || window.event.keyCode === 27) return false;
|
||||
}
|
||||
</script>
|
||||
<script src="js/script.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,43 +0,0 @@
|
||||
let devMode = false
|
||||
|
||||
window.addEventListener("message", (event) => {
|
||||
if (devMode) {
|
||||
document.body.classList.remove('none')
|
||||
}
|
||||
if (event.data.type === "enableui") {
|
||||
document.body.classList[event.data.enable ? "remove" : "add"]("none");
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelector("#register").addEventListener("submit", (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
const dofVal = document.querySelector("#dob").value;
|
||||
if (!dofVal) return;
|
||||
|
||||
const formattedDate = dofVal;
|
||||
|
||||
if (!devMode) {
|
||||
fetch("http://esx_identity/register", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
firstname: document.querySelector("#firstname").value,
|
||||
lastname: document.querySelector("#lastname").value,
|
||||
dateofbirth: formattedDate,
|
||||
sex: document.querySelector("input[type='radio'][name='gender']:checked").value,
|
||||
height: document.querySelector("#height").value,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
document.querySelector("#register").reset();
|
||||
});
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
if (!devMode) {
|
||||
fetch("http://esx_identity/ready", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({}),
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -1,48 +0,0 @@
|
||||
let devMode = true
|
||||
|
||||
window.addEventListener("message", (event) => {
|
||||
if (devMode) {
|
||||
document.body.classList.remove('none')
|
||||
}
|
||||
if (event.data.type === "enableui") {
|
||||
document.body.classList[event.data.enable ? "remove" : "add"]("none");
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelector("#register").addEventListener("submit", (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
const dofVal = document.querySelector("#dateofbirth").value;
|
||||
if (!dofVal) return;
|
||||
|
||||
const dateCheck = new Date(dofVal);
|
||||
|
||||
const year = new Intl.DateTimeFormat("en", { year: "numeric" }).format(dateCheck);
|
||||
const month = new Intl.DateTimeFormat("en", { month: "2-digit" }).format(dateCheck);
|
||||
const day = new Intl.DateTimeFormat("en", { day: "2-digit" }).format(dateCheck);
|
||||
|
||||
const formattedDate = `${day}/${month}/${year}`;
|
||||
if (!devMode) {
|
||||
fetch("http://esx_identity/register", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
firstname: document.querySelector("#firstname").value,
|
||||
lastname: document.querySelector("#lastname").value,
|
||||
dateofbirth: formattedDate,
|
||||
sex: document.querySelector("input[type='radio'][name='sex']:checked").value,
|
||||
height: document.querySelector("#height").value,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
document.querySelector("#register").reset();
|
||||
});
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
if (!devMode) {
|
||||
fetch("http://esx_identity/ready", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({}),
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite + Vue</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous" />
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css"
|
||||
integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg=="
|
||||
crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||
</head>
|
||||
|
||||
<body class="none">
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Generated
+1186
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "esx_identity_new",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"moment": "^2.30.1",
|
||||
"vee-validate": "^4.14.3",
|
||||
"vue": "^3.5.10",
|
||||
"yup": "^1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^5.1.4",
|
||||
"vite": "^5.4.8"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 943 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -126,7 +126,129 @@ local function formatName(name)
|
||||
return convertFirstLetterToUpper(loweredName)
|
||||
end
|
||||
|
||||
local function setIdentity(xPlayer)
|
||||
if Config.UseDeferrals then
|
||||
AddEventHandler("playerConnecting", function(_, _, deferrals)
|
||||
deferrals.defer()
|
||||
local _, identifier = source, ESX.GetIdentifier(source)
|
||||
Wait(100)
|
||||
|
||||
if identifier then
|
||||
MySQL.single("SELECT firstname, lastname, dateofbirth, sex, height FROM users WHERE identifier = ?", { identifier }, function(result)
|
||||
if result then
|
||||
if result.firstname then
|
||||
playerIdentity[identifier] = {
|
||||
firstName = result.firstname,
|
||||
lastName = result.lastname,
|
||||
dateOfBirth = result.dateofbirth,
|
||||
sex = result.sex,
|
||||
height = result.height,
|
||||
}
|
||||
|
||||
deferrals.done()
|
||||
else
|
||||
deferrals.presentCard(
|
||||
[==[{"type": "AdaptiveCard","body":[{"type":"Container","items":[{"type":"ColumnSet",
|
||||
"columns":[{"type":"Column","items":[{"type":"Input.Text","placeholder":"First Name",
|
||||
"id":"firstname","maxLength":15},{"type":"Input.Text","placeholder":"Date of Birth (MM/DD/YYYY)",
|
||||
"id":"dateofbirth","maxLength":10}],"width":"stretch"},{"type":"Column","width":"stretch",
|
||||
"items":[{"type":"Input.Text","placeholder":"Last Name","id":"lastname","maxLength":15},
|
||||
{"type":"Input.Text","placeholder":"Height (48-96 inches)","id":"height","maxLength":2}]}]},
|
||||
{"type":"Input.ChoiceSet","placeholder":"Sex","choices":[{"title":"Male","value":"m"},
|
||||
{"title":"Female","value":"f"}],"style":"expanded","id":"sex"}]},{"type": "ActionSet",
|
||||
"actions": [{"type":"Action.Submit","title":"Submit"}]}],
|
||||
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json","version":"1.0"}]==],
|
||||
function(data)
|
||||
if data.firstname == "" or data.lastname == "" or data.dateofbirth == "" or data.sex == "" or data.height == "" then
|
||||
deferrals.done(TranslateCap("data_incorrect"))
|
||||
else
|
||||
if checkNameFormat(data.firstname) and checkNameFormat(data.lastname) and checkDOBFormat(data.dateofbirth) and checkSexFormat(data.sex) and checkHeightFormat(data.height) then
|
||||
playerIdentity[identifier] = {
|
||||
firstName = formatName(data.firstname),
|
||||
lastName = formatName(data.lastname),
|
||||
dateOfBirth = data.dateofbirth,
|
||||
sex = data.sex,
|
||||
height = tonumber(data.height),
|
||||
saveToDatabase = true,
|
||||
}
|
||||
|
||||
deferrals.done()
|
||||
else
|
||||
deferrals.done(TranslateCap("invalid_format"))
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
else
|
||||
deferrals.presentCard(
|
||||
[==[{"type": "AdaptiveCard","body":[{"type":"Container","items":[{"type":"ColumnSet","columns":[{
|
||||
"type":"Column","items":[{"type":"Input.Text","placeholder":"First Name","id":"firstname",
|
||||
"maxLength":15},{"type":"Input.Text","placeholder":"Date of Birth (MM/DD/YYYY)","id":"dateofbirth",
|
||||
"maxLength":10}],"width":"stretch"},{"type":"Column","width":"stretch","items":[{"type":"Input.Text",
|
||||
"placeholder":"Last Name","id":"lastname","maxLength":15},{"type":"Input.Text",
|
||||
"placeholder":"Height (48-96 inches)","id":"height","maxLength":2}]}]},{"type":"Input.ChoiceSet",
|
||||
"placeholder":"Sex","choices":[{"title":"Male","value":"m"},{"title":"Female","value":"f"}],
|
||||
"style":"expanded","id":"sex"}]},{"type": "ActionSet","actions": [{"type":"Action.Submit",
|
||||
"title":"Submit"}]}],"$schema": "http://adaptivecards.io/schemas/adaptive-card.json","version":"1.0"}]==],
|
||||
function(data)
|
||||
if data.firstname == "" or data.lastname == "" or data.dateofbirth == "" or data.sex == "" or data.height == "" then
|
||||
return deferrals.done(TranslateCap("data_incorrect"))
|
||||
end
|
||||
if not checkNameFormat(data.firstname) then
|
||||
return deferrals.done(TranslateCap("invalid_firstname_format"))
|
||||
end
|
||||
if not checkNameFormat(data.lastname) then
|
||||
return deferrals.done(TranslateCap("invalid_lastname_format"))
|
||||
end
|
||||
if not checkDOBFormat(data.dateofbirth) then
|
||||
return deferrals.done(TranslateCap("invalid_dob_format"))
|
||||
end
|
||||
if not checkSexFormat(data.sex) then
|
||||
return deferrals.done(TranslateCap("invalid_sex_format"))
|
||||
end
|
||||
if not checkHeightFormat(data.height) then
|
||||
return deferrals.done(TranslateCap("invalid_height_format"))
|
||||
end
|
||||
|
||||
playerIdentity[identifier] = {
|
||||
firstName = formatName(data.firstname),
|
||||
lastName = formatName(data.lastname),
|
||||
dateOfBirth = formatDate(data.dateofbirth),
|
||||
sex = data.sex,
|
||||
height = tonumber(data.height),
|
||||
saveToDatabase = true,
|
||||
}
|
||||
|
||||
deferrals.done()
|
||||
end
|
||||
)
|
||||
end
|
||||
end)
|
||||
else
|
||||
deferrals.done(TranslateCap("no_identifier"))
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent("esx:playerLoaded")
|
||||
AddEventHandler("esx:playerLoaded", function(_, xPlayer)
|
||||
if not playerIdentity[xPlayer.identifier] then
|
||||
return xPlayer.kick(_("missing_identity"))
|
||||
end
|
||||
|
||||
local currentIdentity = playerIdentity[xPlayer.identifier]
|
||||
SetPlayerData(xPlayer, currentIdentity)
|
||||
|
||||
if currentIdentity.saveToDatabase then
|
||||
saveIdentityToDatabase(xPlayer.identifier, currentIdentity)
|
||||
end
|
||||
|
||||
Wait(0)
|
||||
alreadyRegistered[xPlayer.identifier] = true
|
||||
TriggerClientEvent("esx_identity:alreadyRegistered", xPlayer.source)
|
||||
playerIdentity[xPlayer.identifier] = nil
|
||||
end)
|
||||
else
|
||||
local function setIdentity(xPlayer)
|
||||
if not alreadyRegistered[xPlayer.identifier] then
|
||||
return
|
||||
end
|
||||
@@ -139,7 +261,7 @@ local function setIdentity(xPlayer)
|
||||
end
|
||||
|
||||
playerIdentity[xPlayer.identifier] = nil
|
||||
end
|
||||
end
|
||||
|
||||
local function checkIdentity(xPlayer)
|
||||
MySQL.single("SELECT firstname, lastname, dateofbirth, sex, height FROM users WHERE identifier = ?", { xPlayer.identifier }, function(result)
|
||||
@@ -312,6 +434,7 @@ end
|
||||
TriggerClientEvent("esx_identity:setPlayerData", source, Identity)
|
||||
cb(true)
|
||||
end)
|
||||
end
|
||||
|
||||
if Config.EnableCommands then
|
||||
ESX.RegisterCommand("char", "user", function(xPlayer)
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<script setup>
|
||||
import { onMounted } from 'vue';
|
||||
import HelloWorld from './components/HelloWorld.vue'
|
||||
|
||||
onMounted(() => {
|
||||
fetch("http://esx_identity/ready", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({}),
|
||||
});
|
||||
|
||||
window.addEventListener("message", (event) => {
|
||||
if (event.data.type === "enableui") {
|
||||
document.body.classList[event.data.enable ? "remove" : "add"]("none");
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<HelloWorld/>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 496 B |
@@ -0,0 +1,94 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { Form, Field, ErrorMessage } from 'vee-validate';
|
||||
import * as yup from 'yup'
|
||||
import moment from 'moment'
|
||||
|
||||
const onSubmit = (values) => {
|
||||
fetch("http://esx_identity/register", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
firstname: values.firstname,
|
||||
lastname: values.lastname,
|
||||
dateofbirth: values.dob,
|
||||
sex: values.gender,
|
||||
height: values.height,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
const schema = yup.object({
|
||||
firstname: yup.string().required('Firstname is required').min(3, 'Firstname must be at least 3 characters'),
|
||||
lastname: yup.string().required('Lastname is required').min(3, 'Lastname must be at least 3 characters'),
|
||||
dob: yup.date().required('Date of Birth is required').transform((value, originalValue) => {
|
||||
const parsedDate = moment(originalValue, 'DD/MM/YYYY', true);
|
||||
return parsedDate.isValid() ? parsedDate.toDate() : new Date('');
|
||||
}).typeError('Date must be in mm/dd/yyyy format'),
|
||||
gender: yup.string().required('Gender is required'),
|
||||
height: yup.number().required('Height is required').min(120, 'Minimum height is 120cm').max(220, 'Maximum height is 220cm').typeError('Amount must be a number'),
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="dialog">
|
||||
<div class="dialog__header">
|
||||
<h1>CHARACTER <span>IDENTITY</span></h1>
|
||||
</div>
|
||||
<div class="dialog__body">
|
||||
<p class="dialog__body-hint">Start by creating your identity</p>
|
||||
<Form class="dialog__body-form" id="register" action="#" novalidate @submit="onSubmit" :validation-schema="schema">
|
||||
<div class="dialog__form-group">
|
||||
<label for="firstname">Firstname</label>
|
||||
<div class="dialog__form-validation">
|
||||
<Field id="firstname" type="text" name="firstname" placeholder="Firstname" validateOnInput />
|
||||
<!-- <i class="fas fa-check-circle" style="color: #478444;"></i> -->
|
||||
</div>
|
||||
<ErrorMessage name="firstname" class="dialog__form-message dialog__form-message--error" />
|
||||
</div>
|
||||
<div class="dialog__form-group">
|
||||
<label for="lastname">Lastname</label>
|
||||
<div class="dialog__form-validation">
|
||||
<Field id="lastname" type="text" name="lastname" placeholder="Lastname" validateOnInput />
|
||||
<!-- <i class="fas fa-times-circle" style="color: #733838;"></i> -->
|
||||
</div>
|
||||
<ErrorMessage name="lastname" class="dialog__form-message dialog__form-message--error" />
|
||||
</div>
|
||||
<div class="dialog__form-group">
|
||||
<label for="dob">Date of birth</label>
|
||||
<Field id="dob" type="text" name="dob" placeholder="mm/dd/yyyy" validateOnInput />
|
||||
<ErrorMessage name="dob" class="dialog__form-message dialog__form-message--error" />
|
||||
</div>
|
||||
<div class="dialog__form-group">
|
||||
<label for="gender">Gender</label>
|
||||
<div class="dialog__form-group dialog__form-group--radio">
|
||||
<div class="dialog__form-radio">
|
||||
<Field type="radio" id="male" value="m" name="gender" validateOnInput />
|
||||
<label for="male">
|
||||
<i class="fas fa-mars"></i>Male
|
||||
</label>
|
||||
</div>
|
||||
<div class="dialog__form-radio">
|
||||
<Field type="radio" id="female" value="f" name="gender" validateOnInput />
|
||||
<label for="female">
|
||||
<i class="fas fa-venus"></i>Female
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<ErrorMessage name="gender" class="dialog__form-message dialog__form-message--error" />
|
||||
</div>
|
||||
<div class="dialog__form-group">
|
||||
<label for="height">Height</label>
|
||||
<Field id="height" type="text" name="height" placeholder="175" validateOnInput/>
|
||||
<ErrorMessage name="height" class="dialog__form-message dialog__form-message--error" />
|
||||
</div>
|
||||
<button class="dialog__form-submit" id="submit" type="submit">
|
||||
<i class="fas fa-user-plus"></i>CREATE
|
||||
</button>
|
||||
</Form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
@@ -0,0 +1,5 @@
|
||||
import { createApp } from 'vue'
|
||||
import './style.css'
|
||||
import App from './App.vue'
|
||||
|
||||
createApp(App).mount('#app')
|
||||
@@ -1,4 +1,13 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
|
||||
/* body {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
place-items: center;
|
||||
min-width: 320px;
|
||||
min-height: 100vh;
|
||||
} */
|
||||
|
||||
/* REMOVE LATER, ADD SCSS */
|
||||
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
@@ -150,6 +159,11 @@ body {
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.dialog__form-radio input:not(:checked) + label {
|
||||
color: #242424;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.dialog__form-message {
|
||||
position: absolute;
|
||||
top: 35px;
|
||||
@@ -170,126 +184,7 @@ body {
|
||||
color: #FF69B4; /* Pink color */
|
||||
}
|
||||
|
||||
/* .title {
|
||||
font-family: "Oswald", sans-serif;
|
||||
font-size: 22px;
|
||||
text-align: center;
|
||||
padding: 5px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
input {
|
||||
margin-bottom: 15px;
|
||||
border: none;
|
||||
border-bottom: 2px solid #58636c;
|
||||
width: 100%;
|
||||
outline: none;
|
||||
padding: 10px;
|
||||
padding-left: 0;
|
||||
font-family: "Oswald", sans-serif;
|
||||
color: #ffffff;
|
||||
text-align: left;
|
||||
background-color: #152029;
|
||||
}
|
||||
|
||||
::placeholder {
|
||||
color: rgba(84, 97, 105, 255);
|
||||
font-family: "Oswald", sans-serif;
|
||||
font-weight: 200;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.radio-toolbar input[type="radio"] {
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
width: 36%;
|
||||
}
|
||||
|
||||
.radio-toolbar label {
|
||||
display: inline-block;
|
||||
margin-top: 5px;
|
||||
background-color: rgba(15, 15, 15, 0.9);
|
||||
padding: 10px 20px;
|
||||
font-family: "Oswald", sans-serif;
|
||||
font-weight: 500;
|
||||
font-size: 16px;
|
||||
color: #ffffff;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
width: 36%;
|
||||
}
|
||||
|
||||
.radio-toolbar input[type="radio"]:checked + label {
|
||||
width: 36%;
|
||||
background-color: rgba(15, 15, 15, 0.9);
|
||||
border: none;
|
||||
border-bottom: 1px solid #93a3b6;
|
||||
border-radius: 5px;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.radio-toolbar input[type="radio"]:focus + label {
|
||||
background-color: rgba(15, 15, 15, 0.9);
|
||||
border: none;
|
||||
border-bottom: 1px solid #93a3b6;
|
||||
border-radius: 5px;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.radio-toolbar label:hover {
|
||||
background-color: rgba(28, 24, 24, 0.931);
|
||||
width: 36%;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
button {
|
||||
display: block;
|
||||
margin-top: 35px;
|
||||
background-color: #4569c6;
|
||||
outline: none;
|
||||
border: 2px double rgba(40, 40, 40, 0.9);
|
||||
color: #ffffff;
|
||||
height: 30px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
h1 {
|
||||
display: block;
|
||||
margin-top: 5px;
|
||||
margin-right: 5px;
|
||||
padding: 10px;
|
||||
background-color: rgba(15, 15, 15, 0.9);
|
||||
color: #ffffff;
|
||||
width: 93%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.range-wrap {
|
||||
position: relative;
|
||||
margin: 0 auto 3rem;
|
||||
}
|
||||
|
||||
.range {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.bubble {
|
||||
background: rgba(15, 15, 15, 0.9);
|
||||
color: #ffffff;
|
||||
padding: 4px 12px;
|
||||
position: absolute;
|
||||
border-radius: 4px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.bubble::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 2px;
|
||||
height: 2px;
|
||||
background: rgba(15, 15, 15, 0.9);
|
||||
color: black;
|
||||
top: -1px;
|
||||
left: 50%;
|
||||
} */
|
||||
color: #242424;
|
||||
font-weight: 600;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
base: './',
|
||||
plugins: [vue()],
|
||||
})
|
||||
Reference in New Issue
Block a user