Add RFID/NFC and consumable fields to assets
This commit is contained in:
@@ -37,6 +37,13 @@ class Asset extends Model
|
||||
'qr_token',
|
||||
'qr_path',
|
||||
'metadata',
|
||||
'rfid_tag',
|
||||
'nfc_tag',
|
||||
'label_template',
|
||||
'is_consumable',
|
||||
'quantity',
|
||||
'available_quantity',
|
||||
'is_pool',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
@@ -45,6 +52,8 @@ class Asset extends Model
|
||||
'warranty_reminder_sent_at' => 'datetime',
|
||||
'residual_value' => 'decimal:2',
|
||||
'metadata' => 'array',
|
||||
'is_consumable' => 'boolean',
|
||||
'is_pool' => 'boolean',
|
||||
];
|
||||
|
||||
public function status()
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('assets', function (Blueprint $table) {
|
||||
$table->string('rfid_tag')->nullable()->unique()->after('qr_path');
|
||||
$table->string('nfc_tag')->nullable()->unique()->after('rfid_tag');
|
||||
$table->string('label_template')->nullable()->after('nfc_tag');
|
||||
$table->boolean('is_consumable')->default(false)->after('label_template');
|
||||
$table->unsignedInteger('quantity')->default(1)->after('is_consumable');
|
||||
$table->unsignedInteger('available_quantity')->nullable()->after('quantity');
|
||||
$table->boolean('is_pool')->default(false)->after('available_quantity');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('assets', function (Blueprint $table) {
|
||||
$table->dropColumn([
|
||||
'rfid_tag',
|
||||
'nfc_tag',
|
||||
'label_template',
|
||||
'is_consumable',
|
||||
'quantity',
|
||||
'available_quantity',
|
||||
'is_pool',
|
||||
]);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -24,9 +24,14 @@ class SettingSeeder extends Seeder
|
||||
// Aset
|
||||
['key' => 'asset.code_prefix', 'value' => 'AST', 'type' => 'string', 'group' => 'asset'],
|
||||
['key' => 'asset.qr_enabled', 'value' => true, 'type' => 'boolean', 'group' => 'asset'],
|
||||
['key' => 'asset.rfid_enabled', 'value' => false, 'type' => 'boolean', 'group' => 'asset', 'description' => 'Aktifkan input tag RFID'],
|
||||
['key' => 'asset.nfc_enabled', 'value' => false, 'type' => 'boolean', 'group' => 'asset', 'description' => 'Aktifkan input tag NFC'],
|
||||
['key' => 'asset.label_template', 'value' => 'default', 'type' => 'string', 'group' => 'asset', 'description' => 'Template label/printing default'],
|
||||
['key' => 'asset.warranty_reminder_days', 'value' => 30, 'type' => 'integer', 'group' => 'asset'],
|
||||
['key' => 'asset.depreciation_method', 'value' => 'straight_line', 'type' => 'string', 'group' => 'asset'],
|
||||
['key' => 'asset.attachment_max_size_mb', 'value' => 20, 'type' => 'integer', 'group' => 'asset', 'description' => 'Batas upload lampiran aset (MB)'],
|
||||
['key' => 'asset.batch_update_enabled', 'value' => true, 'type' => 'boolean', 'group' => 'asset', 'description' => 'Izinkan batch update aset sejenis'],
|
||||
['key' => 'asset.consumable_enabled', 'value' => true, 'type' => 'boolean', 'group' => 'asset', 'description' => 'Aktifkan stok consumable/pool pinjaman'],
|
||||
|
||||
// Keamanan & audit
|
||||
['key' => 'security.audit_log', 'value' => true, 'type' => 'boolean', 'group' => 'security', 'description' => 'Aktifkan audit log aktivitas'],
|
||||
@@ -38,6 +43,12 @@ class SettingSeeder extends Seeder
|
||||
// Maintenance
|
||||
['key' => 'maintenance.readonly_mode', 'value' => false, 'type' => 'boolean', 'group' => 'maintenance', 'description' => 'Jika true, seluruh fitur tulis dimatikan'],
|
||||
['key' => 'maintenance.window', 'value' => null, 'type' => 'string', 'group' => 'maintenance', 'description' => 'Jadwal maintenance terencana'],
|
||||
|
||||
// Integrasi & API
|
||||
['key' => 'integration.api_key', 'value' => 'changeme-api-key', 'type' => 'string', 'group' => 'integration', 'description' => 'API Key untuk akses REST publik'],
|
||||
['key' => 'integration.webhook_enabled', 'value' => false, 'type' => 'boolean', 'group' => 'integration', 'description' => 'Aktifkan webhook untuk event aset'],
|
||||
['key' => 'integration.webhook_url', 'value' => null, 'type' => 'string', 'group' => 'integration', 'description' => 'Endpoint webhook ERP/CMMS/Helpdesk'],
|
||||
['key' => 'integration.webhook_secret', 'value' => null, 'type' => 'string', 'group' => 'integration', 'description' => 'Secret untuk memverifikasi signature webhook'],
|
||||
];
|
||||
|
||||
foreach ($settings as $setting) {
|
||||
|
||||
Reference in New Issue
Block a user