Merge branch 'dillon/90-e-invoice-e' into vapor/development

This commit is contained in:
Dillon Ngo
2026-01-07 13:19:06 +08:00
7 changed files with 67 additions and 9 deletions
@@ -159,7 +159,8 @@ class CreateInvoiceTransactionV2Processor
$eInvoice = false;
$eInvoiceStartDate = Carbon::parse(env('E_INVOICE_START_DATE', '2025-07-01 00:00:00'));
$bookingCreatedDate = Carbon::parse($booking->created_at);
if ($bookingCreatedDate->isAfter($eInvoiceStartDate) && $supplier->e_invoice === 1) {
$eInvoiceRequestedDate = Carbon::parse($supplier->e_invoice_requested_at);
if ($bookingCreatedDate->isAfter($eInvoiceStartDate) && $bookingCreatedDate->isAfter($eInvoiceRequestedDate) && $supplier->e_invoice === 1) {
$eInvoice = true;
}
$kvp = $booking->attributesKVP()->where('key', KVPKey::BOOKING_EINVOICE_ELIGIBLE)->first();
+2 -1
View File
@@ -13,6 +13,7 @@ use App\Classes\ValueObjects\Constants\DocumentType;
use App\Classes\ValueObjects\Constants\KVPKey;
use Carbon\Carbon;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Facades\Log;
class BookingResource extends JsonResource
{
@@ -30,7 +31,7 @@ class BookingResource extends JsonResource
$bookingCreatedDate = Carbon::parse($this->created_at);
$eInvoiceRequestedDate = Carbon::parse($this->company->e_invoice_requested_at);
//cief todo: 90 - for testing
if ($bookingCreatedDate->isAfter($eInvoiceStartDate) && $this->company->e_invoice === 1) { //&& $bookingCreatedDate->diffInMinutes($eInvoiceRequestedDate) <= 480 cief todo: 90
if ($bookingCreatedDate->isAfter($eInvoiceStartDate) && $bookingCreatedDate->isAfter($eInvoiceRequestedDate) && $this->company->e_invoice === 1) { //&& $bookingCreatedDate->diffInMinutes($eInvoiceRequestedDate) <= 480 cief todo: 90
$eInvoice = true;
}
@@ -169,6 +169,7 @@
</template>
<script>
import registrationFormValidation from '../../../general/mixins/accounts/validation/registrationFormValidation'
import { track } from '../../../utils/tracking';
export default {
data() {
return {
@@ -204,9 +205,18 @@
},
submitForm(){
const urlParams = new URLSearchParams(window.location.search);
const tracking = urlParams.get('tracking');
this.step === 2 ? this.submit(this.route('api.account.registration.register') + (tracking ? '?tracking=' + tracking : ''), 'post', 'registrationSection', false, false) : this.changeStep('next');
this.step === 2 ? this.submit(this.route('api.account.registration.register'), 'post', 'registrationSection', false, false) : this.changeStep('next');
},
successHandler(response){
// fire to gtag manager for fb pixel tracking: CompleteRegistration
track('exchange_complete_registration', {
content_name: this.parameters.type === 1 ? 'Company' : 'Personal',
currency: 'MYR'
});
// Call parent success handler logic from authenticationHandler mixin
this.formHandler('');
this.$store.dispatch('userAuthentication', {access_token: response.payload.access_token, redirect_url: response.payload.redirect_url});
}
},
mixins: [registrationFormValidation]
@@ -24,6 +24,7 @@
6. 01DRW - Sales Deposit by Wallet [AR PAYMENT ENTRY] → Filters by Created Date<br/>
7. 01DRF - Sales Deposit by Wallet [AR REFUND ENTRY] → Filters by Created Date<br/>
8. 01DD - Sales Deposit by Wallet [AR DEPOSIT ENTRY] → Filters by Created Date<br/>
9. WALLET TOP UP REPORT [Wallet Deposit Received] → Filters by Top Up Date<br/>
</div>
">
<i class="fa fa-info-circle"></i>
@@ -52,6 +53,7 @@
6. 01DRW - Sales Deposit by Wallet [AR PAYMENT ENTRY] → Filters by Created Date<br/>
7. 01DRF - Sales Deposit by Wallet [AR REFUND ENTRY] → Filters by Created Date<br/>
8. 01DD - Sales Deposit by Wallet [AR DEPOSIT ENTRY] → Filters by Created Date<br/>
9. WALLET TOP UP REPORT [Wallet Deposit Received] → Filters by Top Up Date<br/>
</div>
">
<i class="fa fa-info-circle"></i>
@@ -196,10 +198,10 @@ export default {
'01D - Sales Deposit Received [AR DEPOSIT ENTRY]',
'01R - RECEIVE PAYMENT [AR RECEIVE PAYMENT]',
'Credit Note Report',
//'WALLET TOP UP REPORT [Wallet Deposit Received]',
'01DRW - Sales Deposit by Wallet [AR PAYMENT ENTRY]',
'01DRF - Sales Deposit by Wallet [AR REFUND ENTRY]',
'01DD - Sales Deposit by Wallet [AR DEPOSIT ENTRY]'
'01DD - Sales Deposit by Wallet [AR DEPOSIT ENTRY]',
'WALLET TOP UP REPORT [Wallet Deposit Received]'
];
},
handleExportClick(){
@@ -215,10 +217,10 @@ export default {
'01D - Sales Deposit Received [AR DEPOSIT ENTRY]': route('api.export.transactions.receive_payment_deposit_entry'),
'01R - RECEIVE PAYMENT [AR RECEIVE PAYMENT]': route('api.export.transactions.receive_payment_for_booking'),
'Credit Note Report': route('api.export.transactions.ar_credit_note'),
//'WALLET TOP UP REPORT [Wallet Deposit Received]': route('api.export.transactions.wallet_top_up_deposit_entry'),
'01DRW - Sales Deposit by Wallet [AR PAYMENT ENTRY]': route('api.export.transactions.sales_deposit_by_wallet_payment_entry'),
'01DRF - Sales Deposit by Wallet [AR REFUND ENTRY]': route('api.export.transactions.sales_deposit_by_wallet_refund_entry'),
'01DD - Sales Deposit by Wallet [AR DEPOSIT ENTRY]': route('api.export.transactions.sales_deposit_by_wallet_deposit_entry'),
'WALLET TOP UP REPORT [Wallet Deposit Received]': route('api.export.transactions.wallet_top_up_deposit_entry'),
};
let url = `${routesMap[reportType]}?startDate=${this.parameters.startDate}&endDate=${this.parameters.endDate}`;
@@ -11,6 +11,7 @@
<script>
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
import { track } from '../../../utils/tracking';
export default {
props:{
order_reference_no: {
@@ -26,6 +27,12 @@
},
methods: {
submitForm(){
// fire to gtag manager for fb pixel tracking: AddToCart — fired when the user clicks Confirm Order (user intent, OK even if API fails)
track('exchange_add_to_cart', {
value: Number(String(this.data.amount).replace(/,/g, '')),
currency: 'MYR'
});
this.parameters = {
company_id: this.data.company.id,
type: this.data.type,
@@ -42,6 +49,13 @@
this.submit(route('api.booking.create'), 'post', this.section, true, true)
},
successHandler(response){
// fire to gtag manager for fb pixel tracking: InitiateCheckout — booking created
track('exchange_checkout', {
value: Number(String(this.data.amount).replace(/,/g, '')),
currency: 'MYR',
booking_id: response.payload.data.marking
});
window.location.href = this.route('booking.details', response.payload.data.marking)
}
+13
View File
@@ -0,0 +1,13 @@
// resources/assets/vue/utils/tracking.js
export function track(event, payload = {}) {
if (typeof window === 'undefined') return;
// console.log('tracking', event, payload);
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event,
...payload,
});
}
@@ -103,4 +103,21 @@
</div>
</div>
@endsection
@endsection
@push('scripts')
@if($status === 2 && isset($transaction) && $transaction)
<script>
(function() {
// fire to gtag manager for fb pixel tracking: exchange_purchase
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'exchange_purchase',
transaction_id: @json($transaction->payment_reference ?? ''),
value: {{ number_format((float)($transaction->amount ?? 0), 2, '.', '') }},
currency: 'MYR'
});
})();
</script>
@endif
@endpush