Compare commits

...

33 Commits

Author SHA1 Message Date
Dillon 43cd6f35be New route, middleware, token table, filters for query to allow third party to access api 2023-04-06 22:57:50 +08:00
edmondlang 069c3cea35 Showing Billplz payment status 2023-04-02 12:09:44 +08:00
edmondlang 07998c6850 super admin delete invoice/transaction 2023-04-02 11:25:50 +08:00
Dillon Ngo cd3e955f3e Merge branch 'dillon/debug-and-fixes-2' into 'master'
Another attempt to solve invoice without projectId, rewriting job chaining one after another

See merge request CIEFWorldwideSdnBhd/shipping-portal!160
2023-04-01 16:28:55 +00:00
edmondlang 869397056c final-duplicated-invoice-debug 2023-04-01 19:36:43 +08:00
edmondlang c58cdde254 final-duplicated-invoice-debug 2023-04-01 19:35:47 +08:00
edmondlang 982a7c1d44 final-duplicated-invoice-debug 2023-04-01 19:34:30 +08:00
edmondlang c976319521 final-duplicated-invoice-debug 2023-04-01 19:19:48 +08:00
edmondlang 145bf3263a final-duplicated-invoice-debug 2023-04-01 18:51:37 +08:00
edmondlang 57eb1e147d final-duplicated-invoice-debug 2023-04-01 18:48:34 +08:00
edmondlang e1c69f2de4 final-duplicated-invoice-debug 2023-04-01 18:35:15 +08:00
edmondlang 90b2bffd19 final-duplicated-invoice-debug 2023-04-01 18:31:02 +08:00
edmondlang 562815f9fe final-duplicated-invoice-debug 2023-04-01 18:27:04 +08:00
edmondlang 401db91437 final-duplicated-invoice-debug 2023-04-01 18:20:22 +08:00
edmondlang 0d1a623512 final-duplicated-invoice-debug 2023-04-01 17:36:59 +08:00
edmondlang 548a50c14a final-duplicated-invoice-debug 2023-04-01 17:33:51 +08:00
edmondlang 299512ec08 final-duplicated-invoice-debug 2023-04-01 17:29:28 +08:00
edmondlang 7241db7743 final-duplicated-invoice-debug 2023-04-01 17:27:13 +08:00
edmondlang ce24deea18 final-duplicated-invoice-debug 2023-04-01 17:11:07 +08:00
edmondlang c4642c2042 final-duplicated-invoice-debug 2023-04-01 17:06:37 +08:00
edmondlang 3871d8c010 clean up web routes 2023-04-01 16:01:20 +08:00
edmondlang cb65a1f29b fix bug billplz failed callback 2023-03-31 21:24:43 +08:00
edmondlang b1b13d7cbf fix bug billplz failed callback 2023-03-31 21:21:26 +08:00
Omair Saleh f6fa2fcf51 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	routes/web.php
2023-03-31 15:44:13 +08:00
Omair Saleh 6c00a57446 smc summary report 2023-03-31 15:43:04 +08:00
edmondlang 48445020fb adjust warehouse contact ui 2023-03-31 00:41:45 +08:00
edmondlang 46f1368a92 ui and api to update warehouse contact 2023-03-31 00:29:15 +08:00
edmondlang 82a16a5d9d update address 2023-03-30 17:26:19 +08:00
edmondlang 23002f61da update admin role type 2023-03-30 15:13:41 +08:00
edmondlang 2355c74b65 update customer/summary/monthly to 2023 records 2023-03-30 14:22:10 +08:00
edmondlang bd81560c3d remove console.log 2023-03-30 14:21:31 +08:00
edmondlang 575491e500 search admin in settings 2023-03-30 14:18:22 +08:00
Dillon 94d96c96ea Another attempt to solve invoice without projectId, rewriting job chaining one after another 2023-03-30 05:58:26 +08:00
43 changed files with 1449 additions and 197 deletions
@@ -0,0 +1,19 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class AmountExceed implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('amount', '>', $value);
}
}
@@ -0,0 +1,19 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class AmountShort implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('amount', '<', $value);
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
class CreatedBefore implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('created_at', '<', Carbon::parse($value));
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class EmailLike implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('email', 'LIKE', '%'.$value.'%');
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class PaymentMethod implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('payment_method', $value);
}
}
+23 -2
View File
@@ -9,6 +9,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMObject;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMInvoiceObject;
class UpdatePerfexCRM implements ShouldQueue
{
@@ -17,17 +18,37 @@ class UpdatePerfexCRM implements ShouldQueue
/** @var UpdatePerfexCRMObject */
private $updatePerfexCRMObject;
/** @var UpdatePerfexCRMInvoice */
private $nextJob;
/** @var */
private $transaction;
/**
* UpdatePerfexCRM constructor.
* @param UpdatePerfexCRMObject $updatePerfexCRMObject
* @param UpdatePerfexCRMInvoice $nextJob
* @param $transaction
*/
public function __construct(UpdatePerfexCRMObject $updatePerfexCRMObject)
public function __construct(UpdatePerfexCRMObject $updatePerfexCRMObject, $transaction, $nextJob)
{
$this->updatePerfexCRMObject = $updatePerfexCRMObject;
$this->nextJob = $nextJob;
$this->transaction = $transaction;
}
public function handle()
{
(App()->make(UpdatePerfexCRMProcessor::class))->execute($this->updatePerfexCRMObject);
$result = (App()->make(UpdatePerfexCRMProcessor::class))->execute($this->updatePerfexCRMObject);
if($this->nextJob != null && $this->transaction != null){
$updatePerfexCRMInvoiceOject = new UpdatePerfexCRMInvoiceObject(
$this->updatePerfexCRMObject->getContactEmail(),
$result->projectId,
$this->transaction,
true
);
/** @var UpdatePerfexCRMInvoice $nextJob */
$this->nextJob::dispatch($updatePerfexCRMInvoiceOject);
}
}
}
+3 -20
View File
@@ -47,6 +47,7 @@ class UpdatePerfexCRMInvoice implements ShouldQueue
$invoiceId = 0;
$invoiceStatus = 0;
$invoice = (App()->make(FetchesPerfexCRMInvoice::class))->execute($customer->userid,"INV-", $transaction->owner->bill_no);
Log::error(json_encode('UpdatePerfexCRMInvoice debug $transaction->owner->bill_no: '.$transaction->owner->bill_no));
if(is_null($invoice)){
$result = (App()->make(CreatePerfexCRMInvoiceProcessor::class))->execute($transaction->owner, $this->updatePerfexCRMInvoiceObject->getIsPaid());
@@ -58,27 +59,9 @@ class UpdatePerfexCRMInvoice implements ShouldQueue
//This only run when invoice already exist and the invoice does not have a PAID status
if($invoiceStatus != PerfexCRMInvoiceStatus::PAID){
//get project
$projectId = "";
$projectName = "";
if($transaction->owner instanceof Transaction){
$orderReference = $transaction->owner->owner->owner()->first()->reference;
$packingListReference = $transaction->owner->owner->reference;
$projectName = 'IZYIM | X1 Shipping | '.$orderReference.' | '.$packingListReference;
$result = (App()->make(FetchesPerfexCRMProject::class))->execute($projectName, $customer->userid);
if(isset($result->payload)){
$project = $result->payload[0];
$projectId = $project['id'];
}
}
if($projectId == ""){
Log::error(json_encode('UpdatePerfexCRMInvoice debug: '.$projectName));
Log::error(json_encode($transaction->owner));
}
Log::error(json_encode('UpdatePerfexCRMInvoice debug $this->updatePerfexCRMInvoiceObject->getProjectId(): '.$this->updatePerfexCRMInvoiceObject->getProjectId()));
//update invoice
(App()->make(UpdatesPerfexCRMInvoice::class))->execute($invoice, $projectId);
(App()->make(UpdatesPerfexCRMInvoice::class))->execute($invoice, $this->updatePerfexCRMInvoiceObject->getProjectId());
}
}
+14 -6
View File
@@ -3,6 +3,7 @@
namespace App\Classes\Jobs;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMObject;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMInvoiceObject;
use App\Models\PackingList;
use App\Models\Transaction;
use Illuminate\Bus\Queueable;
@@ -26,22 +27,27 @@ class UpdatePerfexCRMPrelude implements ShouldQueue
/** @var UpdatePerfexCRMObject */
private $updatePerfexCRMObject;
/** @var */
private $nextJob;
/** @var UpdatePerfexCRM */
private $nextJob1;
/** @var UpdatePerfexCRMInvoice */
private $nextJob2;
/**
* UpdatePerfexCRMPrelude constructor.
* @param $packingList
* @param $transaction
* @param UpdatePerfexCRMObject $updatePerfexCRMObject
* @param $nextJob
* @param UpdatePerfexCRM $nextJob1
* @param UpdatePerfexCRMInvoice $nextJob2
*/
public function __construct($packingList, $transaction, UpdatePerfexCRMObject $updatePerfexCRMObject, $nextJob)
public function __construct($packingList, $transaction, UpdatePerfexCRMObject $updatePerfexCRMObject, $nextJob1, $nextJob2)
{
$this->packingList = $packingList;
$this->transaction = $transaction;
$this->updatePerfexCRMObject = $updatePerfexCRMObject;
$this->nextJob = $nextJob;
$this->nextJob1 = $nextJob1;
$this->nextJob2 = $nextJob2;
}
public function handle()
@@ -63,7 +69,9 @@ class UpdatePerfexCRMPrelude implements ShouldQueue
$result = $this->replacePlaceholders($this->updatePerfexCRMObject->getTasks(), $data);
$this->updatePerfexCRMObject->setTasks($result);
$this->nextJob::dispatch($this->updatePerfexCRMObject);
/** @var UpdatePerfexCRM $nextJob1 */
/** @var UpdatePerfexCRMInvoice $nextJob2 */
$this->nextJob1::dispatch($this->updatePerfexCRMObject, $this->transaction, $this->nextJob2);
}
function replacePlaceholders($template, $data, $prefix = '')
@@ -0,0 +1,69 @@
<?php
namespace App\Classes\Modules\Contacts\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Contacts\Services\UpdatesContact;
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Classes\Modules\Contacts\Services\FetchesContact;
use App\Http\Resources\ContactResource;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class UpdateContactLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Updated Contact',
'message' => 'You have successfully updated the Contact'
];
}
/** @var UpdatesContact */
private $updatesContact;
/** @var FetchesContact */
private $fetchesContact;
/**
* UpdateContactLogic constructor.
* @param UpdatesContact $updatesContact
* @param FetchesContact $fetchesContact
*/
public function __construct(UpdatesContact $updatesContact, FetchesContact $fetchesContact)
{
$this->updatesContact = $updatesContact;
$this->fetchesContact = $fetchesContact;
}
/**
* @param Request $request
* @return JsonResponse
* @throws ErrorException
*/
public function logic(Request $request) : JsonResponse
{
$object = new ContactObject(
$request->input('reference'),
$request->input('phone'),
$request->input('email'),
$request->input('wechat_id')
);
// $this->canUpdateContact->passes($object);
$query = $this->fetchesContact->execute(['id' => $request->route('id')]);
$query = $this->updatesContact->execute($query, $object);
return $this->resourceResponse(new ContactResource($query));
}
}
@@ -0,0 +1,32 @@
<?php
namespace App\Classes\Modules\Contacts\Services;
use App\Classes\General\Eloquent\AbstractFetchRecord;
use Illuminate\Database\Eloquent\Builder;
use App\Models\Contact;
class FetchesContact extends AbstractFetchRecord
{
/** @var Contact */
private $repository;
/**
* FetchesContact constructor.
* @param Contact $repository
*/
public function __construct(Contact $repository)
{
$this->repository = $repository;
}
/**
* @return Builder
*/
public function getRepository(): Builder
{
return $this->repository->newQuery();
}
}
@@ -0,0 +1,26 @@
<?php
namespace App\Classes\Modules\Contacts\Services;
use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Models\Contact;
class UpdatesContact extends AbstractUpdateRecord
{
/**
* @param Contact $model
* @return \Illuminate\Database\Eloquent\Model
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(Contact $model, ContactObject $object)
{
$model->reference = $object->getReference();
$model->phone = $object->getPhone();
$model->email = $object->getEmail();
$model->wechat_id = $object->getWechatId();
return $this->handler($model);
}
}
@@ -17,11 +17,15 @@ class UpdatePerfexCRMInvoiceObject implements DataTransferObject
/** @var bool */
private $isPaid;
public function __construct(string $email, Transaction $transaction, bool $isPaid)
/** @var string */
private $projectId;
public function __construct(string $email, string $projectId, Transaction $transaction, bool $isPaid)
{
$this->email = $email;
$this->transaction = $transaction;
$this->isPaid = $isPaid;
$this->projectId = $projectId;
}
/**
@@ -32,6 +36,14 @@ class UpdatePerfexCRMInvoiceObject implements DataTransferObject
return $this->email;
}
/**
* @return string
*/
public function getProjectId(): string
{
return $this->projectId;
}
/**
* @return Transaction
*/
@@ -48,7 +48,7 @@ class PackingListToPerfexCRMProcessor
PerfexCRMTasks::TASK_LOADED_CONTAINER_2,
]
);
UpdatePerfexCRMPrelude::dispatch($packingList, null, $updatePerfexCRMObject, UpdatePerfexCRM::class);
UpdatePerfexCRMPrelude::dispatch($packingList, null, $updatePerfexCRMObject, UpdatePerfexCRM::class, null);
}
} catch (\Exception $exception){
Log::error(json_encode('PackingListToPerfexCRMProcessor debug:'));
@@ -2,13 +2,7 @@
namespace App\Classes\Modules\PerfexCRM\Processors;
use App\Classes\Modules\PerfexCRM\Processors\UpdatePerfexCRMProcessor;
use App\Classes\Modules\PerfexCRM\Services\Init;
use App\Classes\Modules\Companies\Services\FetchesCompany;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMObject;
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMInvoiceObject;
use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\ValueObjects\Constants\PerfexCRMMilestones;
use App\Classes\ValueObjects\Constants\PerfexCRMTasks;
use App\Classes\ValueObjects\Constants\PerfexCRMProjectStatus;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
@@ -21,25 +15,6 @@ use Illuminate\Support\Facades\Log;
class TransactionToPerfexCRMProcessor
{
/** @var FetchesCompany */
private $fetchesCompany;
/** @var UpdatePerfexCRMProcessor */
private $updatePerfexCRMProcessor;
/**
* TransactionToPerfexCRMProcessor constructor.
* @param UpdatePerfexCRMProcessor $updatePerfexCRMProcessor
* @param FetchesCompany $fetchesCompany
*/
public function __construct(UpdatePerfexCRMProcessor $updatePerfexCRMProcessor, FetchesCompany $fetchesCompany)
{
$this->updatePerfexCRMProcessor = $updatePerfexCRMProcessor;
$this->fetchesCompany = $fetchesCompany;
}
/**
* @param Transaction $model
* @param int $status
@@ -84,14 +59,7 @@ class TransactionToPerfexCRMProcessor
]
);
UpdatePerfexCRMPrelude::dispatch(null, $model, $updatePerfexCRMObject, UpdatePerfexCRM::class);
$updatePerfexCRMInvoiceOject = new UpdatePerfexCRMInvoiceObject(
$contactEmail,
$model,
true
);
UpdatePerfexCRMInvoice::dispatch($updatePerfexCRMInvoiceOject)->delay(6);
UpdatePerfexCRMPrelude::dispatch(null, $model, $updatePerfexCRMObject, UpdatePerfexCRM::class, UpdatePerfexCRMInvoice::class);
}
else if($model->owner instanceof \App\Models\PackingList && $model->status == ApprovalStatus::PENDING_SUBMISSION && $status == ApprovalStatus::APPROVED)
{
@@ -108,6 +108,7 @@ class UpdatePerfexCRMProcessor
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(UpdatePerfexCRMObject $updatePerfexCRMObject) {
$projectId = "";
// Customer has to exist first before Project can appear under it
// Check with Perfex CRM, if this user (email) was previously a lead, should automatically now become a customer
@@ -221,7 +222,10 @@ class UpdatePerfexCRMProcessor
}
}
}
return true;
$payload = [];
$payload['projectId'] = $projectId;
return (object) $payload;
}
}
@@ -0,0 +1,52 @@
<?php
namespace App\Classes\Modules\Transactions\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class DeleteTransactionLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Delete Transaction',
'message' => 'You have successfully deleted the transaction'
];
}
/** @var FetchesTransaction */
private $fetchesTransaction;
/** @var UpdatesTransactionStatus */
private $updatesTransactionStatus;
/**
* SuspendTransactionLogic constructor.
* @param FetchesTransaction $fetchesTransaction
* @param UpdatesTransactionStatus $updatesTransactionStatus
*/
public function __construct(FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus)
{
$this->fetchesTransaction = $fetchesTransaction;
$this->updatesTransactionStatus = $updatesTransactionStatus;
}
public function logic(Request $request) : JsonResponse
{
$transaction = $this->fetchesTransaction->execute(['id' => $request->route('id')]);
$transaction->delete();
return $this->response([]);
}
}
@@ -27,4 +27,9 @@ final class TransactionType {
// public const SHIPPING_COST = 9;
public const TRANSACTION_TYPE_ID = [
self::SHIPPING_INVOICE => "Shipping Invoice",
self::PAYMENT => "Payment",
];
}
+1 -1
View File
@@ -24,7 +24,7 @@ class AuditBillplzInvoice extends Command
*
* @var string
*/
protected $description = 'Check all unpaid invoice but marked at paid at out system';
protected $description = 'Check all unpaid invoice but marked paid at our system';
/**
* Create a new command instance.
@@ -0,0 +1,86 @@
<?php
namespace App\Console\Commands;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Transaction;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\Http;
class CheckDeletedInvoiceButPaid extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'check-deleted-paid-invoice';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Check all deleted invoice but has completed payment';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
ini_set('memory_limit', '-1');
$this->info(Carbon::now() . ' : Start Check all deleted invoice but has completed payment.');
$start = new Carbon();
$totalAmount = 0;
$softDeletedTransactions = Transaction::onlyTrashed()->where('type', TransactionType::SHIPPING_INVOICE)->whereHas('transactions', function (Builder $query) {
$query->where('type', TransactionType::PAYMENT)->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY);
})->get();
foreach ($softDeletedTransactions as $invoice) {
$invoice_payments = $invoice->transactions()->payments()->get();
foreach($invoice_payments as $invoice_payment) {
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$invoice_payment->payment_reference);
if($response->successful()){
$data = $response->json();
$orderReference = $invoice->owner->owner->reference ?? null;
if($data['paid']){
$this->info('Invoice id: ' . $invoice->id. '. Payment id: ' . $invoice_payment->id . '. Order: ' . $orderReference);
} else {
}
}else{
$this->info("billplz error</br>");
}
}
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
$this->info(Carbon::now() . ' : Done Check all deleted invoice but has completed payment. ElapsedTime: ' . $elapsedTime . '. Total: ' . $totalAmount);
}
}
@@ -112,7 +112,7 @@ class FixBillplzFailedCallbackPayment extends Command
$order = $transaction->owner->owner->owner;
if ($invoiceStatus == 'Pending Payment') {
if (in_array($invoiceStatus , ['Pending Payment', 'Payment Completed'])) {
// code here
// $billPlz = $this->getBillplzBill->execute($billplzXSignatureObject->getBillPlzId());
@@ -152,9 +152,12 @@ class FixBillplzFailedCallbackPayment extends Command
$this->updateDoFromVTPortalProcessor->execute($packingList);
$this->updateDoFromYDPortalProcessor->execute($packingList);
}
$this->info('Updated invoice ' . $counter . ' of ' . $totalTransactions . '. Order: '. $order->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . '. Status: ' . $approvalStatusArray[$transaction->status] . '. Invoice Status: ' . $invoiceStatus);
} else {
$this->info('Failed to update invoice due to unsufficeint payment ' . $counter . ' of ' . $totalTransactions . '. Order: '. $order->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . '. Status: ' . $approvalStatusArray[$transaction->status] . '. Invoice Status: ' . $invoiceStatus);
}
$this->info('Updated invoice ' . $counter . ' of ' . $totalTransactions . '. Order: '. $order->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . '. Status: ' . $approvalStatusArray[$transaction->status] . '. Invoice Status: ' . $invoiceStatus);
} else {
if(!$order instanceof Order) {
@@ -0,0 +1,69 @@
<?php
namespace App\Console\Commands;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Transaction;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
class ShowBillplzPaymentStatus extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'billplz-payment-status {billplz_id}` ';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Show Billplz payment status';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
ini_set('memory_limit', '-1');
$this->info(Carbon::now() . ' : Show Billplz payment status started.');
$start = new Carbon();
$billplz_id = $this->argument('billplz_id');
$billplz_id = explode(",", $billplz_id);
foreach ($billplz_id as $payment) {
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$payment);
if($response->successful()){
$data = $response->json();
dump($data);
}else{
$this->info("billplz error</br>");
}
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
$this->info(Carbon::now() . ' : Done Showing Billplz payment status. ElapsedTime: ' . $elapsedTime);
}
}
@@ -0,0 +1,138 @@
<?php
namespace App\Console\Commands;
use App\Classes\Exceptions\ResourceNotFoundException;
use App\Classes\Modules\Billplzs\DataTransferObjects\BillplzXSignatureObject;
use App\Classes\Modules\Billplzs\Services\GetBillplzBill;
use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor;
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Order;
use App\Models\Transaction;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\Http;
class SuccessUpdatePaymentStatusButFailedCallback extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'fix-invoice-status';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Success Updated Payment Status But Inoie stat';
protected $output = null;
protected $outputArray = [];
/** @var GetBillplzBill */
private $getBillplzBill;
/** @var FetchesTransaction */
private $fetchesTransaction;
/** @var UpdatesTransactionStatus */
private $updatesTransactionStatus;
/** @var UpdateDoFromVTPortalProcessor */
private $updateDoFromVTPortalProcessor;
/** @var UpdateDoFromYDPortalProcessor */
private $updateDoFromYDPortalProcessor ;
/**
* Create a new command instance.
*
* @return void
*/
public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor)
{
parent::__construct();
$this->getBillplzBill = $getBillplzBill;
$this->fetchesTransaction = $fetchesTransaction;
$this->updatesTransactionStatus = $updatesTransactionStatus;
$this->updateDoFromVTPortalProcessor = $updateDoFromVTPortalProcessor;
$this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor;
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
ini_set('memory_limit', '-1');
$this->info(Carbon::now() . ' : Billplz Failled Callback cron started.');
$this->outputArray = [];
$start = new Carbon();
$approvalStatusArray = ApprovalStatus::APPROVAL_STATUS_ID;
$transactions = Transaction::where('type', TransactionType::PAYMENT)
->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
->get();
foreach ($transactions as $payment) {
$invoice = $payment->owner ?? null;
if (!$invoice) {
$this->info('Payment has no owner. Payment ID: ' . $payment->id);
continue;
}
$packingList = $invoice->owner ?? null;
if (!$packingList) {
$this->info('Invoice has no owner. Invoice ID: ' . $invoice->id);
continue;
}
$order = $packingList->owner;
if (!$invoice) {
$this->info('PackingList has no owner. PackingList ID: ' . $packingList->id);
continue;
}
if ($invoice->status == ApprovalStatus::APPROVED) {
$totalPaidAmount = $invoice->transactions->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount');
if(($invoice->amount - $totalPaidAmount) < 0.01) {
$this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED);
$packingList->status = ApprovalStatus::APPROVED;
$packingList->save();
if(app()->environment('production')){
$this->updateDoFromVTPortalProcessor->execute($packingList);
$this->updateDoFromYDPortalProcessor->execute($packingList);
}
dump('Updated invoice ' . $invoice->id . '. Order: '. $order->reference);
} else {
$this->info('Failed Update invoice ' . $invoice->id . ' because payment not enough. Invoice Amount: ' . $invoice->amount . ' . Paid Amount: ' . $totalPaidAmount . ' . Order: '. $order->reference);
}
}
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
$this->info(Carbon::now() . ' : Done Billplz Failled Callback. ElapsedTime: ' . $elapsedTime );
}
}
@@ -1,77 +0,0 @@
<?php
namespace App\Console\Commands;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Transaction;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
class debugBillplzFailedPayment extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'billplz-failed-payment:debug';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$transactions = Transaction::where('type', TransactionType::PAYMENT)->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereNotIn('status', [ApprovalStatus::COMPLETED, ApprovalStatus::APPROVED])->get();
$i = 0;
$totalAmount = 0;
foreach ($transactions as $transaction){
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$transaction->payment_reference);
// dd($response);
// dd($transaction->owner->owner->owner->reference);
if($response->successful()){
$data = $response->json();
if($data['paid']){
if (!in_array($transaction->status, [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) {
$this->returnLog('Paid transaction', $transaction);
}
}
// else {
// $totalAmount += $transaction->amount;
// $this->returnLog('Unpaid Transaction', $transaction);
// }
}else{
$this->returnLog('billplz error', $transaction);
}
}
}
public function returnLog($text, $transaction) {
$approvalStatusArray = ApprovalStatus::APPROVAL_STATUS_ID;
$this->info($text . ' - id: '. $transaction->id . '. Order Marking: '. $transaction->owner->owner->owner->reference . ' - Date: '.$transaction->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . '. Current Status: ' . $approvalStatusArray[$transaction->status]);
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Http\Controllers\Contacts;
use App\Classes\Modules\Contacts\ControllersLogic\UpdateContactLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class UpdateContactController
{
/**
* @param Request $request
* @param UpdateCompanyLogic $logic
* @return JsonResponse
*/
public function update(Request $request, UpdateContactLogic $logic): JsonResponse {
return $logic->execute($request);
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Http\Controllers\Transactions;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use App\Classes\Modules\Transactions\ControllersLogic\DeleteTransactionLogic;
class DeleteTransactionController
{
/**
* @param Request $request
* @param DeleteTransactionLogic $logic
* @return JsonResponse
*/
public function delete(Request $request, DeleteTransactionLogic $logic) : JsonResponse {
return $logic->execute($request);
}
}
+7 -1
View File
@@ -44,6 +44,11 @@ class Kernel extends HttpKernel
'throttle:300,1',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'apipub' => [
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
@@ -63,6 +68,7 @@ class Kernel extends HttpKernel
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'valid.token' => ValidateToken::class
'valid.token' => ValidateToken::class,
'token.check' => \App\Http\Middleware\TokenCheckerMiddleware::class,
];
}
@@ -0,0 +1,56 @@
<?php
namespace App\Http\Middleware;
use App\Models\PersonalAccessTokens;
use Closure;
use Illuminate\Http\Request;
class TokenCheckerMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next)
{
//Method 1: Token pass via query parameter
// Check if the api_key query parameter is present
if (!$request->query('api-key')) {
return response()->json(['message' => 'Invalid API key.'], 401);
}
// Check if the api_key is valid
$apiKey = $request->query('api-key');
$personalAccessToken = PersonalAccessTokens::where('token', $apiKey)->first();
if (!$personalAccessToken) {
return response()->json(['error' => 'Unauthorized'], 401);
}
return $next($request);
//Method 2: Token pass via request header
/*
$authHeader = $request->header('Authorization');
if (preg_match('/Bearer\s+(.*)$/i', $authHeader, $matches)) {
$token = $matches[1];
// validate the token here
$personalAccessToken = PersonalAccessToken::where('token', $token)->first();
if (!$personalAccessToken) {
return response()->json(['error' => 'Unauthorized'], 401);
}
// if the token is valid, you can attach it to the request
$request->attributes->add(['bearerToken' => $token]);
return $next($request);
}
return response()->json(['error' => 'Unauthorized'], 401);
*/
}
}
@@ -49,6 +49,7 @@ class CompanyModuleResource extends JsonResource
'marking' => $marking,
'warehouseCharges' => array_key_exists($this->id, $segmentConstant) ? $segmentConstant[$this->id] : null,
'connections' => $this->connections,
'contact' => new ContactResource ($this->when($this->has('contacts'), $this->contacts->first())),
];
}
+9
View File
@@ -0,0 +1,9 @@
<?php
namespace App\Models;
class PersonalAccessTokens extends AbstractModel
{
protected $table = 'personal_access_tokens';
}
+5
View File
@@ -43,6 +43,11 @@ class RouteServiceProvider extends ServiceProvider
->namespace($this->namespace)
->group(base_path('routes/api.php'));
Route::prefix('public/api')
->middleware('apipub')
->namespace($this->namespace)
->group(base_path('routes/apipub.php'));
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePersonalAccessTokensTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->bigIncrements('id');
// $table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('personal_access_tokens');
}
}
@@ -0,0 +1,76 @@
<template>
<div class="row m-b-10 parentContainer">
<div class="col">
<div class="row">
<div class="col-auto">
<div class="row">
<div class="col">
<h6 class="no-margin fs-12 text-black">{{item.street_one}} {{item.street_two}}, {{item.district.name}}, {{item.post_code}} {{item.state.name}}, {{item.country.name}}</h6>
</div>
</div>
</div>
<div class="col-auto">
<div class="row">
<!-- <div class="col-auto p-r-5">
<i class="fa m-r-10" data-type="defaultAddress" :class="{'fa-star': item.default, 'requestModal': !item.default, 'fa-star-o': !item.default, 'pointer': !item.default, 'text-warning': item.default}" ></i>
</div> -->
<div class="col-auto no-padding p-r-5 p-l-5 pointer">
<i class="fa fa-pencil-square-o text-complete m-r-10" @click="expanded = !expanded"></i>
</div>
<!-- <div class="col-auto p-l-5">
<i class="fa fa-trash-o text-danger requestModal" data-type="deleteAddress"></i>
</div> -->
</div>
</div>
</div>
<div class="row" v-if="expanded">
<div class="col">
<warehouse-address-form-component :company_module_id="company_module_id" :data="item" :section="section" @input="updateAddress($event)"></warehouse-address-form-component>
</div>
</div>
<!-- <modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="deleteAddress">
<delete-address-form-component :data="item" :section="section" class="text-center"></delete-address-form-component>
</modal-component>
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="defaultAddress">
<set-default-address-form-component :data="item" :section="section" class="text-center"></set-default-address-form-component>
</modal-component> -->
</div>
</div>
</template>
<script>
import componentHandler from '../../../general/mixins/componentHandler';
export default {
props: {
company_module_id: {
type: Number,
required: true
},
section: {
type: String,
required: true
}
},
data(){
return {
expanded: false
}
},
watch: {
value: function(value){
this.value = value;
if(value !== this.item.id){
this.expanded = false;
}
}
},
methods: {
updateAddress(id){
this.expanded = false;
this.$emit('input', id);
}
},
mixins: [componentHandler]
}
</script>
@@ -0,0 +1,230 @@
<template>
<div class="row p-t-25 text-left">
<div class="col">
<div class="row" v-if="![7,8].includes($store.getters.getCompanyModuleType)">
<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="col">
<validation-wrapper-component :validator="$v.parameters.street_one">
<label>Address Line 1</label>
<input class="form-control" name="street_one" v-model="parameters.street_one">
</validation-wrapper-component>
</div>
</div>
<div class="row m-b-15">
<div class="col">
<validation-wrapper-component :validator="$v.parameters.street_two">
<label>Address Line 2</label>
<input class="form-control" name="street_two" v-model="parameters.street_two">
</validation-wrapper-component>
</div>
</div>
<div class="row m-b-15">
<div class="col-12 col-md pr-md-1 pb-3 pb-md-0">
<validation-wrapper-component selectable :validator="$v.parameters.district_id">
<label>District</label>
<selectable-component :endpoint="route('api.address.district.list')" section="districtListSection" valueColumn="id" :labelColumn="['city']" v-model="parameters.district_id"></selectable-component>
</validation-wrapper-component>
</div>
<div class="col-12 col-md pl-md-1">
<validation-wrapper-component :validator="$v.parameters.post_code">
<label>Post Code</label>
<input class="form-control" name="post_code" v-model="parameters.post_code">
</validation-wrapper-component>
</div>
</div>
<!-- <div class="row">
<div class="col">
<div class="row">
<div class="col">
<div class="row m-b-15">
<div class="col-12 col-md pr-md-1 pb-3 pb-md-0">
<validation-wrapper-component :validator="$v.parameters.person_in_charge">
<label>Person In Charge</label>
<input class="form-control" name="person_in_charge" v-model="parameters.person_in_charge">
</validation-wrapper-component>
</div>
<div class="col-12 col-md pl-md-1">
<validation-wrapper-component :validator="$v.parameters.phone">
<label>Phone</label>
<input class="form-control" name="phone" v-model="parameters.phone">
</validation-wrapper-component>
</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>
<div class="row" v-if="[7,8].includes($store.getters.getCompanyModuleType)">
<div class="col">
<div class="row m-b-15">
<div class="col">
<validation-wrapper-component :validator="$v.parameters.reference">
<label>Company Name</label>
<input class="form-control" name="reference" v-model="parameters.reference">
</validation-wrapper-component>
</div>
</div>
<div class="row m-b-15">
<div class="col-12 col-md pr-md-1 pb-3 pb-md-0">
<validation-wrapper-component :validator="$v.parameters.person_in_charge">
<label>Name</label>
<input class="form-control" name="person_in_charge" v-model="parameters.person_in_charge">
</validation-wrapper-component>
</div>
<div class="col-12 col-md pl-md-1">
<validation-wrapper-component :validator="$v.parameters.phone">
<label>Phone</label>
<input class="form-control" name="phone" v-model="parameters.phone">
</validation-wrapper-component>
</div>
</div>
<div class="row m-b-15">
<div class="col-12 col-md-3 pr-md-1 pb-3 pb-md-0">
<validation-wrapper-component :validator="$v.parameters.street_one">
<label>Unit No.</label>
<input class="form-control" name="street_one" v-model="parameters.street_one">
</validation-wrapper-component>
</div>
<div class="col-12 col-md pl-md-1">
<validation-wrapper-component :validator="$v.parameters.street_two">
<label>Street Address</label>
<input class="form-control" name="street_two" v-model="parameters.street_two">
</validation-wrapper-component>
</div>
</div>
<div class="row m-b-15">
<div class="col-12 col-md pr-md-1 pb-3 pb-md-0">
<validation-wrapper-component selectable :validator="$v.parameters.district_id">
<label>City/Town</label>
<selectable-component :endpoint="route('api.address.district.list')" section="districtListSection" valueColumn="id" :labelColumn="['city']" v-model="parameters.district_id"></selectable-component>
</validation-wrapper-component>
</div>
<div class="col-12 col-md pl-md-1">
<validation-wrapper-component :validator="$v.parameters.post_code">
<label>Post Code</label>
<input class="form-control" name="post_code" v-model="parameters.post_code">
</validation-wrapper-component>
</div>
</div>
<div class="row m-b-15">
<div class="col">
<validation-wrapper-component :validator="$v.parameters.remark">
<label>Remark</label>
<input class="form-control" name="remark" v-model="parameters.remark">
</validation-wrapper-component>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="row">
<div class="col"></div>
<div class="col-auto">
<button type="button" class="btn btn-sm btn-complete b-rad-none" @click="submitForm()">{{ this.data ? "Update" : "Save" }} Address</button>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { required, requiredIf, numeric } from "vuelidate/lib/validators";
import componentHandler from '../../../general/mixins/componentHandler';
export default {
props: {
company_module_id: {
type: Number,
required: true
},
type: {
type: Number,
default: 2
},
data: {
type: Object,
default: null
},
section:{
type: String,
required: true
},
},
data() {
return {
parameters : {
company_module_id: this.company_module_id,
street_one: '',
street_two: '',
district_id: '',
post_code: '',
type: this.type,
// reference: null,
// remark: null,
// phone: null,
// person_in_charge: null,
}
}
},
created(){
if(this.data){
this.parameters.reference = this.data.reference;
this.parameters.street_one = this.data.street_one;
this.parameters.street_two = this.data.street_two;
this.parameters.district_id = this.data.district.id;
this.parameters.post_code = this.data.post_code;
this.parameters.type = this.data.type;
this.parameters.phone = this.data.contact ? this.data.contact.phone : '';
this.parameters.person_in_charge = this.data.contact ? this.data.contact.reference : '';
this.parameters.remark = this.data.remark ? this.data.remark.content : '';
}
},
validations: {
parameters: {
// reference: {
// required: requiredIf(function(){
// return ![7,8].includes(this.$store.getters.getCompanyModuleType);
// })
// },
street_one: { required },
street_two: {
required: requiredIf(function(){
return [7,8].includes(this.$store.getters.getCompanyModuleType);
})
},
district_id: { required },
post_code: { required },
// remark: {},
// phone: {required, numeric},
// person_in_charge: { required },
}
},
methods:{
submitForm(){
this.submit(this.data ? (this.route('api.address.update', this.data.id)) : (this.route('api.address.create')), this.data ? 'put' : 'post', this.section, true, true);
},
},
}
</script>
@@ -0,0 +1,89 @@
<template>
<div class="row" style="width: 450px; margin: auto;" @keyup.enter="submitForm">
<div class="col bg-white padding-40 b-rad-lg">
<div class="row m-b-10">
<div class="col text-center">
<h3>Edit Contact</h3>
</div>
</div>
<div class="row m-b-15">
<div class="col">
<validation-wrapper-component :validator="$v.parameters.reference">
<label>Reference</label>
<input class="form-control" name="street_one" v-model="parameters.reference">
</validation-wrapper-component>
</div>
</div>
<div class="row m-b-15">
<div class="col">
<validation-wrapper-component :validator="$v.parameters.phone">
<label>Phone</label>
<input class="form-control" name="street_one" v-model="parameters.phone">
</validation-wrapper-component>
</div>
</div>
<div class="row m-b-15">
<div class="col">
<validation-wrapper-component :validator="$v.parameters.email">
<label>Email</label>
<input class="form-control" name="street_one" v-model="parameters.email">
</validation-wrapper-component>
</div>
</div>
<div class="row m-b-15">
<div class="col">
<validation-wrapper-component :validator="$v.parameters.wechat_id">
<label>Wechat ID</label>
<input class="form-control" name="street_one" v-model="parameters.wechat_id">
</validation-wrapper-component>
</div>
</div>
<div class="row m-t-15">
<div class="col-auto p-r-5">
<div class="btn btn-lg btn-default b-rad-none" data-dismiss="modal">Cancel</div>
</div>
<div class="col p-l-5">
<div class="btn btn-primary w-100 btn-lg" @click="submitForm">Confirm</div>
</div>
</div>
</div>
</div>
</template>
<script>
import modalFormHandler from '../../../general/mixins/modalFormHandler';
import { required } from "vuelidate/lib/validators";
export default {
props: {
company_module_id: {
type: Number,
required: true
},
},
data() {
return {
parameters: {
reference: this.data.reference,
phone: this.data.phone,
email: this.data.email,
wechat_id: this.data.wechat_id,
}
};
},
methods: {
submitForm() {
this.submit(this.route('api.contact.update', this.data.id), 'put', this.section, true, true)
},
},
validations: {
parameters: {
reference: { },
phone: { },
email: { },
wechat_id: { },
}
},
mixins: [modalFormHandler]
}
</script>
@@ -63,6 +63,14 @@
</div>
</div>
</div>
<div class="col-auto p-l-0 p-r-0 d-flex justify-content-center align-items-center" v-if="$store.getters.isSuperAdmin">
<span class="d-inline-block m-r-15 text-primary bold text-underline pointer requestModal" data-type="deleteInvoice">
<i class="fa fa-close"></i>
</span>
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="deleteInvoice">
<delete-invoice-form-component :data="item" :section="section"></delete-invoice-form-component>
</modal-component>
</div>
<div class="col-auto hide">
<div class="btn btn-sm all-caps b-rad-none btn-block" :class="{'btn-success': !expanded, 'btn-default': expanded}" @click="expanded = !expanded">
{{ expanded ? 'Cancel' : 'Make Payment' }}</div>
@@ -0,0 +1,31 @@
<template>
<div class="row" @keyup.enter="submitForm">
<div class="col bg-white padding-40 b-rad-lg">
<div class="row">
<div class="col text-center">
<div class="row m-b-20">
<div class="col">
<h5 class="all-caps">Delete Invoice</h5>
<div class="fs-11">Are you sure you want to delete this invoice?</div>
</div>
</div>
<div class="row">
<div class="col p-r-5">
<div data-dismiss="modal" class="btn btn-sm btn-default bg-master-lighter btn-block b-rad-none">Cancel</div>
</div>
<div class="col p-l-5">
<div class="btn btn-danger w-100 btn-sm" @click="submit(route('api.transaction.delete', data.id), 'delete', section, true, true)">Confirm</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import modalFormHandler from '../../../general/mixins/modalFormHandler';
export default {
mixins: [modalFormHandler]
}
</script>
@@ -1,9 +1,9 @@
<template>
<div class="row m-b-15 parentContainer">
<div class="row m-b-15 parentContainer bg-white padding-10 rounded m-b-10">
<div class="col">
<div class="row align-items-center">
<div class="col-auto p-r-0">
<div class="padding-5 bg-master-lightest">
<div class="padding-5 bg-master-lightest rounded">
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="35" height="35" viewBox="0 0 172 172" style=" fill:#000000;"><g fill="none" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><path d="M0,172v-172h172v172z" fill="none"></path><g fill="#333333"><path d="M15.05,25.8v105.35h4.3v2.15c0,3.53669 2.91331,6.45 6.45,6.45h50.5376c1.67444,3.75213 5.30105,6.45 9.6624,6.45c4.36203,0 7.98734,-2.69797 9.6624,-6.45h50.5376c3.53669,0 6.45,-2.91331 6.45,-6.45v-2.15h4.3v-105.35h-64.5c-2.60352,0 -4.86855,1.23893 -6.45,3.08643c-1.58145,-1.8475 -3.84648,-3.08643 -6.45,-3.08643zM19.35,30.1h60.2c2.40083,0 4.3,1.89917 4.3,4.3c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-2.40083 1.89917,-4.3 4.3,-4.3h60.2v96.75h-60.2c-2.60352,0 -4.86855,1.23893 -6.45,3.08643c-1.58145,-1.8475 -3.84648,-3.08643 -6.45,-3.08643h-60.2zM86,40.85c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,49.45c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM119.68193,53.57363v4.12783c-8.0754,0.7482 -12.97979,5.32437 -12.97979,12.23232c0,5.8351 3.64818,9.8429 10.31748,11.54785l2.66231,0.68867v13.63906c-4.45695,-0.50955 -7.33113,-2.99253 -7.62998,-6.55078h-6.33662c0.0301,6.9402 5.41175,11.63533 13.9666,12.20293v3.88428h4.09844v-3.91367c8.7634,-0.7482 13.81963,-5.32289 13.81963,-12.65224c0,-6.192 -3.53195,-9.99125 -11.03975,-11.8166l-2.77988,-0.62568v-12.8958c3.9474,0.47945 6.64034,3.04917 6.76074,6.34082h6.24844c-0.1806,-6.67145 -5.26273,-11.39315 -13.00918,-12.08115v-4.12783zM86,58.05c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM119.68193,63.4124v12.05596c-4.3086,-0.8686 -6.58018,-2.99112 -6.58018,-6.07207c0,-3.26155 2.75103,-5.77534 6.58018,-5.98389zM86,66.65c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,75.25c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM123.78037,82.94717c5.08475,1.01695 7.44521,3.07924 7.44521,6.52139c0,3.79905 -2.71951,6.12871 -7.44521,6.39961zM86,83.85c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,92.45c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,101.05c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,109.65c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,118.25c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM23.65,131.15h55.9c2.40083,0 4.3,1.89917 4.3,4.3h4.3c0,-2.40083 1.89917,-4.3 4.3,-4.3h55.9v2.15c0,1.21481 -0.93519,2.15 -2.15,2.15h-53.56523l-0.41992,1.6083c-0.72235,2.78276 -3.19533,4.8417 -6.21484,4.8417c-3.01952,0 -5.49455,-2.05645 -6.21484,-4.8375l-0.41992,-1.6125h-53.56523c-1.21481,0 -2.15,-0.93519 -2.15,-2.15z"></path></g></g></svg>
</div>
</div>
@@ -68,6 +68,95 @@
</div>
</div>
</div>
<div class="row m-t-10">
<div class="col">
<div class="row">
<div class="col-auto p-r-0 invisible">
<div class="padding-5 bg-master-lightest">
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="35" height="35" viewBox="0 0 172 172" style=" fill:#000000;"><g fill="none" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><path d="M0,172v-172h172v172z" fill="none"></path><g fill="#333333"><path d="M15.05,25.8v105.35h4.3v2.15c0,3.53669 2.91331,6.45 6.45,6.45h50.5376c1.67444,3.75213 5.30105,6.45 9.6624,6.45c4.36203,0 7.98734,-2.69797 9.6624,-6.45h50.5376c3.53669,0 6.45,-2.91331 6.45,-6.45v-2.15h4.3v-105.35h-64.5c-2.60352,0 -4.86855,1.23893 -6.45,3.08643c-1.58145,-1.8475 -3.84648,-3.08643 -6.45,-3.08643zM19.35,30.1h60.2c2.40083,0 4.3,1.89917 4.3,4.3c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-2.40083 1.89917,-4.3 4.3,-4.3h60.2v96.75h-60.2c-2.60352,0 -4.86855,1.23893 -6.45,3.08643c-1.58145,-1.8475 -3.84648,-3.08643 -6.45,-3.08643h-60.2zM86,40.85c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,49.45c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM119.68193,53.57363v4.12783c-8.0754,0.7482 -12.97979,5.32437 -12.97979,12.23232c0,5.8351 3.64818,9.8429 10.31748,11.54785l2.66231,0.68867v13.63906c-4.45695,-0.50955 -7.33113,-2.99253 -7.62998,-6.55078h-6.33662c0.0301,6.9402 5.41175,11.63533 13.9666,12.20293v3.88428h4.09844v-3.91367c8.7634,-0.7482 13.81963,-5.32289 13.81963,-12.65224c0,-6.192 -3.53195,-9.99125 -11.03975,-11.8166l-2.77988,-0.62568v-12.8958c3.9474,0.47945 6.64034,3.04917 6.76074,6.34082h6.24844c-0.1806,-6.67145 -5.26273,-11.39315 -13.00918,-12.08115v-4.12783zM86,58.05c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM119.68193,63.4124v12.05596c-4.3086,-0.8686 -6.58018,-2.99112 -6.58018,-6.07207c0,-3.26155 2.75103,-5.77534 6.58018,-5.98389zM86,66.65c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,75.25c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM123.78037,82.94717c5.08475,1.01695 7.44521,3.07924 7.44521,6.52139c0,3.79905 -2.71951,6.12871 -7.44521,6.39961zM86,83.85c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,92.45c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,101.05c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,109.65c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,118.25c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM23.65,131.15h55.9c2.40083,0 4.3,1.89917 4.3,4.3h4.3c0,-2.40083 1.89917,-4.3 4.3,-4.3h55.9v2.15c0,1.21481 -0.93519,2.15 -2.15,2.15h-53.56523l-0.41992,1.6083c-0.72235,2.78276 -3.19533,4.8417 -6.21484,4.8417c-3.01952,0 -5.49455,-2.05645 -6.21484,-4.8375l-0.41992,-1.6125h-53.56523c-1.21481,0 -2.15,-0.93519 -2.15,-2.15z"></path></g></g></svg>
</div>
</div>
<div class="col">
<div class="row">
<div class="col-auto p-r-10">
<div class="font-heading all-caps fs-8 muted">Address</div>
</div>
</div>
<div class="row">
<div class="col">
<display-warehouse-address-component :data="data.address" :company_module_id="data.id" :section="section"></display-warehouse-address-component>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row m-t-10">
<div class="col">
<div class="row">
<div class="col-auto p-r-0 invisible">
<div class="padding-5 bg-master-lightest">
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="35" height="35" viewBox="0 0 172 172" style=" fill:#000000;"><g fill="none" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><path d="M0,172v-172h172v172z" fill="none"></path><g fill="#333333"><path d="M15.05,25.8v105.35h4.3v2.15c0,3.53669 2.91331,6.45 6.45,6.45h50.5376c1.67444,3.75213 5.30105,6.45 9.6624,6.45c4.36203,0 7.98734,-2.69797 9.6624,-6.45h50.5376c3.53669,0 6.45,-2.91331 6.45,-6.45v-2.15h4.3v-105.35h-64.5c-2.60352,0 -4.86855,1.23893 -6.45,3.08643c-1.58145,-1.8475 -3.84648,-3.08643 -6.45,-3.08643zM19.35,30.1h60.2c2.40083,0 4.3,1.89917 4.3,4.3c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-2.40083 1.89917,-4.3 4.3,-4.3h60.2v96.75h-60.2c-2.60352,0 -4.86855,1.23893 -6.45,3.08643c-1.58145,-1.8475 -3.84648,-3.08643 -6.45,-3.08643h-60.2zM86,40.85c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,49.45c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM119.68193,53.57363v4.12783c-8.0754,0.7482 -12.97979,5.32437 -12.97979,12.23232c0,5.8351 3.64818,9.8429 10.31748,11.54785l2.66231,0.68867v13.63906c-4.45695,-0.50955 -7.33113,-2.99253 -7.62998,-6.55078h-6.33662c0.0301,6.9402 5.41175,11.63533 13.9666,12.20293v3.88428h4.09844v-3.91367c8.7634,-0.7482 13.81963,-5.32289 13.81963,-12.65224c0,-6.192 -3.53195,-9.99125 -11.03975,-11.8166l-2.77988,-0.62568v-12.8958c3.9474,0.47945 6.64034,3.04917 6.76074,6.34082h6.24844c-0.1806,-6.67145 -5.26273,-11.39315 -13.00918,-12.08115v-4.12783zM86,58.05c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM119.68193,63.4124v12.05596c-4.3086,-0.8686 -6.58018,-2.99112 -6.58018,-6.07207c0,-3.26155 2.75103,-5.77534 6.58018,-5.98389zM86,66.65c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,75.25c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM123.78037,82.94717c5.08475,1.01695 7.44521,3.07924 7.44521,6.52139c0,3.79905 -2.71951,6.12871 -7.44521,6.39961zM86,83.85c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,92.45c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,101.05c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,109.65c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,118.25c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM23.65,131.15h55.9c2.40083,0 4.3,1.89917 4.3,4.3h4.3c0,-2.40083 1.89917,-4.3 4.3,-4.3h55.9v2.15c0,1.21481 -0.93519,2.15 -2.15,2.15h-53.56523l-0.41992,1.6083c-0.72235,2.78276 -3.19533,4.8417 -6.21484,4.8417c-3.01952,0 -5.49455,-2.05645 -6.21484,-4.8375l-0.41992,-1.6125h-53.56523c-1.21481,0 -2.15,-0.93519 -2.15,-2.15z"></path></g></g></svg>
</div>
</div>
<div class="col-auto">
<div class="row">
<div class="col-auto p-r-10">
<div class="font-heading all-caps fs-8 muted">Reference</div>
</div>
</div>
<div class="row">
<div class="col">
{{ data.contact.reference ? data.contact.reference : "-" }}
</div>
</div>
</div>
<div class="col-auto">
<div class="row">
<div class="col-auto p-r-10">
<div class="font-heading all-caps fs-8 muted">Phone</div>
</div>
</div>
<div class="row">
<div class="col">
{{ data.contact.phone ? data.contact.phone : '-' }}
</div>
</div>
</div>
<div class="col-auto">
<div class="row">
<div class="col-auto p-r-10">
<div class="font-heading all-caps fs-8 muted">Email</div>
</div>
</div>
<div class="row">
<div class="col">
{{ data.contact.email ? data.contact.email : '-' }}
</div>
</div>
</div>
<div class="col-auto">
<div class="row">
<div class="col-auto p-r-10">
<div class="font-heading all-caps fs-8 muted">Wechat ID</div>
</div>
</div>
<div class="row">
<div class="col">
{{ data.contact.wechat_id ? data.contact.wechat_id : '-' }}
</div>
</div>
</div>
<div class="col"></div>
<div class="col-auto">
<div class="btn btn-xs btn-default pointer m-t-10 b-primary b-a text-primary requestModal" data-type="warehouseContact">Edit Contact</div>
</div>
<modal-component class="animate__animated animate__fast animate__fadeIn" type="warehouseContact" styleType="fill-in">
<contact-form-component :section="section" :data="data.contact" :company_module_id="data.id"></contact-form-component>
</modal-component>
</div>
</div>
</div>
</div>
</div>
</template>
@@ -79,10 +168,10 @@
props: {
data: {
type: Object,
required: false
},
section: {
default: 'warhouseListSection'
required: false,
parameters: {
}
},
},
mixins: [modalFormHandler]
@@ -1,7 +1,34 @@
<template>
<div class="row m-b-15 parentContainer">
<div class="col">
<list-component :section="section" :endpoint="route('api.account.user.list')" :options="{ 'type_in': adminTypeArray }">
<div class="row">
<div class="col">
<div class="row m-b-15">
<div class="col">
<div class="row">
<div class="col p-r-0">
<div class="form-group no-margin form-group-default b-rad-none">
<label class="text-primary">Email Like</label>
<input type="text" class="form-control" v-model="email" @keyup.enter="search"/>
</div>
</div>
</div>
</div>
<div class="col-auto p-l-0 p-r-0">
<div class="btn btn-primary b-rad-none" @click="search">
<i class="fa fa-search lh-40"></i>
</div>
</div>
<div class="col-auto p-l-0">
<div class="btn btn-secondary b-rad-none" @click="reset">
<i class="fa fa-remove lh-40"></i>
</div>
</div>
<div class="col"></div>
</div>
</div>
</div>
<list-component :key="currentKey" :section="section" :endpoint="route('api.account.user.list')" :options="options">
<template slot="list" slot-scope="{data}">
<user-component :data="data"></user-component>
</template>
@@ -11,29 +38,35 @@
</template>
<script>
import componentHandler from '../../../general/mixins/componentHandler';
export default {
props: {
section: {
type: String,
required: true
}
},
data() {
return {
expanded: false,
isSuperAdmin: this.$store.getters.isSuperAdmin,
}
},
computed: {
adminTypeArray() {
if (this.isSuperAdmin) {
return [1, 2];
} else {
return [2];
import componentHandler from '../../../general/mixins/componentHandler';
export default {
props: {
section: {
type: String,
required: true
}
},
},
mixins: [componentHandler]
}
data() {
return {
expanded: false,
currentKey: 1,
email: '',
options: {
'type_in': this.$store.getters.isSuperAdmin ? [1, 2] : [2],
}
}
},
methods: {
search() {
this.options['email_like'] = this.email;
this.currentKey+=1;
},
reset() {
this.email = '';
delete(this.options['email_like']);
this.currentKey+=1;
},
},
mixins: [componentHandler]
}
</script>
+2
View File
@@ -62,6 +62,8 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
require __DIR__ . '/report.php';
require __DIR__ . '/contact.php';
});
require __DIR__ . '/announcement.php';
+9
View File
@@ -0,0 +1,9 @@
<?php
use Illuminate\Support\Facades\Route;
Route::group(['middleware' => 'apipub', 'prefix' => 'v1', 'as' => 'apipub.'], function () {
Route::group(['middleware' => 'token.check'], function () {
Route::get('/list', 'Transactions\ListTransactionsController@list')->name('list');
});
});
+11
View File
@@ -0,0 +1,11 @@
<?php
use Illuminate\Support\Facades\Route;
Route::group(['prefix' => 'contact', 'as' => 'contact.', 'namespace' => 'Contacts'], function () {
Route::put('/{id}/update', 'UpdateContactController@update')->name('update');
});
+1
View File
@@ -6,6 +6,7 @@ Route::group(['prefix' => 'transactions', 'namespace' => 'Transactions', 'as' =>
Route::get('/list', 'ListTransactionsController@list')->name('list');
Route::delete('/suspend/{id}', 'SuspendTransactionController@suspend')->name('suspend');
Route::delete('/delete/{id}', 'DeleteTransactionController@delete')->name('delete');
Route::put('{id}/status/update/{status}', 'UpdateTransactionStatusController@update')->where('status', 'approve|expire|reject')->name('update');
Route::group(['prefix' => 'payment', 'as' => 'payment.'], function () {
+44 -22
View File
@@ -377,7 +377,7 @@ Route::get('/export-customer-order/{marking}', 'Exports\ExportCompanyModuleSumma
Route::get('/customer/summary/monthly', function () {
// $containers = Container::whereMonth('loading_date', '>=', ((float)Carbon::now()->format('m') - 2))->whereYear('loading_date', (float)Carbon::now()->format('Y'))->get();
$containers = Container::whereMonth('loading_date', '>=', 9)->whereYear('loading_date', 2022)->get();
$containers = Container::whereMonth('loading_date', '>=', 1)->whereYear('loading_date', 2023)->get();
$marking = '769SMC';
$connection = CompanyConnection::where('invitee_reference', $marking)->first();
$companyModuleId = $connection->invitee->id;
@@ -956,32 +956,54 @@ Route::get('/packing-lists/delete-duplicated', function(Request $request){
}
});
Route::get('/billplz/audit', function (Request $request) {
$transactions = Transaction::where('type', TransactionType::PAYMENT)->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereIn('status', [ApprovalStatus::COMPLETED, ApprovalStatus::APPROVED])->get();
$i = 0;
$totalAmount = 0;
foreach ($transactions as $transaction){
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$transaction->payment_reference);
Route::get('/final-duplicated-invoice-debug', function(){
$duplicatedTransactions = Transaction::select(DB::raw('owner_type, owner_id, receiver, type, GROUP_CONCAT(id) as transaction_ids, COUNT(*) as count'))
->whereNotIn('status', [ApprovalStatus::REJECTED,ApprovalStatus::SUSPENDED,ApprovalStatus::EXPIRED])
->groupBy('owner_type', 'owner_id', 'receiver', 'type')
->having('count', '>', 1)
->get();
if($response->successful()){
$data = $response->json();
if($data['paid']){
$approvalStatusArray = ApprovalStatus::APPROVAL_STATUS_ID;
} else {
$transactionType = TransactionType::TRANSACTION_TYPE_ID;
$transaction->status = ApprovalStatus::REJECTED;
$transaction->save();
echo '<table style="width: 100%; text-align: center; border: 1px solid black">
<tr>
<!-- <th style="border: 1px solid black" >Owner Type</th> -->
<!-- <th style="border: 1px solid black" >Owner Id</th> -->
<!--<th style="border: 1px solid black" >Reveiver</th>-->
<th style="border: 1px solid black" >Order</th>
<th style="border: 1px solid black" >Transaction type</th>
<th style="border: 1px solid black" >Count</th>
<th style="border: 1px solid black" >Invoice Ids</th>
<th style="border: 1px solid black" >Invoices</th>
</tr>';
$invoice = $transaction->owner;
$invoice->status = ApprovalStatus::APPROVED;
foreach ($duplicatedTransactions as $transaction) {
$transactionIds = explode(',', $transaction->transaction_ids);
$totalAmount += $transaction->amount;
echo 'Order: '. $transaction->owner->owner->owner->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . " </br></br>";
}
}else{
echo "billplz error</br>";
}
$duplicatedInvoice = Transaction::whereIn('id', $transactionIds)->get();
$order_reference = $duplicatedInvoice->first()->owner->owner->reference ?? null;
if ($transaction->type == TransactionType::PAYMENT) {
$order_reference = $duplicatedInvoice->first()->owner->owner->owner->reference ?? null;
}
echo 'Total: ' . $totalAmount;
echo '<tr>';
// echo '<td style="border: 1px solid black">' . $transaction->owner_type . '</td>';
// echo '<td style="border: 1px solid black">' . $transaction->owner_id . '</td>';
echo '<td style="border: 1px solid black">' . $transaction->receiver . '</td>';
echo '<td style="border: 1px solid black">' . '<a target="_blank" href="'.route('order.show', $order_reference).'">'. $order_reference .'</a>' . '</td>';
echo '<td style="border: 1px solid black">' . $transactionType[$transaction->type] . '</td>';
echo '<td style="border: 1px solid black">' . count($transactionIds) . '</td>';
echo '<td style="border: 1px solid black; text-align: left">';
foreach ($duplicatedInvoice as $invoice) {
echo '<p>ID: ' . $invoice->id . '. Status: ' . $approvalStatusArray[$invoice->status] . '. Amount: ' . $invoice->amount . '</p>';
}
echo'</td>';
echo '</tr>';
}
echo '</table>';
});