mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-25 15:34:09 +00:00
Merge branch 'vapor/production' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into vapor/staging
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Services\FetchesContact;
|
||||
use App\Classes\Modules\Contacts\Services\UpdatesContact;
|
||||
use App\Http\Resources\ContactResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateCompanyContactNumberLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Updated Company Contact Number',
|
||||
'message' => 'You have successfully updated the Company Contact Number'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var FetchesContact */
|
||||
private $fetchesContact;
|
||||
|
||||
/** @var UpdatesContact */
|
||||
private $updatesContact;
|
||||
|
||||
/**
|
||||
* UpdateCompanyControllersLogic constructor.
|
||||
* @param FetchesContact $fetchesContact
|
||||
* @param UpdatesContact $updatesContact
|
||||
*/
|
||||
public function __construct(FetchesContact $fetchesContact, UpdatesContact $updatesContact)
|
||||
{
|
||||
$this->fetchesContact = $fetchesContact;
|
||||
$this->updatesContact = $updatesContact;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$query = $this->fetchesContact->execute(['id' => $request->input('id')]);
|
||||
|
||||
$contact = new ContactObject(
|
||||
$query->first()->reference,
|
||||
$request->input('contactNumber'),
|
||||
$query->first()->email,
|
||||
$query->first()->wechat_id
|
||||
);
|
||||
|
||||
$this->updatesContact->execute($query, $contact);
|
||||
|
||||
return $this->resourceResponse(new ContactResource($query));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Companies;
|
||||
|
||||
use App\Classes\Modules\Companies\ControllersLogic\UpdateCompanyContactNumberLogic;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateCompanyContactNumberController extends Controller
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param UpdateCompanyLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(Request $request, UpdateCompanyContactNumberLogic $logic): JsonResponse
|
||||
{
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -118,7 +118,15 @@
|
||||
<div class="row align-items-center m-b-5">
|
||||
<div class="col">
|
||||
<h6 class="no-margin fs-12">Contact Number</h6>
|
||||
<h6 class="no-margin">{{item.contact.phone}}</h6>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="changeCustomerContactNumber">
|
||||
<change-customer-contact-number-form-component :section="'customerProfileSection'" :data="item"></change-customer-contact-number-form-component>
|
||||
</modal-component>
|
||||
<h6 class="no-margin">
|
||||
{{item.contact.phone}}
|
||||
<div class="btn btn-xs b-rad-none pointer requestModal d-inline rounded no-border hover-primary bg-transparent" data-type="changeCustomerContactNumber" v-if="$store.getters.isAdmin">
|
||||
<i class="fa fa-edit pointer fa-fw fs-15 m-l-5"></i>
|
||||
</div>
|
||||
</h6>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="row align-items-center">
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<div class="row" style="width: 450px; margin: auto;" @keyup.enter="submitForm">
|
||||
<div class="col bg-white padding-40 b-rad-lg">
|
||||
<div class="row m-b-10">
|
||||
<div class="col text-center">
|
||||
<h3>Edit Contact Number</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<validation-wrapper-component class="m-b-15" :validator="$v.parameters.contactNumber">
|
||||
<label class="text-primary">Contact Number</label>
|
||||
<input class="form-control" v-model="parameters.contactNumber">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-15">
|
||||
<div class="col-auto p-r-5">
|
||||
<div class="btn btn-lg btn-default b-rad-none" data-dismiss="modal">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-primary w-100 btn-lg" @click="submitForm">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import modalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
import { required, minLength } from "vuelidate/lib/validators";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
parameters: {
|
||||
id: this.data.contact.id,
|
||||
contactNumber: this.data.contact.phone,
|
||||
}
|
||||
};
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
contactNumber: {
|
||||
required,
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitForm() {
|
||||
this.submit(this.route('api.company.update.contactNumber', this.data.id), 'put', this.section, true, true)
|
||||
}
|
||||
},
|
||||
mixins: [modalFormHandler]
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -10,6 +10,7 @@ Route::group(['prefix' => 'company', 'as' => 'company.', 'namespace' => 'Compani
|
||||
Route::delete('/delete/{id}', 'DeleteCompanyController@destroy')->name('delete');
|
||||
Route::put('/name-and-debtor/update/{id}', 'UpdateCompanyNameAndDebtorController@update')->name('update.nameAndDebtor');
|
||||
Route::post('/update-credit-term/{id}', 'UpdateCompanyCreditTermStatusController@update')->name('update.creditterm.status');
|
||||
Route::put('/contact-number/update/{id}', 'UpdateCompanyContactNumberController@update')->name('update.contactNumber');
|
||||
Route::put('/type/update/{id}', 'UpdateCompanyTypeController@create')->name('update.type');
|
||||
|
||||
Route::post('/team/create', 'AddNewMemberController@create')->name('team.create');
|
||||
|
||||
Reference in New Issue
Block a user