Update source into github

This commit is contained in:
pbao9
2025-07-24 16:18:27 +07:00
parent 41419358dd
commit 69851ac7bc
2642 changed files with 284095 additions and 0 deletions
@@ -0,0 +1,218 @@
@extends('frontend.user.layout')
@section('section-account')
<!-- Change Profile Form -->
<div class="col-span-12 lg:col-span-9 animate__animated animate__fadeIn">
<form action="{{ route('user.information.store') }}" method="POST" enctype="multipart/form-data">
@csrf
@method('PUT')
<div class="bg-white rounded-xl shadow-md mt-5 p-5">
<div class="border-b border-gray-200 pb-4 mb-6">
<h2 class="text-lg font-semibold text-gray-800">Cập nhật thông tin cá nhân</h2>
</div>
<input type="hidden" name="method" value="put">
<!-- Avatar Upload -->
<div class="flex justify-center items-center mb-3">
<div x-data="{ fileName: '', previewUrl: '{{ customer()->avatar ? asset('template/' . customer()->avatar) : asset('/images/avatar.png') }}' }" class="w-fit mx-auto text-center">
<!-- Preview ảnh -->
<template x-if="previewUrl">
<div class="my-3">
<img :src="previewUrl" alt="Xem trước ảnh"
class="w-24 h-24 mx-auto object-cover rounded-lg border border-gray-200 dark:border-gray-600" />
</div>
</template>
<label for="file_input"
class="inline-flex items-center gap-2 px-4 py-2 bg-primary hover:bg-primary text-white text-sm font-medium rounded-lg cursor-pointer shadow transition
duration-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round" class="lucide lucide-image-up-icon lucide-image-up w-5 h-5">
<path
d="M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21" />
<path d="m14 19.5 3-3 3 3" />
<path d="M17 22v-5.5" />
<circle cx="9" cy="9" r="2" />
</svg>
Tải ảnh lên
</label>
<input id="file_input" type="file" name="avatar" accept=".jpg,.jpeg,.png" class="hidden"
@change="
const file = $event.target.files[0];
fileName = file?.name || '';
if (file && file.type.startsWith('image/')) {
const reader = new FileReader();
reader.onload = e => previewUrl = e.target.result;
reader.readAsDataURL(file);
} else {
previewUrl = '';
}
">
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-3">
<!-- Profile Fields -->
<div class="space-y-4">
<flux:field>
<flux:label>Họ</flux:label>
<flux:input wire:model="firstname" name="firstname" type="text" placeholder="Nhập họ"
value="{{ customer()->firstname ?? '' }}" />
<flux:error name="firstname" />
</flux:field>
<flux:field>
<flux:label>Tên</flux:label>
<flux:input wire:model="lastname" name="lastname" type="text" placeholder="Nhập tên"
value="{{ customer()->lastname ?? '' }}" />
<flux:error name="lastname" />
</flux:field>
<flux:field>
<flux:label>Email</flux:label>
<flux:input wire:model="email" name="email" type="email" placeholder="Email" disabled
value="{{ customer()->email ?? '' }}" />
<flux:error name="email" />
</flux:field>
<flux:field>
<flux:label>Giới tính</flux:label>
<flux:select wire:model="gender" name="gender" placeholder="Chọn giới tính...">
<flux:select.option value="0">Nam</flux:select.option>
<flux:select.option value="1">Nữ</flux:select.option>
</flux:select>
<flux:error name="gender" />
</flux:field>
</div>
<!-- Contact Fields -->
<div class="space-y-4">
<flux:field>
<flux:label>Số điện thoại</flux:label>
<flux:input wire:model="phone" name="phone" type="text" placeholder="Nhập số điện thoại"
value="{{ customer()->phone ?? '' }}" />
<flux:error name="phone" />
</flux:field>
<flux:field>
<flux:label>Công ty (Optional)</flux:label>
<flux:input wire:model="company" name="company" type="text" placeholder="Tên công ty"
value="{{ customer()->company ?? '' }}" />
<flux:error name="company" />
</flux:field>
<flux:field>
<flux:label>Địa chỉ</flux:label>
<flux:input wire:model="address" name="address" type="text" placeholder="Nhập địa chỉ"
value="{{ customer()->address ?? '' }}" />
<flux:error name="address" />
</flux:field>
<flux:field>
<flux:label>Ngày sinh</flux:label>
<flux:input wire:model="birthday" name="birthday" type="date" placeholder="Nhập ngày sinh"
value="{{ customer()->birthday ?? '' }}" />
<flux:error name="birthday" />
</flux:field>
</div>
</div>
<!-- Upload CCCD -->
<div class="bg-white rounded-lg p-6 border-3 border-dashed border-gray-200">
<h3 class="text-center text-lg font-bold mb-6">Upload CMND/CCCD</h3>
<div class="mb-3">
<flux:field>
<flux:label>Số CMND/CCCD</flux:label>
<flux:input wire:model="cccd" name="cccd" type="text" placeholder="Nhập số CMND/CCCD"
value="{{ customer()->cccd ?? '' }}" />
<flux:error name="cccd" />
</flux:field>
</div>
<div x-data="{
frontPreview: '{{ customer()->front_cccd ? asset('template/' . customer()->front_cccd) : '' }}',
backPreview: '{{ customer()->back_cccd ? asset('template/' . customer()->back_cccd) : '' }}'
}" class="grid grid-cols-1 lg:grid-cols-2 gap-6">
<!-- Mặt trước -->
<div class="border-2 border-dashed border-gray-200 flex flex-col justify-center items-center">
<label class="block mb-1 font-medium text-gray-700 text-center py-3">Ảnh mặt
trước</label>
<template x-if="frontPreview">
<img :src="frontPreview" class="w-48 h-32 object-cover mx-auto my-4 rounded shadow"
alt="Ảnh mặt trước CCCD">
</template>
<label for="cccd_front"
class="inline-flex items-center gap-2 my-3 px-4 py-2 bg-primary hover:bg-primary text-white text-sm font-medium rounded-lg cursor-pointer shadow transition
duration-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round"
class="lucide lucide-image-up-icon lucide-image-up w-5 h-5">
<path
d="M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21" />
<path d="m14 19.5 3-3 3 3" />
<path d="M17 22v-5.5" />
<circle cx="9" cy="9" r="2" />
</svg>
Tải ảnh lên
</label>
<input id="cccd_front" type="file" name="front_cccd" accept=".jpg,.png" hidden
@change="
const file = $event.target.files[0];
if (file && file.type.startsWith('image/')) {
const reader = new FileReader();
reader.onload = e => frontPreview = e.target.result;
reader.readAsDataURL(file);
}">
</div>
<!-- Mặt sau -->
<div class="border-2 border-dashed border-gray-200 flex flex-col justify-center items-center">
<label class="block mb-1 font-medium text-gray-700 text-center py-3">Ảnh mặt sau</label>
<template x-if="backPreview">
<img :src="backPreview" class="w-48 h-32 object-cover mx-auto my-4 rounded shadow"
alt="Ảnh mặt sau CCCD">
</template>
<label for="cccd_back"
class="inline-flex items-center gap-2 my-3 px-4 py-2 bg-primary hover:bg-primary text-white text-sm font-medium rounded-lg cursor-pointer shadow transition
duration-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round"
class="lucide lucide-image-up-icon lucide-image-up w-5 h-5">
<path
d="M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21" />
<path d="m14 19.5 3-3 3 3" />
<path d="M17 22v-5.5" />
<circle cx="9" cy="9" r="2" />
</svg>
Tải ảnh lên
</label>
<input id="cccd_back" type="file" name="back_cccd" accept=".jpg,.png" hidden
@change="
const file = $event.target.files[0];
if (file && file.type.startsWith('image/')) {
const reader = new FileReader();
reader.onload = e => backPreview = e.target.result;
reader.readAsDataURL(file);
}">
</div>
</div>
</div>
<div class="text-right my-3">
<button type="submit"
class="bg-primary hover:bg-primary-dark text-white font-semibold py-2 px-6 rounded-lg transition duration-300">
Cập nhật
</button>
</div>
</div>
</form>
</div>
@endsection
@@ -0,0 +1,49 @@
@extends('frontend.layouts.master')
@section('content')
<div class="grid grid-cols-12 gap-6">
<!-- Profile Menu -->
<div class="col-span-12 lg:col-span-3 flex flex-col-reverse lg:flex-col animate__animated animate__fadeInLeft">
<div class="bg-white rounded-xl shadow-md mt-5 p-5">
<div class="flex items-center">
<div class="w-12 h-12">
<img class="rounded-full object-cover w-full h-full"
src="{{ asset('template/' . customer()?->avatar) ?? asset('images/avatar.png') }}" alt="Avatar">
</div>
<div class="ml-4">
<div class="font-semibold text-base text-gray-800">{{ customer()->firstname . ' ' . customer()->lastname }}
</div>
</div>
</div>
<div class="border-t border-gray-200 mt-5 pt-5 space-y-5">
<a class="flex items-center {{ request()->routeIs('user.information') ? 'text-primary font-semibold' : 'text-gray-700 hover:text-primary' }}"
href="{{ route('user.information') }}" wire:navigate>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round" class="lucide lucide-activity-icon lucide-activity w-4 h-4 mr-2">
<path
d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2" />
</svg>
Thông tin cá nhân
</a>
<a class="flex items-center {{ request()->routeIs('user.password') ? 'text-primary font-semibold' : 'text-gray-700 hover:text-primary' }}"
href="{{ route('user.password') }}" wire:navigate>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round" class="lucide lucide-user-lock-icon lucide-user-lock w-4 h-4 mr-2">
<circle cx="10" cy="7" r="4" />
<path d="M10.3 15H7a4 4 0 0 0-4 4v2" />
<path d="M15 15.5V14a2 2 0 0 1 4 0v1.5" />
<rect width="8" height="5" x="13" y="16" rx=".899" />
</svg>
Đổi mật khẩu
</a>
</div>
</div>
</div>
@yield('section-account')
</div>
@endsection
@@ -0,0 +1,152 @@
@extends('frontend.user.layout')
@section("section-account")
<div x-data="{
currentPassword: '',
newPassword: '',
confirmPassword: '',
showCurrentPassword: false,
showNewPassword: false,
showConfirmPassword: false,
passwordStrength: 0,
passwordMatch: null
}" class="col-span-12 lg:col-span-9 animate__animated animate__fadeInUp">
<form action="{{ route('user.password.store') }}" method="post"
class="grid grid-cols-1 md:grid-cols-2 gap-6 bg-white rounded-xl shadow-md mt-5 p-5">
@csrf
@method('put')
<!-- Ảnh minh hoạ -->
<div>
<img src="{{ asset('images/password-reset.jpg') }}" alt="{{ $title }}" class="w-full h-auto rounded">
</div>
<!-- Form nhập mật khẩu -->
<div class="space-y-5 self-center">
<!-- Mật khẩu cũ -->
<flux:field>
<flux:label>Nhập mật khẩu cũ</flux:label>
<flux:input
x-bind:type="showCurrentPassword ? 'text' : 'password'"
icon="lock-closed"
placeholder="*******"
name="password"
x-model="currentPassword"
autocomplete="current-password"
value="{{ old('password') }}">
<x-slot name="iconTrailing">
<flux:button size="sm" variant="subtle" class="-mr-1"
@click="showCurrentPassword = !showCurrentPassword" type="button">
<flux:icon.eye x-show="!showCurrentPassword" class="w-4 h-4" />
<flux:icon.eye-slash x-show="showCurrentPassword" class="w-4 h-4" />
</flux:button>
</x-slot>
</flux:input>
</flux:field>
<!-- Mật khẩu mới -->
<flux:field>
<flux:label>Mật khẩu mới</flux:label>
<flux:input
x-bind:type="showNewPassword ? 'text' : 'password'"
icon="lock-closed"
placeholder="*******"
name="new_password"
x-model="newPassword"
autocomplete="new-password"
value="{{ old('new_password') }}"
@input="
passwordStrength = 0;
if (newPassword.length >= 8) passwordStrength++;
if (/[0-9]/.test(newPassword)) passwordStrength++;
if (/[A-Z]/.test(newPassword) && /[a-z]/.test(newPassword)) passwordStrength++;
if (/[^A-Za-z0-9]/.test(newPassword)) passwordStrength++;
passwordMatch = confirmPassword === newPassword ? true : (confirmPassword === '' ? null : false);
">
<x-slot name="iconTrailing">
<flux:button size="sm" variant="subtle" class="-mr-1"
@click="showNewPassword = !showNewPassword" type="button">
<flux:icon.eye x-show="!showNewPassword" class="w-4 h-4" />
<flux:icon.eye-slash x-show="showNewPassword" class="w-4 h-4" />
</flux:button>
</x-slot>
</flux:input>
<!-- Password Strength Indicator -->
<div class="mt-2">
<div class="flex gap-1 mb-1">
<template x-for="i in 4" :key="i">
<div class="h-1 flex-1 rounded-full transition-colors"
:class="{
'bg-gray-200': passwordStrength < i,
'bg-red-500': passwordStrength === 1 && i === 1,
'bg-yellow-500': passwordStrength === 2 && i <= 2,
'bg-emerald-500': passwordStrength === 3 && i <= 3,
'bg-green-500': passwordStrength === 4 && i <= 4
}">
</div>
</template>
</div>
<p class="text-xs font-medium"
:class="{
'text-red-500': passwordStrength === 1,
'text-yellow-500': passwordStrength === 2,
'text-emerald-500': passwordStrength === 3,
'text-green-500': passwordStrength === 4,
'text-gray-500': passwordStrength === 0
}"
x-text="[
'Độ bảo mật mật khẩu sẽ được hiển thị ở đây',
'Yếu',
'Trung bình',
'Tốt',
'Rất mạnh'
][passwordStrength]">
</p>
</div>
</flux:field>
<!-- Nhập lại mật khẩu mới -->
<flux:field>
<flux:label>Nhập lại mật khẩu mới</flux:label>
<flux:input
x-bind:type="showConfirmPassword ? 'text' : 'password'"
icon="shield-check"
placeholder="*******"
name="confirm_password"
x-model="confirmPassword"
autocomplete="new-password"
value="{{ old('confirm_password') }}"
@input="passwordMatch = (confirmPassword === newPassword) ? true : false">
<x-slot name="iconTrailing">
<flux:button size="sm" variant="subtle" class="-mr-1"
@click="showConfirmPassword = !showConfirmPassword" type="button">
<flux:icon.eye x-show="!showConfirmPassword" class="w-4 h-4" />
<flux:icon.eye-slash x-show="showConfirmPassword" class="w-4 h-4" />
</flux:button>
</x-slot>
</flux:input>
<!-- Password Match Indicator -->
<flux:error x-show="passwordMatch === false" class="text-red-500">
Mật khẩu không khớp
</flux:error>
<flux:description x-show="passwordMatch === true" class="text-green-500">
Mật khẩu trùng khớp
</flux:description>
<flux:description x-show="passwordMatch === null" class="text-gray-500">
Vui lòng xác nhận mật khẩu
</flux:description>
</flux:field>
</div>
<!-- Nút submit -->
<div class="col-span-1 md:col-span-2 text-end pt-4">
<flux:button type="submit" icon:trailing="arrow-right" variant="primary" color="orange">
Lưu thông tin
</flux:button>
</div>
</form>
</div>
@endsection