mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
update remark on transactions
This commit is contained in:
@@ -259,4 +259,12 @@ class Transaction extends AbstractModel implements Documentable, Transactionable
|
||||
return $this->morphMany(VoucherEntityMapping::class, 'owner');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function remarks(): morphMany
|
||||
{
|
||||
return $this->morphMany(Remark::class, 'owner');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+10
-10
@@ -973,15 +973,17 @@ Route::get('/invoice/{marking}/{started_at}/{ended_at}/fix', function($marking,
|
||||
route:: post('/transaction/{id}/create-remark',function ($transactionId) {
|
||||
$transaction = Transaction::find($transactionId);
|
||||
$remark = new Remark();
|
||||
|
||||
$remark->owner_type = get_class($transaction);
|
||||
$remark->owner_id = $transaction->id;
|
||||
|
||||
$remark->content = request('content');
|
||||
$remark->id = $transactionId;
|
||||
$remark->save();
|
||||
return redirect()->back();
|
||||
})->name('transaction.create-remark');
|
||||
|
||||
Route::get('/show-white-form-transactions-in-date-range/{from_date}/{to_date}', function ($from_date, $to_date) {
|
||||
|
||||
|
||||
$approvedTransactions = Transaction::where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED])->where('owner_type', '!=', Wallet::class)->orderBy('status')->get();
|
||||
|
||||
echo '<h1>Pending Orders Payments</h1>';
|
||||
@@ -1004,15 +1006,15 @@ Route::get('/show-white-form-transactions-in-date-range/{from_date}/{to_date}',
|
||||
echo '<td style="border: 1px solid black;">' . round($approvedTransaction->amount, 2) . '</td>';
|
||||
echo '<td style="border: 1px solid black;">' . $approvedTransaction->created_at->format('d-m-Y h:i A') . '</td>';
|
||||
echo '<td style="border: 1px solid black;">' . ApprovalStatus::APPROVAL_STATUS_ID[$approvedTransaction->status] . '</td>';
|
||||
$remark = Remark::where('id', $approvedTransaction->id)->first();
|
||||
if ($remark) {
|
||||
echo '<td style="border: 1px solid black;">' . $remark->content . '</td>';
|
||||
} else {
|
||||
echo '<td style="border: 1px solid black;">No remark found</td>';
|
||||
$remarks = $approvedTransaction->remarks;
|
||||
echo '<td style="border: 1px solid black;">';
|
||||
foreach ($remarks as $remark) {
|
||||
echo "<p>$remark->content</p>";
|
||||
}
|
||||
echo '</td>';
|
||||
echo '<td style="border: 1px solid black;">' ;
|
||||
echo '<form method="post" action="' . route('transaction.create-remark', ['id' => $approvedTransaction->id]) . '">';
|
||||
echo '<input type="text" name="content" placeholder="Enter remark">';
|
||||
echo '<input type="text" name="content" placeholder="Enter remark" required>';
|
||||
echo '<button type="submit">Add Remark</button>';
|
||||
echo csrf_field();
|
||||
echo '</form>';
|
||||
@@ -1063,6 +1065,4 @@ Route::get('/show-white-form-transactions-in-date-range/{from_date}/{to_date}',
|
||||
|
||||
echo '</tbody>';
|
||||
echo '</table>';
|
||||
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user