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:
@@ -103,6 +103,7 @@
|
|||||||
$search = $request->get('search');
|
$search = $request->get('search');
|
||||||
$query->where(function ($q) use ($search) {
|
$query->where(function ($q) use ($search) {
|
||||||
$q->where('code', 'LIKE', "%$search%");
|
$q->where('code', 'LIKE', "%$search%");
|
||||||
|
$q->orWhere('symbol', 'LIKE', "%$search%");
|
||||||
$q->orWhere('name', 'LIKE', "%$search%");
|
$q->orWhere('name', 'LIKE', "%$search%");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
{
|
{
|
||||||
$rules = [
|
$rules = [
|
||||||
'name' => 'required|string|max:255',
|
'name' => 'required|string|max:255',
|
||||||
|
'symbol' => 'required|string|max:10',
|
||||||
'decimal_places' => 'nullable|integer|between:0,3',
|
'decimal_places' => 'nullable|integer|between:0,3',
|
||||||
'status' => 'nullable|boolean',
|
'status' => 'nullable|boolean',
|
||||||
'authorized_at' => 'nullable|datetime',
|
'authorized_at' => 'nullable|datetime',
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'code',
|
'code',
|
||||||
'name',
|
'name',
|
||||||
|
'symbol',
|
||||||
'decimal_places',
|
'decimal_places',
|
||||||
'status',
|
'status',
|
||||||
'authorized_at',
|
'authorized_at',
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
$table->id();
|
$table->id();
|
||||||
$table->string('code', 3)->unique();
|
$table->string('code', 3)->unique();
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
|
$table->string('symbol')->nullable();
|
||||||
$table->integer('decimal_places')->default(2);
|
$table->integer('decimal_places')->default(2);
|
||||||
$table->boolean('status')->default(true)->nullable();
|
$table->boolean('status')->default(true)->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
|||||||
@@ -46,6 +46,17 @@
|
|||||||
@enderror
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
</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">
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
<label class="form-label max-w-56">
|
<label class="form-label max-w-56">
|
||||||
Decimal Places
|
Decimal Places
|
||||||
|
|||||||
@@ -41,6 +41,10 @@
|
|||||||
<span class="sort"> <span class="sort-label"> Mata Uang </span>
|
<span class="sort"> <span class="sort-label"> Mata Uang </span>
|
||||||
<span class="sort-icon"> </span> </span>
|
<span class="sort-icon"> </span> </span>
|
||||||
</th>
|
</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">
|
<th class="min-w-[50px]" data-datatable-column="decimal_places">
|
||||||
<span class="sort"> <span class="sort-label"> Decimal Places </span>
|
<span class="sort"> <span class="sort-label"> Decimal Places </span>
|
||||||
<span class="sort-icon"> </span> </span>
|
<span class="sort-icon"> </span> </span>
|
||||||
@@ -126,7 +130,7 @@
|
|||||||
|
|
||||||
$.ajax('{{ route("basicdata.currency.deleteMultiple") }}', {
|
$.ajax('{{ route("basicdata.currency.deleteMultiple") }}', {
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: { ids: ids }
|
data: {ids: ids}
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
Swal.fire('Deleted!', 'Selected rows have been deleted.', 'success').then(() => {
|
Swal.fire('Deleted!', 'Selected rows have been deleted.', 'success').then(() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
@@ -165,6 +169,9 @@
|
|||||||
name: {
|
name: {
|
||||||
title: 'Mata Uang',
|
title: 'Mata Uang',
|
||||||
},
|
},
|
||||||
|
symbol: {
|
||||||
|
title: 'Symbol',
|
||||||
|
},
|
||||||
decimal_places: {
|
decimal_places: {
|
||||||
title: 'Decimal Places',
|
title: 'Decimal Places',
|
||||||
},
|
},
|
||||||
@@ -204,7 +211,7 @@
|
|||||||
updateDeleteButtonVisibility();
|
updateDeleteButtonVisibility();
|
||||||
|
|
||||||
// Add event listener to the table for checkbox changes
|
// 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"]')) {
|
if (event.target.matches('input[data-datatable-row-check="true"]')) {
|
||||||
updateDeleteButtonVisibility();
|
updateDeleteButtonVisibility();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user