diff --git a/app/Exports/NfcVoucherExportsCollection.php b/app/Exports/NfcVoucherExportsCollection.php
new file mode 100644
index 00000000..48b5ab5a
--- /dev/null
+++ b/app/Exports/NfcVoucherExportsCollection.php
@@ -0,0 +1,17 @@
+nfc_vouchers = $nfc_vouchers;
+ }
+
+ public function view(): View
+ {
+ return view('seller.pos.exports.nfc_chourches', [
+ 'nfc_vouchers' => $this->nfc_vouchers
+ ]);
+ }
+
+ //estilos de exel
+ public function styles(Worksheet $sheet)
+ {
+ $nfc_vouchersCount = count($this->nfc_vouchers);
+
+ // Aplica los estilos a la tabla en Excel
+ $sheet->getStyle('A1:H1')->getFont()->setBold(true);
+ $sheet->getStyle('A1:H1')->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setRGB('DDDDDD');
+ $sheet->getStyle('A2:H' . ($nfc_vouchersCount + 1))->getAlignment()->setWrapText(true);
+
+ // Ajusta automáticamente el ancho de las columnas
+ foreach(range('A', 'H') as $column) {
+ $sheet->getColumnDimension($column)->setAutoSize(true);
+ }
+
+ // Agrega líneas alternas de color a las filas
+ for ($row = 2; $row <= $nfc_vouchersCount + 1; $row += 2) {
+ $sheet->getStyle('A' . $row . ':H' . $row)->applyFromArray([
+ 'fill' => [
+ 'fillType' => Fill::FILL_SOLID,
+ 'startColor' => [
+ 'rgb' => 'F2F2F2' // Color gris claro
+ ]
+ ],
+ 'borders' => [
+ 'allBorders' => [
+ 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
+ 'color' => ['rgb' => '000000'] // Color negro
+ ]
+ ]
+ ]);
+ }
+
+ // Agrega bordes a todas las celdas
+ $sheet->getStyle('A1:H' . ($nfc_vouchersCount + 1))->applyFromArray([
+ 'borders' => [
+ 'allBorders' => [
+ 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
+ 'color' => ['rgb' => '000000'] // Color negro
+ ]
+ ]
+ ]);
+ }
+
+
+}
diff --git a/app/Http/Controllers/NfcVouchersController.php b/app/Http/Controllers/NfcVouchersController.php
new file mode 100644
index 00000000..05be8bb1
--- /dev/null
+++ b/app/Http/Controllers/NfcVouchersController.php
@@ -0,0 +1,135 @@
+validate([
+ 'nfc_type' => 'required',
+ 'nfc_following' => 'required',
+ 'nfc_expiration' => 'required|date',
+ 'nfc_amount' => 'required|numeric',
+ 'nfc_next' => 'required',
+ 'nfc_select' => 'required|in:active,deactivated',
+ ]);
+
+ // Guardar los datos en la base de datos
+ DB::beginTransaction();
+
+ try {
+ $nfc_voucher->nfc_type = $validatedData['nfc_type'];
+ $nfc_voucher->nfc_following = $validatedData['nfc_following'];
+ $nfc_voucher->nfc_expiration = $validatedData['nfc_expiration'];
+ $nfc_voucher->nfc_amount = $validatedData['nfc_amount'];
+ $nfc_voucher->nfc_next = $validatedData['nfc_next'];
+ $nfc_voucher->nfc_select = $validatedData['nfc_select'];
+
+ $nfc_voucher->save();
+
+ DB::commit();
+
+ // Redireccionar o mostrar un mensaje de éxito
+ // Redireccionar a la ruta '/pos-activation'
+
+ return redirect()->route('pos.configuration')->with('toast_success', '¡Política de empresa creada con éxito!');
+ } catch (\Exception $e) {
+ DB::rollback();
+
+ // Manejar el error y mostrar un mensaje de error
+ //
+ }
+
+
+
+
+ }
+
+ /**
+ * Display the specified resource.
+ *
+ * @param \App\Models\NfcVoucher $nfcVoucher
+ * @return \Illuminate\Http\Response
+ */
+ public function show(NfcVoucher $nfcVoucher)
+ {
+ //
+ }
+
+ /**
+ * Show the form for editing the specified resource.
+ *
+ * @param \App\Models\NfcVoucher $nfcVoucher
+ * @return \Illuminate\Http\Response
+ */
+ public function edit(NfcVoucher $nfcVoucher)
+ {
+ //
+ }
+
+ /**
+ * Update the specified resource in storage.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @param \App\Models\NfcVoucher $nfcVoucher
+ * @return \Illuminate\Http\Response
+ */
+ public function update(Request $request, NfcVoucher $nfcVoucher)
+ {
+ //
+ }
+
+ /**
+ * Remove the specified resource from storage.
+ *
+ * @param \App\Models\NfcVoucher $nfcVoucher
+ * @return \Illuminate\Http\Response
+ */
+ public function collection()
+ {
+ return Excel::download(new NfcVoucherExportsCollection, 'Nfc_Voucher.xlsx');
+ }
+
+ public function view()
+ {
+ // return Excel::download(new NfcVoucherExportsView, 'Nfc_Voucher.xlsx');
+
+ $nfc_vouchers = NfcVoucher::latest()->get();// Obtén los datos de la tabla desde tu controlador o modelo
+
+ return Excel::download(new NfcVoucherExportsView($nfc_vouchers), 'nfc_vouchers.xlsx');
+ }
+}
diff --git a/app/Http/Controllers/Seller/PosController.php b/app/Http/Controllers/Seller/PosController.php
index d3124aa1..f50f6237 100644
--- a/app/Http/Controllers/Seller/PosController.php
+++ b/app/Http/Controllers/Seller/PosController.php
@@ -17,6 +17,7 @@ use Mail;
use App\Mail\InvoiceEmailManager;
use App\Http\Resources\PosProductCollection;
use App\Models\Country;
+use App\Models\NfcVoucher;
use App\Models\State;
use App\Utility\CategoryUtility;
use App\Utility\FontUtility;
@@ -365,7 +366,12 @@ class PosController extends Controller
public function configuration()
{
- return view('seller.pos.pos_activation');
+
+ //AQUI AGREGO LA CONSULTA donde traigo los comprobantes desde el ultimo que agrego que se muestre primero
+ $nfc_vouchers = $nfc_vouchers = NfcVoucher::latest()->get();
+
+
+ return view('seller.pos.pos_activation', compact('nfc_vouchers'));
}
public function invoice($id)
diff --git a/app/Models/NfcVoucher.php b/app/Models/NfcVoucher.php
new file mode 100644
index 00000000..c1107a50
--- /dev/null
+++ b/app/Models/NfcVoucher.php
@@ -0,0 +1,22 @@
+
+
+
+
+
+ ID
+ NFC Tipo
+ NFC Siguiente
+ NFC Vencimiento
+ NFC Cantidad
+ NFC Próximo
+ NFC Estado
+ NFC Usado
+
| ID | +NFC Tipo | +NFC Siguiente | +NFC Vencimiento | +NFC Cantidad | +NFC Próximo | +NFC Estado | +NFC Usado | +
|---|---|---|---|---|---|---|---|
| {{ $nfc_voucher->id }} | +{{ $nfc_voucher->nfc_type }} | +{{ $nfc_voucher->nfc_following }} | +{{ $nfc_voucher->nfc_expiration }} | +{{ $nfc_voucher->nfc_amount }} | +{{ $nfc_voucher->nfc_next }} | ++ @if($nfc_voucher->nfc_select == 'active') + Activo + @elseif($nfc_voucher->nfc_select == 'deactivated') + Desactivado + @endif + | ++ @if($nfc_voucher->nfc_used == 'not_use') + No usado + @elseif($nfc_voucher->nfc_used == 'in_use') + En uso + @endif + | +