Sign page: added user check for accepting notes of a delivery
This commit is contained in:
@ -22,6 +22,11 @@ class NoteBloc extends Bloc<NoteEvent, NoteState> {
|
||||
on<RemoveNote>(_remove);
|
||||
on<AddImageNote>(_upload);
|
||||
on<RemoveImageNote>(_removeImage);
|
||||
on<ResetNotes>(_reset);
|
||||
}
|
||||
|
||||
Future<void> _reset(ResetNotes event, Emitter<NoteState> emit) async {
|
||||
emit.call(NoteInitial());
|
||||
}
|
||||
|
||||
Future<void> _removeImage(
|
||||
|
||||
@ -9,6 +9,8 @@ class LoadNote extends NoteEvent {
|
||||
final Delivery delivery;
|
||||
}
|
||||
|
||||
class ResetNotes extends NoteEvent {}
|
||||
|
||||
class AddNote extends NoteEvent {
|
||||
AddNote({required this.note, required this.deliveryId});
|
||||
|
||||
|
||||
@ -6,6 +6,9 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:hl_lieferservice/feature/delivery/detail/bloc/delivery_bloc.dart';
|
||||
import 'package:hl_lieferservice/feature/delivery/detail/bloc/delivery_event.dart';
|
||||
import 'package:hl_lieferservice/feature/delivery/detail/bloc/delivery_state.dart';
|
||||
import 'package:hl_lieferservice/feature/delivery/detail/bloc/note_bloc.dart';
|
||||
import 'package:hl_lieferservice/feature/delivery/detail/bloc/note_event.dart';
|
||||
import 'package:hl_lieferservice/feature/delivery/detail/bloc/note_state.dart';
|
||||
import 'package:hl_lieferservice/feature/delivery/detail/presentation/delivery_sign.dart';
|
||||
import 'package:hl_lieferservice/feature/delivery/detail/presentation/steps/step.dart';
|
||||
import 'package:hl_lieferservice/feature/delivery/overview/bloc/tour_bloc.dart';
|
||||
@ -35,6 +38,11 @@ class _DeliveryDetailState extends State<DeliveryDetail> {
|
||||
LoadDeliveryEvent(delivery: widget.delivery),
|
||||
);
|
||||
|
||||
// Reset Note BLOC
|
||||
// otherwise the notes of the previously
|
||||
// opened delivery would be loaded
|
||||
context.read<NoteBloc>().add(ResetNotes());
|
||||
|
||||
// Initialize steps
|
||||
_step = 0;
|
||||
_steps = [
|
||||
@ -120,10 +128,8 @@ class _DeliveryDetailState extends State<DeliveryDetail> {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(context) => SignatureView(
|
||||
onSigned: _onSign,
|
||||
customer: widget.delivery.customer,
|
||||
),
|
||||
(context) =>
|
||||
SignatureView(onSigned: _onSign, delivery: widget.delivery),
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -176,13 +182,16 @@ class _DeliveryDetailState extends State<DeliveryDetail> {
|
||||
listener: (context, state) {
|
||||
if (state is DeliveryFinished) {
|
||||
final tourState = context.read<TourBloc>().state as TourLoaded;
|
||||
final newTour = tourState.tour.copyWith(deliveries: tourState.tour.deliveries.map((delivery) {
|
||||
if (delivery.id == state.delivery.id) {
|
||||
return state.delivery;
|
||||
}
|
||||
final newTour = tourState.tour.copyWith(
|
||||
deliveries:
|
||||
tourState.tour.deliveries.map((delivery) {
|
||||
if (delivery.id == state.delivery.id) {
|
||||
return state.delivery;
|
||||
}
|
||||
|
||||
return delivery;
|
||||
}).toList());
|
||||
return delivery;
|
||||
}).toList(),
|
||||
);
|
||||
|
||||
context.read<TourBloc>().add(UpdateTour(tour: newTour));
|
||||
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:hl_lieferservice/feature/delivery/detail/bloc/note_bloc.dart';
|
||||
import 'package:hl_lieferservice/feature/delivery/detail/bloc/note_event.dart';
|
||||
import 'package:hl_lieferservice/feature/delivery/detail/bloc/note_state.dart';
|
||||
import 'package:hl_lieferservice/model/customer.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hl_lieferservice/model/delivery.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:signature/signature.dart';
|
||||
|
||||
@ -9,14 +14,18 @@ class SignatureView extends StatefulWidget {
|
||||
const SignatureView({
|
||||
super.key,
|
||||
required this.onSigned,
|
||||
required this.customer,
|
||||
required this.delivery,
|
||||
});
|
||||
|
||||
final Customer customer;
|
||||
final Delivery delivery;
|
||||
|
||||
/// Callback that is called when the user has signed.
|
||||
/// The parameter stores the path to the image file of the signature.
|
||||
final void Function(Uint8List customerSignaturePng, Uint8List driverSignaturePng) onSigned;
|
||||
final void Function(
|
||||
Uint8List customerSignaturePng,
|
||||
Uint8List driverSignaturePng,
|
||||
)
|
||||
onSigned;
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _SignatureViewState();
|
||||
@ -37,10 +46,18 @@ class _SignatureViewState extends State<SignatureView> {
|
||||
|
||||
bool _isDriverSigning = false;
|
||||
bool _customerAccepted = false;
|
||||
bool _noteAccepted = false;
|
||||
bool _notesEmpty = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
// only load notes if they are not already loaded
|
||||
final noteState = context.read<NoteBloc>().state;
|
||||
if (noteState is NoteInitial) {
|
||||
context.read<NoteBloc>().add(LoadNote(delivery: widget.delivery));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@ -56,6 +73,124 @@ class _SignatureViewState extends State<SignatureView> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _notes() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 15),
|
||||
child: Text(
|
||||
"Notizen",
|
||||
style: Theme.of(context).textTheme.headlineSmall,
|
||||
),
|
||||
),
|
||||
BlocConsumer<NoteBloc, NoteState>(
|
||||
listener: (context, state) {
|
||||
final current = state;
|
||||
if (current is NoteLoaded) {
|
||||
setState(() {
|
||||
_notesEmpty = current.notes.isEmpty;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
builder: (context, state) {
|
||||
final current = state;
|
||||
|
||||
if (current is NoteLoaded) {
|
||||
if (current.notes.isEmpty) {
|
||||
return const SizedBox(
|
||||
width: double.infinity,
|
||||
child: Center(child: Text("Keine Notizen vorhanden")),
|
||||
);
|
||||
}
|
||||
|
||||
return ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (context, index) {
|
||||
return ListTile(
|
||||
leading: const Icon(Icons.event_note_outlined),
|
||||
title: Text(current.notes[index].content),
|
||||
contentPadding: EdgeInsets.all(20),
|
||||
tileColor: Theme.of(context).colorScheme.onSecondary,
|
||||
);
|
||||
},
|
||||
separatorBuilder: (context, index) => const Divider(height: 0),
|
||||
itemCount: current.notes.length,
|
||||
);
|
||||
}
|
||||
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
const Padding(padding: EdgeInsets.only(top: 25), child: Divider()),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _customerCheckboxes() {
|
||||
return !_isDriverSigning
|
||||
? Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 25, bottom: 0),
|
||||
child: _notes(),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 25.0, bottom: 0),
|
||||
child: Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
value: _noteAccepted,
|
||||
onChanged:
|
||||
_notesEmpty
|
||||
? null
|
||||
: (value) {
|
||||
setState(() {
|
||||
_noteAccepted = value!;
|
||||
});
|
||||
},
|
||||
),
|
||||
const Flexible(
|
||||
child: Text(
|
||||
"Ich nehme die oben genannten Anmerkungen zur Lieferung zur Kenntnis.",
|
||||
overflow: TextOverflow.fade,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 25.0, bottom: 10.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
value: _customerAccepted,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_customerAccepted = value!;
|
||||
});
|
||||
},
|
||||
),
|
||||
const Flexible(
|
||||
child: Text(
|
||||
"Ich bestätige, dass ich die Ware im ordnungsgemäßen Zustand erhalten habe und, dass die Aufstell- und Einbauarbeiten korrekt durchgeführt wurden.",
|
||||
overflow: TextOverflow.fade,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Container();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String formattedDate = DateFormat("dd.MM.yyyy").format(DateTime.now());
|
||||
@ -69,73 +204,50 @@ class _SignatureViewState extends State<SignatureView> {
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
child: ListView(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: DecoratedBox(
|
||||
decoration: const BoxDecoration(color: Colors.white),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"Lieferung an: ${widget.customer.name}",
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
height:
|
||||
MediaQuery.of(context).size.height *
|
||||
(_isDriverSigning ? 0.75 : 0.5),
|
||||
child: DecoratedBox(
|
||||
decoration: const BoxDecoration(color: Colors.white),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"Lieferung an: ${widget.delivery.customer.name}",
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Expanded(child: _signatureField()),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(child: _signatureField()),
|
||||
],
|
||||
),
|
||||
const Divider(),
|
||||
Text(
|
||||
"${widget.customer.address.city}, den $formattedDate",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(),
|
||||
Text(
|
||||
"${widget.delivery.customer.address.city}, den $formattedDate",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
!_isDriverSigning
|
||||
? Padding(
|
||||
padding: const EdgeInsets.only(top: 25.0, bottom: 25.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
value: _customerAccepted,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_customerAccepted = value!;
|
||||
});
|
||||
},
|
||||
),
|
||||
const Flexible(
|
||||
child: Text(
|
||||
"Ich bestätige, dass ich die Ware im ordnungsgemäßen Zustand erhalten habe und, dass die Aufstell- und Einbauarbeiten korrekt durchgeführt wurden.",
|
||||
overflow: TextOverflow.fade,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
_customerCheckboxes(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 25.0, bottom: 25.0),
|
||||
child: Center(
|
||||
child: FilledButton(
|
||||
onPressed:
|
||||
!_customerAccepted
|
||||
!(_customerAccepted && (_noteAccepted || _notesEmpty))
|
||||
? null
|
||||
: () async {
|
||||
if (!_isDriverSigning) {
|
||||
|
||||
@ -19,7 +19,7 @@ import '../../../../util.dart';
|
||||
import '../../../authentication/exceptions.dart';
|
||||
|
||||
class NoteService extends ErpFrameService {
|
||||
NoteService({required super.config});
|
||||
NoteService({required super.backendUrl});
|
||||
|
||||
Future<void> deleteNote(int noteId) async {
|
||||
try {
|
||||
@ -210,20 +210,31 @@ class NoteService extends ErpFrameService {
|
||||
}
|
||||
|
||||
String uploadId = data["uploadId"];
|
||||
http.MultipartRequest request =
|
||||
http.MultipartRequest("POST", Uri.parse("$basePath/$uploadId"));
|
||||
http.MultipartRequest request = http.MultipartRequest(
|
||||
"POST",
|
||||
Uri.parse("$basePath/$uploadId"),
|
||||
);
|
||||
|
||||
HashMap<String, String> header = HashMap();
|
||||
header["Content-Type"] = "multipart/form-data";
|
||||
header.addAll(getSessionOrThrow());
|
||||
|
||||
request.headers.addAll(header);
|
||||
request.files.add(http.MultipartFile.fromBytes("file", bytes,
|
||||
request.files.add(
|
||||
http.MultipartFile.fromBytes(
|
||||
"file",
|
||||
bytes,
|
||||
filename: filename,
|
||||
contentType: MediaType.parse(mimeType ?? "application/octet-stream")));
|
||||
contentType: MediaType.parse(mimeType ?? "application/octet-stream"),
|
||||
),
|
||||
);
|
||||
|
||||
http.Response fileUploadResponse = await http.Response.fromStream(await request.send());
|
||||
Map<String, dynamic> fileUploadResponseJson = jsonDecode(fileUploadResponse.body);
|
||||
http.Response fileUploadResponse = await http.Response.fromStream(
|
||||
await request.send(),
|
||||
);
|
||||
Map<String, dynamic> fileUploadResponseJson = jsonDecode(
|
||||
fileUploadResponse.body,
|
||||
);
|
||||
|
||||
debugPrint("UPLOAD IMAGE RESPONSE: ${fileUploadResponse.body}");
|
||||
|
||||
@ -233,7 +244,10 @@ class NoteService extends ErpFrameService {
|
||||
throw NoteImageAddException();
|
||||
}
|
||||
|
||||
var fileCommitResponse = await http.patch(Uri.parse("$basePath/$uploadId"), headers: getSessionOrThrow());
|
||||
var fileCommitResponse = await http.patch(
|
||||
Uri.parse("$basePath/$uploadId"),
|
||||
headers: getSessionOrThrow(),
|
||||
);
|
||||
debugPrint("FILE COMMIT BODY: ${fileCommitResponse.body}");
|
||||
var fileCommitResponseJson = jsonDecode(fileCommitResponse.body);
|
||||
|
||||
@ -251,7 +265,7 @@ class NoteService extends ErpFrameService {
|
||||
try {
|
||||
return urls.map((url) async {
|
||||
return (await http.get(
|
||||
Uri.parse("${config.backendUrl}$url"),
|
||||
Uri.parse("$backendUrl$url"),
|
||||
headers: getSessionOrThrow(),
|
||||
)).bodyBytes;
|
||||
}).toList();
|
||||
|
||||
@ -13,7 +13,6 @@ import 'package:hl_lieferservice/model/car.dart';
|
||||
import 'package:hl_lieferservice/model/delivery.dart';
|
||||
import 'package:hl_lieferservice/model/tour.dart';
|
||||
import 'package:hl_lieferservice/util.dart';
|
||||
import 'package:hl_lieferservice/services/erpframe.dart';
|
||||
import 'package:http/http.dart';
|
||||
|
||||
import '../../../../dto/basic_response.dart';
|
||||
@ -23,20 +22,17 @@ import '../../../../dto/discount_update_response.dart';
|
||||
import '../../../../dto/scan_response.dart';
|
||||
import '../../../authentication/exceptions.dart';
|
||||
|
||||
class DeliveryInfoService extends ErpFrameService {
|
||||
DeliveryInfoService({required super.config});
|
||||
class DeliveryInfoService {
|
||||
DeliveryInfoService();
|
||||
|
||||
Future<void> updateDelivery(Delivery delivery) async {
|
||||
try {
|
||||
var headers = {
|
||||
"Content-Type": "application/json"
|
||||
};
|
||||
var headers = {"Content-Type": "application/json"};
|
||||
headers.addAll(getSessionOrThrow());
|
||||
|
||||
debugPrint(getSessionOrThrow().toString());
|
||||
debugPrint(jsonEncode(DeliveryUpdateDTO.fromEntity(delivery).toJson()));
|
||||
|
||||
|
||||
var response = await post(
|
||||
urlBuilder("_web_updateDelivery"),
|
||||
headers: headers,
|
||||
@ -70,9 +66,7 @@ class DeliveryInfoService extends ErpFrameService {
|
||||
|
||||
Future<void> assignCar(String deliveryId, String carId) async {
|
||||
try {
|
||||
var headers = {
|
||||
"Content-Type": "application/json"
|
||||
};
|
||||
var headers = {"Content-Type": "application/json"};
|
||||
headers.addAll(getSessionOrThrow());
|
||||
|
||||
var response = await post(
|
||||
@ -87,7 +81,7 @@ class DeliveryInfoService extends ErpFrameService {
|
||||
|
||||
Map<String, dynamic> responseJson = jsonDecode(response.body);
|
||||
DeliveryUpdateResponseDTO responseDto =
|
||||
DeliveryUpdateResponseDTO.fromJson(responseJson);
|
||||
DeliveryUpdateResponseDTO.fromJson(responseJson);
|
||||
|
||||
if (responseDto.code == "200") {
|
||||
return;
|
||||
@ -118,23 +112,29 @@ class DeliveryInfoService extends ErpFrameService {
|
||||
if (response.statusCode == HttpStatus.unauthorized) {
|
||||
throw UserUnauthorized();
|
||||
}
|
||||
|
||||
DeliveryResponseDTO responseDto =
|
||||
DeliveryResponseDTO.fromJson(jsonDecode(response.body));
|
||||
|
||||
DeliveryResponseDTO responseDto = DeliveryResponseDTO.fromJson(
|
||||
jsonDecode(response.body),
|
||||
);
|
||||
|
||||
return Tour(
|
||||
discountArticleNumber: responseDto.discountArticleNumber,
|
||||
date: DateTime.now(),
|
||||
deliveries: responseDto.deliveries.map(Delivery.fromDTO).toList(),
|
||||
paymentMethods: [],
|
||||
driver: Driver(
|
||||
cars: responseDto.driver.cars
|
||||
.map((carDto) =>
|
||||
Car(id: int.parse(carDto.id), plate: carDto.plate))
|
||||
discountArticleNumber: responseDto.discountArticleNumber,
|
||||
date: DateTime.now(),
|
||||
deliveries: responseDto.deliveries.map(Delivery.fromDTO).toList(),
|
||||
paymentMethods: [],
|
||||
driver: Driver(
|
||||
cars:
|
||||
responseDto.driver.cars
|
||||
.map(
|
||||
(carDto) =>
|
||||
Car(id: int.parse(carDto.id), plate: carDto.plate),
|
||||
)
|
||||
.toList(),
|
||||
teamNumber: int.parse(responseDto.driver.id),
|
||||
name: responseDto.driver.name,
|
||||
salutation: responseDto.driver.salutation));
|
||||
teamNumber: int.parse(responseDto.driver.id),
|
||||
name: responseDto.driver.name,
|
||||
salutation: responseDto.driver.salutation,
|
||||
),
|
||||
);
|
||||
} catch (e, stacktrace) {
|
||||
debugPrint(e.toString());
|
||||
debugPrint(stacktrace.toString());
|
||||
@ -157,8 +157,9 @@ class DeliveryInfoService extends ErpFrameService {
|
||||
}
|
||||
|
||||
Map<String, dynamic> responseJson = jsonDecode(response.body);
|
||||
PaymentMethodListDTO responseDto =
|
||||
PaymentMethodListDTO.fromJson(responseJson);
|
||||
PaymentMethodListDTO responseDto = PaymentMethodListDTO.fromJson(
|
||||
responseJson,
|
||||
);
|
||||
|
||||
return responseDto.paymentMethods;
|
||||
} catch (e, st) {
|
||||
@ -171,7 +172,10 @@ class DeliveryInfoService extends ErpFrameService {
|
||||
}
|
||||
|
||||
Future<String?> unscanArticle(
|
||||
String internalId, int amount, String reason) async {
|
||||
String internalId,
|
||||
int amount,
|
||||
String reason,
|
||||
) async {
|
||||
try {
|
||||
var response = await post(
|
||||
urlBuilder("_web_unscanArticle"),
|
||||
@ -179,7 +183,7 @@ class DeliveryInfoService extends ErpFrameService {
|
||||
body: {
|
||||
"article_id": internalId,
|
||||
"amount": amount.toString(),
|
||||
"reason": reason
|
||||
"reason": reason,
|
||||
},
|
||||
);
|
||||
|
||||
@ -234,7 +238,10 @@ class DeliveryInfoService extends ErpFrameService {
|
||||
}
|
||||
|
||||
Future<DiscountAddResponseDTO> addDiscount(
|
||||
String deliveryId, int discount, String note) async {
|
||||
String deliveryId,
|
||||
int discount,
|
||||
String note,
|
||||
) async {
|
||||
try {
|
||||
var response = await post(
|
||||
urlBuilder("_web_addDiscount"),
|
||||
@ -242,7 +249,7 @@ class DeliveryInfoService extends ErpFrameService {
|
||||
body: {
|
||||
"delivery_id": deliveryId,
|
||||
"discount": discount.toString(),
|
||||
"note": note
|
||||
"note": note,
|
||||
},
|
||||
);
|
||||
|
||||
@ -268,9 +275,7 @@ class DeliveryInfoService extends ErpFrameService {
|
||||
var response = await post(
|
||||
urlBuilder("_web_removeDiscount"),
|
||||
headers: getSessionOrThrow(),
|
||||
body: {
|
||||
"delivery_id": deliveryId,
|
||||
},
|
||||
body: {"delivery_id": deliveryId},
|
||||
);
|
||||
|
||||
if (response.statusCode == HttpStatus.unauthorized) {
|
||||
@ -291,16 +296,15 @@ class DeliveryInfoService extends ErpFrameService {
|
||||
}
|
||||
|
||||
Future<DiscountUpdateResponseDTO> updateDiscount(
|
||||
String deliveryId, String? note, int? discount) async {
|
||||
String deliveryId,
|
||||
String? note,
|
||||
int? discount,
|
||||
) async {
|
||||
try {
|
||||
var response = await post(
|
||||
urlBuilder("_web_updateDiscount"),
|
||||
headers: getSessionOrThrow(),
|
||||
body: {
|
||||
"delivery_id": deliveryId,
|
||||
"discount": discount,
|
||||
"note": note
|
||||
},
|
||||
body: {"delivery_id": deliveryId, "discount": discount, "note": note},
|
||||
);
|
||||
|
||||
if (response.statusCode == HttpStatus.unauthorized) {
|
||||
@ -336,9 +340,7 @@ class DeliveryInfoService extends ErpFrameService {
|
||||
|
||||
Map<String, dynamic> responseJson = jsonDecode(response.body);
|
||||
debugPrint(responseJson.toString());
|
||||
ScanResponseDTO responseDto = ScanResponseDTO.fromJson(
|
||||
responseJson,
|
||||
);
|
||||
ScanResponseDTO responseDto = ScanResponseDTO.fromJson(responseJson);
|
||||
|
||||
if (responseDto.succeeded == true) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user