mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-29 17:34:09 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3fe98b24a4 | |||
| 39892a0938 | |||
| 0ffe81d1cf | |||
| 5fd6e6a528 | |||
| 09ede52ecf | |||
| e5d6f3f581 |
@@ -169,16 +169,17 @@ class CreateCustomerLogic extends AbstractControllerLogic
|
|||||||
CreatePerfexCRMCustomer::dispatch($createLeadPerfexCRMObject);
|
CreatePerfexCRMCustomer::dispatch($createLeadPerfexCRMObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!app()->environment(['production'])){
|
if(app()->environment(['production'])){
|
||||||
// call wac webhook
|
// call wac webhook
|
||||||
$url = 'https://wacontact.readyspace.com/rest/trigger/9fe03daf-2ace-4095-b064-601ef6d9bfe7';
|
$url = config('wagWebhookUrl.account_registration_url');
|
||||||
$payload = [
|
$payload = [
|
||||||
'name' => $request->input('name'),
|
'name' => $request->input('name'),
|
||||||
'email' => $request->input('email'),
|
'email' => $request->input('email'),
|
||||||
'phone' => $request->input('phone'),
|
'phone' => $request->input('phone'),
|
||||||
|
'portal' => 'izyim'
|
||||||
];
|
];
|
||||||
$response = Http::post($url, $payload);
|
$response = Http::post($url, $payload);
|
||||||
Log::channel('wac_webhook')->info(json_encode($response));
|
Log::channel('wac_webhook')->info('Register Account: ' . json_encode($response));
|
||||||
}
|
}
|
||||||
|
|
||||||
// $this->generateEmailVerificationAttemptProcessor->execute($user);
|
// $this->generateEmailVerificationAttemptProcessor->execute($user);
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
|||||||
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
||||||
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
||||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||||
use App\Classes\ValueObjects\Constants\RemarkTypes;
|
|
||||||
use App\Http\Resources\AddressResource;
|
use App\Http\Resources\AddressResource;
|
||||||
use App\Models\Address;
|
use App\Models\Address;
|
||||||
use ErrorException;
|
use ErrorException;
|
||||||
@@ -101,16 +100,6 @@ class CreateAddressLogic extends AbstractControllerLogic
|
|||||||
$this->createRemarkProcessor->execute($address, $remarkObject);
|
$this->createRemarkProcessor->execute($address, $remarkObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
$addressExtraFields = [
|
|
||||||
'property_type' => $request->input('property_type'),
|
|
||||||
'tools_required_unload' => $request->input('tools_required_unload'),
|
|
||||||
'pickup_time_from' => $request->input('pickup_time_from'),
|
|
||||||
'pickup_time_to' => $request->input('pickup_time_to'),
|
|
||||||
];
|
|
||||||
|
|
||||||
$addressExtraFieldsObject = new RemarkObject(json_encode($addressExtraFields), Auth()->user()->id, RemarkTypes::ADDRESS_EXTRA_COLUMNS);
|
|
||||||
$this->createRemarkProcessor->execute($address, $addressExtraFieldsObject);
|
|
||||||
|
|
||||||
return $this->resourceResponse(new AddressResource($address));
|
return $this->resourceResponse(new AddressResource($address));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,12 +15,10 @@ use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
|||||||
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
||||||
use App\Classes\ValueObjects\Constants\AddressType;
|
use App\Classes\ValueObjects\Constants\AddressType;
|
||||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||||
use App\Classes\ValueObjects\Constants\RemarkTypes;
|
|
||||||
use App\Http\Resources\AddressResource;
|
use App\Http\Resources\AddressResource;
|
||||||
use App\Models\Address;
|
use App\Models\Address;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Carbon\Carbon;
|
|
||||||
|
|
||||||
class UpdateAddressLogic extends AbstractControllerLogic
|
class UpdateAddressLogic extends AbstractControllerLogic
|
||||||
{
|
{
|
||||||
@@ -104,25 +102,6 @@ class UpdateAddressLogic extends AbstractControllerLogic
|
|||||||
$this->createRemarkProcessor->execute($address, $remarkObject);
|
$this->createRemarkProcessor->execute($address, $remarkObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->input('pickup_time_to') <= $request->input('pickup_time_from')) {
|
|
||||||
$pickupTimeFrom = Carbon::parse($request->input('pickup_time_from'));
|
|
||||||
$request->merge([
|
|
||||||
'pickup_time_to' => $pickupTimeFrom->addHour()->format('H:i') // Format to hh:mm
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$addressExtraFields = [
|
|
||||||
'property_type' => $request->input('property_type'),
|
|
||||||
'additional_request' => $request->input('additional_request'),
|
|
||||||
'receive_goods_working_hours' => $request->input('receive_goods_working_hours'),
|
|
||||||
'receive_goods_after_hours' => $request->input('receive_goods_after_hours'),
|
|
||||||
'receive_goods_on_saturday' => $request->input('receive_goods_on_saturday'),
|
|
||||||
];
|
|
||||||
|
|
||||||
$address->addressExtraFields()->delete();
|
|
||||||
$addressExtraFieldsObject = new RemarkObject(json_encode($addressExtraFields), Auth()->user()->id, RemarkTypes::ADDRESS_EXTRA_COLUMNS);
|
|
||||||
$this->createRemarkProcessor->execute($address, $addressExtraFieldsObject);
|
|
||||||
|
|
||||||
return $this->resourceResponse(new AddressResource($address));
|
return $this->resourceResponse(new AddressResource($address));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,14 +13,10 @@ class RemarkObject implements DataTransferObject
|
|||||||
/** @var string*/
|
/** @var string*/
|
||||||
private $content;
|
private $content;
|
||||||
|
|
||||||
/** @var int|null */
|
public function __construct(string $content, int $commenterID)
|
||||||
private $type;
|
|
||||||
|
|
||||||
public function __construct(string $content, int $commenterID, int $type = null)
|
|
||||||
{
|
{
|
||||||
$this->commenterID = $commenterID;
|
$this->commenterID = $commenterID;
|
||||||
$this->content = $content;
|
$this->content = $content;
|
||||||
$this->type = $type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,12 +35,4 @@ class RemarkObject implements DataTransferObject
|
|||||||
return $this->content;
|
return $this->content;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int|null
|
|
||||||
*/
|
|
||||||
public function getType(): ?int
|
|
||||||
{
|
|
||||||
return $this->type;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ class CreatesRemark extends AbstractUpdateRelationshipRecord
|
|||||||
|
|
||||||
$model->commenter_id = $object->getCommenterId();
|
$model->commenter_id = $object->getCommenterId();
|
||||||
$model->content = $object->getContent();
|
$model->content = $object->getContent();
|
||||||
$model->type = $object->getType();
|
|
||||||
|
|
||||||
return $this->handler($remarkable->remarks(), $model);
|
return $this->handler($remarkable->remarks(), $model);
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ use Illuminate\Http\JsonResponse;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Mccarlosen\LaravelMpdf\Facades\LaravelMpdf;
|
use Mccarlosen\LaravelMpdf\Facades\LaravelMpdf;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
class CreateInvoiceTransactionProcessor
|
class CreateInvoiceTransactionProcessor
|
||||||
{
|
{
|
||||||
@@ -74,6 +75,18 @@ class CreateInvoiceTransactionProcessor
|
|||||||
*/
|
*/
|
||||||
public function execute(PackingList $packingList)
|
public function execute(PackingList $packingList)
|
||||||
{
|
{
|
||||||
|
$ori_packing_list = $packingList;
|
||||||
|
// call wac webhook
|
||||||
|
$hasInvoiceCreated = Transaction::withTrashed()
|
||||||
|
->where('type', TransactionType::SHIPPING_INVOICE)
|
||||||
|
->where('owner_type', PackingList::class)
|
||||||
|
->where('owner_id', $ori_packing_list->id)
|
||||||
|
->exists();
|
||||||
|
|
||||||
|
if ($hasInvoiceCreated) {
|
||||||
|
Log::channel('wac_webhook')->info('Regenerating Invoice for PackingList: ' . $ori_packing_list->id . '. No call wac api.');
|
||||||
|
}
|
||||||
|
|
||||||
$packing_list = PackingList::where('reference', $packingList->reference)->where('type', PackingListType::SHIPPING_PACKING_LIST)->first();
|
$packing_list = PackingList::where('reference', $packingList->reference)->where('type', PackingListType::SHIPPING_PACKING_LIST)->first();
|
||||||
|
|
||||||
$billable_packing_list = $packing_list->packingLists()->first();
|
$billable_packing_list = $packing_list->packingLists()->first();
|
||||||
@@ -238,6 +251,32 @@ class CreateInvoiceTransactionProcessor
|
|||||||
|
|
||||||
$this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
|
$this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (app()->environment('production') && !$hasInvoiceCreated) {
|
||||||
|
$order = $ori_packing_list->owner;
|
||||||
|
$companyModule = $order->companyModule;
|
||||||
|
$company = $companyModule->company;
|
||||||
|
$companyContact = $company->contacts()->first();
|
||||||
|
$employee = $companyModule->employees()->first();
|
||||||
|
|
||||||
|
$invoiceCount = Transaction::where('type', TransactionType::SHIPPING_INVOICE)
|
||||||
|
->where('receiver', $companyModule->id)
|
||||||
|
->where('status', ApprovalStatus::APPROVED)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
$payload = [
|
||||||
|
'name' => $employee->name,
|
||||||
|
'email' => $employee->email,
|
||||||
|
'phone' => $companyContact->phone,
|
||||||
|
'order_reference' => $order->reference,
|
||||||
|
'portal' => 'izyim',
|
||||||
|
'invoice_count' => $invoiceCount,
|
||||||
|
];
|
||||||
|
|
||||||
|
Log::channel('wac_webhook')->info('Attempt to send wac_webhook - Invoice Created: ' . json_encode($payload));
|
||||||
|
$response = Http::post(config('wagWebhookUrl.invoice_created_url'), $payload);
|
||||||
|
Log::channel('wac_webhook')->info('Invoice Created: ' . json_encode($response));
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,125 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Classes\Modules\Wac\ControllersLogic;
|
||||||
|
|
||||||
|
use App\Classes\Exceptions\RequestValidationException;
|
||||||
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||||
|
use App\Classes\Modules\Accounts\DataTransferObjects\RegistrationObject;
|
||||||
|
use App\Classes\Modules\Companies\DataTransferObjects\EmploymentObject;
|
||||||
|
use App\Classes\Modules\HelpMenu\Standards\Rules\CanFetchHelpMenuQuestion;
|
||||||
|
use App\Classes\Modules\HelpMenu\Processors\FetchFirstQuestionQAProcessor;
|
||||||
|
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||||
|
use App\Http\Resources\HelpMenuQuestionResource;
|
||||||
|
use App\Models\User;
|
||||||
|
use ErrorException;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use App\Classes\Modules\Companies\Processors\AssignEmployeeProcessor;
|
||||||
|
use App\Classes\Modules\Accounts\Services\CreatesUser;
|
||||||
|
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||||
|
|
||||||
|
class RegisterExchangeEmailLogic extends AbstractControllerLogic
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function notification(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'title' => 'Register Exchange Email',
|
||||||
|
'message' => 'You have successfully registered an exchange email address'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var AssignEmployeeProcessor */
|
||||||
|
private $assignEmployeeProcessor;
|
||||||
|
|
||||||
|
/** @var CreatesUser */
|
||||||
|
private $createsUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RegisterEmailLogic constructor.
|
||||||
|
* @param AssignEmployeeProcessor $assignEmployeeProcessor
|
||||||
|
*/
|
||||||
|
public function __construct(AssignEmployeeProcessor $assignEmployeeProcessor, CreatesUser $createsUser)
|
||||||
|
{
|
||||||
|
$this->assignEmployeeProcessor = $assignEmployeeProcessor;
|
||||||
|
$this->createsUser = $createsUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Request $request
|
||||||
|
* @return JsonResponse
|
||||||
|
* @throws ErrorException
|
||||||
|
*/
|
||||||
|
public function logic(Request $request): JsonResponse
|
||||||
|
{
|
||||||
|
// Validate the request inputs
|
||||||
|
$validator = Validator::make(
|
||||||
|
$request->all(),
|
||||||
|
[
|
||||||
|
'izyim_email' => 'email|required',
|
||||||
|
'exchange_email' => 'email|required',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
throw new RequestValidationException($validator->messages()->first());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieve the validated emails from the request
|
||||||
|
$izyimEmail = $request->input('izyim_email');
|
||||||
|
$exchangeEmail = $request->input('exchange_email');
|
||||||
|
|
||||||
|
// Check if both emails are the same
|
||||||
|
if ($izyimEmail === $exchangeEmail) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Both emails are the same.',
|
||||||
|
'status' => 'ok',
|
||||||
|
], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the exchange email already exists in the system
|
||||||
|
$existingUser = User::where('email', $exchangeEmail)->first();
|
||||||
|
if ($existingUser) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'The Exchange email already exists in the system.',
|
||||||
|
'status' => 'error',
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieve the izyim user
|
||||||
|
$izyimUser = User::where('email', $izyimEmail)->first();
|
||||||
|
if (!$izyimUser) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'The Izyim email not found in system.',
|
||||||
|
'status' => 'error',
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$newUser = new User();
|
||||||
|
$newUser->name = $izyimUser->name;
|
||||||
|
$newUser->email = $exchangeEmail;
|
||||||
|
$newUser->password = $izyimUser->password;
|
||||||
|
$newUser->type = RoleTypes::USER;
|
||||||
|
$newUser->status = ApprovalStatus::APPROVED;
|
||||||
|
$newUser->save();
|
||||||
|
|
||||||
|
Log::channel('wac_webhook')->info('Wac created user: ' . $exchangeEmail);
|
||||||
|
|
||||||
|
$companyModule = $izyimUser->companyModule->first();
|
||||||
|
$Object = new EmploymentObject($companyModule, $newUser);
|
||||||
|
|
||||||
|
$this->assignEmployeeProcessor->execute($Object);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Exchange email registered successfully.',
|
||||||
|
'status' => 'success',
|
||||||
|
], 201);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,4 @@ final class RemarkTypes
|
|||||||
|
|
||||||
public const EXTERNAL = 1;
|
public const EXTERNAL = 1;
|
||||||
|
|
||||||
public const ADDRESS_EXTRA_COLUMNS = 2;
|
}
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Wac;
|
||||||
|
|
||||||
|
use App\Classes\Modules\Wac\ControllersLogic\RegisterExchangeEmailLogic;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class RegisterExchangeEmailController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param Request $request
|
||||||
|
* @param FetchQuestionQALogic $logic
|
||||||
|
* @return JsonResponse
|
||||||
|
*/
|
||||||
|
public function register(Request $request, RegisterExchangeEmailLogic $logic): JsonResponse {
|
||||||
|
return $logic->execute($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -27,11 +27,7 @@ class AddressResource extends JsonResource
|
|||||||
$outstationPostcodeConstant = $outstationPostcodeConstantObject->isEmpty() ? [] : (array)$outstationPostcodeConstantObject->first()->value;
|
$outstationPostcodeConstant = $outstationPostcodeConstantObject->isEmpty() ? [] : (array)$outstationPostcodeConstantObject->first()->value;
|
||||||
in_array((String)$this->postcode, $outstationPostcodeConstant) ? $postcodeArea = 'OUTSTATION_POSTCODE' : null;
|
in_array((String)$this->postcode, $outstationPostcodeConstant) ? $postcodeArea = 'OUTSTATION_POSTCODE' : null;
|
||||||
|
|
||||||
// Handle extra fields
|
return [
|
||||||
$extrafields = $this->addressExtraFields->first();
|
|
||||||
$extrafields = $extrafields ? json_decode($extrafields->content, true) : [];
|
|
||||||
|
|
||||||
$returnArray = [
|
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'reference' => $this->reference,
|
'reference' => $this->reference,
|
||||||
'street_one' => $this->street_one,
|
'street_one' => $this->street_one,
|
||||||
@@ -56,12 +52,5 @@ class AddressResource extends JsonResource
|
|||||||
])
|
])
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// Merge extra fields into the return array
|
|
||||||
if ($extrafields) {
|
|
||||||
$returnArray = array_merge($returnArray, $extrafields);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $returnArray;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ namespace App\Http\Resources;
|
|||||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||||
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
|
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
|
||||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||||
use App\Classes\ValueObjects\Constants\RemarkTypes;
|
|
||||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||||
use App\Classes\ValueObjects\Constants\TransportType;
|
use App\Classes\ValueObjects\Constants\TransportType;
|
||||||
use App\Models\Transaction;
|
use App\Models\Transaction;
|
||||||
@@ -54,7 +53,7 @@ class OrderResource extends JsonResource
|
|||||||
'invoices' => $this->whenLoaded('packingLists', function() use ($orderId) {
|
'invoices' => $this->whenLoaded('packingLists', function() use ($orderId) {
|
||||||
return TransactionResource::collection($this->transactions()->whereNotIn('transactions.status', [0, 1])->where('transactions.type', TransactionType::SHIPPING_INVOICE)->get());
|
return TransactionResource::collection($this->transactions()->whereNotIn('transactions.status', [0, 1])->where('transactions.type', TransactionType::SHIPPING_INVOICE)->get());
|
||||||
}),
|
}),
|
||||||
'remark' => new RemarkResource($this->remarks->first()),
|
'remarks' => RemarkResource::collection($this->remarks),
|
||||||
'created_at' => $this->created_at->format('d-m-Y')
|
'created_at' => $this->created_at->format('d-m-Y')
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
+1
-10
@@ -4,7 +4,6 @@ namespace App\Models;
|
|||||||
|
|
||||||
use App\Classes\General\Interfaces\Contactable;
|
use App\Classes\General\Interfaces\Contactable;
|
||||||
use App\Classes\General\Interfaces\Remarkable;
|
use App\Classes\General\Interfaces\Remarkable;
|
||||||
use App\Classes\ValueObjects\Constants\RemarkTypes;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||||
@@ -88,14 +87,6 @@ class Address extends AbstractModel implements Contactable, Remarkable
|
|||||||
*/
|
*/
|
||||||
public function remarks(): morphMany
|
public function remarks(): morphMany
|
||||||
{
|
{
|
||||||
return $this->morphMany(Remark::class, 'owner')->whereNull('type');
|
return $this->morphMany(Remark::class, 'owner');
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return MorphMany
|
|
||||||
*/
|
|
||||||
public function addressExtraFields(): MorphMany
|
|
||||||
{
|
|
||||||
return $this->morphMany(Remark::class, 'owner')->where('type', RemarkTypes::ADDRESS_EXTRA_COLUMNS);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'account_registration_url' => 'https://wacontact.readyspace.com/rest/trigger/9fe03daf-2ace-4095-b064-601ef6d9bfe7',
|
||||||
|
'invoice_created_url' => 'https://wacontact.readyspace.com/rest/trigger/c0d38aa7-91ac-458b-8014-cf3287a636e4',
|
||||||
|
];
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
class AddTypeToRemarksTable extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function up()
|
|
||||||
{
|
|
||||||
Schema::table('remarks', function (Blueprint $table) {
|
|
||||||
$table->string('type')->nullable();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
Schema::table('remarks', function (Blueprint $table) {
|
|
||||||
$table->dropColumn('type');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -31,7 +31,6 @@
|
|||||||
"vue": "^2.6.10",
|
"vue": "^2.6.10",
|
||||||
"vue-avatar": "^2.1.8",
|
"vue-avatar": "^2.1.8",
|
||||||
"vue-debounce": "^2.6.0",
|
"vue-debounce": "^2.6.0",
|
||||||
"vue-multi-select": "^4.6.0",
|
|
||||||
"vue-template-compiler": "^2.6.10",
|
"vue-template-compiler": "^2.6.10",
|
||||||
"vue-the-mask": "^0.11.1",
|
"vue-the-mask": "^0.11.1",
|
||||||
"vuelidate": "^0.7.4",
|
"vuelidate": "^0.7.4",
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="row" v-if="![7,8].includes($store.getters.getCompanyModuleType)">
|
<div class="row" v-if="![7,8].includes($store.getters.getCompanyModuleType)">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
<div class="row m-b-15">
|
||||||
|
<div class="col">
|
||||||
|
<validation-wrapper-component :validator="$v.parameters.reference">
|
||||||
|
<label>Address Reference/Label</label>
|
||||||
|
<input class="form-control" name="reference" v-model="parameters.reference">
|
||||||
|
</validation-wrapper-component>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row m-b-15">
|
<div class="row m-b-15">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<validation-wrapper-component :validator="$v.parameters.street_one">
|
<validation-wrapper-component :validator="$v.parameters.street_one">
|
||||||
@@ -33,14 +41,6 @@
|
|||||||
</validation-wrapper-component>
|
</validation-wrapper-component>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row m-b-15">
|
|
||||||
<div class="col">
|
|
||||||
<validation-wrapper-component :validator="$v.parameters.reference">
|
|
||||||
<label>Address Name / Label</label>
|
|
||||||
<input class="form-control" name="reference" v-model="parameters.reference" placeholder="E.g. Home Address">
|
|
||||||
</validation-wrapper-component>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -59,6 +59,14 @@
|
|||||||
</validation-wrapper-component>
|
</validation-wrapper-component>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row m-b-15">
|
||||||
|
<div class="col">
|
||||||
|
<validation-wrapper-component :validator="$v.parameters.remark">
|
||||||
|
<label>Delivery Remark</label>
|
||||||
|
<input class="form-control" name="remark" v-model="parameters.remark">
|
||||||
|
</validation-wrapper-component>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -117,70 +125,16 @@
|
|||||||
</validation-wrapper-component>
|
</validation-wrapper-component>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="row m-b-15">
|
||||||
</div>
|
<div class="col">
|
||||||
<div class="row m-b-15">
|
<validation-wrapper-component :validator="$v.parameters.remark">
|
||||||
<div class="col">
|
<label>Remark</label>
|
||||||
<validation-wrapper-component :validator="$v.parameters.remark">
|
<input class="form-control" name="remark" v-model="parameters.remark">
|
||||||
<label>Delivery Remark</label>
|
</validation-wrapper-component>
|
||||||
<input class="form-control" name="remark" v-model="parameters.remark">
|
|
||||||
</validation-wrapper-component>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row m-b-15">
|
|
||||||
<div class="col">
|
|
||||||
<validation-wrapper-component selectable :validator="$v.parameters.property_type">
|
|
||||||
<label>房型 Receiver's property type</label>
|
|
||||||
<select-component :options="['住家Landed house', '公寓Condominium (Drop on lobby only)', '工厂Factory', '店面Shop', '商场Shopping Mall (Drop on loading bay only)', 'Others']" v-model="parameters.property_type"></select-component>
|
|
||||||
</validation-wrapper-component>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row m-b-15">
|
|
||||||
<div class="col">
|
|
||||||
<div class="form-group no-margin form-group-default p-b-5">
|
|
||||||
<label>Available to receive goods on: </label>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12 col-md pb-3 pb-md-0">
|
|
||||||
<div class="row justify-content-center m-t-10 m-b-10" @click="parameters.receive_goods_working_hours = !parameters.receive_goods_working_hours">
|
|
||||||
<div class="col pointer d-flex justtify-content-center align-items-center">
|
|
||||||
<i class="fa fs-20 fa-fw m-r-5" :class="{'fa-square-o': !parameters.receive_goods_working_hours, 'fa-check-square': parameters.receive_goods_working_hours, 'text-primary':parameters.receive_goods_working_hours}" ></i>
|
|
||||||
<p class="m-b-0">Working Hours (9am-6pm)</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-12 col-md pb-3 pb-md-0">
|
|
||||||
<div class="row justify-content-center m-t-10 m-b-10" @click="parameters.receive_goods_after_hours = !parameters.receive_goods_after_hours">
|
|
||||||
<div class="col pointer d-flex justtify-content-center align-items-center">
|
|
||||||
<i class="fa fs-20 fa-fw m-r-5" :class="{'fa-square-o': !parameters.receive_goods_after_hours, 'fa-check-square': parameters.receive_goods_after_hours, 'text-primary':parameters.receive_goods_after_hours}" ></i>
|
|
||||||
<p class="m-b-0">After Working Hours</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-12 col-md pb-3 pb-md-0">
|
|
||||||
<div class="row justify-content-center m-t-10 m-b-10" @click="parameters.receive_goods_on_saturday = !parameters.receive_goods_on_saturday">
|
|
||||||
<div class="col pointer d-flex justtify-content-center align-items-center">
|
|
||||||
<i class="fa fs-20 fa-fw m-r-5" :class="{'fa-square-o': !parameters.receive_goods_on_saturday, 'fa-check-square': parameters.receive_goods_on_saturday, 'text-primary':parameters.receive_goods_on_saturday}" ></i>
|
|
||||||
<p class="m-b-0">On Saturday</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row m-b-15">
|
|
||||||
<div class="col">
|
|
||||||
<validation-wrapper-component :validator="$v.parameters.additional_request">
|
|
||||||
<label>Additional Request</label>
|
|
||||||
<input class="form-control" name="additional_request" v-model="parameters.additional_request">
|
|
||||||
</validation-wrapper-component>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row justify-content-center allign-items-center">
|
|
||||||
<div class="col-12 col-sm-7">
|
|
||||||
<h6 class="text-center fs-12 text-danger">**kindly reply within 2 hours while warehouse contact to arrange for delivery, otherwise, reschedule of delivery date will apply</h6>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -200,7 +154,7 @@
|
|||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: Number,
|
type: Number,
|
||||||
// required: true
|
required: true
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
type: Number,
|
type: Number,
|
||||||
@@ -220,11 +174,6 @@
|
|||||||
remark: '',
|
remark: '',
|
||||||
phone: '',
|
phone: '',
|
||||||
person_in_charge: '',
|
person_in_charge: '',
|
||||||
property_type: '',
|
|
||||||
additional_request: '',
|
|
||||||
receive_goods_working_hours: false,
|
|
||||||
receive_goods_after_hours: false,
|
|
||||||
receive_goods_on_saturday: false,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -240,11 +189,6 @@
|
|||||||
this.parameters.phone = this.data.contact ? this.data.contact.phone : '';
|
this.parameters.phone = this.data.contact ? this.data.contact.phone : '';
|
||||||
this.parameters.person_in_charge = this.data.contact ? this.data.contact.reference : '';
|
this.parameters.person_in_charge = this.data.contact ? this.data.contact.reference : '';
|
||||||
this.parameters.remark = this.data.remark ? this.data.remark.content : '';
|
this.parameters.remark = this.data.remark ? this.data.remark.content : '';
|
||||||
this.parameters.property_type = this.data.property_type ? this.data.property_type : '';
|
|
||||||
this.parameters.additional_request = this.data.additional_request ? this.data.additional_request : '';
|
|
||||||
this.parameters.receive_goods_working_hours = this.data.receive_goods_working_hours ? this.data.receive_goods_working_hours : false;
|
|
||||||
this.parameters.receive_goods_after_hours = this.data.receive_goods_after_hours ? this.data.receive_goods_after_hours : false;
|
|
||||||
this.parameters.receive_goods_on_saturday = this.data.receive_goods_on_saturday ? this.data.receive_goods_on_saturday : false;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="w-100 multi-select-container">
|
|
||||||
<vue-multi-select ref="multiSelect" v-model="localValue" search :options="settings" :btnLabel="btnLabel" :selectOptions="options" class="w-100" style="height: 25px;" @close="close">
|
|
||||||
<template v-slot:option="{ option }">
|
|
||||||
<div class="d-flex justify-content-start align-items-center">
|
|
||||||
<input class="m-l-5 m-r-5" type="checkbox" :checked="option.selected" />
|
|
||||||
<span>{{ option.name }}</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</vue-multi-select>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import vueMultiSelect from 'vue-multi-select';
|
|
||||||
import 'vue-multi-select/dist/lib/vue-multi-select.css';
|
|
||||||
import PerfectScrollbar from 'perfect-scrollbar';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
props: {
|
|
||||||
value: {
|
|
||||||
type: Array,
|
|
||||||
required: false,
|
|
||||||
default: () => []
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
type: Array,
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
localValue: this.value,
|
|
||||||
settings: {
|
|
||||||
multi: true,
|
|
||||||
groups: false,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
btnLabel(localValue) {
|
|
||||||
if (localValue.length === 0) {
|
|
||||||
return 'Please select';
|
|
||||||
}
|
|
||||||
return localValue.join(', ');
|
|
||||||
},
|
|
||||||
close() {
|
|
||||||
this.$emit('input', this.localValue);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
vueMultiSelect,
|
|
||||||
PerfectScrollbar,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.multi-select-container .select>button {
|
|
||||||
width: 100%;
|
|
||||||
min-height: unset;
|
|
||||||
}
|
|
||||||
|
|
||||||
.multi-select-container .select .selectItem {
|
|
||||||
color: black !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
+3
-6
@@ -10,18 +10,15 @@ export default {
|
|||||||
},
|
},
|
||||||
street_one: { required },
|
street_one: { required },
|
||||||
street_two: {
|
street_two: {
|
||||||
required
|
required: requiredIf(function(){
|
||||||
// required: requiredIf(function(){
|
return [7,8].includes(this.$store.getters.getCompanyModuleType);
|
||||||
// return [7,8].includes(this.$store.getters.getCompanyModuleType);
|
})
|
||||||
// })
|
|
||||||
},
|
},
|
||||||
district_id: { required },
|
district_id: { required },
|
||||||
post_code: { required },
|
post_code: { required },
|
||||||
remark: {},
|
remark: {},
|
||||||
phone: {required, numeric},
|
phone: {required, numeric},
|
||||||
person_in_charge: { required },
|
person_in_charge: { required },
|
||||||
property_type: { required },
|
|
||||||
additional_request: { },
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mixins: [addressFormHandler]
|
mixins: [addressFormHandler]
|
||||||
|
|||||||
@@ -12,5 +12,9 @@ Route::group(['middleware' => 'apipub', 'prefix' => 'v1', 'as' => 'apipub.'], fu
|
|||||||
Route::group(['prefix' => 'feedback', 'as' => 'feedback.', 'namespace' => 'HelpMenu'], function () {
|
Route::group(['prefix' => 'feedback', 'as' => 'feedback.', 'namespace' => 'HelpMenu'], function () {
|
||||||
Route::post('/generate', 'GenerateFeedbackUrlController@generate')->name('feedback.url.generate');
|
Route::post('/generate', 'GenerateFeedbackUrlController@generate')->name('feedback.url.generate');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::group(['prefix' => 'wac', 'as' => 'wac.', 'namespace' => 'Wac'], function () {
|
||||||
|
Route::post('/register-email', 'RegisterExchangeEmailController@register')->name('register_email');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user