feat: profile_photo en contratos activos, notificaciones bilingues en reportes y foto en panel usuarios
- API contratos activos (cliente y proveedor): agrega campo profile_photo (técnico asignado o supplier, null si no tiene) - Notificaciones push bilingues en comentarios de reporte: "Nueva actividad en tu reporte" / "New activity on your report" - Moderador en web panel notifica a cliente y proveedor al comentar, con prefijo Moderador/Moderator - Panel usuarios: columna de foto de perfil entre ID y Nombre Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -33,13 +33,14 @@ class AuthController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'access_token' => $tokenResult->accessToken,
|
'access_token' => $tokenResult->accessToken,
|
||||||
'token_type' => 'Bearer',
|
'token_type' => 'Bearer',
|
||||||
'expires_at' => Carbon::parse($tokenResult->token->expires_at)->toDateTimeString(),
|
'expires_at' => Carbon::parse($tokenResult->token->expires_at)->toDateTimeString(),
|
||||||
'userid' => $user->id,
|
'userid' => $user->id,
|
||||||
'role' => $user->role_id,
|
'role' => $user->role_id,
|
||||||
'verified' => $user->phone_verified_at,
|
'verified' => $user->phone_verified_at,
|
||||||
'reported' => $user->reported,
|
'reported' => $user->reported,
|
||||||
|
'profile_photo' => $user->profile_photo,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,9 +54,10 @@ class AuthController extends Controller
|
|||||||
return response()->json(['message' => 'Token de Firebase inválido'], 401);
|
return response()->json(['message' => 'Token de Firebase inválido'], 401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$uid = $verifiedToken->claims()->get('sub');
|
$uid = $verifiedToken->claims()->get('sub');
|
||||||
$email = $verifiedToken->claims()->get('email');
|
$email = $verifiedToken->claims()->get('email');
|
||||||
$name = $verifiedToken->claims()->get('name') ?? 'Usuario';
|
$name = $verifiedToken->claims()->get('name') ?? 'Usuario';
|
||||||
|
$picture = $verifiedToken->claims()->get('picture');
|
||||||
|
|
||||||
// Buscar por firebase uid primero, luego por email para hacer merge si ya existía cuenta
|
// Buscar por firebase uid primero, luego por email para hacer merge si ya existía cuenta
|
||||||
$user = User::where('social_id', 'firebase|' . $uid)->first();
|
$user = User::where('social_id', 'firebase|' . $uid)->first();
|
||||||
@@ -65,31 +67,38 @@ class AuthController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($user) {
|
if ($user) {
|
||||||
// Vincular uid de Firebase si aún no lo tiene (merge de cuenta existente)
|
$changed = false;
|
||||||
if (!$user->social_id) {
|
if (!$user->social_id) {
|
||||||
$user->social_id = 'firebase|' . $uid;
|
$user->social_id = 'firebase|' . $uid;
|
||||||
$user->save();
|
$changed = true;
|
||||||
}
|
}
|
||||||
|
if ($picture && $user->profile_photo !== $picture) {
|
||||||
|
$user->profile_photo = $picture;
|
||||||
|
$changed = true;
|
||||||
|
}
|
||||||
|
if ($changed) $user->save();
|
||||||
} else {
|
} else {
|
||||||
$user = User::create([
|
$user = User::create([
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'email' => $email,
|
'email' => $email,
|
||||||
'social_id'=> 'firebase|' . $uid,
|
'social_id' => 'firebase|' . $uid,
|
||||||
'role_id' => 1,
|
'role_id' => 1,
|
||||||
'password' => null,
|
'password' => null,
|
||||||
|
'profile_photo' => $picture,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$tokenResult = $user->createToken('Firebase Token');
|
$tokenResult = $user->createToken('Firebase Token');
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'access_token' => $tokenResult->accessToken,
|
'access_token' => $tokenResult->accessToken,
|
||||||
'token_type' => 'Bearer',
|
'token_type' => 'Bearer',
|
||||||
'expires_at' => Carbon::parse($tokenResult->token->expires_at)->toDateTimeString(),
|
'expires_at' => Carbon::parse($tokenResult->token->expires_at)->toDateTimeString(),
|
||||||
'userid' => $user->id,
|
'userid' => $user->id,
|
||||||
'role' => $user->role_id,
|
'role' => $user->role_id,
|
||||||
'verified' => $user->phone_verified_at,
|
'verified' => $user->phone_verified_at,
|
||||||
'reported' => $user->reported,
|
'reported' => $user->reported,
|
||||||
|
'profile_photo' => $user->profile_photo,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ use App\Models\iChambaParameter;
|
|||||||
use App\Models\Suppliers;
|
use App\Models\Suppliers;
|
||||||
use App\Models\Categories;
|
use App\Models\Categories;
|
||||||
use App\Models\Cards;
|
use App\Models\Cards;
|
||||||
|
use App\Models\Technician;
|
||||||
use App\Models\Postulations;
|
use App\Models\Postulations;
|
||||||
use App\Models\CurrentContracts;
|
use App\Models\CurrentContracts;
|
||||||
use App\Models\FinishedContracts;
|
use App\Models\FinishedContracts;
|
||||||
@@ -159,28 +160,14 @@ class ContractController extends Controller
|
|||||||
|
|
||||||
public function create(Request $request) {
|
public function create(Request $request) {
|
||||||
|
|
||||||
// Si el bypass está activo, usar reglas relajadas
|
|
||||||
$paymentBypass = env('PAYMENT_BYPASS', false);
|
$paymentBypass = env('PAYMENT_BYPASS', false);
|
||||||
|
|
||||||
if ($paymentBypass) {
|
$rules = [
|
||||||
$rules = [
|
'postulation_id' => 'required|numeric',
|
||||||
'postulation_id' => 'required|numeric',
|
'supplier_id' => 'required|numeric',
|
||||||
'supplier_id' => 'required|numeric',
|
'payment_intent_id' => $paymentBypass ? 'nullable|string' : 'required|string',
|
||||||
'card_id' => 'required|string',
|
'coupon' => 'nullable|string',
|
||||||
'code' => 'required|string',
|
];
|
||||||
'device_id' => 'required|string',
|
|
||||||
'coupon' => 'nullable|string',
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
$rules = [
|
|
||||||
'postulation_id' => 'required|numeric',
|
|
||||||
'supplier_id' => 'required|numeric',
|
|
||||||
'card_id' => 'required|numeric',
|
|
||||||
'code' => 'required|numeric',
|
|
||||||
'device_id' => 'required|string|regex:/(^[A-Za-z0-9 ]+$)+/',
|
|
||||||
'coupon' => 'nullable|string|regex:/(^[A-Za-z0-9 ]+$)+/',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$validator = Validator::make($request->all(), $rules);
|
$validator = Validator::make($request->all(), $rules);
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
@@ -191,20 +178,12 @@ class ContractController extends Controller
|
|||||||
return redirect()->back()->withInput($request->all())->withErrors($validator);
|
return redirect()->back()->withInput($request->all())->withErrors($validator);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$postulation = Postulations::where('id', $request->postulation_id)->first();
|
$postulation = Postulations::where('id', $request->postulation_id)->first();
|
||||||
$coupon = Coupon::where('name', $request->coupon)->first();
|
$coupon = Coupon::where('name', $request->coupon)->first();
|
||||||
|
|
||||||
if (!$paymentBypass) {
|
|
||||||
Openpay::setProductionMode(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($user->id == $postulation->user_id) {
|
if ($user->id == $postulation->user_id) {
|
||||||
|
|
||||||
$card = null;
|
|
||||||
if (!$paymentBypass && $request->card_id) {
|
|
||||||
$card = Cards::where('id', $request->card_id)->first();
|
|
||||||
}
|
|
||||||
$supplier = Suppliers::where('id', $request->supplier_id)->first();
|
$supplier = Suppliers::where('id', $request->supplier_id)->first();
|
||||||
|
|
||||||
$IVA = iChambaParameter::where('id', $supplier->IVA_id)->first();
|
$IVA = iChambaParameter::where('id', $supplier->IVA_id)->first();
|
||||||
@@ -213,8 +192,7 @@ class ContractController extends Controller
|
|||||||
$ichambafee = iChambaParameter::where('parameter', 'ichamba_fee')->first();
|
$ichambafee = iChambaParameter::where('parameter', 'ichamba_fee')->first();
|
||||||
$category = Categories::where('id', $postulation->category_id)->first();
|
$category = Categories::where('id', $postulation->category_id)->first();
|
||||||
|
|
||||||
// En modo bypass, saltar la validación de tarjeta
|
if (true) { // autorización verificada arriba con user_id == postulation->user_id
|
||||||
if ($paymentBypass || ($card && $card->user_id == $user->id)) {
|
|
||||||
|
|
||||||
$contract = new CurrentContracts();
|
$contract = new CurrentContracts();
|
||||||
$contract->user_id = $postulation->user_id;
|
$contract->user_id = $postulation->user_id;
|
||||||
@@ -288,53 +266,22 @@ class ContractController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!empty($request->card_id) && !empty($request->device_id) && !empty($request->code) && $fee > $discount) {
|
if ($request->payment_intent_id && $fee > $discount) {
|
||||||
// Bypass de pago para pruebas
|
if ($paymentBypass) {
|
||||||
if (env('PAYMENT_BYPASS', false)) {
|
|
||||||
$contract->transaction_id = 'BYPASS_' . uniqid();
|
$contract->transaction_id = 'BYPASS_' . uniqid();
|
||||||
} else {
|
} else {
|
||||||
|
\Stripe\Stripe::setApiKey(env('STRIPE_SECRET'));
|
||||||
try {
|
try {
|
||||||
$openpay = Openpay::getInstance(config('app.openpay_id'), config('app.openpay_apikey'));
|
$intent = \Stripe\PaymentIntent::retrieve($request->payment_intent_id);
|
||||||
|
} catch (\Exception $e) {
|
||||||
$customer = $openpay->customers->get($user->openpay_id);
|
return response()->json(['type' => 'error', 'message' => 'PaymentIntent inválido'], 422);
|
||||||
$charge = $customer->charges->create($chargeData);
|
|
||||||
|
|
||||||
|
|
||||||
} catch (OpenpayApiTransactionError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'No se pudo procesar la transacción'
|
|
||||||
]);
|
|
||||||
} catch (OpenpayApiRequestError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'No se pudo procesar la operación'
|
|
||||||
]);
|
|
||||||
} catch (OpenpayApiConnectionError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error al conectarse a Openpay:' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
|
|
||||||
} catch (OpenpayApiAuthError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error al conectarse a Openpay' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
|
|
||||||
} catch (OpenpayApiError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error al conectarse a Openpay' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error: ' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$contract->transaction_id = $charge->id;
|
if ($intent->status !== 'succeeded') {
|
||||||
|
return response()->json(['type' => 'error', 'message' => 'El pago no ha sido confirmado'], 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
$contract->transaction_id = $intent->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ($coupon) {
|
} else if ($coupon) {
|
||||||
@@ -612,7 +559,8 @@ class ContractController extends Controller
|
|||||||
|
|
||||||
public function getcurrentcontracts(Request $request) {
|
public function getcurrentcontracts(Request $request) {
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$ccontracts = CurrentContracts::where('user_id', $user->id)->orderBy('created_at', 'DESC')->get();
|
$ccontracts = CurrentContracts::with(['technician.user'])
|
||||||
|
->where('user_id', $user->id)->orderBy('created_at', 'DESC')->get();
|
||||||
$currentcontracts = array();
|
$currentcontracts = array();
|
||||||
|
|
||||||
foreach($ccontracts as $ccontract) {
|
foreach($ccontracts as $ccontract) {
|
||||||
@@ -620,6 +568,12 @@ class ContractController extends Controller
|
|||||||
$supplier = Suppliers::where('id', $ccontract->supplier_id)->first();
|
$supplier = Suppliers::where('id', $ccontract->supplier_id)->first();
|
||||||
$time_limit = Carbon::parse($ccontract->appointment);
|
$time_limit = Carbon::parse($ccontract->appointment);
|
||||||
$day_limit = Carbon::parse($ccontract->created_at);
|
$day_limit = Carbon::parse($ccontract->created_at);
|
||||||
|
$technician_name = $ccontract->technical_id
|
||||||
|
? ($ccontract->technician->user->name ?? null)
|
||||||
|
: ($supplier ? ($supplier->user->name ?? null) : null);
|
||||||
|
$profile_photo = $ccontract->technical_id
|
||||||
|
? ($ccontract->technician->user->profile_photo ?? null)
|
||||||
|
: ($supplier ? ($supplier->user->profile_photo ?? null) : null);
|
||||||
$currentcontractinfo = array(
|
$currentcontractinfo = array(
|
||||||
'id' => $ccontract->id,
|
'id' => $ccontract->id,
|
||||||
'phone' => $supplier ? ($supplier->user ? $supplier->user->phone : null) : null,
|
'phone' => $supplier ? ($supplier->user ? $supplier->user->phone : null) : null,
|
||||||
@@ -628,6 +582,8 @@ class ContractController extends Controller
|
|||||||
'address' => $ccontract->address,
|
'address' => $ccontract->address,
|
||||||
'date' => $ccontract->appointment,
|
'date' => $ccontract->appointment,
|
||||||
'supplier' => $supplier ? $supplier->company_name : 'Proveedor no disponible',
|
'supplier' => $supplier ? $supplier->company_name : 'Proveedor no disponible',
|
||||||
|
'technician' => $technician_name,
|
||||||
|
'profile_photo' => $profile_photo,
|
||||||
'status' => $ccontract->status_id,
|
'status' => $ccontract->status_id,
|
||||||
'amount' => $ccontract->amount,
|
'amount' => $ccontract->amount,
|
||||||
'code' => $ccontract->code,
|
'code' => $ccontract->code,
|
||||||
@@ -660,48 +616,14 @@ class ContractController extends Controller
|
|||||||
|
|
||||||
$time_limit = Carbon::parse($ccontract->appointment);
|
$time_limit = Carbon::parse($ccontract->appointment);
|
||||||
if ($time_limit->diffInHours(Carbon::now()) >= 24) {
|
if ($time_limit->diffInHours(Carbon::now()) >= 24) {
|
||||||
if($ccontract->transaction_id != 'NO APPLY') {
|
if ($ccontract->transaction_id !== 'NO APPLY' && !str_starts_with($ccontract->transaction_id, 'BYPASS_')) {
|
||||||
try {
|
try {
|
||||||
$openpay = Openpay::getInstance(config('app.openpay_id'), config('app.openpay_apikey'));
|
\Stripe\Stripe::setApiKey(env('STRIPE_SECRET'));
|
||||||
|
\Stripe\Refund::create(['payment_intent' => $ccontract->transaction_id]);
|
||||||
$refundData = array(
|
} catch (\Stripe\Exception\ApiErrorException $e) {
|
||||||
'description' => 'Reembolso del contrato con id: ' . $ccontract->id . ', del usuario ' . $user->name . '. Con proveedor: ' . $supplier->id,
|
|
||||||
);
|
|
||||||
|
|
||||||
$customer = $openpay->customers->get($user->openpay_id);
|
|
||||||
$charge = $customer->charges->get($ccontract->transaction_id);
|
|
||||||
$charge->refund($refundData);
|
|
||||||
} catch (OpenpayApiTransactionError $e) {
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'type' => 'error',
|
'type' => 'error',
|
||||||
'message' => 'No se pudo procesar la transacción'
|
'message' => 'No se pudo procesar el reembolso: ' . $e->getMessage()
|
||||||
]);
|
|
||||||
} catch (OpenpayApiRequestError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'No se pudo procesar la operación'
|
|
||||||
]);
|
|
||||||
} catch (OpenpayApiConnectionError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error al conectarse a Openpay:' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
|
|
||||||
} catch (OpenpayApiAuthError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error al conectarse a Openpay' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
|
|
||||||
} catch (OpenpayApiError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error al conectarse a Openpay' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error: ' . $e->getMessage()
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -723,7 +645,8 @@ class ContractController extends Controller
|
|||||||
$fcontract->revenue = $ccontract->revenue;
|
$fcontract->revenue = $ccontract->revenue;
|
||||||
$fcontract->details = $ccontract->details;
|
$fcontract->details = $ccontract->details;
|
||||||
$fcontract->en = $ccontract->en;
|
$fcontract->en = $ccontract->en;
|
||||||
$fcontract->transaction_id = (!empty($charge->id) ? $charge->id : $ccontract->transaction_id);
|
$fcontract->transaction_id = $ccontract->transaction_id;
|
||||||
|
$fcontract->technical_id = $ccontract->technical_id;
|
||||||
$fcontract->status_id = 4;
|
$fcontract->status_id = 4;
|
||||||
$fcontract->save();
|
$fcontract->save();
|
||||||
|
|
||||||
@@ -756,17 +679,29 @@ class ContractController extends Controller
|
|||||||
return redirect()->back()->withInput($request->all())->withErrors($validator);
|
return redirect()->back()->withInput($request->all())->withErrors($validator);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$supplier = $user->suppliers;
|
$supplier = $user->suppliers;
|
||||||
|
$technician = null;
|
||||||
|
|
||||||
if (!$supplier) {
|
if (!$supplier) {
|
||||||
return response()->json([
|
$technician = Technician::where('user_id', $user->id)->first();
|
||||||
'success' => false,
|
if (!$technician) {
|
||||||
'message' => 'No tienes un perfil de proveedor registrado'
|
return response()->json([
|
||||||
], 400);
|
'success' => false,
|
||||||
|
'message' => 'No tienes un perfil de proveedor o técnico registrado'
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
$supplier = $technician->supplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ccontract = CurrentContracts::where('code', $request->contract_pin)->where('supplier_id', $supplier->id)->first();
|
$ccontract = $technician
|
||||||
|
? CurrentContracts::where('code', $request->contract_pin)
|
||||||
|
->where('supplier_id', $technician->supplier_id)
|
||||||
|
->where('technical_id', $technician->id)
|
||||||
|
->first()
|
||||||
|
: CurrentContracts::where('code', $request->contract_pin)
|
||||||
|
->where('supplier_id', $supplier->id)
|
||||||
|
->first();
|
||||||
|
|
||||||
if($ccontract) {
|
if($ccontract) {
|
||||||
|
|
||||||
@@ -790,6 +725,7 @@ class ContractController extends Controller
|
|||||||
$fcontract->en = $ccontract->en;
|
$fcontract->en = $ccontract->en;
|
||||||
$fcontract->coupon_id = $ccontract->coupon_id;
|
$fcontract->coupon_id = $ccontract->coupon_id;
|
||||||
$fcontract->transaction_id = $ccontract->transaction_id;
|
$fcontract->transaction_id = $ccontract->transaction_id;
|
||||||
|
$fcontract->technical_id = $ccontract->technical_id;
|
||||||
$fcontract->status_id = 3;
|
$fcontract->status_id = 3;
|
||||||
$fcontract->score = 5;
|
$fcontract->score = 5;
|
||||||
$fcontract->save();
|
$fcontract->save();
|
||||||
@@ -944,14 +880,17 @@ class ContractController extends Controller
|
|||||||
|
|
||||||
public function getfinishedcontracts(Request $request) {
|
public function getfinishedcontracts(Request $request) {
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$fcontracts = FinishedContracts::where('user_id', $user->id)->orderBy('created_at', 'DESC')->get();
|
$fcontracts = FinishedContracts::with(['technician.user', 'status'])
|
||||||
|
->where('user_id', $user->id)->orderBy('created_at', 'DESC')->get();
|
||||||
$finishedcontracts = array();
|
$finishedcontracts = array();
|
||||||
|
|
||||||
foreach($fcontracts as $fcontract) {
|
foreach($fcontracts as $fcontract) {
|
||||||
$category = Categories::where('id', $fcontract->category_id)->first();
|
$category = Categories::where('id', $fcontract->category_id)->first();
|
||||||
$supplier = Suppliers::where('id', $fcontract->supplier_id)->first();
|
$supplier = Suppliers::where('id', $fcontract->supplier_id)->first();
|
||||||
$time_limit = Carbon::parse($fcontract->appointment);
|
$time_limit = Carbon::parse($fcontract->appointment);
|
||||||
$day_limit = Carbon::parse($fcontract->created_at);
|
$technician_name = $fcontract->technical_id
|
||||||
|
? ($fcontract->technician->user->name ?? null)
|
||||||
|
: ($supplier ? ($supplier->user->name ?? null) : null);
|
||||||
$finishedcontractinfo = array(
|
$finishedcontractinfo = array(
|
||||||
'id' => $fcontract->id,
|
'id' => $fcontract->id,
|
||||||
'category' => $category ? $category->name : null,
|
'category' => $category ? $category->name : null,
|
||||||
@@ -960,6 +899,7 @@ class ContractController extends Controller
|
|||||||
'date' => $fcontract->appointment,
|
'date' => $fcontract->appointment,
|
||||||
'date_difference' => $time_limit->diff(Carbon::now(), false)->days,
|
'date_difference' => $time_limit->diff(Carbon::now(), false)->days,
|
||||||
'supplier' => $supplier ? $supplier->company_name : 'Proveedor no disponible',
|
'supplier' => $supplier ? $supplier->company_name : 'Proveedor no disponible',
|
||||||
|
'technician' => $technician_name,
|
||||||
'amount' => $fcontract->amount,
|
'amount' => $fcontract->amount,
|
||||||
'scored' => $fcontract->scored_at,
|
'scored' => $fcontract->scored_at,
|
||||||
'parent' => $fcontract->parent_contract_id,
|
'parent' => $fcontract->parent_contract_id,
|
||||||
|
|||||||
34
app/Http/Controllers/PaymentBatchController.php
Normal file
34
app/Http/Controllers/PaymentBatchController.php
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\PaymentBatch;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class PaymentBatchController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$batches = PaymentBatch::with('user')
|
||||||
|
->orderBy('created_at', 'desc')
|
||||||
|
->paginate(15);
|
||||||
|
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return view('payment-batches.index', compact('batches'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('payment-batches.ajax', compact('batches'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function download($id)
|
||||||
|
{
|
||||||
|
$batch = PaymentBatch::findOrFail($id);
|
||||||
|
$absolutePath = storage_path('app/' . $batch->file_path);
|
||||||
|
|
||||||
|
if (!file_exists($absolutePath)) {
|
||||||
|
return redirect('payment-batches')->with('error', 'El archivo ya no está disponible en el servidor.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->download($absolutePath, $batch->file_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,14 +10,12 @@ use App\Models\User;
|
|||||||
use App\Models\Suppliers;
|
use App\Models\Suppliers;
|
||||||
use App\Models\Payments;
|
use App\Models\Payments;
|
||||||
use App\Models\FinishedContracts;
|
use App\Models\FinishedContracts;
|
||||||
use App\Models\Cards;
|
use App\Models\PaymentBatch;
|
||||||
use Openpay;
|
use Stripe\Stripe;
|
||||||
use Exception;
|
use Stripe\Customer;
|
||||||
use OpenpayApiError;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
use OpenpayApiAuthError;
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
use OpenpayApiRequestError;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use OpenpayApiConnectionError;
|
|
||||||
use OpenpayApiTransactionError;
|
|
||||||
|
|
||||||
class PaymentController extends Controller
|
class PaymentController extends Controller
|
||||||
{
|
{
|
||||||
@@ -33,7 +31,7 @@ class PaymentController extends Controller
|
|||||||
if ($request->has('date_to')) $request->session()->put('pay_date_to', $dateTo);
|
if ($request->has('date_to')) $request->session()->put('pay_date_to', $dateTo);
|
||||||
|
|
||||||
$contracts = FinishedContracts::with(['suppliers.user', 'suppliers.banks'])
|
$contracts = FinishedContracts::with(['suppliers.user', 'suppliers.banks'])
|
||||||
->where('status_id', 3)
|
->whereIn('status_id', [3, 9])
|
||||||
->where('paid', false)
|
->where('paid', false)
|
||||||
->where('transaction_id', '!=', 'NO APPLY')
|
->where('transaction_id', '!=', 'NO APPLY')
|
||||||
->when($dateFrom, fn($q) => $q->whereDate('appointment', '>=', $dateFrom))
|
->when($dateFrom, fn($q) => $q->whereDate('appointment', '>=', $dateFrom))
|
||||||
@@ -93,327 +91,158 @@ class PaymentController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cardsindex(Request $request)
|
public function intent(Request $request)
|
||||||
{
|
{
|
||||||
//
|
$validator = Validator::make($request->all(), [
|
||||||
$request->session()->put('search', $request
|
'supplier_id' => 'required|numeric',
|
||||||
->has('search') ? strip_tags($request->get('search')) : ($request->session()
|
]);
|
||||||
->has('search') ? strip_tags($request->session()->get('search')) : ''));
|
if ($validator->fails()) {
|
||||||
|
return response()->json($validator->errors(), 422);
|
||||||
$request->session()->put('field', $request
|
|
||||||
->has('field') ? strip_tags($request->get('field')) : ($request->session()
|
|
||||||
->has('field') ? strip_tags($request->session()->get('field')) : 'id'));
|
|
||||||
|
|
||||||
$request->session()->put('sort', $request
|
|
||||||
->has('sort') ? strip_tags($request->get('sort')) : ($request->session()
|
|
||||||
->has('sort') ? strip_tags($request->session()->get('sort')) : 'asc'));
|
|
||||||
|
|
||||||
//$headers = $request->get('header') != '' ? $request->get('header') : -1;
|
|
||||||
|
|
||||||
$cards= new Cards();
|
|
||||||
$cards = $cards->where('id', 'LIKE', '%' . strip_tags($request->session()->get('search')) . '%')
|
|
||||||
->orwhere('token', 'LIKE', '%' . strip_tags($request->session()->get('search')) . '%')
|
|
||||||
->orderBy(strip_tags($request->session()->get('field')), strip_tags($request->session()->get('sort')))
|
|
||||||
->paginate(10);
|
|
||||||
|
|
||||||
if ($request->ajax()) {
|
|
||||||
return view('cards.index', compact('cards'));
|
|
||||||
} else {
|
|
||||||
return view('cards.ajax', compact('cards'));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function destroy($id)
|
|
||||||
{
|
|
||||||
$credit_card = Cards::where('id', $id)->first();
|
|
||||||
$user = User::where('id', $credit_card->user_id)->first();
|
|
||||||
Openpay::setProductionMode(true);
|
|
||||||
|
|
||||||
try {
|
|
||||||
$openpay = Openpay::getInstance(config('app.openpay_id'), config('app.openpay_apikey'));
|
|
||||||
$customer = $openpay->customers->get($user->openpay_id);
|
|
||||||
$card = $customer->cards->get($credit_card->token);
|
|
||||||
$card->delete();
|
|
||||||
} catch (OpenpayApiTransactionError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error en la transacción'
|
|
||||||
]);
|
|
||||||
} catch (OpenpayApiRequestError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error en los datos requeridos'
|
|
||||||
]);
|
|
||||||
} catch (OpenpayApiConnectionError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error al conectarse a Openpay: ' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
} catch (OpenpayApiAuthError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error al conectarse a Openpay: ' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
|
|
||||||
} catch (OpenpayApiError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error al conectarse a Openpay: ' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error: ' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Cards::destroy($id);
|
$user = Auth::user();
|
||||||
return redirect('cards');
|
$supplier = Suppliers::find($request->supplier_id);
|
||||||
}
|
|
||||||
|
|
||||||
public function addcard(Request $request)
|
if (!$supplier) {
|
||||||
{
|
return response()->json(['message' => 'Proveedor no encontrado'], 404);
|
||||||
$rules = [
|
}
|
||||||
'token' => 'required|string|regex:/(^[A-Za-z0-9 ]+$)+/',
|
|
||||||
'device_id' => 'required|string|regex:/(^[A-Za-z0-9 ]+$)+/',
|
|
||||||
];
|
|
||||||
|
|
||||||
$validator = Validator::make($request->all(), $rules);
|
Stripe::setApiKey(env('STRIPE_SECRET'));
|
||||||
if ($validator->fails()) {
|
|
||||||
return redirect()->back()->withInput($request->all())->withErrors($validator);
|
|
||||||
}
|
|
||||||
|
|
||||||
$user = $request->user();
|
if (!$user->stripe_customer_id) {
|
||||||
Openpay::setProductionMode(true);
|
$customer = Customer::create([
|
||||||
|
'email' => $user->email,
|
||||||
|
'name' => $user->name,
|
||||||
|
]);
|
||||||
|
$user->stripe_customer_id = $customer->id;
|
||||||
|
$user->save();
|
||||||
|
}
|
||||||
|
|
||||||
if ($user->openpay_id == null) {
|
$amount = max((int) $supplier->minimun_fee, 150);
|
||||||
try {
|
|
||||||
$openpay = Openpay::getInstance(config('app.openpay_id'), config('app.openpay_apikey'));
|
try {
|
||||||
$customerData = array(
|
$ephemeralKey = \Stripe\EphemeralKey::create(
|
||||||
'external_id' => $user->id,
|
['customer' => $user->stripe_customer_id],
|
||||||
'name' => $user->name,
|
['stripe_version' => \Stripe\Stripe::$apiVersion]
|
||||||
'email' => $user->email,
|
|
||||||
);
|
);
|
||||||
$customer = $openpay->customers->add($customerData);
|
|
||||||
} catch (OpenpayApiTransactionError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'No se pudo procesar la transacción'
|
|
||||||
]);
|
|
||||||
} catch (OpenpayApiRequestError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'No se pudo procesar la operación'
|
|
||||||
]);
|
|
||||||
} catch (OpenpayApiConnectionError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error al conectarse a Openpay: ' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
|
|
||||||
} catch (OpenpayApiAuthError $e) {
|
$intent = \Stripe\PaymentIntent::create([
|
||||||
return response()->json([
|
'amount' => $amount * 100,
|
||||||
'type' => 'error',
|
'currency' => env('STRIPE_CURRENCY', 'mxn'),
|
||||||
'message' => 'Error al conectarse a Openpay: ' . $e->getMessage()
|
'customer' => $user->stripe_customer_id,
|
||||||
|
'automatic_payment_methods' => ['enabled' => true],
|
||||||
]);
|
]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
} catch (OpenpayApiError $e) {
|
return response()->json(['message' => $e->getMessage()], 422);
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error al conectarse a Openpay: ' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error: ' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$user->openpay_id = $customer->id;
|
|
||||||
$user->save();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$cardDataRequest = array(
|
|
||||||
'token_id' => $request->token,
|
|
||||||
'device_session_id' => $request->device_id
|
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
|
||||||
$openpay = Openpay::getInstance(config('app.openpay_id'), config('app.openpay_apikey'));
|
|
||||||
$customer = $openpay->customers->get($user->openpay_id);
|
|
||||||
$card = $customer->cards->add($cardDataRequest);
|
|
||||||
|
|
||||||
} catch (OpenpayApiTransactionError $e) {
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'type' => 'error',
|
'payment_intent_id' => $intent->id,
|
||||||
'message' => 'No se pudo procesar la transacción'
|
'client_secret' => $intent->client_secret,
|
||||||
|
'customer' => $user->stripe_customer_id,
|
||||||
|
'ephemeral_key' => $ephemeralKey->secret,
|
||||||
]);
|
]);
|
||||||
} catch (OpenpayApiRequestError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'No se pudo procesar la operación'
|
|
||||||
]);
|
|
||||||
} catch (OpenpayApiConnectionError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error al conectarse a Openpay: ' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
|
|
||||||
} catch (OpenpayApiAuthError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error al conectarse a Openpay: ' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
|
|
||||||
} catch (OpenpayApiError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error al conectarse a Openpay: ' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error: ' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$card = new Cards();
|
|
||||||
|
|
||||||
$card->user_id = $user->id;
|
|
||||||
$card->token = $request->token;
|
|
||||||
|
|
||||||
$card->save();
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'message' => 'Tarjeta guardada exitosamente'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function deletecard(Request $request)
|
|
||||||
{
|
|
||||||
$rules = [
|
|
||||||
'card_id' => 'required|numeric',
|
|
||||||
];
|
|
||||||
|
|
||||||
$validator = Validator::make($request->all(), $rules);
|
|
||||||
if ($validator->fails()) {
|
|
||||||
return redirect()->back()->withInput($request->all())->withErrors($validator);
|
|
||||||
}
|
|
||||||
|
|
||||||
$user = $request->user();
|
|
||||||
$credit_card = Cards::where('id', $request->card_id)->first();
|
|
||||||
Openpay::setProductionMode(true);
|
|
||||||
|
|
||||||
|
|
||||||
if ($credit_card->user_id == $user->id) {
|
|
||||||
try {
|
|
||||||
$openpay = Openpay::getInstance(config('app.openpay_id'), config('app.openpay_apikey'));
|
|
||||||
$customer = $openpay->customers->get($user->openpay_id);
|
|
||||||
$card = $customer->cards->get($credit_card->token);
|
|
||||||
$card->delete();
|
|
||||||
} catch (OpenpayApiTransactionError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'No se pudo procesar la transacción'
|
|
||||||
]);
|
|
||||||
} catch (OpenpayApiRequestError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'No se pudo procesar la operación'
|
|
||||||
]);
|
|
||||||
} catch (OpenpayApiConnectionError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error al conectarse a Openpay: ' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
|
|
||||||
} catch (OpenpayApiAuthError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error al conectarse a Openpay: ' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
|
|
||||||
} catch (OpenpayApiError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error al conectarse a Openpay: ' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error: ' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Cards::destroy($request->card_id);
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'message' => 'Tarjeta eliminada exitosamente'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getcards(Request $request)
|
public function getcards(Request $request)
|
||||||
{
|
{
|
||||||
$user = $request->user();
|
$user = Auth::user();
|
||||||
Openpay::setProductionMode(true);
|
$cards = Cards::where('user_id', $user->id)->get()->map(fn($c) => [
|
||||||
|
'id' => $c->id,
|
||||||
|
'payment_method_id' => $c->stripe_pm_id,
|
||||||
|
'brand' => $c->brand,
|
||||||
|
'last4' => $c->last4,
|
||||||
|
'exp_month' => $c->exp_month,
|
||||||
|
'exp_year' => $c->exp_year,
|
||||||
|
]);
|
||||||
|
|
||||||
if ($user->openpay_id) {
|
return response()->json($cards);
|
||||||
try {
|
}
|
||||||
$openpay = Openpay::getInstance(config('app.openpay_id'), config('app.openpay_apikey'));
|
|
||||||
$customer = $openpay->customers->get($user->openpay_id);
|
|
||||||
} catch (OpenpayApiTransactionError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'No se pudo procesar la transacción'
|
|
||||||
]);
|
|
||||||
} catch (OpenpayApiRequestError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'No se pudo procesar la operación'
|
|
||||||
]);
|
|
||||||
} catch (OpenpayApiConnectionError $e) {
|
|
||||||
return response()->json([
|
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error al conectarse a Openpay: ' . $e->getMessage()
|
|
||||||
]);
|
|
||||||
|
|
||||||
} catch (OpenpayApiAuthError $e) {
|
public function generate(Request $request)
|
||||||
return response()->json([
|
{
|
||||||
'type' => 'error',
|
$dateFrom = $request->input('date_from', '');
|
||||||
'message' => 'Error al conectarse a Openpay: ' . $e->getMessage()
|
$dateTo = $request->input('date_to', '');
|
||||||
]);
|
|
||||||
|
|
||||||
} catch (OpenpayApiError $e) {
|
$contracts = FinishedContracts::with(['suppliers.user', 'suppliers.banks'])
|
||||||
return response()->json([
|
->whereIn('status_id', [3, 9])
|
||||||
'type' => 'error',
|
->where('paid', false)
|
||||||
'message' => 'Error al conectarse a Openpay: ' . $e->getMessage()
|
->where('transaction_id', '!=', 'NO APPLY')
|
||||||
]);
|
->when($dateFrom, fn($q) => $q->whereDate('appointment', '>=', $dateFrom))
|
||||||
} catch (Exception $e) {
|
->when($dateTo, fn($q) => $q->whereDate('appointment', '<=', $dateTo))
|
||||||
return response()->json([
|
->get();
|
||||||
'type' => 'error',
|
|
||||||
'message' => 'Error: ' . $e->getMessage()
|
if ($contracts->isEmpty()) {
|
||||||
]);
|
return redirect('payments')->with('warning', 'No hay contratos pendientes de pago con los filtros seleccionados.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$cards = Cards::where('user_id', $user->id)->get();
|
$contractIds = $contracts->pluck('id');
|
||||||
|
|
||||||
$cardsinfo = array();
|
$grouped = $contracts->groupBy('supplier_id')->map(function ($group) {
|
||||||
|
$first = $group->first();
|
||||||
|
return [
|
||||||
|
'suppliers' => $first->suppliers,
|
||||||
|
'contract_count' => $group->count(),
|
||||||
|
'total_amount' => $group->sum('amount'),
|
||||||
|
'total_revenue' => $group->sum('revenue'),
|
||||||
|
'total_iva' => $group->sum('IVA'),
|
||||||
|
'total_isr' => $group->sum('ISR'),
|
||||||
|
'total_fee' => $group->sum('ichamba_fee'),
|
||||||
|
];
|
||||||
|
})->values();
|
||||||
|
|
||||||
foreach ($cards as $credit_card) {
|
// Generar Excel
|
||||||
$card = $customer->cards->get($credit_card->token);
|
$spreadsheet = new Spreadsheet();
|
||||||
$cardinfo = array(
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
'id' => $credit_card->id,
|
$sheet->setTitle('Pagos');
|
||||||
'brand' => $card->brand,
|
|
||||||
'card_number' => $card->card_number,
|
$headers = ['Proveedor', 'Email', 'RFC / CURP', 'CLABE', 'Banco', 'Contratos', 'Monto Total', 'Utilidad', 'Ret. IVA', 'Ret. ISR', 'Ret. JobHero'];
|
||||||
);
|
foreach ($headers as $i => $header) {
|
||||||
$cardsinfo[] = $cardinfo;
|
$sheet->setCellValueByColumnAndRow($i + 1, 1, $header);
|
||||||
}
|
}
|
||||||
return response()->json($cardsinfo);
|
|
||||||
}
|
foreach ($grouped as $idx => $data) {
|
||||||
|
$row = $idx + 2;
|
||||||
|
$supplier = $data['suppliers'];
|
||||||
|
$sheet->setCellValueByColumnAndRow(1, $row, optional($supplier)->company_name ?? '');
|
||||||
|
$sheet->setCellValueByColumnAndRow(2, $row, optional(optional($supplier)->user)->email ?? '');
|
||||||
|
$sheet->setCellValueByColumnAndRow(3, $row, optional($supplier)->RFC ?: (optional($supplier)->CURP ?? ''));
|
||||||
|
$sheet->setCellValueByColumnAndRow(4, $row, optional($supplier)->clabe ?? '');
|
||||||
|
$sheet->setCellValueByColumnAndRow(5, $row, optional(optional($supplier)->banks)->name ?? '');
|
||||||
|
$sheet->setCellValueByColumnAndRow(6, $row, $data['contract_count']);
|
||||||
|
$sheet->setCellValueByColumnAndRow(7, $row, $data['total_amount']);
|
||||||
|
$sheet->setCellValueByColumnAndRow(8, $row, $data['total_revenue']);
|
||||||
|
$sheet->setCellValueByColumnAndRow(9, $row, $data['total_iva']);
|
||||||
|
$sheet->setCellValueByColumnAndRow(10, $row, $data['total_isr']);
|
||||||
|
$sheet->setCellValueByColumnAndRow(11, $row, $data['total_fee']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$now = now();
|
||||||
|
$fileName = 'pagos_' . $now->format('Y-m-d_H-i-s') . '.xlsx';
|
||||||
|
$relativePath = 'payment-batches/' . $fileName;
|
||||||
|
$absolutePath = storage_path('app/' . $relativePath);
|
||||||
|
|
||||||
|
if (!is_dir(storage_path('app/payment-batches'))) {
|
||||||
|
mkdir(storage_path('app/payment-batches'), 0755, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$writer = new Xlsx($spreadsheet);
|
||||||
|
$writer->save($absolutePath);
|
||||||
|
|
||||||
|
PaymentBatch::create([
|
||||||
|
'file_name' => $fileName,
|
||||||
|
'file_path' => $relativePath,
|
||||||
|
'generated_by' => Auth::id(),
|
||||||
|
'date_from' => $dateFrom ?: null,
|
||||||
|
'date_to' => $dateTo ?: null,
|
||||||
|
]);
|
||||||
|
|
||||||
|
FinishedContracts::whereIn('id', $contractIds)->update([
|
||||||
|
'paid' => true,
|
||||||
|
'paid_at' => $now,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->download($absolutePath, $fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,17 +160,17 @@ class PostulationController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$minutes = intval(substr(substr($request->setdate, 14), 0, 2) + 15);
|
$minutes = intval(substr(substr($request->sethour, 14), 0, 2) + 15);
|
||||||
$hours = intval(substr(substr($request->setdate, 11), 0, 2) + 1);
|
$hours = intval(substr(substr($request->sethour, 11), 0, 2) + 1);
|
||||||
|
|
||||||
if ($minutes > 59) {
|
if ($minutes > 59) {
|
||||||
if ($hours > 23){
|
if ($hours > 23){
|
||||||
$delay_msg = Carbon::now()->addDays(1)->toDateString() . ' ' . ($hours - 24) . ':' . ($minutes - 60) . substr(substr($request->setdate, 16), 0, 3);
|
$delay_msg = Carbon::now()->addDays(1)->toDateString() . ' ' . ($hours - 24) . ':' . ($minutes - 60) . substr(substr($request->sethour, 16), 0, 3);
|
||||||
} else {
|
} else {
|
||||||
$delay_msg = substr($request->sethour, 0, 10) . ' ' . $hours . ':' . ($minutes - 60) . substr(substr($request->setdate, 16), 0, 3);
|
$delay_msg = substr($request->sethour, 0, 10) . ' ' . $hours . ':' . ($minutes - 60) . substr(substr($request->sethour, 16), 0, 3);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$delay_msg = substr($request->sethour, 0, 10) . ' ' . $hours . ':' . $minutes . substr(substr($request->setdate, 16), 0, 3);
|
$delay_msg = substr($request->sethour, 0, 10) . ' ' . $hours . ':' . $minutes . substr(substr($request->sethour, 16), 0, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
$delay_UTC = Carbon::now()->addMinutes(15)->toString();
|
$delay_UTC = Carbon::now()->addMinutes(15)->toString();
|
||||||
@@ -290,19 +290,24 @@ class PostulationController extends Controller
|
|||||||
], 400);
|
], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
$postulations = FinishedContracts::where('supplier_id', $user->suppliers->id)->orderBy('created_at', 'DESC')->get();
|
$supplier = $user->suppliers;
|
||||||
|
$postulations = FinishedContracts::with(['technician.user'])
|
||||||
|
->where('supplier_id', $supplier->id)->orderBy('created_at', 'DESC')->get();
|
||||||
$finishedpostulations = array();
|
$finishedpostulations = array();
|
||||||
|
|
||||||
foreach($postulations as $postulation) {
|
foreach($postulations as $postulation) {
|
||||||
$time_limit = Carbon::parse($postulation->appointment);
|
|
||||||
$category = Categories::where('id', $postulation->category_id)->first();
|
$category = Categories::where('id', $postulation->category_id)->first();
|
||||||
|
$technician = $postulation->technical_id
|
||||||
|
? ($postulation->technician->user->name ?? null)
|
||||||
|
: ($supplier->user->name ?? null);
|
||||||
$finishedpostulationinfo = array(
|
$finishedpostulationinfo = array(
|
||||||
'id' => $postulation->id,
|
'id' => $postulation->id,
|
||||||
'category' => $category->name,
|
'category' => $category->name,
|
||||||
'en_category' => $category->en_name,
|
'en_category' => $category->en_name,
|
||||||
'address' => $postulation->address,
|
'address' => $postulation->address,
|
||||||
'date' => $postulation->appointment,
|
'date' => $postulation->appointment,
|
||||||
'amount' => $postulation->amount
|
'amount' => $postulation->amount,
|
||||||
|
'technician' => $technician
|
||||||
);
|
);
|
||||||
$finishedpostulations[] = $finishedpostulationinfo;
|
$finishedpostulations[] = $finishedpostulationinfo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ namespace App\Http\Controllers;
|
|||||||
use App\Models\Report;
|
use App\Models\Report;
|
||||||
use App\Models\ReportComment;
|
use App\Models\ReportComment;
|
||||||
use App\Models\FinishedContracts;
|
use App\Models\FinishedContracts;
|
||||||
|
use App\Models\Suppliers;
|
||||||
use App\Models\NoHome;
|
use App\Models\NoHome;
|
||||||
|
use OneSignal;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
@@ -15,7 +17,7 @@ class ReportCommentController extends Controller
|
|||||||
public function index(Request $request, $id)
|
public function index(Request $request, $id)
|
||||||
{
|
{
|
||||||
$report = Report::find($id);
|
$report = Report::find($id);
|
||||||
$contract = FinishedContracts::with(['user', 'suppliers.user', 'categories'])->find($report->contract_id);
|
$contract = FinishedContracts::with(['user', 'suppliers.user', 'categories', 'status'])->find($report->contract_id);
|
||||||
$nohome = NoHome::where('contract_id', $contract->id)->first();
|
$nohome = NoHome::where('contract_id', $contract->id)->first();
|
||||||
$comments = ReportComment::with('user')
|
$comments = ReportComment::with('user')
|
||||||
->where('report_id', $id)
|
->where('report_id', $id)
|
||||||
@@ -41,6 +43,31 @@ class ReportCommentController extends Controller
|
|||||||
$comment->comment = strip_tags($request->comment);
|
$comment->comment = strip_tags($request->comment);
|
||||||
$comment->save();
|
$comment->save();
|
||||||
|
|
||||||
|
$report = Report::find($id);
|
||||||
|
$contract = FinishedContracts::find($report->contract_id);
|
||||||
|
$supplier = Suppliers::find($contract->supplier_id);
|
||||||
|
|
||||||
|
$recipients = array_filter([
|
||||||
|
$contract->user_id,
|
||||||
|
$supplier->user_id ?? null,
|
||||||
|
]);
|
||||||
|
|
||||||
|
foreach ($recipients as $recipientId) {
|
||||||
|
try {
|
||||||
|
OneSignal::sendNotificationCustom([
|
||||||
|
'include_external_user_ids' => [(string) $recipientId],
|
||||||
|
'contents' => [
|
||||||
|
'es' => 'Moderador: ' . $comment->comment,
|
||||||
|
'en' => 'Moderator: ' . $comment->comment,
|
||||||
|
],
|
||||||
|
'headings' => [
|
||||||
|
'es' => 'Nueva actividad en tu reporte',
|
||||||
|
'en' => 'New activity on your report',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
} catch (\Exception $e) {}
|
||||||
|
}
|
||||||
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ use App\Models\FinishedContracts;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use OneSignal;
|
||||||
|
use Stripe\Stripe;
|
||||||
|
use Stripe\Refund;
|
||||||
|
|
||||||
class ReportController extends Controller
|
class ReportController extends Controller
|
||||||
{
|
{
|
||||||
@@ -89,27 +92,47 @@ class ReportController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function veredict(Request $request, $id)
|
public function veredict(Request $request, $id)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
if ($request->isMethod('get'))
|
if ($request->isMethod('get'))
|
||||||
return view('reports.veredict', ['report' => Report::find($id)]);
|
return view('reports.veredict', ['report' => Report::with('finishedcontracts')->find($id)]);
|
||||||
|
|
||||||
$rules = [
|
$rules = [
|
||||||
'veredict' => 'required|string',
|
'veredict' => 'required|string',
|
||||||
|
'contract_status' => 'nullable|in:8,9',
|
||||||
];
|
];
|
||||||
|
|
||||||
$messages = [
|
$messages = [
|
||||||
'veredict.required' => 'Se requiere un veredicto',
|
'veredict.required' => 'Se requiere un veredicto',
|
||||||
];
|
];
|
||||||
|
|
||||||
$validator = Validator::make($request->all(), $rules, $messages);
|
$validator = Validator::make($request->all(), $rules, $messages);
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return redirect()->back()->withInput($request->all())->withErrors($validator);
|
return redirect()->back()->withInput($request->all())->withErrors($validator);
|
||||||
}
|
}
|
||||||
|
|
||||||
$report = Report::find($id);
|
$report = Report::with('finishedcontracts')->find($id);
|
||||||
$report->veredict = strip_tags($request->veredict);
|
$report->veredict = strip_tags($request->veredict);
|
||||||
$report->save();
|
$report->save();
|
||||||
|
|
||||||
|
if ($request->filled('contract_status')) {
|
||||||
|
$contract = $report->finishedcontracts;
|
||||||
|
$newStatus = (int) $request->contract_status;
|
||||||
|
|
||||||
|
if ($newStatus === 8) {
|
||||||
|
$tid = $contract->transaction_id ?? null;
|
||||||
|
if ($tid && $tid !== 'NO APPLY' && !str_starts_with($tid, 'BYPASS_')) {
|
||||||
|
try {
|
||||||
|
Stripe::setApiKey(env('STRIPE_SECRET'));
|
||||||
|
Refund::create(['payment_intent' => $tid]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// reembolso fallido: se registra pero no bloquea el flujo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$contract->status_id = $newStatus;
|
||||||
|
$contract->save();
|
||||||
|
}
|
||||||
|
|
||||||
return redirect('reports');
|
return redirect('reports');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,6 +231,23 @@ class ReportController extends Controller
|
|||||||
$isSupplier = $user->id === $supplierUserId;
|
$isSupplier = $user->id === $supplierUserId;
|
||||||
$isClient = $user->id === $contract->user_id;
|
$isClient = $user->id === $contract->user_id;
|
||||||
|
|
||||||
|
$recipientId = $isClient ? $supplierUserId : $contract->user_id;
|
||||||
|
if ($recipientId) {
|
||||||
|
try {
|
||||||
|
OneSignal::sendNotificationCustom([
|
||||||
|
'include_external_user_ids' => [(string) $recipientId],
|
||||||
|
'contents' => [
|
||||||
|
'es' => $user->name . ': ' . $comment->comment,
|
||||||
|
'en' => $user->name . ': ' . $comment->comment,
|
||||||
|
],
|
||||||
|
'headings' => [
|
||||||
|
'es' => 'Nueva actividad en tu reporte',
|
||||||
|
'en' => 'New activity on your report',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
} catch (\Exception $e) {}
|
||||||
|
}
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'id' => $comment->id,
|
'id' => $comment->id,
|
||||||
'sender_id' => $user->id,
|
'sender_id' => $user->id,
|
||||||
@@ -232,6 +272,7 @@ class ReportController extends Controller
|
|||||||
$reports = Report::with([
|
$reports = Report::with([
|
||||||
'finishedcontracts.suppliers.user',
|
'finishedcontracts.suppliers.user',
|
||||||
'finishedcontracts.categories',
|
'finishedcontracts.categories',
|
||||||
|
'finishedcontracts.technician.user',
|
||||||
])
|
])
|
||||||
->whereIn('contract_id', $contractIds)
|
->whereIn('contract_id', $contractIds)
|
||||||
->orderBy('created_at', 'desc')
|
->orderBy('created_at', 'desc')
|
||||||
@@ -239,9 +280,12 @@ class ReportController extends Controller
|
|||||||
|
|
||||||
$data = $reports->map(function ($report) {
|
$data = $reports->map(function ($report) {
|
||||||
$contract = $report->finishedcontracts;
|
$contract = $report->finishedcontracts;
|
||||||
|
$technician = $contract->technical_id
|
||||||
|
? ($contract->technician->user->name ?? null)
|
||||||
|
: ($contract->suppliers->user->name ?? null);
|
||||||
return [
|
return [
|
||||||
'id' => $report->id,
|
'id' => $report->id,
|
||||||
'supplier' => $contract->suppliers->user->name ?? null,
|
'technician' => $technician,
|
||||||
'company' => $contract->suppliers->company_name ?? null,
|
'company' => $contract->suppliers->company_name ?? null,
|
||||||
'category' => $contract->categories->name ?? null,
|
'category' => $contract->categories->name ?? null,
|
||||||
'en_category' => $contract->categories->en_name ?? null,
|
'en_category' => $contract->categories->en_name ?? null,
|
||||||
|
|||||||
@@ -1280,12 +1280,19 @@ class SupplierController extends Controller
|
|||||||
], 400);
|
], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
$contracts = CurrentContracts::where('supplier_id', $supplier->id)->orderBy('created_at', 'DESC')->get();
|
$contracts = CurrentContracts::with(['technician.user'])
|
||||||
|
->where('supplier_id', $supplier->id)->orderBy('created_at', 'DESC')->get();
|
||||||
|
|
||||||
$contractsinfo = array();
|
$contractsinfo = array();
|
||||||
|
|
||||||
foreach ($contracts as $contract) {
|
foreach ($contracts as $contract) {
|
||||||
$category = Categories::where('id', $contract->category_id)->first();
|
$category = Categories::where('id', $contract->category_id)->first();
|
||||||
|
$technician = $contract->technical_id
|
||||||
|
? ($contract->technician->user->name ?? null)
|
||||||
|
: ($supplier->user->name ?? null);
|
||||||
|
$profile_photo = $contract->technical_id
|
||||||
|
? ($contract->technician->user->profile_photo ?? null)
|
||||||
|
: ($supplier->user->profile_photo ?? null);
|
||||||
$contractinfo = array(
|
$contractinfo = array(
|
||||||
'id' => $contract->id,
|
'id' => $contract->id,
|
||||||
'phone' => $contract->user->phone,
|
'phone' => $contract->user->phone,
|
||||||
@@ -1297,7 +1304,9 @@ class SupplierController extends Controller
|
|||||||
'lat' => $contract->location->getLat(),
|
'lat' => $contract->location->getLat(),
|
||||||
'lng' => $contract->location->getLng(),
|
'lng' => $contract->location->getLng(),
|
||||||
'amount' => $contract->amount,
|
'amount' => $contract->amount,
|
||||||
'details' => $contract->details
|
'details' => $contract->details,
|
||||||
|
'technician' => $technician,
|
||||||
|
'profile_photo' => $profile_photo
|
||||||
);
|
);
|
||||||
$contractsinfo[] = $contractinfo;
|
$contractsinfo[] = $contractinfo;
|
||||||
}
|
}
|
||||||
|
|||||||
192
app/Http/Controllers/TechnicianController.php
Normal file
192
app/Http/Controllers/TechnicianController.php
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Technician;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\CurrentContracts;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
|
||||||
|
class TechnicianController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
$supplier = $user->suppliers;
|
||||||
|
|
||||||
|
if (!$supplier) {
|
||||||
|
return response()->json(['message' => 'No tienes un perfil de proveedor'], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$technicians = Technician::with('user')
|
||||||
|
->where('supplier_id', $supplier->id)
|
||||||
|
->get()
|
||||||
|
->map(fn($t) => [
|
||||||
|
'id' => $t->id,
|
||||||
|
'user_id' => $t->user_id,
|
||||||
|
'name' => $t->user->name ?? null,
|
||||||
|
'email' => $t->user->email ?? null,
|
||||||
|
'phone' => $t->user->phone ?? null,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json($technicians);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'user_id' => 'required|numeric|exists:users,id',
|
||||||
|
]);
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json($validator->errors(), 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = Auth::user();
|
||||||
|
$supplier = $user->suppliers;
|
||||||
|
|
||||||
|
if (!$supplier) {
|
||||||
|
return response()->json(['message' => 'No tienes un perfil de proveedor'], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$targetUser = User::find($request->user_id);
|
||||||
|
|
||||||
|
if ($targetUser->id === $user->id) {
|
||||||
|
return response()->json(['message' => 'No puedes agregarte a ti mismo como técnico'], 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
$exists = Technician::where('user_id', $request->user_id)
|
||||||
|
->where('supplier_id', $supplier->id)
|
||||||
|
->exists();
|
||||||
|
|
||||||
|
if ($exists) {
|
||||||
|
return response()->json(['message' => 'Este usuario ya es técnico de tu empresa'], 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
$technician = Technician::create([
|
||||||
|
'user_id' => $request->user_id,
|
||||||
|
'supplier_id' => $supplier->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$targetUser->role_id = 8;
|
||||||
|
$targetUser->save();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'id' => $technician->id,
|
||||||
|
'user_id' => $technician->user_id,
|
||||||
|
'name' => $targetUser->name,
|
||||||
|
'email' => $targetUser->email,
|
||||||
|
'phone' => $targetUser->phone,
|
||||||
|
], 201);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
$supplier = $user->suppliers;
|
||||||
|
|
||||||
|
if (!$supplier) {
|
||||||
|
return response()->json(['message' => 'No tienes un perfil de proveedor'], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$technician = Technician::where('id', $id)
|
||||||
|
->where('supplier_id', $supplier->id)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (!$technician) {
|
||||||
|
return response()->json(['message' => 'Técnico no encontrado'], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Revertir role a "Usuario" solo si no pertenece a otro proveedor
|
||||||
|
$otherSuppliers = Technician::where('user_id', $technician->user_id)
|
||||||
|
->where('supplier_id', '!=', $supplier->id)
|
||||||
|
->exists();
|
||||||
|
|
||||||
|
if (!$otherSuppliers) {
|
||||||
|
$targetUser = User::find($technician->user_id);
|
||||||
|
if ($targetUser && $targetUser->role_id === 8) {
|
||||||
|
$targetUser->role_id = 1;
|
||||||
|
$targetUser->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$technician->delete();
|
||||||
|
|
||||||
|
return response()->json(['message' => 'Técnico eliminado exitosamente']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function find(Request $request)
|
||||||
|
{
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'email' => 'required|email',
|
||||||
|
]);
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json($validator->errors(), 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = Auth::user();
|
||||||
|
$supplier = $user->suppliers;
|
||||||
|
|
||||||
|
if (!$supplier) {
|
||||||
|
return response()->json(['message' => 'No tienes un perfil de proveedor'], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$targetUser = User::where('email', $request->email)->first();
|
||||||
|
|
||||||
|
if (!$targetUser) {
|
||||||
|
return response()->json(['message' => 'Usuario no encontrado'], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$alreadyInTeam = Technician::where('user_id', $targetUser->id)
|
||||||
|
->where('supplier_id', $supplier->id)
|
||||||
|
->exists();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'id' => $targetUser->id,
|
||||||
|
'name' => $targetUser->name,
|
||||||
|
'email' => $targetUser->email,
|
||||||
|
'phone' => $targetUser->phone,
|
||||||
|
'already_in_team' => $alreadyInTeam,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function assign(Request $request)
|
||||||
|
{
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
'contract_id' => 'required|numeric|exists:current_contracts,id',
|
||||||
|
'technician_id' => 'nullable|numeric|exists:technicians,id',
|
||||||
|
]);
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json($validator->errors(), 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = Auth::user();
|
||||||
|
$supplier = $user->suppliers;
|
||||||
|
|
||||||
|
if (!$supplier) {
|
||||||
|
return response()->json(['message' => 'No tienes un perfil de proveedor'], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$contract = CurrentContracts::find($request->contract_id);
|
||||||
|
|
||||||
|
if ($contract->supplier_id !== $supplier->id) {
|
||||||
|
return response()->json(['message' => 'No autorizado'], 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->technician_id) {
|
||||||
|
$technician = Technician::where('id', $request->technician_id)
|
||||||
|
->where('supplier_id', $supplier->id)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (!$technician) {
|
||||||
|
return response()->json(['message' => 'El técnico no pertenece a tu empresa'], 422);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$contract->technical_id = $request->technician_id ?? null;
|
||||||
|
$contract->save();
|
||||||
|
|
||||||
|
return response()->json(['message' => 'Técnico asignado exitosamente']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -107,7 +107,6 @@ class UserController extends Controller
|
|||||||
'name' => 'required|string',
|
'name' => 'required|string',
|
||||||
'email' => 'required|string|email',
|
'email' => 'required|string|email',
|
||||||
'role' => 'required|numeric',
|
'role' => 'required|numeric',
|
||||||
'openpay_id' => 'string|nullable',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$messages = [
|
$messages = [
|
||||||
@@ -125,9 +124,6 @@ class UserController extends Controller
|
|||||||
$user->name = strip_tags($request->name);
|
$user->name = strip_tags($request->name);
|
||||||
$user->email = $request->email;
|
$user->email = $request->email;
|
||||||
$user->role_id = $request->role;
|
$user->role_id = $request->role;
|
||||||
if ($request->openpay_id == "null" OR $request->openpay_id == null){
|
|
||||||
$user->openpay_id = null;
|
|
||||||
}
|
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
return redirect('users');
|
return redirect('users');
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use App\Models\Categories;
|
|||||||
use App\Models\Suppliers;
|
use App\Models\Suppliers;
|
||||||
use App\Models\Coupon;
|
use App\Models\Coupon;
|
||||||
use App\Models\Status;
|
use App\Models\Status;
|
||||||
|
use App\Models\Technician;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use TarfinLabs\LaravelSpatial\Casts\LocationCast;
|
use TarfinLabs\LaravelSpatial\Casts\LocationCast;
|
||||||
use TarfinLabs\LaravelSpatial\Traits\HasSpatial;
|
use TarfinLabs\LaravelSpatial\Traits\HasSpatial;
|
||||||
@@ -30,6 +31,7 @@ class CurrentContracts extends Model
|
|||||||
'coupon_id',
|
'coupon_id',
|
||||||
'transaction_id',
|
'transaction_id',
|
||||||
'status_id',
|
'status_id',
|
||||||
|
'technical_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@@ -61,4 +63,9 @@ class CurrentContracts extends Model
|
|||||||
return $this->belongsTo(Status::class);
|
return $this->belongsTo(Status::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function technician()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Technician::class, 'technical_id');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use App\Models\Status;
|
|||||||
use App\Models\Report;
|
use App\Models\Report;
|
||||||
use App\Models\Payments;
|
use App\Models\Payments;
|
||||||
use App\Models\NoHome;
|
use App\Models\NoHome;
|
||||||
|
use App\Models\Technician;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use TarfinLabs\LaravelSpatial\Casts\LocationCast;
|
use TarfinLabs\LaravelSpatial\Casts\LocationCast;
|
||||||
use TarfinLabs\LaravelSpatial\Traits\HasSpatial;
|
use TarfinLabs\LaravelSpatial\Traits\HasSpatial;
|
||||||
@@ -34,6 +35,7 @@ class FinishedContracts extends Model
|
|||||||
'transaction_id',
|
'transaction_id',
|
||||||
'score',
|
'score',
|
||||||
'status_id',
|
'status_id',
|
||||||
|
'technical_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@@ -80,4 +82,9 @@ class FinishedContracts extends Model
|
|||||||
return $this->hasOne(NoHome::class);
|
return $this->hasOne(NoHome::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function technician()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Technician::class, 'technical_id');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
22
app/Models/PaymentBatch.php
Normal file
22
app/Models/PaymentBatch.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class PaymentBatch extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'file_name',
|
||||||
|
'file_path',
|
||||||
|
'generated_by',
|
||||||
|
'date_from',
|
||||||
|
'date_to',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'generated_by');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ use App\Models\Postulations;
|
|||||||
use App\Models\FinishedContracts;
|
use App\Models\FinishedContracts;
|
||||||
use App\Models\CurrentContracts;
|
use App\Models\CurrentContracts;
|
||||||
use App\Models\Payments;
|
use App\Models\Payments;
|
||||||
|
use App\Models\Technician;
|
||||||
use TarfinLabs\LaravelSpatial\Casts\LocationCast;
|
use TarfinLabs\LaravelSpatial\Casts\LocationCast;
|
||||||
use TarfinLabs\LaravelSpatial\Traits\HasSpatial;
|
use TarfinLabs\LaravelSpatial\Traits\HasSpatial;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
@@ -73,6 +74,11 @@ class Suppliers extends Model
|
|||||||
return $this->hasMany(FinishedContracts::class);
|
return $this->hasMany(FinishedContracts::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function technicians()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Technician::class, 'supplier_id');
|
||||||
|
}
|
||||||
|
|
||||||
public function ichambaparameters()
|
public function ichambaparameters()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(iChambaParameter::class);
|
return $this->belongsTo(iChambaParameter::class);
|
||||||
|
|||||||
11
app/Models/Cards.php → app/Models/Technician.php
Executable file → Normal file
11
app/Models/Cards.php → app/Models/Technician.php
Executable file → Normal file
@@ -3,16 +3,23 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use App\Models\Suppliers;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Cards extends Model
|
class Technician extends Model
|
||||||
{
|
{
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'user_id',
|
'user_id',
|
||||||
'token',
|
'supplier_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function user()
|
public function user()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(User::class);
|
return $this->belongsTo(User::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function supplier()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Suppliers::class, 'supplier_id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,6 @@ namespace App\Models;
|
|||||||
|
|
||||||
use App\Models\Role;
|
use App\Models\Role;
|
||||||
use App\Models\LinkedSocialAccount;
|
use App\Models\LinkedSocialAccount;
|
||||||
use App\Models\Cards;
|
|
||||||
use App\Models\Suppliers;
|
use App\Models\Suppliers;
|
||||||
use App\Models\Postulations;
|
use App\Models\Postulations;
|
||||||
use App\Models\Report;
|
use App\Models\Report;
|
||||||
@@ -27,10 +26,9 @@ class User extends Authenticatable
|
|||||||
'profile_photo',
|
'profile_photo',
|
||||||
'role_id',
|
'role_id',
|
||||||
'social_id',
|
'social_id',
|
||||||
'openpay_id',
|
'stripe_customer_id',
|
||||||
'password',
|
'password',
|
||||||
'phone',
|
'phone',
|
||||||
'openpay_id',
|
|
||||||
'phone_verified_at'
|
'phone_verified_at'
|
||||||
];
|
];
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
@@ -54,11 +52,6 @@ class User extends Authenticatable
|
|||||||
return $this->hasMany(LinkedSocialAccount::class);
|
return $this->hasMany(LinkedSocialAccount::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cards()
|
|
||||||
{
|
|
||||||
return $this->hasMany(Cards::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function suppliers()
|
public function suppliers()
|
||||||
{
|
{
|
||||||
return $this->hasOne(Suppliers::class);
|
return $this->hasOne(Suppliers::class);
|
||||||
|
|||||||
@@ -39,6 +39,8 @@
|
|||||||
"openpay/sdk": "^2.0",
|
"openpay/sdk": "^2.0",
|
||||||
"spatie/laravel-google-cloud-storage": "^2.3",
|
"spatie/laravel-google-cloud-storage": "^2.3",
|
||||||
"spatie/laravel-html": "^3.0",
|
"spatie/laravel-html": "^3.0",
|
||||||
|
"phpoffice/phpspreadsheet": "^2.0",
|
||||||
|
"stripe/stripe-php": "^20.2",
|
||||||
"tarfin-labs/laravel-spatial": "^3.0",
|
"tarfin-labs/laravel-spatial": "^3.0",
|
||||||
"timehunter/laravel-google-recaptcha-v3": "^2.4"
|
"timehunter/laravel-google-recaptcha-v3": "^2.4"
|
||||||
},
|
},
|
||||||
|
|||||||
431
composer.lock
generated
431
composer.lock
generated
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "c61511f0eed8a14cd184f0bae9104e5e",
|
"content-hash": "36319ee9cf7a1e9c627e9e9d19baf6e6",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "berkayk/onesignal-laravel",
|
"name": "berkayk/onesignal-laravel",
|
||||||
@@ -398,6 +398,82 @@
|
|||||||
],
|
],
|
||||||
"time": "2024-02-09T16:56:22+00:00"
|
"time": "2024-02-09T16:56:22+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "composer/pcre",
|
||||||
|
"version": "3.4.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/composer/pcre.git",
|
||||||
|
"reference": "d5a341b3fb61f3001970940afb1d332968a183ed"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/composer/pcre/zipball/d5a341b3fb61f3001970940afb1d332968a183ed",
|
||||||
|
"reference": "d5a341b3fb61f3001970940afb1d332968a183ed",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7.4 || ^8.0"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"phpstan/phpstan": "<2.2.2"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpstan/phpstan": "^2",
|
||||||
|
"phpstan/phpstan-deprecation-rules": "^2",
|
||||||
|
"phpstan/phpstan-strict-rules": "^2",
|
||||||
|
"phpunit/phpunit": "^9"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"phpstan": {
|
||||||
|
"includes": [
|
||||||
|
"extension.neon"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-main": "3.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Composer\\Pcre\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Jordi Boggiano",
|
||||||
|
"email": "j.boggiano@seld.be",
|
||||||
|
"homepage": "http://seld.be"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PCRE wrapping library that offers type-safe preg_* replacements.",
|
||||||
|
"keywords": [
|
||||||
|
"PCRE",
|
||||||
|
"preg",
|
||||||
|
"regex",
|
||||||
|
"regular expression"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/composer/pcre/issues",
|
||||||
|
"source": "https://github.com/composer/pcre/tree/3.4.0"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://packagist.com",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/composer",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2026-06-07T11:47:49+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "cuyz/valinor",
|
"name": "cuyz/valinor",
|
||||||
"version": "2.4.0",
|
"version": "2.4.0",
|
||||||
@@ -4249,6 +4325,191 @@
|
|||||||
],
|
],
|
||||||
"time": "2026-03-08T20:05:35+00:00"
|
"time": "2026-03-08T20:05:35+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "maennchen/zipstream-php",
|
||||||
|
"version": "3.2.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/maennchen/ZipStream-PHP.git",
|
||||||
|
"reference": "77bebeb4c6c340bb3c11c843b2cffd8bbfde4d5e"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/77bebeb4c6c340bb3c11c843b2cffd8bbfde4d5e",
|
||||||
|
"reference": "77bebeb4c6c340bb3c11c843b2cffd8bbfde4d5e",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-mbstring": "*",
|
||||||
|
"ext-zlib": "*",
|
||||||
|
"php-64bit": "^8.3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"brianium/paratest": "^7.7",
|
||||||
|
"ext-zip": "*",
|
||||||
|
"friendsofphp/php-cs-fixer": "^3.86",
|
||||||
|
"guzzlehttp/guzzle": "^7.5",
|
||||||
|
"mikey179/vfsstream": "^1.6",
|
||||||
|
"php-coveralls/php-coveralls": "^2.5",
|
||||||
|
"phpunit/phpunit": "^12.0",
|
||||||
|
"vimeo/psalm": "^6.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"guzzlehttp/psr7": "^2.4",
|
||||||
|
"psr/http-message": "^2.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"ZipStream\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Paul Duncan",
|
||||||
|
"email": "pabs@pablotron.org"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jonatan Männchen",
|
||||||
|
"email": "jonatan@maennchen.ch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jesse Donat",
|
||||||
|
"email": "donatj@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "András Kolesár",
|
||||||
|
"email": "kolesar@kolesar.hu"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.",
|
||||||
|
"keywords": [
|
||||||
|
"stream",
|
||||||
|
"zip"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/maennchen/ZipStream-PHP/issues",
|
||||||
|
"source": "https://github.com/maennchen/ZipStream-PHP/tree/3.2.2"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/maennchen",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2026-04-11T18:38:28+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "markbaker/complex",
|
||||||
|
"version": "3.0.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/MarkBaker/PHPComplex.git",
|
||||||
|
"reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/95c56caa1cf5c766ad6d65b6344b807c1e8405b9",
|
||||||
|
"reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7.2 || ^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
|
||||||
|
"phpcompatibility/php-compatibility": "^9.3",
|
||||||
|
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
|
||||||
|
"squizlabs/php_codesniffer": "^3.7"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Complex\\": "classes/src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Mark Baker",
|
||||||
|
"email": "mark@lange.demon.co.uk"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP Class for working with complex numbers",
|
||||||
|
"homepage": "https://github.com/MarkBaker/PHPComplex",
|
||||||
|
"keywords": [
|
||||||
|
"complex",
|
||||||
|
"mathematics"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/MarkBaker/PHPComplex/issues",
|
||||||
|
"source": "https://github.com/MarkBaker/PHPComplex/tree/3.0.2"
|
||||||
|
},
|
||||||
|
"time": "2022-12-06T16:21:08+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "markbaker/matrix",
|
||||||
|
"version": "3.0.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/MarkBaker/PHPMatrix.git",
|
||||||
|
"reference": "728434227fe21be27ff6d86621a1b13107a2562c"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/728434227fe21be27ff6d86621a1b13107a2562c",
|
||||||
|
"reference": "728434227fe21be27ff6d86621a1b13107a2562c",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7.1 || ^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
|
||||||
|
"phpcompatibility/php-compatibility": "^9.3",
|
||||||
|
"phpdocumentor/phpdocumentor": "2.*",
|
||||||
|
"phploc/phploc": "^4.0",
|
||||||
|
"phpmd/phpmd": "2.*",
|
||||||
|
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
|
||||||
|
"sebastian/phpcpd": "^4.0",
|
||||||
|
"squizlabs/php_codesniffer": "^3.7"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Matrix\\": "classes/src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Mark Baker",
|
||||||
|
"email": "mark@demon-angel.eu"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP Class for working with matrices",
|
||||||
|
"homepage": "https://github.com/MarkBaker/PHPMatrix",
|
||||||
|
"keywords": [
|
||||||
|
"mathematics",
|
||||||
|
"matrix",
|
||||||
|
"vector"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/MarkBaker/PHPMatrix/issues",
|
||||||
|
"source": "https://github.com/MarkBaker/PHPMatrix/tree/3.0.1"
|
||||||
|
},
|
||||||
|
"time": "2022-12-02T22:17:43+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "mercadopago/dx-php",
|
"name": "mercadopago/dx-php",
|
||||||
"version": "3.10.0",
|
"version": "3.10.0",
|
||||||
@@ -5115,6 +5376,112 @@
|
|||||||
},
|
},
|
||||||
"time": "2024-10-02T11:20:13+00:00"
|
"time": "2024-10-02T11:20:13+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "phpoffice/phpspreadsheet",
|
||||||
|
"version": "2.4.6",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
|
||||||
|
"reference": "0bbef382b7d9c1dbda10c8113d564ff9159a7e79"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/0bbef382b7d9c1dbda10c8113d564ff9159a7e79",
|
||||||
|
"reference": "0bbef382b7d9c1dbda10c8113d564ff9159a7e79",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"composer/pcre": "^1 || ^2 || ^3",
|
||||||
|
"ext-ctype": "*",
|
||||||
|
"ext-dom": "*",
|
||||||
|
"ext-fileinfo": "*",
|
||||||
|
"ext-gd": "*",
|
||||||
|
"ext-iconv": "*",
|
||||||
|
"ext-libxml": "*",
|
||||||
|
"ext-mbstring": "*",
|
||||||
|
"ext-simplexml": "*",
|
||||||
|
"ext-xml": "*",
|
||||||
|
"ext-xmlreader": "*",
|
||||||
|
"ext-xmlwriter": "*",
|
||||||
|
"ext-zip": "*",
|
||||||
|
"ext-zlib": "*",
|
||||||
|
"maennchen/zipstream-php": "^2.1 || ^3.0",
|
||||||
|
"markbaker/complex": "^3.0",
|
||||||
|
"markbaker/matrix": "^3.0",
|
||||||
|
"php": ">=8.1.0 <8.6.0",
|
||||||
|
"psr/simple-cache": "^1.0 || ^2.0 || ^3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"dealerdirect/phpcodesniffer-composer-installer": "dev-main",
|
||||||
|
"dompdf/dompdf": "^2.0 || ^3.0",
|
||||||
|
"friendsofphp/php-cs-fixer": "^3.2",
|
||||||
|
"mitoteam/jpgraph": "^10.5",
|
||||||
|
"mpdf/mpdf": "^8.1.1",
|
||||||
|
"phpcompatibility/php-compatibility": "^9.3",
|
||||||
|
"phpstan/phpstan": "^1.1",
|
||||||
|
"phpstan/phpstan-phpunit": "^1.0",
|
||||||
|
"phpunit/phpunit": "^9.6 || ^10.5",
|
||||||
|
"squizlabs/php_codesniffer": "^3.7",
|
||||||
|
"tecnickcom/tcpdf": "^6.5"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"dompdf/dompdf": "Option for rendering PDF with PDF Writer",
|
||||||
|
"ext-intl": "PHP Internationalization Functions, required for NumberFormatter Wizard",
|
||||||
|
"mitoteam/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers",
|
||||||
|
"mpdf/mpdf": "Option for rendering PDF with PDF Writer",
|
||||||
|
"tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Maarten Balliauw",
|
||||||
|
"homepage": "https://blog.maartenballiauw.be"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Mark Baker",
|
||||||
|
"homepage": "https://markbakeruk.net"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Franck Lefevre",
|
||||||
|
"homepage": "https://rootslabs.net"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Erik Tilt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Adrien Crivelli"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Owen Leibman"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
|
||||||
|
"homepage": "https://github.com/PHPOffice/PhpSpreadsheet",
|
||||||
|
"keywords": [
|
||||||
|
"OpenXML",
|
||||||
|
"excel",
|
||||||
|
"gnumeric",
|
||||||
|
"ods",
|
||||||
|
"php",
|
||||||
|
"spreadsheet",
|
||||||
|
"xls",
|
||||||
|
"xlsx"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues",
|
||||||
|
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/2.4.6"
|
||||||
|
},
|
||||||
|
"time": "2026-06-07T02:31:12+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "phpoption/phpoption",
|
"name": "phpoption/phpoption",
|
||||||
"version": "1.9.5",
|
"version": "1.9.5",
|
||||||
@@ -6365,6 +6732,68 @@
|
|||||||
],
|
],
|
||||||
"time": "2026-02-22T09:05:56+00:00"
|
"time": "2026-02-22T09:05:56+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "stripe/stripe-php",
|
||||||
|
"version": "v20.2.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/stripe/stripe-php.git",
|
||||||
|
"reference": "c628cfa0b3de4ef5110b2c2bfbf881a33a52fdd5"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/c628cfa0b3de4ef5110b2c2bfbf881a33a52fdd5",
|
||||||
|
"reference": "c628cfa0b3de4ef5110b2c2bfbf881a33a52fdd5",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-curl": "*",
|
||||||
|
"ext-json": "*",
|
||||||
|
"ext-mbstring": "*",
|
||||||
|
"php": ">=7.2.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"friendsofphp/php-cs-fixer": "3.94.0",
|
||||||
|
"phpstan/phpstan": "^1.2",
|
||||||
|
"phpunit/phpunit": "^8.0 || ^9.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.0-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"lib/version_check.php"
|
||||||
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"Stripe\\": "lib/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Stripe and contributors",
|
||||||
|
"homepage": "https://github.com/stripe/stripe-php/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Stripe PHP Library",
|
||||||
|
"homepage": "https://stripe.com/",
|
||||||
|
"keywords": [
|
||||||
|
"api",
|
||||||
|
"payment processing",
|
||||||
|
"stripe"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/stripe/stripe-php/issues",
|
||||||
|
"source": "https://github.com/stripe/stripe-php/tree/v20.2.1"
|
||||||
|
},
|
||||||
|
"time": "2026-06-12T22:41:56+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/cache",
|
"name": "symfony/cache",
|
||||||
"version": "v8.1.0",
|
"version": "v8.1.0",
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class CreateUsersTable extends Migration
|
|||||||
$table->string('profile_photo')->nullable();
|
$table->string('profile_photo')->nullable();
|
||||||
$table->BigInteger('role_id')->unsigned()->nullable();
|
$table->BigInteger('role_id')->unsigned()->nullable();
|
||||||
$table->string('social_id')->unique()->nullable();
|
$table->string('social_id')->unique()->nullable();
|
||||||
$table->string('openpay_id')->unique()->nullable();
|
$table->string('stripe_customer_id')->unique()->nullable();
|
||||||
$table->string('phone')->unique()->nullable();
|
$table->string('phone')->unique()->nullable();
|
||||||
$table->timestamp('phone_verified_at')->nullable();
|
$table->timestamp('phone_verified_at')->nullable();
|
||||||
$table->string('password')->nullable();
|
$table->string('password')->nullable();
|
||||||
|
|||||||
@@ -16,7 +16,11 @@ class CreateCardsTable extends Migration
|
|||||||
Schema::create('cards', function (Blueprint $table) {
|
Schema::create('cards', function (Blueprint $table) {
|
||||||
$table->bigIncrements('id');
|
$table->bigIncrements('id');
|
||||||
$table->unsignedBigInteger('user_id');
|
$table->unsignedBigInteger('user_id');
|
||||||
$table->string('token');
|
$table->string('stripe_pm_id')->unique();
|
||||||
|
$table->string('brand');
|
||||||
|
$table->string('last4', 4);
|
||||||
|
$table->unsignedTinyInteger('exp_month');
|
||||||
|
$table->unsignedSmallInteger('exp_year');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -36,7 +36,9 @@ class CreateFinishedcontractsTable extends Migration
|
|||||||
$table->unsignedBigInteger('parent_contract_id')->nullable();
|
$table->unsignedBigInteger('parent_contract_id')->nullable();
|
||||||
$table->Integer('score')->nullable();
|
$table->Integer('score')->nullable();
|
||||||
$table->timestamp('scored_at')->nullable();
|
$table->timestamp('scored_at')->nullable();
|
||||||
|
$table->unsignedBigInteger('technical_id')->nullable();
|
||||||
$table->boolean('paid')->default(false);
|
$table->boolean('paid')->default(false);
|
||||||
|
$table->timestamp('paid_at')->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('set null');
|
$table->foreign('user_id')->references('id')->on('users')->onDelete('set null');
|
||||||
$table->foreign('supplier_id')->references('id')->on('suppliers')->onDelete('set null');
|
$table->foreign('supplier_id')->references('id')->on('suppliers')->onDelete('set null');
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ class CreateCurrentContractsTable extends Migration
|
|||||||
$table->unsignedBigInteger('status_id')->nullable()->default('1');
|
$table->unsignedBigInteger('status_id')->nullable()->default('1');
|
||||||
$table->BigInteger('code')->nullable();
|
$table->BigInteger('code')->nullable();
|
||||||
$table->unsignedBigInteger('parent_contract_id')->nullable();
|
$table->unsignedBigInteger('parent_contract_id')->nullable();
|
||||||
|
$table->unsignedBigInteger('technical_id')->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('set null');
|
$table->foreign('user_id')->references('id')->on('users')->onDelete('set null');
|
||||||
$table->foreign('supplier_id')->references('id')->on('suppliers')->onDelete('set null');
|
$table->foreign('supplier_id')->references('id')->on('suppliers')->onDelete('set null');
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreatePaymentBatchesTable extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('payment_batches', function (Blueprint $table) {
|
||||||
|
$table->bigIncrements('id');
|
||||||
|
$table->string('file_name');
|
||||||
|
$table->string('file_path');
|
||||||
|
$table->unsignedBigInteger('generated_by')->nullable();
|
||||||
|
$table->date('date_from')->nullable();
|
||||||
|
$table->date('date_to')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
$table->foreign('generated_by')->references('id')->on('users')->onDelete('set null');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('payment_batches');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreateTechniciansTable extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('technicians', function (Blueprint $table) {
|
||||||
|
$table->bigIncrements('id');
|
||||||
|
$table->unsignedBigInteger('user_id');
|
||||||
|
$table->unsignedBigInteger('supplier_id');
|
||||||
|
$table->timestamps();
|
||||||
|
$table->unique(['user_id', 'supplier_id']);
|
||||||
|
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||||
|
$table->foreign('supplier_id')->references('id')->on('suppliers')->onDelete('cascade');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('finished_contracts', function (Blueprint $table) {
|
||||||
|
$table->foreign('technical_id')->references('id')->on('technicians')->onDelete('set null');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('current_contracts', function (Blueprint $table) {
|
||||||
|
$table->foreign('technical_id')->references('id')->on('technicians')->onDelete('set null');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('finished_contracts', function (Blueprint $table) {
|
||||||
|
$table->dropForeign(['technical_id']);
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('current_contracts', function (Blueprint $table) {
|
||||||
|
$table->dropForeign(['technical_id']);
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::dropIfExists('technicians');
|
||||||
|
}
|
||||||
|
}
|
||||||
27
database/migrations/2026_06_22_000001_drop_cards_table.php
Normal file
27
database/migrations/2026_06_22_000001_drop_cards_table.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('cards');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::create('cards', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->unsignedBigInteger('user_id');
|
||||||
|
$table->string('stripe_pm_id')->nullable();
|
||||||
|
$table->string('brand')->nullable();
|
||||||
|
$table->string('last4')->nullable();
|
||||||
|
$table->unsignedTinyInteger('exp_month')->nullable();
|
||||||
|
$table->unsignedSmallInteger('exp_year')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -44,6 +44,10 @@ class DatabaseSeeder extends Seeder
|
|||||||
'name' => 'SuperAdmin',
|
'name' => 'SuperAdmin',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
DB::table('roles')->insert([
|
||||||
|
'name' => 'Técnico',
|
||||||
|
]);
|
||||||
|
|
||||||
DB::table('users')->insert([
|
DB::table('users')->insert([
|
||||||
'name' => 'Admin',
|
'name' => 'Admin',
|
||||||
'email' => 'torch2196@gmail.com',
|
'email' => 'torch2196@gmail.com',
|
||||||
@@ -102,6 +106,10 @@ class DatabaseSeeder extends Seeder
|
|||||||
'en_name' => 'canceled',
|
'en_name' => 'canceled',
|
||||||
]);
|
]);
|
||||||
DB::table('statuses')->insert([
|
DB::table('statuses')->insert([
|
||||||
|
'name' => 'ausente',
|
||||||
|
'en_name' => 'absent',
|
||||||
|
]);
|
||||||
|
DB::table('statuses')->insert([
|
||||||
'name' => 'fuera de casa',
|
'name' => 'fuera de casa',
|
||||||
'en_name' => 'no home',
|
'en_name' => 'no home',
|
||||||
]);
|
]);
|
||||||
@@ -110,9 +118,14 @@ class DatabaseSeeder extends Seeder
|
|||||||
'en_name' => 'reported',
|
'en_name' => 'reported',
|
||||||
]);
|
]);
|
||||||
DB::table('statuses')->insert([
|
DB::table('statuses')->insert([
|
||||||
'name' => 'ausente',
|
'name' => 'devuelto al cliente',
|
||||||
'en_name' => 'absent',
|
'en_name' => 'returned to client',
|
||||||
]);
|
]);
|
||||||
|
DB::table('statuses')->insert([
|
||||||
|
'name' => 'disptuta terminada',
|
||||||
|
'en_name' => 'complain ended',
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
$this->call([
|
$this->call([
|
||||||
BanksSeeder::class,
|
BanksSeeder::class,
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
@extends('layouts.app')
|
|
||||||
|
|
||||||
@section('content')
|
|
||||||
<div class="container">
|
|
||||||
<div class="col-md-8 offset-md-2">
|
|
||||||
<h1>{{isset($bank)?'Editar':'Nuevo'}} Banco</h1>
|
|
||||||
<hr>
|
|
||||||
@if(isset($bank))
|
|
||||||
{!! Form::model($bank,['method'=>'put','id'=>'frm']) !!}
|
|
||||||
@else
|
|
||||||
{!! Form::open(['id'=>'frm']) !!}
|
|
||||||
@endif
|
|
||||||
<div class="form-group row required">
|
|
||||||
{!! Form::label("code","Código",["class"=>"col-form-label col-md-3 col-lg-2"]) !!}
|
|
||||||
<div class="col-md-8">
|
|
||||||
{!! Form::number("code",null,["class"=>"form-control".($errors->has('code')?" is-invalid":""),"autofocus",'placeholder'=>'Código del banco']) !!}
|
|
||||||
<span id="error-name" class="invalid-feedback"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group row required">
|
|
||||||
{!! Form::label("name","Banco",["class"=>"col-form-label col-md-3 col-lg-2"]) !!}
|
|
||||||
<div class="col-md-8">
|
|
||||||
{!! Form::text("name",null,["class"=>"form-control".($errors->has('name')?" is-invalid":""),"autofocus",'placeholder'=>'Nombre del banco']) !!}
|
|
||||||
<span id="error-name" class="invalid-feedback"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@if ($errors->any())
|
|
||||||
<div class="alert alert-danger">
|
|
||||||
<ul>
|
|
||||||
@foreach ($errors->all() as $error)
|
|
||||||
<li>{{ $error }}</li>
|
|
||||||
@endforeach
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
<div class="form-group row">
|
|
||||||
<div class="col-md-3 col-lg-2"></div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<a href="{{url('banks')}}" class="btn btn-danger btn-xs">
|
|
||||||
Atrás</a>
|
|
||||||
{!! Form::button("Guardar",["type" => "submit","class"=>"btn btn-primary btn-xs"])!!}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{!! Form::close() !!}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endsection
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
|
|
||||||
@if (Auth::user()->role_id >= 5)
|
|
||||||
<div class="container-fluid" style="height:100%">
|
|
||||||
<div>
|
|
||||||
@else
|
|
||||||
<div class="container" style="margin:0 1em">
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-7">
|
|
||||||
<h3>Tarjetas</h3>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-5">
|
|
||||||
<div class="pull-right">
|
|
||||||
{!! Form::open(['method'=>'GET','url'=>'cards','class'=>'navbar-form navbar-left','role'=>'search']) !!}
|
|
||||||
<div class="input-group">
|
|
||||||
<input class="form-control" id="search"
|
|
||||||
value="{{ request()->session()->get('search') }}"
|
|
||||||
placeholder="Buscar" name="search"
|
|
||||||
type="text" id="search"/>
|
|
||||||
<div class="input-group-btn">
|
|
||||||
<button type="submit" class="btn btn-primary">
|
|
||||||
<i class="fa fa-search" aria-hidden="true"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{!! Form::close() !!}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th style="vertical-align: middle"><a href="{{url('cards?field=id&sort='.(request()->session()->get('sort')=='asc'?'desc':'asc'))}}">ID</a></th>
|
|
||||||
{{request()->session()->get('field')=='id'?(request()->session()->get('sort')=='asc'?'':''):''}}
|
|
||||||
|
|
||||||
<th style="vertical-align: middle"><a href="{{url('cards?field=user_id&sort='.(request()->session()->get('sort')=='asc'?'desc':'asc'))}}">Usuario</a></th>
|
|
||||||
{{request()->session()->get('field')=='user_id'?(request()->session()->get('sort')=='asc'?'':''):''}}
|
|
||||||
|
|
||||||
<th style="vertical-align: middle"><a href="{{url('cards?field=user_id&sort='.(request()->session()->get('sort')=='asc'?'desc':'asc'))}}">Openpay ID</a></th>
|
|
||||||
{{request()->session()->get('field')=='user_id'?(request()->session()->get('sort')=='asc'?'':''):''}}
|
|
||||||
|
|
||||||
<th style="vertical-align: middle"><a href="{{url('cards?field=token&sort='.(request()->session()->get('sort')=='asc'?'desc':'asc'))}}">Token</a></th>
|
|
||||||
{{request()->session()->get('field')=='token'?(request()->session()->get('sort')=='asc'?'':''):''}}
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@php
|
|
||||||
$i=1;
|
|
||||||
@endphp
|
|
||||||
@foreach ($cards as $card)
|
|
||||||
<tr>
|
|
||||||
<th>{{ $card->id }}</th>
|
|
||||||
<th>{{ $card->user->name }}</th>
|
|
||||||
<td>{{ $card->user->openpay_id }}</td>
|
|
||||||
<td>{{ $card->token}}</td>
|
|
||||||
<td>
|
|
||||||
<input type="hidden" name="_method" value="delete"/>
|
|
||||||
<a class="btn btn-danger btn-xs" title="Delete"
|
|
||||||
href="javascript:if(confirm('¿Estás seguro de que quieres eliminar esta tarjeta?')) javascript:if(confirm('Usualmente no se deben eliminar tarjetas, ¿Estás seguro?')) ajaxDelete('{{url('cards/delete/'.$card->id)}}','{{csrf_token()}}')">
|
|
||||||
<i class="fa fa-trash"></i>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{{ $cards->links() }}
|
|
||||||
</div>
|
|
||||||
@@ -111,7 +111,7 @@
|
|||||||
@else
|
@else
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre style="padding-left:55px;">
|
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre style="padding-left:55px;">
|
||||||
<img src="{{ isset(Auth::user()->profile_photo) ? asset('img/users/' . Auth::user()->id . '/' . Auth::user()->profile_photo) : asset('img/users/default.png') }}" style="width:48px; height:auto; position:absolute; top:-5px; left:-1px; border-radius:50%"/>
|
<img src="{{ Auth::user()->profile_photo ?? asset('img/users/default.png') }}" style="width:48px; height:auto; position:absolute; top:-5px; left:-1px; border-radius:50%"/>
|
||||||
{{ Auth::user()->name }} <span class="caret"></span>
|
{{ Auth::user()->name }} <span class="caret"></span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|||||||
2
resources/views/cards/ajax.blade.php → resources/views/payment-batches/ajax.blade.php
Executable file → Normal file
2
resources/views/cards/ajax.blade.php → resources/views/payment-batches/ajax.blade.php
Executable file → Normal file
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div id="content">
|
<div id="content">
|
||||||
@include('cards.index')
|
@include('payment-batches.index')
|
||||||
</div>
|
</div>
|
||||||
<div class="loading">
|
<div class="loading">
|
||||||
<i class="fa fa-refresh fa-spin fa-2x fa-tw"></i>
|
<i class="fa fa-refresh fa-spin fa-2x fa-tw"></i>
|
||||||
56
resources/views/payment-batches/index.blade.php
Normal file
56
resources/views/payment-batches/index.blade.php
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col">
|
||||||
|
<h3>Pagos Realizados</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if(session('error'))
|
||||||
|
<div class="alert alert-danger">{{ session('error') }}</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
|
<th>Archivo</th>
|
||||||
|
<th>Generado por</th>
|
||||||
|
<th>Fecha de generación</th>
|
||||||
|
<th>Rango de fechas</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@forelse($batches as $batch)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $batch->id }}</td>
|
||||||
|
<td>{{ $batch->file_name }}</td>
|
||||||
|
<td>{{ optional($batch->user)->name ?? '—' }}</td>
|
||||||
|
<td>{{ $batch->created_at->format('d/m/Y H:i') }}</td>
|
||||||
|
<td>
|
||||||
|
@if($batch->date_from || $batch->date_to)
|
||||||
|
{{ $batch->date_from ? \Carbon\Carbon::parse($batch->date_from)->format('d/m/Y') : '—' }}
|
||||||
|
al
|
||||||
|
{{ $batch->date_to ? \Carbon\Carbon::parse($batch->date_to)->format('d/m/Y') : '—' }}
|
||||||
|
@else
|
||||||
|
Todos los registros
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{ url('payment-batches/' . $batch->id . '/download') }}"
|
||||||
|
class="btn btn-sm btn-outline-primary">
|
||||||
|
<i class="fa fa-download"></i> Descargar
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@empty
|
||||||
|
<tr>
|
||||||
|
<td colspan="6" class="text-center text-muted">Sin pagos realizados aún.</td>
|
||||||
|
</tr>
|
||||||
|
@endforelse
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
{{ $batches->links() }}
|
||||||
|
</div>
|
||||||
@@ -13,27 +13,53 @@
|
|||||||
$sortUrl = fn($f) => url('payments') . '?' . http_build_query(array_filter(['date_from' => $dateFrom, 'date_to' => $dateTo, 'field' => $f, 'sort' => $currentField === $f ? $nextSort : 'desc']));
|
$sortUrl = fn($f) => url('payments') . '?' . http_build_query(array_filter(['date_from' => $dateFrom, 'date_to' => $dateTo, 'field' => $f, 'sort' => $currentField === $f ? $nextSort : 'desc']));
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<div class="row">
|
@if(session('warning'))
|
||||||
<div class="col-sm-5">
|
<div class="alert alert-warning">{{ session('warning') }}</div>
|
||||||
<h3>Pagos a Proveedores</h3>
|
@endif
|
||||||
|
|
||||||
|
<div class="row align-items-center mb-2">
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<h3 class="mb-0">Pagos a Proveedores</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-7">
|
<div class="col-sm-8">
|
||||||
<div class="pull-right">
|
<div class="d-flex justify-content-end align-items-center flex-wrap" style="gap:.5rem">
|
||||||
{!! Form::open(['method' => 'GET', 'url' => 'payments', 'class' => 'form-inline', 'role' => 'search']) !!}
|
{!! Form::open(['method' => 'GET', 'url' => 'payments', 'class' => 'd-flex align-items-center', 'style' => 'gap:.4rem']) !!}
|
||||||
<label class="mr-2 mb-0">Filtrar</label>
|
<label class="mb-0 mr-1">Filtrar</label>
|
||||||
<input type="date" class="form-control mr-1" name="date_from" value="{{ $dateFrom }}">
|
<input type="date" class="form-control form-control-sm" name="date_from" value="{{ $dateFrom }}">
|
||||||
<input type="date" class="form-control mr-1" name="date_to" value="{{ $dateTo }}">
|
<input type="date" class="form-control form-control-sm" name="date_to" value="{{ $dateTo }}">
|
||||||
<button type="submit" class="btn btn-primary mr-1">
|
<button type="submit" class="btn btn-sm btn-primary">
|
||||||
<i class="fa fa-filter" aria-hidden="true"></i>
|
<i class="fa fa-filter"></i>
|
||||||
</button>
|
</button>
|
||||||
<a href="{{ url('payments') }}" class="btn btn-default">
|
<a href="{{ url('payments') }}" class="btn btn-sm btn-default">
|
||||||
<i class="fa fa-times" aria-hidden="true"></i>
|
<i class="fa fa-times"></i>
|
||||||
</a>
|
</a>
|
||||||
{!! Form::close() !!}
|
{!! Form::close() !!}
|
||||||
|
|
||||||
|
<form method="POST" action="{{ url('payments/generate') }}" id="generateForm">
|
||||||
|
@csrf
|
||||||
|
<input type="hidden" name="date_from" value="{{ $dateFrom }}">
|
||||||
|
<input type="hidden" name="date_to" value="{{ $dateTo }}">
|
||||||
|
<button type="button" class="btn btn-sm btn-success" onclick="confirmGenerate()">
|
||||||
|
<i class="fa fa-file-excel-o"></i> Generar Pagos
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function confirmGenerate() {
|
||||||
|
var total = {{ $payments->total() }};
|
||||||
|
if (total === 0) {
|
||||||
|
alert('No hay contratos pendientes de pago.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (confirm('Se generará un archivo Excel con ' + total + ' proveedor(es) y se marcarán sus contratos como pagados. ¿Continuar?')) {
|
||||||
|
document.getElementById('generateForm').submit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -21,11 +21,13 @@
|
|||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
.chat-info .btn-verdict {
|
.chat-info .btn-actions {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 1rem;
|
right: 1rem;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
|
display: flex;
|
||||||
|
gap: 0.4rem;
|
||||||
}
|
}
|
||||||
.chat-info span { color: #495057; }
|
.chat-info span { color: #495057; }
|
||||||
.chat-info strong { color: #212529; }
|
.chat-info strong { color: #212529; }
|
||||||
@@ -135,10 +137,16 @@
|
|||||||
@if($report->veredict)
|
@if($report->veredict)
|
||||||
<span>Veredicto: <strong>{{ $report->veredict }}</strong></span>
|
<span>Veredicto: <strong>{{ $report->veredict }}</strong></span>
|
||||||
@endif
|
@endif
|
||||||
<a class="btn btn-secondary btn-xs btn-verdict" title="Veredict"
|
<div class="btn-actions">
|
||||||
href="{{ url('reports/veredict/' . $report->id) }}">
|
<button type="button" class="btn btn-info btn-xs" title="Ver detalles"
|
||||||
<i class="fa fa-gavel"></i>
|
data-toggle="modal" data-target="#modalDetalles">
|
||||||
</a>
|
<i class="fa fa-info-circle"></i>
|
||||||
|
</button>
|
||||||
|
<a class="btn btn-secondary btn-xs" title="Veredicto"
|
||||||
|
href="{{ url('reports/veredict/' . $report->id) }}">
|
||||||
|
<i class="fa fa-gavel"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Leyenda --}}
|
{{-- Leyenda --}}
|
||||||
@@ -196,4 +204,76 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{-- Modal fuera del chat-wrapper para evitar stacking context del flex --}}
|
||||||
|
<div class="modal fade" id="modalDetalles" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">Detalles del Contrato #{{ $contract->id }}</h5>
|
||||||
|
<button type="button" class="close" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
|
||||||
|
<h6 class="font-weight-bold mb-2">Información del contrato</h6>
|
||||||
|
<table class="table table-sm table-borderless mb-4">
|
||||||
|
<tr><th style="width:35%">Cliente</th><td>{{ $contract->user->name ?? '—' }}</td></tr>
|
||||||
|
<tr><th>Proveedor</th><td>{{ $contract->suppliers->company_name ?? '—' }}</td></tr>
|
||||||
|
<tr><th>Categoría</th><td>{{ $contract->categories->name ?? '—' }}</td></tr>
|
||||||
|
<tr><th>Dirección</th><td>{{ $contract->address }}</td></tr>
|
||||||
|
<tr><th>Cita</th><td>{{ $contract->appointment }}</td></tr>
|
||||||
|
<tr><th>Monto</th><td>${{ $contract->amount }}</td></tr>
|
||||||
|
<tr><th>Estado</th><td>{{ $contract->status->name ?? $contract->status_id }}</td></tr>
|
||||||
|
<tr><th>Transaction ID</th><td><code>{{ $contract->transaction_id ?? '—' }}</code></td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
@if($nohome)
|
||||||
|
<hr>
|
||||||
|
<h6 class="font-weight-bold mb-2">Evidencia del proveedor (No Home)</h6>
|
||||||
|
<table class="table table-sm table-borderless mb-3">
|
||||||
|
<tr>
|
||||||
|
<th style="width:35%">Descripción</th>
|
||||||
|
<td>{{ $nohome->house_description ?? '—' }}</td>
|
||||||
|
</tr>
|
||||||
|
@if($nohome->location)
|
||||||
|
<tr>
|
||||||
|
<th>Coordenadas GPS</th>
|
||||||
|
<td>
|
||||||
|
{{ $nohome->location->getLatitude() }}, {{ $nohome->location->getLongitude() }}
|
||||||
|
<a href="https://www.google.com/maps?q={{ $nohome->location->getLatitude() }},{{ $nohome->location->getLongitude() }}"
|
||||||
|
target="_blank" class="btn btn-xs btn-outline-secondary ml-2">
|
||||||
|
<i class="fa fa-map-marker"></i> Ver en mapa
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
</table>
|
||||||
|
@if($nohome->house_photo)
|
||||||
|
<img src="{{ $nohome->house_photo }}" alt="Foto del domicilio"
|
||||||
|
class="img-fluid rounded" style="max-height:400px;">
|
||||||
|
@endif
|
||||||
|
@else
|
||||||
|
<hr>
|
||||||
|
<p class="text-muted mb-0"><em>El proveedor no registró evidencia de visita.</em></p>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cerrar</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('js')
|
||||||
|
<script>
|
||||||
|
// main-content tiene overflow-y:auto que crea stacking context
|
||||||
|
// Mover el modal a body para que Bootstrap pueda posicionarlo correctamente
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('#modalDetalles').appendTo('body');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -17,6 +17,20 @@
|
|||||||
<span id="error-name" class="invalid-feedback"></span>
|
<span id="error-name" class="invalid-feedback"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
{!! Form::label("contract_status","Acción sobre el contrato",["class"=>"col-form-label col-md-3 col-lg-2"]) !!}
|
||||||
|
<div class="col-md-8">
|
||||||
|
{!! Form::select("contract_status", [
|
||||||
|
'' => '— Sin cambio de estatus —',
|
||||||
|
'8' => 'Devuelto al cliente (reembolso Stripe)',
|
||||||
|
'9' => 'Disputa terminada (pagar al proveedor)',
|
||||||
|
], null, ["class"=>"form-control"]) !!}
|
||||||
|
<small class="text-muted">
|
||||||
|
"Devuelto al cliente" emite el reembolso en Stripe automáticamente.
|
||||||
|
"Disputa terminada" aparece en la sección de Pagos.
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@if ($errors->any())
|
@if ($errors->any())
|
||||||
<div class="alert alert-danger">
|
<div class="alert alert-danger">
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
@@ -15,12 +15,12 @@
|
|||||||
<a href="/banks" class="sidebar-link {{ Request::is('banks*') ? 'active' : '' }}">
|
<a href="/banks" class="sidebar-link {{ Request::is('banks*') ? 'active' : '' }}">
|
||||||
<i class="fa fa-university"></i> Bancos
|
<i class="fa fa-university"></i> Bancos
|
||||||
</a>
|
</a>
|
||||||
<a href="/cards" class="sidebar-link {{ Request::is('cards*') ? 'active' : '' }}">
|
<a href="/payments" class="sidebar-link {{ Request::is('payments') ? 'active' : '' }}">
|
||||||
<i class="fa fa-credit-card"></i> Tarjetas
|
|
||||||
</a>
|
|
||||||
<a href="/payments" class="sidebar-link {{ Request::is('payments*') ? 'active' : '' }}">
|
|
||||||
<i class="fa fa-money"></i> Pagos
|
<i class="fa fa-money"></i> Pagos
|
||||||
</a>
|
</a>
|
||||||
|
<a href="/payment-batches" class="sidebar-link {{ Request::is('payment-batches*') ? 'active' : '' }}">
|
||||||
|
<i class="fa fa-history"></i> Pagos Realizados
|
||||||
|
</a>
|
||||||
<a href="/postulations" class="sidebar-link {{ Request::is('postulations*') ? 'active' : '' }}">
|
<a href="/postulations" class="sidebar-link {{ Request::is('postulations*') ? 'active' : '' }}">
|
||||||
<i class="fa fa-file-text"></i> Postulaciones
|
<i class="fa fa-file-text"></i> Postulaciones
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -28,7 +28,8 @@
|
|||||||
'4' => 'Facturación',
|
'4' => 'Facturación',
|
||||||
'5' => 'Moderador',
|
'5' => 'Moderador',
|
||||||
'6' => 'Administrador',
|
'6' => 'Administrador',
|
||||||
'7' => 'SuperAdmin'
|
'7' => 'SuperAdmin',
|
||||||
|
'8' => 'Técnico'
|
||||||
), $user->roles->id) !!}
|
), $user->roles->id) !!}
|
||||||
<span id="error-name" class="invalid-feedback"></span>
|
<span id="error-name" class="invalid-feedback"></span>
|
||||||
</div>
|
</div>
|
||||||
@@ -42,13 +43,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group row required">
|
|
||||||
{!! Form::label("openpay_id","Openpay ID",["class"=>"col-form-label col-md-3 col-lg-2"]) !!}
|
|
||||||
<div class="col-md-8">
|
|
||||||
{!! Form::text("openpay_id",null,["class"=>"form-control".($errors->has('openpay_id')?" is-invalid":""),'placeholder'=>'Openpay ID']) !!}
|
|
||||||
<span id="error-openpay_id" class="invalid-feedback"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@if ($errors->any())
|
@if ($errors->any())
|
||||||
<div class="alert alert-danger">
|
<div class="alert alert-danger">
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
@@ -35,6 +35,8 @@
|
|||||||
<th style="vertical-align: middle"><a href="{{url('users?field=id&sort='.(request()->session()->get('sort')=='asc'?'desc':'asc'))}}">ID</a></th>
|
<th style="vertical-align: middle"><a href="{{url('users?field=id&sort='.(request()->session()->get('sort')=='asc'?'desc':'asc'))}}">ID</a></th>
|
||||||
{{request()->session()->get('field')=='id'?(request()->session()->get('sort')=='asc'?'':''):''}}
|
{{request()->session()->get('field')=='id'?(request()->session()->get('sort')=='asc'?'':''):''}}
|
||||||
|
|
||||||
|
<th style="vertical-align: middle">Foto</th>
|
||||||
|
|
||||||
<th style="vertical-align: middle"><a href="{{url('users?field=name&sort='.(request()->session()->get('sort')=='asc'?'desc':'asc'))}}">Nombre</a></th>
|
<th style="vertical-align: middle"><a href="{{url('users?field=name&sort='.(request()->session()->get('sort')=='asc'?'desc':'asc'))}}">Nombre</a></th>
|
||||||
{{request()->session()->get('field')=='name'?(request()->session()->get('sort')=='asc'?'':''):''}}
|
{{request()->session()->get('field')=='name'?(request()->session()->get('sort')=='asc'?'':''):''}}
|
||||||
|
|
||||||
@@ -70,6 +72,13 @@
|
|||||||
@foreach ($users as $user)
|
@foreach ($users as $user)
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ $user->id }}</th>
|
<th>{{ $user->id }}</th>
|
||||||
|
<td>
|
||||||
|
@if($user->profile_photo)
|
||||||
|
<img src="{{ $user->profile_photo }}" style="width:36px;height:36px;object-fit:cover;border-radius:50%;">
|
||||||
|
@else
|
||||||
|
<span class="text-muted">—</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
<td>{{ $user->name }}</td>
|
<td>{{ $user->name }}</td>
|
||||||
<td >{{ $user->email }}</td>
|
<td >{{ $user->email }}</td>
|
||||||
<td >{{ $user->roles->name }}</td>
|
<td >{{ $user->roles->name }}</td>
|
||||||
|
|||||||
@@ -37,9 +37,7 @@ Route::group([
|
|||||||
'prefix' => 'payments',
|
'prefix' => 'payments',
|
||||||
'middleware' => 'auth:api'
|
'middleware' => 'auth:api'
|
||||||
], function() {
|
], function() {
|
||||||
Route::post('addcard', 'PaymentController@addcard');
|
Route::post('intent', 'PaymentController@intent');
|
||||||
Route::post('deletecard', 'PaymentController@deletecard');
|
|
||||||
Route::get('getcards', 'PaymentController@getcards');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::group([
|
Route::group([
|
||||||
@@ -80,6 +78,13 @@ Route::group([
|
|||||||
Route::get('postulations/reports', 'ReportController@getsupplierreports');
|
Route::get('postulations/reports', 'ReportController@getsupplierreports');
|
||||||
Route::get('get-postulants', 'PostulationController@getpostulants');
|
Route::get('get-postulants', 'PostulationController@getpostulants');
|
||||||
Route::post('postulate', 'PostulationController@postulate');
|
Route::post('postulate', 'PostulationController@postulate');
|
||||||
|
|
||||||
|
// Técnicos
|
||||||
|
Route::get('technicians', 'TechnicianController@index');
|
||||||
|
Route::get('technicians/find', 'TechnicianController@find');
|
||||||
|
Route::post('technicians/add', 'TechnicianController@store');
|
||||||
|
Route::delete('technicians/{id}', 'TechnicianController@destroy');
|
||||||
|
Route::post('contracts/assign-technician', 'TechnicianController@assign');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::get('/parameters', 'IChambaParameterController@parameters');
|
Route::get('/parameters', 'IChambaParameterController@parameters');
|
||||||
|
|||||||
@@ -56,14 +56,6 @@ Route::group([
|
|||||||
Route::match(['get', 'put'], 'update/{id}', 'BanksController@update')->middleware('rolecheck:6');
|
Route::match(['get', 'put'], 'update/{id}', 'BanksController@update')->middleware('rolecheck:6');
|
||||||
Route::match(['get', 'post'], 'create', 'BanksController@create')->middleware('rolecheck:6');
|
Route::match(['get', 'post'], 'create', 'BanksController@create')->middleware('rolecheck:6');
|
||||||
});
|
});
|
||||||
Route::group([
|
|
||||||
'prefix' => 'cards'
|
|
||||||
], function() {
|
|
||||||
Route::get('/', 'PaymentController@cardsindex')->middleware('rolecheck:6');
|
|
||||||
Route::delete('delete/{id}', 'PaymentController@destroy')->middleware('superadmin');
|
|
||||||
//Route::match(['get', 'put'], 'update/{id}', 'PaymentController@update')->middleware('rolecheck:6');
|
|
||||||
//Route::match(['get', 'post'], 'create', 'PaymentController@create')->middleware('rolecheck:6');
|
|
||||||
});
|
|
||||||
Route::group([
|
Route::group([
|
||||||
'prefix' => 'coupons'
|
'prefix' => 'coupons'
|
||||||
], function() {
|
], function() {
|
||||||
@@ -92,10 +84,17 @@ Route::group([
|
|||||||
'prefix' => 'payments'
|
'prefix' => 'payments'
|
||||||
], function() {
|
], function() {
|
||||||
Route::get('/', 'PaymentController@index')->middleware('rolecheck:6');
|
Route::get('/', 'PaymentController@index')->middleware('rolecheck:6');
|
||||||
|
Route::post('generate', 'PaymentController@generate')->middleware('rolecheck:6');
|
||||||
Route::delete('delete/{id}', 'StatusController@destroy')->middleware('superadmin');
|
Route::delete('delete/{id}', 'StatusController@destroy')->middleware('superadmin');
|
||||||
Route::match(['get', 'put'], 'update/{id}', 'StatusController@update')->middleware('rolecheck:6');
|
Route::match(['get', 'put'], 'update/{id}', 'StatusController@update')->middleware('rolecheck:6');
|
||||||
Route::match(['get', 'post'], 'create', 'StatusController@create')->middleware('rolecheck:6');
|
Route::match(['get', 'post'], 'create', 'StatusController@create')->middleware('rolecheck:6');
|
||||||
});
|
});
|
||||||
|
Route::group([
|
||||||
|
'prefix' => 'payment-batches'
|
||||||
|
], function() {
|
||||||
|
Route::get('/', 'PaymentBatchController@index')->middleware('rolecheck:6');
|
||||||
|
Route::get('{id}/download', 'PaymentBatchController@download')->middleware('rolecheck:6');
|
||||||
|
});
|
||||||
Route::group([
|
Route::group([
|
||||||
'prefix' => 'postulations'
|
'prefix' => 'postulations'
|
||||||
], function() {
|
], function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user