working on loan orders
This commit is contained in:
@@ -31,6 +31,7 @@ class Branch extends Model
|
|||||||
'billing_username',
|
'billing_username',
|
||||||
'billing_password',
|
'billing_password',
|
||||||
'address',
|
'address',
|
||||||
|
'active',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
13
app/Models/Order/Loan/LoanOrder.php
Normal file
13
app/Models/Order/Loan/LoanOrder.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Order\Loan;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
|
class LoanOrder extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
use SoftDeletes;
|
||||||
|
}
|
||||||
33
app/Models/Order/Loan/LoanType.php
Normal file
33
app/Models/Order/Loan/LoanType.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Order\Loan;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Spatie\Translatable\HasTranslations;
|
||||||
|
|
||||||
|
class LoanType extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
use HasTranslations;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'name',
|
||||||
|
'tax',
|
||||||
|
'maturity',
|
||||||
|
'notes',
|
||||||
|
'active',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translatable fields
|
||||||
|
*
|
||||||
|
* @var array<string>
|
||||||
|
*/
|
||||||
|
public $translatable = ['name', 'notes'];
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@ class Province extends Model
|
|||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'region',
|
'region',
|
||||||
'name',
|
'name',
|
||||||
|
'active',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ use Laravel\Nova\Fields\Text;
|
|||||||
use Laravel\Nova\Fields\Textarea;
|
use Laravel\Nova\Fields\Textarea;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
use Laravel\Nova\Resource;
|
use Laravel\Nova\Resource;
|
||||||
|
use Trin4ik\NovaSwitcher\NovaSwitcher;
|
||||||
|
|
||||||
class Branch extends Resource
|
class Branch extends Resource
|
||||||
{
|
{
|
||||||
@@ -89,6 +90,9 @@ class Branch extends Resource
|
|||||||
->rules('nullable', 'string', 'max:255'),
|
->rules('nullable', 'string', 'max:255'),
|
||||||
|
|
||||||
Textarea::make(__('Address'), 'address'),
|
Textarea::make(__('Address'), 'address'),
|
||||||
|
|
||||||
|
NovaSwitcher::make(__('Active'), 'active')
|
||||||
|
->default(true),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
111
app/Nova/Resources/Order/Loan/LoanType.php
Normal file
111
app/Nova/Resources/Order/Loan/LoanType.php
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Nova\Resources\Order\Loan;
|
||||||
|
|
||||||
|
use App\Nova\Resource;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Laravel\Nova\Fields\ID;
|
||||||
|
use Laravel\Nova\Fields\Number;
|
||||||
|
use Laravel\Nova\Fields\Text;
|
||||||
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
|
use Trin4ik\NovaSwitcher\NovaSwitcher;
|
||||||
|
use \App\Models\Order\Loan\LoanType as LoanTypeModel;
|
||||||
|
|
||||||
|
class LoanType extends Resource
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The model the resource corresponds to.
|
||||||
|
*
|
||||||
|
* @var class-string<LoanTypeModel>
|
||||||
|
*/
|
||||||
|
public static $model = LoanTypeModel::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The single value that should be used to represent the resource when being displayed.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public static $title = 'name';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The columns that should be searched.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $search = [
|
||||||
|
'name',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the fields displayed by the resource.
|
||||||
|
*
|
||||||
|
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function fields(NovaRequest $request): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
ID::make()->sortable(),
|
||||||
|
|
||||||
|
Text::make(__('Name'), 'name')
|
||||||
|
->rules('required', 'string', 'max:255')
|
||||||
|
->translatable(),
|
||||||
|
|
||||||
|
Number::make(__('Tax'), 'tax')
|
||||||
|
->rules('required', 'numeric', 'max:100'),
|
||||||
|
|
||||||
|
Text::make(__('Maturity'), 'maturity')
|
||||||
|
->rules('required', 'string', 'max:255'),
|
||||||
|
|
||||||
|
Text::make(__('Notes'), 'notes')
|
||||||
|
->rules('required', 'string', 'max:255'),
|
||||||
|
|
||||||
|
NovaSwitcher::make(__('Active'), 'active')
|
||||||
|
->default(true),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the cards available for the request.
|
||||||
|
*
|
||||||
|
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function cards(NovaRequest $request): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the filters available for the resource.
|
||||||
|
*
|
||||||
|
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function filters(NovaRequest $request): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the lenses available for the resource.
|
||||||
|
*
|
||||||
|
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function lenses(NovaRequest $request): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the actions available for the resource.
|
||||||
|
*
|
||||||
|
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function actions(NovaRequest $request): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ use Laravel\Nova\Fields\ID;
|
|||||||
use Laravel\Nova\Fields\Select;
|
use Laravel\Nova\Fields\Select;
|
||||||
use Laravel\Nova\Fields\Text;
|
use Laravel\Nova\Fields\Text;
|
||||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||||
|
use Trin4ik\NovaSwitcher\NovaSwitcher;
|
||||||
|
|
||||||
class Province extends Resource
|
class Province extends Resource
|
||||||
{
|
{
|
||||||
@@ -25,7 +26,7 @@ class Province extends Resource
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public static $title = 'id';
|
public static $title = 'name';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The columns that should be searched.
|
* The columns that should be searched.
|
||||||
@@ -70,6 +71,9 @@ class Province extends Resource
|
|||||||
|
|
||||||
Text::make(__('Name'), 'name')
|
Text::make(__('Name'), 'name')
|
||||||
->rules('required', 'string', 'max:255'),
|
->rules('required', 'string', 'max:255'),
|
||||||
|
|
||||||
|
NovaSwitcher::make(__('Active'), 'active')
|
||||||
|
->default(true),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use App\Nova\Resources\Branch\Branch;
|
use App\Nova\Resources\Branch\Branch;
|
||||||
|
use App\Nova\Resources\Order\Loan\LoanType;
|
||||||
use App\Nova\Resources\System\Location\Province;
|
use App\Nova\Resources\System\Location\Province;
|
||||||
use App\Nova\Resources\System\Roles\Permission;
|
use App\Nova\Resources\System\Roles\Permission;
|
||||||
use App\Nova\Resources\System\Roles\Role;
|
use App\Nova\Resources\System\Roles\Role;
|
||||||
@@ -117,11 +118,14 @@ class NovaServiceProvider extends NovaApplicationServiceProvider
|
|||||||
MenuItem::resource(Permission::class),
|
MenuItem::resource(Permission::class),
|
||||||
])->collapsable(),
|
])->collapsable(),
|
||||||
|
|
||||||
|
MenuGroup::make(__('Loans'), [
|
||||||
|
MenuItem::resource(LoanType::class),
|
||||||
|
])->collapsable(),
|
||||||
|
|
||||||
MenuGroup::make(__('Location'), [
|
MenuGroup::make(__('Location'), [
|
||||||
MenuItem::resource(Province::class),
|
MenuItem::resource(Province::class),
|
||||||
MenuItem::resource(Branch::class),
|
MenuItem::resource(Branch::class),
|
||||||
])->collapsable(),
|
])->collapsable(),
|
||||||
|
|
||||||
])->icon('cog')->collapsable(),
|
])->icon('cog')->collapsable(),
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -13,7 +13,8 @@
|
|||||||
"laravel/tinker": "^2.8",
|
"laravel/tinker": "^2.8",
|
||||||
"outl1ne/nova-translatable": "^2.2",
|
"outl1ne/nova-translatable": "^2.2",
|
||||||
"spatie/laravel-permission": "^6.1",
|
"spatie/laravel-permission": "^6.1",
|
||||||
"spatie/laravel-translatable": "^6.5"
|
"spatie/laravel-translatable": "^6.5",
|
||||||
|
"trin4ik/nova-switcher": "^0.4.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"fakerphp/faker": "^1.9.1",
|
"fakerphp/faker": "^1.9.1",
|
||||||
|
|||||||
48
composer.lock
generated
48
composer.lock
generated
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "db74e81011c0c297cac0a68bbe058ea3",
|
"content-hash": "09947809353f3e7cb6ef72488a67a75d",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "brick/math",
|
"name": "brick/math",
|
||||||
@@ -6765,6 +6765,52 @@
|
|||||||
},
|
},
|
||||||
"time": "2023-01-03T09:29:04+00:00"
|
"time": "2023-01-03T09:29:04+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "trin4ik/nova-switcher",
|
||||||
|
"version": "v0.4",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/trin4ik/nova-switcher.git",
|
||||||
|
"reference": "06b7dc8cbe842bf0943c161f9335546dbe6dd30c"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/trin4ik/nova-switcher/zipball/06b7dc8cbe842bf0943c161f9335546dbe6dd30c",
|
||||||
|
"reference": "06b7dc8cbe842bf0943c161f9335546dbe6dd30c",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"laravel/nova": "^4.0",
|
||||||
|
"php": "^8.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"Trin4ik\\NovaSwitcher\\FieldServiceProvider"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Trin4ik\\NovaSwitcher\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"description": "A Laravel Nova switcher field.",
|
||||||
|
"keywords": [
|
||||||
|
"laravel",
|
||||||
|
"nova"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/trin4ik/nova-switcher/issues",
|
||||||
|
"source": "https://github.com/trin4ik/nova-switcher/tree/v0.4"
|
||||||
|
},
|
||||||
|
"time": "2023-11-01T05:33:29+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "vlucas/phpdotenv",
|
"name": "vlucas/phpdotenv",
|
||||||
"version": "v5.6.0",
|
"version": "v5.6.0",
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ return new class extends Migration
|
|||||||
$table->id();
|
$table->id();
|
||||||
$table->string('region', 2)->index();
|
$table->string('region', 2)->index();
|
||||||
$table->jsonb('name');
|
$table->jsonb('name');
|
||||||
|
$table->boolean('active')->default(true);
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,11 @@ return new class extends Migration
|
|||||||
$table->string('unique_code')->index()->nullable();
|
$table->string('unique_code')->index()->nullable();
|
||||||
|
|
||||||
$table->string('region', 2)->index();
|
$table->string('region', 2)->index();
|
||||||
$table->foreignId('province_id')->nullable()->constrained()->nullOnDelete();
|
$table->foreignId('province_id')->nullable()->constrained()->restrictOnDelete();
|
||||||
|
|
||||||
$table->string('billing_username')->nullable();
|
$table->string('billing_username')->nullable();
|
||||||
$table->string('billing_password')->nullable();
|
$table->string('billing_password')->nullable();
|
||||||
|
$table->boolean('active')->default(true);
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('loan_types', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->jsonb('name');
|
||||||
|
$table->string('tax')->nullable();
|
||||||
|
$table->string('maturity')->nullable();
|
||||||
|
$table->string('notes')->nullable();
|
||||||
|
$table->boolean('active')->default(true);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('loan_orders');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('loan_orders', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('unique_id')->unique();
|
||||||
|
|
||||||
|
$table->foreignId('loan_type')->constrained()->restrictOnDelete();
|
||||||
|
|
||||||
|
$table->string('region', 2)->index();
|
||||||
|
$table->foreignId('branch_id')->constrained()->restrictOnDelete();
|
||||||
|
|
||||||
|
$table->string('customer_name')->index();
|
||||||
|
$table->string('customer_surname')->index();
|
||||||
|
$table->string('customer_patronic_name')->nullable();
|
||||||
|
|
||||||
|
$table->string('passport_address');
|
||||||
|
$table->string('real_address');
|
||||||
|
|
||||||
|
$table->string('passport_serie')->index();
|
||||||
|
$table->integer('passport_id')->index();
|
||||||
|
$table->date('passport_given_at');
|
||||||
|
$table->string('passport_given_by');
|
||||||
|
|
||||||
|
$table->string('born_place');
|
||||||
|
$table->date('born_at');
|
||||||
|
|
||||||
|
$table->string('email')->nullable()->index();
|
||||||
|
$table->string('phone')->index();
|
||||||
|
$table->string('phone_additional')->nullable();
|
||||||
|
$table->string('phone_home')->nullable();
|
||||||
|
|
||||||
|
$table->string('work_region')->nullable()->index();
|
||||||
|
$table->string('work_province')->nullable();
|
||||||
|
$table->string('work_company')->nullable();
|
||||||
|
$table->string('work_company_accountant_number')->nullable();
|
||||||
|
$table->date('work_started_at')->nullable();
|
||||||
|
$table->string('work_salary')->nullable();
|
||||||
|
$table->string('work_position')->nullable();
|
||||||
|
|
||||||
|
$table->string('education');
|
||||||
|
$table->string('marriage_status');
|
||||||
|
|
||||||
|
$table->text('passport_one');
|
||||||
|
$table->text('passport_two');
|
||||||
|
$table->text('passport_three');
|
||||||
|
$table->text('passport_four');
|
||||||
|
|
||||||
|
$table->foreignId('filled_by')->constrained('users')->restrictOnDelete();
|
||||||
|
$table->foreignId('user_id')->constrained('users')->restrictOnDelete();
|
||||||
|
|
||||||
|
$table->string('status')->index();
|
||||||
|
$table->string('status_reason')->nullable();
|
||||||
|
|
||||||
|
$table->string('notes')->nullable();
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
$table->softDeletes();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('loan_orders');
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user