diff --git a/src/pages/customer/profile/profile.vue b/src/pages/customer/profile/profile.vue index 4666c8f..3dcad7e 100755 --- a/src/pages/customer/profile/profile.vue +++ b/src/pages/customer/profile/profile.vue @@ -140,7 +140,7 @@ {{ oil.id }} - + {{ oil.customer_name }} @@ -230,16 +230,19 @@ export default defineComponent({ }, - get_oil_orders(page: any) { - let path = import.meta.env.VITE_BASE_URL + '/delivery/outfordelivery/' + page; - axios({ - method: 'get', - url: path, - headers: authHeader(), - }).then((response: any) => { - this.deliveries = response.data - }) - }, + mod: (date: any) => new Date (date).getTime(), + get_oil_orders(page: any) { + let path = import.meta.env.VITE_BASE_URL + '/delivery/outfordelivery/' + page; + axios({ + method: 'get', + url: path, + headers: authHeader(), + }).then((response: any) => { + this.deliveries = response.data + // Sort deliveries by Delivery # (id) in descending order + this.deliveries.sort((a, b) => b.id - a.id); + }) + }, deleteCall(delivery_id: any) { let path = import.meta.env.VITE_BASE_URL + '/delivery/delete/' + delivery_id; @@ -315,4 +318,4 @@ export default defineComponent({ }) - \ No newline at end of file + diff --git a/src/pages/pay/oil/authorize_preauthcharge.vue b/src/pages/pay/oil/authorize_preauthcharge.vue index df77863..2fcd52f 100644 --- a/src/pages/pay/oil/authorize_preauthcharge.vue +++ b/src/pages/pay/oil/authorize_preauthcharge.vue @@ -117,7 +117,7 @@ + + + + + + diff --git a/src/pages/pay/service/capture_authorize.vue b/src/pages/pay/service/capture_authorize.vue index 72d0836..bee7125 100644 --- a/src/pages/pay/service/capture_authorize.vue +++ b/src/pages/pay/service/capture_authorize.vue @@ -11,14 +11,14 @@ {{ service.customer_name }} -
  • Charge Service #{{ service.id }}
  • +
  • Capture Service #{{ service.id }}
  • - Charge Service #{{ service?.id }} + Capture Charge for Service #{{ service?.id }}

    @@ -60,61 +60,102 @@
    + + +
    +

    Transaction History

    +
    +

    No transactions found for this service.

    +
    +
    +
    +
    +
    +
    Transaction ID: {{ transaction.id }}
    +
    {{ transaction.created_at ? formatDateTime(transaction.created_at) : 'N/A' }}
    +
    +
    + {{ getTransactionStatus(transaction.status) }} +
    +
    + +
    +
    +
    Preauth Amount
    +
    ${{ formatCurrency(transaction.preauthorize_amount) }}
    +
    +
    +
    Charge Amount
    +
    ${{ formatCurrency(transaction.charge_amount) }}
    +
    +
    +
    Transaction Type
    +
    {{ getTransactionType(transaction.transaction_type) }}
    +
    +
    +
    Auth Transaction ID
    +
    {{ transaction.auth_net_transaction_id || 'N/A' }}
    +
    +
    + +
    +
    Rejection Reason:
    +
    {{ transaction.rejection_reason }}
    +
    +
    +
    +
    -
    -

    Credit Cards

    - - - +

    Pre-authorized Card

    +
    +

    No pre-authorized card found.

    -
    -

    No cards on file.

    -
    -
    -
    +
    +
    -
    {{ card.name_on_card }}
    -
    {{ card.type_of_card }}
    +
    {{ preAuthCard.name_on_card }}
    +
    {{ preAuthCard.type_of_card }}
    -
    Primary
    +
    Primary
    -

    {{ card.card_number }}

    -

    Exp: {{ formattedExpiration(card) }}

    -

    {{ card.security_number }}

    +

    {{ preAuthCard.card_number }}

    +

    Exp: {{ formattedExpiration(preAuthCard) }}

    +

    {{ preAuthCard.security_number }}

    +
    Preauthorization amount: ${{ preAuthAmount.toFixed(2) }}
    - - +
    + $ + +
    @@ -124,7 +165,7 @@ @click="chargeService" > - Charge Service + Capture Charge - Charge + Charge + Capture @@ -93,7 +101,12 @@
    -

    {{ service.customer_name }}

    + + {{ service.customer_name }} +

    ID: {{ service.id }}

    {{ service.customer_address }}, {{ service.customer_town }}

    @@ -122,7 +135,8 @@
    - Charge + Charge + Capture
    @@ -160,6 +174,7 @@ interface ServiceCall { type_service_call: number; description: string; service_cost: string; + payment_status?: number; } export default defineComponent({ @@ -189,7 +204,7 @@ export default defineComponent({ headers: authHeader(), withCredentials: true, }); - this.services = response.data; + this.services = response.data.sort((a: ServiceCall, b: ServiceCall) => b.id - a.id); } catch (error) { console.error("Failed to fetch upcoming service calls:", error); } finally { @@ -313,6 +328,14 @@ export default defineComponent({ 4: 'black', }; return colorMap[typeId] || 'gray'; + }, + + shouldShowChargeButton(service: any): boolean { + return service.payment_status === null || service.payment_status === undefined; + }, + + shouldShowCaptureButton(service: any): boolean { + return service.payment_status === 1; } }, }) diff --git a/src/pages/service/ServicePast.vue b/src/pages/service/ServicePast.vue index 40b0b4f..380e7dd 100644 --- a/src/pages/service/ServicePast.vue +++ b/src/pages/service/ServicePast.vue @@ -50,13 +50,20 @@ - {{ service.id }} - + {{ service.id }} +
    {{ formatDate(service.scheduled_date) }}
    {{ formatTime(service.scheduled_date) }}
    - {{ service.customer_name }} - {{ service.customer_address }}, {{ service.customer_town }} + + + {{ service.customer_name }} + + + {{ service.customer_address }}, {{ service.customer_town }}