mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
fix up group transactions bulk purchase orders
This commit is contained in:
@@ -21,13 +21,6 @@ class GroupResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
dd($this->transactions()->whereHasMorph('owner', [Transaction::class], function($query){
|
||||
return $query->whereHas('booking', function($query){
|
||||
return $query->whereHas('transactions', function($query){
|
||||
return $query->where('type', TransactionType::PURCHASE_ORDER)->where('status', '=', ApprovalStatus::APPROVED);
|
||||
});
|
||||
});
|
||||
})->get());
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
@@ -47,7 +40,7 @@ class GroupResource extends JsonResource
|
||||
return $query->where('type', TransactionType::PURCHASE_ORDER)->where('status', '=', ApprovalStatus::APPROVED);
|
||||
});
|
||||
});
|
||||
})->count(),
|
||||
})->get()->pluck('owner.owner.marking'),
|
||||
'documents' => [
|
||||
'currency_order' => new DocumentResource($this->documents()->where('document_type', DocumentType::CURRENCY_VENDOR_ORDER)->first()),
|
||||
'purchase_order' => new DocumentResource($this->documents()->where('document_type', DocumentType::BULK_PURCHASE_ORDER)->first())
|
||||
|
||||
Reference in New Issue
Block a user