fixed auto query profile

This commit is contained in:
2025-10-30 20:39:14 -04:00
parent e70ae887f3
commit 661aaf39b0
11 changed files with 157 additions and 190 deletions

View File

@@ -1,4 +1,4 @@
<!-- src/pages/admin/oilprice.vue -->
<!-- src/pages/admin/authorize.vue -->
<template>
<div class="flex">
<div class="w-full px-4 md:px-10 py-4">

View File

@@ -1,3 +1,4 @@
<!-- src/pages/card/addcard.vue -->
<template>
<div class="flex">
<div class="w-full px-4 md-px-10 py-4">

View File

@@ -6,23 +6,22 @@
<div v-if="customer && customer.id" class="bg-neutral rounded-lg p-4 sm:p-6 mt-6">
<!-- Current Plan Status Banner - Same as ServicePlanEdit.vue -->
<div v-if="servicePlan && servicePlan.contract_plan > 0"
class="alert alert-info mb-6"
<div v-if="servicePlan && servicePlan.contract_plan > 0" class="alert alert-info mb-6"
:class="servicePlan.contract_plan === 2 ? 'border-4 border-yellow-400 bg-yellow-50' : ''">
<div class="flex items-center">
<div class="flex-1">
<div class="flex items-center gap-3">
<h3 class="font-bold">Current Plan: {{ getPlanName(servicePlan.contract_plan) }}</h3>
<!-- Premium Star Icon -->
<svg v-if="servicePlan.contract_plan === 2"
class="w-8 h-8 text-yellow-500 fill-current"
fill="none" stroke="currentColor" viewBox="0 0 24 24">
<svg v-if="servicePlan.contract_plan === 2" class="w-8 h-8 text-yellow-500 fill-current" fill="none"
stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z" />
</svg>
</div>
<p>{{ servicePlan.contract_years }} Year{{ servicePlan.contract_years > 1 ? 's' : '' }} Contract</p>
<p class="text-sm">Expires: {{ formatEndDate(servicePlan.contract_start_date, servicePlan.contract_years) }}</p>
<p class="text-sm">Expires: {{ formatEndDate(servicePlan.contract_start_date, servicePlan.contract_years) }}
</p>
</div>
<div class="badge" :class="getStatusBadge(servicePlan.contract_start_date, servicePlan.contract_years)">
{{ getStatusText(servicePlan.contract_start_date, servicePlan.contract_years) }}
@@ -37,33 +36,20 @@
<div class="xl:col-span-8 space-y-6">
<div class="grid grid-cols-1 xl:grid-cols-12 gap-6">
<ProfileMap
v-if="customer && customer.customer_latitude != null && customer.customer_longitude != null"
class="xl:col-span-7"
:customer="customer"
/>
<ProfileMap v-if="customer && customer.customer_latitude != null && customer.customer_longitude != null"
class="xl:col-span-7" :customer="customer" />
<!-- You can add a placeholder for when the map isn't ready -->
<div v-else class="xl:col-span-7 bg-base-100 rounded-lg flex justify-center items-center">
<p class="text-gray-400">Location not available...</p>
</div>
<ProfileSummary
class="xl:col-span-5"
:customer="customer"
:automatic_status="automatic_status"
:customer_description="customer_description.description"
@toggle-automatic="userAutomatic"
/>
<ProfileSummary class="xl:col-span-5" :customer="customer" :automatic_status="automatic_status"
:customer_description="customer_description.description" @toggle-automatic="userAutomatic" />
</div>
<HistoryTabs
:deliveries="deliveries"
:autodeliveries="autodeliveries"
:service-calls="serviceCalls"
:transactions="transactions"
@open-service-modal="openEditModal"
/>
<HistoryTabs :deliveries="deliveries" :autodeliveries="autodeliveries" :service-calls="serviceCalls"
:transactions="transactions" @open-service-modal="openEditModal" />
</div>
@@ -75,7 +61,8 @@
<div class="flex flex-col lg:flex-row lg:items-center lg:justify-between">
<div class="flex items-center gap-3 mb-3 md:mb-0">
<svg class="w-5 h-5 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v4a3 3 0 003 3z"/>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v4a3 3 0 003 3z" />
</svg>
<span v-if="isLoadingAuthorize" class="text-sm font-medium">
<span class="loading loading-dots loading-xs mr-2"></span>
@@ -92,51 +79,31 @@
<!-- CREATE ACCOUNT SECTION - Only show when account doesn't exist -->
<div class="flex gap-2">
<button
@click="createAuthorizeAccount"
<button @click="createAuthorizeAccount"
:class="['btn btn-sm', credit_cards_count === 0 ? 'btn-disabled' : 'btn-primary']"
:disabled="credit_cards_count === 0"
v-if="credit_cards_count > 0"
>
:disabled="credit_cards_count === 0" v-if="credit_cards_count > 0">
Create Account
</button>
<button
v-else
@click="addCreditCard"
class="btn btn-secondary btn-sm"
>
<button v-else @click="addCreditCard" class="btn btn-secondary btn-sm">
Add Card First
</button>
</div>
</div>
<!-- DELETE ACCOUNT SECTION - Only show when account exists -->
<div v-if="authorizeCheck.valid_for_charging" class="mt-3 lg:mt-0 lg:flex lg:gap-2">
<button
@click="showDeleteAccountModal"
class="btn btn-error btn-sm lg:self-start"
>
<button @click="showDeleteAccountModal" class="btn btn-error btn-sm lg:self-start">
Delete Account
</button>
</div>
</div>
</div>
<CustomerComments
:comments="comments"
@add-comment="onSubmitSocial"
@delete-comment="deleteCustomerSocial"
/>
<CustomerComments :comments="comments" @add-comment="onSubmitSocial" @delete-comment="deleteCustomerSocial" />
<CustomerStats :stats="customer_stats" :last_delivery="customer_last_delivery" />
<TankInfo :customer_id="customer.id" :tank="customer_tank" :description="customer_description" />
<EquipmentParts :parts="currentParts" @open-parts-modal="openPartsModal" />
<CreditCards
:cards="credit_cards"
:count="credit_cards_count"
:user_id="customer.id"
:auth_net_profile_id="customer.auth_net_profile_id"
@edit-card="editCard"
@remove-card="removeCard"
/>
<CreditCards :cards="credit_cards" :count="credit_cards_count" :user_id="customer.id"
:auth_net_profile_id="customer.auth_net_profile_id" @edit-card="editCard" @remove-card="removeCard" />
<!-- Automatic Delivery Actions Box -->
<div v-if="automatic_status === 1 && autodeliveries.length > 0" class="bg-base-100 rounded-lg p-4 border">
@@ -174,26 +141,17 @@
<!-- Modals remain at the root of the template for proper display -->
<ServiceEditModal
v-if="selectedServiceForEdit"
:service="selectedServiceForEdit"
@close-modal="closeEditModal"
@save-changes="handleSaveChanges"
@delete-service="handleDeleteService"
/>
<PartsEditModal
v-if="isPartsModalOpen && currentParts"
:customer-id="customer.id"
:existing-parts="currentParts"
@close-modal="closePartsModal"
@save-parts="handleSaveParts"
/>
<ServiceEditModal v-if="selectedServiceForEdit" :service="selectedServiceForEdit" @close-modal="closeEditModal"
@save-changes="handleSaveChanges" @delete-service="handleDeleteService" />
<PartsEditModal v-if="isPartsModalOpen && currentParts" :customer-id="customer.id" :existing-parts="currentParts"
@close-modal="closePartsModal" @save-parts="handleSaveParts" />
<!-- Delete Account Confirmation Modal -->
<div class="modal" :class="{ 'modal-open': isDeleteAccountModalVisible }">
<div class="modal-box">
<h3 class="font-bold text-lg">Confirm Account Deletion</h3>
<p class="py-4">This will permanently delete the Authorize.net account and remove all payment profiles. This action cannot be undone.</p>
<p class="py-4">This will permanently delete the Authorize.net account and remove all payment profiles. This
action cannot be undone.</p>
<div class="modal-action">
<button @click="deleteAccount" class="btn btn-error">Delete Account</button>
<button @click="isDeleteAccountModalVisible = false" class="btn">Cancel</button>
@@ -214,7 +172,9 @@
<div v-else class="text-center">
<div class="text-success mb-3">
<svg class="w-12 h-12 mx-auto mb-2" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
<path fill-rule="evenodd"
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
clip-rule="evenodd" />
</svg>
</div>
<p class="text-lg font-semibold mb-2">Account Created Successfully!</p>
@@ -623,14 +583,15 @@ export default defineComponent({
})
},
getCustomerAutoDelivery(userid: any) {
let path = import.meta.env.VITE_AUTO_URL + '/delivery/auto/customer/' + userid ;
let path = import.meta.env.VITE_AUTO_URL + '/delivery/all/profile/' + userid;
axios({
method: 'get',
url: path,
headers: authHeader(),
}).then((response: any) => {
// Handle the case where response.data might be null (no auto delivery found)
this.autodeliveries = response.data ? [response.data] : []
this.autodeliveries = response.data || []
console.log(this.autodeliveries)
})
},
getCustomerDelivery(userid: any, delivery_page: any) {

View File

@@ -1,3 +1,4 @@
<!-- src/pages/delivery/update_tickets/finalize_ticket.vue -->
<template>
<div class="flex">

View File

@@ -1,4 +1,4 @@
<!-- src/pages/delivery/update_tickets/finalize_ticket_auto.vue -->
<!-- src/pages/delivery/update_tickets/finalize_ticket_auto_nocc.vue -->
<template>
<div class="flex">

View File

@@ -1,4 +1,4 @@
<!-- src/pages/pay/capture_authorize.vue -->
<!-- src/pages/pay/oil/capture_authorize.vue -->
<template>
<div class="flex">

View File

@@ -1,4 +1,4 @@
<!-- src/pages/pay/pay_oil.vue -->
<!-- src/pages/pay/oil/pay_oil.vue -->
<template>
<div class="flex">

View File

@@ -1,4 +1,4 @@
<!-- src/pages/pay/oil/authorize_preauthcharge.vue -->
<!-- src/pages/pay/service/authorize_preauthcharge.vue -->
<template>
<div class="flex">

View File

@@ -1,3 +1,4 @@
<!-- src/pages/pay/service/capture_authorize.vue -->
<template>
<div class="flex">
<!-- Main container with responsive horizontal padding -->

View File

@@ -1,4 +1,4 @@
<!-- src/pages/pay/pay_oil.vue -->
<!-- src/pages/pay/service/pay_service.vue -->
<template>
<div class="flex">

View File

@@ -21,7 +21,10 @@
<!-- Customer & Parts Info Section (Remains the same) -->
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
<div v-if="customer" class="p-4 bg-base-200 rounded-md">
<div class="font-bold text-lg">{{ customer.account_number }}</div>
<div class="flex justify-between items-center font-bold text-lg">
<div>{{ customer.account_number }}</div>
<router-link :to="{ name: 'customerProfile', params: { id: customer.id } }" class="btn btn-sm btn-primary">Profile</router-link>
</div>
<div class="text-sm">{{ customer.customer_first_name }} {{ customer.customer_last_name }}</div>
<div class="text-sm">{{ customer.customer_address }}</div>
<div class="text-sm">{{ customer.customer_town }}, {{ getStateAbbrev(customer.customer_state) }} {{ customer.customer_zip }}</div>
@@ -105,7 +108,7 @@ import authHeader from '../../services/auth.header';
// --- Interfaces ---
interface ServiceCall { id: number; scheduled_date: string; customer_id: number; customer_name: string; customer_address: string; customer_town: string; type_service_call: number; description: string; service_cost: string }
interface EditableService extends Omit<ServiceCall, 'scheduled_date'> { date: string; time: number; }
interface Customer { account_number: string; customer_first_name: string; customer_last_name: string; customer_address: string; customer_town: string; customer_state: number; customer_zip: string; customer_phone_number: string; }
interface Customer { id: number; account_number: string; customer_first_name: string; customer_last_name: string; customer_address: string; customer_town: string; customer_state: number; customer_zip: string; customer_phone_number: string; }
interface ServiceParts { customer_id: number; oil_filter: string; oil_filter_2: string; oil_nozzle: string; oil_nozzle_2: string; }
export default defineComponent({