Compare commits
12 Commits
be271dbe6e
...
shola
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fec8dc083c | ||
|
|
4c4a4a33a9 | ||
|
|
a2aabd51d6 | ||
|
|
c168634c3a | ||
|
|
65695d0594 | ||
|
|
9158005a5c | ||
|
|
336d74b628 | ||
|
|
5f9f07657f | ||
|
|
05ceb5ef01 | ||
|
|
89f5fedfd6 | ||
|
|
0a4f39cca1 | ||
|
|
9c0ee08c40 |
@@ -12,6 +12,7 @@
|
||||
class BranchExport implements WithColumnFormatting, WithHeadings, FromCollection, WithMapping
|
||||
{
|
||||
protected $search;
|
||||
protected $parent_id;
|
||||
|
||||
public function __construct($search = null, $parent_id = null)
|
||||
{
|
||||
@@ -28,6 +29,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 +53,7 @@
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->parent ? $row->parent->name : '',
|
||||
$row->address,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
@@ -63,6 +66,7 @@
|
||||
'Code',
|
||||
'Name',
|
||||
'Parent Branch',
|
||||
'Address',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
@@ -72,7 +76,7 @@
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
'E' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Modules\Basicdata\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -16,7 +17,14 @@
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->user = auth()->user();
|
||||
// Mengatur middleware auth
|
||||
$this->middleware('auth');
|
||||
|
||||
// Mengatur user setelah middleware auth dijalankan
|
||||
$this->middleware(function ($request, $next) {
|
||||
$this->user = Auth::user();
|
||||
return $next($request);
|
||||
});
|
||||
}
|
||||
|
||||
public function index()
|
||||
@@ -189,6 +197,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 +242,7 @@
|
||||
'code' => $item->code,
|
||||
'name' => $item->name,
|
||||
'parent_id' => $item->parent?->name ?? null,
|
||||
'address' => str_replace(']', "", $item->address),
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
@@ -9,13 +9,22 @@
|
||||
use Modules\Basicdata\Exports\CurrencyExport;
|
||||
use Modules\Basicdata\Http\Requests\CurrencyRequest;
|
||||
use Modules\Basicdata\Models\Currency;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class CurrencyController extends Controller
|
||||
{
|
||||
protected $user;
|
||||
|
||||
public function __construct(){
|
||||
$this->user = auth()->user();
|
||||
public function __construct()
|
||||
{
|
||||
// Mengatur middleware auth
|
||||
$this->middleware('auth');
|
||||
|
||||
// Mengatur user setelah middleware auth dijalankan
|
||||
$this->middleware(function ($request, $next) {
|
||||
$this->user = Auth::user();
|
||||
return $next($request);
|
||||
});
|
||||
}
|
||||
|
||||
public function index()
|
||||
|
||||
@@ -9,13 +9,22 @@
|
||||
use Modules\Basicdata\Exports\HolidayCalendarExport;
|
||||
use Modules\Basicdata\Http\Requests\HolidayCalendarRequest;
|
||||
use Modules\Basicdata\Models\HolidayCalendar;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class HolidayCalendarController extends Controller
|
||||
{
|
||||
protected $user;
|
||||
|
||||
public function __construct(){
|
||||
$this->user = auth()->user();
|
||||
public function __construct()
|
||||
{
|
||||
// Mengatur middleware auth
|
||||
$this->middleware('auth');
|
||||
|
||||
// Mengatur user setelah middleware auth dijalankan
|
||||
$this->middleware(function ($request, $next) {
|
||||
$this->user = Auth::user();
|
||||
return $next($request);
|
||||
});
|
||||
}
|
||||
|
||||
public function index()
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\Facades\CauserResolver;
|
||||
use Spatie\Activitylog\LogOptions;
|
||||
use Spatie\Activitylog\Traits\LogsActivity;
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
use Mattiverse\Userstamps\Traits\Userstamps;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,25 @@
|
||||
class Branch extends Base
|
||||
{
|
||||
protected $table = 'branches';
|
||||
protected $fillable = ['code', 'name', 'status', 'authorized_at', 'authorized_status', 'authorized_by', 'parent_id'];
|
||||
protected $fillable = [
|
||||
'code',
|
||||
'name',
|
||||
'is_dalam_kota',
|
||||
'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
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<?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::table('branches', function (Blueprint $table) {
|
||||
$table->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'
|
||||
]);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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::table('branches', function (Blueprint $table) {
|
||||
$table->boolean('is_dalam_kota')->default(true)->after('name');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('branches', function (Blueprint $table) {
|
||||
$table->dropColumn('is_dalam_kota');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -12,6 +12,7 @@ class BasicdataDatabaseSeeder extends Seeder
|
||||
public function run(): void
|
||||
{
|
||||
$this->call([
|
||||
PermissionSeeder::class,
|
||||
BranchesSeeder::class,
|
||||
CurrencySeeder::class,
|
||||
HolidayCalendarSeeder::class
|
||||
|
||||
@@ -59,7 +59,8 @@
|
||||
['code' => 'PKR', 'name' => 'Pakistani Rupee', 'symbol' => '₨', 'decimal_places' => 2, 'status' => true, 'created_at' => $now, 'updated_at' => $now],
|
||||
];
|
||||
|
||||
DB::table('currencies')->truncate();
|
||||
// DB::table('currencies')->truncate();
|
||||
DB::table('currencies')->delete();
|
||||
DB::table('currencies')->insert($currencies);
|
||||
}
|
||||
}
|
||||
|
||||
32
database/seeders/PermissionSeeder.php
Normal file
32
database/seeders/PermissionSeeder.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Basicdata\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Str;
|
||||
use Modules\Usermanagement\Models\PermissionGroup;
|
||||
|
||||
class PermissionSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$data = $this->data();
|
||||
|
||||
foreach ($data as $value) {
|
||||
PermissionGroup::updateOrCreate([
|
||||
'name' => $value['name'],
|
||||
'slug' => Str::slug($value['name'])
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function data()
|
||||
{
|
||||
return [
|
||||
['name' => 'basic-data']
|
||||
];
|
||||
}
|
||||
}
|
||||
54
database/seeders/UpdateBranchesIsDalamKotaSeeder.php
Normal file
54
database/seeders/UpdateBranchesIsDalamKotaSeeder.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Basicdata\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Modules\Basicdata\Models\Branch;
|
||||
|
||||
class UpdateBranchesIsDalamKotaSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$codes = [
|
||||
'0005','0012','0250','0016','0018','0279','0092','0022','0251',
|
||||
'0029','0270','0096','0109','0098','2005','0008','0028','0015',
|
||||
'0006','0090','0009','0023','0020','0099','0003','0010','0002',
|
||||
'0273','0011','0105',
|
||||
];
|
||||
|
||||
Branch::query()->update(['is_dalam_kota' => false]);
|
||||
|
||||
foreach ($codes as $code) {
|
||||
Branch::where('code', 'like', '%' . $code)
|
||||
->update(['is_dalam_kota' => true]);
|
||||
}
|
||||
|
||||
$newBranches = [
|
||||
[
|
||||
'code' => 'ID0012005',
|
||||
'name' => 'KORPORASI',
|
||||
'is_dalam_kota' => true,
|
||||
],
|
||||
[
|
||||
'code' => 'ID0010172',
|
||||
'name' => 'AMBON TUAL MALUKU',
|
||||
'is_dalam_kota' => false,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($newBranches as $branch) {
|
||||
Branch::firstOrCreate(
|
||||
['code' => $branch['code']],
|
||||
[
|
||||
'name' => $branch['name'],
|
||||
'is_dalam_kota' => $branch['is_dalam_kota'],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
echo "Seeder update kolom is_dalam_kota + insert data baru selesai!\n";
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,10 @@
|
||||
<span class="sort"> <span class="sort-label"> Cabang Induk</span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[250px]" data-datatable-column="address">
|
||||
<span class="sort"> <span class="sort-label"> Address</span>
|
||||
<span class="sort-icon"> </span> </span>
|
||||
</th>
|
||||
<th class="min-w-[50px] text-center" data-datatable-column="actions">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -183,6 +187,9 @@
|
||||
parent_id: {
|
||||
title: 'Cabang Induk',
|
||||
},
|
||||
address: {
|
||||
title: 'Address',
|
||||
},
|
||||
actions: {
|
||||
title: 'Status',
|
||||
render: (item, data) => {
|
||||
|
||||
Reference in New Issue
Block a user