105 lines
5.6 KiB
Vue
105 lines
5.6 KiB
Vue
<!-- src/pages/customer/profile/profile/ProfileSummary.vue -->
|
|
<template>
|
|
<div class="card bg-base-100 shadow-xl h-full">
|
|
<div class="card-body p-4 sm:p-6">
|
|
<!-- Action Buttons - Two Row Layout -->
|
|
<div class="grid grid-cols-3 gap-3">
|
|
<!-- Row 1 -->
|
|
<router-link :to="{ name: 'deliveryCreate', params: { id: customer.id } }"
|
|
class="btn btn-primary min-h-[3rem] flex flex-col items-center justify-center gap-1">
|
|
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"/>
|
|
</svg>
|
|
<span class="text-xs font-medium">Delivery</span>
|
|
</router-link>
|
|
|
|
<router-link :to="{ name: 'CalenderCustomer', params: { id: customer.id } }"
|
|
class="btn btn-info min-h-[3rem] flex flex-col items-center justify-center gap-1">
|
|
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"/>
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>
|
|
</svg>
|
|
<span class="text-xs font-medium">Service</span>
|
|
</router-link>
|
|
|
|
<router-link :to="{ name: 'customerEdit', params: { id: customer.id } }"
|
|
class="btn btn-secondary min-h-[3rem] flex flex-col items-center justify-center gap-1">
|
|
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/>
|
|
</svg>
|
|
<span class="text-xs font-medium">Edit</span>
|
|
</router-link>
|
|
|
|
<!-- Row 2 -->
|
|
<router-link :to="{ name: 'servicePlanEdit', params: { id: customer.id } }"
|
|
class="btn btn-accent min-h-[3rem] flex flex-col items-center justify-center gap-1">
|
|
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
|
|
</svg>
|
|
<span class="text-xs font-medium">Contract</span>
|
|
</router-link>
|
|
|
|
<button @click="$emit('toggleAutomatic', customer.id)"
|
|
class="btn min-h-[3rem] flex flex-col items-center justify-center gap-1 col-span-2"
|
|
:class="automatic_status === 1 ? 'btn-success' : 'btn-warning'">
|
|
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"/>
|
|
</svg>
|
|
<span class="text-xs font-medium">{{ automatic_status === 1 ? 'Set to Will Call' : 'Set to Auto' }}</span>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="divider my-4"></div>
|
|
|
|
<!-- Customer Details -->
|
|
<div>
|
|
<div class="flex justify-between items-center">
|
|
<h2 class="card-title text-lg">{{ customer.customer_first_name }} {{ customer.customer_last_name }}</h2>
|
|
<span class="badge" :class="automatic_status === 1 ? 'badge-success' : 'badge-ghost'">
|
|
{{ automatic_status === 1 ? 'Automatic' : 'Will Call' }}
|
|
</span>
|
|
</div>
|
|
<div class="text-error font-semibold mt-2" v-if="!customer.correct_address">
|
|
Possible Incorrect Address!
|
|
</div>
|
|
<div class="mt-4 space-y-2 text-sm">
|
|
<p>{{ customer.customer_address }}<span v-if="customer.customer_apt">, {{ customer.customer_apt }}</span></p>
|
|
<p>{{ customer.customer_town }}, {{ stateName(customer.customer_state) }} {{ customer.customer_zip }}</p>
|
|
<p class="pt-2">{{ customer.customer_phone_number }}</p>
|
|
<p><span class="badge badge-outline badge-sm">{{ homeTypeName(customer.customer_home_type) }}</span></p>
|
|
<hr class="my-2" v-if="customer_description">
|
|
<p v-if="customer_description" class="text-sm">{{ customer_description }}</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
interface Customer {
|
|
id: number;
|
|
customer_first_name: string;
|
|
customer_last_name: string;
|
|
correct_address: boolean;
|
|
customer_address: string;
|
|
customer_apt: string | null;
|
|
customer_town: string;
|
|
customer_state: number;
|
|
customer_zip: string;
|
|
customer_phone_number: string;
|
|
customer_home_type: number;
|
|
}
|
|
|
|
interface Props {
|
|
customer: Customer;
|
|
automatic_status: number;
|
|
customer_description?: string;
|
|
}
|
|
|
|
defineProps<Props>();
|
|
defineEmits(['toggleAutomatic']);
|
|
|
|
const stateName = (id: number) => ['MA', 'RI', 'NH', 'ME', 'VT', 'CT', 'NY'][id] || 'N/A';
|
|
const homeTypeName = (id: number) => ['Residential', 'Apartment', 'Condo', 'Commercial', 'Business', 'Construction', 'Container'][id] || 'Unknown';
|
|
</script>
|