diff --git a/app/Exports/BranchExport.php b/app/Exports/BranchExport.php index 0a62ebc..67d3373 100644 --- a/app/Exports/BranchExport.php +++ b/app/Exports/BranchExport.php @@ -28,6 +28,7 @@ $query->where(function ($q) use ($search) { $q->whereRaw('LOWER(code) LIKE ?', ['%' . $search . '%']) ->orWhereRaw('LOWER(name) LIKE ?', ['%' . $search . '%']) + ->orWhereRaw('LOWER(address) LIKE ?', ['%' . $search . '%']) ->orWhereHas('parent', function ($q) use ($search) { $q->whereRaw('LOWER(name) LIKE ?', ['%' . strtolower($search) . '%']); }); @@ -51,6 +52,7 @@ $row->code, $row->name, $row->parent ? $row->parent->name : '', + $row->address, $row->created_at ]; } @@ -63,6 +65,7 @@ 'Code', 'Name', 'Parent Branch', + 'Address', 'Created At' ]; } @@ -72,7 +75,7 @@ { return [ 'A' => NumberFormat::FORMAT_NUMBER, - 'D' => NumberFormat::FORMAT_DATE_DATETIME + 'E' => NumberFormat::FORMAT_DATE_DATETIME ]; } } diff --git a/app/Http/Controllers/BranchController.php b/app/Http/Controllers/BranchController.php index 0178c5b..343f053 100644 --- a/app/Http/Controllers/BranchController.php +++ b/app/Http/Controllers/BranchController.php @@ -189,6 +189,7 @@ $query->where(function ($q) use ($search_) { $q->whereRaw('LOWER(code) LIKE ?', ['%' . strtolower($search_) . '%']); $q->orWhereRaw('LOWER(name) LIKE ?', ['%' . strtolower($search_) . '%']); + $q->orWhereRaw('LOWER(address) LIKE ?', ['%' . strtolower($search_) . '%']); $q->orWhereHas('parent', function ($q) use ($search_) { $q->whereRaw('LOWER(name) LIKE ?', ['%' . strtolower($search_) . '%']); }); @@ -233,6 +234,7 @@ 'code' => $item->code, 'name' => $item->name, 'parent_id' => $item->parent?->name ?? null, + 'address' => str_replace(']', "", $item->address), ]; }); diff --git a/app/Models/Branch.php b/app/Models/Branch.php index 4c9b790..db3d7f7 100644 --- a/app/Models/Branch.php +++ b/app/Models/Branch.php @@ -5,7 +5,24 @@ class Branch extends Base { protected $table = 'branches'; - protected $fillable = ['code', 'name', 'status', 'authorized_at', 'authorized_status', 'authorized_by', 'parent_id']; + protected $fillable = [ + 'code', + 'name', + 'address', + 'mnemonic', + 'customer_company', + 'customer_mnemonic', + 'company_group', + 'curr_no', + 'co_code', + 'l_vendor_atm', + 'l_vendor_cpc', + 'status', + 'authorized_at', + 'authorized_status', + 'authorized_by', + 'parent_id' + ]; /** * Get the parent branch of this branch diff --git a/database/migrations/2025_05_20_145203_add_fields_to_branches_table.php b/database/migrations/2025_05_20_145203_add_fields_to_branches_table.php new file mode 100644 index 0000000..10f4ae5 --- /dev/null +++ b/database/migrations/2025_05_20_145203_add_fields_to_branches_table.php @@ -0,0 +1,46 @@ +string('address')->nullable()->after('name'); + $table->string('mnemonic')->nullable()->after('address'); + $table->string('customer_company')->nullable()->after('mnemonic'); + $table->string('customer_mnemonic')->nullable()->after('customer_company'); + $table->string('company_group')->nullable()->after('customer_mnemonic'); + $table->string('curr_no')->nullable()->after('company_group'); + $table->string('co_code')->nullable()->after('curr_no'); + $table->boolean('l_vendor_atm')->default(false)->after('co_code'); + $table->boolean('l_vendor_cpc')->default(false)->after('l_vendor_atm'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('branches', function (Blueprint $table) { + $table->dropColumn([ + 'address', + 'mnemonic', + 'customer_company', + 'customer_mnemonic', + 'company_group', + 'curr_no', + 'co_code', + 'l_vendor_atm', + 'l_vendor_cpc' + ]); + }); + } +}; diff --git a/resources/views/branch/index.blade.php b/resources/views/branch/index.blade.php index ce1ba6f..64137ad 100644 --- a/resources/views/branch/index.blade.php +++ b/resources/views/branch/index.blade.php @@ -57,6 +57,10 @@ Cabang Induk + + Address + + Action @@ -183,6 +187,9 @@ parent_id: { title: 'Cabang Induk', }, + address: { + title: 'Address', + }, actions: { title: 'Status', render: (item, data) => {