diff --git a/app/Classes/General/Eloquent/Filters/ClaimantId.php b/app/Classes/General/Eloquent/Filters/ClaimantId.php
new file mode 100644
index 00000000..7d473825
--- /dev/null
+++ b/app/Classes/General/Eloquent/Filters/ClaimantId.php
@@ -0,0 +1,20 @@
+where('claimant_id', $value);
+ }
+
+}
\ No newline at end of file
diff --git a/app/Classes/General/Eloquent/Filters/PackingListDeliveryStatus.php b/app/Classes/General/Eloquent/Filters/PackingListDeliveryStatus.php
new file mode 100644
index 00000000..4f316148
--- /dev/null
+++ b/app/Classes/General/Eloquent/Filters/PackingListDeliveryStatus.php
@@ -0,0 +1,29 @@
+whereDoesntHave('transports') : ($value == 2 ? $builder->whereHas('transports', function (Builder $query) use ($value) {
+ $query->whereDoesntHave('schedules', function (Builder $query) use ($value) {
+ $query->where('status', '!=', ApprovalStatus::EXPIRED)->where('eta', '>', Carbon::now());
+ });
+ }) : $builder->whereHas('transports', function (Builder $query) use ($value) {
+ $query->whereHas('schedules', function (Builder $query) use ($value) {
+ $query->where('status', '!=', ApprovalStatus::EXPIRED)->where('eta', '<', Carbon::now());
+ });
+ }));
+ }
+}
diff --git a/app/Classes/General/Interfaces/Notifiable.php b/app/Classes/General/Interfaces/Notifiable.php
new file mode 100644
index 00000000..e9d8f22d
--- /dev/null
+++ b/app/Classes/General/Interfaces/Notifiable.php
@@ -0,0 +1,15 @@
+ 'Retrieved Company Moduels',
+ 'message' => 'You have successfully retrieved a list of Companies'
+ ];
+ }
+
+ /** @var CanListCompanies */
+ private $canListCompanies;
+
+ /** @var ListsCompanyModules */
+ private $listsCompanyModules;
+
+ /**
+ * ListCompaniesControllersLogic constructor.
+ * @param CanListCompanies $canListCompanies
+ * @param ListsCompanyModules $listsCompanyModules
+ */
+ public function __construct(CanListCompanies $canListCompanies, ListsCompanyModules $listsCompanyModules)
+ {
+ $this->canListCompanies = $canListCompanies;
+ $this->listsCompanyModules = $listsCompanyModules;
+ }
+
+
+ /**
+ * @param Request $request
+ * @return JsonResponse
+ * @throws \App\Classes\Exceptions\AccessForbiddenException
+ * @throws \App\Classes\Exceptions\MalformedRequestException
+ * @throws \App\Classes\Exceptions\RequestValidationException
+ */
+ public function logic(Request $request) : JsonResponse
+ {
+ $this->canListCompanies->passes();
+
+ $query = $this->listsCompanyModules->execute($this->listsCompanyModules->deserializeFilters($request->input('filters')));
+ return $this->collectionResponse(CompanyModuleResource::collection($query));
+
+ }
+
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Companies/Services/ListsCompanyModules.php b/app/Classes/Modules/Companies/Services/ListsCompanyModules.php
new file mode 100644
index 00000000..906578c1
--- /dev/null
+++ b/app/Classes/Modules/Companies/Services/ListsCompanyModules.php
@@ -0,0 +1,33 @@
+repository = $repository;
+ }
+
+
+ /**
+ * @return Builder
+ */
+ function getRepository(): Builder
+ {
+ return $this->repository->newQuery();
+ }
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Notifications/DataTransferObjects/NotificationObject.php b/app/Classes/Modules/Notifications/DataTransferObjects/NotificationObject.php
new file mode 100644
index 00000000..40dc4f3c
--- /dev/null
+++ b/app/Classes/Modules/Notifications/DataTransferObjects/NotificationObject.php
@@ -0,0 +1,101 @@
+title = $title;
+ $this->description = $description;
+ $this->subject = $subject;
+ $this->target = $target;
+ $this->causer = $causer;
+ $this->status = $status;
+ }
+
+ /**
+ * @return int
+ */
+ public function getTitle(): string
+ {
+ return $this->title;
+ }
+
+ /**
+ * @return int
+ */
+ public function getDescription(): string
+ {
+ return $this->description;
+ }
+
+ /**
+ * @return Notifiable
+ */
+ public function getSubject(): Notifiable
+ {
+ return $this->subject;
+ }
+
+ /**
+ * @return Notifiable
+ */
+ public function getTarget(): Notifiable
+ {
+ return $this->target;
+ }
+
+ /**
+ * @return Notifiable
+ */
+ public function getCauser(): Notifiable
+ {
+ return $this->causer;
+ }
+
+ /**
+ * @return int
+ */
+ public function getStatus(): int
+ {
+ return $this->status;
+ }
+
+
+}
diff --git a/app/Classes/Modules/Notifications/Processors/CreateNotificationProcessor.php b/app/Classes/Modules/Notifications/Processors/CreateNotificationProcessor.php
new file mode 100644
index 00000000..d6b077f8
--- /dev/null
+++ b/app/Classes/Modules/Notifications/Processors/CreateNotificationProcessor.php
@@ -0,0 +1,27 @@
+createsNotification = $createsNotification;
+ }
+
+ public function execute(NotificationObject $object)
+ {
+ $notification = $this->createsNotification->execute($object);
+ return $notification;
+ }
+}
diff --git a/app/Classes/Modules/Notifications/Services/CreatesNotification.php b/app/Classes/Modules/Notifications/Services/CreatesNotification.php
new file mode 100644
index 00000000..4f5ca5fd
--- /dev/null
+++ b/app/Classes/Modules/Notifications/Services/CreatesNotification.php
@@ -0,0 +1,30 @@
+title = $object->getTitle();
+ $model->description = $object->getDescription();
+ $model->status = $object->getStatus();
+ $model->subject_type = get_class($object->getSubject());
+ $model->subject_id = $object->getSubject()->id;
+ $model->target_type = get_class($object->getTarget());
+ $model->target_id = $object->getTarget()->id;
+ $model->causer_type = get_class($object->getCauser());
+ $model->causer_id = $object->getCauser()->id;
+ $model->save();
+
+ return $model;
+ }
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Orders/ControllersLogic/CreateOrderRemarkLogic.php b/app/Classes/Modules/Orders/ControllersLogic/CreateOrderRemarkLogic.php
deleted file mode 100644
index e134bcc7..00000000
--- a/app/Classes/Modules/Orders/ControllersLogic/CreateOrderRemarkLogic.php
+++ /dev/null
@@ -1,60 +0,0 @@
- 'Created Order',
- 'message' => 'You have successfully created a new Order'
- ];
- }
-
- /** @var FetchesOrder */
- private $fetchesOrder;
-
- /** @var CreateRemarkProcessor */
- private $createRemarkProcessor;
-
- /**
- * CreateOrderRemarkLogic constructor.
- * @param FetchesOrder $fetchesOrder
- * @param CreateRemarkProcessor $createRemarkProcessor
- */
- public function __construct(FetchesOrder $fetchesOrder, CreateRemarkProcessor $createRemarkProcessor)
- {
- $this->fetchesOrder = $fetchesOrder;
- $this->createRemarkProcessor = $createRemarkProcessor;
- }
-
- /**
- * @param Request $request
- * @return JsonResponse
- * @throws \App\Classes\Exceptions\AccessForbiddenException
- * @throws \App\Classes\Exceptions\MalformedRequestException
- * @throws \App\Classes\Exceptions\RequestValidationException
- */
- public function logic(Request $request) : JsonResponse
- {
- $order = $this->fetchesOrder->execute(['id' => $request->route('id')]);
-
- $object = new RemarkObject($request->input('content'), auth()->user()->id);
-
- $this->createRemarkProcessor->execute($order, $object);
-
- return $this->resourceResponse(new OrderResource($order));
-
- }
-}
diff --git a/app/Classes/Modules/PackingLists/ControllersLogic/Containers/CreateContainerRemarkLogic.php b/app/Classes/Modules/PackingLists/ControllersLogic/Containers/CreateContainerRemarkLogic.php
index bb4b2a06..f35b828e 100644
--- a/app/Classes/Modules/PackingLists/ControllersLogic/Containers/CreateContainerRemarkLogic.php
+++ b/app/Classes/Modules/PackingLists/ControllersLogic/Containers/CreateContainerRemarkLogic.php
@@ -20,8 +20,8 @@ class CreateContainerRemarkLogic extends AbstractControllerLogic
*/
protected function notification():array {
return [
- 'title' => 'Created Container',
- 'message' => 'You have successfully created a new Container'
+ 'title' => 'Created Container Remark',
+ 'message' => 'You have successfully created a new Container Remark'
];
}
diff --git a/app/Classes/Modules/Remarks/ControllersLogic/CreateRemarkLogic.php b/app/Classes/Modules/Remarks/ControllersLogic/CreateRemarkLogic.php
index a5bf50b0..46d822c5 100644
--- a/app/Classes/Modules/Remarks/ControllersLogic/CreateRemarkLogic.php
+++ b/app/Classes/Modules/Remarks/ControllersLogic/CreateRemarkLogic.php
@@ -4,18 +4,16 @@ namespace App\Classes\Modules\Remarks\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
-use App\Classes\Modules\Remarks\Services\CreatesRemark;
-use App\Classes\Modules\Remarks\Standards\Rules\CanCreateRemark;
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
-use App\Classes\Modules\Accounts\Services\FetchesUser;
-use App\Http\Resources\RemarkResource;
-use ErrorException;
+use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
+use Illuminate\Support\Str;
+use App\Classes\Exceptions\MalformedRequestException;
+use App\Http\Resources\RemarkResource;
class CreateRemarkLogic extends AbstractControllerLogic
{
-
/**
* @return array
*/
@@ -26,25 +24,16 @@ class CreateRemarkLogic extends AbstractControllerLogic
];
}
- /** @var CanCreateRemark */
- private $canCreateRemark;
-
- /** @var CreatesRemark */
- private $createsRemark;
-
- /** @var FetchesUser */
- private $fetchesUser;
+ /** @var CreateRemarkProcessor */
+ private $createRemarkProcessor;
/**
* CreateRemarkLogic constructor.
- * @param CanCreateRemark $canCreateRemark
- * @param CreatesRemark $createsRemark
+ * @param CreateRemarkProcessor $createRemarkProcessor
*/
- public function __construct(CanCreateRemark $canCreateRemark, CreatesRemark $createsRemark, FetchesUser $fetchesUser)
+ public function __construct(CreateRemarkProcessor $createRemarkProcessor)
{
- $this->canCreateRemark = $canCreateRemark;
- $this->createsRemark = $createsRemark;
- $this->fetchesUser = $fetchesUser;
+ $this->createRemarkProcessor = $createRemarkProcessor;
}
/**
@@ -56,15 +45,18 @@ class CreateRemarkLogic extends AbstractControllerLogic
*/
public function logic(Request $request) : JsonResponse
{
+ $classs = '\\App\\Models\\' . Str::studly($request->input('model_type'));
- $object = new RemarkObject($request->input('content'), $request->input('commenter_id'));
+ if (!class_exists($classs)) {
+ throw new MalformedRequestException('Unable to process this entity');
+ }
+
+ $remarkOwner = $classs::find($request->route('id'));
- $this->canCreateRemark->passes($object);
+ $remarkObject = new RemarkObject($request->input('content'), auth()->user()->id);
- $query = $this->createsRemark->execute($this->fetchesUser->execute(['id' => $request->input('commenter_id')]), $object);
-
- return $this->resourceResponse(new RemarkResource($query));
+ $remmark = $this->createRemarkProcessor->execute($remarkOwner, $remarkObject);
+ return $this->resourceResponse(new RemarkResource($remmark));
}
-
}
diff --git a/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php
index b6edcc5f..6e6c5882 100644
--- a/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php
+++ b/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php
@@ -8,29 +8,37 @@ use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
use App\Classes\Modules\SegmentConstants\Services\FetchesSegmentConstant;
use App\Classes\Modules\Transactions\Services\GeneratesTransactionBillNumber;
use App\Classes\Modules\Transactions\Services\CreatesTransaction;
+use App\Classes\Modules\Transactions\Services\CreatesTransactionDetail;
+use App\Classes\Modules\Documents\Services\CreatesDocument;
+use App\Classes\Modules\Documents\Services\CreatesFiles;
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
+use App\Classes\Modules\Transactions\DataTransferObjects\TransactionDetailObject;
+use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
+
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
+use App\Classes\ValueObjects\Constants\DocumentType;
// use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
// use App\Classes\Modules\Transactions\Services\FetchesTransaction;
// use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
-// use App\Classes\Modules\Documents\Services\CreatesDocument;
-// use App\Classes\Modules\Documents\Services\CreatesFiles;
-// use App\Classes\ValueObjects\Constants\DocumentType;
+
// use App\Models\Document;
// use App\Models\Transaction;
// use Barryvdh\DomPDF\PDF;
// use Carbon\Carbon;
+
+
+
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
// use Meneses\LaravelLaravelMpdf\Facades\LaravelLaravelMpdf;
-// use Meneses\LaravelMpdf\Facades\LaravelMpdf;
+use Meneses\LaravelMpdf\Facades\LaravelMpdf;
class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
{
@@ -58,8 +66,16 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
/** @var CreatesTransaction */
private $createsTransaction;
+ /** @var CreatesTransactionDetail */
+ private $createsTransactionDetail;
+
+ /** @var CreatesDocument */
+ private $createsDocument;
+
+ /** @var CreatesFiles */
+ private $createsFile;
+
// /** @var FetchesTransaction */
- // private $fetchesTransaction;
// /** @var UpdatesTransactionStatus */
// private $updatesTransactionStatus;
// /** @var CreatesDocument */
@@ -68,23 +84,16 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
// private $createsFile;
// /** @var PDF */
// private $pdf;
-
- /**
- * CreateSupplierTransactionLogic constructor.
- * @param FetchesPackingList $fetchesPackingList
- * @param GeneratesTransactionBillNumber $generatesTransactionBillNumber
- * @param CreatesTransaction $createsTransaction
- * @param FetchesTransaction $fetchesTransaction
- * @param UpdatesTransactionStatus $updatesTransactionStatus
- * @param PDF $pdf
- */
+
public function __construct(
FetchesPackingList $fetchesPackingList,
FetchesSegmentConstant $fetchesSegmentConstant,
GeneratesTransactionBillNumber $generatesTransactionBillNumber,
- CreatesTransaction $createsTransaction
+ CreatesTransaction $createsTransaction,
+ CreatesTransactionDetail $createsTransactionDetail,
+ CreatesDocument $createsDocument,
+ CreatesFiles $createsFile
- // UpdatesTransactionStatus $updatesTransactionStatus,
// CreatesDocument $createsDocument,
// CreatesFiles $createsFile,
// PDF $pdf
@@ -95,6 +104,9 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
$this->fetchesSegmentConstant = $fetchesSegmentConstant;
$this->generatesTransactionBillNumber = $generatesTransactionBillNumber;
$this->createsTransaction = $createsTransaction;
+ $this->createsTransactionDetail = $createsTransactionDetail;
+ $this->createsDocument = $createsDocument;
+ $this->createsFile = $createsFile;
// $this->updatesTransactionStatus = $updatesTransactionStatus;
// $this->createsDocument = $createsDocument;
@@ -185,8 +197,31 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
ApprovalStatus::PENDING_SUBMISSION
);
- $transactions = $this->createsTransaction->execute($packing_list, $object);
+ $invoice_transaction = $this->createsTransaction->execute($packing_list, $object);
+ $object_detail = new TransactionDetailObject(
+ $invoice_transaction->bill_no,
+ $invoice_transaction->bill_no,
+ 1,
+ $invoice_transaction->amount,
+ $invoice_transaction->amount
+ );
+ $transaction_detail = $this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
+
+ $transaction_invoice_pdf = LaravelMpdf::loadView('pages.pdfs.shipping_invoice', ['invoice_transaction' => $invoice_transaction]);
+
+ $document_object = new DocumentObject(
+ DocumentType::SHIPPING_INVOICE,
+ [chunk_split('data:application/pdf;base64,'.base64_encode($transaction_invoice_pdf->output()))],
+ '',
+ ApprovalStatus::COMPLETED,
+ 'shipping_invoice'
+ );
+ /** @var Document $document */
+ $document = $this->createsDocument->execute($invoice_transaction, $document_object);
+ $this->createsFile->execute($document, $document_object);
+
+ // dd('yess');
return $this->response([]);
}
}
diff --git a/app/Classes/Modules/Transactions/Services/CreatesTransactionDetail.php b/app/Classes/Modules/Transactions/Services/CreatesTransactionDetail.php
index 0e852ddf..bdb0f387 100644
--- a/app/Classes/Modules/Transactions/Services/CreatesTransactionDetail.php
+++ b/app/Classes/Modules/Transactions/Services/CreatesTransactionDetail.php
@@ -18,8 +18,8 @@ class CreatesTransactionDetail extends AbstractUpdateRelationshipRecord
*/
public function execute(Transaction $transaction, TransactionDetailObject $object) {
$model = new TransactionDetail();
- $model->product_code = $object->getCode();
- $model->product_name = $object->getName();
+ $model->reference = $object->getReference();
+ $model->name = $object->getName();
$model->quantity = $object->getQuantity();
$model->price = $object->getPrice();
$model->amount = $object->getAmount();
diff --git a/app/Classes/ValueObjects/Constants/DocumentType.php b/app/Classes/ValueObjects/Constants/DocumentType.php
index 2b053163..75db231a 100644
--- a/app/Classes/ValueObjects/Constants/DocumentType.php
+++ b/app/Classes/ValueObjects/Constants/DocumentType.php
@@ -21,4 +21,8 @@ final class DocumentType {
public const DELIVER_ORDER = 'DELIVER_ORDER';
public const INVOICE = 'INVOICE';
public const SUPPLIER_DELIVER_ORDER = 'SUPPLIER_DELIVER_ORDER';
+
+
+ public const SHIPPING_INVOICE = 'SHIPPING_INVOICE';
+
}
diff --git a/app/Classes/ValueObjects/Constants/NotificationType.php b/app/Classes/ValueObjects/Constants/NotificationType.php
new file mode 100644
index 00000000..0c9ec5a4
--- /dev/null
+++ b/app/Classes/ValueObjects/Constants/NotificationType.php
@@ -0,0 +1,11 @@
+ 'Unknown Action',
- 'message' => 'unknown message..'
+ public const NEW_ARRIVED_PARCEL = [
+ 'title' => 'New Arrived Parcel',
+ 'message' => 'you have received new parcel for your order #-'
];
+ public const UNDEFINED = [
+ 'title' => 'UNDEFINED TITLE',
+ 'message' => 'undefined message'
+ ];
}
\ No newline at end of file
diff --git a/app/Http/Controllers/Companies/ListCompanyModulesController.php b/app/Http/Controllers/Companies/ListCompanyModulesController.php
new file mode 100644
index 00000000..68bca75e
--- /dev/null
+++ b/app/Http/Controllers/Companies/ListCompanyModulesController.php
@@ -0,0 +1,20 @@
+execute($request);
+ }
+
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/Orders/CreateOrderRemarkController.php b/app/Http/Controllers/Orders/CreateOrderRemarkController.php
deleted file mode 100644
index 3464566a..00000000
--- a/app/Http/Controllers/Orders/CreateOrderRemarkController.php
+++ /dev/null
@@ -1,14 +0,0 @@
-execute($request);
- }
-}
\ No newline at end of file
diff --git a/app/Http/Controllers/Orders/DownloadOrderQrPdfController.php b/app/Http/Controllers/Orders/DownloadOrderQrPdfController.php
index b87012ec..3218be52 100644
--- a/app/Http/Controllers/Orders/DownloadOrderQrPdfController.php
+++ b/app/Http/Controllers/Orders/DownloadOrderQrPdfController.php
@@ -24,9 +24,9 @@ class DownloadOrderQrPdfController
$warehousePrefix = '';
$deliveryPrefix = '';
$customerMarking = '';
+ $remark = $warehouse->remarks()->first()->content;
if($warehouse->reference === WarehouseReferences::VT_GUANG_ZHOU || $warehouse->reference === WarehouseReferences::VT_YIWU) {
- $remark = '周一 至 周六 , 早上八点到下午六点';
$customerMarking = $order->companyModule->connections()->first()->invitee_reference.'/';
if(strtolower($deliveryAddress->state->name) === 'sabah' || strtolower($deliveryAddress->state->name) === 'labuan') {
$deliveryPrefix = 'SB/';
@@ -38,12 +38,10 @@ class DownloadOrderQrPdfController
}
if($warehouse->reference === WarehouseReferences::YD_YIWU){
- $remark = '周一 至 周六 , 早上九点到下午六点';
$warehousePrefix = 'YW/';
}
if($warehouse->reference === WarehouseReferences::YD_GUANG_ZHOU){
- $remark = '周日 至 周五 , 早上八点到下午六点';
$warehousePrefix = 'YD/';
if(strtolower($deliveryAddress->state->name) === 'sabah' || strtolower($deliveryAddress->state->name) === 'labuan') {
diff --git a/app/Http/Resources/CompanyModuleResource.php b/app/Http/Resources/CompanyModuleResource.php
index e1f253be..7af3ae8d 100644
--- a/app/Http/Resources/CompanyModuleResource.php
+++ b/app/Http/Resources/CompanyModuleResource.php
@@ -39,6 +39,7 @@ class CompanyModuleResource extends JsonResource
'reference' => $this->reference,
'address' => new AddressResource($defaultAddress),
'company' => new CompanyResource($this->whenLoaded('company')),
+ 'remarks' => RemarkResource::collection($this->remarks),
'marking' => $marking
];
diff --git a/app/Http/Resources/CountryResource.php b/app/Http/Resources/CountryResource.php
new file mode 100644
index 00000000..f15c41f8
--- /dev/null
+++ b/app/Http/Resources/CountryResource.php
@@ -0,0 +1,24 @@
+ $this->id,
+ 'name' => $this->name,
+ 'short_code' => $this->short_code,
+ 'phone_code' => $this->phone_code,
+ ];
+ }
+}
diff --git a/app/Http/Resources/PackingListResource.php b/app/Http/Resources/PackingListResource.php
index 82065b18..5256e3de 100644
--- a/app/Http/Resources/PackingListResource.php
+++ b/app/Http/Resources/PackingListResource.php
@@ -3,6 +3,7 @@
namespace App\Http\Resources;
use App\Classes\ValueObjects\Constants\PackingListType;
+use App\Classes\ValueObjects\Constants\TransactionType;
use App\Classes\ValueObjects\Constants\RoleTypes;
use App\Models\Order;
use App\Models\PackingList;
@@ -32,7 +33,8 @@ class PackingListResource extends JsonResource
'packages' => PackageResource::collection($packages),
$this->mergeWhen($this->owner instanceof Order, [
'order' => New OrderResource($this->owner)
- ])
+ ]),
+ 'shippng_transaction' => new TransactionResource($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->first()),
];
}
}
diff --git a/app/Http/Resources/TransactionResource.php b/app/Http/Resources/TransactionResource.php
index ef652fd7..05c35038 100644
--- a/app/Http/Resources/TransactionResource.php
+++ b/app/Http/Resources/TransactionResource.php
@@ -18,7 +18,7 @@ class TransactionResource extends JsonResource
return [
'id' => $this->id,
- 'booking' => new BookingResource($this->booking),
+ // 'booking' => new BookingResource($this->booking),
'type' => (int) $this->type,
'bill_no' => $this->bill_no,
'amount' => (double) $this->amount,
diff --git a/app/Models/AbstractModel.php b/app/Models/AbstractModel.php
index 7a7c9c06..f459750f 100644
--- a/app/Models/AbstractModel.php
+++ b/app/Models/AbstractModel.php
@@ -3,11 +3,39 @@
namespace App\Models;
+use App\Classes\General\Interfaces\Notifiable;
use Illuminate\Database\Eloquent\Model;
use Spatie\Activitylog\Traits\LogsActivity;
+use Illuminate\Database\Eloquent\Relations\MorphTo;
-class AbstractModel extends Model
+class AbstractModel extends Model implements Notifiable
{
use LogsActivity;
protected static $logFillable = true;
+
+ /**
+ * @return MorphTo
+ */
+ public function subject(): MorphTo
+ {
+ return $this->MorphTo('subject');
+ }
+
+ /**
+ * @return MorphTo
+ */
+ public function target(): MorphTo
+ {
+ return $this->MorphTo('target');
+ }
+
+ /**
+ * @return MorphTo
+ */
+ public function causer(): MorphTo
+ {
+ return $this->MorphTo('causer');
+ }
+
+
}
\ No newline at end of file
diff --git a/app/Models/CompanyModule.php b/app/Models/CompanyModule.php
index 180d8286..c4964447 100644
--- a/app/Models/CompanyModule.php
+++ b/app/Models/CompanyModule.php
@@ -23,6 +23,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use PhpParser\Node\Expr\AssignOp\Mod;
use Staudenmeir\EloquentHasManyDeep\HasManyDeep;
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
+use App\Classes\General\Interfaces\Remarkable;
/**
* Class CompanyModule
@@ -32,7 +33,7 @@ use Staudenmeir\EloquentHasManyDeep\HasRelationships;
* @property integer type
* @property integer status
*/
-class CompanyModule extends AbstractModel implements Addressable, Documentable, Contactable, ContainerOwner, Packable
+class CompanyModule extends AbstractModel implements Addressable, Documentable, Contactable, ContainerOwner, Packable, Remarkable
{
use HasRelationships;
use SoftDeletes;
@@ -177,6 +178,14 @@ class CompanyModule extends AbstractModel implements Addressable, Documentable,
return $query->where('type', '=', BusinessType::WAREHOUSE);
}
+ /**
+ * @return MorphMany
+ */
+ public function remarks(): morphMany
+ {
+ return $this->morphMany(Remark::class, 'owner');
+ }
+
}
diff --git a/app/Models/Notification.php b/app/Models/Notification.php
new file mode 100644
index 00000000..06bd6024
--- /dev/null
+++ b/app/Models/Notification.php
@@ -0,0 +1,18 @@
+BelongsTo(Package::class, 'package_id', 'id');
+ }
+}
diff --git a/app/Models/Order.php b/app/Models/Order.php
index 5aabfd44..5011fd36 100644
--- a/app/Models/Order.php
+++ b/app/Models/Order.php
@@ -6,6 +6,7 @@ use App\Classes\General\Interfaces\Addressable;
use App\Classes\General\Interfaces\Contactable;
use App\Classes\General\Interfaces\Packable;
use App\Classes\General\Interfaces\Remarkable;
+use App\Classes\General\Interfaces\Notifiable;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Classes\ValueObjects\Constants\RoleTypes;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
@@ -16,7 +17,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphMany;
-class Order extends AbstractModel implements Addressable, Packable, Remarkable
+class Order extends AbstractModel implements Addressable, Packable, Remarkable, Notifiable
{
use SoftDeletes;
@@ -153,8 +154,8 @@ class Order extends AbstractModel implements Addressable, Packable, Remarkable
/**
* @return morphMany
*/
- public function transactions(): morphMany
- {
- return $this->morphMany(Transaction::class, 'owner');
- }
+ // public function transactions(): morphMany
+ // {
+ // return $this->morphMany(Transaction::class, 'owner');
+ // }
}
diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php
index 232964d9..9ca9c24f 100644
--- a/app/Models/Transaction.php
+++ b/app/Models/Transaction.php
@@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphMany;
-
+use Illuminate\Database\Eloquent\Relations\MorphTo;
class Transaction extends AbstractModel implements Documentable
{
diff --git a/database/migrations/2022_02_18_120837_create_notifications_table.php b/database/migrations/2022_02_18_120837_create_notifications_table.php
new file mode 100644
index 00000000..d14cdc89
--- /dev/null
+++ b/database/migrations/2022_02_18_120837_create_notifications_table.php
@@ -0,0 +1,40 @@
+id();
+ $table->string('title');
+ $table->text('description');
+ $table->morphs('subject');
+ $table->morphs('target');
+ $table->morphs('causer');
+ $table->integer('status')->default(ApprovalStatus::APPROVED);
+ $table->softDeletes();
+ $table->timestamps();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::dropIfExists('notifications');
+ }
+}
diff --git a/resources/assets/vue/components/companies/sections/CustomerProfileDetailsSectionComponent.vue b/resources/assets/vue/components/companies/sections/CustomerProfileDetailsSectionComponent.vue
new file mode 100644
index 00000000..f61275e2
--- /dev/null
+++ b/resources/assets/vue/components/companies/sections/CustomerProfileDetailsSectionComponent.vue
@@ -0,0 +1,180 @@
+
+
+
+
+
{{item.status === 3 ? 'Un-stuffed' : 'In Progress'}}
{{item.transport ? item.transport.current_schedule.eta : 'n/a'}}
+
+ |
+
+
+
+ CIEF WORLDWIDE SDN BHD
+
+
+ (1134596-M) + Malaysian Global Innovation & Creativity Center + Level 1 CWS, Block 3730, Persiaran APEC, + 63000 Cyberjaya, Malaysian. + Tel: 018-2909252 + |
+
+
+
+ Invoice
+
+
+
+ EI#: {{ $invoice_transaction->bill_no }}
+
+ @php
+ $companyModule = $invoice_transaction->owner->owner->companyModule;
+ @endphp
+
+ Ref# {{ $invoice_transaction->owner->owner->reference }}
+
+ Date: {{ $invoice_transaction->created_at }}
+ |
+
| + + Bill To + + | +||
|
+
+ {{ $companyModule->name }}
+
+
+ @php
+ $addresses = $invoice_transaction->owner->owner->addresses()->where('status', '=', 2)->first();
+ @endphp
+ {{ $addresses->street_one }}
+ {{ $addresses->street_two }} ,
+ {{ $addresses->district()->first()->name }},
+ {{ $addresses->postcode }}
+ {{ $addresses->state()->first()->name }},
+ {{ $addresses->country()->first()->name }}
+
+
+ @php
+ $contact = $companyModule->contacts()->first();
+ @endphp
+ Phone: {{ $contact ? $contact->phone : '' }}
+
+ |
+ ||
| No | +Description | +Quantity | +Unit Price (RM) | +Total Amount (RM) |
+ |
|---|---|---|---|---|---|
| {{ $key + 1 }} | +{{ $transaction_detail->name }} | +{{ $transaction_detail->quantity }} | ++ {{ $transaction_detail->price }} + | ++ {{ $transaction_detail->amount }} + | +|
| + | Subtotal | ++ {{ number_format($invoice_transaction->amount, 2) }} + | +|||
| + | Service Charges | ++ {{ number_format($invoice_transaction->service_charge, 2) }} + | +|||
| + | Tax | +{{ number_format($invoice_transaction->tax, 2) }} | +|||
| + | Total | ++ {{ number_format($invoice_transaction->amount, 2) }} + | +|||
| This is generated by computer. No signature required. | +Page {PAGENO} of {nbpg} | +