Fix some issues
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React, { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Building2, Settings, Wrench, Thermometer, Activity, CheckCircle, AlertTriangle, Eye, Edit, FileText } from 'lucide-react';
|
||||
import { Building2, Settings, Wrench, Thermometer, Activity, CheckCircle, AlertTriangle, Eye, Edit, FileText, Mail } from 'lucide-react';
|
||||
import { EditViewModal, EditViewModalSection } from '../../ui/EditViewModal/EditViewModal';
|
||||
import { Equipment } from '../../../api/types/equipment';
|
||||
|
||||
@@ -101,7 +101,12 @@ export const EquipmentModal: React.FC<EquipmentModalProps> = ({
|
||||
[t('fields.specifications.depth')]: 'depth',
|
||||
[t('fields.current_temperature')]: 'temperature',
|
||||
[t('fields.target_temperature')]: 'targetTemperature',
|
||||
[t('fields.notes')]: 'notes'
|
||||
[t('fields.notes')]: 'notes',
|
||||
[t('fields.support_contact_email')]: 'support_contact_email',
|
||||
[t('fields.support_contact_phone')]: 'support_contact_phone',
|
||||
[t('fields.support_contact_company')]: 'support_contact_company',
|
||||
[t('fields.support_contact_contract_number')]: 'support_contact_contract_number',
|
||||
[t('fields.support_contact_response_time_sla')]: 'support_contact_response_time_sla'
|
||||
};
|
||||
|
||||
const propertyName = fieldLabelKeyMap[field.label];
|
||||
@@ -120,6 +125,13 @@ export const EquipmentModal: React.FC<EquipmentModalProps> = ({
|
||||
...newEquipment.specifications,
|
||||
[propertyName]: value
|
||||
};
|
||||
} else if (propertyName.startsWith('support_contact_')) {
|
||||
// Handle nested support_contact fields
|
||||
const contactField = propertyName.replace('support_contact_', '');
|
||||
newEquipment.support_contact = {
|
||||
...newEquipment.support_contact,
|
||||
[contactField]: value
|
||||
};
|
||||
} else {
|
||||
(newEquipment as any)[propertyName] = value;
|
||||
}
|
||||
@@ -262,6 +274,47 @@ export const EquipmentModal: React.FC<EquipmentModalProps> = ({
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: t('sections.support_contact'),
|
||||
icon: Mail,
|
||||
fields: [
|
||||
{
|
||||
label: t('fields.support_contact_email'),
|
||||
value: equipment.support_contact?.email || '',
|
||||
type: 'text',
|
||||
editable: true,
|
||||
placeholder: t('placeholders.support_contact_email')
|
||||
},
|
||||
{
|
||||
label: t('fields.support_contact_phone'),
|
||||
value: equipment.support_contact?.phone || '',
|
||||
type: 'text',
|
||||
editable: true,
|
||||
placeholder: t('placeholders.support_contact_phone')
|
||||
},
|
||||
{
|
||||
label: t('fields.support_contact_company'),
|
||||
value: equipment.support_contact?.company || '',
|
||||
type: 'text',
|
||||
editable: true,
|
||||
placeholder: t('placeholders.support_contact_company')
|
||||
},
|
||||
{
|
||||
label: t('fields.support_contact_contract_number'),
|
||||
value: equipment.support_contact?.contract_number || '',
|
||||
type: 'text',
|
||||
editable: true,
|
||||
placeholder: t('placeholders.support_contact_contract_number')
|
||||
},
|
||||
{
|
||||
label: t('fields.support_contact_response_time_sla'),
|
||||
value: equipment.support_contact?.response_time_sla || 0,
|
||||
type: 'number',
|
||||
editable: true,
|
||||
placeholder: '24'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: t('sections.specifications'),
|
||||
icon: Building2,
|
||||
|
||||
@@ -73,6 +73,16 @@ const EquipmentDetailsStep: React.FC<WizardStepProps> = ({ dataRef, onDataChange
|
||||
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
||||
/>
|
||||
</div>
|
||||
<div className="md:col-span-2">
|
||||
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">{t('equipment.fields.supportContactEmail')}</label>
|
||||
<input
|
||||
type="email"
|
||||
value={data.support_contact?.email || ''}
|
||||
onChange={(e) => handleFieldChange('support_contact', { ...data.support_contact, email: e.target.value })}
|
||||
placeholder={t('equipment.fields.supportContactEmailPlaceholder')}
|
||||
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user