|
|
@@ -13,6 +13,7 @@ use App\Models\TransactionStatus;
|
|
13
|
13
|
use Illuminate\Database\QueryException;
|
|
14
|
14
|
use Illuminate\Support\Facades\Auth;
|
|
15
|
15
|
use Illuminate\Support\Facades\DB;
|
|
|
16
|
+use Illuminate\Support\Facades\Http;
|
|
16
|
17
|
|
|
17
|
18
|
class TransactionController extends Controller
|
|
18
|
19
|
{
|
|
|
@@ -126,6 +127,13 @@ class TransactionController extends Controller
|
|
126
|
127
|
$thermalPrinting = new ThermalPrinting($transaction);
|
|
127
|
128
|
$thermalPrinting->startPrinting(2);
|
|
128
|
129
|
|
|
|
130
|
+ $customer = Customer::find($request->customer_id);
|
|
|
131
|
+
|
|
|
132
|
+ Http::post('https://gerbangchatapi.dijitalcode.com/chat/send?id=bambslaundry', [
|
|
|
133
|
+ 'receiver' => $customer->phone,
|
|
|
134
|
+ 'message' => 'Terima kasih sudah mempercayakan layanan laundry kepada Bamb\'s Laundry. Nomor transaksi Anda adalah *'.$request->transaction_number.'*',
|
|
|
135
|
+ ]);
|
|
|
136
|
+
|
|
129
|
137
|
return to_route('transactions.index')->with('success', __('Transaksi berhasil ditambahkan'));
|
|
130
|
138
|
} catch (QueryException $e) {
|
|
131
|
139
|
return back()->with('error', __('Penambahan transaksi gagal'));
|
|
|
@@ -194,6 +202,19 @@ class TransactionController extends Controller
|
|
194
|
202
|
{
|
|
195
|
203
|
$transaction->update($request->validated());
|
|
196
|
204
|
|
|
|
205
|
+ if($transaction->transaction_status_id==2) {
|
|
|
206
|
+ $status_message = " sudah diproses, harap menunggu sampai pemberitahuan selanjutnya.";
|
|
|
207
|
+ } else if($transaction->transaction_status_id==3) {
|
|
|
208
|
+ $status_message = " sudah selesai, silahkan diambil.";
|
|
|
209
|
+ } else {
|
|
|
210
|
+ $status_message = " sudah diambil. Silahkan datang lagi di kemudian hari jika ingin laundry kembali, terima kasih.";
|
|
|
211
|
+ }
|
|
|
212
|
+
|
|
|
213
|
+ Http::post('https://gerbangchatapi.dijitalcode.com/chat/send?id=bambslaundry', [
|
|
|
214
|
+ 'receiver' => $transaction->customer->phone,
|
|
|
215
|
+ 'message' => 'Layanan laundry Anda dengan nomor transaksi *'.$transaction->transaction_number.'*'.$status_message,
|
|
|
216
|
+ ]);
|
|
|
217
|
+
|
|
197
|
218
|
return back()->with('success', __('Transaksi berhasil diperbaharui'));
|
|
198
|
219
|
}
|
|
199
|
220
|
|