17 | */
18 | public function definition()
19 | {
20 | return [
21 | 'name' => fake()->name(),
22 | 'email' => fake()->unique()->safeEmail(),
23 | 'email_verified_at' => now(),
24 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
25 | 'remember_token' => Str::random(10),
26 | ];
27 | }
28 |
29 | /**
30 | * Indicate that the model's email address should be unverified.
31 | *
32 | * @return static
33 | */
34 | public function unverified()
35 | {
36 | return $this->state(fn (array $attributes) => [
37 | 'email_verified_at' => null,
38 | ]);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_000000_create_users_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->string('name');
19 | $table->string('email')->unique();
20 | $table->timestamp('email_verified_at')->nullable();
21 | $table->string('password');
22 | $table->rememberToken();
23 | $table->timestamps();
24 | });
25 | }
26 |
27 | /**
28 | * Reverse the migrations.
29 | *
30 | * @return void
31 | */
32 | public function down()
33 | {
34 | Schema::dropIfExists('users');
35 | }
36 | };
37 |
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_100000_create_password_resets_table.php:
--------------------------------------------------------------------------------
1 | string('email')->primary();
18 | $table->string('token');
19 | $table->timestamp('created_at')->nullable();
20 | });
21 | }
22 |
23 | /**
24 | * Reverse the migrations.
25 | *
26 | * @return void
27 | */
28 | public function down()
29 | {
30 | Schema::dropIfExists('password_resets');
31 | }
32 | };
33 |
--------------------------------------------------------------------------------
/database/migrations/2019_08_19_000000_create_failed_jobs_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->string('uuid')->unique();
19 | $table->text('connection');
20 | $table->text('queue');
21 | $table->longText('payload');
22 | $table->longText('exception');
23 | $table->timestamp('failed_at')->useCurrent();
24 | });
25 | }
26 |
27 | /**
28 | * Reverse the migrations.
29 | *
30 | * @return void
31 | */
32 | public function down()
33 | {
34 | Schema::dropIfExists('failed_jobs');
35 | }
36 | };
37 |
--------------------------------------------------------------------------------
/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->morphs('tokenable');
19 | $table->string('name');
20 | $table->string('token', 64)->unique();
21 | $table->text('abilities')->nullable();
22 | $table->timestamp('last_used_at')->nullable();
23 | $table->timestamp('expires_at')->nullable();
24 | $table->timestamps();
25 | });
26 | }
27 |
28 | /**
29 | * Reverse the migrations.
30 | *
31 | * @return void
32 | */
33 | public function down()
34 | {
35 | Schema::dropIfExists('personal_access_tokens');
36 | }
37 | };
38 |
--------------------------------------------------------------------------------
/database/migrations/2022_12_17_060048_create_agencies_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->integer('fanavaran_id')->unique();
19 | $table->integer('code')->nullable();
20 | $table->string('name')->nullable();
21 | $table->string('last_name')->nullable();
22 | $table->string('national_code')->nullable();
23 | $table->string('tel')->nullable();
24 | $table->string('mobile')->nullable();
25 | $table->integer('province_id')->nullable();
26 | $table->integer('city_id')->nullable();
27 | $table->string('address')->nullable();
28 | $table->string('unit_name')->nullable();
29 | $table->integer('unit_kind_id')->nullable();
30 | $table->integer('is_active')->nullable();
31 | $table->timestamps();
32 | });
33 | }
34 | /**
35 | * Reverse the migrations.
36 | *
37 | * @return void
38 | */
39 | public function down()
40 | {
41 | Schema::dropIfExists('agencies');
42 | }
43 | };
44 |
--------------------------------------------------------------------------------
/database/migrations/2022_12_18_073743_create_fanavaran_roles_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->integer('fanavaran_id')->unique();
19 | $table->tinyInteger('is_active');
20 | $table->string('caption');
21 | $table->string('slug');
22 | $table->timestamps();
23 | });
24 | }
25 |
26 | /**
27 | * Reverse the migrations.
28 | *
29 | * @return void
30 | */
31 | public function down()
32 | {
33 | Schema::dropIfExists('fanavaran_roles');
34 | }
35 | };
36 |
--------------------------------------------------------------------------------
/database/migrations/2022_12_18_163726_create_colors_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->integer('fanavaran_id')->unique();
19 | $table->string('name')->nullable();
20 | $table->string('caption');
21 | $table->integer('is_active');
22 | $table->timestamps();
23 | });
24 | }
25 |
26 | /**
27 | * Reverse the migrations.
28 | *
29 | * @return void
30 | */
31 | public function down()
32 | {
33 | Schema::dropIfExists('colors');
34 | }
35 | };
36 |
--------------------------------------------------------------------------------
/database/migrations/2022_12_24_095228_create_provinces_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->string('caption');
19 | $table->integer('fanavaran_id')->unique();
20 | $table->integer('is_active');
21 | $table->string('name')->nullable();
22 | $table->timestamps();
23 | });
24 | }
25 |
26 | /**
27 | * Reverse the migrations.
28 | *
29 | * @return void
30 | */
31 | public function down()
32 | {
33 | Schema::dropIfExists('provinces');
34 | }
35 | };
36 |
--------------------------------------------------------------------------------
/database/migrations/2022_12_24_095255_create_answers_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->string('caption');
19 | $table->integer('fanavaran_id')->unique();
20 | $table->integer('is_active');
21 | $table->timestamps();
22 | });
23 | }
24 |
25 | /**
26 | * Reverse the migrations.
27 | *
28 | * @return void
29 | */
30 | public function down()
31 | {
32 | Schema::dropIfExists('answers');
33 | }
34 | };
35 |
--------------------------------------------------------------------------------
/database/migrations/2022_12_24_095638_create_fields_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->string('caption');
19 | $table->integer('fanavaran_id')->unique();
20 | $table->integer('is_active');
21 | $table->string('name');
22 | $table->timestamps();
23 | });
24 | }
25 |
26 | /**
27 | * Reverse the migrations.
28 | *
29 | * @return void
30 | */
31 | public function down()
32 | {
33 | Schema::dropIfExists('fields');
34 | }
35 | };
36 |
--------------------------------------------------------------------------------
/database/migrations/2022_12_24_110413_create_responses_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->string('caption');
19 | $table->integer('fanavaran_id')->unique();
20 | $table->integer('is_active');
21 | $table->timestamps();
22 | });
23 | }
24 |
25 | /**
26 | * Reverse the migrations.
27 | *
28 | * @return void
29 | */
30 | public function down()
31 | {
32 | Schema::dropIfExists('responses');
33 | }
34 | };
35 |
--------------------------------------------------------------------------------
/database/migrations/2022_12_24_111634_create_companies_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->string('caption');
19 | $table->integer('fanavaran_id')->unique();
20 | $table->integer('is_active');
21 | $table->timestamps();
22 | });
23 | }
24 |
25 | /**
26 | * Reverse the migrations.
27 | *
28 | * @return void
29 | */
30 | public function down()
31 | {
32 | Schema::dropIfExists('companies');
33 | }
34 | };
35 |
--------------------------------------------------------------------------------
/database/migrations/2023_01_04_145207_create_jobs_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->integer('fanavaran_id')->unique();
19 | $table->integer('job_category_id');
20 | $table->string('caption');
21 | $table->integer('is_active');
22 | $table->timestamps();
23 | });
24 | }
25 |
26 | /**
27 | * Reverse the migrations.
28 | *
29 | * @return void
30 | */
31 | public function down()
32 | {
33 | Schema::dropIfExists('jobs');
34 | }
35 | };
36 |
--------------------------------------------------------------------------------
/database/migrations/2023_01_08_170816_create_life_insurances_table.php:
--------------------------------------------------------------------------------
1 | id();
18 | $table->string('insurance_target');
19 | $table->string('birth_year');
20 | $table->string('birth_month');
21 | $table->string('birth_day');
22 | $table->string('life_ins_duration');
23 | $table->string('payment_method');
24 | $table->string('annual_payment');
25 | $table->string('first_job_level');
26 | $table->string('first_job_level_id');
27 | $table->string('second_job_level');
28 | $table->string('second_job_level_id');
29 | $table->string('divided_payment');
30 | $table->string('annual_payment_increase');
31 | $table->string('addon_payment_method');
32 | $table->string('death_capital_any_reason_ratio');
33 | $table->string('capital_increase');
34 | $table->string('death_capital_incident_ratio')->nullable();
35 | $table->string('maim_ratio')->nullable();
36 | $table->string('has_medical_cost')->nullable();
37 | $table->string('additional_dangers')->nullable();
38 | $table->string('hospitalization')->nullable();
39 | $table->string('exemption')->nullable();
40 | $table->string('special_diseases_ratio')->nullable();
41 | $table->string('national_code')->unique()->nullable();
42 | $table->string('mobile_number')->nullable();
43 | $table->string('ins_target_height')->nullable();
44 | $table->string('ins_target_weight')->nullable();
45 | $table->string('gender')->nullable();
46 | $table->string('military_service_status')->nullable();
47 | $table->string('military_service_details')->nullable();
48 | $table->string('military_service_reason')->nullable();
49 | $table->string('father_life_status')->nullable();
50 | $table->string('father_age')->nullable();
51 | $table->string('father_death_reason')->nullable();
52 | $table->string('mother_life_status')->nullable();
53 | $table->string('mother_age')->nullable();
54 | $table->string('mother_death_reason')->nullable();
55 | $table->string('family_health_history')->nullable();
56 | $table->string('family_health_history_reason')->nullable();
57 | $table->string('smoking_status')->nullable();
58 | $table->string('hospitalization_status')->nullable();
59 | $table->string('hospitalization_reason')->nullable();
60 | $table->string('physical_impairment')->nullable();
61 | $table->string('drug_usage')->nullable();
62 | $table->string('health_status')->nullable();
63 | $table->string('disease_type')->nullable();
64 | $table->string('weight_loss')->nullable();
65 | $table->string('weight_loss_reason')->nullable();
66 | $table->unsignedBigInteger('user_id')->nullable();
67 | $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
68 | $table->timestamps();
69 | });
70 | }
71 |
72 | /**
73 | * Reverse the migrations.
74 | *
75 | * @return void
76 | */
77 | public function down()
78 | {
79 | Schema::dropIfExists('life_insurances');
80 | }
81 | };
82 |
--------------------------------------------------------------------------------
/database/seeders/DatabaseSeeder.php:
--------------------------------------------------------------------------------
1 | create();
18 |
19 | // \App\Models\User::factory()->create([
20 | // 'name' => 'Test User',
21 | // 'email' => 'test@example.com',
22 | // ]);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/lang/en/auth.php:
--------------------------------------------------------------------------------
1 | 'These credentials do not match our records.',
17 | 'password' => 'The provided password is incorrect.',
18 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
19 |
20 | ];
21 |
--------------------------------------------------------------------------------
/lang/en/pagination.php:
--------------------------------------------------------------------------------
1 | '« Previous',
17 | 'next' => 'Next »',
18 |
19 | ];
20 |
--------------------------------------------------------------------------------
/lang/en/passwords.php:
--------------------------------------------------------------------------------
1 | 'Your password has been reset!',
17 | 'sent' => 'We have emailed your password reset link!',
18 | 'throttled' => 'Please wait before retrying.',
19 | 'token' => 'This password reset token is invalid.',
20 | 'user' => "We can't find a user with that email address.",
21 |
22 | ];
23 |
--------------------------------------------------------------------------------
/lang/fa/auth.php:
--------------------------------------------------------------------------------
1 | 'مشخصات وارد شده با اطلاعات ما سازگار نیست.',
16 | 'password' => 'رمز عبور شما معتبر نیست.',
17 | 'throttle' => 'دفعات تلاش شما برای ورود بیش از حد مجاز است. لطفا پس از :seconds ثانیه مجددا تلاش فرمایید.',
18 | ];
--------------------------------------------------------------------------------
/lang/fa/pagination.php:
--------------------------------------------------------------------------------
1 | 'بعدی »',
16 | 'previous' => '« قبلی',
17 | ];
--------------------------------------------------------------------------------
/lang/fa/passwords.php:
--------------------------------------------------------------------------------
1 | 'رمز عبور شما بازگردانی شد!',
16 | 'sent' => 'لینک بازگردانی رمز عبور به ایمیل شما ارسال شد.',
17 | 'throttled' => 'پیش از تلاش مجدد کمی صبر کنید.',
18 | 'token' => 'مشخصهی بازگردانی رمز عبور معتبر نیست.',
19 | 'user' => 'ما کاربری با این نشانی ایمیل نداریم!',
20 | ];
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "scripts": {
4 | "dev": "vite",
5 | "build": "vite build"
6 | },
7 | "devDependencies": {
8 | "axios": "^1.1.2",
9 | "laravel-vite-plugin": "^0.7.2",
10 | "lodash": "^4.17.19",
11 | "postcss": "^8.1.14",
12 | "vite": "^4.0.0"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 | ./tests/Unit
10 |
11 |
12 | ./tests/Feature
13 |
14 |
15 |
16 |
17 | ./app
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/public/.htaccess:
--------------------------------------------------------------------------------
1 |
2 |
3 | Options -MultiViews -Indexes
4 |
5 |
6 | RewriteEngine On
7 |
8 | # Handle Authorization Header
9 | RewriteCond %{HTTP:Authorization} .
10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
11 |
12 | # Redirect Trailing Slashes If Not A Folder...
13 | RewriteCond %{REQUEST_FILENAME} !-d
14 | RewriteCond %{REQUEST_URI} (.+)/$
15 | RewriteRule ^ %1 [L,R=301]
16 |
17 | # Send Requests To Front Controller...
18 | RewriteCond %{REQUEST_FILENAME} !-d
19 | RewriteCond %{REQUEST_FILENAME} !-f
20 | RewriteRule ^ index.php [L]
21 |
22 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mh97m/React-Life/fd3af697dd3a89a60f1d3b44aeb94cec90c34239/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.php:
--------------------------------------------------------------------------------
1 | make(Kernel::class);
50 |
51 | $response = $kernel->handle(
52 | $request = Request::capture()
53 | )->send();
54 |
55 | $kernel->terminate($request, $response);
56 |
--------------------------------------------------------------------------------
/public/pdf-export-assets/css/app.css:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'iransans';
3 | src: url('../fonts/iransans.eot');
4 | src: url('../fonts/iransans.eot?#iefix') format('embedded-opentype'),
5 | url('../fonts/iransans.woff') format('woff'),
6 | url('../fonts/iransans.ttf') format('truetype')
7 | }
8 |
9 | .checked::before,
10 | .checked::after {
11 | position: absolute;
12 | }
13 |
14 | .checked::before {
15 | content: "";
16 | border: 2px solid #716f64;
17 | border-right-color: transparent;
18 | border-bottom-color: transparent;
19 | top: -1px;
20 | left: -1px;
21 | height: 10px;
22 | width: 10px;
23 | }
24 |
25 | .ckecked-wide::after {
26 | display: none;
27 | }
28 |
29 | .ckecked-wide::before {
30 | width: 85px;
31 | height: 23px;
32 | }
33 |
34 | .check-set-width::before {
35 | width: 56px;
36 | }
37 |
38 | .new-page {
39 | page-break-before: always;
40 | }
--------------------------------------------------------------------------------
/public/pdf-export-assets/fonts/FontAwesome.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mh97m/React-Life/fd3af697dd3a89a60f1d3b44aeb94cec90c34239/public/pdf-export-assets/fonts/FontAwesome.otf
--------------------------------------------------------------------------------
/public/pdf-export-assets/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mh97m/React-Life/fd3af697dd3a89a60f1d3b44aeb94cec90c34239/public/pdf-export-assets/fonts/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/public/pdf-export-assets/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mh97m/React-Life/fd3af697dd3a89a60f1d3b44aeb94cec90c34239/public/pdf-export-assets/fonts/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/public/pdf-export-assets/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mh97m/React-Life/fd3af697dd3a89a60f1d3b44aeb94cec90c34239/public/pdf-export-assets/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/public/pdf-export-assets/fonts/fontawesome-webfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mh97m/React-Life/fd3af697dd3a89a60f1d3b44aeb94cec90c34239/public/pdf-export-assets/fonts/fontawesome-webfont.woff2
--------------------------------------------------------------------------------
/public/pdf-export-assets/fonts/iransans.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mh97m/React-Life/fd3af697dd3a89a60f1d3b44aeb94cec90c34239/public/pdf-export-assets/fonts/iransans.eot
--------------------------------------------------------------------------------
/public/pdf-export-assets/fonts/iransans.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mh97m/React-Life/fd3af697dd3a89a60f1d3b44aeb94cec90c34239/public/pdf-export-assets/fonts/iransans.ttf
--------------------------------------------------------------------------------
/public/pdf-export-assets/fonts/iransans.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mh97m/React-Life/fd3af697dd3a89a60f1d3b44aeb94cec90c34239/public/pdf-export-assets/fonts/iransans.woff
--------------------------------------------------------------------------------
/public/pdf-export-assets/images/apple.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mh97m/React-Life/fd3af697dd3a89a60f1d3b44aeb94cec90c34239/public/pdf-export-assets/images/apple.png
--------------------------------------------------------------------------------
/public/pdf-export-assets/images/barcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mh97m/React-Life/fd3af697dd3a89a60f1d3b44aeb94cec90c34239/public/pdf-export-assets/images/barcode.png
--------------------------------------------------------------------------------
/public/pdf-export-assets/images/logo-left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mh97m/React-Life/fd3af697dd3a89a60f1d3b44aeb94cec90c34239/public/pdf-export-assets/images/logo-left.png
--------------------------------------------------------------------------------
/public/pdf-export-assets/images/logo-right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mh97m/React-Life/fd3af697dd3a89a60f1d3b44aeb94cec90c34239/public/pdf-export-assets/images/logo-right.png
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow:
3 |
--------------------------------------------------------------------------------
/react-life-form/.env.example:
--------------------------------------------------------------------------------
1 | VITE_API_BASE_URL=http://localhost:8000
2 | VITE_BASE_URL=http://localhost:8080
--------------------------------------------------------------------------------
/react-life-form/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/react-life-form/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | سایت بیمه
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/react-life-form/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "step-form",
3 | "private": true,
4 | "version": "1.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite --port=8080",
8 | "build": "vite build",
9 | "preview": "vite preview",
10 | "watch": "vite build --watch"
11 | },
12 | "dependencies": {
13 | "axios": "^1.2.2",
14 | "react": "^18.2.0",
15 | "react-date-object": "^2.1.5",
16 | "react-dom": "^18.2.0",
17 | "react-router-dom": "^6.6.1",
18 | "universal-cookie": "^4.0.4",
19 | "web-vitals": "^3.1.0"
20 | },
21 | "devDependencies": {
22 | "@types/react": "^18.0.26",
23 | "@types/react-dom": "^18.0.9",
24 | "@vitejs/plugin-react": "^3.0.0",
25 | "vite": "^4.0.0"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/react-life-form/public/vite.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/react-life-form/src/Dashboard.jsx:
--------------------------------------------------------------------------------
1 | import { useState } from 'react'
2 |
3 | function Dashboard() {
4 |
5 | return (
6 |
7 |
داشبورد
8 |
9 | )
10 | }
11 |
12 | export default Dashboard
13 |
--------------------------------------------------------------------------------
/react-life-form/src/assets/react.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/react-life-form/src/axios-client.js:
--------------------------------------------------------------------------------
1 | import axios from "axios";
2 | import { useStateContext } from "./context/ContextProvider.jsx";
3 |
4 | const axiosClient = axios.create({
5 | baseURL: `${import.meta.env.VITE_API_BASE_URL}/api`,
6 | });
7 |
8 | axiosClient.interceptors.request.use((config) => {
9 | const token = localStorage.getItem("ACCESS_TOKEN");
10 | config.headers.Authorization = `Bearer ${token}`;
11 | return config;
12 | });
13 |
14 | axiosClient.interceptors.response.use(
15 | (response) => {
16 | return response;
17 | },
18 | (error) => {
19 | const { response } = error;
20 | if (response.status === 401) {
21 | localStorage.removeItem("ACCESS_TOKEN");
22 | // window.location.reload();
23 | } else if (response.status === 404) {
24 | //Show not found
25 | }
26 |
27 | throw error;
28 | }
29 | );
30 |
31 | export default axiosClient;
32 |
--------------------------------------------------------------------------------
/react-life-form/src/components/DefaultLayout.jsx:
--------------------------------------------------------------------------------
1 | import { Link, Navigate, Outlet } from "react-router-dom";
2 | import { useStateContext } from "../context/ContextProvider";
3 | import axiosClient from "../axios-client.js";
4 | import { useEffect } from "react";
5 |
6 | export default function DefaultLayout() {
7 | const { user, token, setUser, setToken, notification, setNext } = useStateContext();
8 |
9 | if (!token) {
10 | return ;
11 | }
12 |
13 | const onLogout = (ev) => {
14 | ev.preventDefault();
15 |
16 | axiosClient.post("/logout").then(() => {
17 | setUser({});
18 | setToken(null);
19 | });
20 | };
21 |
22 | useEffect(() => {
23 | axiosClient.get("/user").then(({ data }) => {
24 | setUser(data);
25 | });
26 | setNext(null);
27 | }, []);
28 |
29 | return (
30 |
31 |
37 |
38 |
48 |
49 |
50 |
51 | {notification && (
52 |
{notification}
53 | )}
54 |
55 |
56 | );
57 | }
58 |
--------------------------------------------------------------------------------
/react-life-form/src/components/GuestLayout.jsx:
--------------------------------------------------------------------------------
1 | import { Navigate, Outlet } from "react-router-dom";
2 | import { useStateContext } from "../context/ContextProvider";
3 |
4 | export default function GuestLayout() {
5 | const { user, token, notification, next, setNext } = useStateContext();
6 |
7 | if (token) {
8 | if (next) {
9 | return ;
10 | } else {
11 | return ;
12 | }
13 | // navigate(-1);
14 | }
15 |
16 | return (
17 |
18 |
19 | {notification &&
{notification}
}
20 |
21 | );
22 | }
23 |
--------------------------------------------------------------------------------
/react-life-form/src/context/ContextProvider.jsx:
--------------------------------------------------------------------------------
1 | import { createContext, useContext, useState } from "react";
2 |
3 | const StateContext = createContext({
4 | currentUser: null,
5 | token: null,
6 | notification: null,
7 | next: null,
8 | insurancedId: null,
9 | setUser: () => {},
10 | setToken: () => {},
11 | setNotification: () => {},
12 | setNext: () => {},
13 | setInsurancedId: () => {},
14 | });
15 |
16 | export const ContextProvider = ({ children }) => {
17 | const [user, setUser] = useState({});
18 | const [token, _setToken] = useState(localStorage.getItem("ACCESS_TOKEN"));
19 | const [notification, _setNotification] = useState("");
20 | const [next, _setNext] = useState(localStorage.getItem("NEXT"));
21 | const [insurancedId, _setInsurancedId] = useState(
22 | localStorage.getItem("INSURANCED_ID")
23 | );
24 |
25 | const setToken = (token) => {
26 | _setToken(token);
27 | if (token) {
28 | localStorage.setItem("ACCESS_TOKEN", token);
29 | } else {
30 | localStorage.removeItem("ACCESS_TOKEN");
31 | }
32 | };
33 |
34 | const setNotification = (message) => {
35 | _setNotification(message);
36 |
37 | setTimeout(() => {
38 | _setNotification("");
39 | }, 5000);
40 | };
41 |
42 | const setInsurancedId = (insurancedId) => {
43 | _setInsurancedId(insurancedId);
44 | if (insurancedId) {
45 | localStorage.setItem("INSURANCED_ID", insurancedId);
46 | } else {
47 | localStorage.removeItem("INSURANCED_ID");
48 | }
49 | };
50 |
51 | const setNext = (next) => {
52 | _setNext(next);
53 | if (next) {
54 | localStorage.setItem("NEXT", next);
55 | } else {
56 | localStorage.removeItem("NEXT");
57 | }
58 | };
59 |
60 | return (
61 |
75 | {children}
76 |
77 | );
78 | };
79 |
80 | export const useStateContext = () => useContext(StateContext);
81 |
--------------------------------------------------------------------------------
/react-life-form/src/main.jsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom/client";
3 | import Dashboard from "./Dashboard.jsx";
4 | import "./index.css";
5 | import { RouterProvider } from "react-router-dom";
6 | import router from "./router.jsx";
7 | import { ContextProvider } from "./context/ContextProvider.jsx";
8 | import reportWebVitals from "./reportWebVitals";
9 |
10 | ReactDOM.createRoot(document.getElementById("root")).render(
11 | <>
12 |
13 |
14 |
15 | >
16 | );
17 |
18 | reportWebVitals();
--------------------------------------------------------------------------------
/react-life-form/src/reportWebVitals.jsx:
--------------------------------------------------------------------------------
1 | const reportWebVitals = (onPerfEntry) => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import("web-vitals").then(
4 | ({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
5 | getCLS(onPerfEntry);
6 | getFID(onPerfEntry);
7 | getFCP(onPerfEntry);
8 | getLCP(onPerfEntry);
9 | getTTFB(onPerfEntry);
10 | }
11 | );
12 | }
13 | };
14 |
15 | export default reportWebVitals;
16 |
--------------------------------------------------------------------------------
/react-life-form/src/router.jsx:
--------------------------------------------------------------------------------
1 | import { createBrowserRouter, Navigate } from "react-router-dom";
2 | import Dashboard from "./Dashboard.jsx";
3 | import DefaultLayout from "./components/DefaultLayout";
4 | import GuestLayout from "./components/GuestLayout";
5 | import Login from "./views/Login";
6 | import NotFound from "./views/NotFound";
7 | import Signup from "./views/Signup";
8 | import Users from "./views/Users";
9 | import Lifes from "./views/Lifes";
10 | import UserForm from "./views/UserForm";
11 | import MultiStepForm from "./views/form-0/MultiStepForm";
12 | import LifeCompare from "./views/form-1/LifeCompare";
13 | import LifeMedicalInfo from "./views/form-2/LifeMedicalInfo";
14 | import InsuranceTargetDetails from "./views/form-3/InsuranceTargetDetails";
15 |
16 | const router = createBrowserRouter([
17 | {
18 | path: "/",
19 | element: ,
20 | children: [
21 | {
22 | path: "/",
23 | element: ,
24 | },
25 | {
26 | path: "/dashboard",
27 | element: ,
28 | },
29 | {
30 | path: "/users",
31 | element: ,
32 | },
33 | {
34 | path: "/users/new",
35 | element: ,
36 | },
37 | {
38 | path: "/users/:id",
39 | element: ,
40 | },
41 | {
42 | path: "/lifes",
43 | element: ,
44 | },
45 | {
46 | path: "/life-insurance",
47 | element: ,
48 | },
49 | // {
50 | // path: "/life",
51 | // element: ,
52 | // },
53 | {
54 | path: "/life-medical-info",
55 | element: ,
56 | },
57 | {
58 | path: "/insurance-target-details",
59 | element: ,
60 | },
61 | ],
62 | },
63 | {
64 | path: "/",
65 | element: ,
66 | children: [
67 | {
68 | path: "/login",
69 | element: ,
70 | },
71 | {
72 | path: "/signup",
73 | element: ,
74 | },
75 | {
76 | path: "/life",
77 | element: ,
78 | },
79 | {
80 | path: "/life-compare",
81 | element: ,
82 | },
83 | ],
84 | },
85 | {
86 | path: "*",
87 | element: ,
88 | },
89 | ]);
90 |
91 | export default router;
92 |
--------------------------------------------------------------------------------
/react-life-form/src/views/Login.jsx:
--------------------------------------------------------------------------------
1 | import { Link } from "react-router-dom";
2 | import axiosClient from "../axios-client.js";
3 | import { createRef, useState } from "react";
4 | import { useStateContext } from "../context/ContextProvider.jsx";
5 |
6 | export default function Login() {
7 | const emailRef = createRef();
8 | const passwordRef = createRef();
9 | const { setUser, setToken } = useStateContext();
10 | const [message, setMessage] = useState(null);
11 |
12 | const onSubmit = (ev) => {
13 | ev.preventDefault();
14 |
15 | const payload = {
16 | email: emailRef.current.value,
17 | password: passwordRef.current.value,
18 | };
19 | axiosClient
20 | .post("/login", payload)
21 | .then(({ data }) => {
22 | setUser(data.user);
23 | setToken(data.token);
24 | })
25 | .catch((err) => {
26 | const response = err.response;
27 | if (response && response.status === 422) {
28 | setMessage(response.data.message);
29 | }
30 | });
31 | };
32 |
33 | return (
34 |
59 | );
60 | }
61 |
--------------------------------------------------------------------------------
/react-life-form/src/views/NotFound.jsx:
--------------------------------------------------------------------------------
1 | export default function NotFound() {
2 | return (
3 |
4 |
404 صفحه پیدا نشد!!!؟؟
5 |
6 | );
7 | }
8 |
--------------------------------------------------------------------------------
/react-life-form/src/views/Signup.jsx:
--------------------------------------------------------------------------------
1 | import { Link } from "react-router-dom";
2 | import { createRef, useState } from "react";
3 | import axiosClient from "../axios-client.js";
4 | import { useStateContext } from "../context/ContextProvider.jsx";
5 |
6 | export default function Signup() {
7 | const nameRef = createRef();
8 | const emailRef = createRef();
9 | const passwordRef = createRef();
10 | const passwordConfirmationRef = createRef();
11 | const { setUser, setToken } = useStateContext();
12 | const [errors, setErrors] = useState(null);
13 |
14 | const onSubmit = (ev) => {
15 | ev.preventDefault();
16 |
17 | const payload = {
18 | name: nameRef.current.value,
19 | email: emailRef.current.value,
20 | password: passwordRef.current.value,
21 | password_confirmation: passwordConfirmationRef.current.value,
22 | };
23 | axiosClient
24 | .post("/signup", payload)
25 | .then(({ data }) => {
26 | setUser(data.user);
27 | setToken(data.token);
28 | })
29 | .catch((err) => {
30 | const response = err.response;
31 | if (response && response.status === 422) {
32 | setErrors(response.data.errors);
33 | }
34 | });
35 | };
36 |
37 | return (
38 |
72 | );
73 | }
74 |
--------------------------------------------------------------------------------
/react-life-form/src/views/UserForm.jsx:
--------------------------------------------------------------------------------
1 | import { useNavigate, useParams } from "react-router-dom";
2 | import { useEffect, useState } from "react";
3 | import axiosClient from "../axios-client.js";
4 | import { useStateContext } from "../context/ContextProvider.jsx";
5 |
6 | export default function UserForm() {
7 | const navigate = useNavigate();
8 | let { id } = useParams();
9 | const [user, setUser] = useState({
10 | id: null,
11 | name: "",
12 | email: "",
13 | password: "",
14 | password_confirmation: "",
15 | });
16 | const [errors, setErrors] = useState(null);
17 | const [loading, setLoading] = useState(false);
18 | const { setNotification } = useStateContext();
19 |
20 | if (id) {
21 | useEffect(() => {
22 | setLoading(true);
23 | axiosClient
24 | .get(`/users/${id}`)
25 | .then(({ data }) => {
26 | setLoading(false);
27 | setUser(data);
28 | })
29 | .catch(() => {
30 | setLoading(false);
31 | });
32 | }, []);
33 | }
34 |
35 | const onSubmit = (ev) => {
36 | ev.preventDefault();
37 | if (user.id) {
38 | axiosClient
39 | .put(`/users/${user.id}`, user)
40 | .then(() => {
41 | setNotification("کاربر بروزرسانی شد.!");
42 | navigate("/users");
43 | })
44 | .catch((err) => {
45 | const response = err.response;
46 | if (response && response.status === 422) {
47 | setErrors(response.data.errors);
48 | }
49 | });
50 | } else {
51 | axiosClient
52 | .post("/users", user)
53 | .then(() => {
54 | setNotification("کاربر ساخته شد.");
55 | navigate("/users");
56 | })
57 | .catch((err) => {
58 | const response = err.response;
59 | if (response && response.status === 422) {
60 | setErrors(response.data.errors);
61 | }
62 | });
63 | }
64 | };
65 |
66 | return (
67 | <>
68 | {user.id && Update User: {user.name}
}
69 | {!user.id && New User
}
70 |
71 | {loading &&
Loading...
}
72 | {errors && (
73 |
74 | {Object.keys(errors).map((key) => (
75 |
{errors[key][0]}
76 | ))}
77 |
78 | )}
79 | {!loading && (
80 |
114 | )}
115 |
116 | >
117 | );
118 | }
119 |
--------------------------------------------------------------------------------
/react-life-form/src/views/Users.jsx:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from "react";
2 | import axiosClient from "../axios-client.js";
3 | import { Link } from "react-router-dom";
4 | import { useStateContext } from "../context/ContextProvider.jsx";
5 |
6 | export default function Users() {
7 | const [users, setUsers] = useState([]);
8 | const [loading, setLoading] = useState(false);
9 | const { setNotification } = useStateContext();
10 |
11 | useEffect(() => {
12 | getUsers();
13 | }, []);
14 |
15 | const onDeleteClick = (user) => {
16 | if (!window.confirm("Are you sure you want to delete this user?")) {
17 | return;
18 | }
19 | axiosClient.delete(`/users/${user.id}`).then(() => {
20 | setNotification("User was successfully deleted");
21 | getUsers();
22 | });
23 | };
24 |
25 | const getUsers = () => {
26 | setLoading(true);
27 | axiosClient
28 | .get("/users")
29 | .then(({ data }) => {
30 | setLoading(false);
31 | setUsers(data.data);
32 | })
33 | .catch(() => {
34 | setLoading(false);
35 | });
36 | };
37 |
38 | return (
39 |
40 |
47 |
کاربران
48 |
49 | اضافه کردن کاربر
50 |
51 |
52 |
53 |
54 |
55 |
56 | آیدی |
57 | نام |
58 | ایمیل |
59 | تاریخ ایجاد |
60 | مدیریت |
61 |
62 |
63 | {loading && (
64 |
65 |
66 |
67 | در حال لود شدن...
68 | |
69 |
70 |
71 | )}
72 | {!loading && (
73 |
74 | {users.map((u) => (
75 |
76 | {u.id} |
77 | {u.name} |
78 | {u.email} |
79 | {u.created_at} |
80 |
81 |
85 | تغییر
86 |
87 |
88 |
94 | |
95 |
96 | ))}
97 |
98 | )}
99 |
100 |
101 |
102 | );
103 | }
104 |
--------------------------------------------------------------------------------
/react-life-form/src/views/form-0/InsuranceInfo.jsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import DateObject from "react-date-object";
3 | import persian from "react-date-object/calendars/persian";
4 | import persian_fa from "react-date-object/locales/persian_fa";
5 |
6 | function InsuranceInfo({ formData, setFormData }) {
7 | const now = new DateObject({
8 | date: new Date(),
9 | calendar: persian,
10 | locale: persian_fa,
11 | });
12 | const durations = [];
13 | if (now.year - parseInt(formData["birth_year"]) >= 59) {
14 | for (
15 | let i = 0;
16 | i < 65 - now.year + parseInt(formData["birth_year"]) + 1;
17 | i++
18 | ) {
19 | durations.push(i + 5);
20 | }
21 | } else {
22 | for (
23 | let i = 0;
24 | i < 64 - now.year + parseInt(formData["birth_year"]) + 11 && i < 26;
25 | i++
26 | ) {
27 | durations.push(i + 5);
28 | }
29 | }
30 |
31 | const handleChange = (e) => {
32 | setFormData({ ...formData, [e.target.name]: e.target.value });
33 | };
34 |
35 | const handleannualPayment = (e) => {
36 | setFormData({
37 | ...formData,
38 | [e.target.name]: parseInt(e.target.value.replace(/,/g, ""))
39 | ? parseInt(e.target.value.replace(/,/g, "")).toLocaleString()
40 | : 0,
41 | });
42 | };
43 |
44 | return (
45 |
46 |
66 |
83 |
91 |
92 | );
93 | }
94 |
95 | export default InsuranceInfo;
96 |
--------------------------------------------------------------------------------
/react-life-form/src/views/form-0/JobInfo.jsx:
--------------------------------------------------------------------------------
1 | import React, { useState } from "react";
2 | import Jobs from "../../Jobs.json";
3 |
4 | function JobInfo({ formData, setFormData }) {
5 | const [results, setResults] = useState([]);
6 |
7 | const search = (query) => {
8 | const results =
9 | query.target.value.length > 2
10 | ? Jobs.filter((value) => {
11 | return value.caption.toLowerCase().includes(
12 | query.target.value.toLowerCase()
13 | );
14 | })
15 | : [];
16 | setResults({ ...results, results });
17 | };
18 |
19 | const handleChange = (e) => {
20 | setFormData({
21 | ...formData,
22 | [e.target.name]: e.target.value,
23 | job_id: 0,
24 | });
25 | search(e);
26 | };
27 |
28 | return (
29 |
30 |
37 | {results.results?.map((item, index) => {
38 | if (index < 5) {
39 | return (
40 | {
42 | setFormData({
43 | ...formData,
44 | job_id: item.fanavaran_id.toString(),
45 | job: e.target.innerHTML,
46 | });
47 | setResults([]);
48 | }}
49 | key={index}
50 | className="job-offer"
51 | >
52 | {item.caption}
53 |
54 | );
55 | }
56 | })}
57 |
58 | );
59 | }
60 |
61 | export default JobInfo;
62 |
--------------------------------------------------------------------------------
/react-life-form/src/views/form-1/LifeCompareItem.jsx:
--------------------------------------------------------------------------------
1 | import { useState } from "react";
2 | import "./lifeCompareItem.css";
3 |
4 | const LifeCompareItem = (props) => {
5 | const {
6 | label,
7 | errorMessage,
8 | onChange,
9 | onClick,
10 | id,
11 | type,
12 | options,
13 | error,
14 | defaultValue,
15 | disabled,
16 | ...inputProps
17 | } = props;
18 | const [focused, setFocused] = useState(false);
19 |
20 | const handleFocus = (e) => {
21 | setFocused(true);
22 | };
23 |
24 | switch (type) {
25 | case "select":
26 | return (
27 |
28 |
29 |
56 | {errorMessage}
57 | {error}
58 |
59 | );
60 | break;
61 | default:
62 | return (
63 |
64 |
65 |
74 |
{errorMessage}
75 |
{error}
76 | {(inputProps.name == "first_job_level" ||
77 | inputProps.name == "second_job_level") && (
78 |
79 | {options?.map((item, index) => {
80 | if (index < 5) {
81 | return (
82 | -
88 | {item.caption}
89 |
90 | );
91 | }
92 | })}
93 |
94 | )}
95 |
96 | );
97 | break;
98 | }
99 | };
100 |
101 | export default LifeCompareItem;
102 |
--------------------------------------------------------------------------------
/react-life-form/src/views/form-1/lifeCompare.css:
--------------------------------------------------------------------------------
1 | .life-compare {
2 | display: flex;
3 | align-items: center;
4 | justify-content: right;
5 | padding-right: 1%;
6 | height: 100%;
7 | background-size: cover;
8 | background-position: center;
9 | }
10 |
11 | .life-compare-form {
12 | width: 40%;
13 | height: 100%;
14 | background-color: white;
15 | padding: 0px 60px;
16 | border-radius: 10px;
17 | background-color: rgba(0, 0, 0, 0.247);
18 | background-position: center;
19 | }
20 |
21 | .life-compare-h1 {
22 | color: rgb(77, 1, 77);
23 | text-align: center;
24 | margin: 35px;
25 | }
26 |
27 | .life-compare-button {
28 | width: 80%;
29 | height: 50px;
30 | padding: 10px;
31 | border: none;
32 | background-color: rebeccapurple;
33 | color: white;
34 | border-radius: 5px;
35 | font-weight: bold;
36 | font-size: 18px;
37 | cursor: pointer;
38 | margin-top: 15px;
39 | margin-bottom: 30px;
40 | margin-right: 10%;
41 | }
42 |
43 |
44 | .life-compare-nav {
45 | display: flex;
46 | width: 80%;
47 | height: 50px;
48 | padding: 10px;
49 | border: none;
50 | background-color: rgba(102, 51, 153, 0.457);
51 | color: white;
52 | border-radius: 5px;
53 | font-weight: bold;
54 | font-size: 18px;
55 | text-align: center;
56 | cursor: pointer;
57 | margin-top: 15px;
58 | margin-bottom: 30px;
59 | margin-right: 10%;
60 | align-items: center;
61 | justify-items: center;
62 | }
63 |
--------------------------------------------------------------------------------
/react-life-form/src/views/form-1/lifeCompareItem.css:
--------------------------------------------------------------------------------
1 | .life-compare-form-input {
2 | display: flex;
3 | flex-direction: column;
4 | width: 100%;
5 | }
6 |
7 | .life-compare-input {
8 | padding: 15px;
9 | margin: 10px 0px;
10 | border-radius: 5px;
11 | border: 1px solid gray;
12 | text-align: right;
13 | font-size: 16px;
14 | font-weight: 600;
15 | text-align: center;
16 | }
17 |
18 |
19 | .life-compare-label {
20 | font-size: 14px;
21 | color: gray;
22 | text-align: right;
23 | }
24 |
25 | .life-compare-span {
26 | font-size: 12px;
27 | padding: 3px;
28 | color: red;
29 | display: none;
30 | font-size: 14px;
31 | font-weight: 600;
32 | text-align: right;
33 | direction: rtl;
34 | }
35 | .life-compare-span-error {
36 | font-size: 12px;
37 | padding: 3px;
38 | color: red;
39 | font-size: 14px;
40 | font-weight: 600;
41 | text-align: right;
42 | direction: rtl;
43 | }
44 |
45 | input:invalid[focused="true"]{
46 | border: 2px solid red;
47 | }
48 |
49 | input:invalid[focused="true"] ~ span{
50 | display: block;
51 | }
52 |
53 | select:invalid[focused="true"]{
54 | border: 2px solid red;
55 | }
56 |
57 | select:invalid[focused="true"] ~ span{
58 | display: block;
59 | }
60 |
61 | .life-compare-form-select {
62 | display: flex;
63 | flex-direction: column;
64 | width: 100%;
65 | }
66 |
67 |
68 | .life-compare-select {
69 | padding: 15px;
70 | margin: 10px 0px;
71 | border-radius: 5px;
72 | border: 1px solid gray;
73 | text-align: right;
74 | font-size: 16px;
75 | font-weight: 600;
76 | text-align: center;
77 | }
78 |
79 | .life-compare-select-error {
80 | padding: 15px;
81 | margin: 10px 0px;
82 | border-radius: 5px;
83 | border: 1px solid gray;
84 | text-align: right;
85 | font-size: 16px;
86 | font-weight: 600;
87 | text-align: center;
88 | border: 2px solid red;
89 | }
90 |
91 | .ui-menu-item {
92 | cursor: pointer;
93 | font-weight: 600;
94 | border-radius: 5px;
95 | border: 1px solid gray;
96 | padding: 4px;
97 | margin: 2px;
98 | background-color: azure;
99 | text-align: center;
100 | }
--------------------------------------------------------------------------------
/react-life-form/src/views/form-2/LifeMedicalInfoItem.jsx:
--------------------------------------------------------------------------------
1 | import { useState } from "react";
2 | import "./lifeMedicalInfoItem.css";
3 |
4 | const LifeMedicalInfoItem = (props) => {
5 | const {
6 | label,
7 | errorMessage,
8 | onChange,
9 | onClick,
10 | id,
11 | type,
12 | options,
13 | error,
14 | defaultValue,
15 | disabled,
16 | ...inputProps
17 | } = props;
18 | const [focused, setFocused] = useState(false);
19 |
20 | const handleFocus = (e) => {
21 | setFocused(true);
22 | };
23 |
24 | switch (type) {
25 | case "select":
26 | return (
27 |
28 |
29 |
56 | {errorMessage}
57 | {error}
58 |
59 | );
60 | break;
61 | default:
62 | return (
63 |
64 |
65 |
78 | {errorMessage}
79 | {error}
80 |
81 | );
82 | break;
83 | }
84 | };
85 |
86 | export default LifeMedicalInfoItem;
87 |
--------------------------------------------------------------------------------
/react-life-form/src/views/form-2/lifeMedicalInfo.css:
--------------------------------------------------------------------------------
1 | .life-compare {
2 | display: flex;
3 | align-items: center;
4 | justify-content: right;
5 | padding-right: 1%;
6 | height: 100%;
7 | background-size: cover;
8 | background-position: center;
9 | }
10 |
11 | .life-medical-form {
12 | width: 80%;
13 | height: 100%;
14 | background-color: white;
15 | padding: 0px 60px;
16 | border-radius: 10px;
17 | background-color: rgba(0, 0, 0, 0.247);
18 | background-position: center;
19 | }
20 |
21 | .life-compare-h1 {
22 | color: rgb(77, 1, 77);
23 | text-align: center;
24 | margin: 35px;
25 | }
26 |
27 | .life-compare-button {
28 | width: 80%;
29 | height: 50px;
30 | padding: 10px;
31 | border: none;
32 | background-color: rebeccapurple;
33 | color: white;
34 | border-radius: 5px;
35 | font-weight: bold;
36 | font-size: 18px;
37 | cursor: pointer;
38 | margin-top: 15px;
39 | margin-bottom: 30px;
40 | margin-right: 10%;
41 | }
42 |
43 |
44 | .life-compare-nav {
45 | display: flex;
46 | width: 80%;
47 | height: 50px;
48 | padding: 10px;
49 | border: none;
50 | background-color: rgba(102, 51, 153, 0.457);
51 | color: white;
52 | border-radius: 5px;
53 | font-weight: bold;
54 | font-size: 18px;
55 | text-align: center;
56 | cursor: pointer;
57 | margin-top: 15px;
58 | margin-bottom: 30px;
59 | margin-right: 10%;
60 | align-items: center;
61 | justify-items: center;
62 | }
63 |
--------------------------------------------------------------------------------
/react-life-form/src/views/form-2/lifeMedicalInfoItem.css:
--------------------------------------------------------------------------------
1 | .life-compare-form-input {
2 | display: flex;
3 | flex-direction: column;
4 | width: 100%;
5 | }
6 |
7 | .life-compare-input {
8 | padding: 15px;
9 | margin: 10px 0px;
10 | border-radius: 5px;
11 | border: 1px solid gray;
12 | text-align: right;
13 | font-size: 16px;
14 | font-weight: 600;
15 | text-align: center;
16 | }
17 |
18 | .life-compare-input-error {
19 | padding: 15px;
20 | margin: 10px 0px;
21 | border-radius: 5px;
22 | border: 1px solid gray;
23 | text-align: right;
24 | font-size: 16px;
25 | font-weight: 600;
26 | text-align: center;
27 | border: 2px solid red;
28 | }
29 |
30 |
31 | .life-compare-label {
32 | font-size: 14px;
33 | color: gray;
34 | text-align: right;
35 | }
36 |
37 | .life-compare-span {
38 | font-size: 12px;
39 | padding: 3px;
40 | color: red;
41 | display: none;
42 | font-size: 14px;
43 | font-weight: 600;
44 | text-align: right;
45 | direction: rtl;
46 | }
47 | .life-compare-span-error {
48 | font-size: 12px;
49 | padding: 3px;
50 | color: red;
51 | font-size: 14px;
52 | font-weight: 600;
53 | text-align: right;
54 | direction: rtl;
55 | }
56 |
57 | input:invalid[focused="true"]{
58 | border: 2px solid red;
59 | }
60 |
61 | input:invalid[focused="true"] ~ span{
62 | display: block;
63 | }
64 |
65 | select:invalid[focused="true"]{
66 | border: 2px solid red;
67 | }
68 |
69 | select:invalid[focused="true"] ~ span{
70 | display: block;
71 | }
72 |
73 | .life-compare-form-select {
74 | display: flex;
75 | flex-direction: column;
76 | width: 100%;
77 | }
78 |
79 |
80 | .life-compare-select {
81 | padding: 15px;
82 | margin: 10px 0px;
83 | border-radius: 5px;
84 | border: 1px solid gray;
85 | text-align: right;
86 | font-size: 16px;
87 | font-weight: 600;
88 | text-align: center;
89 | }
90 |
91 | .life-compare-select-error {
92 | padding: 15px;
93 | margin: 10px 0px;
94 | border-radius: 5px;
95 | border: 1px solid gray;
96 | text-align: right;
97 | font-size: 16px;
98 | font-weight: 600;
99 | text-align: center;
100 | border: 2px solid red;
101 | }
102 |
103 | .ui-menu-item {
104 | cursor: pointer;
105 | font-weight: 600;
106 | border-radius: 5px;
107 | border: 1px solid gray;
108 | padding: 4px;
109 | margin: 2px;
110 | background-color: azure;
111 | text-align: center;
112 | }
--------------------------------------------------------------------------------
/react-life-form/src/views/form-3/InsuranceTargetDetailsHeir.jsx:
--------------------------------------------------------------------------------
1 | import { useState } from "react";
2 | import InsuranceTargetDetailsItem from "./InsuranceTargetDetailsItem";
3 | import "./insuranceTargetDetailsItem.css";
4 |
5 | const InsuranceTargetDetailsHeir = (props) => {
6 | const {
7 | values,
8 | errors,
9 | disableds,
10 | time,
11 | inputLength,
12 | } = props;
13 |
14 | const inputs = [];
15 | for (let i = 1; i < time + 1; i++) {
16 | inputs.push(
17 | {
18 | id: inputLength + i * 3 + 1 ,
19 | type: "text",
20 | label: "کد ملی",
21 | name: `national_codes[${i}]`,
22 | placeholder: "1234567890",
23 | errorMessage: ". کد ملی خود را وارد کنید!!",
24 | required: true,
25 | },
26 | {
27 | id: inputLength + i * 3 + 2 ,
28 | type: "select",
29 | label: "نسبت",
30 | name: `heir_targets[${i}]`,
31 | errorMessage: ". نسبت وارث را وارد کنید!!",
32 | required: true,
33 | options: [
34 | "خودم",
35 | "همسر",
36 | "فرزند",
37 | "پدر",
38 | "مادر",
39 | "خواهر",
40 | "برادر",
41 | ],
42 | },
43 | {
44 | id: inputLength + i * 3 + 3 ,
45 | type: "text",
46 | label: "درصد سهم",
47 | name: `heir_shares[${i}]`,
48 | placeholder: "10 %",
49 | errorMessage: ". درصد سهم را وارد کنید!!",
50 | required: true,
51 | }
52 | );
53 | }
54 |
55 | const onChange = (e) => {
56 | // setValues({ ...values, [e.target.name]: e.target.value });
57 | // setErrors({ ...errors, [e.target.name]: "" });
58 | handleChange(e);
59 | };
60 |
61 | const handleChange = (e) => {
62 | if ((new RegExp("national_codes").test(e.target.name))) {
63 | handleNationalCode(e);
64 | }else if ((new RegExp("heir_targets").test(e.target.name))) {
65 | handleHeirTargets(e);
66 | }else if ((new RegExp("heir_shares").test(e.target.name))) {
67 | handleHeirShares(e);
68 | }
69 | };
70 |
71 | const handleNationalCode = (e) => {
72 | values.national_codes[e.target.name[e.target.name.length - 2]] = e.target.value;
73 | };
74 |
75 | const handleHeirTargets = (e) => {
76 | values.heir_targets[e.target.name[e.target.name.length - 2]] = e.target.value;
77 | };
78 |
79 | const handleHeirShares = (e) => {
80 | values.heir_shares[e.target.name[e.target.name.length - 2]] = e.target.value;
81 | };
82 | return (
83 | <>
84 | {inputs.map((input) => (
85 |
94 | ))}
95 | >
96 | );
97 | };
98 |
99 | export default InsuranceTargetDetailsHeir;
100 |
--------------------------------------------------------------------------------
/react-life-form/src/views/form-3/InsuranceTargetDetailsItem.jsx:
--------------------------------------------------------------------------------
1 | import { useState } from "react";
2 | import "./insuranceTargetDetailsItem.css";
3 |
4 | const InsuranceTargetDetailsItem = (props) => {
5 | const {
6 | label,
7 | errorMessage,
8 | onChange,
9 | onClick,
10 | id,
11 | type,
12 | options,
13 | error,
14 | defaultValue,
15 | disabled,
16 | heirsElement,
17 | heirs,
18 | ...inputProps
19 | } = props;
20 | const [focused, setFocused] = useState(false);
21 |
22 | const handleFocus = (e) => {
23 | setFocused(true);
24 | };
25 |
26 | switch (type) {
27 | case "select":
28 | return (
29 |
30 |
31 |
58 |
{errorMessage}
59 |
{error}
60 | {(inputProps.name == "user_if_dead" && inputProps.value == 0) && (
61 |
62 | {heirs < 4 && (
)}
63 | {heirs > 1 && (
)}
64 |
65 |
66 |
67 | )}
68 | {(inputProps.name == "user_if_dead" && inputProps.value == 0) && (heirsElement)}
69 |
70 | );
71 | break;
72 | default:
73 | return (
74 |
75 |
76 |
89 | {errorMessage}
90 | {error}
91 |
92 | );
93 | break;
94 | }
95 | };
96 |
97 | export default InsuranceTargetDetailsItem;
98 |
--------------------------------------------------------------------------------
/react-life-form/src/views/form-3/insuranceTargetDetails.css:
--------------------------------------------------------------------------------
1 | .life-compare {
2 | display: flex;
3 | align-items: center;
4 | justify-content: right;
5 | padding-right: 1%;
6 | height: 100%;
7 | background-size: cover;
8 | background-position: center;
9 | }
10 |
11 | .life-medical-form {
12 | width: 80%;
13 | height: 100%;
14 | background-color: white;
15 | padding: 0px 60px;
16 | border-radius: 10px;
17 | background-color: rgba(0, 0, 0, 0.247);
18 | background-position: center;
19 | }
20 |
21 | .life-compare-h1 {
22 | color: rgb(77, 1, 77);
23 | text-align: center;
24 | margin: 35px;
25 | }
26 |
27 | .life-compare-button {
28 | width: 80%;
29 | height: 50px;
30 | padding: 10px;
31 | border: none;
32 | background-color: rebeccapurple;
33 | color: white;
34 | border-radius: 5px;
35 | font-weight: bold;
36 | font-size: 18px;
37 | cursor: pointer;
38 | margin-top: 15px;
39 | margin-bottom: 30px;
40 | margin-right: 10%;
41 | }
42 |
43 |
44 | .life-compare-nav {
45 | display: flex;
46 | width: 80%;
47 | height: 50px;
48 | padding: 10px;
49 | border: none;
50 | background-color: rgba(102, 51, 153, 0.457);
51 | color: white;
52 | border-radius: 5px;
53 | font-weight: bold;
54 | font-size: 18px;
55 | text-align: center;
56 | cursor: pointer;
57 | margin-top: 15px;
58 | margin-bottom: 30px;
59 | margin-right: 10%;
60 | align-items: center;
61 | justify-items: center;
62 | }
63 |
--------------------------------------------------------------------------------
/react-life-form/src/views/form-3/insuranceTargetDetailsItem.css:
--------------------------------------------------------------------------------
1 | .life-compare-form-input {
2 | display: flex;
3 | flex-direction: column;
4 | width: 100%;
5 | }
6 |
7 | .life-compare-input {
8 | padding: 15px;
9 | margin: 10px 0px;
10 | border-radius: 5px;
11 | border: 1px solid gray;
12 | text-align: right;
13 | font-size: 16px;
14 | font-weight: 600;
15 | text-align: center;
16 | }
17 |
18 | .life-compare-input-error {
19 | padding: 15px;
20 | margin: 10px 0px;
21 | border-radius: 5px;
22 | border: 1px solid gray;
23 | text-align: right;
24 | font-size: 16px;
25 | font-weight: 600;
26 | text-align: center;
27 | border: 2px solid red;
28 | }
29 |
30 |
31 | .life-compare-label {
32 | font-size: 14px;
33 | color: gray;
34 | text-align: right;
35 | }
36 |
37 | .life-compare-span {
38 | font-size: 12px;
39 | padding: 3px;
40 | color: red;
41 | display: none;
42 | font-size: 14px;
43 | font-weight: 600;
44 | text-align: right;
45 | direction: rtl;
46 | }
47 | .life-compare-span-error {
48 | font-size: 12px;
49 | padding: 3px;
50 | color: red;
51 | font-size: 14px;
52 | font-weight: 600;
53 | text-align: right;
54 | direction: rtl;
55 | }
56 |
57 | input:invalid[focused="true"]{
58 | border: 2px solid red;
59 | }
60 |
61 | input:invalid[focused="true"] ~ span{
62 | display: block;
63 | }
64 |
65 | select:invalid[focused="true"]{
66 | border: 2px solid red;
67 | }
68 |
69 | select:invalid[focused="true"] ~ span{
70 | display: block;
71 | }
72 |
73 | .life-compare-form-select {
74 | display: flex;
75 | flex-direction: column;
76 | width: 100%;
77 | }
78 |
79 |
80 | .life-compare-select {
81 | padding: 15px;
82 | margin: 10px 0px;
83 | border-radius: 5px;
84 | border: 1px solid gray;
85 | text-align: right;
86 | font-size: 16px;
87 | font-weight: 600;
88 | text-align: center;
89 | }
90 |
91 | .life-compare-select-error {
92 | padding: 15px;
93 | margin: 10px 0px;
94 | border-radius: 5px;
95 | border: 1px solid gray;
96 | text-align: right;
97 | font-size: 16px;
98 | font-weight: 600;
99 | text-align: center;
100 | border: 2px solid red;
101 | }
102 |
103 | .ui-menu-item {
104 | cursor: pointer;
105 | font-weight: 600;
106 | border-radius: 5px;
107 | border: 1px solid gray;
108 | padding: 4px;
109 | margin: 2px;
110 | background-color: azure;
111 | text-align: center;
112 | }
113 |
114 | .heir-add-button {
115 | width: 30%;
116 | height: 40px;
117 | border: none;
118 | background-color: rebeccapurple;
119 | color: white;
120 | border-radius: 5px;
121 | font-weight: bold;
122 | font-size: 15px;
123 | cursor: pointer;
124 | margin-top: 15px;
125 | margin-bottom: 30px;
126 | }
127 |
128 | .heir-remove-button {
129 | width: 20%;
130 | height: 40px;
131 | border: none;
132 | background-color: rebeccapurple;
133 | color: white;
134 | border-radius: 5px;
135 | font-weight: bold;
136 | font-size: 15px;
137 | cursor: pointer;
138 | margin-top: 15px;
139 | margin-bottom: 30px;
140 | margin-right: 50%;
141 | display: inline-block;
142 | direction: ltr;
143 | justify-self: start;
144 | }
145 |
--------------------------------------------------------------------------------
/react-life-form/vite.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import react from '@vitejs/plugin-react'
3 |
4 | // https://vitejs.dev/config/
5 | export default defineConfig({
6 | plugins: [react()],
7 | })
8 |
--------------------------------------------------------------------------------
/resources/css/app.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mh97m/React-Life/fd3af697dd3a89a60f1d3b44aeb94cec90c34239/resources/css/app.css
--------------------------------------------------------------------------------
/resources/js/app.js:
--------------------------------------------------------------------------------
1 | import './bootstrap';
2 |
--------------------------------------------------------------------------------
/resources/js/bootstrap.js:
--------------------------------------------------------------------------------
1 | import _ from 'lodash';
2 | window._ = _;
3 |
4 | /**
5 | * We'll load the axios HTTP library which allows us to easily issue requests
6 | * to our Laravel back-end. This library automatically handles sending the
7 | * CSRF token as a header based on the value of the "XSRF" token cookie.
8 | */
9 |
10 | import axios from 'axios';
11 | window.axios = axios;
12 |
13 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
14 |
15 | /**
16 | * Echo exposes an expressive API for subscribing to channels and listening
17 | * for events that are broadcast by Laravel. Echo and event broadcasting
18 | * allows your team to easily build robust real-time web applications.
19 | */
20 |
21 | // import Echo from 'laravel-echo';
22 |
23 | // import Pusher from 'pusher-js';
24 | // window.Pusher = Pusher;
25 |
26 | // window.Echo = new Echo({
27 | // broadcaster: 'pusher',
28 | // key: import.meta.env.VITE_PUSHER_APP_KEY,
29 | // cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1',
30 | // wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`,
31 | // wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80,
32 | // wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443,
33 | // forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https',
34 | // enabledTransports: ['ws', 'wss'],
35 | // });
36 |
--------------------------------------------------------------------------------
/routes/api.php:
--------------------------------------------------------------------------------
1 | group(function () {
22 | Route::post('/logout', [AuthController::class, 'logout']);
23 | Route::get('/user', function (Request $request) {
24 | return $request->user();
25 | });
26 |
27 | Route::get('/assgin-insurance-to-user/{insurance}', [LifeInsurancesController::class, 'assginInsuranceToUser']);
28 |
29 | Route::apiResource('/users', UserController::class);
30 |
31 | Route::get('/lifes', [LifeInsurancesController::class, 'all']);
32 | Route::delete('/lifes/{insurance}', [LifeInsurancesController::class, 'destroy']);
33 |
34 | Route::post('/check-national-code', [LifeInsurancesController::class, 'checkNationalCode']);
35 |
36 | Route::post('/send-verification-code', [LifeInsurancesController::class, 'sendVerificationCode']);
37 |
38 | Route::post('/life-medical-info', [LifeInsurancesController::class, 'storeLifeMedicalInfo']);
39 |
40 | Route::get('/export-excel/{id}', [LifeInsurancesController::class, 'exportExcel']);
41 |
42 | Route::get('/export-pdf/{id}', [LifeInsurancesController::class, 'exportPdf']);
43 | });
44 |
45 | Route::post('/signup', [AuthController::class, 'signup']);
46 | Route::post('/login', [AuthController::class, 'login']);
47 | Route::post('/life-compare', [LifeInsurancesController::class, 'storeLifeCompare']);
48 |
49 | Route::prefix('v1')->group(function () {
50 | Route::get('/get-jobs', function () {
51 | return Job::get(['fanavaran_id', 'caption']);
52 | });
53 | Route::get('/update-jobs', function () {
54 | $data = json_encode(Job::get(['fanavaran_id', 'caption']), JSON_UNESCAPED_UNICODE );
55 | if ($data != file_get_contents(base_path('react-life-form/src/jobs.json'))) {
56 | file_put_contents(base_path('react-life-form/src/jobs.json'), $data);
57 | return response(true);
58 | }
59 | return response(false);
60 | });
61 | });
62 |
--------------------------------------------------------------------------------
/routes/channels.php:
--------------------------------------------------------------------------------
1 | id === (int) $id;
18 | });
19 |
--------------------------------------------------------------------------------
/routes/console.php:
--------------------------------------------------------------------------------
1 | comment(Inspiring::quote());
19 | })->purpose('Display an inspiring quote');
20 |
--------------------------------------------------------------------------------
/routes/web.php:
--------------------------------------------------------------------------------
1 | get());
22 | dd($data);
23 |
24 | // return view('pdf.index', ['data' => $data->resource->toArray()]);
25 |
26 | // dd((LifeInsurance::inRandomOrder()->first())->birth_day);
27 |
28 | // return Excel::download(new LifeInsuranceExport(5), 'life-' . '5' . '.xlsx');
29 |
30 | // $data = new LifeInsuranceResource(LifeInsurance::find(12));
31 | // $pdf = SnappyPdf::loadView('pdf.index', ['data' => $data->resource->toArray()]);
32 | // return $pdf->inline('github.pdf');
33 | });
34 |
35 | Route::get('/{uri?}', function () {
36 | return view('welcome');
37 | })->where('uri', '(.*)');
38 |
39 | //$2y$10$1HTtUKUoX.Sp9wLfub/UqeJvP/pG8p4fMbRkjnxTRamMQEv.KOqKu
40 | //$2y$10$cEFYSWLYb2wZffPqpG/HJOnGt0fGpgHfungdM/3KRD1HnLLjZoWh.
41 |
42 |
43 | //6fac72b170b609bd7cbb3091f7d9f66d
44 | //6fac72b170b609bd7cbb3091f7d9f66d
--------------------------------------------------------------------------------
/storage/app/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !public/
3 | !.gitignore
4 |
--------------------------------------------------------------------------------
/storage/app/public/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/.gitignore:
--------------------------------------------------------------------------------
1 | compiled.php
2 | config.php
3 | down
4 | events.scanned.php
5 | maintenance.php
6 | routes.php
7 | routes.scanned.php
8 | schedule-*
9 | services.json
10 |
--------------------------------------------------------------------------------
/storage/framework/cache/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !data/
3 | !.gitignore
4 |
--------------------------------------------------------------------------------
/storage/framework/cache/data/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/sessions/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/testing/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/views/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/logs/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/tests/CreatesApplication.php:
--------------------------------------------------------------------------------
1 | make(Kernel::class)->bootstrap();
19 |
20 | return $app;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/Feature/ExampleTest.php:
--------------------------------------------------------------------------------
1 | get('/');
18 |
19 | $response->assertStatus(200);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tests/TestCase.php:
--------------------------------------------------------------------------------
1 | assertTrue(true);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/vite.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 | import laravel from 'laravel-vite-plugin';
3 |
4 | export default defineConfig({
5 | plugins: [
6 | laravel({
7 | input: ['resources/css/app.css', 'resources/js/app.js'],
8 | refresh: true,
9 | }),
10 | ],
11 | });
12 |
--------------------------------------------------------------------------------