-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
372 additions
and
24 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
app/Events/ProposalDonatingStatusApprovedWithDonatedAmount.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace App\Events; | ||
|
||
use App\Models\Proposal; | ||
use Illuminate\Broadcasting\Channel; | ||
use Illuminate\Broadcasting\InteractsWithSockets; | ||
use Illuminate\Broadcasting\PresenceChannel; | ||
use Illuminate\Broadcasting\PrivateChannel; | ||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast; | ||
use Illuminate\Foundation\Events\Dispatchable; | ||
use Illuminate\Queue\SerializesModels; | ||
|
||
class ProposalDonatingStatusApprovedWithDonatedAmount | ||
{ | ||
use Dispatchable, InteractsWithSockets, SerializesModels; | ||
|
||
public $proposal; | ||
public $donatingAmount; | ||
/** | ||
* Create a new event instance. | ||
*/ | ||
public function __construct(Proposal $proposal, int $donatingAmount) | ||
{ | ||
$this->proposal = $proposal; | ||
$this->donatingAmount = $donatingAmount; | ||
} | ||
|
||
/** | ||
* Get the channels the event should broadcast on. | ||
* | ||
* @return array<int, \Illuminate\Broadcasting\Channel> | ||
*/ | ||
public function broadcastOn(): array | ||
{ | ||
return [ | ||
new PrivateChannel('channel-name'), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\Listeners; | ||
|
||
use App\Events\ProposalDonatingStatusApprovedWithDonatedAmount; | ||
use App\Models\Donation; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
use Illuminate\Queue\InteractsWithQueue; | ||
|
||
class StoreDonationRecord | ||
{ | ||
/** | ||
* Create the event listener. | ||
*/ | ||
public function __construct() | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Handle the event. | ||
*/ | ||
public function handle(ProposalDonatingStatusApprovedWithDonatedAmount $event): void | ||
{ | ||
// create donation | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
namespace App\Observers; | ||
|
||
use App\Models\Proposal; | ||
|
||
class ProposalObserver | ||
{ | ||
/** | ||
* Handle the Proposal "created" event. | ||
* | ||
* @param \App\Models\Proposal $proposal | ||
* @return void | ||
*/ | ||
public function created(Proposal $proposal) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Handle the Proposal "updated" event. | ||
* | ||
* @param \App\Models\Proposal $proposal | ||
* @return void | ||
*/ | ||
public function updated(Proposal $proposal) | ||
{ | ||
|
||
} | ||
|
||
/** | ||
* Handle the Proposal "deleted" event. | ||
* | ||
* @param \App\Models\Proposal $proposal | ||
* @return void | ||
*/ | ||
public function deleted(Proposal $proposal) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Handle the Proposal "restored" event. | ||
* | ||
* @param \App\Models\Proposal $proposal | ||
* @return void | ||
*/ | ||
public function restored(Proposal $proposal) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Handle the Proposal "force deleted" event. | ||
* | ||
* @param \App\Models\Proposal $proposal | ||
* @return void | ||
*/ | ||
public function forceDeleted(Proposal $proposal) | ||
{ | ||
// | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
31 changes: 31 additions & 0 deletions
31
database/migrations/2025_01_17_170709_change_status_default_value_in_proposals_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('proposals', function (Blueprint $table) { | ||
$table->integer('status')->default(1)->change(); //[1 => 'donating_status', 2 => 'execution_status', 3 => 'read_to_archive_status', 8 => 'done_status'] | ||
|
||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
// | ||
} | ||
}; |
71 changes: 71 additions & 0 deletions
71
resources/js/Components/Modals/CompleteDonatingStatusModal.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<template> | ||
<Modal :show="complete_donating_status" @close="closeCompleteDonatingStatusModal"> | ||
<div class="p-6"> | ||
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100"> | ||
{{ $t("Are you sure you want to complete donating status?") }} | ||
</h2> | ||
|
||
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400"> | ||
{{ $t("Once your accept, User will be updated") }}. | ||
</p> | ||
|
||
<div class="mt-6 flex justify-end"> | ||
<SecondaryButton @click="closeCompleteDonatingStatusModal"> | ||
{{ $t("Cancel") }} | ||
</SecondaryButton> | ||
<TextInput | ||
id="donatingAmount" | ||
type="number" | ||
class="mt-1 block w-full" | ||
v-model="form.title" | ||
required | ||
autofocus | ||
autocomplete="name" | ||
> | ||
|
||
</TextInput> | ||
<PrimaryButton class="ml-3" @click="confirmCompleteDonatingStatusModal"> | ||
{{ $t("approve") }} | ||
</PrimaryButton> | ||
</div> | ||
</div> | ||
</Modal> | ||
|
||
</template> | ||
|
||
<script> | ||
import SecondaryButton from "@/Components/SecondaryButton.vue"; | ||
import PrimaryButton from "@/Components/PrimaryButton.vue"; | ||
import TextInput from "@/Components/TextInput.vue"; | ||
import Modal from "@/Components/Modal.vue"; | ||
import { router } from "@inertiajs/vue3"; | ||
export default { | ||
components: { | ||
SecondaryButton, | ||
PrimaryButton, | ||
Modal, | ||
}, | ||
props: ["action", "item", "complete_donating_status"], | ||
methods: { | ||
closeCompleteDonatingStatusModal() { | ||
this.complete_donating_status = false; | ||
}, | ||
confirmCompleteDonatingStatusModal() { | ||
router.put(route(`${this.action.model}.update`, this.item.id), { | ||
donated_amount: 100, | ||
status: 2, | ||
}); | ||
this.closeCompleteDonatingStatusModal(); | ||
}, | ||
completingDonatingStatus() { | ||
this.complete_donating_status = true; | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style></style> | ||
|
Oops, something went wrong.