Merge pull request #153 from WDI-Ideas/sayaliP

Sayali p
This commit is contained in:
CodewithSayali
2024-06-17 13:45:59 +05:30
committed by GitHub
4 changed files with 10 additions and 25 deletions

View File

@@ -30,7 +30,7 @@ class customer_export implements FromCollection , WithHeadings
'first_name' => $customer->first_name,
'last_name' => $customer->last_name,
'email_address' => $customer->email_address,
'date_of_birth' => $customer->date_of_birth,
'date_of_birth'=> \Carbon\Carbon::parse($customer->date_of_birth)->format('m-d-Y'),
'state_xid' => $customer->state->name ?? '', // Access the state name and handle null
'phone_number' => $customer->phone_number,
];

View File

@@ -42,7 +42,7 @@ class customer_export_selected implements FromCollection, WithHeadings
'first_name' => $customer->first_name,
'last_name' => $customer->last_name,
'email_address' => $customer->email_address,
'date_of_birth' => $customer->date_of_birth,
'date_of_birth' => \Carbon\Carbon::parse($customer->date_of_birth)->format('m-d-Y'), // Format the date
'state_xid' => $customer->state->name ?? '', // Access the state name and handle null
'phone_number' => $customer->phone_number,
];
@@ -61,7 +61,7 @@ class customer_export_selected implements FromCollection, WithHeadings
'Last Name',
'Email Address',
'Date of Birth',
'state_name',
'State Name',
'Phone Number'
];
}

View File

@@ -218,27 +218,12 @@ class ManageCustomerController extends Controller
}
}
// public function exportSelectedCustomer(Request $request)
// {
// // dd($request->all());
// try {
// if ($request->has('all_id')) {
// return Excel::download(new customer_export, 'Passport_data.xlsx');
// }
// $ids = $request->selected_id;
// // dd( $ids);
// $fileName = 'selected_customer_data.xlsx';
// return Excel::download(new customer_export_selected($ids), $fileName);
// // dd($ids);
// } catch (\Exception $e) {
// return response()->json(['error' => 'Export failed. Something went wrong.'], 500);
// }
// }
/*
Created By : Sayali Parab
Created at : 28 May 2024
Use : To Get Excel.
*/
public function exportSelectedCustomer(Request $request)
{
try {

View File

@@ -115,7 +115,7 @@ $currentPage = 'manage-customer';
<a class="view-btn" href="{{ url('/manage_customer_restaurant/' . $customer->id) }}">View</a>
</td>
<td>{{ \Carbon\Carbon::parse($customer->date_of_birth)->format('d/m/Y') }}</td>
<td>{{ \Carbon\Carbon::parse($customer->date_of_birth)->format('m/d/Y') }}</td>
<td class="text-start">{{ $customer->phone_number }}</td>
<td>{{ $customer->state ? $customer->state->name : 'No state assigned' }}</td>