mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
wip update container comments(remarks) section and implement api
This commit is contained in:
+2
-2
@@ -53,9 +53,9 @@ class CreateContainerRemarkLogic extends AbstractControllerLogic
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$container = $this->fetchesContainer->execute(['id' => $request->input('container_id')]);
|
||||
$container = $this->fetchesContainer->execute(['id' => $request->route('id')]);
|
||||
|
||||
$object = new RemarkObject($request->input('content'), 1);
|
||||
$object = new RemarkObject($request->input('content'), auth()->user()->id);
|
||||
|
||||
$this->createRemarkProcessor->execute($container, $object);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ContainerTypes;
|
||||
use App\Models\Remark;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ContainerResource extends JsonResource
|
||||
@@ -26,6 +27,7 @@ class ContainerResource extends JsonResource
|
||||
'packing_lists' => PackingListResource::collection($this->whenLoaded('packingLists', function(){
|
||||
return $this->packingLists()->whereHas('packages')->get();
|
||||
})),
|
||||
'remarks' => RemarkResource::collection($this->remarks),
|
||||
'status' => $this->status
|
||||
];
|
||||
}
|
||||
|
||||
@@ -16,8 +16,10 @@ class RemarkResource extends JsonResource
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'commenter_id' => $this->commenter_id,
|
||||
'commenter' => new UserResource($this->commenter),
|
||||
'content' => $this->content,
|
||||
'created_at' => $this->created_at->format('d-m-Y H:i'),
|
||||
'long_ago' => $this->created_at->diffForHumans()
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Remark extends AbstractModel
|
||||
{
|
||||
@@ -15,4 +16,12 @@ class Remark extends AbstractModel
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function commenter(): BelongsTo
|
||||
{
|
||||
return $this->BelongsTo(User::class, 'commenter_id', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
+42
-26
@@ -616,41 +616,57 @@
|
||||
</div>
|
||||
<div class="row" v-if="tabShowing === 'Comments'">
|
||||
<div class="col">
|
||||
<div class="row m-b-20">
|
||||
|
||||
<div class="row" v-for="remarks in container.remarks">
|
||||
<div class="col">
|
||||
<div class="row justify-content-center align-items-center m-l-5 m-b-15">
|
||||
<div class="col-auto b-a btn-rounded padding-10 p-l-15 p-r-15">
|
||||
<i class="fa fa-user"></i>
|
||||
</div>
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<p class="no-margin muted bold fs-20">Jacob Arlington</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p>Adipisicing occaecat pariatur id sunt ullamco quis laborum irure ea excepteur enim dolore est. Deserunt do consectetur ex in dolor labore ad reprehenderit velit laboris officia ut.</p>
|
||||
<div class="row justify-content-center align-items-center">
|
||||
<div class="hide col-auto btn-rounded padding-10 d-flex justify-content-center align-items-center bg-master-lighter" style="width: 30px;height: 30px; box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.14);">
|
||||
<span class="bold">{{remarks.commenter.name.substr(0, 1)}}</span>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-auto">
|
||||
<p class="no-margin muted bold fs-14">{{remarks.commenter.name}}</p>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<span class="fs-12 muted normal">{{remarks.long_ago}}</span>
|
||||
</div>
|
||||
<div class="col d-flex justify-content-end">
|
||||
<div class="row">
|
||||
<div class="col p-t-5 p-b-5 b-a b-grey">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<i class="fa fa-edit pointer"></i>
|
||||
</div>
|
||||
<div class="col">
|
||||
<i class="fa fa-trash pointer" @click="submit(route('api.remark.delete', remarks.id), 'delete', section)"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p>{{remarks.content}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-20">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row justify-content-center align-items-center m-l-5 m-b-15">
|
||||
<div class="col-auto b-a btn-rounded padding-10 p-l-15 p-r-15">
|
||||
<i class="fa fa-user"></i>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="no-margin muted bold fs-20">Jacob Arlington</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p>Adipisicing occaecat pariatur id sunt ullamco quis laborum irure ea excepteur enim dolore est. Deserunt do consectetur ex in dolor labore ad reprehenderit velit laboris officia ut.</p>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" class="b-a w-100 padding-10 rounded b-grey" placeholder="Write your comments...">
|
||||
</div>
|
||||
<div class="col-auto b-a b-grey d-flex justify-content-center align-items-center rounded pointer">
|
||||
<i class="fa fa-paper-plane" @click="submit(route('api.packing_list.container.remark.create', container.id), 'post', section, true, true)"></i>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" class="b-a w-100 padding-10 rounded b-grey" placeholder="Write your comments...">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -30,6 +30,7 @@ Route::group(['namespace' => 'PackingLists', 'as' => 'packing_list.', 'prefix' =
|
||||
Route::put('/update-dispatch-date/{id}', 'UpdateDispatchDateContainerController@update')->name('update_dispatch_date');
|
||||
Route::put('/update-drop-date/{id}', 'UpdateDropDateContainerController@update')->name('update_drop_date');
|
||||
Route::put('/complete/{id}', 'CompleteContainerController@complete')->name('complete');
|
||||
Route::post('/{id}/remark/create', 'CreateContainerRemarkController@create')->name('remark.create');
|
||||
});
|
||||
|
||||
Route::group(['namespace' => 'Packages', 'as' => 'package.', 'prefix' => 'package'], function () {
|
||||
|
||||
Reference in New Issue
Block a user