mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
Merge remote-tracking branch 'origin/development' into development
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
|
||||
use App\Models\Company;
|
||||
|
||||
class UpdatesCompany extends AbstractUpdateRecord
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Company $model
|
||||
* @param CompanyObject $object
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Company $model, CompanyObject $object)
|
||||
{
|
||||
$model->name = $object->getName();
|
||||
$model->reference = $object->getReference();
|
||||
$model->type = $object->getType();
|
||||
|
||||
return $this->handler($model);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\Standards\Rules;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
|
||||
use App\Classes\Modules\Companies\Standards\Validators\CompanyValidation;
|
||||
|
||||
class CanUpdateCompany extends AbstractRule
|
||||
{
|
||||
/** @var CompanyValidation */
|
||||
private $companyValidation;
|
||||
|
||||
|
||||
/**
|
||||
* CanUpdateCompany constructor.
|
||||
* @param CompanyValidation $companyValidation
|
||||
*/
|
||||
public function __construct(CompanyValidation $companyValidation)
|
||||
{
|
||||
$this->companyValidation = $companyValidation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorized(): bool
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CompanyObject $object
|
||||
* @return bool
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
protected function validators($object): bool
|
||||
{
|
||||
return $this->companyValidation->validate($object, 'PUT');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CompanyObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function criteria($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+14
-2
@@ -63,9 +63,21 @@
|
||||
<div class="fs-8 all-caps muted">Company Name</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row" v-if="isEditCompanyName === false">
|
||||
<div class="col">
|
||||
<div class="fs-11 text-primary">{{item.owner.name}}</div>
|
||||
<div class="fs-11 text-primary">{{item.owner.name}} <i class="fa fa-edit pointer fa-fw m-l-5" v-if="$store.getters.isSuperAdmin" @click="isEditCompanyName = !isEditCompanyName"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" v-if="isEditCompanyName === true">
|
||||
<div class="col">
|
||||
<update-company-name-form-component :section="section" :data="item.owner" v-on:submit="isEditCompanyName=false"></update-company-name-form-component>
|
||||
</div>
|
||||
<div class="col-auto d-flex align-items-center">
|
||||
<div class="row">
|
||||
<div class="col b-none btn btn-sm btn-danger" @click="isEditCompanyName = !isEditCompanyName">
|
||||
<i class="fa fa-times"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col p-r-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.name">
|
||||
<input type="text" class="form-control fs-12" placeholder="Edit company name" v-model.trim="parameters.name">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-auto bg-success d-flex justify-content-center align-items-center pointer text-white">
|
||||
<i class="fa fa-check" @click="submitForm"></i>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import modalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
import { required } from "vuelidate/lib/validators";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
name: this.data.name,
|
||||
};
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
name: { required },
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
submitForm() {
|
||||
this.parameters.name = this.data.name;
|
||||
this.submit(this.route('api.company.update', this.data.id), 'put', '', false, false);
|
||||
this.$emit('submit');
|
||||
}
|
||||
},
|
||||
mixins: [modalFormHandler]
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user