Commit b5ee13fe authored by Thidaporn Laisan's avatar Thidaporn Laisan
Browse files

update upload exchange rate

parent 15453852
...@@ -10,6 +10,7 @@ use App\Models\CenterConfExchangerateExport; ...@@ -10,6 +10,7 @@ use App\Models\CenterConfExchangerateExport;
class ExchangerateIndex extends Component class ExchangerateIndex extends Component
{ {
use WithPagination; use WithPagination;
public $action = 'list'; public $action = 'list';
public $searchBy, $searchByPage, $editCurrency, $editExdate, $deleteCurrency, $deleteExdate, $message, $keyword, $perPage = 20, $searchSelected = 'center_conf_exchangerate.currency'; public $searchBy, $searchByPage, $editCurrency, $editExdate, $deleteCurrency, $deleteExdate, $message, $keyword, $perPage = 20, $searchSelected = 'center_conf_exchangerate.currency';
public $selectedExchangerates = []; public $selectedExchangerates = [];
...@@ -102,7 +103,7 @@ class ExchangerateIndex extends Component ...@@ -102,7 +103,7 @@ class ExchangerateIndex extends Component
public function deleteSelectedExchangerates() public function deleteSelectedExchangerates()
{ {
foreach ($this->selectedExchangerates as $exchangerate) { foreach ($this->selectedExchangerates as $exchangerate) {
$parts = explode(',', $exchangerate); // แยกค่า currency และ exdate $parts = explode(',', $exchangerate);
CenterConfExchangerate::where('currency', $parts[0]) CenterConfExchangerate::where('currency', $parts[0])
->where('exdate', $parts[1]) ->where('exdate', $parts[1])
->delete(); ->delete();
...@@ -131,3 +132,4 @@ class ExchangerateIndex extends Component ...@@ -131,3 +132,4 @@ class ExchangerateIndex extends Component
$this->action = $page; $this->action = $page;
} }
} }
?>
...@@ -55,20 +55,7 @@ ...@@ -55,20 +55,7 @@
<button type="button" class="py-2 px-3 bg-stone-700 rounded-lg text-white" <button type="button" class="py-2 px-3 bg-stone-700 rounded-lg text-white"
onclick="confirmDeleteSelected()">Delete</button> onclick="confirmDeleteSelected()">Delete</button>
<!-- File Upload Form --> <!-- File Upload Form -->
<form wire:submit.prevent="upload" class="form-upload"> @livewire('pages.exchangerate.exchangerate-upload')
<input type="file" wire:model="file">
@error('file') <span class="error">{{ $message }}</span> @enderror
<label>
<input type="checkbox" wire:model="createPatch"> <b>Create Patch</b>
</label>
<label>
<input type="checkbox" wire:model="updatepatch"> <b>Update Patch</b>
</label>
<label>
<input type="checkbox" wire:model="sendToEec"> <b>Send To EEC</b>
</label>
<button type="submit" class="py-2 px-3 bg-stone-700 rounded-lg text-white">Upload</button>
</form>
</div> </div>
<div class="inline-flex flex-initial"> <div class="inline-flex flex-initial">
<div x-data="{ isInputActive: true }"> <div x-data="{ isInputActive: true }">
......
<form wire:submit.prevent="upload" class="form-upload">
<input type="file" wire:model="file">
@error('file') <span class="error">{{ $message }}</span> @enderror
<label>
<input type="checkbox" wire:model="createPatch"> <b>Create Patch</b>
</label>
<label>
<input type="checkbox" wire:model="updatePatch"> <b>Update Patch</b>
</label>
<label>
<input type="checkbox" wire:model="sendToEec"> <b>Send To EEC</b>
</label>
<button type="submit" class="py-2 px-3 bg-stone-700 rounded-lg text-white">Upload</button>
</form>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment