123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689 |
- <?php
- namespace App\Http\Controllers\Form;
-
- use Illuminate\Http\Request;
- use App\Http\Controllers\Controller;
- use Illuminate\Support\Facades\Auth;
-
- use App\Mail\CustomerInvoice;
- use App\Jobs\SendCustomerInvoice;
-
- use Carbon\Carbon;
- use Validator;
- use File;
-
- use App\Model\Coverage;
- use App\Model\Product;
-
- use App\Model\Form;
- use App\Model\WorkOrder;
- use App\Model\Subscriber;
- use App\Model\PackageDetail;
- use App\Model\FormStatus;
-
- use App\Staff;
- use App\Model\StaffDetail;
-
- class ResidentialController extends Controller
- {
-
- public function successSubmit(){
- return view('sales.form.after_submit_form');
- }
-
- public function successVerified(){
- return view('sales.form.success_verify');
- }
-
- public function sendInvoice($subscriber_id) {
-
- $subscriber = Subscriber::with('Form')->where('subscriber_id',$subscriber_id)->first();
- $form = Form::with('Subscriber','PackageDetail')->where('_id',$subscriber->_id)->first();
- $product = Product::where('speed',$form->PackageDetail->name)->where('formT',$form->type_application)->first();
- SendCustomerInvoice::dispatch($form, $product, $form->Subscriber->email);
-
- return $form->_id;
- }
-
- public function sendInvoice1($subscriber_id) {
-
- $subscriber = Subscriber::with('Form')->where('subscriber_id',$subscriber_id)->first();
- $form = Form::with('Subscriber','PackageDetail')->where('_id',$subscriber->_id)->first();
- $product = Product::where('speed',$form->PackageDetail->name)->where('formT',$form->type_application)->first();
- SendCustomerInvoice::dispatch($form, $product, 'nsakinahs1991@gmail.com');
-
- return $form->_id;
- }
-
- function random_code($limit) {
- return substr(base_convert(sha1(uniqid(mt_rand())), 16, 36), 0, $limit);
- }
-
- public function viewFormAddress($package) {
-
- $dealer_id = '';
- $coverage = Coverage::where('Type','R')->groupBy('building_name')->orderBy('building_name')->get();
- return view('sales.form.residential_address', compact('coverage','package','dealer_id'));
- }
-
- public function viewFormApplication(Request $request) {
- $data = array();
- $coverage = Coverage::where('building_name', $request->coverage)->where('street',$request->street)->get();
-
- array_push($data, array(
- 'coverage' => $coverage[0]['_id'],
- 'unit' => $request->unit,
- 'street' => $request->street,
- 'package' => $request->package
- ));
- return view('sales.form.residential_application_information', compact('data'));
- }
-
- public function viewFormPackage(Request $request) {
- $data = array();
-
- $citizen = ''; $street = '';
- if($request->citizenship == "Malaysian"){
- $citizen = $request->citizenship;
- }
- else {
- $citizen = $request->citizenlist;
- }
-
- if($request->street != null){
- $street = $request->street;
- }
-
- if (!empty($request->nric_passport1)){
- $nokp = $request->nric_passport1;
- }else {
- $nokp = $request->nric_passport2;
- }
-
- array_push($data, array(
- 'coverage' => $request->coverage,
- 'unit' => $request->unit,
- 'street' => $street,
- 'package' => $request->package,
- 'application' => $request->application,
- 'name' => $request->name,
- 'nric_passport' => $nokp,
- 'gender' => $request->gender,
- 'race' => $request->race,
- 'contact_primary' => $request->contact_primary,
- 'contact_secondary' => $request->contact_secondary,
- 'citizenship' => $citizen,
- 'email' => $request->email
- ));
-
- $product = Product::where('formT','R')->where('package_name',$request->package)->first();
-
- return view('sales.form.residential_package', compact('data','product','citizen'));
- }
-
- public function viewFormPreview(Request $request){
- $data = array();
-
- $coverage = Coverage::where('_id',$request->coverage)->first();
- $product = Product::where('formT','R')->where('package_name',$request->package)->first();
- $otc = 0.0; $deposit = 0.0;
-
- $voice = "No";
- if($request->voice == "Yes"){
- $voice = $request->voice;
- $voice_price = 20;
- }else {
- $voice = "No";
- $voice_price = 0;
- }
-
- $total_monthly = 0;
- $gst ='';
- $promo_st = '';
-
- if ($request->package != "1Gbps" && $request->subscription == '24'){
- $promo_price = number_format(floatval($product->retail_price) - 10);
- $promo_st = number_format(floatval($promo_price) * 1.06,2);
- $total_monthly = number_format($promo_st + ($voice_price * 1.06), 2);
- }
- else{
- $gst = number_format(floatval($product->retail_price) * 1.06,2);
- $total_monthly = number_format($gst + ($voice_price * 1.06), 2);
- }
-
- if($request->citizenship != 'Malaysian' && $request->subscription == '12' && $voice == 'No'){
- $otc = 300;
- $deposit = 0;
- }else if($request->citizenship != 'Malaysian' && $request->subscription == '12' && $voice == 'Yes'){
- $otc = 300 + 100;
- $deposit = 0;
- }else if($request->citizenship != 'Malaysian' && $request->subscription == '24' && ($voice == 'No' || $voice == 'Yes')){
- $otc = 0.0;
- $deposit = 300;
- }else if($request->citizenship == 'Malaysian' && $request->subscription == '24' && ($voice == 'No' || $voice == 'Yes')){
- $otc = 0.0;
- $deposit = $product->deposit;
- }else if($request->citizenship == 'Malaysian' && $request->subscription == '12' && $voice == 'No'){
- $otc = 300;
- $deposit = $product->deposit;
- }else if($request->citizenship == 'Malaysian' && $request->subscription == '12' && $voice == 'Yes'){
- $otc = 300 + 100;
- $deposit = $product->deposit;
- }
-
- $otc_st = number_format(floatval($otc) * 1.06,2);
- $upfront_total = number_format(floatval($otc_st) + $deposit,2);
-
-
- array_push($data, array(
- 'coverage' => $request->coverage,
- 'unit' => $request->unit,
- 'street' => $request->street,
- 'package' => $request->package,
- 'application' => $request->application,
- 'name' => $request->name,
- 'nric_passport' => $request->nric_passport,
- 'gender' => $request->gender,
- 'race' => $request->race,
- 'contact_primary' => $request->contact_primary,
- 'contact_secondary' => $request->contact_secondary,
- 'citizenship' => $request->citizenship,
- 'email' => $request->email,
- 'subscription' => $request->subscription,
- 'billing' => $request->billing,
- 'voice' => $voice,
- 'thedate' => $request->thedate,
- ));
-
- return view('sales.form.residential_preview', compact('data', 'coverage', 'product', 'deposit', 'otc', 'otc_st', 'gst', 'promo_price', 'promo_st', 'total_monthly', 'upfront_total'));
- }
-
- public function storeFormData(Request $request){
-
- $su_id = ''; $pathIconF = ''; $pathIconB = ''; $pathVisaF = ''; $pathVisaB = '';
-
- do {
- $su_id = strtoupper('CBB-'.$this->random_code(6).'R');
- } while (Subscriber::where("subscriber_id", "=", $su_id)->first() instanceof Subscriber);
-
-
- $destinationPath = 'document/'.$su_id;
- // create folder/dir if not exist
-
- if(!File::exists(public_path().'/'.$destinationPath)){
- File::makeDirectory(public_path().'/'.$destinationPath,0777,true);
- }
-
- $uploaded = public_path().'/'.$destinationPath;
- // Signature
- $signature_form = $request->cuss_signature;
- $signature_form = str_replace('data:image/jpeg;base64,','',$signature_form);
- $signature_form = str_replace('','+',$signature_form);
- //convert signature_form
- $data = base64_decode($signature_form);
- $file = $uploaded."/signature_form.jpg";
- $savetoServer = file_put_contents($file,$data);
-
- if (($savetoServer === false) || ($savetoServer == -1)) {
- print "Couldn't save signature to jpeg";
- }else {
-
- if($request->hasfile('front_ic')){
-
- $icon = $request->file('front_ic');
- $icon->move($destinationPath,'frontic.'.strtolower($icon->getClientOriginalExtension()));
- $pathIconF = '/'.$destinationPath.'/frontic.'.strtolower($icon->getClientOriginalExtension());
- }
-
- if($request->hasfile('back_ic')){
-
- $icon = $request->file('back_ic');
- $icon->move($destinationPath,'backic.'.strtolower($icon->getClientOriginalExtension()));
- $pathIconB = '/'.$destinationPath.'/backic.'.strtolower($icon->getClientOriginalExtension());
- }
-
- if($request->hasfile('visaF')){
-
- $icon = $request->file('visaF');
- $icon->move($destinationPath,'visaF.'.strtolower($icon->getClientOriginalExtension()));
- $pathVisaF = '/'.$destinationPath.'/visaF.'.strtolower($icon->getClientOriginalExtension());
- }
-
- if($request->hasfile('visaB')){
-
- $icon = $request->file('visaB');
- $icon->move($destinationPath,'visaB.'.strtolower($icon->getClientOriginalExtension()));
- $pathVisaB = '/'.$destinationPath.'/visaB.'.strtolower($icon->getClientOriginalExtension());
- }
-
- $coverage = Coverage::where('_id',$request->coverage)->first();
- $product = Product::where('formT','R')->where('package_name',$request->package)->first();
-
- $sl = Form::create([
- 'type_service' => $request->application,
- 'type_application' => 'R',
- 'project_type' => $coverage->project_type,
- 'status_payment' => 'paid',
- 'status_email' => 'unverified',
- 'customer_category' => 'Allo',
- 'remark_form' => ''
- ]);
-
- $sdl = new Subscriber();
- $sdl->subscriber_id = $su_id;
- $sdl->name = $request->name;
- $sdl->ic = $request->nric_passport;
- $sdl->citizen = $request->citizenship;
- $sdl->gender = $request->gender;
- $sdl->race = $request->race;
- $sdl->email = $request->email;
- $sdl->phone1 = $request->contact_primary;
- $sdl->phone2 = $request->contact_secondary;
- $sdl->unit_no = $request->unit;
- $sdl->building_name = $coverage->building_name;
- $sdl->street = $request->street;
- $sdl->postcode = $coverage->postcode;
- $sdl->city = $coverage->city;
- $sdl->state = $coverage->state;
- $sdl->front_ic = $pathIconF;
- $sdl->back_ic = $pathIconB;
- $sdl->visaF = $pathVisaF;
- $sdl->visaB = $pathVisaB;
- $sdl->signature = '/'.$destinationPath.'/signature_form.jpg';
-
- $packageD = new PackageDetail();
- $packageD->contract = $request->subscription;
- $packageD->name = $product->speed;
- if ($request->gst != null){
- $packageD->montly_fee = $request->gst;
- }else {
- $packageD->montly_fee = $request->promo_st;
- }
- $packageD->voice_fee = $request->voice;
- $packageD->deposit = $request->deposit;
- $packageD->upfront_payment = $request->otc;
- $packageD->rfs = $request->rfs;
-
- $sl->subscriber()->save($sdl);
- $sl->packagedetail()->save($packageD);
-
- $f_id = $this->sendInvoice($su_id);
- $stat = new FormStatus();
- $stat->form_id = $f_id;
- $stat->status_id = 1;
- $stat->date = new \MongoDB\BSON\UTCDateTime(time()*1000);
- $stat->status = 'Submitted';
- $stat->desc = 'The form already been submit';
- $sl->formstatus()->save($stat);
-
- return redirect('http://db.citybroadband.my/residential/application-form/success-submit');
- }
- }
-
- /**
- ** Dealer
- **/
- public function viewFormAddressD($package,$dealer_id) {
-
- $coverage = Coverage::where('Type','R')->groupBy('building_name')->orderBy('building_name')->get();
- $dealer = Staff::where('_id',$dealer_id)->first();
-
- return view('sales.form.dealer.residential_address', compact('coverage','package','dealer_id'));
- }
-
- public function viewFormApplicationD(Request $request) {
- $data = array();
- $coverage = Coverage::where('building_name', $request->coverage)->where('street',$request->street)->get();
-
- array_push($data, array(
- 'coverage' => $coverage[0]['_id'],
- 'unit' => $request->unit,
- 'street' => $request->street,
- 'package' => $request->package,
- 'dealer_id' => $request->dealer_id
- ));
-
- return view('sales.form.dealer.residential_application_information', compact('data'));
- }
-
- public function viewFormPackageD(Request $request) {
- $data = array();
-
- $citizen = ''; $street = '';
- if($request->citizenship == "Malaysian"){
- $citizen = $request->citizenship;
- }
- else {
- $citizen = $request->citizenlist;
- }
-
- if($request->street != null){
- $street = $request->street;
- }
-
- if (!empty($request->nric_passport1)){
- $nokp = $request->nric_passport1;
- }else {
- $nokp = $request->nric_passport2;
- }
-
- array_push($data, array(
- 'dealer_id' => $request->dealer_id,
- 'coverage' => $request->coverage,
- 'unit' => $request->unit,
- 'street' => $street,
- 'package' => $request->package,
- 'application' => $request->application,
- 'name' => $request->name,
- 'nric_passport' => $nokp,
- 'ip' => $request->ip,
- 'gender' => $request->gender,
- 'race' => $request->race,
- 'contact_primary' => $request->contact_primary,
- 'contact_secondary' => $request->contact_secondary,
- 'citizenship' => $citizen,
- 'email' => $request->email
- ));
-
- $product = Product::where('formT','R')->where('package_name',$request->package)->first();
-
- return view('sales.form.dealer.residential_package', compact('data','product','citizen'));
- }
-
- public function viewFormPreviewD(Request $request){
- $data = array();
-
- $coverage = Coverage::where('_id',$request->coverage)->first();
- $product = Product::where('formT','R')->where('package_name',$request->package)->first();
- $otc = 0.0; $deposit = 0.0;
-
- $voice = "No";
- if($request->voice == "Yes"){
- $voice = $request->voice;
- $voice_price = 20;
- }else {
- $voice = "No";
- $voice_price = 0;
- }
-
- $total_monthly = 0;
- $gst ='';
- $promo_st = '';
-
- if ($request->package != "1Gbps" && $request->subscription == '24'){
- $promo_price = number_format(floatval($product->retail_price) - 10);
- $promo_st = number_format(floatval($promo_price) * 1.06,2);
- $total_monthly = number_format($promo_st + ($voice_price * 1.06), 2);
- }
- else{
- $gst = number_format(floatval($product->retail_price) * 1.06,2);
- $total_monthly = number_format($gst + ($voice_price * 1.06), 2);
- }
-
- if($request->citizenship != 'Malaysian' && $request->subscription == '12' && $voice == 'No'){
- $otc = 300;
- $deposit = 0;
- }else if($request->citizenship != 'Malaysian' && $request->subscription == '12' && $voice == 'Yes'){
- $otc = 300 + 100;
- $deposit = 0;
- }else if($request->citizenship != 'Malaysian' && $request->subscription == '24' && ($voice == 'No' || $voice == 'Yes')){
- $otc = 0.0;
- $deposit = 300;
- }else if($request->citizenship == 'Malaysian' && $request->subscription == '24' && ($voice == 'No' || $voice == 'Yes')){
- $otc = 0.0;
- $deposit = $product->deposit;
- }else if($request->citizenship == 'Malaysian' && $request->subscription == '12' && $voice == 'No'){
- $otc = 300;
- $deposit = $product->deposit;
- }else if($request->citizenship == 'Malaysian' && $request->subscription == '12' && $voice == 'Yes'){
- $otc = 300 + 100;
- $deposit = $product->deposit;
- }
-
- $otc_st = number_format(floatval($otc) * 1.06,2);
- $upfront_total = number_format(floatval($otc_st) + $deposit,2);
-
- array_push($data, array(
- 'dealer_id' => $request->dealer_id,
- 'coverage' => $request->coverage,
- 'unit' => $request->unit,
- 'street' => $request->street,
- 'package' => $request->package,
- 'application' => $request->application,
- 'name' => $request->name,
- 'nric_passport' => $request->nric_passport,
- 'gender' => $request->gender,
- 'race' => $request->race,
- 'contact_primary' => $request->contact_primary,
- 'contact_secondary' => $request->contact_secondary,
- 'citizenship' => $request->citizenship,
- 'email' => $request->email,
- 'subscription' => $request->subscription,
- 'billing' => $request->billing,
- 'voice' => $voice,
- 'ip' => $request->ip,
- 'thedate' => $request->thedate,
- ));
-
- return view('sales.form.dealer.residential_preview', compact('data', 'coverage', 'product', 'deposit', 'otc', 'otc_st', 'gst', 'promo_price', 'promo_st', 'total_monthly', 'upfront_total'));
- }
-
- public function storeFormDataD(Request $request){
-
- $su_id = ''; $pathIconF = ''; $pathIconB = ''; $pathVisaF = ''; $pathVisaB = ''; $pathPaymentReceipt=''; $pathSOForm='';
-
- do {
- $su_id = strtoupper('CBB-'.$this->random_code(6).'R');
- } while (Subscriber::where("subscriber_id", "=", $su_id)->first() instanceof Subscriber);
-
-
- $destinationPath = 'document/'.$su_id;
- // create folder/dir if not exist
- if(!File::exists(public_path().'/'.$destinationPath)){
- File::makeDirectory(public_path().'/'.$destinationPath,0777,true);
- }
-
- $uploaded = public_path().'/'.$destinationPath;
- // Signature
- $signature_form = $request->cuss_signature;
- $signature_form = str_replace('data:image/jpeg;base64,','',$signature_form);
- $signature_form = str_replace('','+',$signature_form);
- //convert signature_form
- $data = base64_decode($signature_form);
- $file = $uploaded."/signature_form.jpg";
- $savetoServer = file_put_contents($file,$data);
-
- if (($savetoServer === false) || ($savetoServer == -1)) {
- print "Couldn't save signature to jpeg";
- }else {
-
- if($request->hasfile('front_ic')){
-
- $icon = $request->file('front_ic');
- $icon->move($destinationPath,'frontic.'.strtolower($icon->getClientOriginalExtension()));
- $pathIconF = '/'.$destinationPath.'/frontic.'.strtolower($icon->getClientOriginalExtension());
- }
-
- if($request->hasfile('back_ic')){
-
- $icon = $request->file('back_ic');
- $icon->move($destinationPath,'backic.'.strtolower($icon->getClientOriginalExtension()));
- $pathIconB = '/'.$destinationPath.'/backic.'.strtolower($icon->getClientOriginalExtension());
- }
-
- if($request->hasfile('visaF')){
-
- $icon = $request->file('visaF');
- $icon->move($destinationPath,'visaF.'.strtolower($icon->getClientOriginalExtension()));
- $pathVisaF = '/'.$destinationPath.'/visaF.'.strtolower($icon->getClientOriginalExtension());
- }
-
- if($request->hasfile('visaB')){
-
- $icon = $request->file('visaB');
- $icon->move($destinationPath,'visaB.'.strtolower($icon->getClientOriginalExtension()));
- $pathVisaB = '/'.$destinationPath.'/visaB.'.strtolower($icon->getClientOriginalExtension());
- }
-
- if($request->hasfile('payment_receipt')){
-
- $icon = $request->file('payment_receipt');
- $icon->move($destinationPath,'payment_receipt.'.strtolower($icon->getClientOriginalExtension()));
- $pathPaymentReceipt = '/'.$destinationPath.'/payment_receipt.'.strtolower($icon->getClientOriginalExtension());
- }
-
- if($request->hasfile('so_form')){
-
- $icon = $request->file('so_form');
- $icon->move($destinationPath,'so_form.'.strtolower($icon->getClientOriginalExtension()));
- $pathSOForm = '/'.$destinationPath.'/so_form.'.strtolower($icon->getClientOriginalExtension());
- }
-
- // staff
- $staff = Staff::with('StaffDetail')->where('_id',$request->dealer_id)->first();
- if(!empty($staff)){
- $coverage = Coverage::where('_id',$request->coverage)->first();
- $product = Product::where('formT','R')->where('package_name',$request->package)->first();
-
- $sl = new Form();
- $sl->type_service = $request->application;
- $sl->type_application = 'R';
- $sl->project_type = $coverage->project_type;
- $sl->status_payment = 'paid';
- $sl->status_email = 'unverified';
- $sl->customer_category = 'Allo';
- $sl->remark_form = '';
- $sl->dealer_id = $request->dealer_id;
- $sl->company_id = $staff->StaffDetail->company_id;
-
- $staff->form()->save($sl);
-
- $sdl = new Subscriber();
- $sdl->subscriber_id = $su_id;
- $sdl->name = $request->name;
- $sdl->ic = $request->nric_passport;
- $sdl->citizen = $request->citizenship;
- $sdl->gender = $request->gender;
- $sdl->race = $request->race;
- $sdl->email = $request->email;
- $sdl->phone1 = $request->contact_primary;
- $sdl->phone2 = $request->contact_secondary;
- $sdl->unit_no = $request->unit;
- $sdl->building_name = $coverage->building_name;
- $sdl->street = $request->street;
- $sdl->postcode = $coverage->postcode;
- $sdl->city = $coverage->city;
- $sdl->state = $coverage->state;
- $sdl->front_ic = $pathIconF;
- $sdl->back_ic = $pathIconB;
- $sdl->visaF = $pathVisaF;
- $sdl->visaB = $pathVisaB;
- $sdl->paymentReceipt = $pathPaymentReceipt;
- $sdl->soForm = $pathSOForm;
- $sdl->signature = '/'.$destinationPath.'/signature_form.jpg';
-
- $packageD = new PackageDetail();
- $packageD->contract = $request->subscription;
- $packageD->name = $product->speed;
- if ($request->gst != null){
- $packageD->montly_fee = $request->gst;
- }else {
- $packageD->montly_fee = $request->promo_st;
- }
- $packageD->voice_fee = $request->voice;
- $packageD->deposit = $request->deposit;
- $packageD->upfront_payment = $request->otc;
- $packageD->rfs = $request->rfs;
-
- $sl->subscriber()->save($sdl);
- $sl->packagedetail()->save($packageD);
-
-
- $f_id = $this->sendInvoice($su_id);
- $stat = new FormStatus();
- $stat->form_id = $f_id;
- $stat->status_id = 1;
- $stat->date = new \MongoDB\BSON\UTCDateTime(time()*1000);
- $stat->status = 'Submitted';
- $stat->desc = 'The form already been submit';
- $sl->formstatus()->save($stat);
-
- return redirect('http://db.citybroadband.my/residential/application-form/success-submit');
- }
- }
- }
- function createWorkID(){
- $number = WorkOrder::select('id','wo')->orderBy('created_at','DESC')->first();
- $numberOnly = str_replace('WO-','',$number->wo);
- info('before RC WO'.$numberOnly);
- $numberOnly++;
- info('after RC WO'.$numberOnly);
- return $numberOnly;
- }
-
- public function verifyEmail($subscriber_id){
- $subscriber = Subscriber::where('subscriber_id',$subscriber_id)->first();
- if(!empty($subscriber)){
- $form = Form::where('_id',$subscriber->_id)->first();
- if(!empty($form)){
- if($form->status_email == 'unverified'){
- $form->status_email = 'verified';
- $form->save();
-
- $stat = new FormStatus();
- $stat->form_id = $form->_id;
- $stat->status_id = 2;
- $stat->date = new \MongoDB\BSON\UTCDateTime(time()*1000);
- $stat->status = 'Verified';
- $stat->desc = 'Email already been verified by customer';
- $form->formstatus()->save($stat);
-
- do {
- $woID = 'WO-'.$this->createWorkID();
- } while (WorkOrder::where("wo", "=", $woID)->first() instanceof WorkOrder);
-
- $work_order = new WorkOrder;
- $work_order->img_url = '/assets/img/activation_icon_nRead1.png';
- $work_order->wo = $woID;
- $work_order->nature_work = '';
- $work_order->sub_category = '';
- $work_order->dateTimeStart = '';
- $work_order->dateTimeEnd = '';
- $work_order->contractor_id = '';
- $work_order->installer_id = '';
- $work_order->onu = '';
- $work_order->router = '';
- $work_order->need_phone = '';
- $work_order->no_phone = '';
- $work_order->pppoe_username = '';
- $work_order->pppoe_password = '';
- $work_order->docket_id = '';
- $work_order->remarks_custservice = '';
- $work_order->remarks_installer = '';
- $work_order->status = '';
- $work_order->created_by = '';
-
- $form->workorder()->save($work_order);
-
- return redirect('http://db.citybroadband.my/residential/application-form/success-verified');
- }
- }
- }
- }
-
-
- public function resendEmail($subscriber_id){
- $f_id = $this->sendInvoice($subscriber_id);
- return $f_id;
- }
-
- public function checkEmailTemplate($subscriber_id){
- $subscriber = Subscriber::where('subscriber_id',$subscriber_id)->first();
- if(!empty($subscriber)){
- $form = Form::where('_id',$subscriber->_id)->first();
- $product = Product::where('speed',$form->PackageDetail->name)->where('formT',$form->type_application)->first();
- }
- return view('email.invoice', compact ('form', 'product'));
- }
- }
|