|
|
|
|
@@ -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) {
|
|
|
|
|
|