feat(currency): tambahkan atribut simbol dan perbarui tampilan

- Menambahkan kolom simbol pada tabel mata uang di halaman index.
- Menambahkan input simbol pada form pembuatan mata uang.
- Memperbarui aturan validasi untuk simbol pada CurrencyRequest.
- Memperbarui model Currency untuk menyertakan atribut simbol.
- Memperbarui migrasi untuk menambahkan kolom simbol pada tabel currencies.
This commit is contained in:
Daeng Deni Mardaeni
2025-04-26 19:34:44 +07:00
parent 2e52155eda
commit 1b692215b8
6 changed files with 24 additions and 2 deletions

View File

@@ -103,6 +103,7 @@
$search = $request->get('search');
$query->where(function ($q) use ($search) {
$q->where('code', 'LIKE', "%$search%");
$q->orWhere('symbol', 'LIKE', "%$search%");
$q->orWhere('name', 'LIKE', "%$search%");
});
}

View File

@@ -14,6 +14,7 @@
{
$rules = [
'name' => 'required|string|max:255',
'symbol' => 'required|string|max:10',
'decimal_places' => 'nullable|integer|between:0,3',
'status' => 'nullable|boolean',
'authorized_at' => 'nullable|datetime',

View File

@@ -9,6 +9,7 @@
protected $fillable = [
'code',
'name',
'symbol',
'decimal_places',
'status',
'authorized_at',

View File

@@ -15,6 +15,7 @@
$table->id();
$table->string('code', 3)->unique();
$table->string('name');
$table->string('symbol')->nullable();
$table->integer('decimal_places')->default(2);
$table->boolean('status')->default(true)->nullable();
$table->timestamps();

View File

@@ -46,6 +46,17 @@
@enderror
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Symbol
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('symbol') border-danger bg-danger-light @enderror" type="text" name="symbol" value="{{ $currency->symbol ?? '' }}">
@error('symbol')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Decimal Places

View File

@@ -41,6 +41,10 @@
<span class="sort"> <span class="sort-label"> Mata Uang </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[150px]" data-datatable-column="symbol">
<span class="sort"> <span class="sort-label"> Symbol </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[50px]" data-datatable-column="decimal_places">
<span class="sort"> <span class="sort-label"> Decimal Places </span>
<span class="sort-icon"> </span> </span>
@@ -126,7 +130,7 @@
$.ajax('{{ route("basicdata.currency.deleteMultiple") }}', {
type: 'POST',
data: { ids: ids }
data: {ids: ids}
}).then((response) => {
Swal.fire('Deleted!', 'Selected rows have been deleted.', 'success').then(() => {
window.location.reload();
@@ -165,6 +169,9 @@
name: {
title: 'Mata Uang',
},
symbol: {
title: 'Symbol',
},
decimal_places: {
title: 'Decimal Places',
},
@@ -204,7 +211,7 @@
updateDeleteButtonVisibility();
// Add event listener to the table for checkbox changes
element.addEventListener('change', function(event) {
element.addEventListener('change', function (event) {
if (event.target.matches('input[data-datatable-row-check="true"]')) {
updateDeleteButtonVisibility();
}