a
This commit is contained in:
@@ -13,11 +13,7 @@ class TicketFormCubit extends Cubit<TicketFormState> {
|
||||
TicketFormCubit()
|
||||
: super(
|
||||
// Inizializziamo con un ticket vuoto di default
|
||||
TicketFormState(
|
||||
ticket: TicketModel.empty(
|
||||
companyId: GetIt.I.get<SessionCubit>().state.company!.id!,
|
||||
),
|
||||
),
|
||||
TicketFormState(ticket: TicketModel.empty()),
|
||||
);
|
||||
|
||||
/// 1. INIZIALIZZAZIONE (Se stiamo modificando un ticket esistente)
|
||||
@@ -32,18 +28,15 @@ class TicketFormCubit extends Cubit<TicketFormState> {
|
||||
final currentStore = _sessionCubit.state.currentStore;
|
||||
final companyId = _sessionCubit.state.company?.id ?? '';
|
||||
|
||||
final newTicket =
|
||||
TicketModel.empty(
|
||||
companyId: _sessionCubit.state.company!.id!,
|
||||
).copyWith(
|
||||
companyId: companyId,
|
||||
storeId: currentStore?.id,
|
||||
staffId: currentUser?.id,
|
||||
createdById: currentUser?.name,
|
||||
// Impostiamo lo stato iniziale
|
||||
status: TicketStatus.open,
|
||||
ticketType: TicketType.repair, // Default
|
||||
);
|
||||
final newTicket = TicketModel.empty().copyWith(
|
||||
companyId: companyId,
|
||||
storeId: currentStore?.id,
|
||||
createdById: currentUser?.id,
|
||||
createdByName: currentUser?.name,
|
||||
// Impostiamo lo stato iniziale
|
||||
status: TicketStatus.open,
|
||||
ticketType: TicketType.repair, // Default
|
||||
);
|
||||
|
||||
emit(state.copyWith(ticket: newTicket, status: TicketFormStatus.ready));
|
||||
}
|
||||
@@ -77,7 +70,10 @@ class TicketFormCubit extends Cubit<TicketFormState> {
|
||||
void updateCreator({required String staffId, required String staffName}) {
|
||||
emit(
|
||||
state.copyWith(
|
||||
ticket: state.ticket.copyWith(staffId: staffId, createdById: staffName),
|
||||
ticket: state.ticket.copyWith(
|
||||
createdById: staffId,
|
||||
createdByName: staffName,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user