feat: add whatsapp_number field to supplier and customer forms
This commit is contained in:
parent
34e095526f
commit
12751ab39c
@ -42,12 +42,13 @@ class SupplierController extends Controller
|
||||
$request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'credit_days' => 'nullable|integer|min:0',
|
||||
'whatsapp_number' => ['nullable', 'string', 'max:20'],
|
||||
]);
|
||||
|
||||
Supplier::create(array_merge(
|
||||
$request->only([
|
||||
'supplier_code', 'name', 'category', 'contact_person',
|
||||
'email', 'secondary_email', 'phone', 'phone2', 'whatsapp',
|
||||
'email', 'secondary_email', 'phone', 'phone2', 'whatsapp', 'whatsapp_number',
|
||||
'address', 'website', 'tax_number', 'credit_terms', 'credit_days', 'remarks',
|
||||
]),
|
||||
['is_active' => (bool) $request->input('is_active', 1)]
|
||||
@ -72,12 +73,13 @@ class SupplierController extends Controller
|
||||
'name' => 'required|string|max:255',
|
||||
'credit_days' => 'nullable|integer|min:0',
|
||||
'is_active' => 'nullable',
|
||||
'whatsapp_number' => ['nullable', 'string', 'max:20'],
|
||||
]);
|
||||
|
||||
$supplier->update(array_merge(
|
||||
$request->only([
|
||||
'supplier_code', 'name', 'category', 'contact_person',
|
||||
'email', 'secondary_email', 'phone', 'phone2', 'whatsapp',
|
||||
'email', 'secondary_email', 'phone', 'phone2', 'whatsapp', 'whatsapp_number',
|
||||
'address', 'website', 'tax_number', 'credit_terms', 'credit_days', 'remarks',
|
||||
]),
|
||||
['is_active' => (bool) $request->input('is_active', 0)]
|
||||
|
||||
@ -22,14 +22,21 @@ class CustomerController extends Controller
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'email' => 'nullable|email|max:255',
|
||||
'phone' => 'nullable|string|max:50',
|
||||
'whatsapp_number' => 'nullable|string|max:20',
|
||||
'address' => 'nullable|string',
|
||||
'contact_person' => 'nullable|string|max:255',
|
||||
'tax_number' => 'nullable|string|max:50',
|
||||
'credit_limit' => 'nullable|numeric|min:0',
|
||||
'is_active' => 'nullable|boolean',
|
||||
]);
|
||||
|
||||
Customer::create($request->all());
|
||||
$validated['is_active'] = (bool) $request->input('is_active', 1);
|
||||
|
||||
Customer::create($validated);
|
||||
|
||||
return redirect()->route('sales.customers.index')->with('success', 'Customer created successfully.');
|
||||
}
|
||||
@ -46,14 +53,21 @@ class CustomerController extends Controller
|
||||
|
||||
public function update(Request $request, Customer $customer)
|
||||
{
|
||||
$request->validate([
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|string|max:255',
|
||||
'email' => 'nullable|email|max:255',
|
||||
'phone' => 'nullable|string|max:50',
|
||||
'whatsapp_number' => 'nullable|string|max:20',
|
||||
'address' => 'nullable|string',
|
||||
'contact_person' => 'nullable|string|max:255',
|
||||
'tax_number' => 'nullable|string|max:50',
|
||||
'credit_limit' => 'nullable|numeric|min:0',
|
||||
'is_active' => 'nullable|boolean',
|
||||
]);
|
||||
|
||||
$customer->update($request->all());
|
||||
$validated['is_active'] = (bool) $request->input('is_active', 0);
|
||||
|
||||
$customer->update($validated);
|
||||
|
||||
return redirect()->route('sales.customers.index')->with('success', 'Customer updated successfully.');
|
||||
}
|
||||
|
||||
@ -43,6 +43,15 @@
|
||||
<input type="text" name="phone" value="{{ old('phone') }}" class="form-input">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="form-label">WhatsApp Number</label>
|
||||
<input type="text" name="whatsapp_number"
|
||||
value="{{ old('whatsapp_number', '') }}"
|
||||
placeholder="+971501234567"
|
||||
class="form-input">
|
||||
<p style="font-size:12px;color:#6b7280;margin-top:4px;">International format. Used for WhatsApp notifications.</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="form-label">Tax Number</label>
|
||||
<input type="text" name="tax_number" value="{{ old('tax_number') }}" class="form-input">
|
||||
|
||||
@ -44,6 +44,15 @@
|
||||
<input type="text" name="phone" value="{{ old('phone', $supplier->phone) }}" class="form-input">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="form-label">WhatsApp Number</label>
|
||||
<input type="text" name="whatsapp_number"
|
||||
value="{{ old('whatsapp_number', $supplier->whatsapp_number ?? '') }}"
|
||||
placeholder="+971501234567"
|
||||
class="form-input">
|
||||
<p style="font-size:12px;color:#6b7280;margin-top:4px;">International format. Used for WhatsApp notifications.</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="form-label">Tax Number</label>
|
||||
<input type="text" name="tax_number" value="{{ old('tax_number', $supplier->tax_number) }}" class="form-input">
|
||||
|
||||
@ -43,6 +43,15 @@
|
||||
<input type="text" name="phone" value="{{ old('phone') }}" class="form-input">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="form-label">WhatsApp Number</label>
|
||||
<input type="text" name="whatsapp_number"
|
||||
value="{{ old('whatsapp_number', '') }}"
|
||||
placeholder="+971501234567"
|
||||
class="form-input">
|
||||
<p style="font-size:12px;color:#6b7280;margin-top:4px;">International format. Used for WhatsApp notifications.</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="form-label">Tax Number</label>
|
||||
<input type="text" name="tax_number" value="{{ old('tax_number') }}" class="form-input">
|
||||
|
||||
@ -44,6 +44,15 @@
|
||||
<input type="text" name="phone" value="{{ old('phone', $customer->phone) }}" class="form-input">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="form-label">WhatsApp Number</label>
|
||||
<input type="text" name="whatsapp_number"
|
||||
value="{{ old('whatsapp_number', $customer->whatsapp_number ?? '') }}"
|
||||
placeholder="+971501234567"
|
||||
class="form-input">
|
||||
<p style="font-size:12px;color:#6b7280;margin-top:4px;">International format. Used for WhatsApp notifications.</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="form-label">Tax Number</label>
|
||||
<input type="text" name="tax_number" value="{{ old('tax_number', $customer->tax_number) }}" class="form-input">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user